Merge pull request #29 from differentreality/admin_event_edit

edit event from admin panel
This commit is contained in:
Henne Vogelsang 2013-07-29 04:37:23 -07:00
commit 6d5edfd301
2 changed files with 7 additions and 4 deletions

View file

@ -33,10 +33,8 @@ class Admin::EventsController < ApplicationController
@tracks = Track.all
@comments = @event.root_comments
@comment_count = @event.comment_threads.count
@event = Event.find_by_id(params[:id])
@person = @event.submitter
@url = edit_admin_conference_event_path(@conference.short_title, @event)
@url = admin_conference_event_path(@conference.short_title, @event)
end
def comment
@ -58,6 +56,11 @@ class Admin::EventsController < ApplicationController
if params.has_key? :event_type_id
@event.update_attribute(:event_type_id, params[:event_type_id])
end
if @event.update_attributes(params[:event]) && @event.submitter.update_attributes(params[:person])
flash[:notice] = "Successfully updated #{@event.title}."
else
flash[:notice] = "Update not successful."
end
expire_page :controller => '/schedule', :action => :index
redirect_back_or_to(admin_conference_event_path(@conference.short_title, @event), :notice => "Updated")
end

View file

@ -7,7 +7,7 @@
= @event.subtitle
.span2
= link_to "Edit", edit_conference_proposal_path(@conference.short_title, @event.id), :class => "btn btn-mini btn-primary"
= link_to "Edit", edit_admin_conference_event_path(@conference.short_title, @event), :class => "btn btn-mini btn-primary"
.row-fluid
.span12