mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Implement consistent admin interface
* Consistent route/model/controller/view layout * Get rid of unused photos, speakers, dietchoices, social_events controllers * Drop unused :public from Rooms and :description from CallForPapers
This commit is contained in:
parent
f6a87331be
commit
28063129c7
133 changed files with 1461 additions and 1461 deletions
|
|
@ -1,29 +1,59 @@
|
|||
module Admin
|
||||
class TracksController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
authorize_resource through: :conference
|
||||
load_and_authorize_resource :track, through: :conference
|
||||
|
||||
def index
|
||||
authorize! :index, Track.new(conference_id: @conference.id)
|
||||
end
|
||||
def index; end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html { render :tracks_list }
|
||||
format.html { render }
|
||||
format.json { render json: @conference.tracks.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @conference.update_attributes(params[:conference])
|
||||
redirect_to(admin_conference_tracks_path(
|
||||
conference_id: @conference.short_title),
|
||||
notice: 'Tracks were successfully updated.')
|
||||
def new
|
||||
@track = @conference.tracks.new
|
||||
end
|
||||
|
||||
def create
|
||||
@track = @conference.tracks.new(track_params)
|
||||
if @track.save
|
||||
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title),
|
||||
notice: 'Track successfully created.')
|
||||
else
|
||||
redirect_to(admin_conference_tracks_path(
|
||||
conference_id: @conference.short_title),
|
||||
notice: 'Tracks update failed.')
|
||||
flash[:alert] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def update
|
||||
if @track.update_attributes(track_params)
|
||||
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title),
|
||||
notice: 'Track successfully updated.')
|
||||
else
|
||||
flash[:alert] = "Track update failed: #{@track.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @track.destroy
|
||||
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title),
|
||||
notice: 'Track successfully deleted.')
|
||||
else
|
||||
redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title),
|
||||
alert: 'Track couldn\'t be deleted.' \
|
||||
"#{@track.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def track_params
|
||||
params[:track]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue