From d9d889eb9f4e227447b2cf651ae23b12008f7450 Mon Sep 17 00:00:00 2001 From: differentreality Date: Sun, 28 Jul 2013 11:48:56 +0300 Subject: [PATCH 1/4] Option for proposal changes --- app/models/call_for_papers.rb | 2 +- app/views/admin/callforpapers/show.html.haml | 1 + ...20130728055450_add_schedule_changes_to_call_for_papers.rb | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20130728055450_add_schedule_changes_to_call_for_papers.rb diff --git a/app/models/call_for_papers.rb b/app/models/call_for_papers.rb index f31a8127..6dcef8d7 100644 --- a/app/models/call_for_papers.rb +++ b/app/models/call_for_papers.rb @@ -1,5 +1,5 @@ class CallForPapers < ActiveRecord::Base - attr_accessible :start_date, :end_date, :hard_deadline, :description + attr_accessible :start_date, :end_date, :hard_deadline, :description, :schedule_changes belongs_to :conference validates_presence_of :start_date, :end_date, :hard_deadline diff --git a/app/views/admin/callforpapers/show.html.haml b/app/views/admin/callforpapers/show.html.haml index 5b388a82..dac989de 100644 --- a/app/views/admin/callforpapers/show.html.haml +++ b/app/views/admin/callforpapers/show.html.haml @@ -8,4 +8,5 @@ = f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" } = f.input :hard_deadline, :as => :string, :input_html => { :id => "cfp-hard-datepicker", :readonly => "readonly" } = f.input :description, :hint => "Welcome text for the Call for Papers" + = f.input :schedule_changes = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} \ No newline at end of file diff --git a/db/migrate/20130728055450_add_schedule_changes_to_call_for_papers.rb b/db/migrate/20130728055450_add_schedule_changes_to_call_for_papers.rb new file mode 100644 index 00000000..277f08fa --- /dev/null +++ b/db/migrate/20130728055450_add_schedule_changes_to_call_for_papers.rb @@ -0,0 +1,5 @@ +class AddScheduleChangesToCallForPapers < ActiveRecord::Migration + def change + add_column :call_for_papers, :schedule_changes, :boolean, :default => 0 + end +end From c91156ae0c383ea2254dc09e0daaf94ab5b94a6e Mon Sep 17 00:00:00 2001 From: differentreality Date: Sun, 28 Jul 2013 11:49:47 +0300 Subject: [PATCH 2/4] Do not allow title change after proposal is confirmed --- app/views/proposal/_proposal_form.html.haml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index c02a9fdc..df960068 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -1,7 +1,14 @@ = semantic_form_for(@event, :url => @url) do |f| %section#basic = f.inputs :name => "Session Information" do - = f.input :title, :as => :string, :required => true + - if !@conference.call_for_papers.schedule_changes && @event.state == "confirmed" + Title + %br + = @event.title + %br + %br + - else + = f.input :title, :as => :string, :required => true = f.input :subtitle, :as => :string %section#details - unless @event.state === "unconfirmed" || @event.state === "confirmed" From d7ae2ba29b7b15a876caba56d029c9cdf286d5fe Mon Sep 17 00:00:00 2001 From: differentreality Date: Sun, 28 Jul 2013 13:03:22 +0300 Subject: [PATCH 3/4] Allow title edit for confirmed proposal if organizer or admin and do not allow event type change for confirmed/unconfirmed proposals if schedule_changes is not set, unless it is done by an admin or organizer --- app/controllers/application_controller.rb | 1 + app/views/proposal/_proposal_form.html.haml | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fe7d2950..80d74f93 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,4 +48,5 @@ class ApplicationController < ActionController::Base Rails.logger.debug("Access denied!") redirect_to root_path, :alert => exception.message end + helper_method :organizer_or_admin? end diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index df960068..d309b55a 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -1,17 +1,19 @@ = semantic_form_for(@event, :url => @url) do |f| %section#basic = f.inputs :name => "Session Information" do - - if !@conference.call_for_papers.schedule_changes && @event.state == "confirmed" - Title - %br - = @event.title + - if !@conference.call_for_papers.schedule_changes && @event.state == "confirmed" && !organizer_or_admin? + Title: #{@event.title} %br %br - else = f.input :title, :as => :string, :required => true = f.input :subtitle, :as => :string %section#details - - unless @event.state === "unconfirmed" || @event.state === "confirmed" + - if (@event.state === "unconfirmed" || @event.state === "confirmed") && !organizer_or_admin? && !@conference.call_for_papers.schedule_changes + Event type: #{@event.event_type.title} + %br + %br + - else = f.input :event_type_id,:as => :select, :collection => @event_types, :include_blank => false, :label => "Session Type" = f.input :require_registration = f.input :abstract, :input_html => {:rows => 5, :class => "span11"}, From 0590da056efcdfea3b9590d957ea82bd341e53e0 Mon Sep 17 00:00:00 2001 From: differentreality Date: Sun, 28 Jul 2013 13:11:34 +0300 Subject: [PATCH 4/4] Do not show New submission button if cfp is closed, unless organizer or admin --- app/views/proposal/index.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/proposal/index.html.haml b/app/views/proposal/index.html.haml index 8c8d175a..9674ebb0 100644 --- a/app/views/proposal/index.html.haml +++ b/app/views/proposal/index.html.haml @@ -4,6 +4,7 @@ %h2.pull-left = "My Proposals for #{@conference.title}" .pull-right{:style=>"margin-top:20px;"} + - if @conference.cfp_open? || organizer_or_admin? = link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-primary" - if @person.proposal_count(@conference) > 0 .row-fluid