diff --git a/app/assets/javascripts/venue_management_file_link.js b/app/assets/javascripts/venue_management_file_link.js new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/admin/venue_management_contracts_controller.rb b/app/controllers/admin/venue_management_contracts_controller.rb index 8a57e0d..18d19f6 100644 --- a/app/controllers/admin/venue_management_contracts_controller.rb +++ b/app/controllers/admin/venue_management_contracts_controller.rb @@ -29,8 +29,6 @@ class Admin::VenueManagementContractsController < OrbitAdminController def create @venue_management_contract = VenueManagementContract.new(venue_management_contract_params) - inviting = VenueManagementInviting.find_by(id: venue_management_contract_params[:venue_management_inviting_id]) - assign_inviting_attrs(@venue_management_contract, inviting) @venue_management_contract.save redirect_to params['referer_url'] @@ -41,10 +39,7 @@ class Admin::VenueManagementContractsController < OrbitAdminController end def update - inviting = VenueManagementInviting.find_by(id: venue_management_contract_params[:venue_management_inviting_id]) - assign_inviting_attrs(@venue_management_contract, inviting) - @venue_management_contract.update_attributes(venue_management_contract_params) - + @venue_management_contract.update_attributes!(venue_management_contract_params) redirect_to venue_management_contracts_admin_venue_management_path(@venue_management_contract.venue_management_main_id) end @@ -57,12 +52,6 @@ class Admin::VenueManagementContractsController < OrbitAdminController private - def assign_inviting_attrs(contract, inviting) - %i(case_no publish_times start_date end_date close_date bid_date evaluation_date early_rent operation_rent royalty contractor_manager house_tax_payer land_tax_payer bid_result details).each do |attr| - contract[attr] = inviting.send(attr) - end - end - def set_venue_management_contract @venue_management_contract = VenueManagementContract.find(params[:id]) end diff --git a/app/controllers/admin/venue_management_memorabilias_controller.rb b/app/controllers/admin/venue_management_memorabilias_controller.rb index 36f48b3..3592cc2 100644 --- a/app/controllers/admin/venue_management_memorabilias_controller.rb +++ b/app/controllers/admin/venue_management_memorabilias_controller.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - class Admin::VenueManagementMemorabiliasController < OrbitAdminController include Admin::VenueManagementsHelper before_action ->(module_app = @app_title) { set_variables module_app } @@ -22,7 +20,7 @@ class Admin::VenueManagementMemorabiliasController < OrbitAdminController def new @venue_management = VenueManagementMain.find(params[:id]) - @venue_management_memorabilia = @venue_management.venue_management_memorabilias.build + @venue_management_memorabilia = VenueManagementMemorabilia.new(venue_management_main_id: params[:id]) end def create diff --git a/app/controllers/admin/venue_managements_controller.rb b/app/controllers/admin/venue_managements_controller.rb index 081596a..7980fe0 100644 --- a/app/controllers/admin/venue_managements_controller.rb +++ b/app/controllers/admin/venue_managements_controller.rb @@ -81,12 +81,12 @@ class Admin::VenueManagementsController < OrbitAdminController def create - if !venue_management_params['venue_management_links_attributes'].nil? - venue_management_params['venue_management_links_attributes'].each do |idx,link| - venue_management_params['venue_management_links_attributes'].delete(idx.to_s) if link['url'].blank? + venue_management_main_params = venue_management_params + if !venue_management_main_params['venue_management_links_attributes'].nil? + venue_management_main_params['venue_management_links_attributes'].each do |idx,link| + venue_management_main_params['venue_management_links_attributes'].delete(idx.to_s) if link['url'].blank? end end - venue_management_main_params = venue_management_params venue_management_signup_set_params = venue_management_main_params['venue_management_signup_field_sets'] venue_management_submission_set_params = venue_management_main_params['venue_management_submission_field_sets'] venue_management_email_sets_params = venue_management_main_params['venue_management_email_sets'] @@ -173,20 +173,21 @@ class Admin::VenueManagementsController < OrbitAdminController @venue_management.venue_management_submission_fields.each{|t| t.destroy if t["to_delete"] == true} redirect_to admin_venue_managements_path else - - if !venue_management_params['venue_management_links_attributes'].nil? - venue_management_params['venue_management_links_attributes'].each do |idx,link| - venue_management_params['venue_management_links_attributes'].delete(idx.to_s) if link['url'].blank? + venue_management_main_params = venue_management_params + if !venue_management_main_params['venue_management_links_attributes'].nil? + venue_management_main_params['venue_management_links_attributes'].each do |idx,link| + venue_management_main_params['venue_management_links_attributes'].delete(idx.to_s) if link['url'].blank? end end @venue_management.update_user_id = current_user.id - if @venue_management.update_attributes(venue_management_params) + if @venue_management.update_attributes(venue_management_main_params) @venue_management.venue_management_signup_fields.each{|t| t.destroy if t["to_delete"] == true} redirect_to params['referer_url'] else flash.now[:error] = t('update.error.category') - render action: :edit + flash.keep + redirect_to action: :edit, :id =>@venue_management.id.to_s end end diff --git a/app/models/concerns/venue_link_file.rb b/app/models/concerns/venue_link_file.rb new file mode 100644 index 0000000..e8771c3 --- /dev/null +++ b/app/models/concerns/venue_link_file.rb @@ -0,0 +1,12 @@ +module VenueLinkFile + extend ActiveSupport::Concern + included do + tmp = self.to_s.underscore.to_sym + VenueManagementFile.send(:belongs_to,tmp, :class_name => self.to_s, :foreign_key => "#{tmp}_id") + VenueManagementLink.send(:belongs_to,tmp, :class_name => self.to_s, :foreign_key => "#{tmp}_id") + self.has_many :venue_management_files, :autosave => true, :dependent => :destroy + self.accepts_nested_attributes_for :venue_management_files, :allow_destroy => true + self.has_many :venue_management_links, :autosave => true, :dependent => :destroy + self.accepts_nested_attributes_for :venue_management_links, :allow_destroy => true + end +end \ No newline at end of file diff --git a/app/models/venue_management_contract.rb b/app/models/venue_management_contract.rb index 3613f6e..af1fdac 100644 --- a/app/models/venue_management_contract.rb +++ b/app/models/venue_management_contract.rb @@ -7,10 +7,12 @@ class VenueManagementContract include Mongoid::Timestamps include Mongoid::Enum - PAYERS = [ :school, :vendor ].freeze - BID_RESULTS = [ :failure, :abandoned, :qualified ].freeze + PAYERS = [ :school, :vendor].freeze + BID_RESULTS = [ :failure, :abandoned, :qualified].freeze # Copy from Inviting + field :renewal_permission, type: Boolean,default: false + field :renewal_deadline, type: Date field :case_no, type: String field :publish_times, type: Integer field :start_date, type: Date, default: Time.now @@ -49,10 +51,31 @@ class VenueManagementContract field :other_commitment, localize: true field :note, localize: true - belongs_to :venue_management_main belongs_to :venue_management_inviting - has_many :venue_management_links, :as => :venue_object, :autosave => true, :dependent => :destroy - accepts_nested_attributes_for :venue_management_links, :allow_destroy => true - + include VenueLinkFile + before_save do + org_contract = VenueManagementContract.find(self.id) + inviting = VenueManagementInviting.find(self.venue_management_inviting_id) rescue nil + if !inviting.nil? + %i(case_no publish_times start_date end_date close_date bid_date evaluation_date contractor_manager bid_result details).each do |attr_| + self[attr_] = inviting.send(attr_) rescue nil + end + else + self[:case_no] = nil + end + update_flag = true + if org_contract.venue_management_inviting_id == self.venue_management_inviting_id + %i(early_rent operation_rent royalty house_tax_payer land_tax_payer).each do |attr_| + if self[attr_] != (inviting.send(attr_) rescue nil) + update_flag = false + end + end + end + if update_flag && !inviting.nil? + %i(early_rent operation_rent royalty house_tax_payer land_tax_payer).each do |attr_| + self[attr_] = (inviting.send(attr_) rescue nil) + end + end + end end diff --git a/app/models/venue_management_file.rb b/app/models/venue_management_file.rb index 43a0d5e..44f2a47 100644 --- a/app/models/venue_management_file.rb +++ b/app/models/venue_management_file.rb @@ -8,7 +8,6 @@ class VenueManagementFile field :description, localize: true field :title, localize: true - - belongs_to :venue_management_main - + #belongs_to :venue_management_main + #belongs_to :venue_management_contract end diff --git a/app/models/venue_management_inviting.rb b/app/models/venue_management_inviting.rb index 58336ef..0afe740 100644 --- a/app/models/venue_management_inviting.rb +++ b/app/models/venue_management_inviting.rb @@ -6,9 +6,9 @@ class VenueManagementInviting include Mongoid::Document include Mongoid::Timestamps include Mongoid::Enum - - PAYERS = [ :school, :vendor ].freeze - BID_RESULTS = [ :failure, :abandoned, :qualified ].freeze + include OrbitTag::Taggable + PAYERS = [ :school, :vendor].freeze + BID_RESULTS = [ :failure, :abandoned, :qualified].freeze field :case_no, type: String field :publish_times, type: Integer @@ -26,8 +26,14 @@ class VenueManagementInviting enum :bid_result, BID_RESULTS field :details, localize: true + has_many :venue_management_contracts + has_many :venue_management_memorabilias, :class_name => 'VenueManagementMemorabilia', :foreign_key => "venue_management_memorabilia_ids" belongs_to :venue_management_main - has_many :venue_management_links, :as => :venue_object, :autosave => true, :dependent => :destroy - accepts_nested_attributes_for :venue_management_links, :allow_destroy => true - + include VenueLinkFile + before_save do + contracts = self.venue_management_contracts + contracts.each do |contract| + contract.save + end + end end diff --git a/app/models/venue_management_link.rb b/app/models/venue_management_link.rb index 5cdca42..46da24b 100644 --- a/app/models/venue_management_link.rb +++ b/app/models/venue_management_link.rb @@ -7,12 +7,11 @@ class VenueManagementLink field :url field :title, localize: true - - belongs_to :venue_management_main before_validation :add_http - - validates :url, :presence => true, :format => /\A(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?\Z/i + #belongs_to :venue_management_main + #belongs_to :venue_management_contract + #validates :url, :presence => true, :format => /\A(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?\Z/i protected diff --git a/app/models/venue_management_main.rb b/app/models/venue_management_main.rb index 4537bbc..cb8d22b 100644 --- a/app/models/venue_management_main.rb +++ b/app/models/venue_management_main.rb @@ -1,7 +1,6 @@ class VenueManagementMain include Mongoid::Document include Mongoid::Timestamps - include OrbitModel::Impression # encoding: utf-8 include OrbitCategory::Categorizable @@ -35,11 +34,9 @@ class VenueManagementMain belongs_to :venue_management_item - has_many :venue_management_links, :autosave => true, :dependent => :destroy has_many :venue_management_invitings, :autosave => true, :dependent => :destroy has_many :venue_management_memorabilias, :autosave => true, :dependent => :destroy has_many :venue_management_contracts, :autosave => true, :dependent => :destroy - has_many :venue_management_files, :autosave => true, :dependent => :destroy has_many :venue_management_item_contents, :autosave => true, :dependent => :destroy has_many :venue_management_signups, :autosave => true, :dependent => :destroy has_many :venue_management_submission_fields, :autosave => true, :dependent => :destroy @@ -49,8 +46,7 @@ class VenueManagementMain has_many :venue_management_submission_field_sets, autosave: true, dependent: :destroy has_many :venue_management_email_sets, autosave: true, dependent: :destroy has_many :venue_management_signup_field_customs, :autosave => true, :dependent => :destroy - accepts_nested_attributes_for :venue_management_links, :allow_destroy => true - accepts_nested_attributes_for :venue_management_files, :allow_destroy => true + accepts_nested_attributes_for :venue_management_memorabilias, :allow_destroy => true accepts_nested_attributes_for :venue_management_item_contents, :allow_destroy => true accepts_nested_attributes_for :venue_management_signups, :allow_destroy => true accepts_nested_attributes_for :venue_management_submission_fields, :allow_destroy => true @@ -60,6 +56,7 @@ class VenueManagementMain accepts_nested_attributes_for :venue_management_submission_field_sets, :allow_destroy => true accepts_nested_attributes_for :venue_management_email_sets, :allow_destroy => true accepts_nested_attributes_for :venue_management_signup_field_customs, :allow_destroy => true + include VenueLinkFile def self.time_range(date1 = null, date2 = null) if !date1.blank? diff --git a/app/models/venue_management_memorabilia.rb b/app/models/venue_management_memorabilia.rb index 1066089..901adc1 100644 --- a/app/models/venue_management_memorabilia.rb +++ b/app/models/venue_management_memorabilia.rb @@ -1,18 +1,19 @@ -# frozen_string_literal: true - -require 'orbit_form_helper' - class VenueManagementMemorabilia include Mongoid::Document include Mongoid::Timestamps include Mongoid::Enum field :event_date, type: Date, default: Time.now - field :case_no, type: String field :details, localize: true - + def case_no + inviting = self.venue_management_inviting + if !inviting.nil? + inviting.case_no + else + nil + end + end + belongs_to :venue_management_inviting belongs_to :venue_management_main - has_many :venue_management_links, :as => :venue_object, :autosave => true, :dependent => :destroy - accepts_nested_attributes_for :venue_management_links, :allow_destroy => true - + include VenueLinkFile end diff --git a/app/views/admin/venue_management_contracts/_form.html.erb b/app/views/admin/venue_management_contracts/_form.html.erb index 145fc63..a5ca4d7 100644 --- a/app/views/admin/venue_management_contracts/_form.html.erb +++ b/app/views/admin/venue_management_contracts/_form.html.erb @@ -24,6 +24,48 @@ <%= f.select :venue_management_inviting_id, @venue_management.venue_management_invitings.map { |i| [ i.case_no, i.id ] }, :include_blank => true %> +
+ +
+ <%= f.number_field :early_rent %> +
+
+
+ +
+ <%= f.number_field :operation_rent %> +
+
+
+ +
+ <%= f.number_field :royalty %> +
+
+
+ +
+ <%= f.select :house_tax_payer, VenueManagementInviting::PAYERS.map { |p| [t("vm_inviting.enums.#{p}"), p] } %> +
+
+
+ +
+ <%= f.select :land_tax_payer, VenueManagementInviting::PAYERS.map { |p| [t("vm_inviting.enums.#{p}"), p] } %> +
+
+
+ +
+ <%= f.check_box :renewal_permission,:id => 'renewal_permission' %> +
+
+
+ +
+ <%= f.datetime_picker :renewal_deadline, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %> +
+
@@ -146,7 +188,7 @@
<%= f.fields_for :other_commitment_translations do |f| %> - <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_contract.details_translations[locale] rescue nil) %> + <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_contract.other_commitment_translations[locale] rescue nil) %> <% end %>
@@ -157,7 +199,7 @@
<%= f.fields_for :note_translations do |f| %> - <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_contract.details_translations[locale] rescue nil) %> + <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_contract.note_translations[locale] rescue nil) %> <% end %>
@@ -165,34 +207,9 @@
<% end %> + <%= render partial: 'admin/venue_shared/venue_file_link',locals: {venue: @venue_management_contract,f: f} %> + - -
- -
- - - <% if @venue_management_contract && !@venue_management_contract.venue_management_links.blank? %> -
- <% @venue_management_contract.venue_management_links.each_with_index do |venue_management_link, i| %> - <%= f.fields_for :venue_management_links, venue_management_link do |f| %> - <%= render :partial => 'form_link', :object => venue_management_link, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> -
-
- <% end %> - - -
-
-

- <%= hidden_field_tag 'venue_management_link_field_count', @venue_management_contract.venue_management_links.count %> - <%= t(:add) %> -

-
-
-
@@ -202,3 +219,14 @@ <%= link_to t('cancel'), venue_management_contracts_admin_venue_management_path(id: @venue_management.id), :class=>"btn" %> + \ No newline at end of file diff --git a/app/views/admin/venue_management_invitings/_form.html.erb b/app/views/admin/venue_management_invitings/_form.html.erb index ad4d5f7..62be368 100644 --- a/app/views/admin/venue_management_invitings/_form.html.erb +++ b/app/views/admin/venue_management_invitings/_form.html.erb @@ -17,6 +17,11 @@
+ +
+ + <%= select_tags(f, @module_app) %> +
<%= f.hidden_field :venue_management_main_id %>
@@ -81,19 +86,19 @@
- <%= f.select :house_tax_payer, VenueManagementInviting::PAYERS.map { |p| [t("vm_inviting.enums.#{p}"), p] }, :include_blank => true %> + <%= f.select :house_tax_payer, VenueManagementInviting::PAYERS.map { |p| [t("vm_inviting.enums.#{p}"), p] } %>
- <%= f.select :land_tax_payer, VenueManagementInviting::PAYERS.map { |p| [t("vm_inviting.enums.#{p}"), p] }, :include_blank => true %> + <%= f.select :land_tax_payer, VenueManagementInviting::PAYERS.map { |p| [t("vm_inviting.enums.#{p}"), p] } %>
- <%= f.select :bid_result, VenueManagementInviting::BID_RESULTS.map { |p| [t("vm_inviting.enums.bid_result.#{p}"), p] }, :include_blank => true %> + <%= f.select :bid_result, VenueManagementInviting::BID_RESULTS.map { |p| [t("vm_inviting.enums.bid_result.#{p}"), p] } %>
@@ -131,32 +136,7 @@ <% end %> - -
- -
- - - <% if @venue_management_inviting && !@venue_management_inviting.venue_management_links.blank? %> -
- <% @venue_management_inviting.venue_management_links.each_with_index do |venue_management_link, i| %> - <%= f.fields_for :venue_management_links, venue_management_link do |f| %> - <%= render :partial => 'form_link', :object => venue_management_link, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> -
-
- <% end %> - - -
-
-

- <%= hidden_field_tag 'venue_management_link_field_count', @venue_management_inviting.venue_management_links.count %> - <%= t(:add) %> -

-
-
+ <%= render partial: 'admin/venue_shared/venue_file_link',locals: {venue: @venue_management_inviting,f: f} %>
diff --git a/app/views/admin/venue_management_memorabilias/_form.html.erb b/app/views/admin/venue_management_memorabilias/_form.html.erb index 8da71b3..51b2134 100644 --- a/app/views/admin/venue_management_memorabilias/_form.html.erb +++ b/app/views/admin/venue_management_memorabilias/_form.html.erb @@ -21,7 +21,7 @@
- <%= f.text_field :case_no %> + <%= f.select :venue_management_inviting_id, @venue_management.venue_management_invitings.map { |i| [ i.case_no, i.id ] }, :include_blank => true %>
@@ -55,42 +55,15 @@
- <%= f.fields_for :details_translations do |f| %> - <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_memorabilia.details_translations[locale] rescue nil) %> + <%= f.fields_for :details_translations do |f1| %> + <%= f1.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_memorabilia.details_translations[locale] rescue nil) %> <% end %>
- <% end %> - - -
- -
- - - <% if @venue_management_memorabilia && !@venue_management_memorabilia.venue_management_links.blank? %> -
- <% @venue_management_memorabilia.venue_management_links.each_with_index do |venue_management_link, i| %> - <%= f.fields_for :venue_management_links, venue_management_link do |f| %> - <%= render :partial => 'form_link', :object => venue_management_link, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> -
-
- <% end %> - - -
-
-

- <%= hidden_field_tag 'venue_management_link_field_count', @venue_management_memorabilia.venue_management_links.count %> - <%= t(:add) %> -

-
-
+ <%= render partial: 'admin/venue_shared/venue_file_link',locals: {venue: @venue_management_memorabilia,f: f} %> diff --git a/app/views/admin/venue_managements/_form.html.erb b/app/views/admin/venue_managements/_form.html.erb index ba0edd2..c905571 100644 --- a/app/views/admin/venue_managements/_form.html.erb +++ b/app/views/admin/venue_managements/_form.html.erb @@ -25,7 +25,13 @@
+ <% flash.each do |type, msg| %> +
+ <%= msg %> +
+ <% end %> +
-
@@ -442,63 +447,8 @@
<% end %> - - -
- -
- - - <% if @venue_management && !@venue_management.venue_management_links.blank? %> -
- <% @venue_management.venue_management_links.each_with_index do |venue_management_link, i| %> - <%= f.fields_for :venue_management_links, venue_management_link do |f| %> - <%= render :partial => 'form_link', :object => venue_management_link, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> -
-
- <% end %> - - -
-
-

- <%= hidden_field_tag 'venue_management_link_field_count', @venue_management.venue_management_links.count %> - <%= t(:add) %> -

- -
-
- - -
- -
- - - <% if @venue_management && !@venue_management.venue_management_files.blank? %> -
- <% @venue_management.venue_management_files.each_with_index do |venue_management_file, i| %> - <%= f.fields_for :venue_management_files, venue_management_file do |f| %> - <%= render :partial => 'form_file', :object => venue_management_file, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> -
-
- <% end %> - - -
-
-

- <%= hidden_field_tag 'venue_management_file_field_count', @venue_management.venue_management_files.count %> - <%= t(:add) %> -

- -
-
- + <%= render partial: 'admin/venue_shared/venue_file_link',locals: {venue: @venue_management,f: f} %> + @@ -509,48 +459,4 @@ <%= f.submit t('submit'), class: 'btn btn-primary' %> <%= link_to t('cancel'), admin_venue_managements_path, :class=>"btn" %> - - -<% content_for :page_specific_javascript do %> - -<% end %> + \ No newline at end of file diff --git a/app/views/admin/venue_shared/_form_file.html.erb b/app/views/admin/venue_shared/_form_file.html.erb new file mode 100644 index 0000000..b30539b --- /dev/null +++ b/app/views/admin/venue_shared/_form_file.html.erb @@ -0,0 +1,55 @@ +<% if form_file.nil? || form_file.new_record? %> +
+<% else %> +
+ <% if form_file.file.blank? %> + <%= t(:no_file) %> + <% else %> + <%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %> + <% end %> +<% end %> +
+ + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :description_translations do |f| %> + <%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_file.description_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + <% if form_file.nil? || form_file.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %> +
+
\ No newline at end of file diff --git a/app/views/admin/venue_shared/_form_link.html.erb b/app/views/admin/venue_shared/_form_link.html.erb new file mode 100644 index 0000000..586bf3f --- /dev/null +++ b/app/views/admin/venue_shared/_form_link.html.erb @@ -0,0 +1,26 @@ +
+ + <%= f.text_field :url, class: "input-large", placeholder: t(:url) %> + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_link.title_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + <% if form_link.nil? || form_link.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %> +
\ No newline at end of file diff --git a/app/views/admin/venue_shared/_venue_file_link.html.erb b/app/views/admin/venue_shared/_venue_file_link.html.erb new file mode 100644 index 0000000..f67299c --- /dev/null +++ b/app/views/admin/venue_shared/_venue_file_link.html.erb @@ -0,0 +1,94 @@ + +
+ +
+ + + <% if !venue.nil? && !venue.venue_management_links.blank? %> +
+ <% venue.venue_management_links.each_with_index do |venue_management_link, i| %> + <%= f.fields_for :venue_management_links, venue_management_link do |f| %> + <%= render :partial => 'admin/venue_shared/form_link', :locals => {:f => f, :i => i,form_link: venue_management_link} %> + <% end %> + <% end %> +
+
+ <% end %> + + +
+
+

+ <%= hidden_field_tag 'venue_management_link_field_count', venue.venue_management_links.count %> + <%= t(:add) %> +

+
+
+ + +
+ +
+ + + <% if !venue.nil? && !venue.venue_management_files.blank? %> +
+ <% venue.venue_management_files.each_with_index do |venue_management_file, i| %> + <%= f.fields_for :venue_management_files, venue_management_file do |f| %> + <%= render :partial => 'admin/venue_shared/form_file', :locals => {:f => f, :i => i,form_file: venue_management_file} %> + <% end %> + <% end %> +
+
+ <% end %> + + +
+
+

+ <%= hidden_field_tag 'venue_management_file_field_count', venue.venue_management_files.count %> + <%= t(:add) %> +

+ +
+
+
+ \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index e3f549b..dbc989d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -142,6 +142,7 @@ en: logouting: Logging Out #登出中 success_message: 'Registration successful, thank you.' vm_inviting: + type: Type case_no: 'Case No.' publish_times: Publish Times start_date: Start Date @@ -170,6 +171,8 @@ en: event_date: Event Date details: Details vm_contract: + renewal_permission: Renewal permission + renewal_deadline: Renewal deadline case_no: 'Case No.' vendor: Vendor start_end: Contract Duration diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index ba1ce1f..5fcc2b8 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -142,6 +142,7 @@ zh_tw: logouting: 登出中 success_message: '您的報名已成功,感謝您的參與。' vm_inviting: + type: 招商形式 case_no: 案號 publish_times: 公告次數 start_date: 公告開始 @@ -170,6 +171,8 @@ zh_tw: event_date: 事件日期 details: 事件內容 vm_contract: + renewal_permission: 是否得續約 + renewal_deadline: 續約申請期限 case_no: 案號 vendor: 廠商 start_end: 契約期間 diff --git a/lib/venue_management/engine.rb b/lib/venue_management/engine.rb index 8c49d8e..e9ce873 100644 --- a/lib/venue_management/engine.rb +++ b/lib/venue_management/engine.rb @@ -6,6 +6,7 @@ module VenueManagement base_url File.expand_path File.dirname(__FILE__) authorizable categorizable + taggable "VenueManagementInviting" frontend_enabled data_count 1..20 @@ -32,29 +33,36 @@ module VenueManagement :active_for_action=>{'admin/venue_managements'=>'categories'}, :active_for_category => 'VenueManagement', :available_for => 'managers' + context_link 'tags', + :link_path=>"admin_module_app_tags_path" , + :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'venue_management').id}", + :priority=>4, + :active_for_action=>{'admin/venue_managements'=>'tags'}, + :active_for_tag => 'VenueManagement', + :available_for => 'managers' context_link 'venue_management.set_venue_management_items', :link_path=>"admin_venue_management_items_path" , - :priority=>3, + :priority=>5, :active_for_action=>{'admin/venue_managements'=>'venue_management_items'}, :available_for => 'managers' context_link 'venue_management.set_venue_management_agreements', :link_path=>"admin_venue_management_agreements_path" , - :priority=>3, + :priority=>6, :active_for_action=>{'admin/venue_managements'=>'venue_management_agreements'}, :available_for => 'managers' context_link 'venue_management.set_venue_management_invitings', :link_path => 'admin_venue_management_invitings_path', - :priority => 3, + :priority => 7, :active_for_action => { 'admin/venue_managements' => 'venue_management_invitings' }, :available_for => 'managers' context_link 'venue_management.set_venue_management_memorabilias', :link_path => 'admin_venue_management_memorabilias_path', - :priority => 3, + :priority => 8, :active_for_action => { 'admin/venue_managements' => 'venue_management_memorabilias' }, :available_for => 'managers' context_link 'venue_management.set_venue_management_contracts', :link_path => 'admin_venue_management_contracts_path', - :priority => 3, + :priority => 9, :active_for_action => { 'admin/venue_managements' => 'venue_management_contracts' }, :available_for => 'managers' end