forked from saurabh/personal-journal
修復member_profile_id型態問題
This commit is contained in:
parent
934b054974
commit
def145d70d
|
@ -1,28 +1,37 @@
|
||||||
module PersonalJournal
|
module PersonalJournal
|
||||||
class Engine < ::Rails::Engine
|
class Engine < ::Rails::Engine
|
||||||
initializer "personal_journal" do
|
initializer "personal_journal" do
|
||||||
OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do
|
require File.expand_path('../../../app/models/journal_paper', __FILE__)
|
||||||
module_label 'module_name.journal_paper'
|
mp_id_maps = {}
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
JournalPaper.where({'member_profile_id.0'=> {'$exists'=> false}, 'member_profile_id' => {'$ne'=> nil}}).pluck(:id, :member_profile_id).each do |jpv|
|
||||||
personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/personal_journal/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'PersonalJournal', :one_line_title => true, :field_modifiable => true, :analysis => true, :analysis_path => "/admin/journal_papers/analysis"
|
mp_id_maps[jpv[1]] = [] if !mp_id_maps[jpv[1]]
|
||||||
|
mp_id_maps[jpv[1]] << jpv[0]
|
||||||
|
end
|
||||||
|
mp_id_maps.each do |mp_id, ids|
|
||||||
|
JournalPaper.where(:id.in => ids).update_all(member_profile_id: [mp_id])
|
||||||
|
end
|
||||||
|
OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do
|
||||||
|
module_label 'module_name.journal_paper'
|
||||||
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/personal_journal/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'PersonalJournal', :one_line_title => true, :field_modifiable => true, :analysis => true, :analysis_path => "/admin/journal_papers/analysis"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
page_custom_option({year: '<%= select_tag "#{f.object_name}[custom_data_field][year][]", options_for_select((1930...(DateTime.now.year+5)).to_a.reverse, (f.object.custom_data_field[:year].to_a rescue [])), {multiple: true} %>'})
|
page_custom_option({year: '<%= select_tag "#{f.object_name}[custom_data_field][year][]", options_for_select((1930...(DateTime.now.year+5)).to_a.reverse, (f.object.custom_data_field[:year].to_a rescue [])), {multiple: true} %>'})
|
||||||
page_custom_option({journal_type: '<% JournalType.all.each do |journal_type| %><label><%= check_box_tag "#{f.object_name}[custom_data_field][journal_type][]", journal_type.id.to_s, (f.object.custom_data_field[:journal_type].include?(journal_type.id.to_s) rescue false) %><%= journal_type.title %></label><% end %>'})
|
page_custom_option({journal_type: '<% JournalType.all.each do |journal_type| %><label><%= check_box_tag "#{f.object_name}[custom_data_field][journal_type][]", journal_type.id.to_s, (f.object.custom_data_field[:journal_type].include?(journal_type.id.to_s) rescue false) %><%= journal_type.title %></label><% end %>'})
|
||||||
rescue => e
|
rescue => e
|
||||||
puts ['there_was_no_page_custom_option',e]
|
puts ['there_was_no_page_custom_option',e]
|
||||||
end
|
end
|
||||||
version "0.1"
|
version "0.1"
|
||||||
desktop_enabled true
|
desktop_enabled true
|
||||||
organization "Rulingcom"
|
organization "Rulingcom"
|
||||||
author "RD dep"
|
author "RD dep"
|
||||||
intro "I am intro"
|
intro "I am intro"
|
||||||
update_info 'some update_info'
|
update_info 'some update_info'
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
icon_class_no_sidebar "icons-user"
|
icon_class_no_sidebar "icons-user"
|
||||||
data_count 1..10
|
data_count 1..10
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue