### Initialize the layout of a certain
@namespace Lungo.View @class Article @author Javier Jimenez Villar || @soyjavi @author Guillermo Pascual || @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