37 lines
1.3 KiB
Ruby
37 lines
1.3 KiB
Ruby
|
class PersonalPluginTemplatesController < ApplicationController
|
||
|
def index
|
||
|
plugin_templates = PluginTemplate.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||
|
plugin_templates_list = plugin_templates.collect do |plugin_template|
|
||
|
member = plugin_template.member_profile
|
||
|
fields_to_show = col_name_to_show_in_index_page
|
||
|
|
||
|
fields_hash = fields_to_show.map{|field| [field, get_display_field(field)]}.to_h
|
||
|
|
||
|
path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
|
||
|
fields_hash["authors"] = "<a href='#{path}'>#{member.name}</a>"
|
||
|
fields_hash["link_to_show"] = OrbitHelper.url_to_show(course.to_param)
|
||
|
end
|
||
|
|
||
|
extras = extra_translate_title
|
||
|
|
||
|
extras["widget-title"] = I18n.t("module_name.personal_plugin_template")
|
||
|
{
|
||
|
"plugin_templates" => plugin_templates_list,
|
||
|
"extras" => extras,
|
||
|
"total_pages" => plugin_templates.total_pages
|
||
|
}
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
params = OrbitHelper.params
|
||
|
plugin = PluginTemplate.where(:is_hidden=>false).find_by(uid: params[:uid])
|
||
|
fields_to_show = col_name_to_show_in_show_page
|
||
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
||
|
end
|
||
|
|
||
|
def get_display_field(field)
|
||
|
value_case_codes
|
||
|
return value
|
||
|
end
|
||
|
end
|