diff --git a/app/controllers/admin/cfps_controller.rb b/app/controllers/admin/cfps_controller.rb index 481b67ab..76d2f63a 100644 --- a/app/controllers/admin/cfps_controller.rb +++ b/app/controllers/admin/cfps_controller.rb @@ -26,11 +26,11 @@ module Admin def update @cfp = @program.cfp - @cfp.assign_attributes(params[:cfp]) + @cfp.assign_attributes(cfp_params) send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update? - if @cfp.update_attributes(params[:cfp]) + if @cfp.update_attributes(cfp_params) Mailbot.delay.send_on_cfps_dates_updates(@conference) if send_mail_on_cfp_dates_updates redirect_to(admin_conference_program_cfp_path(@conference.short_title), notice: 'Call for papers successfully updated.') @@ -52,7 +52,7 @@ module Admin private def cfp_params - params[:cfp] + params.require(:cfp).permit(:start_date, :end_date) end end end diff --git a/app/controllers/admin/programs_controller.rb b/app/controllers/admin/programs_controller.rb index ec64d7a3..d527a8aa 100644 --- a/app/controllers/admin/programs_controller.rb +++ b/app/controllers/admin/programs_controller.rb @@ -10,10 +10,10 @@ module Admin def update authorize! :update, @conference.program @program = @conference.program - @program.assign_attributes(params[:program]) + @program.assign_attributes(program_params) # send_mail_on_schedule_public = @program.notify_on_schedule_public? - if @program.update_attributes(params[:program]) + if @program.update_attributes(program_params) # Mailbot.delay.send_on_schedule_public(@conference) if send_mail_on_schedule_public redirect_to(admin_conference_program_path(@conference.short_title), notice: 'The program was successfully updated.') @@ -26,7 +26,7 @@ module Admin private def program_params - params[:program] + params.require(:program).permit(:rating, :schedule_public, :schedule_fluid) end end end diff --git a/app/controllers/proposal_controller.rb b/app/controllers/proposal_controller.rb index 1b3c42f0..95042af5 100644 --- a/app/controllers/proposal_controller.rb +++ b/app/controllers/proposal_controller.rb @@ -39,7 +39,7 @@ class ProposalController < ApplicationController params[:event].delete :user - @event = Event.new(params[:event]) + @event = Event.new(event_params) @event.program = @program @event.event_users.new(user: current_user, diff --git a/app/models/ahoy/program.rb b/app/models/ahoy/program.rb index 9165ae5d..ef321377 100644 --- a/app/models/ahoy/program.rb +++ b/app/models/ahoy/program.rb @@ -38,10 +38,6 @@ class Program < ActiveRecord::Base accepts_nested_attributes_for :difficulty_levels, allow_destroy: true accepts_nested_attributes_for :rooms, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true - attr_accessible :schedule_fluid, :rating, - :schedule_public, :include_cfp_in_splash, :conference_id, - :event_types_attributes, :difficulty_levels_attributes, :rooms_attributes, :tracks_attributes - # validates :conference_id, presence: true, uniqueness: true validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 } diff --git a/app/models/cfp.rb b/app/models/cfp.rb index 35b2e561..706e376b 100644 --- a/app/models/cfp.rb +++ b/app/models/cfp.rb @@ -3,8 +3,6 @@ class Cfp < ActiveRecord::Base belongs_to :program - attr_accessible :start_date, :end_date, :program_id - validates :program_id, presence: true, uniqueness: true validates :start_date, :end_date, presence: true validate :before_end_of_conference diff --git a/app/models/program.rb b/app/models/program.rb index d313910a..dbc64b91 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -36,10 +36,6 @@ class Program < ActiveRecord::Base accepts_nested_attributes_for :tracks, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true accepts_nested_attributes_for :difficulty_levels, allow_destroy: true - attr_accessible :schedule_fluid, :rating, - :schedule_public, :include_cfp_in_splash, :conference_id, - :event_types_attributes, :difficulty_levels_attributes, :tracks_attributes - # validates :conference_id, presence: true, uniqueness: true validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 } diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 6b3ff1e7..6eea977f 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -48,7 +48,7 @@ %br #{pluralize(event.voters.length, 'voter')} %br - - @program.cfp.rating.times do |counter| + - @program.rating.times do |counter| - if event.average_rating.to_f.round == counter+1 = label_tag "label_rating", "", :class => "avgrating", :avgrate => true = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" diff --git a/db/schema.rb b/db/schema.rb index df6f292c..2eaf0334 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -21,14 +21,14 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.datetime "time" end - add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time", using: :btree - add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree - add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree + add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time" + add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id" + add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id" create_table "answers", force: true do |t| t.string "title" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "campaigns", force: true do |t| @@ -46,28 +46,28 @@ ActiveRecord::Schema.define(version: 20151031092713) do create_table "cfps", force: true do |t| t.date "start_date", null: false t.date "end_date", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "program_id" end create_table "comments", force: true do |t| - t.string "title", limit: 50, default: "" - t.text "body", limit: 16777215 + t.string "title", limit: 50, default: "" + t.text "body" t.integer "commentable_id" t.string "commentable_type" t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "subject" t.integer "parent_id" t.integer "lft" t.integer "rgt" end - add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id", using: :btree - add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type", using: :btree - add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree + add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id" + add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type" + add_index "comments", ["user_id"], name: "index_comments_on_user_id" create_table "commercials", force: true do |t| t.string "commercial_id" @@ -87,8 +87,8 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.string "html_export_path" t.date "start_date", null: false t.date "end_date", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "logo_file_name" t.string "logo_content_type" t.integer "logo_file_size" @@ -136,51 +136,51 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.datetime "updated_at" end - add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree + add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority" create_table "dietary_choices", force: true do |t| t.integer "conference_id" t.string "title", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "difficulty_levels", force: true do |t| t.string "title" t.text "description" t.string "color" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "program_id" end create_table "email_settings", force: true do |t| t.integer "conference_id" - t.boolean "send_on_registration", default: false - t.boolean "send_on_accepted", default: false - t.boolean "send_on_rejected", default: false - t.boolean "send_on_confirmed_without_registration", default: false - t.text "registration_body", limit: 16777215 - t.text "accepted_body", limit: 16777215 - t.text "rejected_body", limit: 16777215 - t.text "confirmed_without_registration_body", limit: 16777215 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "send_on_registration", default: false + t.boolean "send_on_accepted", default: false + t.boolean "send_on_rejected", default: false + t.boolean "send_on_confirmed_without_registration", default: false + t.text "registration_body" + t.text "accepted_body" + t.text "rejected_body" + t.text "confirmed_without_registration_body" + t.datetime "created_at" + t.datetime "updated_at" t.string "registration_subject" t.string "accepted_subject" t.string "rejected_subject" t.string "confirmed_without_registration_subject" - t.boolean "send_on_conference_dates_updated", default: false + t.boolean "send_on_conference_dates_updated", default: false t.string "conference_dates_updated_subject" t.text "conference_dates_updated_body" - t.boolean "send_on_conference_registration_dates_updated", default: false + t.boolean "send_on_conference_registration_dates_updated", default: false t.string "conference_registration_dates_updated_subject" t.text "conference_registration_dates_updated_body" - t.boolean "send_on_venue_updated", default: false + t.boolean "send_on_venue_updated", default: false t.string "venue_updated_subject" t.text "venue_updated_body" - t.boolean "send_on_cfp_dates_updated", default: false - t.boolean "send_on_program_schedule_public", default: false + t.boolean "send_on_cfp_dates_updated", default: false + t.boolean "send_on_program_schedule_public", default: false t.string "program_schedule_public_subject" t.string "cfp_dates_updated_subject" t.text "program_schedule_public_body" @@ -207,31 +207,31 @@ ActiveRecord::Schema.define(version: 20151031092713) do end create_table "events", force: true do |t| - t.string "guid", null: false + t.string "guid", null: false t.integer "event_type_id" - t.string "title", null: false + t.string "title", null: false t.string "subtitle" t.integer "time_slots" - t.string "state", default: "new", null: false - t.string "progress", default: "new", null: false + t.string "state", default: "new", null: false + t.string "progress", default: "new", null: false t.string "language" t.datetime "start_time" - t.text "abstract", limit: 16777215 - t.text "description", limit: 16777215 - t.boolean "public", default: true + t.text "abstract" + t.text "description" + t.boolean "public", default: true t.string "logo_file_name" t.string "logo_content_type" t.integer "logo_file_size" t.datetime "logo_updated_at" - t.text "proposal_additional_speakers", limit: 16777215 + t.text "proposal_additional_speakers" t.integer "track_id" t.integer "room_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "require_registration" t.integer "difficulty_level_id" t.integer "week" - t.boolean "is_highlight", default: false + t.boolean "is_highlight", default: false t.integer "program_id" end @@ -296,8 +296,8 @@ ActiveRecord::Schema.define(version: 20151031092713) do create_table "question_types", force: true do |t| t.string "title" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "questions", force: true do |t| @@ -305,8 +305,8 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.integer "question_type_id" t.integer "conference_id" t.boolean "global" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "registration_periods", force: true do |t| @@ -321,12 +321,12 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.integer "conference_id" t.datetime "arrival" t.datetime "departure" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "dietary_choice_id" - t.text "other_dietary_choice", limit: 16777215 - t.text "other_special_needs", limit: 16777215 - t.boolean "attended", default: false + t.text "other_dietary_choice" + t.text "other_special_needs" + t.boolean "attended", default: false t.boolean "volunteer" t.integer "user_id" t.integer "week" @@ -344,22 +344,22 @@ ActiveRecord::Schema.define(version: 20151031092713) do create_table "roles", force: true do |t| t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "description" t.integer "resource_id" t.string "resource_type" end - add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree - add_index "roles", ["name"], name: "index_roles_on_name", using: :btree + add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id" + add_index "roles", ["name"], name: "index_roles_on_name" create_table "roles_users", id: false, force: true do |t| t.integer "role_id" t.integer "user_id" end - add_index "roles_users", ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id", using: :btree + add_index "roles_users", ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id" create_table "rooms", force: true do |t| t.string "guid", null: false @@ -448,12 +448,12 @@ ActiveRecord::Schema.define(version: 20151031092713) do end create_table "tracks", force: true do |t| - t.string "guid", null: false - t.string "name", null: false - t.text "description", limit: 16777215 + t.string "guid", null: false + t.string "name", null: false + t.text "description" t.string "color" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "program_id" end @@ -472,8 +472,8 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.string "unconfirmed_email" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "name" t.boolean "email_public" t.text "biography" @@ -492,10 +492,10 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.boolean "is_disabled", default: false end - add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - add_index "users", ["username"], name: "index_users_on_username", unique: true, using: :btree + add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true + add_index "users", ["email"], name: "index_users_on_email", unique: true + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + add_index "users", ["username"], name: "index_users_on_username", unique: true create_table "vchoices", force: true do |t| t.integer "vday_id" @@ -506,8 +506,8 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.integer "conference_id" t.date "day" t.text "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "venues", force: true do |t| @@ -515,8 +515,8 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.string "name" t.string "website" t.text "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "photo_file_name" t.string "photo_content_type" t.integer "photo_file_size" @@ -531,16 +531,16 @@ ActiveRecord::Schema.define(version: 20151031092713) do end create_table "versions", force: true do |t| - t.string "item_type", null: false - t.integer "item_id", null: false - t.string "event", null: false + t.string "item_type", null: false + t.integer "item_id", null: false + t.string "event", null: false t.string "whodunnit" - t.text "object", limit: 16777215 - t.text "object_changes", limit: 16777215 + t.text "object" + t.text "object_changes" t.datetime "created_at" end - add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree + add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" create_table "visits", force: true do |t| t.uuid "visitor_id" @@ -565,13 +565,13 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.datetime "started_at" end - add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree + add_index "visits", ["user_id"], name: "index_visits_on_user_id" create_table "votes", force: true do |t| t.integer "event_id" t.integer "rating" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "user_id" end @@ -579,8 +579,8 @@ ActiveRecord::Schema.define(version: 20151031092713) do t.integer "conference_id" t.string "title", null: false t.text "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end end