This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9e4bc4f  todomvc-jewel-example: fix some issues when filtering and 
styles and add foooter credits
9e4bc4f is described below

commit 9e4bc4f8ccefa7a0cbb226244e7772382f83ee72
Author: Carlos Rovira <[email protected]>
AuthorDate: Wed Jan 29 12:26:45 2020 +0100

    todomvc-jewel-example: fix some issues when filtering and styles and add 
foooter credits
---
 .../todomvc/src/main/resources/todomvc-styles.css  | 32 +++++++++++-----
 .../royale/jewel/todomvc/views/MainContent.mxml    | 43 +++++++++++++++++-----
 2 files changed, 56 insertions(+), 19 deletions(-)

diff --git a/examples/jewel/todomvc/src/main/resources/todomvc-styles.css 
b/examples/jewel/todomvc/src/main/resources/todomvc-styles.css
index af11f2b..4b27e31 100644
--- a/examples/jewel/todomvc/src/main/resources/todomvc-styles.css
+++ b/examples/jewel/todomvc/src/main/resources/todomvc-styles.css
@@ -37,15 +37,6 @@
        font-weight: 300;
 }
 
-/* Main View */
-.royale
-{
-    background: #fff;
-    margin: 130px 0 40px 0;
-    position: relative;
-    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 
0.1);
-}
-
 /* Main Section */
 .todoapp {
        background: #fff;
@@ -302,3 +293,26 @@
 {
        height: unset;
 }
+
+/* Footer Info */
+.info {
+       text-align: center;
+       margin: 65px auto 0;
+       color: #bfbfbf;
+       font-size: 10px;
+       text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
+}
+
+.info p {
+       line-height: 1;
+}
+
+.info a {
+       font-weight: 400;
+       color: inherit;
+       text-decoration: none;
+}
+
+.info a:hover {
+       text-decoration: underline;
+}
\ No newline at end of file
diff --git 
a/examples/jewel/todomvc/src/main/royale/jewel/todomvc/views/MainContent.mxml 
b/examples/jewel/todomvc/src/main/royale/jewel/todomvc/views/MainContent.mxml
index 9a1b94f..b5c4c6c 100644
--- 
a/examples/jewel/todomvc/src/main/royale/jewel/todomvc/views/MainContent.mxml
+++ 
b/examples/jewel/todomvc/src/main/royale/jewel/todomvc/views/MainContent.mxml
@@ -95,7 +95,15 @@ limitations under the License.
                     items.removeItem(item);
                 }
             }
+            clearCompleted.visible = false;
             toogleAll.visible = footer.visible = itemsCompleted(items, 
null).length != 0 ? true : false;
+            
+            if(all_btn.selected)
+                selectFilter(all_btn.text);
+            else if(active_btn.selected)
+                selectFilter(active_btn.text);
+            else if(completed_btn.selected)
+                selectFilter(completed_btn.text);
         }
 
         public function itemStateChangedHandler(event:Event = null):void {
@@ -109,15 +117,18 @@ limitations under the License.
             itemStateChangedHandler();
         }
         
-        public function selectFileter(event:Event):void {
-            if(event.target.text == "All")
+        public function toggleButtonClickHandler(event:Event):void {
+            selectFilter(event.target.text);
+        }
+        public function selectFilter(label:String):void {
+            if(label == "All")
             {
                 active_btn.selected = false;
                 completed_btn.selected = false;
 
                 todolist.dataProvider = items;
             } 
-            else if(event.target.text == "Active")
+            else if(label == "Active")
             {
                 all_btn.selected = false;
                 completed_btn.selected = false;
@@ -126,7 +137,7 @@ limitations under the License.
 
                 todolist.dataProvider = activeItems;
             }
-            else if(event.target.text == "Completed")
+            else if(label == "Completed")
             {
                 all_btn.selected = false;
                 active_btn.selected = false;
@@ -180,16 +191,28 @@ limitations under the License.
                     <j:Label localId="itemsLeft" text="0 items left"/>
                 </j:BarSection>
                 <j:BarSection gap="3" itemsHorizontalAlign="itemsCenter">
-                    <j:ToggleButton localId="all_btn" text="All" 
click="selectFileter(event)" selected="true"/>
-                    <j:ToggleButton localId="active_btn" text="Active" 
click="selectFileter(event)"/>
-                    <j:ToggleButton localId="completed_btn" text="Completed" 
click="selectFileter(event)"/>
+                    <j:ToggleButton localId="all_btn" text="All" 
click="toggleButtonClickHandler(event)" selected="true"/>
+                    <j:ToggleButton localId="active_btn" text="Active" 
click="toggleButtonClickHandler(event)"/>
+                    <j:ToggleButton localId="completed_btn" text="Completed" 
click="toggleButtonClickHandler(event)"/>
                 </j:BarSection>
                 <j:BarSection width="15%" itemsHorizontalAlign="itemsRight">
-                    <j:Button localId="clearCompleted" text="Clear Completed" 
click="removeCompleted()" visible="false">
-                        
-                    </j:Button>
+                    <j:Button localId="clearCompleted" text="Clear Completed" 
click="removeCompleted()" visible="false"/>
                 </j:BarSection>
             </j:BarRow>
+
         </html:Footer>
     </html:Section>
+    
+    <html:Footer className="info">
+        <![CDATA[
+            <p>Double-click to edit a todo</p>
+            <p>
+                Created by
+                <a href="http://github.com/carlosrovira"; 
target="_blank">Carlos Rovira</a>
+                for
+                <a href="http://royale.apache.org"; target="_blank">Apache 
Royale</a>
+            </p>
+            <p>Inspired in <a href="http://todomvc.com"; 
target="_blank">TodoMVC</a></p>
+        ]]>
+    </html:Footer>
 </j:View>
\ No newline at end of file

Reply via email to