This commit is contained in:
Aditya Chatterjee 2016-03-01 13:36:01 +00:00
commit 1b7c61e435
14 changed files with 136 additions and 39 deletions

View file

@ -52,7 +52,11 @@ gem 'uglifier', '>= 1.3.0'
gem 'bootstrap-sass', '~> 3.3.4.1'
gem 'autoprefixer-rails'
gem 'formtastic-bootstrap'
<<<<<<< HEAD
gem 'formtastic', '~> 2.3.0.rc3'
=======
gem 'formtastic', '~> 3.1.1'
>>>>>>> upstream/master
gem 'cocoon'
# frontend javascripts
@ -85,6 +89,10 @@ end
gem 'bootstrap3-datetimepicker-rails', '~> 3.0.2'
gem 'jquery-datatables-rails', '~> 2.2.1'
# for charts
<<<<<<< HEAD
gem 'd3_rails'
=======
>>>>>>> upstream/master
gem 'chart-js-rails'
# for user avatars

View file

@ -9,6 +9,17 @@ GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
<<<<<<< HEAD
actionmailer (4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5.1)
actionview (= 4.2.5.1)
activesupport (= 4.2.5.1)
=======
actionmailer (4.2.5.2)
actionpack (= 4.2.5.2)
actionview (= 4.2.5.2)
@ -18,18 +29,37 @@ GEM
actionpack (4.2.5.2)
actionview (= 4.2.5.2)
activesupport (= 4.2.5.2)
>>>>>>> upstream/master
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
<<<<<<< HEAD
actionview (4.2.5.1)
activesupport (= 4.2.5.1)
=======
actionview (4.2.5.2)
activesupport (= 4.2.5.2)
>>>>>>> upstream/master
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
active_model_serializers (0.8.1)
activemodel (>= 3.0)
<<<<<<< HEAD
activejob (4.2.5.1)
activesupport (= 4.2.5.1)
globalid (>= 0.3.0)
activemodel (4.2.5.1)
activesupport (= 4.2.5.1)
builder (~> 3.1)
activerecord (4.2.5.1)
activemodel (= 4.2.5.1)
activesupport (= 4.2.5.1)
arel (~> 6.0)
activesupport (4.2.5.1)
=======
activejob (4.2.5.2)
activesupport (= 4.2.5.2)
globalid (>= 0.3.0)
@ -41,6 +71,7 @@ GEM
activesupport (= 4.2.5.2)
arel (~> 6.0)
activesupport (4.2.5.2)
>>>>>>> upstream/master
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
@ -316,6 +347,18 @@ GEM
ruby-openid (>= 2.1.8)
rack-test (0.6.3)
rack (>= 1.0)
<<<<<<< HEAD
rails (4.2.5.1)
actionmailer (= 4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
activemodel (= 4.2.5.1)
activerecord (= 4.2.5.1)
activesupport (= 4.2.5.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.1)
=======
rails (4.2.5.2)
actionmailer (= 4.2.5.2)
actionpack (= 4.2.5.2)
@ -326,6 +369,7 @@ GEM
activesupport (= 4.2.5.2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.2)
>>>>>>> upstream/master
sprockets-rails
rails-assets-date.format (1.2.3)
rails-assets-holderjs (2.9.1)
@ -349,9 +393,15 @@ GEM
loofah (~> 2.0)
rails-observers (0.1.2)
activemodel (~> 4.0)
<<<<<<< HEAD
railties (4.2.5.1)
actionpack (= 4.2.5.1)
activesupport (= 4.2.5.1)
=======
railties (4.2.5.2)
actionpack (= 4.2.5.2)
activesupport (= 4.2.5.2)
>>>>>>> upstream/master
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)

View file

@ -4,6 +4,8 @@ class ApplicationController < ActionController::Base
before_filter :get_conferences
before_filter :store_location
helper_method :date_string
add_flash_types :error
add_flash_types :alert
# Ensure every controller authorizes resource or skips authorization (skip_authorization_check)
check_authorization unless: :devise_controller?
@ -52,16 +54,14 @@ 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(@ user), 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(@ user), error: "This User is disabled. Please contact #{mail}!"
end
def not_found

View file

@ -2,6 +2,8 @@ class CommercialsController < ApplicationController
load_resource :conference, find_by: :short_title
before_action :set_event
load_and_authorize_resource through: :event
add_flash_types :error
add_flash_types :alert
def create
@commercial = @event.commercials.build(commercial_params)
@ -11,8 +13,7 @@ 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 +22,7 @@ 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

@ -3,6 +3,8 @@ class ConferenceRegistrationsController < ApplicationController
load_resource :conference, find_by: :short_title
authorize_resource :conference_registrations, class: Registration
before_action :set_registration, only: [:edit, :update, :destroy, :show]
add_flash_types :error
add_flash_types :alert
def new
# Redirect to registration edit when user is already registered
@ -60,16 +62,14 @@ 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}: "\
render :new, error: "Could not create your registration for #{@conference.title}: "\
"#{@registration.errors.full_messages.join('. ')}."
render :new
end
end
@ -78,9 +78,8 @@ class ConferenceRegistrationsController < ApplicationController
redirect_to conference_conference_registrations_path(@conference.short_title),
notice: 'Registration was successfully updated.'
else
flash[:error] = "Could not update your registration for #{@conference.title}: "\
render :edit, error: "Could not update your registration for #{@conference.title}: "\
"#{@registration.errors.full_messages.join('. ')}."
render :edit
end
end
@ -100,8 +99,7 @@ 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), alert: "Can't find a registration for #{@conference.title} for you. Please register."
end
end

View file

@ -3,6 +3,8 @@ class ProposalController < ApplicationController
load_resource :conference, find_by: :short_title
load_resource :program, through: :conference, singleton: true
load_and_authorize_resource :event, parent: false, through: :program
add_flash_types :error
add_flash_types :alert
def index
@events = current_user.proposals(@conference)
@ -31,8 +33,7 @@ class ProposalController < ApplicationController
if @user.save
sign_in(@user)
else
flash[:error] = "Could not save user: #{@user.errors.full_messages.join(', ')}"
render action: 'new'
render action: 'new', error: "Could not save user: #{@user.errors.full_messages.join(', ')}"
return
end
end
@ -48,15 +49,13 @@ class ProposalController < ApplicationController
event_role: 'speaker')
unless @event.save
flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"
render action: 'new'
render action: 'new', error: "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"
return
end
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
@ -64,8 +63,7 @@ class ProposalController < ApplicationController
@url = conference_program_proposal_path(@conference.short_title, params[:id])
if !@event.update(event_params)
flash[:error] = "Could not update proposal: #{@event.errors.full_messages.join(', ')}"
render action: 'new'
render action: 'new', error: "Could not update proposal: #{@event.errors.full_messages.join(', ')}"
return
end
@ -101,8 +99,7 @@ class ProposalController < ApplicationController
end
if !@event.save
flash[:error] = "Could not confirm proposal: #{@event.errors.full_messages.join(', ')}"
render action: 'new'
render action: 'new', error: "Could not confirm proposal: #{@event.errors.full_messages.join(', ')}"
return
end
@ -128,8 +125,7 @@ class ProposalController < ApplicationController
end
if !@event.save
flash[:error] = "Could not re-submit proposal: #{@event.errors.full_messages.join(', ')}"
render action: 'new'
render action: 'new', error: "Could not re-submit proposal: #{@event.errors.full_messages.join(', ')}"
return
end

View file

@ -1,6 +1,7 @@
class RegistrationsController < Devise::RegistrationsController
before_action :configure_permitted_parameters, if: :devise_controller?
def edit
@openids = Openid.where(user_id: current_user.id).order(:provider)
super

View file

@ -2,26 +2,24 @@ class SubscriptionsController < ApplicationController
before_filter :authenticate_user!
load_resource :conference, find_by: :short_title
load_and_authorize_resource only: [:create, :destroy], through: :conference
add_flash_types :error
add_flash_types :alert
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

@ -2,6 +2,8 @@ class TicketPurchasesController < ApplicationController
before_filter :authenticate_user!
load_resource :conference, find_by: :short_title
authorize_resource :conference_registrations, class: Registration
add_flash_types :error
add_flash_types :alert
def create
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])

View file

@ -4,6 +4,8 @@ class TicketsController < ApplicationController
load_resource :ticket, through: :conference
authorize_resource :conference_registrations, class: Registration
before_filter :check_load_resource, only: :index
add_flash_types :error
add_flash_types :alert
def index; end

View file

@ -1,5 +1,7 @@
class UsersController < ApplicationController
load_and_authorize_resource
add_flash_types :error
add_flash_types :alert
# GET /users/1
def show
@ -15,8 +17,7 @@ class UsersController < ApplicationController
if @user.update(user_params)
redirect_to @user, notice: 'User was successfully updated.'
else
flash[:error] = "An error prohibited your Profile from being saved: #{@user.errors.full_messages.join('. ')}."
render :edit
render :edit, error: "An error prohibited your Profile from being saved: #{@user.errors.full_messages.join('. ')}."
end
end

0
bin/rspec Executable file → Normal file
View file

0
bin/spring Executable file → Normal file
View file

View file

@ -13,8 +13,13 @@
ActiveRecord::Schema.define(version: 20160201221411) do
<<<<<<< HEAD
create_table "ahoy_events", force: true do |t|
t.uuid "visit_id"
=======
create_table "ahoy_events", force: :cascade do |t|
t.uuid "visit_id", limit: 16
>>>>>>> upstream/master
t.integer "user_id"
t.string "name"
t.text "properties"
@ -31,7 +36,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.datetime "updated_at"
end
<<<<<<< HEAD
create_table "campaigns", force: true do |t|
=======
create_table "campaigns", force: :cascade do |t|
>>>>>>> upstream/master
t.integer "conference_id"
t.string "name"
t.string "utm_source"
@ -43,7 +52,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.datetime "updated_at"
end
<<<<<<< HEAD
create_table "cfps", force: true do |t|
=======
create_table "cfps", force: :cascade do |t|
>>>>>>> upstream/master
t.date "start_date", null: false
t.date "end_date", null: false
t.datetime "created_at"
@ -51,7 +64,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.integer "program_id"
end
<<<<<<< HEAD
create_table "comments", force: true do |t|
=======
create_table "comments", force: :cascade do |t|
>>>>>>> upstream/master
t.string "title", limit: 50, default: ""
t.text "body"
t.integer "commentable_id"
@ -146,7 +163,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.datetime "updated_at"
end
<<<<<<< HEAD
create_table "difficulty_levels", force: true do |t|
=======
create_table "difficulty_levels", force: :cascade do |t|
>>>>>>> upstream/master
t.string "title"
t.text "description"
t.string "color"
@ -188,7 +209,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.text "cfp_dates_updated_body"
end
<<<<<<< HEAD
create_table "event_types", force: true do |t|
=======
create_table "event_types", force: :cascade do |t|
>>>>>>> upstream/master
t.string "title", null: false
t.integer "length", default: 30
t.integer "minimum_abstract_length", default: 0
@ -274,7 +299,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.datetime "updated_at"
end
<<<<<<< HEAD
create_table "programs", force: true do |t|
=======
create_table "programs", force: :cascade do |t|
>>>>>>> upstream/master
t.integer "conference_id"
t.integer "rating", default: 0
t.boolean "schedule_public", default: false
@ -283,7 +312,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.datetime "updated_at"
end
<<<<<<< HEAD
create_table "qanswers", force: true do |t|
=======
create_table "qanswers", force: :cascade do |t|
>>>>>>> upstream/master
t.integer "question_id"
t.integer "answer_id"
t.datetime "created_at"
@ -362,7 +395,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
add_index "roles_users", ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id"
<<<<<<< HEAD
create_table "rooms", force: true do |t|
=======
create_table "rooms", force: :cascade do |t|
>>>>>>> upstream/master
t.string "guid", null: false
t.string "name", null: false
t.integer "size"
@ -448,7 +485,11 @@ ActiveRecord::Schema.define(version: 20160201221411) do
t.string "price_currency", default: "USD", null: false
end
<<<<<<< HEAD
create_table "tracks", force: true do |t|
=======
create_table "tracks", force: :cascade do |t|
>>>>>>> upstream/master
t.string "guid", null: false
t.string "name", null: false
t.text "description"