This commit is contained in:
CamilleM 2016-03-26 23:37:35 +01:00
commit c5da563a48
105 changed files with 2052 additions and 3881 deletions

View file

@ -2,6 +2,7 @@ $(function () {
$(document).ready(function() {
$('.datatable').DataTable({
// ajax: ...,
stateSave: true,
autoWidth: false,
pagingType: 'full_numbers',
"lengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]

View file

@ -22,4 +22,7 @@ $( document ).ready(function() {
$('.quantity').change(function() {
update_price($(this));
});
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
});

View file

@ -10,7 +10,7 @@
*= require osem-splash
*= require font-awesome
*= require osem-fonts
*= require bootstrap-markdown.min
*= require bootstrap-markdown
*= require bootstrap-datetimepicker
*= require leaflet
*= require bootstrap3-switch

View file

@ -1 +0,0 @@
.md-editor{display:block;border:1px solid #ddd}.md-editor>.md-header,.md-editor .md-footer{display:block;padding:6px 4px;background:#fff}.md-editor>.md-header{margin: 0;}.md-editor>.md-preview{background:#fff;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;min-height:10px;overflow:auto}.md-editor>textarea{font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:14px;outline:0;outline:thin dotted \9;margin:0;display:block;padding:0;width:100%;border:0;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;border-radius:0;box-shadow:none;background:#eee}.md-editor>textarea:focus{box-shadow:none;background:#fff}.md-editor.active{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,0.6)}

View file

@ -18,8 +18,6 @@ body {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
.container {
padding: 15px;

View file

@ -34,8 +34,8 @@ module Admin
if @cfp.update_attributes(call_for_paper_params)
Mailbot.delay.send_on_call_for_papers_dates_updated(@conference) if send_mail_on_cfp_dates_updated
Mailbot.delay.send_on_schedule_public(@conference) if send_mail_on_schedule_public
redirect_to(admin_conference_call_for_paper_path(@conference.short_title),
notice: 'Call for papers successfully updated.')
redirect_to admin_conference_call_for_paper_path(@conference.short_title),
notice: 'Call for papers successfully updated.'
else
flash[:error] = "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}."
render :new

View file

@ -12,8 +12,8 @@ module Admin
@campaign.attributes = campaign_params
if @conference.save
flash[:notice] = 'Campaign successfully created.'
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
notice: 'Campaign successfully created.'
else
flash[:error] = 'Campaign creation failed. ' + @campaign.errors.full_messages.to_sentence
render action: 'new'
@ -26,8 +26,8 @@ module Admin
def update
if @campaign.update_attributes(campaign_params)
flash[:notice] = "Campaign '#{@campaign.name}' successfully updated."
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
notice: "Campaign '#{@campaign.name}' successfully updated."
else
flash[:error] = "Campaign update failed. #{@campaign.errors.full_messages.to_sentence}"
render action: 'edit'
@ -36,12 +36,12 @@ module Admin
def destroy
if @campaign.destroy
flash[:notice] = "Campaign '#{@campaign.name}' successfully deleted."
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
notice: "Campaign '#{@campaign.name}' successfully deleted."
else
flash[:error] = "Delete of Campaign for #{@conference.short_title} failed." \
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
error: "Delete of Campaign for #{@conference.short_title} failed."\
"#{@campaign.errors.full_messages.join('. ')}."
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
end
end

View file

@ -32,8 +32,8 @@ module Admin
if @cfp.update_attributes(cfp_params)
Mailbot.delay.send_on_cfps_dates_updates(@conference) if send_mail_on_cfp_dates_updates
redirect_to(admin_conference_program_cfp_path(@conference.short_title),
notice: 'Call for papers successfully updated.')
redirect_to admin_conference_program_cfp_path(@conference.short_title),
notice: 'Call for papers successfully updated.'
else
flash[:error] = "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}."
render :new

View file

@ -18,8 +18,9 @@ module Admin
redirect_to admin_conference_commercials_path,
notice: 'Commercial was successfully created.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
redirect_to admin_conference_commercials_path
redirect_to admin_conference_commercials_path,
error: 'An error prohibited this Commercial from being saved: '\
"#{@commercial.errors.full_messages.join('. ')}."
end
end
@ -29,8 +30,9 @@ module Admin
redirect_to admin_conference_commercials_path,
notice: 'Commercial was successfully updated.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
redirect_to admin_conference_commercials_path
redirect_to admin_conference_commercials_path,
error: 'An error prohibited this Commercial from being saved: '\
"#{@commercial.errors.full_messages.join('. ')}."
end
end

View file

@ -67,12 +67,11 @@ module Admin
@conference = Conference.new(conference_params)
if @conference.save
flash[:notice] = 'Conference was successfully created.'
# user that creates the conference becomes organizer of that conference
current_user.add_role :organizer, @conference
redirect_to admin_conference_path(id: @conference.short_title)
redirect_to admin_conference_path(id: @conference.short_title),
notice: 'Conference was successfully created.'
else
flash[:error] = 'Could not create conference. ' + @conference.errors.full_messages.to_sentence
render action: 'new'
@ -87,12 +86,12 @@ module Admin
if @conference.update_attributes(conference_params)
Mailbot.delay.conference_date_update_mail(@conference) if send_mail_on_conf_update
redirect_to(edit_admin_conference_path(id: @conference.short_title),
notice: 'Conference was successfully updated.')
redirect_to edit_admin_conference_path(id: @conference.short_title),
notice: 'Conference was successfully updated.'
else
redirect_to(edit_admin_conference_path(id: short_title),
alert: 'Updating conference failed. ' \
"#{@conference.errors.full_messages.join('. ')}.")
redirect_to edit_admin_conference_path(id: short_title),
error: 'Updating conference failed. ' \
"#{@conference.errors.full_messages.join('. ')}."
end
end

View file

@ -17,8 +17,8 @@ module Admin
def create
@difficulty_level = @conference.program.difficulty_levels.new(difficulty_level_params)
if @difficulty_level.save
flash[:notice] = 'Difficulty level successfully created.'
redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title),
notice: 'Difficulty level successfully created.'
else
flash[:error] = "Creating difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}."
render :new
@ -27,8 +27,8 @@ module Admin
def update
if @difficulty_level.update_attributes(difficulty_level_params)
flash[:notice] = 'Difficulty level successfully updated.'
redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title),
notice: 'Difficulty level successfully updated.'
else
flash[:error] = "Update difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}."
render :edit
@ -37,12 +37,12 @@ module Admin
def destroy
if @difficulty_level.destroy
flash[:notice] = 'Difficulty level successfully deleted.'
redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title),
notice: 'Difficulty level successfully deleted.'
else
flash[:error] = 'Deleting difficulty level type failed! ' \
"#{@difficulty_level.errors.full_messages.join('. ')}."
redirect_to(admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title),
error: 'Deleting difficulty level type failed! '\
"#{@difficulty_level.errors.full_messages.join('. ')}."
end
end

View file

@ -5,9 +5,9 @@ module Admin
def update
@conference.email_settings.update_attributes(email_params)
redirect_to(admin_conference_emails_path(
redirect_to admin_conference_emails_path(
@conference.short_title),
notice: 'Settings have been successfully updated.')
notice: 'Settings have been successfully updated.'
end
def index

View file

@ -15,8 +15,8 @@ module Admin
def create
@event_type = @conference.program.event_types.new(event_type_params)
if @event_type.save
flash[:notice] = 'Event type successfully created.'
redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title),
notice: 'Event type successfully created.'
else
flash[:error] = "Creating event type failed: #{@event_type.errors.full_messages.join('. ')}."
render :new
@ -25,8 +25,8 @@ module Admin
def update
if @event_type.update_attributes(event_type_params)
flash[:notice] = 'Event type successfully updated.'
redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title),
notice: 'Event type successfully updated.'
else
flash[:error] = "Update event type failed: #{@event_type.errors.full_messages.join('. ')}."
render :edit
@ -35,12 +35,12 @@ module Admin
def destroy
if @event_type.destroy
flash[:notice] = 'Event type successfully deleted.'
redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title),
notice: 'Event type successfully deleted.'
else
flash[:error] = 'Destroying event type failed! ' \
"#{@event_type.errors.full_messages.join('. ')}."
redirect_to(admin_conference_program_event_types_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title),
error: 'Destroying event type failed! '\
"#{@event_type.errors.full_messages.join('. ')}."
end
end

View file

@ -94,7 +94,9 @@ module Admin
end
def comment
comment = Comment.build_from(@event, current_user.id, comment_params)
comment = Comment.new(comment_params)
comment.commentable = @event
comment.user_id = current_user.id
comment.save!
if !params[:parent].nil?
comment.move_to_child_of(params[:parent])
@ -182,8 +184,9 @@ module Admin
def get_event
@event = @conference.program.events.find(params[:id])
if !@event
redirect_to(admin_conference_program_events_path(conference_id: @conference.short_title),
alert: 'Error! Could not find event!') && return
redirect_to admin_conference_program_events_path(conference_id: @conference.short_title),
error: 'Error! Could not find event!'
return
end
@event
end

View file

@ -13,8 +13,8 @@ module Admin
def create
@lodging = @conference.lodgings.new(lodging_params)
if @lodging.save
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully created.')
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully created.'
else
flash[:error] = "Creating Lodging failed: #{@lodging.errors.full_messages.join('. ')}."
render :new
@ -25,8 +25,8 @@ module Admin
def update
if @lodging.update_attributes(lodging_params)
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully updated.')
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully updated.'
else
flash[:error] = "Update Lodging failed: #{@lodging.errors.full_messages.join('. ')}."
render :edit
@ -35,12 +35,12 @@ module Admin
def destroy
if @lodging.destroy
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully deleted.')
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully deleted.'
else
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title),
error: 'Deleting lodging failed.' \
"#{@lodging.errors.full_messages.join('. ')}.")
"#{@lodging.errors.full_messages.join('. ')}."
end
end

View file

@ -15,8 +15,8 @@ module Admin
if @program.update_attributes(program_params)
# Mailbot.delay.send_on_schedule_public(@conference) if send_mail_on_schedule_public
redirect_to(admin_conference_program_path(@conference.short_title),
notice: 'The program was successfully updated.')
redirect_to admin_conference_program_path(@conference.short_title),
notice: 'The program was successfully updated.'
else
flash[:error] = "Updating program failed. #{@program.errors.to_a.join('. ')}."
render :new

View file

@ -32,8 +32,7 @@ module Admin
if @conference.save
format.html { redirect_to admin_conference_questions_path, notice: 'Question was successfully created.' }
else
flash[:error] = "Oops, couldn't save Question. #{@question.errors.full_messages.join('. ')}"
format.html { redirect_to admin_conference_questions_path }
format.html { redirect_to admin_conference_questions_path, error: "Oops, couldn't save Question. #{@question.errors.full_messages.join('. ')}" }
end
end
end
@ -41,16 +40,16 @@ module Admin
# GET questions/1/edit
def edit
if @question.global
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), error: 'Sorry, you cannot edit global questions. Create a new one.'
end
end
# PUT questions/1
def update
if @question.update_attributes(question_params)
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. #{@question.errors.full_messages.join('. ')}")
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed. #{@question.errors.full_messages.join('. ')}"
end
end
@ -58,9 +57,9 @@ module Admin
def update_conference
authorize! :update, Question.new(conference_id: @conference.id)
if @conference.update_attributes(conference_params)
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

View file

@ -31,8 +31,8 @@ module Admin
redirect_to admin_conference_registrations_path(@conference.short_title),
notice: "Deleted registration for #{@user.name}!"
else
redirect_to(admin_conference_registrations_path(@conference.short_title),
error: 'You must be an admin to delete a registration.')
redirect_to admin_conference_registrations_path(@conference.short_title),
error: 'You must be an admin to delete a registration.'
end
end

View file

@ -21,8 +21,8 @@ module Admin
role_name = @role.name
if @role.update_attributes(role_params)
flash[:notice] = 'Successfully updated role ' + @role.name
redirect_to admin_conference_role_path(@conference.short_title, @role.name)
redirect_to admin_conference_role_path(@conference.short_title, @role.name),
notice: 'Successfully updated role ' + @role.name
else
@role.name = role_name
flash[:error] = 'Could not update role! ' + @role.errors.full_messages.to_sentence
@ -35,14 +35,16 @@ module Admin
state = user_params[:state]
unless user
flash[:error] = 'Could not find user. Please provide a valid email!'
redirect_to(admin_conference_role_path(@conference.short_title, @role.name)) && return
redirect_to admin_conference_role_path(@conference.short_title, @role.name),
error: 'Could not find user. Please provide a valid email!'
return
end
# The conference must have at least 1 organizer
if @role.name == 'organizer' && state == 'false' && @role.users.count == 1
flash[:error] = 'The conference must have at least 1 organizer!'
redirect_to(admin_conference_role_path(@conference.short_title, @role.name)) && return
redirect_to admin_conference_role_path(@conference.short_title, @role.name),
error: 'The conference must have at least 1 organizer!'
return
end
# Remove user

View file

@ -15,8 +15,8 @@ module Admin
def create
@room = @venue.rooms.new(room_params)
if @room.save
flash[:notice] = 'Room successfully created.'
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title),
notice: 'Room successfully created.'
else
flash[:error] = "Creating Room failed: #{@room.errors.full_messages.join('. ')}."
render :new
@ -25,8 +25,8 @@ module Admin
def update
if @room.update_attributes(room_params)
flash[:notice] = 'Room successfully updated.'
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title),
notice: 'Room successfully updated.'
else
flash[:error] = "Update Room failed: #{@room.errors.full_messages.join('. ')}."
render :edit
@ -35,11 +35,11 @@ module Admin
def destroy
if @room.destroy
flash[:notice] = 'Room successfully deleted.'
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title),
notice: 'Room successfully deleted.'
else
flash[:error] = "Destroying room failed! #{@room.errors.full_messages.join('. ')}."
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title),
error: "Destroying room failed! #{@room.errors.full_messages.join('. ')}."
end
end

View file

@ -35,7 +35,7 @@ module Admin
if @splashpage.destroy
redirect_to admin_conference_splashpage_path, notice: 'Splashpage was successfully destroyed.'
else
redirect_to admin_conference_splashpage_path, alert: 'An error prohibited this Splashpage from being destroyed: '\
redirect_to admin_conference_splashpage_path, error: 'An error prohibited this Splashpage from being destroyed: '\
"#{@splashpage.errors.full_messages.join('. ')}."
end
end

View file

@ -16,8 +16,8 @@ module Admin
def create
@sponsor = @conference.sponsors.new(sponsor_params)
if @sponsor.save
redirect_to(admin_conference_sponsors_path(conference_id: @conference.short_title),
notice: 'Sponsor successfully created.')
redirect_to admin_conference_sponsors_path(conference_id: @conference.short_title),
notice: 'Sponsor successfully created.'
else
flash[:error] = "Creating sponsor failed: #{@sponsor.errors.full_messages.join('. ')}."
render :new
@ -26,9 +26,9 @@ module Admin
def update
if @sponsor.update_attributes(sponsor_params)
redirect_to(admin_conference_sponsors_path(
redirect_to admin_conference_sponsors_path(
conference_id: @conference.short_title),
notice: 'Sponsor successfully updated.')
notice: 'Sponsor successfully updated.'
else
flash[:error] = "Update sponsor failed: #{@sponsor.errors.full_messages.join('. ')}."
render :edit
@ -37,12 +37,12 @@ module Admin
def destroy
if @sponsor.destroy
redirect_to(admin_conference_sponsors_path(conference_id: @conference.short_title),
notice: 'Sponsor successfully deleted.')
redirect_to admin_conference_sponsors_path(conference_id: @conference.short_title),
notice: 'Sponsor successfully deleted.'
else
redirect_to(admin_conference_sponsors_path(conference_id: @conference.short_title),
redirect_to admin_conference_sponsors_path(conference_id: @conference.short_title),
error: 'Deleting sponsor failed! ' \
"#{@sponsor.errors.full_messages.join('. ')}.")
"#{@sponsor.errors.full_messages.join('. ')}."
end
end

View file

@ -16,8 +16,8 @@ module Admin
def create
@sponsorship_level = @conference.sponsorship_levels.new(sponsorship_level_params)
if @sponsorship_level.save
redirect_to(admin_conference_sponsorship_levels_path(conference_id: @conference.short_title),
notice: 'Sponsorship level successfully created.')
redirect_to admin_conference_sponsorship_levels_path(conference_id: @conference.short_title),
notice: 'Sponsorship level successfully created.'
else
flash[:error] = "Creating Sponsorship Level failed: #{@sponsorship_level.errors.full_messages.join('. ')}."
render :new
@ -26,9 +26,9 @@ module Admin
def update
if @sponsorship_level.update_attributes(sponsorship_level_params)
redirect_to(admin_conference_sponsorship_levels_path(
redirect_to admin_conference_sponsorship_levels_path(
conference_id: @conference.short_title),
notice: 'Sponsorship level successfully updated.')
notice: 'Sponsorship level successfully updated.'
else
flash[:error] = "Update Sponsorship level failed: #{@sponsorship_level.errors.full_messages.join('. ')}."
render :edit
@ -37,23 +37,23 @@ module Admin
def destroy
if @sponsorship_level.destroy
redirect_to(admin_conference_sponsorship_levels_path(conference_id: @conference.short_title),
notice: 'Sponsorship level successfully deleted.')
redirect_to admin_conference_sponsorship_levels_path(conference_id: @conference.short_title),
notice: 'Sponsorship level successfully deleted.'
else
redirect_to(admin_conference_sponsorship_levels_path(conference_id: @conference.short_title),
redirect_to admin_conference_sponsorship_levels_path(conference_id: @conference.short_title),
error: 'Deleting sponsorship level failed! ' \
"#{@sponsorship_level.errors.full_messages.join('. ')}.")
"#{@sponsorship_level.errors.full_messages.join('. ')}."
end
end
def up
@sponsorship_level.move_higher
redirect_to(admin_conference_sponsorship_levels_path(conference_id: @conference.short_title))
redirect_to admin_conference_sponsorship_levels_path(conference_id: @conference.short_title)
end
def down
@sponsorship_level.move_lower
redirect_to(admin_conference_sponsorship_levels_path(conference_id: @conference.short_title))
redirect_to admin_conference_sponsorship_levels_path(conference_id: @conference.short_title)
end
private

View file

@ -3,9 +3,7 @@ module Admin
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :target, through: :conference
def index
authorize! :update, Target.new(conference_id: @conference.id)
end
def index; end
def new
@target = @conference.targets.new
@ -14,8 +12,8 @@ module Admin
def create
@target = @conference.targets.new(target_params)
if @target.save(target_params)
redirect_to(admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully created.')
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully created.'
else
flash[:error] = "Creating target failed: #{@target.errors.full_messages.join('. ')}."
render :new
@ -26,8 +24,8 @@ module Admin
def update
if @target.update_attributes(target_params)
redirect_to(admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully updated.')
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully updated.'
else
flash[:error] = "Target update failed: #{@target.errors.full_messages.join('. ')}."
render :edit
@ -36,12 +34,12 @@ module Admin
def destroy
if @target.destroy
redirect_to(admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully destroyed.')
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
notice: 'Target successfully destroyed.'
else
redirect_to(admin_conference_targets_path(conference_id: @conference.short_title),
error: 'Target was successfully destroyed.' \
"#{@target.errors.full_messages.join('. ')}.")
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
error: "Could not delete target for #{@conference.title}: "\
"#{@target.errors.full_messages.join('. ')}."
end
end

View file

@ -14,8 +14,8 @@ module Admin
def create
@ticket = @conference.tickets.new(ticket_params)
if @ticket.save(ticket_params)
redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully created.')
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully created.'
else
flash[:error] = "Creating Ticket failed: #{@ticket.errors.full_messages.join('. ')}."
render :new
@ -26,8 +26,8 @@ module Admin
def update
if @ticket.update_attributes(ticket_params)
redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully updated.')
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully updated.'
else
flash[:error] = "Ticket update failed: #{@ticket.errors.full_messages.join('. ')}."
render :edit
@ -36,12 +36,12 @@ module Admin
def destroy
if @ticket.destroy
redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully destroyed.')
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully destroyed.'
else
redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title),
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
error: 'Ticket was successfully destroyed.' \
"#{@ticket.errors.full_messages.join('. ')}.")
"#{@ticket.errors.full_messages.join('. ')}."
end
end

View file

@ -20,8 +20,8 @@ module Admin
def create
@track = @program.tracks.new(track_params)
if @track.save
flash[:notice] = 'Track successfully created.'
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
notice: 'Track successfully created.'
else
flash[:error] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}."
render :new
@ -32,8 +32,8 @@ module Admin
def update
if @track.update_attributes(track_params)
flash[:notice] = 'Track successfully updated.'
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
notice: 'Track successfully updated.'
else
flash[:error] = "Track update failed: #{@track.errors.full_messages.join('. ')}."
render :edit
@ -42,11 +42,11 @@ module Admin
def destroy
if @track.destroy
flash[:notice] = 'Track successfully deleted.'
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
notice: 'Track successfully deleted.'
else
flash[:error] = "Track couldn't be deleted. #{@track.errors.full_messages.join('. ')}."
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
error: "Track couldn't be deleted. #{@track.errors.full_messages.join('. ')}."
end
end

View file

@ -30,7 +30,7 @@ module Admin
if @user.update_attributes(user_params)
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message
else
redirect_to admin_users_path, alert: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
redirect_to admin_users_path, error: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
end
end

View file

@ -24,8 +24,8 @@ module Admin
def update
if @venue.update_attributes(venue_params)
redirect_to(admin_conference_venue_path(conference_id: @conference.short_title),
notice: 'Venue was successfully updated.')
redirect_to admin_conference_venue_path(conference_id: @conference.short_title),
notice: 'Venue was successfully updated.'
else
flash[:error] = "Update venue failed: #{@venue.errors.full_messages.join('. ')}."
render :edit
@ -36,7 +36,7 @@ module Admin
if @venue.destroy
redirect_to admin_conference_venue_path, notice: 'Venue was successfully deleted.'
else
redirect_to admin_conference_venue_path, alert: 'An error prohibited this Venue from being destroyed: '\
redirect_to admin_conference_venue_path, error: 'An error prohibited this Venue from being destroyed: '\
"#{@venue.errors.full_messages.join('. ')}."
end
end

View file

@ -24,9 +24,9 @@ module Admin
def update
if @conference.update_attributes(conference_params)
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.'
else
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}")
redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), error: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}"
end
end

View file

@ -5,13 +5,11 @@ module Api
respond_to :json
def index
if params[:conference_id].blank?
rooms = Room.all
if @conference
respond_with @conference.venue ? @conference.venue.rooms : Room.none
else
conference = Conference.find_by_guid(params[:conference_id])
rooms = conference.venue.rooms if conference.venue
respond_with Room.all
end
respond_with rooms
end
end
end

View file

@ -5,7 +5,7 @@ module Api
respond_to :json
def index
@conference ? (tracks = @conference.tracks) : (tracks = Track.all)
tracks = @conference ? @conference.program.tracks : Track.all
respond_with tracks
end

View file

@ -1,5 +1,6 @@
class ApplicationController < ActionController::Base
include ApplicationHelper
add_flash_types :error
protect_from_forgery with: :exception
before_filter :get_conferences
before_filter :store_location
@ -52,16 +53,15 @@ class ApplicationController < ActionController::Base
rescue_from IChainRecordNotFound do
Rails.logger.debug('IChain Record was not Unique!')
sign_out(current_user)
flash[:error] = 'Your E-Mail adress is already registered at OSEM. Please contact the admin if you want to attach your openSUSE Account to OSEM!'
redirect_to root_path
redirect_to root_path,
error: 'Your E-Mail adress is already registered at OSEM. Please contact the admin if you want to attach your openSUSE Account to OSEM!'
end
rescue_from UserDisabled do
Rails.logger.debug('User is disabled!')
sign_out(current_user)
mail = User.admin.first ? User.admin.first.email : 'the admin!'
flash[:error] = "This User is disabled. Please contact #{mail}!"
redirect_to User.ichain_logout_url
redirect_to User.ichain_logout_url, error: "This User is disabled. Please contact #{mail}!"
end
def not_found

View file

@ -11,8 +11,8 @@ class CommercialsController < ApplicationController
redirect_to edit_conference_program_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'),
notice: 'Commercial was successfully created.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content')
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'),
error: "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
end
end
@ -21,8 +21,8 @@ class CommercialsController < ApplicationController
redirect_to edit_conference_program_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'),
notice: 'Commercial was successfully updated.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content')
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'),
error: "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
end
end

View file

@ -1,4 +1,5 @@
class ConferenceController < ApplicationController
protect_from_forgery with: :null_session
before_filter :respond_to_options
load_and_authorize_resource find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index

View file

@ -21,7 +21,7 @@ class ConferenceRegistrationsController < ApplicationController
end
if @conference.registration_limit_exceeded?
redirect_to root_path, alert: "Sorry, registration limit exceeded for #{@conference.title}"
redirect_to root_path, error: "Sorry, registration limit exceeded for #{@conference.title}"
return
end
@ -60,11 +60,12 @@ class ConferenceRegistrationsController < ApplicationController
sign_in(@registration.user)
end
flash[:notice] = 'You are now registered and will be receiving E-Mail notifications.'
if @conference.tickets.any? && !current_user.supports?(@conference)
redirect_to conference_tickets_path(@conference.short_title)
redirect_to conference_tickets_path(@conference.short_title),
notice: 'You are now registered and will be receiving E-Mail notifications.'
else
redirect_to conference_conference_registrations_path(@conference.short_title)
redirect_to conference_conference_registrations_path(@conference.short_title),
notice: 'You are now registered and will be receiving E-Mail notifications.'
end
else
flash[:error] = "Could not create your registration for #{@conference.title}: "\
@ -89,8 +90,8 @@ class ConferenceRegistrationsController < ApplicationController
redirect_to root_path,
notice: "You are not registered for #{@conference.title} anymore!"
else
redirect_to root_path,
error: "Could not update your registration for #{@conference.title}: "\
redirect_to conference_conference_registrations_path(@conference.short_title),
error: "Could not delete your registration for #{@conference.title}: "\
"#{@registration.errors.full_messages.join('. ')}."
end
end
@ -100,8 +101,8 @@ class ConferenceRegistrationsController < ApplicationController
def set_registration
@registration = Registration.find_by(conference: @conference, user: current_user)
if !@registration
flash[:alert] = "Can't find a registration for #{@conference.title} for you. Please register."
redirect_to new_conference_conference_registrations_path(@conference.short_title)
redirect_to new_conference_conference_registrations_path(@conference.short_title),
error: "Can't find a registration for #{@conference.title} for you. Please register."
end
end

View file

@ -2,9 +2,11 @@ class ProposalController < ApplicationController
before_filter :authenticate_user!, except: [:show, :new, :create]
load_resource :conference, find_by: :short_title
load_resource :program, through: :conference, singleton: true
load_and_authorize_resource :event, parent: false, through: :program
load_and_authorize_resource :event, parent: false, through: :program, except: [:new, :create]
def index
@event = @program.events.new
@event.event_users.new(user: current_user, event_role: 'submitter')
@events = current_user.proposals(@conference)
end
@ -14,6 +16,9 @@ class ProposalController < ApplicationController
end
def new
@event = @program.events.new
@event.event_users.new(user: current_user, event_role: 'submitter') if current_user
authorize! :new, @event
@user = User.new
@url = conference_program_proposal_index_path(@conference.short_title)
end
@ -46,6 +51,7 @@ class ProposalController < ApplicationController
event_role: 'submitter')
@event.event_users.new(user: current_user,
event_role: 'speaker')
authorize! :new, @event
unless @event.save
flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"
@ -55,8 +61,7 @@ class ProposalController < ApplicationController
ahoy.track 'Event submission', title: 'New submission'
flash[:notice] = 'Proposal was successfully submitted.'
redirect_to conference_program_proposal_index_path(@conference.short_title)
redirect_to conference_program_proposal_index_path(@conference.short_title), notice: 'Proposal was successfully submitted.'
end
def update
@ -69,8 +74,8 @@ class ProposalController < ApplicationController
return
end
redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully updated.')
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully updated.'
end
def destroy
@ -80,13 +85,13 @@ class ProposalController < ApplicationController
begin
@event.withdraw
rescue Transitions::InvalidTransition
redirect_to(:back, error: "Event can't be withdrawn")
redirect_to :back, error: "Event can't be withdrawn"
return
end
@event.save(validate: false)
redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully withdrawn.')
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully withdrawn.'
end
def confirm
@ -96,7 +101,7 @@ class ProposalController < ApplicationController
begin
@event.confirm!
rescue Transitions::InvalidTransition
redirect_to(:back, error: "Event can't be confirmed")
redirect_to :back, error: "Event can't be confirmed"
return
end
@ -107,11 +112,11 @@ class ProposalController < ApplicationController
end
if @conference.user_registered?(current_user)
redirect_to(conference_program_proposal_index_path(@conference.short_title),
notice: 'The proposal was confirmed.')
redirect_to conference_program_proposal_index_path(@conference.short_title),
notice: 'The proposal was confirmed.'
else
redirect_to(new_conference_conference_registrations_path(conference_id: @conference.short_title),
alert: 'The proposal was confirmed. Please register to attend the conference.')
redirect_to new_conference_conference_registrations_path(conference_id: @conference.short_title),
alert: 'The proposal was confirmed. Please register to attend the conference.'
end
end
@ -122,8 +127,8 @@ class ProposalController < ApplicationController
begin
@event.restart
rescue Transitions::InvalidTransition
redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
error: "The proposal can't be re-submitted.")
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title),
error: "The proposal can't be re-submitted."
return
end
@ -133,14 +138,14 @@ class ProposalController < ApplicationController
return
end
redirect_to(conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: "The proposal was re-submitted. The #{@conference.short_title} organizers will review it again.")
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title),
notice: "The proposal was re-submitted. The #{@conference.short_title} organizers will review it again."
end
private
def event_params
params.require(:event).permit(:title, :subtitle, :event_type_id, :abstract, :description, :require_registration, :difficulty_level_id)
params.require(:event).permit(:title, :subtitle, :track_id, :event_type_id, :abstract, :description, :require_registration, :difficulty_level_id)
end
def user_params

View file

@ -6,22 +6,18 @@ class SubscriptionsController < ApplicationController
def create
@subscription = current_user.subscriptions.build(conference_id: @conference.id)
if @subscription.save!
flash[:notice] = "You have been subscribed to receive email notifications for #{@conference.short_title}."
redirect_to root_path
redirect_to root_path, notice: "You have been subscribed to receive email notifications for #{@conference.short_title}."
else
flash[:error] = subscription.errors.full_messages.to_sentence
redirect_to root_path
redirect_to root_path, error: subscription.errors.full_messages.to_sentence
end
end
def destroy
@subscription = current_user.subscriptions.find_by(conference_id: @conference.id)
if @subscription.destroy
flash[:notice] = "You have been unsubscribed and now you will not be receiving email notifications for #{@conference.short_title}."
redirect_to root_path
redirect_to root_path, notice: "You have been unsubscribed and now you will not be receiving email notifications for #{@conference.short_title}."
else
flash[:error] = @subscription.errors.full_messages.to_sentence
redirect_to root_path
redirect_to root_path, error: @subscription.errors.full_messages.to_sentence
end
end
end

View file

@ -14,7 +14,7 @@ class TicketPurchasesController < ApplicationController
end
else
redirect_to conference_conference_registrations_path(@conference.short_title),
alert: "Oops, something went wrong with your purchase! #{message}"
error: "Oops, something went wrong with your purchase! #{message}"
end
end
@ -25,7 +25,7 @@ class TicketPurchasesController < ApplicationController
notice: 'Ticket successfully deleted.'
else
redirect_to conference_conference_registrations_path(@conference.short_title),
alert: 'An error prohibited deleting your purchase! '\
error: 'An error prohibited deleting your purchase! '\
"#{@ticket_purchases.errors.full_messages.join('. ')}."
end
end

View file

@ -28,8 +28,8 @@ module Users
openid.save!
sign_in user
flash[:notice] = "#{user.email} signed in successfully with #{provider}"
redirect_to request.env['omniauth.origin'] || root_path
redirect_to request.env['omniauth.origin'] || root_path,
notice: "#{user.email} signed in successfully with #{provider}"
rescue => e
flash[:error] = e.message
redirect_back_or_to new_user_registration_path

View file

@ -181,9 +181,9 @@ module ApplicationHelper
# Same as redirect_to(:back) if there is a valid HTTP referer, otherwise redirect_to()
def redirect_back_or_to(options = {}, response_status = {})
if request.env['HTTP_REFERER']
redirect_to(:back)
redirect_to :back
else
redirect_to(options, response_status)
redirect_to options, response_status
end
end

View file

@ -9,7 +9,7 @@ class Mailbot < ActionMailer::Base
end
def acceptance_mail(event)
conference = event.conference
conference = event.program.conference
person = event.submitter
build_email(conference,
person.email,
@ -18,7 +18,7 @@ class Mailbot < ActionMailer::Base
end
def rejection_mail(event)
conference = event.conference
conference = event.program.conference
person = event.submitter
build_email(conference,
person.email,
@ -27,7 +27,7 @@ class Mailbot < ActionMailer::Base
end
def confirm_reminder_mail(event)
conference = event.conference
conference = event.program.conference
person = event.submitter
build_email(conference,
person.email,
@ -83,7 +83,7 @@ class Mailbot < ActionMailer::Base
def send_notification_email_for_comment(comment)
@comment = comment
@event = @comment.commentable
@conference = @event.conference
@conference = @event.program.conference
recipients = User.comment_notifiable(@conference) # with scope
recipients.each do |user|
@user = user

View file

@ -76,8 +76,12 @@ class Ability
can :manage, Event do |event|
event.users.include?(user)
end
# can create an event until the last day of a conference
can :create, Event, program_id: Conference.where('end_date >= ?', Date.today).map { |conference| conference.program.id}.compact
# cannot create an event if program does not have open cfp
cannot [:new, :create], Event do |event|
user_inclusion = event.event_users.map { |event_user| event_user.user.id }.compact.include? user.id
!event.program.cfp_open? || !event.new_record? || !user_inclusion
end
# can manage the commercials of their own events
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)

View file

@ -41,7 +41,11 @@ class Comment < ActiveRecord::Base
}
scope :find_since_last_login, lambda { |user|
where(created_at: (user.last_sign_in_at..Time.now)).order(created_at: :desc)
if user.last_sign_in_at
where(created_at: (user.last_sign_in_at..Time.now)).order(created_at: :desc)
else
none
end
}
# Helper class method to look up a commentable object
# given the commentable class name and id

View file

@ -9,7 +9,7 @@ class Contact < ActiveRecord::Base
format: URI::regexp(%w(http https)), allow_blank: true
def has_social_media?
return true if !facebook.blank? || !twitter.blank? || !googleplus.blank? || !instagram.blank?
return true if !facebook.blank? || !twitter.blank? || !googleplus.blank? || !instagram.blank? || !email.blank?
false
end
end

View file

@ -38,14 +38,14 @@ class EmailSettings < ActiveRecord::Base
if event
h['eventtitle'] = event.title
h['proposalslink'] = Rails.application.routes.url_helpers.conference_proposal_index_url(
h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposal_index_url(
conference.short_title, host: CONFIG['url_for_emails'])
end
h
end
def generate_event_mail(event, event_template)
values = get_values(event.conference, event.submitter, event)
values = get_values(event.program.conference, event.submitter, event)
parse_template(event_template, values)
end

View file

@ -190,6 +190,7 @@ class Event < ActiveRecord::Base
commercials: self.commercials.any?,
biography: !self.submitter.biography.blank?,
subtitle: !self.subtitle.blank?,
track: !self.track.blank?,
difficulty_level: !self.difficulty_level.blank?,
title: true,
abstract: true

View file

@ -29,6 +29,7 @@ class Registration < ActiveRecord::Base
validate :registration_limit_not_exceed, on: :create
after_create :set_week, :subscribe_to_conference, :send_registration_mail
after_destroy :destroy_purchased_tickets
def week
created_at.strftime('%W').to_i
@ -36,6 +37,11 @@ class Registration < ActiveRecord::Base
private
def destroy_purchased_tickets
ticket_purchased = TicketPurchase.where(conference_id: conference_id, user_id: user.id)
ticket_purchased.destroy_all
end
def subscribe_to_conference
Subscription.create(conference_id: conference.id, user_id: user.id)
end

View file

@ -1,6 +1,6 @@
class Role < ActiveRecord::Base
belongs_to :resource, polymorphic: true
has_and_belongs_to_many :users
has_and_belongs_to_many :users, join_table: :users_roles
scopify

View file

@ -64,7 +64,7 @@ class Target < ActiveRecord::Base
'unit' => unit,
'created_at' => created_at,
'progress' => progress,
'days_left' => days_left,
'days_left' => days_left
}
result
end

View file

@ -18,7 +18,7 @@ class Ticket < ActiveRecord::Base
end
def paid?(user)
ticket_purchases.where(user_id: user.id, paid: false).count == 0
ticket_purchases.find_by(user: user, paid: true).present?
end
def quantity_bought_by(user)
@ -48,11 +48,19 @@ class Ticket < ActiveRecord::Base
result ? result : Money.new(0, 'USD')
end
def tickets_sold
ticket_purchases.sum(:quantity)
end
def tickets_turnover
tickets_sold * price
end
private
def tickets_of_conference_have_same_currency
unless Ticket.where(conference_id: conference_id).all?{|t| t.price_currency == self.price_currency }
errors.add(:price_currency, 'Currency is different from the exist ticktes of this conference.')
errors.add(:price_currency, 'is different from the existing tickets of this conference.')
end
end
end

View file

@ -29,7 +29,6 @@ class User < ActiveRecord::Base
devise(*devise_modules)
has_and_belongs_to_many :roles
has_many :openids
attr_accessor :login
@ -54,6 +53,10 @@ class User < ActiveRecord::Base
},
presence: true
def name
self[:name] || username
end
def subscribed? conference
self.subscriptions.find_by(conference_id: conference.id).present?
end
@ -75,7 +78,9 @@ class User < ActiveRecord::Base
raise UserDisabled if user && user.is_disabled
if user
user.update_attributes(email: attributes[:email])
user.update_attributes(email: attributes[:email],
last_sign_in_at: user.current_sign_in_at,
current_sign_in_at: Time.current)
else
begin
user = create!(username: username, email: attributes[:email])

View file

@ -4,47 +4,51 @@ class ConferenceSerializer < ActiveModel::Serializer
:date_range, :revision
def difficulty_levels
object.difficulty_levels.map do |difficulty_level| { id: difficulty_level.id,
title: difficulty_level.title,
description: difficulty_level.description
object.program.difficulty_levels.map do |difficulty_level| { id: difficulty_level.id,
title: difficulty_level.title,
description: difficulty_level.description
}
end
end
def event_types
object.event_types.map do |event_type| { id: event_type.id,
title: event_type.title,
length: event_type.length,
description: event_type.description
object.program.event_types.map do |event_type| { id: event_type.id,
title: event_type.title,
length: event_type.length,
description: event_type.description
}
end
end
def rooms
object.rooms.includes(:events).map do |room| { id: room.id,
size: room.size,
events: room.events.map do |event| { guid: event.title,
title: event.title,
subtitle: event.subtitle,
abstract: event.abstract,
description: event.description,
is_highlight: event.is_highlight,
require_registration: event.require_registration,
start_time: event.start_time,
event_type_id: event.event_type.id,
difficulty_level_id: event.difficulty_level_id,
track_id: event.track_id,
speaker_names: event.speaker_names
}
end
}
if object.venue
object.venue.rooms.includes(:events).map do |room| { id: room.id,
size: room.size,
events: room.events.map do |event| { guid: event.title,
title: event.title,
subtitle: event.subtitle,
abstract: event.abstract,
description: event.description,
is_highlight: event.is_highlight,
require_registration: event.require_registration,
start_time: event.start_time,
event_type_id: event.event_type.id,
difficulty_level_id: event.difficulty_level_id,
track_id: event.track_id,
speaker_names: event.speaker_names
}
end
}
end
else
[]
end
end
def tracks
object.tracks.map do |track| { 'id' => track.id,
'name' => track.name,
'description' => track.description
object.program.tracks.map do |track| { 'id' => track.id,
'name' => track.name,
'description' => track.description
}
end
end

View file

@ -6,10 +6,10 @@
%div
%a.pull-right.comment-reply-link{href: "#"} Reply
.comment-reply
= form_tag "#{comment_admin_conference_program_event_path(@conference.short_title, comment.commentable_id)}", method: :post do
= semantic_form_for :comment, url: "#{comment_admin_conference_program_event_path(@conference.short_title, comment.commentable_id)}", method: :post do |f|
= f.input :body
%input{name: "parent", type: "hidden", value: "#{comment.id}"}
%input{name: "authenticity_token", type: "hidden", value: "#{form_authenticity_token}"}
%textarea{name: "comment"}
%button.btn.btn-primary.pull-right{name: "button", type: "submit"} Add Reply
- comment.children.each do |child|
= render "nested_comments", comment: child, padding: 50

View file

@ -147,10 +147,11 @@
%ul.media
%div
.row-fluid
= form_tag(comment_admin_conference_program_event_path(@conference.short_title, @event.id), method: :post) do
= text_area_tag(:comment, '')
= submit_tag 'Add Comment', class: 'btn btn-primary pull-right'
= semantic_form_for :comment, url: comment_admin_conference_program_event_path(@conference.short_title, @event.id), method: :post do |f|
= f.input :body
= f.submit 'Add Comment', class: 'btn btn-primary pull-right'
%br
%br
- @comments.each do |comment|
%div
= render "nested_comments", comment: comment, padding: 0
= render partial: 'nested_comments', locals: { comment: comment, padding: 0}

View file

@ -53,7 +53,7 @@
.row
.col-md-12.text-right
- if can? :edit, @progam
- if can? :edit, @program
= link_to edit_admin_conference_program_path(@conference.short_title), class: 'btn btn-primary' do
Edit
- if can? :destroy, @program

View file

@ -7,7 +7,7 @@
The available roles for the conference
.col-md-12
%table.table.table-bordered.table-striped.table-hover.datatable#roles
%table.table.table-bordered.table-striped.table-hover#roles
%thead
%th ID
%th Name

View file

@ -10,9 +10,9 @@
%table.table.table-hover#tickets
%thead
%th Title
%th Description
%th Price
%th Sold
%th Turnover
%th Actions
%tbody
- @conference.tickets.each do |ticket|
@ -20,12 +20,12 @@
%td
= link_to(admin_conference_ticket_path(@conference.short_title, ticket.id)) do
= ticket.title
%td
= truncate(ticket.description)
%td
= humanized_money_with_symbol ticket.price
%td
= ticket.buyers.count
= ticket.tickets_sold
%td
= humanized_money_with_symbol ticket.tickets_turnover
%td
.btn-group
= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id),

View file

@ -2,10 +2,11 @@
.col-md-12
.page-header
%h1
= @ticket.title
Ticket
%small
= humanized_money_with_symbol @ticket.price
%div{"data-placement" => "left", "data-toggle" => "tooltip", :title => @ticket.description}
= @ticket.title
Ticket
%small
= humanized_money_with_symbol @ticket.price
%p.text-muted
People who bought this ticket
.row

View file

@ -6,7 +6,7 @@
- if @users
= "(#{@users.length})"
.row
.col-md-12
.col-md-12.table-responsive
%table.table.table-striped.table-bordered.table-hover.datatable
%thead
%th ID

View file

@ -17,3 +17,6 @@
- unless @conference.contact.googleplus.blank?
= link_to "#{ @conference.contact.googleplus }" do
%i.fa.fa-google-plus-square.fa-4x
- unless @conference.contact.email.blank?
= mail_to "#{ @conference.contact.email }" do
%i.fa.fa-envelope-o.fa-4x

View file

@ -1,45 +1,42 @@
.container
.row
.col-md-12
.tabbable
%ul.nav.nav-tabs
%li.active
= link_to 'Proposal', '#proposal-content', 'data-toggle' => 'tab'
%li
= link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab'
.tab-content
#proposal-content.tab-pane.active
= render 'proposal/proposal_form'
#commercials-content.tab-pane
%p.text-muted
You can add commercials for your proposal. These commercials will be displayed on the
= link_to 'public proposal page.', conference_program_proposal_path(@conference.short_title, @event)
If you don't add a commercial, the conference commercial will be displayed!
- if can? :create, @event.commercials.new
.row
.col-md-6
#resource-content
#resource-placeholder{ style: 'background-color:#d3d3d3; float: left; width: 400px; height: 250px; margin: 5px; border-width: 1px; border-style: solid; border-color: rgba(0,0,0,.2);' }
.row
.col-md-6
= semantic_form_for(@event.commercials.build, url: conference_program_proposal_commercials_path(conference_id: @conference.short_title, proposal_id: @event)) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { required: 'required', type: 'url' },
hint: 'Just paste the url of your video/photo provider. Currently supported: YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.'
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }
%hr
- @event.commercials.each_slice(3) do |slice|
.row
- slice.each do |commercial|
- if commercial.persisted?
.col-md-4
.thumbnail
.flexvideo{ id: "resource-content-#{commercial.id}"}
= render partial: 'shared/media_item', locals: { commercial: commercial }
.caption
- if can? :update, commercial
= semantic_form_for commercial, url: conference_program_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event, id: commercial) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required', type: 'url' }
= f.action :submit, as: :button, button_html: { class: 'btn btn-success' }, label: 'Update'
- if can? :destroy, commercial
= link_to 'Delete', conference_program_proposal_commercial_path(@conference.short_title, @event.id, commercial.id),
:method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'
.tabbable
%ul.nav.nav-tabs
%li.active
= link_to 'Proposal', '#proposal-content', 'data-toggle' => 'tab'
%li
= link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab'
.tab-content
#proposal-content.tab-pane.active
= render 'proposal/proposal_form'
#commercials-content.tab-pane
%p.text-muted
You can add commercials for your proposal. These commercials will be displayed on the
= link_to 'public proposal page.', conference_program_proposal_path(@conference.short_title, @event)
If you don't add a commercial, the conference commercial will be displayed!
- if can? :create, @event.commercials.new
.row
.col-md-6
#resource-content
#resource-placeholder{ style: 'background-color:#d3d3d3; float: left; width: 400px; height: 250px; margin: 5px; border-width: 1px; border-style: solid; border-color: rgba(0,0,0,.2);' }
.row
.col-md-6
= semantic_form_for(@event.commercials.build, url: conference_program_proposal_commercials_path(conference_id: @conference.short_title, proposal_id: @event)) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { required: 'required', type: 'url' },
hint: 'Just paste the url of your video/photo provider. Currently supported: YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.'
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }
%hr
- @event.commercials.each_slice(3) do |slice|
.row
- slice.each do |commercial|
- if commercial.persisted?
.col-md-4
.thumbnail
.flexvideo{ id: "resource-content-#{commercial.id}"}
= render partial: 'shared/media_item', locals: { commercial: commercial }
.caption
- if can? :update, commercial
= semantic_form_for commercial, url: conference_program_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event, id: commercial) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required', type: 'url' }
= f.action :submit, as: :button, button_html: { class: 'btn btn-success' }, label: 'Update'
- if can? :destroy, commercial
= link_to 'Delete', conference_program_proposal_commercial_path(@conference.short_title, @event.id, commercial.id),
:method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'

View file

@ -4,6 +4,11 @@
= f.input :subtitle, as: :string
- if @program.tracks.any?
= f.input :track_id, as: :select,
collection: @program.tracks.map {|track| ["#{track.name}", track.id] },
include_blank: true
= f.input :event_type_id, as: :select,
collection: @conference.program.event_types.map {|type| ["#{type.title} - #{show_time(type.length)}", type.id,
data: { min_words: type.minimum_abstract_length, max_words: type.maximum_abstract_length }]},

View file

@ -3,33 +3,21 @@
%li{'class'=>class_for_todo(progress_status['registered'])}
%span{'class'=>icon_for_todo(progress_status['registered'])}
- if progress_status['registered']
= link_to 'Edit your registration', edit_conference_conference_registrations_path(event.program.conference.short_title)
= link_to 'Register to the conference', edit_conference_conference_registrations_path(event.program.conference.short_title)
- else
= link_to 'Register to the conference', new_conference_conference_registrations_path(event.program.conference.short_title)
%li{'class'=>class_for_todo(progress_status['biography'])}
%span{'class'=>icon_for_todo(progress_status['biography'])}
- if progress_status['biography']
= link_to 'Edit your biography', edit_user_path(event.submitter)
- else
= link_to 'Fill out your biography', edit_user_path(event.submitter)
= link_to 'Fill out your biography', edit_user_path(event.submitter)
%li{'class'=>class_for_todo(progress_status['subtitle'])}
%span{'class'=>icon_for_todo(progress_status['subtitle'])}
- if progress_status['subtitle']
= link_to 'Edit the subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event)
- else
= link_to 'Add a subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event)
= link_to 'Add a subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event)
%li{'class'=>class_for_todo(progress_status['commercials'])}
%span{'class'=>icon_for_todo(progress_status['commercials'])}
- if progress_status['commercials']
= link_to 'Edit the commercials', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content')
- else
= link_to 'Add a commercial', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content')
= link_to 'Add a commercial', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content')
%li{'class'=>class_for_todo(progress_status['track'])}
%span{'class'=>icon_for_todo(progress_status['track'])}
= link_to 'Add a track', edit_conference_program_proposal_path(event.program.conference.short_title, event)
%li{'class'=>class_for_todo(progress_status['difficulty_level'])}
%span{'class'=>icon_for_todo(progress_status['difficulty_level'])}
- if progress_status['difficulty_level']
= link_to 'Change the difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event)
- else
= link_to 'Add a difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event)
= link_to 'Add a difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event)

View file

@ -1 +1,4 @@
= render 'form'
.container
.row
.col-md-12
= render 'form'

View file

@ -67,12 +67,13 @@
%small.text-muted
= event.event_type.title
= "(#{event.event_type.length} min)"
= "in #{event.track.name}" if event.track
- if event.state == 'confirmed' && event.require_registration == true
,
Pre-registered: #{pre_registered(event).count}
%td.col-md-2{style: "padding:20px 8px 20px 8px;"}
= link_to 'Complete your todo list', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }"
= link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }"
- progress_percentage = event.calculate_progress
.progress
@ -99,5 +100,5 @@
class: 'btn btn-default', id: "edit_proposal_#{event.id}"
.row
.col-md-12
- if can? :create, @program.events.new
- if can? :create, @event
= link_to "New Proposal", new_conference_program_proposal_path(@conference.short_title), :class => "btn btn-success pull-right"

View file

@ -7,9 +7,10 @@
%br
%small
= @event.subtitle
= link_to "Schedule", schedule_conference_path(@conference.short_title), :class =>"btn btn-success pull-right"
- if can? :schedule, @conference
= link_to "Schedule", schedule_conference_path(@conference.short_title), :class =>"btn btn-success pull-right"
- if can? :edit, @event
= link_to "Edit", edit_admin_conference_program_event_path(@conference.short_title, @event), :class => "btn btn-mini btn-primary pull-right"
= link_to "Edit", edit_conference_program_proposal_path(@conference.short_title, @event), :class => "btn btn-mini btn-primary pull-right"
.row
.col-md-3
%p