More layout work, and set the flow properly between the different states
authorAndy Allan <gravitystorm@gmail.com>
Wed, 24 Nov 2010 14:59:33 +0000 (14:59 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Wed, 24 Nov 2010 14:59:33 +0000 (14:59 +0000)
net/systemeD/potlatch2/BugLayer.as
net/systemeD/potlatch2/panels/BugPanel.mxml

index 4ccee60..95572a2 100644 (file)
@@ -14,10 +14,10 @@ package net.systemeD.potlatch2 {
         private var apiKey:String;
 
         // as strings, since that's how they are in tags and http calls
-        private var BUG_STATUS_OPEN:String = "1";
-        private var BUG_STATUS_FIXED:String = "2";
-        private var BUG_STATUS_INVALID:String = "3"; // or 'non-reproduceable'
-        private static const status:Array = ["", "open", "fixed", "invalid"];
+        public static var BUG_STATUS_OPEN:String = "1";
+        public static var BUG_STATUS_FIXED:String = "2";
+        public static var BUG_STATUS_INVALID:String = "3"; // or 'non-reproduceable'
+        public static const status:Array = ["", "open", "fixed", "invalid"];
 
         public function BugLayer(n:String, map:Map, s:String, baseUrl:String, apiKey:String) {
             this.baseUrl = baseUrl;
index 771944b..ab91673 100644 (file)
@@ -4,26 +4,36 @@
     Bug Panel
 -->
 
-<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%">
+<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%" paddingTop="10">
   <mx:HBox>
-    <mx:Image source="{bugImage}"/>
-    <mx:Text text="{bugTitle}"/>
+    <mx:Image source="{bugImage}" width="32" height="32" />
+    <mx:Text text="{bugTitle}" fontWeight="bold" fontSize="18" />
+  </mx:HBox>
+  <mx:HBox>
+    <mx:Text text="Created:" />
+    <mx:Text text="{bugCreated}" />
+  </mx:HBox>
+  <mx:HBox>
+    <mx:Text text="Updated:" />
+    <mx:Text text="{bugUpdated}" />
   </mx:HBox>
-  <mx:Text text="Description:" />
-  <mx:TextArea editable="false" text="{bugDescription}" width="100%" />
   <mx:HBox>
     <mx:Text text="Type of bug: " />
     <mx:Text text="{bugType}" fontWeight="bold"/>
   </mx:HBox>
-  <mx:ViewStack id="bugControlStack" resizeToContent="true">
-    <mx:HBox id="bugClosed">
-      <mx:Text text="This bug has been marked as (fixed/Invalid)" />
+  <mx:TextArea editable="false" text="{bugDescription}" width="100%" fontSize="14" minHeight="100" maxHeight="400"/>
+
+  <mx:ViewStack id="bugControlStack" resizeToContent="true" width="100%">
+    <mx:HBox id="bugFixed" backgroundColor="#ddffdd" width="100%" padding>
+      <mx:Text text="This bug has been marked as Fixed" width="100%"/>
     </mx:HBox>
-    <mx:HBox id="bugControl" horizontalAlign="right" width="100%" visible="false">
+    <mx:HBox id="bugInvalid" backgroundColor="#dddddd" width="100%">
+      <mx:Text text="This bug has been marked as Invalid" width="100%"/>
+    </mx:HBox>
+    <mx:HBox id="bugControl" horizontalAlign="right" width="100%">
       <mx:LinkButton label="Add Comment" enabled="false" />
       <mx:LinkButton label="Close Bug" click="bugControlStack.selectedChild=closeBugVBox;" />
     </mx:HBox>
-
     <mx:VBox id="closeBugVBox" visible="false">
       <mx:Text><mx:text>Add your comment and close the bug</mx:text></mx:Text>
       <mx:Label><mx:text>NickName</mx:text></mx:Label>
@@ -36,6 +46,7 @@
       </mx:HBox>
     </mx:VBox>
   </mx:ViewStack>
+
   <mx:Script><![CDATA[
 
       import net.systemeD.halcyon.connection.*;
@@ -52,6 +63,8 @@
       [Bindable] private var bugType:String;
       [Bindable] private var bugImage:String;
       [Bindable] private var bugTitle:String;
+      [Bindable] private var bugCreated:String;
+      [Bindable] private var bugUpdated:String;
 
       public function init(entity:Entity, layer:VectorLayer):void {
             this.layer = layer;
             bugDescription = selectedEntity.getTag("description");
             bugType = selectedEntity.getTag("type").replace(/_/g, " ");
             bugImage = 'features/bugs/'+bugStatus+'.png';
+            bugCreated = selectedEntity.getTag("date_created");
+            bugUpdated = selectedEntity.getTag("date_updated");
 
-            if (layer is BugLayer) {
-              bugControl.visible = true;
+            if ( bugStatus == BugLayer.status[int(BugLayer.BUG_STATUS_FIXED)] ) {
+              bugControlStack.selectedChild = bugFixed;
+            } else if ( bugStatus == BugLayer.status[int(BugLayer.BUG_STATUS_INVALID)] ) {
+              bugControlStack.selectedChild = bugInvalid;
+            } else {
+              bugControlStack.selectedChild = bugControl;
             }
       }
 
@@ -74,6 +93,7 @@
               BugLayer(layer).closeBug(selectedEntity as Marker, nickName.text, closeComment.text);
             }
             bugStatus = selectedEntity.getTag("status");
+            bugControlStack.selectedChild = bugFixed;
       }
 
       ]]>