fix conflicts

This commit is contained in:
Stella Rouzi 2014-08-12 15:48:29 +03:00
parent e2fb434dc7
commit 71dfb3b7e4
34 changed files with 160 additions and 211 deletions

View file

@ -5,7 +5,7 @@ module Admin
def index
authorize! :update, Question.new(conference_id: @conference.id)
@questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id)
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)
@questions_conference = @conference.questions
@new_question = @conference.questions.new
end
@ -33,25 +33,25 @@ module Admin
# GET questions/1/edit
def edit
if @question.global == true && !(current_user.has_role? :organizer, @conference)
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :alert => "Sorry, you cannot edit global questions. Create a new one.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), alert: "Sorry, you cannot edit global questions. Create a new one.")
end
end
# PUT questions/1
def update
if @question.update_attributes(params[:question])
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Question '#{@question.title}' for #{@conference.short_title} successfully updated.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Question '#{@question.title}' for #{@conference.short_title} successfully updated.")
else
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Update of questions for #{@conference.short_title} failed.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed.")
end
end
# Update questions used for the conference
def update_conference
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Questions for #{@conference.short_title} successfully updated.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Questions for #{@conference.short_title} successfully updated.")
else
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Update of questions for #{@conference.short_title} failed.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed.")
end
end
@ -82,7 +82,7 @@ module Admin
flash[:error] = "You must be an admin to delete a question."
end
@questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id)
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)
@questions_conference = @conference.questions
end
end

View file

@ -9,9 +9,9 @@ module Admin
def update
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events were successfully updated.')
redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events were successfully updated.')
else
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events update failed.')
redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events update failed.')
end
end
end

View file

@ -20,28 +20,16 @@ module Admin
end
def update
params[:user].delete :roles_attributes if params[:user]
@user.update_attributes!(params[:user])
redirect_to admin_users_path, notice: "Updated #{@user.email}"
end
def add_role
role = params[:user][:roles_attributes][:"0"]
@user.add_role role['name'].parameterize.underscore.to_sym, Conference.find(role['resource_id'])
respond_to do |format|
format.html
format.js
end
end
def edit
end
def destroy
@user.destroy
redirect_to admin_users_path, notice: "User #{@user.name} (#{@user.email})got deleted"
redirect_to admin_users_path, notice: "User got deleted"
end
end
end

View file

@ -15,7 +15,7 @@ module Admin
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
@volunteers = @conference.registrations.where(:volunteer => true)
@volunteers = @conference.registrations.where(volunteer: true)
end
else
authorize! :index, :volunteer
@ -26,9 +26,9 @@ module Admin
if (current_user.has_role? :organizer, @conference) || (current_user.has_role? :volunteer_coordinator, @conference)
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.")
rescue Exception => e
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{e.message}")
end
else
authorize! :index, :volunteer