- Restructuring the assets
- Worked on the schedule - Removed some gems
This commit is contained in:
parent
a9207671b8
commit
b801f0dc19
123 changed files with 13587 additions and 33123 deletions
|
|
@ -32,5 +32,9 @@ class Admin::ConferenceController < ApplicationController
|
|||
|
||||
def show
|
||||
@conference = Conference.find_all_by_short_title(params[:id]).first
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render :json => @conference.to_json }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,19 +1,34 @@
|
|||
class Admin::EventsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
layout "admin"
|
||||
around_filter :set_timezone_for_this_request
|
||||
|
||||
def set_timezone_for_this_request(&block)
|
||||
Time.use_zone(@conference.timezone, &block)
|
||||
end
|
||||
|
||||
def index
|
||||
@events = @conference.events
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render :json => Event.where(:state => :confirmed) }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@event = @conference.events.find(params[:id])
|
||||
@tracks = Track.all
|
||||
@comments = @event.root_comments
|
||||
@comment_count = @event.comment_threads.count
|
||||
end
|
||||
|
||||
def edit
|
||||
@event = @conference.events.find(params[:id])
|
||||
@event_types = @conference.event_types
|
||||
@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)
|
||||
|
|
@ -27,8 +42,17 @@ class Admin::EventsController < ApplicationController
|
|||
comment.move_to_child_of(params[:parent])
|
||||
end
|
||||
|
||||
redirect_to admin_conference_event_path(:conference_id => @conference.short_title, :id => params[:id])
|
||||
redirect_to admin_conference_event_path(:conference_id => @conference.short_title)
|
||||
end
|
||||
|
||||
def update
|
||||
@event = Event.find(params[:id])
|
||||
if params.has_key? :track_id
|
||||
@event.update_attribute(:track_id, params[:track_id])
|
||||
end
|
||||
redirect_to(admin_conference_event_path(@conference.short_title, @event), :notice => "Updated")
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,11 +3,48 @@ class Admin::ScheduleController < ApplicationController
|
|||
layout "schedule"
|
||||
|
||||
def show
|
||||
if @conference.nil?
|
||||
redirect_to admin_conference_index_path
|
||||
return
|
||||
end
|
||||
@dates = @conference.start_date..@conference.end_date
|
||||
@tracks = @conference.tracks
|
||||
@rooms = @conference.rooms
|
||||
end
|
||||
|
||||
def update
|
||||
event = Event.where(:guid => params[:event]).first
|
||||
error_message = nil
|
||||
if event.nil?
|
||||
error_message = "Could not find event GUID: #{params[:event]}"
|
||||
end
|
||||
|
||||
if params[:date] == "none"
|
||||
event.start_time = nil
|
||||
event.room = nil
|
||||
event.save!
|
||||
render :json => {"status" => "ok"}
|
||||
return
|
||||
end
|
||||
room = Room.where(:guid => params[:room]).first
|
||||
if room.nil?
|
||||
error_message = "Could not find room GUID: #{params[:room]}"
|
||||
end
|
||||
|
||||
if !error_message.nil?
|
||||
render :json => {"status" => "error", "message" => error_message}, :status => 500
|
||||
return
|
||||
end
|
||||
|
||||
event.room = room
|
||||
time = "#{params[:date]} #{params[:time]}"
|
||||
|
||||
Rails.logger.debug("Loading #{time}")
|
||||
zone = ActiveSupport::TimeZone::new(@conference.timezone)
|
||||
startTime = DateTime.strptime(time + zone.formatted_offset, "%Y-%m-%d %k:%M %Z")
|
||||
event.start_time = startTime
|
||||
event.save!
|
||||
render :json => {"status" => "ok"}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ class Admin::TracksController < ApplicationController
|
|||
layout "admin"
|
||||
|
||||
def show
|
||||
render :tracks_list
|
||||
respond_to do |format|
|
||||
format.html { render :tracks_list}
|
||||
format.json { render :json => @conference.tracks.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
include ApplicationHelper
|
||||
|
||||
protect_from_forgery
|
||||
|
||||
def verify_user
|
||||
|
|
@ -8,7 +7,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
if (current_user.nil?)
|
||||
redirect_to '/accounts/sign_in'
|
||||
return
|
||||
return false
|
||||
end
|
||||
|
||||
@conference = Conference.find_all_by_short_title(params[:conference_id]).first
|
||||
|
|
@ -19,14 +18,18 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def verify_organizer
|
||||
verify_user
|
||||
if !verify_user
|
||||
return
|
||||
end
|
||||
|
||||
## Todo simplify this
|
||||
redirect_to '/' unless has_role?(current_user, 'admin') || has_role?(current_user, 'organizer')
|
||||
end
|
||||
|
||||
def verify_admin
|
||||
verify_user
|
||||
if !verify_user
|
||||
return
|
||||
end
|
||||
|
||||
redirect_to '/' unless has_role?(current_user, 'admin')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -49,6 +49,15 @@ class EventAttachmentsController < ApplicationController
|
|||
params[:event_attachment][:public] = false
|
||||
params[:event_attachment][:event_id] = params[:proposal_id]
|
||||
|
||||
if !organizer_or_admin?
|
||||
begin
|
||||
event = current_user.person.events.find(params[:proposal_id])
|
||||
rescue Exception => e
|
||||
# They certainly aren't allowed to attach a file to someone else's proposal
|
||||
raise ActionController::RoutingError.new('Invalid proposal')
|
||||
end
|
||||
end
|
||||
|
||||
if params.has_key?(:public)
|
||||
params[:event_attachment][:public] = true
|
||||
end
|
||||
|
|
@ -86,11 +95,17 @@ class EventAttachmentsController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@proposal = current_user.person.events.find(params[:proposal_id])
|
||||
@upload = @proposal.event_attachments.find(params[:id])
|
||||
@upload.destroy
|
||||
if organizer_or_admin?
|
||||
@upload = Upload.find(params[:id])
|
||||
else
|
||||
@proposal = current_user.person.events.find(params[:proposal_id])
|
||||
@upload = @proposal.event_attachments.find(params[:id])
|
||||
end
|
||||
|
||||
@upload.destroy if !@upload.nil?
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_to uploads_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,13 +7,15 @@ class ProposalController < ApplicationController
|
|||
if params.has_key? :proposal_id
|
||||
params[:id] = params[:proposal_id]
|
||||
end
|
||||
|
||||
begin
|
||||
if !organizer_or_admin?
|
||||
@event = @person.event.find(params[:id])
|
||||
@event = @person.events.find(params[:id])
|
||||
else
|
||||
@event = Event.find(params[:id])
|
||||
end
|
||||
rescue Exception => e
|
||||
Rails.logger.debug("Proposal failure in verify_access: #{e.message}")
|
||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid or uneditable proposal.')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue