Skip to content

Commit

Permalink
Merge pull request manno#36 from ofeldt/develop
Browse files Browse the repository at this point in the history
refactored all occurrences of unneccessary hashrockets to newer syntax
  • Loading branch information
mm committed Feb 24, 2013
2 parents a3f08d9 + e4d8deb commit 409f139
Show file tree
Hide file tree
Showing 123 changed files with 797 additions and 797 deletions.
10 changes: 5 additions & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |ex|
Rails.logger.info "[ !!! ] Access Denied for #{current_user.email}/#{current_user.id}/#{current_user.role}: #{ex.message}"
if @current_user and @current_user.role != 'submitter'
redirect_to :back, :notice => t(:"ability.denied")
redirect_to :back, notice: t(:"ability.denied")
else
redirect_to :back, :notice => t(:"ability.denied")
redirect_to :back, notice: t(:"ability.denied")
end
end

Expand All @@ -37,13 +37,13 @@ def load_conference
end

def info_for_paper_trail
{:conference_id => @conference.id} if @conference
{conference_id: @conference.id} if @conference
end

def default_url_options
result = {:locale => params[:locale]}
result = {locale: params[:locale]}
if @conference
result.merge!(:conference_acronym => @conference.acronym)
result.merge!(conference_acronym: @conference.acronym)
end
result
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/availabilities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def edit

def update
@person.update_attributes_from_slider_form(params[:person])
redirect_to(person_url(@person), :notice => 'Availibility was successfully updated.')
redirect_to(person_url(@person), notice: 'Availibility was successfully updated.')
end

private
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/call_for_papers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def create
@call_for_papers.conference = @conference

if @call_for_papers.save
redirect_to call_for_papers_path, :notice => "Launched Call for Papers."
redirect_to call_for_papers_path, notice: "Launched Call for Papers."
else
render :action => "new"
render action: "new"
end
end

Expand All @@ -29,9 +29,9 @@ def edit
def update
@call_for_papers = @conference.call_for_papers
if @call_for_papers.update_attributes(params[:call_for_papers])
redirect_to call_for_papers_path, :notice => "Changes saved successfully"
redirect_to call_for_papers_path, notice: "Changes saved successfully"
else
render :action => "edit"
render action: "edit"
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/cfp/availabilities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def edit
def update
authorize! :update, current_user.person
current_user.person.update_attributes_from_slider_form(params[:person])
redirect_to cfp_root_path, :notice => t("cfp.update_availability_notice")
redirect_to cfp_root_path, notice: t("cfp.update_availability_notice")
end

end
8 changes: 4 additions & 4 deletions app/controllers/cfp/confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def new
def create
@user = User.find_by_email(params[:user][:email])
if @user and @user.send_confirmation_instructions
redirect_to new_cfp_session_path, :notice => t(:"cfp.confirmation_instructions_sent")
redirect_to new_cfp_session_path, notice: t(:"cfp.confirmation_instructions_sent")
else
redirect_to new_cfp_user_confirmation_path, :flash => {:error => t(:"cfp.error_sending_confirmation_instructions")}
redirect_to new_cfp_user_confirmation_path, flash: {error: t(:"cfp.error_sending_confirmation_instructions")}
end
end

Expand All @@ -20,9 +20,9 @@ def show

if @user
login_as @user
redirect_to cfp_person_path, :notice => t("cfp.successfully_confirmed")
redirect_to cfp_person_path, notice: t("cfp.successfully_confirmed")
else
redirect_to new_cfp_user_confirmation_path, :error => t("cfp.error_confirming")
redirect_to new_cfp_user_confirmation_path, error: t("cfp.error_confirming")
end
end

Expand Down
38 changes: 19 additions & 19 deletions app/controllers/cfp/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Cfp::EventsController < ApplicationController

layout "cfp"

before_filter :authenticate_user!, :except => :confirm
before_filter :authenticate_user!, except: :confirm

# GET /cfp/events
# GET /cfp/events.xml
Expand All @@ -12,7 +12,7 @@ def index

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @events }
format.xml { render xml: @events }
end
end

Expand All @@ -24,19 +24,19 @@ def show

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @event }
format.xml { render xml: @event }
end
end

# GET /cfp/events/new
# GET /cfp/events/new.xml
def new
authorize! :submit, Event
@event = Event.new(:time_slots => @conference.default_timeslots)
@event = Event.new(time_slots: @conference.default_timeslots)

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @event }
format.xml { render xml: @event }
end
end

Expand All @@ -52,16 +52,16 @@ def create
authorize! :submit, Event
@event = Event.new(params[:event])
@event.conference = @conference
@event.event_people << EventPerson.new(:person => current_user.person, :event_role => "submitter")
@event.event_people << EventPerson.new(:person => current_user.person, :event_role => "speaker")
@event.event_people << EventPerson.new(person: current_user.person, event_role: "submitter")
@event.event_people << EventPerson.new(person: current_user.person, event_role: "speaker")

respond_to do |format|
if @event.save
format.html { redirect_to(cfp_person_path, :notice => t("cfp.event_created_notice")) }
format.xml { render :xml => @event, :status => :created, :location => @event }
format.html { redirect_to(cfp_person_path, notice: t("cfp.event_created_notice")) }
format.xml { render xml: @event, status: :created, location: @event }
else
format.html { render :action => "new" }
format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
format.html { render action: "new" }
format.xml { render xml: @event.errors, status: :unprocessable_entity }
end
end
end
Expand All @@ -70,24 +70,24 @@ def create
# PUT /cfp/events/1.xml
def update
authorize! :submit, Event
@event = current_user.person.events.find(params[:id], :readonly => false)
@event = current_user.person.events.find(params[:id], readonly: false)

respond_to do |format|
if @event.update_attributes(params[:event])
format.html { redirect_to(cfp_person_path, :notice => t("cfp.event_updated_notice")) }
format.html { redirect_to(cfp_person_path, notice: t("cfp.event_updated_notice")) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
format.html { render action: "edit" }
format.xml { render xml: @event.errors, status: :unprocessable_entity }
end
end
end

def withdraw
authorize! :submit, Event
@event = current_user.person.events.find(params[:id], :readonly => false)
@event = current_user.person.events.find(params[:id], readonly: false)
@event.withdraw!
redirect_to(cfp_person_path, :notice => t("cfp.event_withdrawn_notice"))
redirect_to(cfp_person_path, notice: t("cfp.event_withdrawn_notice"))
end

def confirm
Expand All @@ -103,9 +103,9 @@ def confirm
event_person.confirm!
end
if current_user
redirect_to cfp_person_path, :notice => t("cfp.thanks_for_confirmation")
redirect_to cfp_person_path, notice: t("cfp.thanks_for_confirmation")
else
render :layout => "signup"
render layout: "signup"
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/cfp/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def show
def create
@user = User.find_by_email(params[:user][:email])
if @user and @user.send_password_reset_instructions(@conference.call_for_papers)
redirect_to new_cfp_session_path, :notice => t(:"cfp.sent_password_reset_instructions")
redirect_to new_cfp_session_path, notice: t(:"cfp.sent_password_reset_instructions")
else
flash[:alert] = t(:"cfp.problem_sending_password_reset_instructions")
redirect_to new_cfp_user_password_path
Expand All @@ -29,10 +29,10 @@ def update
@user = User.find_by_reset_password_token(params[:user][:reset_password_token])
if @user and @user.reset_password(params[:user])
login_as @user
redirect_to cfp_person_path, :notice => t(:"cfp.password_updated")
redirect_to cfp_person_path, notice: t(:"cfp.password_updated")
else
@user.reset_password_token = params[:user][:reset_password_token]
render :action => "edit"
render action: "edit"
end
end

Expand Down
20 changes: 10 additions & 10 deletions app/controllers/cfp/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class Cfp::PeopleController < ApplicationController
def show
@person = current_user.person

redirect_to :action => "new" unless @person
redirect_to action: "new" unless @person
end

def new
@person = Person.new(:email => current_user.email)
@person = Person.new(email: current_user.email)

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @person }
format.xml { render xml: @person }
end
end

Expand All @@ -33,11 +33,11 @@ def create

respond_to do |format|
if @person.save
format.html { redirect_to(cfp_person_path, :notice => t("cfp.person_created_notice")) }
format.xml { render :xml => @person, :status => :created, :location => @person }
format.html { redirect_to(cfp_person_path, notice: t("cfp.person_created_notice")) }
format.xml { render xml: @person, status: :created, location: @person }
else
format.html { render :action => "new" }
format.xml { render :xml => @person.errors, :status => :unprocessable_entity }
format.html { render action: "new" }
format.xml { render xml: @person.errors, status: :unprocessable_entity }
end
end
end
Expand All @@ -47,11 +47,11 @@ def update

respond_to do |format|
if @person.update_attributes(params[:person])
format.html { redirect_to(cfp_person_path, :notice => t("cfp.person_updated_notice")) }
format.html { redirect_to(cfp_person_path, notice: t("cfp.person_updated_notice")) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @person.errors, :status => :unprocessable_entity }
format.html { render action: "edit" }
format.xml { render xml: @person.errors, status: :unprocessable_entity }
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/cfp/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Cfp::UsersController < ApplicationController

layout 'signup'

before_filter :authenticate_user!, :only => [:edit, :update]
before_filter :authenticate_user!, only: [:edit, :update]

def new
@user = User.new
Expand All @@ -13,23 +13,23 @@ def create
@user.call_for_papers = @conference.call_for_papers

if @user.save
redirect_to new_cfp_session_path, :notice => t(:"cfp.signed_up")
redirect_to new_cfp_session_path, notice: t(:"cfp.signed_up")
else
render :action => "new"
render action: "new"
end
end

def edit
@user = current_user
render :layout => "cfp"
render layout: "cfp"
end

def update
@user = current_user
if @user.save
redirect_to cfp_person_path, :notice => t(:"cfp.updated")
redirect_to cfp_person_path, notice: t(:"cfp.updated")
else
render :action => "new"
render action: "new"
end
end

Expand Down
12 changes: 6 additions & 6 deletions app/controllers/conferences_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class ConferencesController < ApplicationController

# these methods don't need a conference
skip_before_filter :load_conference, :only => [:new, :index]
skip_before_filter :load_conference, only: [:new, :index]

before_filter :authenticate_user!
load_and_authorize_resource
Expand All @@ -14,7 +14,7 @@ def index
else
@search = Conference.search(params[:q])
end
@conferences = @search.result.paginate :page => params[:page]
@conferences = @search.result.paginate page: params[:page]

respond_to do |format|
format.html # index.html.erb
Expand Down Expand Up @@ -54,9 +54,9 @@ def create

respond_to do |format|
if @conference.save
format.html { redirect_to(conference_home_path(:conference_acronym => @conference.acronym), :notice => 'Conference was successfully created.') }
format.html { redirect_to(conference_home_path(conference_acronym: @conference.acronym), notice: 'Conference was successfully created.') }
else
format.html { render :action => "new" }
format.html { render action: "new" }
end
end
end
Expand All @@ -66,10 +66,10 @@ def create
def update
respond_to do |format|
if @conference.update_attributes(params[:conference])
format.html { redirect_to(edit_conference_path(:conference_acronym => @conference.acronym), :notice => 'Conference was successfully updated.') }
format.html { redirect_to(edit_conference_path(conference_acronym: @conference.acronym), notice: 'Conference was successfully updated.') }
else
# redirect to the right nested form page
format.html { render :action => get_previous_nested_form(params[:conference]) }
format.html { render action: get_previous_nested_form(params[:conference]) }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/event_feedbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class EventFeedbacksController < ApplicationController

before_filter :authenticate_user!
load_and_authorize_resource :event_feedback, :parent => false
load_and_authorize_resource :event_feedback, parent: false

def index
@event = Event.find(params[:event_id])
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/event_ratings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ def create
@rating.person = current_user.person
authorize! :manage, @rating
@rating.save
redirect_to event_event_rating_path, :notice => "Rating saved successfully."
redirect_to event_event_rating_path, notice: "Rating saved successfully."
end

def update
@rating = @event.event_ratings.find_by_person_id(current_user.person.id)
authorize! :manage, @rating
@rating.update_attributes(params[:event_rating])
redirect_to event_event_rating_path, :notice => "Rating saved successfully."
redirect_to event_event_rating_path, notice: "Rating saved successfully."
end

protected
Expand Down
Loading

0 comments on commit 409f139

Please sign in to comment.