Ticket.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 17 Dec 2018 06:43:35 +0000 (14:43 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 17 Dec 2018 06:43:35 +0000 (14:43 +0800)
Ticket.vala

Ticket.bjs
Ticket.vala

index c2b7c41..283f899 100644 (file)
         },
         {
          "listeners" : {
-          "clicked" : "() => {\n\tGLib.debug(\"fire response = 1\");\n\t\n\t\n\tvar invalid = true;\n\t\n\t// validate first...\n\tthis.el.get_style_context().add_class(\"suggested-action\");\n\t\n\t\n\t\n\t\n\t\n\t_this.el.response(1);\n}"
+          "clicked" : "() => {\n\tGLib.debug(\"fire response = 1\");\n\t\n\t\n\tvar invalid = false;\n\t\n\t// validate first...\n\tthis.project_id.el.get_style_context().remove_class(\"warning\");\t\n\tthis.project_id.getProjectId() == \"\") {\n\t\tthis.project_id.el.get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t\n\t\n\tif (invalid) {\n\t\treturn;\n\t}\n\t\n\t_this.el.response(1);\n}"
          },
          "label" : "Create Ticket",
          "* init" : "{\n   this.el.get_style_context().add_class(\"suggested-action\");\n}\n",
index a3f337f..bc6818d 100644 (file)
@@ -1163,14 +1163,20 @@ public class Ticket : Object
                GLib.debug("fire response = 1");
                
                
-               var invalid = true;
+               var invalid = false;
                
                // validate first...
-               this.el.get_style_context().add_class("suggested-action");
-               
+               this.project_id.el.get_style_context().remove_class("warning"); 
+               this.project_id.getProjectId() == "") {
+                       this.project_id.el.get_style_context().add_class("warning");
+                       invalid = true;
+               }
                
                
                
+               if (invalid) {
+                       return;
+               }
                
                _this.el.response(1);
             });