diff --git a/app/controllers/admin/application_forms_controller.rb b/app/controllers/admin/application_forms_controller.rb index 99bdade..2bc7d3b 100644 --- a/app/controllers/admin/application_forms_controller.rb +++ b/app/controllers/admin/application_forms_controller.rb @@ -4,6 +4,14 @@ class Admin::ApplicationFormsController < OrbitAdminController require 'axlsx' include Admin::ApplicationFormsHelper helper Admin::ApplicationFormsFieldHelper + layout :compute_layout + def compute_layout + if action_name=='print' + false + else + 'back_end' + end + end before_action ->(module_app = @app_title) { set_variables module_app } before_action :set_application_form, only: [:edit, :set_write_off, :application_form_signup, :destroy,:application_form_signup_admin_setting,:update_application_form_signup_admin_setting,:get_reviewer_block,:get_session_block,:update_application_form_review,:update_application_form_session,:reviewer_setting,:update_reviewer_setting,:template_setting,:update_template_setting,:sub_page_setting] before_action :set_application_form_signup_admin_setting, only: [:application_form_signup,:application_form_signup_admin_setting,:update_application_form_signup_admin_setting,:get_reviewer_block,:get_session_block] @@ -144,21 +152,22 @@ class Admin::ApplicationFormsController < OrbitAdminController @fields_values = @fields_values.collect.with_index{|fields_values,i| [i, fields_values.values.map{|v| v[I18n.locale]} ] }.to_h end def update_reviewer_setting - application_form_params[:application_form_reviews_attributes].keys.each do |i| - if application_form_params[:application_form_reviews_attributes][i][:default_topics].present? - application_form_params[:application_form_reviews_attributes][i][:default_topics] = [] if application_form_params[:application_form_reviews_attributes][i][:default_topics].nil? + application_form_main_params = application_form_params + application_form_main_params[:application_form_reviews_attributes].keys.each do |i| + if application_form_main_params[:application_form_reviews_attributes][i][:default_topics].present? + application_form_main_params[:application_form_reviews_attributes][i][:default_topics] = [] if application_form_main_params[:application_form_reviews_attributes][i][:default_topics].nil? default_topics_values = [] - (0...application_form_params[:application_form_reviews_attributes][i][:default_topics].count).each do |ii| - default_topics_values << (Array(application_form_params[:application_form_reviews_attributes][i][:default_topics_values][ii.to_s]) rescue []) + (0...application_form_main_params[:application_form_reviews_attributes][i][:default_topics].count).each do |ii| + default_topics_values << (Array(application_form_main_params[:application_form_reviews_attributes][i][:default_topics_values][ii.to_s]) rescue []) end - application_form_params[:application_form_reviews_attributes][i][:default_topics_values] = default_topics_values + application_form_main_params[:application_form_reviews_attributes][i][:default_topics_values] = default_topics_values else - application_form_params[:application_form_reviews_attributes][i][:default_topics] = [] - application_form_params[:application_form_reviews_attributes][i][:default_topics_values] = [] + application_form_main_params[:application_form_reviews_attributes][i][:default_topics] = [] + application_form_main_params[:application_form_reviews_attributes][i][:default_topics_values] = [] end end #render :html => application_form_params and return - @application_form.update_attributes(application_form_params) + @application_form.update_attributes(application_form_main_params) unassigned_application_form_signup_ids = @application_form.application_form_signup_ids.map{|s| s.to_s} unassigned_mode_1_application_form_signup_ids = unassigned_application_form_signup_ids.dup @application_form.application_form_reviews.each do |sr| @@ -376,12 +385,12 @@ class Admin::ApplicationFormsController < OrbitAdminController if params[:sort] == 'event_during' sort = {:application_form_start_date.to_sym=>params[:order]} elsif params[:sort] == 'signup_during' - sort = {:signup_start_date.to_sym=>params[:order]} + sort = {:application_form_start_date.to_sym=>params[:order]} else sort = {params[:sort].to_sym=>params[:order]} end else - sort = {:signup_start_date=>"desc",:created_at=>"desc"} + sort = {:application_form_start_date=>"desc",:created_at=>"desc"} end @application_forms = ApplicationFormMain.all.order_by(sort).with_categories(filters("category")) @@ -428,9 +437,7 @@ class Admin::ApplicationFormsController < OrbitAdminController end def copy @application_form = ApplicationFormMain.find(params[:id]).clone_new - @member_1st = MemberProfile.where(:id.in=>@application_form.reviewer_1st_ids).to_a rescue [] - @member_2nd = MemberProfile.where(:id.in=>@application_form.reviewer_2nd_ids).to_a rescue [] - @member_3rd = MemberProfile.where(:id.in=>@application_form.reviewer_3rd_ids).to_a rescue [] + @members = @application_form.reviewer_ids_list.collect{|r_ids| MemberProfile.where(:id.in=>Array(r_ids)).to_a} @email_set = @application_form.application_form_email_sets @signup_sets = @application_form.application_form_signup_field_sets @@ -440,10 +447,10 @@ class Admin::ApplicationFormsController < OrbitAdminController @review = @application_form.application_form_reviews.first end def new - @member_1st = nil - @member_2nd = nil - @member_3rd = nil @application_form = ApplicationFormMain.new + @application_form_setting = ApplicationFormSetting.get_one + + @members = (0...@application_form_setting.reviewer_length).collect{nil} create_set (false) @signup_sets = @application_form.application_form_signup_field_sets @submission_set = @application_form.application_form_submission_field_sets @@ -453,22 +460,19 @@ class Admin::ApplicationFormsController < OrbitAdminController end def create - - if !application_form_params['application_form_links_attributes'].nil? - application_form_params['application_form_links_attributes'].each do |idx,link| - application_form_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank? + application_form_main_params = application_form_params + if !application_form_main_params['application_form_links_attributes'].nil? + application_form_main_params['application_form_links_attributes'].each do |idx,link| + application_form_main_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank? end end - application_form_main_params = application_form_params application_form_signup_set_params = application_form_main_params['application_form_signup_field_sets'] - application_form_submission_set_params = application_form_main_params['application_form_submission_field_sets'] application_form_email_sets_params = application_form_main_params['application_form_email_sets'] application_form_signup_field_customs_params = application_form_main_params["application_form_signup_field_customs"].to_h rescue {} application_form_main_params["application_form_signup_field_customs"].to_h.each do |k,v| v.delete "title" end application_form_main_params.delete(:application_form_signup_field_sets) - application_form_main_params.delete(:application_form_submission_field_sets) application_form_main_params.delete(:application_form_email_sets) application_form = ApplicationFormMain.new(application_form_main_params) application_form.create_user_id = current_user.id @@ -481,9 +485,6 @@ class Admin::ApplicationFormsController < OrbitAdminController application_form_signup_set_params.each do |key,value| application_form.application_form_signup_field_sets[key.to_i].update_attributes(value) rescue nil end - application_form_submission_set_params.each do |key,value| - application_form.application_form_submission_field_sets[key.to_i].update_attributes(value) rescue nil - end application_form_email_sets_params.each do |key,value| application_form.application_form_email_sets[key.to_i].update_attributes(value) rescue nil end @@ -494,9 +495,6 @@ class Admin::ApplicationFormsController < OrbitAdminController application_form_signup_set_params.each do |key,value| application_form.application_form_signup_field_sets.create(value) end - application_form_submission_set_params.each do |key,value| - application_form.application_form_submission_field_sets.create(value) - end application_form_email_sets_params.each do |key,value| application_form.application_form_email_sets.create(value) end @@ -505,8 +503,20 @@ class Admin::ApplicationFormsController < OrbitAdminController end + def setting + @application_form_setting = ApplicationFormSetting.get_one + end + + def update_setting + @application_form_setting = ApplicationFormSetting.get_one + tmp = params.require(:application_form_setting).permit! + @application_form_setting.update_attributes(tmp) + redirect_to admin_application_forms_path + end + def edit @application_form_items = ApplicationFormItem.all + @application_form_setting = ApplicationFormSetting.get_one @application_form = ApplicationFormMain.where(id: params[:id]).first except_attributes = ApplicationFormSignup::HiddenFields @application_form.application_form_signup_field_sets.each do |signup_field_set| @@ -528,9 +538,7 @@ class Admin::ApplicationFormsController < OrbitAdminController @signup_sets = @application_form.application_form_signup_field_sets @submission_set = @application_form.application_form_submission_field_sets @custom_set = @application_form.application_form_signup_field_customs - @member_1st = MemberProfile.where(:id.in=>@application_form.reviewer_1st_ids).to_a rescue [] - @member_2nd = MemberProfile.where(:id.in=>@application_form.reviewer_2nd_ids).to_a rescue [] - @member_3rd = MemberProfile.where(:id.in=>@application_form.reviewer_3rd_ids).to_a rescue [] + @members = @application_form.reviewer_ids_list.collect{|r_ids| MemberProfile.where(:id.in=>Array(r_ids)).to_a} if (@application_form.organizer_id == current_user.member_profile_id rescue false) @user_authorized_categories = @module_app.categories.enabled.to_a else @@ -539,13 +547,12 @@ class Admin::ApplicationFormsController < OrbitAdminController end def update - @application_form_params = application_form_params rescue {} + @application_form_params = application_form_params if @application_form_params.count != 0 @application_form_params[:registration_status] = (@application_form_params[:registration_status] ? @application_form_params[:registration_status] : []) uid = params[:id].split('-').last @application_form = ApplicationFormMain.find_by(:uid=>uid) if @application_form_params.has_key?("title_translations") - @application_form_params["reviewer_ids"] = [] if @application_form_params["reviewer_ids"].nil? @application_form_params["organizer_id"] = nil if @application_form_params["organizer_id"].nil? end if @application_form_params[:application_form_signup_fields] @@ -601,14 +608,14 @@ class Admin::ApplicationFormsController < OrbitAdminController redirect_to admin_application_forms_path and return else - if !application_form_params['application_form_links_attributes'].nil? - application_form_params['application_form_links_attributes'].each do |idx,link| - application_form_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank? + if !@application_form_params['application_form_links_attributes'].nil? + @application_form_params['application_form_links_attributes'].each do |idx,link| + @application_form_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank? end end @application_form.update_user_id = current_user.id - if @application_form.update_attributes(application_form_params) + if @application_form.update_attributes(@application_form_params) @application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true} redirect_to params['referer_url'] and return else @@ -742,6 +749,121 @@ class Admin::ApplicationFormsController < OrbitAdminController redirect_to "/admin/application_forms/@application_form_id.to_s/application_form_signup" end + def print_setting + @set = nil + @application_form_id = params[:application_form_id] + if @application_form_id.blank? + @set = ApplicationFormPrintSetting.first + else + @set = ApplicationFormCategoryPrintSetting.where(:application_form_id=>@application_form_id).first + @set = ApplicationFormCategoryPrintSetting.new if @set.nil? + end + @set = ApplicationFormPrintSetting.create if @set.nil? + @url = print_setting_save_admin_application_forms_path + end + def print_setting_save + locale = I18n.locale + if params[:application_form_print_setting][:application_form_id].present? + set = ApplicationFormCategoryPrintSetting.where(:application_form_id=>params[:application_form_print_setting][:application_form_id]).first + set = ApplicationFormCategoryPrintSetting.create(:application_form_id=>params[:application_form_print_setting][:application_form_id]) if set.nil? + else + set = ApplicationFormPrintSetting.first + end + set.update_attributes(print_format: params[:application_form_print_setting][:print_format],save_name: params[:application_form_print_setting][:save_name]) + redirect_to "/#{locale}/admin/application_forms" + end + + def process_format_text(text,custom_fields) + customs = text.scan(//m).uniq + if customs.length != 0 + custom_exist_nums = [] + custom_exists = text.scan(/{custom\d+}/) + custom_exists.each do |custom_exist| + k = custom_exist[6...-1].to_i - 1 + custom_exist_nums << k + end + customs.each do |custom| + tmp = custom_fields.keys.collect.with_index do |k,i| + if custom_exist_nums.exclude?(i) + tp = custom.gsub(/{custom}/,"{custom#{i+1}}") + tp = tp.gsub(/{custom_title}/,"{custom#{i+1}_title}") + tp + else + nil + end + end.compact.join + text = text.gsub(custom,tmp) + end + end + format_texts = text.scan(/{\w+\|*\w+}/).uniq + format_texts.each do |format_text| + if format_text[-7...-1] == '_title' + case format_text[1...-7] + when /custom\d+/ + i = format_text.scan(/\d+/)[0].to_i - 1 + k = custom_fields.keys[i] rescue nil + if !k.blank? + text_tp = custom_fields[k][I18n.locale] rescue '' + text = text.gsub(format_text,text_tp) + end + when 'title' + text = text.gsub(format_text,I18n.t('title')) + when 'submission_time' + text = text.gsub(format_text,I18n.t('application_form_signup.submission_time')) + when 'category' + text = text.gsub(format_text,I18n.t('category')) + when 'name','email','phone' + text = text.gsub(format_text,I18n.t("application_form_signup.#{format_text[1...-7]}")) + end + else + case format_text[1...-1] + when 'submission_time' + text = text.gsub(format_text,@application_form_signup.created_at.strftime('%Y/%m/%d %H:%M')) + when 'title' + text = text.gsub(format_text,@application_form_signup.application_form_main.title.to_s) + when 'title','name','email','phone' + text = text.gsub(format_text,@application_form_signup.send(format_text[1...-1]).to_s) + when 'category' + cat = @application_form_signup.application_form_main.category.title rescue '' + text = text.gsub(format_text,cat) + when 'name|mask' + name_tp = @application_form_signup.name.to_s + if name_tp.length>1 + name_tp = name_tp[0] + '*'*(name_tp.length-1) + end + text = text.gsub(format_text,name_tp) + when /custom\d+\|format/ #not finish + i = format_text.scan(/\d+/)[0].to_i - 1 + k = custom_fields.keys[i] rescue nil + if !k.blank? + text_tp = @application_form_signup.application_form_signup_values.select{|v| v.application_form_signup_field_id==k}[0].get_value_by_locale + text = text.gsub(format_text,text_tp.to_s) + end + when /custom\d+/ + i = format_text.scan(/\d+/)[0].to_i - 1 + k = custom_fields.keys[i] rescue nil + if !k.blank? + text_tp = @application_form_signup.application_form_signup_values.select{|v| v.application_form_signup_field_id==k}[0].get_value_by_locale + text = text.gsub(format_text,text_tp.to_s) + end + end + end + end + text + end + + def print + @application_form_signup = ApplicationFormSignup.find(params[:id]) + @application_form = @application_form_signup.application_form_main + @print_setting = ApplicationFormCategoryPrintSetting.where(application_form_id: @application_form_signup.application_form_main_id.to_s).first + @print_setting = ApplicationFormPrintSetting.first if @print_setting.nil? + @save_name = @print_setting.save_name rescue '' + @print_text = @print_setting.print_format rescue '' + custom_fields = @application_form.application_form_signup_fields.order_by({key: :asc}).collect{|v| [v.id,v.title_translations]}.to_h + @print_text = process_format_text(@print_text,custom_fields) + @save_name = process_format_text(@save_name,custom_fields) + end + private def set_application_form @@ -757,7 +879,10 @@ class Admin::ApplicationFormsController < OrbitAdminController params.require(:application_form_template_setting).permit! end def application_form_params - params.require(:application_form_main).permit! + tmp = params.require(:application_form_main).permit! + tmp['reviewer_ids_list'] = tmp['reviewer_enables'].map{|k,i| Array((tmp['reviewer_ids_list'][k] rescue []))} + tmp['reviewer_enables'] = tmp['reviewer_enables'].map{|k,v| v.to_i != 0 ? true : false} + tmp end def create_set (save_flag) except_attributes = ApplicationFormSignup::HiddenFields diff --git a/app/controllers/application_forms_controller.rb b/app/controllers/application_forms_controller.rb index b979b0d..87d610d 100644 --- a/app/controllers/application_forms_controller.rb +++ b/app/controllers/application_forms_controller.rb @@ -25,11 +25,11 @@ class ApplicationFormsController < ApplicationController session = OrbitHelper.request.session application_forms = application_forms.map do |application_form| link_url = OrbitHelper.url_to_show(application_form.to_param) - if !application_form.registration_status.blank? && (application_form.signup_start_date <= time_now rescue false) && ( application_form.signup_end_date.nil? || application_form.signup_end_date+1 >= time_now ) + if (application_form.application_form_start_date <= time_now rescue false) && ( application_form.application_form_end_date.nil? || application_form.application_form_end_date+1 >= time_now ) sign_up = ('' + I18n.t('application_form.signup') + '').html_safe elsif application_form.registration_status.blank? sign_up = I18n.t('application_form.sign_up_not_open') - elsif (application_form.signup_start_date > @time_now rescue false) + elsif (application_form.application_form_start_date > @time_now rescue false) sign_up = I18n.t('application_form.sign_up_not_yet') else sign_up = I18n.t('application_form.sign_up_overdue') @@ -168,11 +168,11 @@ class ApplicationFormsController < ApplicationController time_now = Time.now params = OrbitHelper.params application_form = ApplicationFormMain.find_by(uid: params[:uid]) - if !application_form.registration_status.blank? && application_form.signup_start_date <= time_now && ( application_form.signup_end_date.nil? || application_form.signup_end_date+1 >= time_now ) + if application_form.application_form_start_date <= time_now && ( application_form.application_form_end_date.nil? || application_form.application_form_end_date+1 >= time_now ) sign_up = ('' + t('application_form.signup') + '').html_safe elsif application_form.registration_status.blank? sign_up = t('application_form.sign_up_not_open') - elsif application_form.signup_start_date > time_now + elsif application_form.application_form_start_date > time_now sign_up = t('application_form.sign_up_not_yet') else sign_up = t('application_form.sign_up_overdue') @@ -194,7 +194,7 @@ class ApplicationFormsController < ApplicationController 'contribute_action' => contribute_action, 'time_now' => time_now, 'contribute_time_range' => ApplicationFormMain.time_range(application_form.contribute_start_date, application_form.contribute_end_date), - 'sign_up_time_range' => ApplicationFormMain.time_range(application_form.signup_start_date, application_form.signup_end_date), + 'sign_up_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date), 'application_form_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) } @_request = OrbitHelper.request @@ -302,11 +302,11 @@ class ApplicationFormsController < ApplicationController application_form = ApplicationFormMain.find_by(uid: params[:uid]) - if !application_form.registration_status.blank? && application_form.signup_start_date <= time_now && ( application_form.signup_end_date.nil? || application_form.signup_end_date+1 >= time_now ) + if application_form.application_form_start_date <= time_now && ( application_form.application_form_end_date.nil? || application_form.application_form_end_date+1 >= time_now ) sign_up = ('' + t('application_form.signup') + '').html_safe elsif application_form.registration_status.blank? sign_up = t('application_form.sign_up_not_open') - elsif application_form.signup_start_date > time_now + elsif application_form.application_form_start_date > time_now sign_up = t('application_form.sign_up_not_yet') else sign_up = t('application_form.sign_up_overdue') @@ -332,7 +332,7 @@ class ApplicationFormsController < ApplicationController 'contribute_action' => contribute_action, 'time_now' => time_now, 'contribute_time_range' => ApplicationFormMain.time_range(application_form.contribute_start_date, application_form.contribute_end_date), - 'sign_up_time_range' => ApplicationFormMain.time_range(application_form.signup_start_date, application_form.signup_end_date), + 'sign_up_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date), 'application_form_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) } @@ -394,8 +394,8 @@ class ApplicationFormsController < ApplicationController @signup = ApplicationFormSignup.where(email: params[:application_form_signup][:email], application_form_main_id: params[:application_form_signup][:application_form_main_id] ).first - @application_form_signup = ApplicationFormSignup.new(application_form_signup_params) @application_form = ApplicationFormMain.where(id:params[:application_form_signup][:application_form_main_id]).first + @application_form_signup = ApplicationFormSignup.new(application_form_signup_params) if @application_form.application_form_signup_field_sets.count!=0 flag = @application_form.application_form_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled else @@ -697,7 +697,9 @@ class ApplicationFormsController < ApplicationController end def application_form_signup_params - params.require(:application_form_signup).permit! + tmp = params.require(:application_form_signup).permit! + tmp['reviewer_ids_list'] = (0...@application_form.reviewer_enables.length).map{|k| Array((tmp['reviewer_ids_list'][k.to_s] rescue []))} + tmp end def application_form_signup_contribute_params diff --git a/app/models/application_form_category_print_setting.rb b/app/models/application_form_category_print_setting.rb new file mode 100644 index 0000000..ee0d4cd --- /dev/null +++ b/app/models/application_form_category_print_setting.rb @@ -0,0 +1,7 @@ +class ApplicationFormCategoryPrintSetting + include Mongoid::Document + include Mongoid::Timestamps + field :print_format, type: String,default: '' + field :save_name, type: String,default: 'ApplicationForm_{title}' + field :application_form_id +end diff --git a/app/models/application_form_main.rb b/app/models/application_form_main.rb index 01dacf2..6a315eb 100644 --- a/app/models/application_form_main.rb +++ b/app/models/application_form_main.rb @@ -27,9 +27,6 @@ class ApplicationFormMain field :application_form_start_date, :type => Date, :default => Time.now field :application_form_end_date, :type => Date, :default => Time.now - field :signup_start_date, :type => Date, :default => Time.now - field :signup_end_date, :type => Date, :default => Time.now - field :contribute_start_date, :type => Date field :contribute_end_date, :type => Date @@ -40,6 +37,10 @@ class ApplicationFormMain field :create_user_id field :update_user_id + field :reviewer_type_list, default: [], :type=>Array + field :reviewer_ids_list, default: [], :type=>Array + field :reviewer_enables, default: [], :type=> Array + field :reviewer_1st field :reviewer_1st_type field :reviewer_1st_ids @@ -91,6 +92,7 @@ class ApplicationFormMain accepts_nested_attributes_for :application_form_template_setting, :allow_destroy => true before_save do module_app_key = "application_form" + """ add_module_app_member_ids = [] remove_module_app_member_ids = [] if self.reviewer_ids_changed? && (self.copy_id.nil? || !self.new_record?) @@ -142,6 +144,7 @@ class ApplicationFormMain next end end + """ if self.enable_summary_choice (0...self.summary_chioices.count).to_a.each do |i| application_form_session = self.application_form_sessions.where(:key=>i).first @@ -171,9 +174,10 @@ class ApplicationFormMain self.application_form_submission_fields.each do |application_form_submission_field| application_form_submission_field.application_form_submission_values.update_all(:key=>application_form_submission_field.key) end + """ current_reviewer_ids = self.reviewer_ids.to_a self.application_form_reviews.where(:reviewer_id.nin=>current_reviewer_ids).destroy - module_app_key = "application_form" + module_app_key = 'application_form' current_reviewer_ids.each do |reviewer_id| application_form_review = self.application_form_reviews.select{|sr| sr.reviewer_id == reviewer_id}.first if application_form_review.nil? @@ -185,6 +189,7 @@ class ApplicationFormMain end end end + """ end end after_initialize do @@ -193,17 +198,19 @@ class ApplicationFormMain save_flag = false application_form_reviews = self.application_form_reviews if application_form_reviews.present? - if self["reviewer_ids"].nil? - self["reviewer_ids"] = application_form_reviews.pluck(:reviewer_id).flatten.select{|s| !s.nil?}.to_a + """ + if self['reviewer_ids'].nil? + self['reviewer_ids'] = application_form_reviews.pluck(:reviewer_id).flatten.select{|s| !s.nil?}.to_a save_flag = true else - self["reviewer_ids"].each do |reviewer_id| + self['reviewer_ids'].each do |reviewer_id| application_form_review_to_destroy = application_form_reviews.where(:reviewer_id=>reviewer_id)[1] if application_form_review_to_destroy application_form_review_to_destroy.destroy end end end + """ if application_form_reviews.count != 0 && self.review_start_date.nil? && self.review_end_date.nil? review_start_date = application_form_reviews.pluck(:review_start_date).select{|t| t.present?}.first.to_datetime rescue nil review_end_date = application_form_reviews.pluck(:review_end_date).select{|t| t.present?}.first.to_datetime rescue nil diff --git a/app/models/application_form_print_setting.rb b/app/models/application_form_print_setting.rb new file mode 100644 index 0000000..6a6bc09 --- /dev/null +++ b/app/models/application_form_print_setting.rb @@ -0,0 +1,6 @@ +class ApplicationFormPrintSetting + include Mongoid::Document + include Mongoid::Timestamps + field :print_format, type: String,default: '' + field :save_name, type: String,default: 'ApplicationForm_{title}' +end diff --git a/app/models/application_form_setting.rb b/app/models/application_form_setting.rb new file mode 100644 index 0000000..6a5f039 --- /dev/null +++ b/app/models/application_form_setting.rb @@ -0,0 +1,11 @@ +class ApplicationFormSetting + include Mongoid::Document + include Mongoid::Timestamps + + field :reviewer_length, default: 3, :type=> Integer + def self.get_one + s = self.first + s = self.create if s.nil? + s + end +end \ No newline at end of file diff --git a/app/models/application_form_signup.rb b/app/models/application_form_signup.rb index 8328e13..7a735b3 100644 --- a/app/models/application_form_signup.rb +++ b/app/models/application_form_signup.rb @@ -3,8 +3,8 @@ class ApplicationFormSignup include Mongoid::Document include Mongoid::Timestamps - HiddenFields = ['application_form_signup_id','_id', 'created_at', 'updated_at','application_form_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'application_form_session_id',"application_form_session_ids","preferred_session","sort_number","abstract_number","presentation_type"] - DefaultEnableFields = ['status','name','tel','phone','email','password'] + HiddenFields = ['application_form_signup_id', 'password', 'status', 'reviewer_ids_list','_id', 'created_at', 'updated_at','application_form_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'application_form_session_id',"application_form_session_ids","preferred_session","sort_number","abstract_number","presentation_type"] + DefaultEnableFields = ['name','tel','phone','email'] field :sort_number , type: Integer, default: 10000 field :status @@ -21,6 +21,21 @@ class ApplicationFormSignup field :final_session #only store old data , not used field :final_sessions field :preferred_sessions, type: Array, default: [] + field :reviewer_ids_list, type: Array, default: [] + def reviewer_ids_list + main = self.application_form_main + main.reviewer_enables.each_with_index.collect do |e,k| + if e + if main.reviewer_type_list[k]=='fixed' + main.reviewer_ids_list[k] + else + super()[k] + end + else + nil + end + end + end belongs_to :application_form_main field :application_form_session_id #only store old data , not used field :application_form_session_ids, type: Array, default: [] diff --git a/app/views/admin/application_forms/_application_form_signup_render_table.html.erb b/app/views/admin/application_forms/_application_form_signup_render_table.html.erb index f1fae75..7a5de89 100644 --- a/app/views/admin/application_forms/_application_form_signup_render_table.html.erb +++ b/app/views/admin/application_forms/_application_form_signup_render_table.html.erb @@ -51,6 +51,7 @@ diff --git a/app/views/admin/application_forms/_form.html.erb b/app/views/admin/application_forms/_form.html.erb index 17d055d..4c7035c 100644 --- a/app/views/admin/application_forms/_form.html.erb +++ b/app/views/admin/application_forms/_form.html.erb @@ -81,50 +81,24 @@
-
- -
- <%= f.select :reviewer_1st_type,['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]} %> - <% if !@member_1st.nil? %> - <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_1st_ids][]', email_members:@member_1st, index: "2", select_name: 'reviewer_1st_ids'} %> - <% else %> - <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_1st_ids][]', email_members:[], index: "2", select_name: 'reviewer_1st_ids'} %> - <% end %> + <% (0...@application_form_setting.reviewer_length).each do |k| %> +
+ +
+ <%= select_tag "#{f.object_name}[reviewer_type_list][]",options_for_select(['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]},f.object.reviewer_type_list[k]) %> +
+ <% if !@members[k].nil? %> + <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}]", email_members:@members[k], index: "#{k+2}", select_name: "reviewer_ids_list_#{k}"} %> + <% else %> + <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}]", email_members:[], index: "#{k+2}", select_name: "reviewer_ids_list_#{k}"} %> + <% end %> +
+
-
- -
- -
- <%= f.select :reviewer_2nd_type,['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]} %> - <% if !@member_2nd.nil? %> - <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_2nd_ids][]', email_members:@member_2nd, index: "3", select_name: 'reviewer_2nd_ids'} %> - <% else %> - <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_2nd_ids][]', email_members:[], index: "3", select_name: 'reviewer_2nd_ids'} %> - <% end %> -
-
- -
- -
- <%= f.select :reviewer_3rd_type,['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]} %> - <% if !@member_3rd.nil? %> - <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_3rd_ids][]', email_members:@member_3rd, index: "4", select_name: 'reviewer_3rd_ids'} %> - <% else %> - <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_3rd_ids][]', email_members:[], index: "4", select_name: 'reviewer_3rd_ids'} %> - <% end %> -
-
+ <% end %>
@@ -382,9 +356,21 @@ <% content_for :page_specific_javascript do %> + +<%= javascript_include_tag "jspdf.min" %> + + +
+ +
+ \ No newline at end of file diff --git a/app/views/admin/application_forms/print_setting.html.erb b/app/views/admin/application_forms/print_setting.html.erb new file mode 100644 index 0000000..4835137 --- /dev/null +++ b/app/views/admin/application_forms/print_setting.html.erb @@ -0,0 +1,44 @@ +<%= form_for @set, as: :application_form_print_setting ,method: 'post',url: @url,html: { class: 'form-horizontal main-forms previewable' } do |f| %> + <%= hidden_field_tag "#{f.object_name}[application_form_id]", @application_form_id %> +
+ + + + + + + + + + + + + + + + + + + + +
+ <%= label_tag t('application_form.save_name') %> + + <%= f.text_field :save_name %> +
+ <%= label_tag t('application_form.print_format') %> + + <%= f.text_area :print_format,class: 'ckeditor' %> +
+ +
+
+<% end %> +<%= render partial: 'print_format_explain' %> + \ No newline at end of file diff --git a/app/views/admin/application_forms/setting.html.erb b/app/views/admin/application_forms/setting.html.erb new file mode 100644 index 0000000..1bab890 --- /dev/null +++ b/app/views/admin/application_forms/setting.html.erb @@ -0,0 +1,35 @@ +<%= form_for @application_form_setting, url: update_setting_admin_application_forms_path,method: 'post', html: {class: "form-horizontal main-forms"} do |f| %> +
+ <% content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/fileupload" %> + <%= stylesheet_link_tag "lib/main-list" %> + <% end %> + <% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/bootstrap-fileupload" %> + <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> + <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> + <%= javascript_include_tag "lib/file-type" %> + <%= javascript_include_tag "lib/module-area" %> + <% end %> + +
+ +
+ +
+ <%= f.number_field :reviewer_length, min: 1, class: '' %> +
+
+
+ + +
+ <%= get_referer_url[:application_formion] rescue "" %> + <%= f.submit t('submit'), class: 'btn btn-primary' %> + + <%= link_to t('cancel'), admin_application_forms_path, :class=>"btn" %> +
+ +
+<% end %> \ No newline at end of file diff --git a/app/views/application_forms/index.html.erb b/app/views/application_forms/index.html.erb index 7514e52..3017dbf 100644 --- a/app/views/application_forms/index.html.erb +++ b/app/views/application_forms/index.html.erb @@ -16,7 +16,6 @@ <%= t(:category) %> <%= t('application_form.title') %> <%= t('application_form_signup.time') %> - <%= t('application_form_signup.place') %> <%= t('application_form.signup') %> @@ -24,11 +23,11 @@ <% @application_forms.each do |application_form| - if !application_form.registration_status.blank? and (application_form.signup_start_date <= @time_now rescue false) and ( application_form.signup_end_date.nil? or application_form.signup_end_date+1 >= @time_now ) + if (application_form.application_form_start_date <= @time_now rescue false) and ( application_form.application_form_end_date.nil? or application_form.application_form_end_date+1 >= @time_now ) sign_up = ('' + t('application_form.signup') + '').html_safe elsif application_form.registration_status.blank? sign_up = t('application_form.sign_up_not_open') - elsif (application_form.signup_start_date > @time_now rescue false) + elsif (application_form.application_form_start_date > @time_now rescue false) sign_up = t('application_form.sign_up_not_yet') else sign_up = t('application_form.sign_up_overdue') @@ -44,7 +43,6 @@ <% end %> <%= ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) %> - <%= application_form.act_place %> <%= sign_up %>
diff --git a/app/views/application_forms/show.html.erb b/app/views/application_forms/show.html.erb index e8ad2d1..d59ed58 100644 --- a/app/views/application_forms/show.html.erb +++ b/app/views/application_forms/show.html.erb @@ -10,7 +10,7 @@ prefix_url = OrbitHelper.url_to_show(@application_form.to_param) end %> -<% if !@application_form.registration_status.blank? and @application_form.signup_start_date < @time_now and ( @application_form.signup_end_date.nil? or @application_form.signup_end_date+1 > @time_now ) %> +<% if @application_form.application_form_start_date < @time_now and ( @application_form.application_form_end_date.nil? or @application_form.application_form_end_date+1.days > @time_now ) %> <%#= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %> @@ -105,7 +105,7 @@
<% elsif signup_field.field_name == 'email' %>
- <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> check mail + <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
<% elsif signup_field.field_name == 'note' %>
@@ -171,19 +171,26 @@
- <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> check mail -
-
- -
- -
- <%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('application_form_signup.password') %> - <%= t('application_form_signup.password_message') %> + <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
<% end %> + <% @application_form.reviewer_enables.each_with_index do |flag,k| %> + <% if flag %> +
+ +
+ <% if @application_form.reviewer_type_list[k]=='fixed' %> + <%= MemberProfile.where(:id.in=>Array(@application_form.reviewer_ids_list[k])).collect{|m| m.name}.join(', ') %> + <% else %> + <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}]", email_members: [], index: "#{k+1}", select_name: "reviewer_ids_list_#{k}"} %> + <% end %> +
+
+ + <% end %> + <% end %> <% @application_form.application_form_signup_fields.asc(:_id).each do |rf| %>
@@ -322,11 +329,7 @@ alert("1ssss2"); })(); -<% elsif @application_form.registration_status.blank? %> - -<%= t('application_form.sign_up_not_open') %> - -<% elsif @application_form.signup_start_date > @time_now %> +<% elsif @application_form.application_form_start_date > @time_now %> <%= t('application_form.sign_up_not_yet') %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ff04743..b199edc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -11,8 +11,8 @@ en: copy: Copy act_signup: Sign Up Info #報名資料 application_form_submission_field: Application Forms Submission Field - application_form_signup_field: Application Forms Signup Field - application_form_signup: Signup Analyze + application_form_signup_field: Custom Field + application_form_signup: Applications enquiry_for_applicants: Enquiry for applicants reviewer_setting: Reviewer setting module_name: @@ -27,6 +27,27 @@ en: abstract_number: Abstract number presentation_type: Presentation application_form: + save_name: Save File Name + and_so_on: and so on + custom1: the first custom field + custom2: the second custom field + custom3: the third custom field + custom_explain: custom field which will automatically include all custom field to table but exclude the fields that are added + name_mask: 'Name only show the first word,for example: 蔡**' + custom_format_explain: use checkbox format to show custom-field's value + can_be_filled_with: can be filled with + show_title_trans: which will show the title's label being translated on now local + example: Example + example_explain: 'When custom field is test1、test2、test3, and being filled with a、b、c' + output_result: Output result + like: 'Like ' + explanation: Explanation + save_data: Save as pdf + print: Print + print_setting: Print Format Setting + print_format: Print Format + reviewer_length: Reviewer Length + setting: Setting participant_list: Participant list back: Back please_login_first: "Please login first!" @@ -85,14 +106,14 @@ en: dashboard: Dashboard display_field: Display field note: Note - email_signup_success: Signup success - email_submission_success: Submission registration success - email_add_file_success: Add file success - email_edit_file_success: Edit file success - email_signup_content: Signup success - email_submission_content: Submission registration success - email_add_file_content: Add file success - email_edit_file_content: Edit file success + email_signup_success: Application sent success + email_submission_success: Process approved success + email_add_file_success: Application Denied + email_edit_file_success: Application Approved success + email_signup_content: Application sent success + email_submission_content: Process approved success + email_add_file_content: Application Denied + email_edit_file_content: Application Approved success email_title: Title email_content: Content email_signup: Application sent @@ -113,10 +134,18 @@ en: disable: Disable hidden: Hidden(admin) submission_set: Submission Set - signup_set: Signup Set - reviewer_1st: 1st Reviewer - reviewer_2nd: 2nd Reviewer - reviewer_3rd: 3rd Reviewer + signup_set: Default fields + reviewers: + '1': 1st Reviewer + '2': 2nd Reviewer + '3': 3rd Reviewer + '4': 4th Reviewer + '5': 6th Reviewer + '6': 6th Reviewer + '7': 7th Reviewer + '8': 8th Reviewer + '9': 9th Reviewer + '10': 10th Reviewer defined_by_applicant: Defined by Applicant fixed: Fixed review_end_date: Review End Date #審查結束日期 @@ -137,26 +166,24 @@ en: registration_status_G: Attendee #Normal sign up #一般報名 application_form_start_date: Applicable Starting Time application_form_end_date: Applicable End Time - signup_start_date: Sign Up Start Date #報名開始時間 - signup_end_date: Sign Up End Date #報名結束時間 contribute_start_date: Contribute Start Date #投稿開始時間 contribute_end_date: Contirbute End Date #投稿結束時間 event_during: Valid Period contribute_during: Contribute During #投稿期間 signup_during: Sign Up During #報名期間 signup_count: Applications - signup: Sign Up #報名 + signup: Application export: Export #匯出 set_application_form_items: Items #項目 set_application_form_submission_field: Set Submission Field - set_application_form_signup_field: Default fields + set_application_form_signup_field: Custom fields set_application_form_item_content: Set Item Content #項目設定 set_application_form_agreements: Personal Data Usage Agreements #個資宣告設定 application_form_agreements_content: Content of Personal Data Usage Agreements #個資宣告內容 to_require: Should Be Filled? #是否必填 - sign_up_not_yet: Does Not Yet Allow Sign Up #報名時間未開始 - sign_up_not_open: Does Not Open Sign Up #未開放報名 - sign_up_overdue: Sign Up Overdue #報名時間已過 + sign_up_not_yet: Does Not Yet Allow to Apply #申請時間未開始 + sign_up_not_open: Does Not Open to Apply #未開放申請 + sign_up_overdue: Application Overdue #申請時間已過 contribute_file_count: Count of Contribute Files #投稿檔案數 frontend: @@ -172,12 +199,13 @@ en: content: Content #內容 application_form_signup: + reviewer_ids_list: Reviewer Stages serial_number: Sign-up No. status: Attendee Role title: File Name description: Summary file: Files - signup_time: Sign Up Time #報名時間 + submission_time: Submission Time name: Name unit: Institute #單位 tel: Tel diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 44c3f43..f77ae4f 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -12,9 +12,9 @@ zh_tw: copy: 複製 act_signup: 報名資料 application_form_submission_field: 上傳介面欄位 - application_form_signup_field: 報名欄位 - application_form_signup: 報名統計 - enquiry_for_applicants: 查詢報名人 + application_form_signup_field: 客製欄位 + application_form_signup: 申請紀錄 + enquiry_for_appflicants: 查詢報名人 reviewer_setting: 審查委員設定 module_name: application_form: 線上申請表單 @@ -28,6 +28,27 @@ zh_tw: abstract_number: 摘要編號 presentation_type: 發表方式 application_form: + save_name: 檔案儲存名稱 + and_so_on: 以此類推 + custom1: 客製化欄位的第一個欄位 + custom2: 客製化欄位的第二個欄位 + custom3: 客製化欄位的第三個欄位 + custom_explain: 客製化欄位(會自動將所有新增的客製欄位帶入表格,但排除已使用數字加入的欄位) + name_mask: 姓名只顯示第一個字,如蔡** + custom_format_explain: 使用checkbox樣式來呈現單選或多選的欄位 + can_be_filled_with: 可填入 + show_title_trans: 會顯示當前語言的標籤翻譯 + example: 範例 + example_explain: '當客製化欄位為: test1、test2、test3,被填入: a、b、c' + output_result: 輸出結果 + like: 如 + explanation: 說明 + save_data: 存為pdf + print: 列印 + print_setting: 列印格式設定 + print_format: 列印格式 + reviewer_length: 審查階段上限 + setting: 設定 participant_list: 參加者名單 back: 回上一頁 please_login_first: "請先登入!" @@ -86,14 +107,14 @@ zh_tw: dashboard: 儀錶板 display_field: 顯示的欄位 note: 附註 - email_signup_success: 報名成功 - email_submission_success: 投稿註冊成功 - email_add_file_success: 新增上傳成功 - email_edit_file_success: 編輯上傳成功 - email_signup_content: 報名成功 - email_submission_content: 投稿註冊成功 - email_add_file_content: 新增上傳成功 - email_edit_file_content: 編輯上傳成功 + email_signup_success: 申請已送出成功 + email_submission_success: 審核階段已通過 + email_add_file_success: 申請不通過 + email_edit_file_success: 申請已通過 + email_signup_content: 申請已送出成功 + email_submission_content: 審核階段已通過 + email_add_file_content: 申請不通過 + email_edit_file_content: 申請已通過 email_title: 主旨 email_content: 內文 email_signup: 申請送出 @@ -114,10 +135,18 @@ zh_tw: disable: 關閉 hidden: 隱藏(後台) submission_set: 投稿欄位設定 - signup_set: 報名欄位設定 - reviewer_1st: 一階審核 - reviewer_2nd: 二階審核 - reviewer_3rd: 三階審核 + signup_set: 預設填寫欄位 + reviewers: + '1': 一階審核 + '2': 二階審核 + '3': 三階審核 + '4': 四階審核 + '5': 五階審核 + '6': 六階審核 + '7': 七階審核 + '8': 八階審核 + '9': 九階審核 + '10': 十階審核 defined_by_applicant: 申請人自填 fixed: 固定人員 review_end_date: 審查結束日期 @@ -138,26 +167,24 @@ zh_tw: registration_status_G: 一般報名 application_form_start_date: 適用開始時間 application_form_end_date: 適用結束時間 - signup_start_date: 報名開始時間 - signup_end_date: 報名結束時間 contribute_start_date: 投稿開始時間 contribute_end_date: 投稿結束時間 event_during: 有效期間 contribute_during: 投稿期間 signup_during: 報名期間 signup_count: 申請紀錄 - signup: 報名 + signup: 申請 export: 匯出 set_application_form_items: 項目 set_application_form_submission_field: 上傳介面欄位設定 - set_application_form_signup_field: 預設填寫欄位 + set_application_form_signup_field: 客製欄位 set_application_form_item_content: 項目設定 set_application_form_agreements: 個資宣告設定 application_form_agreements_content: 個資宣告內容 to_require: 是否必填 - sign_up_not_yet: 報名時間未開始 - sign_up_not_open: 未開放報名 - sign_up_overdue: 報名時間已過 + sign_up_not_yet: 申請時間未開始 + sign_up_not_open: 未開放申請 + sign_up_overdue: 申請時間已過 contribute_file_count: 投稿檔案數 frontend: @@ -173,12 +200,13 @@ zh_tw: content: 內容 application_form_signup: + reviewer_ids_list: 審查階段 serial_number: 註冊編號 status: 報名身分 title: 稿件名稱 description: 摘要 file: 檔案 - signup_time: 報名時間 + submission_time: 提交時間 name: 姓名 unit: 單位 tel: 聯絡電話 diff --git a/config/routes.rb b/config/routes.rb index 8513f44..5b5c5c0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,8 +4,19 @@ Rails.application.routes.draw do scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do + resource :application_forms, only: [] do + get 'setting' + get ':id/print', to: 'application_forms#print' + post 'update_setting' => "application_forms#update_setting" + + get 'print_setting' + get ':application_form_id/print_setting' => "application_forms#print_setting" + + post 'print_setting_save' + end resources :application_forms do member do + get 'print' get 'copy' get 'export' get 'set_write_off' diff --git a/lib/application_form/engine.rb b/lib/application_form/engine.rb index e0bec74..794bf28 100644 --- a/lib/application_form/engine.rb +++ b/lib/application_form/engine.rb @@ -1,6 +1,12 @@ module ApplicationForm class Engine < ::Rails::Engine - initializer "application_form" do + initializer "application_form" do + if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console') + require File.expand_path('../../../app/models/application_form_setting', __FILE__) + if defined?(ApplicationFormSetting) + s = ApplicationFormSetting.get_one + end + end OrbitApp.registration "ApplicationForm", :type => "ModuleApp" do module_label "application_form.application_form" base_url File.expand_path File.dirname(__FILE__) @@ -35,19 +41,29 @@ module ApplicationForm :available_for => 'managers' context_link 'application_form.set_application_form_items', :link_path=>"admin_application_form_items_path" , - :priority=>3, + :priority=>4, :active_for_action=>{'admin/application_forms'=>'application_form_items'}, :available_for => 'managers' context_link 'application_form.set_application_form_agreements', :link_path=>"admin_application_form_agreements_path" , - :priority=>3, + :priority=>5, :active_for_action=>{'admin/application_forms'=>'application_form_agreements'}, :available_for => 'managers' context_link 'application_form.enquiry_for_applicants', :link_path=>"admin_application_form_enquiry_for_applicants_path" , - :priority=>3, + :priority=>6, :active_for_action=>{'admin/application_forms'=>'enquiry_for_applicants'}, :available_for => 'users' + context_link 'application_form.setting', + :link_path=>"setting_admin_application_forms_path" , + :priority=>7, + :active_for_action=>{'admin/application_forms'=>'setting'}, + :available_for => 'managers' + context_link 'application_form.print_setting', + :link_path=>"print_setting_admin_application_forms_path" , + :priority=>8, + :active_for_action=>{'admin/application_forms'=>'print_setting'}, + :available_for => 'sub_managers' end end