soyjavi 13 år sedan
förälder
incheckning
4244fff96f

+ 1 - 2
grunt.js

@@ -20,8 +20,7 @@ module.exports = function(grunt) {
           'build/src/boot/*.js',
           'build/src/data/*.js',
           'build/src/element/*.js',
-          'build/src/router/Lungo.Router.js', 'build/src/router/Lungo.Router.History.js',
-          'build/src/view/*.js'],
+          'build/src/router/Lungo.Router.js', 'build/src/router/Lungo.Router.*.js'],
         stylesheets: [
             'src/**/lungo.base.styl',
             'src/**/lungo.layout.styl',

+ 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 "data", lng.DEVICE
-    lng.View.Aside.draggable()  if lng.DEVICE is lng.Constants.DEVICE.PHONE
+    lng.Aside.draggable()  if lng.DEVICE is lng.Constants.DEVICE.PHONE
 
   init: init

+ 2 - 2
src/boot/Lungo.Boot.Events.coffee

@@ -56,7 +56,7 @@ Lungo.Boot.Events = do(lng = Lungo) ->
     ), lng.Constants.TRANSITION.DURATION * 2
 
   _selectTarget = (link) ->
-    lng.View.Aside.hide()  if link.closest(ELEMENT.ASIDE).length > 0
+    lng.Aside.hide()  if link.closest(ELEMENT.ASIDE).length > 0
     target_type = link.data(ATTRIBUTE.ROUTER)
     target_id = link.attr(ATTRIBUTE.HREF)
     switch target_type
@@ -65,7 +65,7 @@ Lungo.Boot.Events = do(lng = Lungo) ->
       when ELEMENT.ARTICLE
         _goArticle link
       when ELEMENT.ASIDE
-        lng.View.Aside.toggle()
+        lng.Aside.toggle()
       when ELEMENT.MENU
         _goMenu target_id
 

+ 59 - 49
src/modules/Lungo.Constants.coffee

@@ -6,71 +6,81 @@ Object with data-attributes (HTML5) with a special <markup>
 
 @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
 ###
+
 Lungo.Constants =
   ELEMENT:
-    SECTION: "section"
-    ARTICLE: "article"
-    ASIDE: "aside"
-    MENU: "menu"
-    BODY: "body"
-    DIV: "div"
-    LIST: "<ul></ul>"
-    LI: "li"
+    SECTION             : "section"
+    ARTICLE             : "article"
+    ASIDE               : "aside"
+    MENU                : "menu"
+    BODY                : "body"
+    DIV                 : "div"
+    LIST                : "<ul></ul>"
+    LI                  : "li"
 
   QUERY:
-    LIST_IN_ELEMENT: "article.list, aside.list"
-    ELEMENT_SCROLLABLE: "aside.scroll, article.scroll"
-    HREF_ASIDE: "section[data-aside]"
-    HREF_ROUTER: "a[href][data-router]"
-    MENU_HREF: "[data-control=menu] a[href]"
-    INPUT_CHECKBOX: "input[type=range].checkbox"
+    LIST_IN_ELEMENT     : "article.list, aside.list"
+    ELEMENT_SCROLLABLE  : "aside.scroll, article.scroll"
+    HREF_ASIDE          : "section[data-aside]"
+    HREF_ROUTER         : "a[href][data-router]"
+    MENU_HREF           : "[data-control=menu] a[href]"
+    INPUT_CHECKBOX      : "input[type=range].checkbox"
+    NAVIGATION_ITEM     : "a[href][data-router=\"article\"]"
+    REFERENCE_LINK      : " a[href][data-article]"
+    TITLE               : "header .title, footer .title"
+    ACTIVE_LIST_ITEM    : "li a.active, li.active"
+
 
   CLASS:
-    ACTIVE: "active"
-    ASIDE: "aside"
-    SHOW: "show"
-    HIDE: "hide"
-    HIDING: "hiding"
-    RIGHT: "right"
-    LEFT: "left"
-    HORIZONTAL: "horizontal"
-    SMALL: "small"
+    ACTIVE              : "active"
+    ASIDE               : "aside"
+    SHOW                : "show"
+    HIDE                : "hide"
+    HIDING              : "hiding"
+    RIGHT               : "right"
+    LEFT                : "left"
+    HORIZONTAL          : "horizontal"
+    SMALL               : "small"
 
   TRIGGER:
-    LOAD: "load"
-    UNLOAD: "unload"
+    LOAD                : "load"
+    UNLOAD              : "unload"
 
   TRANSITION:
-    DURATION: 350
+    DURATION            : 350
+    ORIGIN              : "transition-origin"
+    ATTR                : "transition"
 
   ATTRIBUTE:
-    ID: "id"
-    HREF: "href"
-    TITLE: "title"
-    ARTICLE: "article"
-    CLASS: "class"
-    WIDTH: "width"
-    HEIGHT: "height"
-    PIXEL: "px"
-    PERCENT: "%"
-    ROUTER: "router"
-    FIRST: "first"
-    LAST: "last"
-    EMPTY: ""
+    ID                  : "id"
+    HREF                : "href"
+    TITLE               : "title"
+    ARTICLE             : "article"
+    CLASS               : "class"
+    WIDTH               : "width"
+    HEIGHT              : "height"
+    PIXEL               : "px"
+    PERCENT             : "%"
+    ROUTER              : "router"
+    FIRST               : "first"
+    LAST                : "last"
+    EMPTY               : ""
+    CHILDREN            : "children"
+    TRANSITION          : "transition"
 
   BINDING:
-    START: "{{"
-    END: "}}"
-    KEY: "value"
-    SELECTOR: "{{value}}"
+    START               : "{{"
+    END                 : "}}"
+    KEY                 : "value"
+    SELECTOR            : "{{value}}"
 
   DEVICE:
-    PHONE: "phone"
-    TABLET: "tablet"
-    TV: "tv"
+    PHONE               : "phone"
+    TABLET              : "tablet"
+    TV                  : "tv"
 
   ERROR:
-    DATABASE: "ERROR: Connecting to Data.Sql."
+    DATABASE            : "ERROR: Connecting to Data.Sql."
     DATABASE_TRANSACTION: "ERROR: Data.Sql >> "
-    ROUTER: "ERROR: The target does not exists >>"
-    LOADING_RESOURCE: "ERROR: Loading resource: "
+    ROUTER              : "ERROR: The target does not exists >>"
+    LOADING_RESOURCE    : "ERROR: Loading resource: "

+ 46 - 0
src/router/Lungo.Router.Article.coffee

@@ -0,0 +1,46 @@
+###
+Initialize the <articles> layout of a certain <section>
+
+@namespace Lungo
+@class Article
+
+@author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
+@author Guillermo Pascual <pasku@tapquo.com> || @pasku1
+###
+
+Lungo.Article = do(lng = Lungo) ->
+  C = lng.Constants
+
+
+  ###
+  @todo   Describe method
+  @method title
+  ###
+  title = (value) -> lng.Element.Cache.section.find(C.QUERY.TITLE).text value if value
+
+
+  ###
+  @todo   Describe method
+  @method switchNavItems
+  ###
+  switchNavItems = (article_id) ->
+    lng.Element.Cache.section.find(C.QUERY.NAVIGATION_ITEM).removeClass C.CLASS.ACTIVE
+    active_nav_items = "a[href=\"" + article_id + "\"][data-router=\"article\"]"
+    lng.Element.Cache.section.find(active_nav_items).addClass C.CLASS.ACTIVE
+    if lng.Element.Cache.aside
+      aside = lng.Element.Cache.aside
+      aside.find(C.QUERY.ACTIVE_LIST_ITEM).removeClass C.CLASS.ACTIVE
+      aside.find(active_nav_items).addClass(C.CLASS.ACTIVE).parent().addClass C.CLASS.ACTIVE
+
+
+  ###
+  @todo   Describe method
+  @method switchReferenceItems
+  ###
+  switchReferenceItems = (article_id, section) ->
+    reference = "[data-article=" + article_id.replace("#", "") + "]"
+    section.find(C.QUERY.REFERENCE_LINK).hide().siblings(reference).show()
+
+  title: title
+  switchReferenceItems: switchReferenceItems
+  switchNavItems: switchNavItems

+ 32 - 52
src/view/Lungo.View.Aside.coffee

@@ -7,19 +7,12 @@ Initialize the <articles> layout of a certain <section>
 @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
 ###
 
-Lungo.View.Aside = do(lng = Lungo) ->
-  ELEMENT = lng.Constants.ELEMENT
-  CLASS = lng.Constants.CLASS
-  ATTRIBUTE = lng.Constants.ATTRIBUTE
-  DEVICE = lng.Constants.DEVICE
-  QUERY = lng.Constants.QUERY
-  TRANSITION = lng.Constants.TRANSITION.DURATION
+Lungo.Aside = do(lng = Lungo) ->
+  C = lng.Constants
 
   ###
   Active aside for a determinate section
-
   @method active
-
   @param  {object} Section element
   ###
   active = (section) ->
@@ -28,75 +21,60 @@ Lungo.View.Aside = do(lng = Lungo) ->
 
     # Deactive
     if (current_aside and aside_id isnt current_aside.attr("id")) or aside_id is null
-      current_aside.removeClass(CLASS.SHOW).removeClass CLASS.ACTIVE
+      current_aside.removeClass(C.CLASS.SHOW).removeClass C.CLASS.ACTIVE
       lng.Element.Cache.aside = null
 
     # Active
     if aside_id
-      lng.Element.Cache.aside = lng.dom(ELEMENT.ASIDE + "#" + aside_id)
-      lng.Element.Cache.aside.addClass CLASS.ACTIVE
-      lng.View.Aside.show aside_id  unless lng.DEVICE is DEVICE.PHONE
+      lng.Element.Cache.aside = lng.dom(C.ELEMENT.ASIDE + "#" + aside_id)
+      lng.Element.Cache.aside.addClass C.CLASS.ACTIVE
+      lng.Aside.show aside_id  unless lng.DEVICE is C.DEVICE.PHONE
     lng.Element.Cache.aside
 
 
   ###
   Toggle an aside element
-
   @method toggle
-
   @param  {string} Aside id
   ###
   toggle = ->
     if lng.Element.Cache.aside
-      is_visible = lng.Element.Cache.aside.hasClass(CLASS.SHOW)
-      if is_visible
-        lng.View.Aside.hide()
-      else
-        lng.View.Aside.show()
+      is_visible = lng.Element.Cache.aside.hasClass(C.CLASS.SHOW)
+      if is_visible then lng.Aside.hide() else lng.Aside.show()
 
 
   ###
   Display an aside element with a particular <section>
-
   @method show
   ###
   show = (aside) ->
     if lng.Element.Cache.aside?
-      setTimeout (->
-        lng.Element.Cache.aside.addClass CLASS.SHOW
-      ), TRANSITION
-      if lng.DEVICE is DEVICE.PHONE
-        lng.Element.Cache.aside.addClass CLASS.SHOW
+      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 CLASS.ASIDE
+        lng.Element.Cache.section.addClass(aside_stylesheet).addClass C.CLASS.ASIDE
 
 
   ###
   Hide an aside element with a particular section
-
   @method hide
   ###
   hide = ->
     if lng.Element.Cache.aside?
-      if lng.DEVICE is DEVICE.PHONE
-        aside_stylesheet = _asideStylesheet()
-        console.error lng.Element.Cache
-
-        lng.Element.Cache.section.removeClass CLASS.ASIDE
-        setTimeout (->
-          lng.Element.Cache.aside.removeClass CLASS.SHOW
-        ), TRANSITION
+      if lng.DEVICE is C.DEVICE.PHONE
+        lng.Element.Cache.section.removeClass C.CLASS.ASIDE
+        setTimeout (-> lng.Element.Cache.aside.removeClass C.CLASS.SHOW), C.TRANSITION.DURATION
 
   ###
   @todo
-
-  @method suscribeEvents
+  @method draggable
   ###
   draggable = ->
     MIN_XDIFF = parseInt(document.body.getBoundingClientRect().width / 3, 10)
     MIN_XDIFF = 128
-    lng.dom(QUERY.HREF_ASIDE).each ->
-      STARTED = false
+    lng.dom(C.QUERY.HREF_ASIDE).each ->
+      started = false
       el = lng.dom(this)
       section = el.closest("section")
       aside = lng.dom("aside#" + el.data("aside"))
@@ -104,11 +82,11 @@ Lungo.View.Aside = do(lng = Lungo) ->
         unless section.hasClass("aside")
           xdiff = gesture.currentTouch.x - gesture.iniTouch.x
           ydiff = Math.abs(gesture.currentTouch.y - gesture.iniTouch.y)
-          STARTED = (if STARTED then true else xdiff > 3 * ydiff and xdiff < 50)
-          if STARTED
+          started = (if started then true else xdiff > 3 * ydiff and xdiff < 50)
+          if started
             xdiff = (if xdiff > 256 then 256 else (if xdiff < 0 then 0 else xdiff))
-            aside.addClass CLASS.SHOW
-            section.vendor "transform", "translateX(" + xdiff + "px)"
+            aside.addClass C.CLASS.SHOW
+            section.vendor "transform", "translateX(#{xdiff}px)"
             section.vendor "transition-duration", "0s"
           else
             section.attr "style", ""
@@ -117,23 +95,25 @@ Lungo.View.Aside = do(lng = Lungo) ->
         diff = gesture.currentTouch.x - gesture.iniTouch.x
         ydiff = Math.abs(gesture.currentTouch.y - gesture.iniTouch.y)
         section.attr "style", ""
-        if diff > MIN_XDIFF and STARTED
+        if diff > MIN_XDIFF and started
           show aside
         else
           hide aside
-        STARTED = false
-
+        started = false
 
 
+  ###
+  Private methods
+  ###
   _asideStylesheet = ->
-    aside_stylesheet = lng.Element.Cache.aside.attr(ATTRIBUTE.CLASS)
-    classes = ""
+    aside_stylesheet = lng.Element.Cache.aside.attr(C.ATTRIBUTE.CLASS)
+    stylesheet = ""
 
     #@todo: Refactor
     if aside_stylesheet
-      classes += (if (aside_stylesheet.indexOf(CLASS.RIGHT) > -1) then CLASS.RIGHT + " " else "")
-      classes += (if (aside_stylesheet.indexOf(CLASS.SMALL) > -1) then CLASS.SMALL + " " else "")
-    classes
+      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
 
   active: active
   toggle: toggle

+ 3 - 12
src/router/Lungo.Router.History.coffee

@@ -8,39 +8,30 @@ Stores the displayed <sections> as a historical.
 @author Guillermo Pascual <pasku@tapquo.com> || @pasku1
 ###
 
-
 Lungo.Router.History = do ->
   _history = []
 
   ###
   Create a new element to the browsing history based on the current section id.
-
   @method add
-
   @param  {string} Id of the section
   ###
-  add = (section_id) ->
-    _history.push section_id  if section_id isnt current()
+  add = (section_id) -> _history.push section_id  if section_id isnt current()
 
 
   ###
   Returns the current browsing history section id.
-
   @method current
-
   @return {string} Current section id
   ###
-  current = ->
-    _history[_history.length - 1]
+  current = -> _history[_history.length - 1]
 
 
   ###
   Removes the current item browsing history.
-
   @method removeLast
   ###
-  removeLast = ->
-    _history.length -= 1
+  removeLast = -> _history.length -= 1
 
   add: add
   current: current

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

@@ -0,0 +1,54 @@
+###
+Initialize the <articles> layout of a certain <section>
+
+@namespace Lungo.View
+@class Section
+
+@author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
+###
+
+Lungo.Section = do(lng = Lungo) ->
+  C = lng.Constants
+
+  show = (current, target) ->
+    if lng.DEVICE is C.DEVICE.PHONE then _phone target else _tablet current, target
+
+    lng.Element.Cache.section = target
+    lng.Element.Cache.article = target.find "#{C.ELEMENT.ARTICLE}.#{C.CLASS.ACTIVE}"
+    lng.Element.Cache.aside = lng.Aside.active target
+
+    current.trigger C.TRIGGER.UNLOAD if current
+    target.trigger C.TRIGGER.LOAD
+
+
+  defineTransition = (target, current) ->
+    target_transition = target.data C.ATTRIBUTE.TRANSITION
+    if target_transition
+      _assignTransitionOrigin current
+      assignTransition current, target_transition
+
+
+  assignTransition = (section, transitionName) ->
+    section.data C.ATTRIBUTE.TRANSITION, transitionName
+
+
+  ###
+  Private methods
+  ###
+  _phone = (target) ->
+    target.removeClass(C.CLASS.HIDE).addClass(C.CLASS.SHOW)
+
+  _tablet = (current, target) ->
+    children = current.data C.ATTRIBUTE.CHILDREN if current
+    if current and (not children or children.indexOf(target.attr(C.ATTRIBUTE.ID)) is -1)
+      current.addClass C.CLASS.HIDE
+      setTimeout (->current.removeClass(C.CLASS.SHOW).removeClass(C.CLASS.HIDE)), C.TRANSITION.DURATION
+
+    setTimeout (-> target.addClass(C.CLASS.SHOW)), C.TRANSITION.DURATION
+
+  _assignTransitionOrigin = (section) ->
+    section.data C.TRANSITION.ORIGIN, section.data(C.TRANSITION.ATTR)
+
+  show: show
+  defineTransition: defineTransition
+  assignTransition: assignTransition

+ 46 - 90
src/router/Lungo.Router.coffee

@@ -9,124 +9,80 @@ Handles the <sections> and <articles> to show
 ###
 
 Lungo.Router = do(lng = Lungo) ->
-  CLASS = lng.Constants.CLASS
-  ELEMENT = lng.Constants.ELEMENT
-  ERROR = lng.Constants.ERROR
-  TRIGGER = lng.Constants.TRIGGER
-  ATTRIBUTE = lng.Constants.ATTRIBUTE
-  DEVICE = lng.Constants.DEVICE
-  HASHTAG_CHARACTER = "#"
+  C       = lng.Constants
+  HASHTAG = "#"
+
 
   ###
   Navigate to a <section>.
-
-  @method section
-
-  @param {string} Id of the <section>
+  @method   section
+  @param    {string} Id of the <section>
   ###
   section = (section_id) ->
     section_id = lng.Core.parseUrl(section_id)
     current = lng.Element.Cache.section
     if _notCurrentTarget(section_id, current)
-      query = ELEMENT.SECTION + section_id
-      target = (if (current) then current.siblings(query) else lng.dom(query))
+      query = C.ELEMENT.SECTION + section_id
+      target = if current then current.siblings(query) else lng.dom(query)
       if target.length > 0
-        if lng.DEVICE is DEVICE.PHONE
-          if current
-            _defineTransition target, current
-            current.removeClass(CLASS.SHOW).addClass CLASS.HIDE
-          _showPhoneSection target
-        else
-          _showTabletSection current, target
-        _cacheView current, target
-        lng.Router.History.add section_id
-
-
-  ###
-  Return to previous section.
+        if lng.DEVICE is C.DEVICE.PHONE
+          if current?
+            lng.Section.defineTransition target, current
+            current.removeClass(C.CLASS.SHOW).addClass(C.CLASS.HIDE)
 
-  @method back
-  ###
-  back = ->
-    lng.View.Aside.hide()  if lng.DEVICE is DEVICE.PHONE and lng.Element.Cache.aside and lng.Element.Cache.aside.hasClass(CLASS.SHOW)
-    lng.Router.History.removeLast()
-    current = lng.Element.Cache.section
-    target = current.siblings(ELEMENT.SECTION + lng.Router.History.current())
-    if lng.DEVICE is DEVICE.PHONE
-      current.removeClass CLASS.SHOW
-      setTimeout (->
-        current.removeClass CLASS.HIDING
-      ), lng.Constants.TRANSITION.DURATION
-      _assignTransition target, target.data("transition-origin")
-      _showPhoneSection target
-    else
-      _showTabletSection current, target
-    _cacheView current, target
+        lng.Section.show current, target
+        lng.Router.History.add section_id
 
 
   ###
   Displays the <article> in a particular <section>.
-
-  @method article
-
-  @param {string} <section> Id
-  @param {string} <article> Id
+  @method   article
+  @param    {string} <section> Id
+  @param    {string} <article> Id
   ###
   article = (section_id, article_id, element) ->
     article_id = lng.Core.parseUrl(article_id)
     current = lng.Element.Cache.article
     if _notCurrentTarget(article_id, current)
       section section_id
-      target = lng.Element.Cache.section.find(ELEMENT.ARTICLE + article_id)
+      target = lng.Element.Cache.section.find(C.ELEMENT.ARTICLE + article_id)
       if target.length > 0
-        current = lng.Element.Cache.section.children(ELEMENT.ARTICLE)  if _sectionId(current) isnt _sectionId(target)
-        current.removeClass(CLASS.ACTIVE).trigger TRIGGER.UNLOAD
-        target.addClass(CLASS.ACTIVE).trigger TRIGGER.LOAD
+        current = lng.Element.Cache.section.children(C.ELEMENT.ARTICLE)  if _sectionId(current) isnt _sectionId(target)
+        current.removeClass(C.CLASS.ACTIVE).trigger C.TRIGGER.UNLOAD
+        target.addClass(C.CLASS.ACTIVE).trigger C.TRIGGER.LOAD
         lng.Element.Cache.article = target
-        lng.View.Article.switchNavItems article_id
-        lng.View.Article.switchReferenceItems article_id, lng.Element.Cache.section
-        lng.View.Article.title element.data(ATTRIBUTE.TITLE)  if element
-
-  _showPhoneSection = (target) ->
-    target.removeClass(CLASS.HIDE).addClass CLASS.SHOW
-
-  _showTabletSection = (current, target) ->
-    if current and not current.data("child")
-      current.addClass CLASS.HIDE
-      setTimeout (->
-        current.removeClass(CLASS.SHOW).removeClass CLASS.HIDE
-      ), lng.Constants.TRANSITION.DURATION
-    setTimeout (->
-      target.addClass CLASS.SHOW
-    ), lng.Constants.TRANSITION.DURATION
-
-  _cacheView = (current, target) ->
-    lng.Element.Cache.section = target
-    lng.Element.Cache.article = target.find(ELEMENT.ARTICLE + "." + CLASS.ACTIVE)
-    lng.Element.Cache.aside = lng.View.Aside.active(target)
-    _sectionTriggers current, target
+        lng.Article.switchNavItems article_id
+        lng.Article.switchReferenceItems article_id, lng.Element.Cache.section
+        lng.Article.title element.data(C.ATTRIBUTE.TITLE)  if element
 
-  _notCurrentTarget = (target, element) ->
-    (if (not element or target isnt HASHTAG_CHARACTER + element.attr("id")) then true else false)
 
-  _sectionId = (element) ->
-    element.parent("section").attr "id"
+  ###
+  Return to previous section.
+  @method   back
+  ###
+  back = ->
+    lng.Router.History.removeLast()
 
-  _sectionTriggers = (current, target) ->
-    current.trigger TRIGGER.UNLOAD  if current
-    target.trigger TRIGGER.LOAD
+    current = lng.Element.Cache.section
+    target = current.siblings(C.ELEMENT.SECTION + lng.Router.History.current())
+    if lng.DEVICE is C.DEVICE.PHONE
+      lng.Aside.hide() if lng.Element.Cache.aside and lng.Element.Cache.aside.hasClass(C.CLASS.SHOW)
+
+      lng.Section.assignTransition target, target.data C.TRANSITION.ORIGIN
+      current.removeClass(C.CLASS.SHOW).addClass(C.CLASS.HIDING)
+      setTimeout (-> current.removeClass(C.CLASS.HIDING)), C.TRANSITION.DURATION
 
-  _defineTransition = (target, current) ->
-    target_transition = target.data("transition")
-    if target_transition
-      _assignTransitionOrigin current
-      _assignTransition current, target_transition
+    lng.Section.show current, target
 
-  _assignTransition = (section, transitionName) ->
-    section.data "transition", transitionName
 
-  _assignTransitionOrigin = (section) ->
-    section.data "transition-origin", section.data("transition")
+  ###
+  Private methods
+  ###
+  _notCurrentTarget = (target, element) ->
+    (if (not element or target isnt HASHTAG + element.attr(C.ATTRIBUTE.ID)) then true else false)
+
+  _sectionId = (element) ->
+    element.parent(C.ELEMENT.SECTION).attr C.ATTRIBUTE.ID
 
   section: section
   article: article

+ 0 - 45
src/view/Lungo.View.Article.coffee

@@ -1,45 +0,0 @@
-###
-Initialize the <articles> layout of a certain <section>
-
-@namespace Lungo.View
-@class Article
-
-@author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
-@author Guillermo Pascual <pasku@tapquo.com> || @pasku1
-###
-
-Lungo.View.Article = do(lng = Lungo) ->
-  ELEMENT = lng.Constants.ELEMENT
-  CLASS = lng.Constants.CLASS
-  ATTRIBUTE = lng.Constants.ATTRIBUTE
-  SELECTORS =
-    NAVIGATION_ITEM: "a[href][data-router=\"article\"]"
-    REFERENCE_LINK: " a[href][data-article]"
-    TITLE_OF_ARTICLE: "header .title, footer .title"
-    ASIDE_REFERENCE_LIST: "li a.active, li.active"
-
-
-  ###
-  ?
-
-  @method show
-  ###
-  title = (value) ->
-    lng.Element.Cache.section.find(SELECTORS.TITLE_OF_ARTICLE).text value  if value
-
-  switchNavItems = (article_id) ->
-    lng.Element.Cache.section.find(SELECTORS.NAVIGATION_ITEM).removeClass CLASS.ACTIVE
-    active_nav_items = "a[href=\"" + article_id + "\"][data-router=\"article\"]"
-    lng.Element.Cache.section.find(active_nav_items).addClass CLASS.ACTIVE
-    if lng.Element.Cache.aside
-      aside = lng.Element.Cache.aside
-      aside.find(SELECTORS.ASIDE_REFERENCE_LIST).removeClass CLASS.ACTIVE
-      aside.find(active_nav_items).addClass(CLASS.ACTIVE).parent().addClass CLASS.ACTIVE
-
-  switchReferenceItems = (article_id, section) ->
-    reference = "[data-article=" + article_id.replace("#", "") + "]"
-    section.find(SELECTORS.REFERENCE_LINK).hide().siblings(reference).show()
-
-  title: title
-  switchReferenceItems: switchReferenceItems
-  switchNavItems: switchNavItems