module Mokio module FrontendHelpers # # Frontend helper methods used with Mokio::StaticModules objects # module StaticModulesHelper # returns all contents by position_name # # ==== Attributes # # * +position_name+ - name of the module position # * +always_displayed+ - display all modules for positions or only always displayed # # ==== Variables # * +content+ - single static module from result # * +position+ - module position active record result def build_static_modules(position_name,always_displayed = false, with_intro = true) lang = Mokio::Lang.default_frontend position = Mokio::ModulePosition.find_by_name(position_name) html = " " if !position.nil? if always_displayed mod = Mokio::AvailableModule.static_module_active_for_lang(position.id,lang.id).only_always_displayed else mod = Mokio::AvailableModule.static_module_active_for_lang(position.id,lang.id) end html << build_content(mod,position, with_intro) else html << "Position not found" end html.html_safe end # builds html for a single position without tpl template # # ==== Attributes # # * +content+ - single static module from result # # ==== Variables # * +content.intro+ - static_module_intro from mokio_static_modules # * +content.content+ - static_module_content from mokio_static_modules def build_from_content(content, with_intro = true) html = "" if with_intro html = "