Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. function addproject() {
  2. $('#create').css('display','block');
  3. }
  4. $("#close").click(function(){
  5. $('#create').css('display','none');
  6. });
  7. var consodata = "";
  8. function createproject() {
  9. datacreate = {
  10. name: $('#name').val(),
  11. projectId: $('#projectId').val()
  12. }
  13. api.post("/project", datacreate, function(success, data){
  14. if (success) {
  15. console.log(data);
  16. consodata = "Create New Project Success";
  17. var currentproject = [{
  18. id: data._id,
  19. name: data.name
  20. }];
  21. localStorage.setItem('Current-Project', JSON.stringify(currentproject));
  22. window.location.replace("/product/project/setting");
  23. } else if (data == 604) {
  24. consodata = "ProjectId was existed";
  25. } else {
  26. consodata = "Create Fail";
  27. //add error form server
  28. }
  29. })
  30. }
  31. function checkNameProject() {
  32. var name = document.getElementById('name');
  33. var filter = /^[A-z0-9\ \S]{1,}$/;
  34.  
  35. if (!filter.test(name.value)) {
  36. $("#name").css({
  37. 'color': 'red',
  38. 'border-color': 'red'
  39. })
  40. }
  41. else
  42. {
  43. $("#name").css({
  44. 'color' : '#45B2B4',
  45. 'border-color' : '#45B2B4'
  46. })
  47. }
  48. }
  49. function checkProjectId() {
  50. var projectid = document.getElementById('projectId');
  51. var filter = /^[A-z0-9\.\=\+\/\S]{1,}$/;
  52.  
  53. if (!filter.test(projectid.value)) {
  54. $("#projectId").css({
  55. 'color': 'red',
  56. 'border-color': 'red'
  57. })
  58. }
  59. else
  60. {
  61. $("#projectId").css({
  62. 'color' : '#45B2B4',
  63. 'border-color' : '#45B2B4'
  64. })
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement