diff --git a/app/controllers/contract_templates_controller.rb b/app/controllers/contract_templates_controller.rb index 8e70811..3ebc3ff 100644 --- a/app/controllers/contract_templates_controller.rb +++ b/app/controllers/contract_templates_controller.rb @@ -5,8 +5,8 @@ class ContractTemplatesController < ApplicationController layout 'project' - before_action :set_project, except: [:destroy] - before_action :set_contract_template, only: [:destroy] + before_action :set_project, except: [:destroy, :edit] + before_action :set_contract_template, only: [:destroy, :edit] before_action :show_splash_screen, only: :index def index @@ -32,6 +32,10 @@ class ContractTemplatesController < ApplicationController end end + def edit + @project = @contract_template.project + end + def destroy @contract_template.archive redirect_to [@contract_template.project, :contract_templates], alert: t('.archived_notice') diff --git a/app/policies/contract_template_policy.rb b/app/policies/contract_template_policy.rb index ca439b8..6739e3c 100644 --- a/app/policies/contract_template_policy.rb +++ b/app/policies/contract_template_policy.rb @@ -23,6 +23,10 @@ class ContractTemplatePolicy < ApplicationPolicy create? end + def edit? + create? + end + def import? if user.account_manager? record.project.account = user.account diff --git a/app/views/contract_templates/edit.html.erb b/app/views/contract_templates/edit.html.erb new file mode 100644 index 0000000..39eb9ce --- /dev/null +++ b/app/views/contract_templates/edit.html.erb @@ -0,0 +1,6 @@ +
+ <%= card_header text: t(".heading"), close_action_path: [@project, :contract_templates] %> +
+ <%= render "form", project: @project, contract_template: @contract_template %> +
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index 290ef7e..e7d09c2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -297,6 +297,8 @@ en: manage_large_audience: Easily manage large audiences with the crowd control feature print_QR_code: Print out release QR codes releases_automatically_organized: Releases are automatically organized as they’re submitted + edit: + heading: Edit Contract Template contracts: for_office_use_only: description_labels: diff --git a/config/locales/es.yml b/config/locales/es.yml index 8c6711c..680f049 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -129,6 +129,8 @@ es: manage_large_audience: Easily manage large audiences with the crowd control feature (ES) print_QR_code: Print out release QR codes (ES) releases_automatically_organized: Releases are automatically organized as they’re submitted (ES) + edit: + heading: Edit Contract Template (ES) contracts: for_office_use_only: description_labels: diff --git a/config/routes.rb b/config/routes.rb index 4d3aa98..9dd03be 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -56,7 +56,7 @@ Rails.application.routes.draw do resources :talent_releases, except: [:show], concerns: [:contractable, :notable, :photoable] resources :medical_releases, except: [:show], concerns: [:contractable, :notable, :photoable] resources :misc_releases, except: [:show], concerns: [:contractable, :notable, :photoable] - resources :contract_templates, only: [:index, :new, :create, :destroy] do + resources :contract_templates, only: [:index, :new, :create, :edit, :update, :destroy] do resource :qr_codes, only: [:show], controller: "contract_templates/qr_codes" resource :blank_contracts, only: [:show, :new, :create], controller: "contract_templates/blank_contracts" end