forked from saurabh/orbit4-5
fix member plugin intro or complete list
This commit is contained in:
parent
ed13c81880
commit
6de00652fe
|
@ -139,7 +139,8 @@ class MembersController < ApplicationController
|
|||
plugins = OrbitApp::Plugin::Registration.all rescue nil
|
||||
plugin_list = plugins.collect.with_index do |plugin, idx|
|
||||
intro = PersonalPluginIntro.find_by(member_profile_id: member.id, _type: "#{plugin.app_name}Intro") rescue nil
|
||||
if intro.nil? or intro.complete_list
|
||||
if !intro.blank?
|
||||
if !intro.complete_list.blank?
|
||||
plugin_data = plugin.app_name.constantize.where(member_profile_id: member) rescue nil
|
||||
pd = plugin_data.collect do |p|
|
||||
slug_title = ["JournalPaper","WritingConference"].include?(plugin.app_name) ? p.create_link : p.slug_title
|
||||
|
@ -148,20 +149,34 @@ class MembersController < ApplicationController
|
|||
"link_to_show" => OrbitHelper.url_to_plugin_show(p.to_param,plugin.module_app_name.underscore)
|
||||
}
|
||||
end
|
||||
elsif intro.brief_intro == true
|
||||
pd = []
|
||||
pd << {"data_title" => intro.text.html_safe}
|
||||
end
|
||||
|
||||
if !intro.brief_intro.blank?
|
||||
pdi = []
|
||||
pdi << {"data_intro_title" => intro.text.html_safe}
|
||||
end
|
||||
|
||||
if intro.complete_list.blank?
|
||||
complete_display = "hide"
|
||||
end
|
||||
|
||||
if intro.brief_intro.blank?
|
||||
brief_display = "hide"
|
||||
end
|
||||
end
|
||||
|
||||
{
|
||||
"plugin_data" => pd,
|
||||
"plugin_data_intro" => pdi,
|
||||
"complete_display" => complete_display,
|
||||
"brief_display" => brief_display,
|
||||
"plugin_name" => plugin.module_app_name.underscore,
|
||||
"plugin_title" => t('module_name.'+plugin.module_app_name.underscore),
|
||||
"plugin_class" => idx==0 ? "active" : ""
|
||||
}
|
||||
end
|
||||
plugin_list = plugin_list.reject{|plugin| plugin['plugin_data'].blank?}
|
||||
|
||||
plugin_list = plugin_list.reject{|plugin| plugin['plugin_data'].blank? and plugin['plugin_data_intro'].blank?}
|
||||
{
|
||||
"plugins" => plugin_list,
|
||||
"profile_data" => profile_data,
|
||||
|
|
Loading…
Reference in New Issue