orbit-basic/app/helpers/admin/frontend_widget_interface.rb

36 lines
962 B
Ruby

module Admin::FrontendWidgetInterface
protected
def get_categories_and_tags
unless @selected[:module_app].nil?
@categories = @selected[:module_app].categories
@tags = @selected[:module_app].tags
end
end
def get_frontend_data_count
local_item = set_local_item
@page_frontend_data_counts = @selected[:module_app].get_registration.get_data_count rescue []
@selected[:page_frontend_data_count] = case local_item
when PagePart
local_item.widget_data_count
when Page
local_item.frontend_data_count
end
end
def set_local_item
local_item = @part
local_item = @item if local_item.nil? && @item
local_item
end
def select_array_for_app_frontend_urls(hash)
ary = hash.collect{|name,data| [I18n.t(data["i18n"]),name]}
ary << [I18n.t('default_widget.name'),'default_widget'] if @selected[:module_app] and @selected[:module_app].has_default_widget?
ary
end
end