2014-04-01 07:10:21 +00:00
|
|
|
module OrbitHelper
|
2014-04-21 02:48:36 +00:00
|
|
|
def self.set_params(params)
|
|
|
|
@params = params
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.get_params
|
|
|
|
@params
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.url_to_show(slug)
|
|
|
|
if @params[:url]
|
|
|
|
"/#{@site_locale}#{@params[:url]}/#{slug}"
|
|
|
|
else
|
|
|
|
page = Page.where(:module => self.current_widget_module).first
|
|
|
|
"/#{@site_locale}#{page.url}/#{slug}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def page_url(url)
|
|
|
|
"#{request.host_with_port}/#{locale}#{url}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.set_site_locale(locale)
|
|
|
|
@site_locale = locale
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.get_site_locale
|
|
|
|
@site_locale
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.current_widget_module
|
|
|
|
@controller_name
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.set_current_widget_module(name)
|
|
|
|
@controller_name = name
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_item_module_infos(page)
|
|
|
|
if page.parent_page_id.nil?
|
|
|
|
["Home","icons-house"]
|
|
|
|
else
|
|
|
|
module_app = ModuleApp.where(:key => page.module).first
|
|
|
|
[module_app.title, module_app.get_registration.icon_class]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# ===============================================================
|
|
|
|
# Breadcrumbs
|
|
|
|
# ===============================================================
|
|
|
|
def back_end_breadcrumb
|
|
|
|
res = ''
|
|
|
|
divider = "<span class='divider'>/</span>"
|
|
|
|
res << "<li><a href='#{admin_dashboards_path}'>#{t(:dashboard_)}</a>#{divider}</li>"
|
|
|
|
case controller.controller_name
|
|
|
|
when 'authorizations'
|
|
|
|
res << "<li><a href='/#{params[:controller]}/#{@module_app.key}'>#{@module_app.title}</a>#{divider}</li>"
|
|
|
|
case params[:type]
|
|
|
|
when 'approval'
|
|
|
|
res << "<li class='active'>#{t(:approval_)}</li>"
|
|
|
|
when 'category'
|
|
|
|
res << "<li class='active'>#{t(:category_auth)}</li>"
|
|
|
|
when nil
|
|
|
|
res << "<li class='active'>#{t(:module_authorization)}</li>"
|
|
|
|
else
|
|
|
|
res << "<li class='active'>#{params[:type].underscore.humanize.capitalize} #{t(:authorization_)}</li>"
|
|
|
|
end
|
|
|
|
when 'categories'
|
|
|
|
res << "<li>#{@module_app.title}#{divider}</li>"
|
|
|
|
res << "<li class='active'>#{t(:categories)}</li>"
|
|
|
|
when 'module_tags'
|
|
|
|
res << "<li>#{@module_app.title}#{divider}</li>"
|
|
|
|
res << "<li class='active'>#{t(:tags)}</li>"
|
|
|
|
else
|
|
|
|
if params[:action].eql?('index')
|
|
|
|
res << "<li>#{@module_app.title}</li>"
|
|
|
|
else
|
|
|
|
res << "<li><a href='/#{params[:controller]}'>#{@module_app.title}</a>#{divider}</li>"
|
|
|
|
res << "<li class='active'>#{t(params[:action], scope: 'restful_actions')}</li>"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
res.html_safe
|
|
|
|
end
|
|
|
|
|
2014-04-01 07:10:21 +00:00
|
|
|
end
|