diff --git a/app/controllers/personal_conferences_controller.rb b/app/controllers/personal_conferences_controller.rb index c705932..e75c9ec 100644 --- a/app/controllers/personal_conferences_controller.rb +++ b/app/controllers/personal_conferences_controller.rb @@ -4,6 +4,7 @@ class PersonalConferencesController < ApplicationController writing_conferences = WritingConference.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) page = Page.where(:page_id => params[:page_id]).first rescue nil if page.custom_string_field == "table" + fields_to_show = page.custom_array_field rescue [] fields_to_show = [ "authors", "paper_title", @@ -11,7 +12,7 @@ class PersonalConferencesController < ApplicationController "location", "paper_types", "paper_levels" - ] + ] if fields_to_show.blank? else fields_to_show = [ "year", @@ -34,6 +35,8 @@ class PersonalConferencesController < ApplicationController t << {"value" => ( !writing_conference.conference_paper_levels.blank? ? "(#{writing_conference.conference_paper_levels.collect{|x| x.title}.join(', ')})" : nil)} when "paper_types" t << {"value" => ( !writing_conference.conference_paper_levels.blank? ? "(#{writing_conference.conference_paper_levels.collect{|x| x.title}.join(', ')})" : nil)} + when "publication_date" + t << {"value" => (writing_conference.send(fs).strftime("%Y/%m/%d") rescue "")} else t << {"value" => writing_conference.send(fs)} end @@ -87,4 +90,45 @@ class PersonalConferencesController < ApplicationController {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)} end + + def get_fields_for_index + @page = Page.find(params[:page_id]) rescue nil + @fields_to_show = [ + "year", + "authors", + "paper_title", + "conference_title", + "location", + "period_start_date", + "period_end_date", + "paper_type", + "paper_level", + "sponsor", + "author_type", + "number_of_authors", + "abstract", + "url", + "publication_date", + "isbn", + "isi_number" , + "language" + ] + @fields_to_show = @fields_to_show.map{|fs| [t("personal_conference.#{fs}"), fs]} + @default_fields_to_show = [ + "authors", + "paper_title", + "conference_title", + "location", + "paper_types", + "paper_levels" + ] + render :layout => false + end + + def save_index_fields + page = Page.find(params[:page_id]) rescue nil + page.custom_array_field = params[:keys] + page.save + render :json => {"success" => true}.to_json + end end \ No newline at end of file diff --git a/app/models/writing_conference.rb b/app/models/writing_conference.rb index 587518e..0e42d39 100644 --- a/app/models/writing_conference.rb +++ b/app/models/writing_conference.rb @@ -69,14 +69,18 @@ class WritingConference def self.get_plugin_datas_to_member(datas) page = Page.where(:module => "personal_conference").first rescue nil if !page.nil? && page.custom_string_field == "table" - fields_to_show = [ - "authors", - "paper_title", - "conference_title", - "location", - "paper_types", - "paper_levels" - ] + if !page.custom_array_field.blank? + fields_to_show = page.custom_array_field + else + fields_to_show = [ + "authors", + "paper_title", + "conference_title", + "location", + "paper_types", + "paper_levels" + ] + end else fields_to_show = [ "year", diff --git a/app/views/personal_conferences/get_fields_for_index.html.erb b/app/views/personal_conferences/get_fields_for_index.html.erb new file mode 100644 index 0000000..b370d20 --- /dev/null +++ b/app/views/personal_conferences/get_fields_for_index.html.erb @@ -0,0 +1,48 @@ +<% if !@page.nil? %> +
+ +<% else %> +