Refactoring Conference Basics #384

This commit is contained in:
Chrisbr 2014-08-07 21:33:08 +02:00
parent ac25561523
commit a8b94c13f3
13 changed files with 309 additions and 109 deletions

View file

@ -20,7 +20,7 @@ module Admin
@active_conferences = Conference.get_active_conferences_for_dashboard # pending or the last two
@deactive_conferences = Conference.
get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active
get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active
@conferences = @active_conferences + @deactive_conferences
@recent_users = User.limit(5).order(created_at: :desc)
@ -116,7 +116,7 @@ module Admin
@conference_progress = @conference.get_status
# Line charts
@registrations = { @conference.short_title => @conference.get_registrations_per_week }
@registrations = {@conference.short_title => @conference.get_registrations_per_week}
@registration_weeks = [0]
@registration_weeks.push(@registrations[@conference.short_title].length)
@ -168,6 +168,7 @@ module Admin
def edit
@conferences = Conference.all
@conference = Conference.find_by(short_title: params[:id])
@date_string = date_string(@conference.start_date, @conference.end_date)
respond_to do |format|
format.html
format.json { render json: @conference.to_json }

View file

@ -1,11 +1,8 @@
module Admin
class ContactsController < ApplicationController
before_action :set_conference
before_action :set_contact, only: [:show, :edit, :update, :destroy]
# GET /:conference/contact
def show
end
before_action :set_conference
before_action :set_contact, only: [:edit, :update]
# GET /:conference/contact/edit
def edit
@ -14,33 +11,27 @@ module Admin
# PATCH/PUT /:conference/contact
def update
if @contact.update(contact_params)
redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
redirect_to edit_admin_conference_contact_path, notice: 'Contact details were successfully updated.'
else
render :edit
end
end
# DELETE /:conference/contact
def destroy
@contact.destroy
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_contact
@contact = @conference.contact
end
# Use callbacks to share common setup or constraints between actions.
def set_contact
@contact = @conference.contact
end
def set_conference
@conference = Conference.find_by(short_title: params[:conference_id])
end
def set_conference
@conference = Conference.find_by(short_title: params[:conference_id])
end
# Only allow a trusted parameter "white list" through.
def contact_params
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public)
params[:contact]
end
# Only allow a trusted parameter "white list" through.
def contact_params
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public)
params[:contact]
end
end
end