houndci fixes
This commit is contained in:
parent
c67700e0ae
commit
a0aa523122
11 changed files with 39 additions and 36 deletions
|
|
@ -13,7 +13,7 @@ class Admin::OrganizationsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@organization = Organization.new(params[:organization])
|
@organization = Organization.new(params[:organization])
|
||||||
flash[:notice] = 'Organization was successfully created.' if @organization.save
|
flash[:notice] = 'Organization was successfully created.' if @organization.save
|
||||||
respond_with @organization, :location => admin_organizations_path
|
respond_with @organization, location: admin_organizations_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
@ -27,7 +27,7 @@ class Admin::OrganizationsController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@organization = Organization.find(params[:id])
|
@organization = Organization.find(params[:id])
|
||||||
flash[:notice] = 'Organization was successfully updated' if @organization.update_attributes(params[:organization])
|
flash[:notice] = 'Organization was successfully updated' if @organization.update_attributes(params[:organization])
|
||||||
respond_with @organization, :location => admin_organizations_path
|
respond_with @organization, location: admin_organizations_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
|
|
@ -37,7 +37,7 @@ class Admin::OrganizationsController < ApplicationController
|
||||||
def destroy
|
def destroy
|
||||||
@organization = Organization.find(params[:id])
|
@organization = Organization.find(params[:id])
|
||||||
@organization.destroy
|
@organization.destroy
|
||||||
redirect_to admin_organizations_path, :notice => "Organization got deleted"
|
redirect_to admin_organizations_path, notice: 'Organization got deleted'
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,14 @@ class Admin::SponsorshipLevelsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
begin
|
if @conference.update_attributes!(params[:conference])
|
||||||
@conference.update_attributes!(params[:conference])
|
redirect_to(admin_conference_sponsorship_levels_path(
|
||||||
redirect_to(admin_conference_sponsorship_levels_path(:conference_id => @conference.short_title), :notice => 'Sponsorship levels were successfully updated.')
|
conference_id: @conference.short_title),
|
||||||
rescue Exception => e
|
notice: 'Sponsorship levels were successfully updated.')
|
||||||
redirect_to(admin_conference_sponsorship_levels_path(:conference_id => @conference.short_title), :alert => "Sponsorship levels update failed: #{e.message}")
|
else
|
||||||
|
redirect_to(admin_conference_sponsorship_levels_path(
|
||||||
|
conference_id: @conference.short_title),
|
||||||
|
alert: 'Sponsorship levels update failed')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,12 @@ class Admin::SponsorshipsController < ApplicationController
|
||||||
params[:sponsorship_registration][:conference_id] = @conference.id
|
params[:sponsorship_registration][:conference_id] = @conference.id
|
||||||
sponsorship = SponsorshipRegistration.new(params[:sponsorship_registration])
|
sponsorship = SponsorshipRegistration.new(params[:sponsorship_registration])
|
||||||
if sponsorship.save
|
if sponsorship.save
|
||||||
redirect_to(admin_conference_sponsorships_path(:conference_id => @conference.short_title), :notice => "Sponsorship added")
|
redirect_to(admin_conference_sponsorships_path(
|
||||||
|
conference_id: @conference.short_title), notice: 'Sponsorship added')
|
||||||
else
|
else
|
||||||
redirect_to(admin_conference_sponsorships_path(:conference_id => @conference.short_title),
|
redirect_to(admin_conference_sponsorships_path(conference_id: @conference.short_title),
|
||||||
:alert => "Sponsorship creation failed.#{sponsorship.errors.full_messages.join('. ')}")
|
alert: 'Sponsorship creation failed.' \
|
||||||
|
"#{sponsorship.errors.full_messages.join('. ')}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class Conference < ActiveRecord::Base
|
||||||
accepts_nested_attributes_for :venue
|
accepts_nested_attributes_for :venue
|
||||||
accepts_nested_attributes_for :dietary_choices, :allow_destroy => true
|
accepts_nested_attributes_for :dietary_choices, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :supporter_levels, :allow_destroy => true
|
accepts_nested_attributes_for :supporter_levels, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :sponsorship_levels, :allow_destroy => true
|
accepts_nested_attributes_for :sponsorship_levels, allow_destroy: true
|
||||||
accepts_nested_attributes_for :event_types, :allow_destroy => true
|
accepts_nested_attributes_for :event_types, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :email_settings
|
accepts_nested_attributes_for :email_settings
|
||||||
accepts_nested_attributes_for :questions, :allow_destroy => true
|
accepts_nested_attributes_for :questions, :allow_destroy => true
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,13 @@ class Organization < ActiveRecord::Base
|
||||||
attr_accessible :title, :photo, :email_id, :description, :website_url
|
attr_accessible :title, :photo, :email_id, :description, :website_url
|
||||||
has_many :sponsorship_registrations, dependent: :destroy
|
has_many :sponsorship_registrations, dependent: :destroy
|
||||||
has_attached_file :photo,
|
has_attached_file :photo,
|
||||||
:styles => {:thumb => "100x100>", :large => "300x300>" }
|
styles: { thumb: '100x100>', large: '300x300>' }
|
||||||
|
|
||||||
validates_attachment_content_type :photo,
|
validates_attachment_content_type :photo,
|
||||||
:content_type => [/jpg/, /jpeg/, /png/, /gif/],
|
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
||||||
:size => { :in => 0..500.kilobytes }
|
size: { :in => 0..500.kilobytes }
|
||||||
validates_presence_of :title,
|
validates_presence_of :title,
|
||||||
:email_id,
|
:email_id,
|
||||||
:website_url
|
:website_url
|
||||||
validates_uniqueness_of :email_id
|
validates_uniqueness_of :email_id
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue