Explorar el Código

Fix bug with setting tittle

@soyjavi hace 14 años
padre
commit
418f2b43e9
Se han modificado 2 ficheros con 6 adiciones y 13 borrados
  1. 2 5
      src/router/Lungo.Router.js
  2. 4 8
      src/view/Lungo.View.Article.js

+ 2 - 5
src/router/Lungo.Router.js

@@ -14,6 +14,7 @@ LUNGO.Router = (function(lng, undefined) {
     var ELEMENT = lng.Constants.ELEMENT;
     var ERROR = lng.Constants.ERROR;
     var TRIGGER = lng.Constants.TRIGGER;
+    var ATTRIBUTE = lng.Constants.ATTRIBUTE;
     var HASHTAG_CHARACTER = '#';
 
     /**
@@ -47,7 +48,6 @@ LUNGO.Router = (function(lng, undefined) {
      * @param {string} <article> Id
      */
     var article = function(section_id, article_id, element) {
-        section_id = lng.Core.parseUrl(section_id);
         article_id = lng.Core.parseUrl(article_id);
         var current =  lng.Element.Current.article;
 
@@ -57,11 +57,8 @@ LUNGO.Router = (function(lng, undefined) {
                 current.removeClass(CLASS.CURRENT).trigger(TRIGGER.UNLOAD);
                 target.addClass(CLASS.CURRENT).trigger(TRIGGER.LOAD);
                 lng.Element.Current.article = target;
-                //@todo: refacto
-                /*
-                tenemos que asignar el titulo a la section activa
 
-                */
+                lng.View.Article.title(element.data(ATTRIBUTE.TITLE));
                 lng.View.Article.switchNavItems(article_id);
                 lng.View.Article.switchReferenceItems(article_id, lng.Element.Current.section);
             }

+ 4 - 8
src/view/Lungo.View.Article.js

@@ -13,7 +13,6 @@ LUNGO.View.Article = (function(lng, undefined) {
     var ELEMENT = lng.Constants.ELEMENT;
     var CLASS = lng.Constants.CLASS;
     var ATTRIBUTE = lng.Constants.ATTRIBUTE;
-    var TRIGGER = lng.Constants.TRIGGER;
 
     var SELECTORS = {
         NAVIGATION_ITEM: 'a[href][data-target="article"]',
@@ -26,13 +25,9 @@ LUNGO.View.Article = (function(lng, undefined) {
      *
      * @method show
      */
-    var show = function(section_id, article_id, element) {
-        if (element) {
-            var title = element.data(ATTRIBUTE.TITLE);
-
-            if (title) {
-                lng.Element.Current.section.find(SELECTORS.TITLE_OF_ARTICLE).text(title);
-            }
+    var title = function(value) {
+        if (value) {
+            lng.Element.Current.section.find(SELECTORS.TITLE_OF_ARTICLE).text(value);
         }
         //@todo: Fallback android Inputs
         //lng.Fallback.androidInputs(current_active_article_id, false);
@@ -62,6 +57,7 @@ LUNGO.View.Article = (function(lng, undefined) {
     };
 
     return {
+        title: title,
         switchReferenceItems: switchReferenceItems,
         switchNavItems: switchNavItems
     };