Ver Fonte

New aside behavior (.right.aside)

Javi Jimenez Villar há 13 anos atrás
pai
commit
6324d003f9

+ 3 - 4
example/app/asides/features.html

@@ -1,4 +1,4 @@
-<aside id="features" class="left">
+<aside id="features">
     <header data-title="Features">
         <nav class="right">
             <a href="#" class="buttons" data-icon="settings"></a>
@@ -32,13 +32,12 @@
 
             <!-- Asides -->
             <li data-view-section="aside" data-async="app/sections/aside.html">
-                <div class="tag right">8</div>
-                <strong>Asides</strong>
+                <strong>Aside</strong>
             </li>
 
             <!-- Menu -->
             <li data-view-section="menu" data-async="app/sections/menu.html">
-                <div class="tag right">1</div>
+                <div class="tag right">2</div>
                 <strong>Menu</strong>
             </li>
 

+ 0 - 13
example/app/asides/left.html

@@ -1,13 +0,0 @@
-<aside id="left" class="left">
-    <header data-title="Example of Aside"></header>
-    <article class="list">
-        <ul>
-            <li>
-                <a href="#aside-example" data-router="article" data-icon="user">
-                    <strong>Tap to close</strong>
-                    <small>Lorem ipsum dolor sit amet.</small>
-                </a>
-            </li>
-        </ul>
-    </article>
-</aside>

+ 10 - 6
example/app/asides/right.html

@@ -1,7 +1,11 @@
-<aside id="right" class="right small">
-    <nav>
-        <a href="#aside-example" data-router="article" class="active" data-icon="clock"></a>
-        <a href="#aside-example" data-router="article" data-icon="user" data-count="14"></a>
-        <a href="#aside-example" data-router="article" data-icon="pushpin"></a>
-    </nav>
+<aside id="right" class="right">
+    <header data-title="Example of Aside"></header>
+    <article class="list active">
+        <ul>
+            <li data-view-aside="right" data-icon="user">
+                <strong>Tap to close</strong>
+                <small>Lorem ipsum dolor sit amet.</small>
+            </li>
+        </ul>
+    </article>
 </aside>

+ 3 - 8
example/app/sections/aside.html

@@ -1,13 +1,8 @@
-<section id="aside" data-transition="slide">
+<section id="aside" data-transition="slide" data-aside="right">
     <header data-title="Asides" data-back="home">
         <nav class="right">
-            <a href="#" data-view="aside" data-async="app/asides/left.html" data-icon="left" class="button anchor blue">Example of normal aside</a>
-            <a href="#" data-router="aside" data-async="app/asides/right.html" data-icon="right" class="button anchor red">Example of mini right aside</a>
+            <button data-view-aside="right" data-label="Show Aside"></button>
         </nav>
     </header>
-    <article id="aside-example" class="active indented">
-        <div>
-
-        </div>
-    </article>
+    <article id="aside-example"></article>
 </section>

+ 1 - 1
example/components/lungo.brownie

@@ -1 +1 @@
-Subproject commit 04e598bb2512a11bf746f4995d06ddcd719525d2
+Subproject commit 3f980c32d772499e5131ef8adfc0cbfa1da83bd6

+ 5 - 3
example/index.html

@@ -58,14 +58,14 @@
 
 <body class="app">
 
-    <section id="main" data-transition="" data-aside="features">
+    <section id="main" data-transition="" data-aside="features" class="drag">
         <header>
             <nav>
                 <a href="#" data-view-aside="features" data-icon="menu"></a>
             </nav>
             <img src="http://cdn.tapquo.com/lungo/logo.png" class="title centered">
             <nav class="right">
-                <a href="#" data-action="twitter" class="button theme" data-icon="brand twitter"></a>
+                <a href="#" data-action="twitter" class="button" data-icon="brand twitter" data-article="main-article"></a>
             </nav>
         </header>
 
@@ -119,7 +119,9 @@
         Lungo.init({
             name: 'Kitchen Sink',
             version: '2.1.0222',
-            resources: ['app/asides/features.html']
+            resources: [
+                'app/asides/features.html',
+                'app/asides/right.html']
         });
     </script>
     <script src="app/app.js"></script>

+ 1 - 1
src/boot/Lungo.Boot.Device.coffee

@@ -18,6 +18,6 @@ Lungo.Boot.Device = do(lng = Lungo) ->
     env = lng.Core.environment()
     lng.DEVICE = (if env.screen.width < 768 then DEVICE.PHONE else DEVICE.TABLET)
     lng.dom(document.body).data "device", lng.DEVICE
-    lng.Aside.draggable()  if lng.DEVICE is lng.Constants.DEVICE.PHONE
+    lng.Aside.draggable() if lng.DEVICE is lng.Constants.DEVICE.PHONE
 
   init: init

+ 1 - 1
src/modules/Lungo.Constants.coffee

@@ -30,7 +30,7 @@ Lungo.Constants =
 
     LIST_IN_ELEMENT     : "article.list"
     ELEMENT_SCROLLABLE  : "article.scroll"
-    HREF_ASIDE          : "section[data-aside]"
+    HREF_ASIDE          : "section[data-aside].drag"
     HREF_ROUTER         : "a[href][data-router]"
     MENU_HREF           : "[data-control=menu] a[href]"
     INPUT_CHECKBOX      : "input[type=range].checkbox"

+ 3 - 11
src/router/Lungo.Router.Aside.coffee

@@ -52,8 +52,7 @@ Lungo.Aside = do(lng = Lungo) ->
       setTimeout (-> lng.Element.Cache.aside.addClass C.CLASS.SHOW), C.TRANSITION.DURATION
       if lng.DEVICE is C.DEVICE.PHONE
         lng.Element.Cache.aside.addClass C.CLASS.SHOW
-        aside_stylesheet = _asideStylesheet()
-        lng.Element.Cache.section.addClass(aside_stylesheet).addClass C.CLASS.ASIDE
+        lng.Element.Cache.section.addClass(_asideStylesheet()).addClass(C.CLASS.ASIDE)
 
 
   ###
@@ -62,7 +61,7 @@ Lungo.Aside = do(lng = Lungo) ->
   ###
   hide = ->
     if lng.Element.Cache.aside? and lng.DEVICE is C.DEVICE.PHONE
-      lng.Element.Cache.section.removeClass C.CLASS.ASIDE
+      lng.Element.Cache.section.removeClass(C.CLASS.ASIDE)
       setTimeout (-> lng.Element.Cache.aside.removeClass C.CLASS.SHOW), C.TRANSITION.DURATION
 
   ###
@@ -105,14 +104,7 @@ Lungo.Aside = do(lng = Lungo) ->
   Private methods
   ###
   _asideStylesheet = ->
-    aside_stylesheet = lng.Element.Cache.aside.attr(C.ATTRIBUTE.CLASS)
-    stylesheet = ""
-
-    #@todo: Refactor
-    if aside_stylesheet
-      stylesheet += (if (aside_stylesheet.indexOf(C.CLASS.RIGHT) > -1) then C.CLASS.RIGHT + " " else "")
-      stylesheet += (if (aside_stylesheet.indexOf(C.CLASS.SMALL) > -1) then C.CLASS.SMALL + " " else "")
-    stylesheet
+    if lng.Element.Cache.aside?.hasClass(C.CLASS.RIGHT) then "#{C.CLASS.RIGHT}" else "  "
 
   active: active
   toggle: toggle

+ 0 - 1
src/router/Lungo.Router.Section.coffee

@@ -23,7 +23,6 @@ Lungo.Section = do(lng = Lungo) ->
     lng.Element.Cache.aside = lng.Aside.active target
     if target.hasClass "aside" then lng.Aside.show()
 
-
     current.trigger C.TRIGGER.UNLOAD if current
     target.trigger C.TRIGGER.LOAD
 

+ 4 - 6
src/stylesheets/lungo.media.phone.styl

@@ -13,15 +13,13 @@
     position: absolute
 
   section
-    &.aside
-      &:not(.small)
+    &.show.aside
+      &:not(.right)
         transform translateX(ASIDE_WIDTH)
-      &.small
-        transform translateX(ASIDE_WIDTH_SMALL)
       &.right
         transform translateX(-(ASIDE_WIDTH))
-        &.small
-          transform translateX(-(ASIDE_WIDTH_SMALL))
+    &.show.hide
+      z-index: -1
 
     &[data-transition]
       display-box()

+ 1 - 1
src/stylesheets/lungo.widgets.button.styl

@@ -27,7 +27,7 @@
       font-size: 1.3em
       float: left
     & .icon + abbr
-      margin-left: 6px
+      margin-left: 4px
       float: right
 
   article &