diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1f2590e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/open_fest/app/vendor/initfest"] + path = lib/open_fest/app/vendor/initfest + url = https://github.com/initLab/initfest.git diff --git a/Capfile b/Capfile index cb0d4a5..3a50fba 100644 --- a/Capfile +++ b/Capfile @@ -1,10 +1,10 @@ -# Load DSL and Setup Up Stages +# Load DSL and set up stages require 'capistrano/setup' -# Includes default deployment tasks +# Include default deployment tasks require 'capistrano/deploy' -# Includes tasks from other gems included in your Gemfile +# Include tasks from other gems included in your Gemfile # # For documentation on these, see for example: # @@ -13,16 +13,19 @@ require 'capistrano/deploy' # https://github.com/capistrano/chruby # https://github.com/capistrano/bundler # https://github.com/capistrano/rails +# https://github.com/capistrano/passenger # # require 'capistrano/rvm' # require 'capistrano/rbenv' # require 'capistrano/chruby' -# require 'capistrano/bundler' -# require 'capistrano/rails/assets' -# require 'capistrano/rails/migrations' - -require 'capistrano/rails' +require 'capistrano/bundler' +require 'capistrano/rails/assets' +require 'capistrano/rails/migrations' +require 'capistrano/puma' +require 'capistrano/puma/nginx' # if you want to upload a nginx site template +# require 'capistrano/passenger' require 'capistrano/rvm' +require 'capistrano/git-submodule-strategy' -# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. +# Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index 6c652c1..5be7f06 100644 --- a/Gemfile +++ b/Gemfile @@ -28,10 +28,6 @@ gem 'phony_rails' gem 'carrierwave' gem 'rmagick' -gem 'capistrano' -gem 'capistrano-rails' -gem 'capistrano-rvm' - gem 'puma', group: :production gem 'globalize' @@ -49,6 +45,8 @@ gem 'jquery-datatables-rails' gem 'morrisjs-rails' gem 'raphael-rails' +gem 'open_fest', path: 'lib/open_fest' + group :development do gem 'spring' gem 'spring-commands-rspec' @@ -58,6 +56,11 @@ group :development do gem 'hirb' gem 'awesome_print' gem 'quiet_assets' + gem 'capistrano' + gem 'capistrano-rails' + gem 'capistrano-rvm' + gem 'capistrano3-puma' + gem 'capistrano-git-submodule-strategy' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 246eb54..cafa556 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,14 @@ GIT specs: yaml_db (0.2.3) +PATH + remote: lib/open_fest + specs: + open_fest (0.0.1) + devise + font-awesome-sass + rails (~> 4.2.3) + GEM remote: https://rubygems.org/ specs: @@ -43,7 +51,7 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.2) + arel (6.0.3) autoprefixer-rails (5.2.1.1) execjs json @@ -64,12 +72,17 @@ GEM capistrano-bundler (1.1.4) capistrano (~> 3.1) sshkit (~> 1.2) + capistrano-git-submodule-strategy (0.1.17) + capistrano (~> 3.1) capistrano-rails (1.1.3) capistrano (~> 3.1) capistrano-bundler (~> 1.1) capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) + capistrano3-puma (1.1.0) + capistrano (~> 3.0) + puma (>= 2.6) capybara (2.4.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -95,7 +108,7 @@ GEM currencies (~> 0.4.2) i18n_data (~> 0.7.0) currencies (0.4.2) - devise (3.5.1) + devise (3.5.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) @@ -122,12 +135,12 @@ GEM font-awesome-sass (4.3.2.1) sass (~> 3.2) formatador (0.2.5) - globalid (0.3.5) + globalid (0.3.6) activesupport (>= 4.1.0) globalize (5.0.1) activemodel (>= 4.2.0, < 4.3) activerecord (>= 4.2.0, < 4.3) - guard (2.12.8) + guard (2.13.0) formatador (>= 0.2.4) listen (>= 2.7, <= 4.0) lumberjack (~> 1.0) @@ -137,20 +150,20 @@ GEM shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) - guard-rspec (4.6.2) + guard-rspec (4.6.4) guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - highline (1.7.2) + highline (1.7.3) hirb (0.7.3) i18n (0.7.0) - i18n-tasks (0.8.5) - activesupport + i18n-tasks (0.8.7) + activesupport (>= 2.3.18) easy_translate (>= 0.5.0) erubis - highline + highline (>= 1.7.3) i18n - term-ansicolor + term-ansicolor (>= 1.3.2) terminal-table (>= 1.5.1) i18n_data (0.7.0) jquery-datatables-rails (3.3.0) @@ -164,7 +177,7 @@ GEM thor (>= 0.14, < 2.0) json (1.8.3) libv8 (3.16.14.11) - listen (3.0.2) + listen (3.0.3) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) loofah (2.0.2) @@ -175,7 +188,7 @@ GEM method_source (0.8.2) mime-types (2.6.1) mini_portile (0.6.2) - minitest (5.7.0) + minitest (5.8.0) morrisjs-rails (0.5.1) railties (> 3.1, < 5) nenv (0.2.0) @@ -185,12 +198,12 @@ GEM net-ssh (2.9.2) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) - notiffany (0.0.6) + notiffany (0.0.7) nenv (~> 0.1) shellany (~> 0.0) orm_adapter (0.5.0) pg (0.18.2) - phony (2.14.10) + phony (2.14.13) phony_rails (0.12.9) activesupport (>= 3.0) countries (~> 0.11, >= 0.11.5) @@ -201,7 +214,7 @@ GEM slop (~> 3.4) pry-rails (0.3.4) pry (>= 0.9.10) - puma (2.12.2) + puma (2.12.3) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.4) @@ -224,7 +237,7 @@ GEM activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) - rails-erd (1.4.1) + rails-erd (1.4.2) activerecord (>= 3.2) activesupport (>= 3.2) choice (~> 0.2.0) @@ -247,7 +260,7 @@ GEM ref (2.0.0) responders (2.1.0) railties (>= 4.2.0, < 5) - rmagick (2.15.2) + rmagick (2.15.3) rspec (3.3.0) rspec-core (~> 3.3.0) rspec-expectations (~> 3.3.0) @@ -342,8 +355,10 @@ DEPENDENCIES bootstrap-sass-extras bootswatch-rails capistrano + capistrano-git-submodule-strategy capistrano-rails capistrano-rvm + capistrano3-puma capybara carrierwave coffee-rails @@ -360,6 +375,7 @@ DEPENDENCIES jquery-rails morrisjs-rails nested_form + open_fest! pg phony_rails pry-rails diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4d04934..58dd170 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,9 +1,5 @@ class ApplicationController < ActionController::Base - def require_current_conference - if not current_conference? - redirect_to '/', alert: 'No conference selected' - end - end + include CurrentConferenceAssigning # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. diff --git a/app/controllers/concerns/current_conference_assigning.rb b/app/controllers/concerns/current_conference_assigning.rb new file mode 100644 index 0000000..d39fbc3 --- /dev/null +++ b/app/controllers/concerns/current_conference_assigning.rb @@ -0,0 +1,30 @@ +module CurrentConferenceAssigning + extend ActiveSupport::Concern + + included do + helper_method :current_conference? + helper_method :current_conference + end + + def current_conference? + current_conference.present? + end + + def current_conference + if not @current_conference + if @conference and not @conference.new_record? + @current_conference = @conference + elsif params[:conference_id].present? + @current_conference = Conference.find(params[:conference_id]) + end + end + + @current_conference + end + + def require_current_conference! + if not current_conference? + raise ActionController::RoutingError.new('Not Found') + end + end +end diff --git a/app/controllers/management/management_controller.rb b/app/controllers/management/management_controller.rb index cefbbaf..d50b412 100644 --- a/app/controllers/management/management_controller.rb +++ b/app/controllers/management/management_controller.rb @@ -6,24 +6,6 @@ module Management private - def current_conference? - current_conference.present? - end - helper_method :current_conference? - - def current_conference - if not @current_conference - if @conference - @current_conference = @conference - elsif params[:conference_id].present? - @current_conference = Conference.find(params[:conference_id]) - end - end - - @current_conference - end - helper_method :current_conference - def authorize_user! head :forbidden unless current_user.admin? end diff --git a/app/models/conference.rb b/app/models/conference.rb index 62dd795..5d773e6 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -24,12 +24,12 @@ class Conference < ActiveRecord::Base end def submissions_grouped_by_day - submissions = events.group('date(events.created_at)').select('events.created_at, count(events.id) as number') + submissions = events.group('date(events.created_at)').select('date(events.created_at) as created_at, count(events.id) as number') submissions.group_by { |s| s.created_at.to_date } end def submissions_grouped_by_confirmation_day - submissions = events.approved.confirmed.group('date(events.confirmed_at)').select('events.confirmed_at, count(events.id) as number') + submissions = events.approved.confirmed.group('date(events.confirmed_at)').select('date(events.confirmed_at) as confirmed_at, count(events.id) as number') submissions.group_by { |s| s.confirmed_at.to_date } end diff --git a/app/models/user.rb b/app/models/user.rb index 69831b6..1124038 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -9,26 +9,18 @@ class User < ActiveRecord::Base has_many :workshops has_many :events - default_scope { order id: :desc } + # TODO (2015-08-05) Copy previous profile + def build_personal_profile(conference, params) + personal_profiles.build({conference_id: conference.id}.merge(params)) + end def personal_profile(conference) personal_profiles.find_by(conference_id: conference.id) end + default_scope { order id: :desc } + def toggle_admin! update admin: !admin end - - def clone_recent_profile(new_conference) - recent_profile = personal_profiles.order('created_at DESC').first - - personal_profiles.build(conference: new_conference) do |new_profile| - if recent_profile.present? - new_profile.attributes = recent_profile.attributes.except( - "id", "created_at", "updated_at", "conference_id" - ) - new_profile.remote_picture_url = recent_profile.picture.url - end - end - end end diff --git a/app/views/devise/shared/_links.html.slim b/app/views/devise/shared/_links.html.slim index 95d6004..58e0871 100644 --- a/app/views/devise/shared/_links.html.slim +++ b/app/views/devise/shared/_links.html.slim @@ -1,24 +1,16 @@ br - if controller_name != 'sessions' - = link_to t('sessions.sign_in'), new_session_path(resource_name) + = link_to t('sessions.sign_in'), new_user_session_path br - if devise_mapping.registerable? && controller_name != 'registrations' - = link_to t('registrations.sign_up'), new_registration_path(resource_name) + = link_to t('registrations.sign_up'), new_user_registration_path br - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' - = link_to t('passwords.forgotten_password'), new_password_path(resource_name) + = link_to t('passwords.forgotten_password'), new_user_password_path br - if devise_mapping.confirmable? && controller_name != 'confirmations' - = link_to t('confirmations.did_not_receive_confirmation_instructions'), new_confirmation_path(resource_name) + = link_to t('confirmations.did_not_receive_confirmation_instructions'), new_user_confirmation_path br - -- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' - = link_to t('unlocks.did_not_receive_unlock_instructions'), new_unlock_path(resource_name) - br - -- if devise_mapping.omniauthable? - - resource_class.omniauth_providers.each do |provider| - = link_to t('sessions.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) diff --git a/app/views/layouts/management/_navigation.html.slim b/app/views/layouts/management/_navigation.html.slim index e4ee0cf..c471a2b 100644 --- a/app/views/layouts/management/_navigation.html.slim +++ b/app/views/layouts/management/_navigation.html.slim @@ -45,5 +45,5 @@ nav.navbar.navbar-static-top.navbar-inverse role="navigation" = link_to t("locales.#{locale}"), "?locale=#{locale}" - if user_signed_in? li - = link_to destroy_user_session_path, method: :delete do + = link_to destroy_management_user_session_path, method: :delete do = icon 'sign-out', t('sessions.sign_out') diff --git a/app/views/management/events/index.html.slim b/app/views/management/events/index.html.slim index c58d3a0..d86cb0b 100644 --- a/app/views/management/events/index.html.slim +++ b/app/views/management/events/index.html.slim @@ -22,7 +22,12 @@ tr td= event.title td= event.subtitle - td= link_to proposer_profile.name, [:management, @conference, proposer] + td + - if proposer_profile + = link_to proposer_profile.name, [:management, @conference, proposer_profile] + - else + | No profile for user #{proposer.email} + td #{event.length} minutes td= event.language diff --git a/config/deploy.rb b/config/deploy.rb index 0da1138..3a40ff2 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,17 +1,18 @@ -# config valid only for Capistrano 3.1 -lock '3.2.1' +# config valid only for current version of Capistrano +lock '3.4.0' set :application, 'clarion' set :repo_url, 'https://github.com/ignisf/clarion.git' # Default branch is :master -ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call +ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp # Default deploy_to directory is /var/www/my_app set :deploy_to, '/home/barf/clarion' # Default value for :scm is :git # set :scm, :git +set :git_strategy, Capistrano::Git::SubmoduleStrategy # Default value for :format is :pretty # set :format, :pretty @@ -23,10 +24,10 @@ set :deploy_to, '/home/barf/clarion' # set :pty, true # Default value for :linked_files is [] -set :linked_files, %w{config/puma.rb config/database.yml config/secrets.yml} +set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml') # Default value for linked_dirs is [] -set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads} +set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads') # Default value for default_env is {} # set :default_env, { path: "/opt/ruby/bin:$PATH" } @@ -34,7 +35,17 @@ set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public # Default value for keep_releases is 5 # set :keep_releases, 5 -set :rvm_ruby_version, '2.1.3' +set :rvm_ruby_version, '2.2.2' + +set :puma_bind, ["tcp://127.0.0.1:9087"] +set :puma_init_active_record, true +set :puma_access_log, "#{shared_path}/log/puma_access.log" +set :puma_error_log, "#{shared_path}/log/puma_error.log" +set :puma_preload_app, true + +set :nginx_sites_available_path, "#{shared_path}" +set :nginx_sites_enabled_path, "/tmp" +set :nginx_server_name, 'cfp.openfest.org' namespace :deploy do diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 74ee85a..b1277f3 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -1,33 +1,53 @@ -# Simple Role Syntax -# ================== -# Supports bulk-adding hosts to roles, the primary server in each group -# is considered to be the first unless any hosts have the primary -# property set. Don't declare `role :all`, it's a meta role. - - -# Extended Server Syntax +# server-based syntax # ====================== -# This can be used to drop a more detailed server definition into the -# server list. The second argument is a, or duck-types, Hash and is -# used to set extended properties on the server. +# Defines a single server with a list of roles and multiple properties. +# You can define all roles on a single server, or split them: + +# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value +# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value +server 'marla.ludost.net', user: 'barf', roles: %w{app db web} + + + +# role-based syntax +# ================== + +# Defines a role with one or multiple servers. The primary server in each +# group is considered to be the first unless any hosts have the primary +# property set. Specify the username and a domain or IP for the server. +# Don't use `:all`, it's a meta role. + +# role :app, %w{deploy@example.com}, my_property: :my_value +# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value +# role :db, %w{deploy@example.com} + + + +# Configuration +# ============= +# You can set any configuration variable like in config/deploy.rb +# These variables are then only loaded and set in this stage. +# For available Capistrano configuration variables see the documentation page. +# http://capistranorb.com/documentation/getting-started/configuration/ +# Feel free to add new variables to customise your setup. -server 'marla.ludost.net', user: 'barf', roles: %w{web db app} # Custom SSH Options # ================== # You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult[net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start). +# limited set of options, consult the Net::SSH documentation. +# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start # # Global options # -------------- -# set :ssh_options, { +set :ssh_options, { # keys: %w(/home/rlisowski/.ssh/id_rsa), -# forward_agent: false, + forward_agent: true, # auth_methods: %w(password) -# } +} # -# And/or per server (overrides global) +# The server-based syntax can be used to override options: # ------------------------------------ # server 'example.com', # user: 'user_name', diff --git a/config/routes.rb b/config/routes.rb index dd4b99c..1e7a448 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,9 @@ Rails.application.routes.draw do - devise_for :users + mount OpenFest::Engine, at: '/', constraints: {subdomain: 'cfp'}, conference_id: 1 namespace :management do root to: 'home#index' + devise_for :users resources :conferences do resources :events diff --git a/db/migrate/20150416234411_create_event_types_for_all_existing_events.rb b/db/migrate/20150416234411_create_event_types_for_all_existing_events.rb index 0e963fe..b12b5ea 100644 --- a/db/migrate/20150416234411_create_event_types_for_all_existing_events.rb +++ b/db/migrate/20150416234411_create_event_types_for_all_existing_events.rb @@ -1,15 +1,18 @@ +class EventType < ActiveRecord::Base +end + class CreateEventTypesForAllExistingEvents < ActiveRecord::Migration def up - event_types = execute 'SELECT DISTINCT(events.type) as type_name, tracks.conference_id, events.created_at, events.updated_at FROM events INNER JOIN tracks ON tracks.id = events.track_id WHERE events.type NOT NULL GROUP BY type_name;' + event_types = execute 'SELECT events.type AS type_name, tracks.conference_id, MIN(events.created_at) AS created_at FROM events + INNER JOIN tracks ON tracks.id = events.track_id + WHERE events.type IS NOT NULL + GROUP BY type_name, tracks.conference_id;' event_types.each do |type| - execute "INSERT INTO event_types (conference_id, created_at, updated_at) - VALUES (#{type['conference_id']}, '#{type['created_at']}', '#{type['updated_at']}');" - - event_type_id = execute('SELECT MAX(id) AS last_id FROM event_types;').first['last_id'] + event_type = EventType.create! conference_id: type['conference_id'], created_at: type['created_at'], updated_at: type['created_at'] execute "INSERT INTO event_type_translations (event_type_id, locale, created_at, updated_at, name, description) - VALUES (#{event_type_id}, 'en', '#{type['created_at']}', '#{type['created_at']}', '#{type['type_name']}', 'None');" + VALUES (#{event_type.id}, 'en', '#{event_type.created_at}', '#{event_type.created_at}', '#{type['type_name']}', 'None');" end end diff --git a/db/migrate/20150417002233_populate_event_type_of_existing_events.rb b/db/migrate/20150417002233_populate_event_type_of_existing_events.rb index 46f01cb..84e8e1d 100644 --- a/db/migrate/20150417002233_populate_event_type_of_existing_events.rb +++ b/db/migrate/20150417002233_populate_event_type_of_existing_events.rb @@ -1,6 +1,6 @@ class PopulateEventTypeOfExistingEvents < ActiveRecord::Migration def up - event_ids = execute('SELECT id FROM events WHERE type NOT NULL;').map { |row| row['id'] }; + event_ids = execute('SELECT id FROM events WHERE type IS NOT NULL;').map { |row| row['id'] }; event_ids.each do |id| event_type_id = execute("SELECT ett.event_type_id FROM events JOIN event_type_translations AS ett ON events.type = ett.name WHERE events.id = #{id};").first['event_type_id'] diff --git a/db/migrate/20150729135346_create_participations.rb b/db/migrate/20150729135346_create_participations.rb index e6ed3c2..848f62f 100644 --- a/db/migrate/20150729135346_create_participations.rb +++ b/db/migrate/20150729135346_create_participations.rb @@ -1,11 +1,13 @@ class CreateParticipations < ActiveRecord::Migration def change create_table :participations do |t| - t.references :participant, index: true, foreign_key: true + t.references :participant, index: true t.references :event, index: true, foreign_key: true t.boolean :approved, default: false t.timestamps null: false end + + add_foreign_key :participations, :users, column: :participant_id end end diff --git a/db/migrate/20150729135818_create_participation_records.rb b/db/migrate/20150729135818_create_participation_records.rb index 33c395e..ca4f337 100644 --- a/db/migrate/20150729135818_create_participation_records.rb +++ b/db/migrate/20150729135818_create_participation_records.rb @@ -6,8 +6,11 @@ class CreateParticipationRecords < ActiveRecord::Migration event_to_speaker_profiles = execute 'SELECT * FROM events_speaker_profiles' event_to_speaker_profiles.each do |event_to_speaker_profile| + profile = PersonalProfile.find_by(id: event_to_speaker_profile['speaker_profile_id']) + next if not profile + Participation.create! event_id: event_to_speaker_profile['event_id'], - participant_id: PersonalProfile.find(event_to_speaker_profile['speaker_profile_id']).user_id, + participant_id: profile.user_id, approved: true end end diff --git a/db/migrate/20150805161830_add_language_to_users.rb b/db/migrate/20150805161830_add_language_to_users.rb new file mode 100644 index 0000000..e9ae846 --- /dev/null +++ b/db/migrate/20150805161830_add_language_to_users.rb @@ -0,0 +1,5 @@ +class AddLanguageToUsers < ActiveRecord::Migration + def change + add_column :users, :language, :string + end +end diff --git a/lib/open_fest/.gitignore b/lib/open_fest/.gitignore new file mode 100644 index 0000000..de5d954 --- /dev/null +++ b/lib/open_fest/.gitignore @@ -0,0 +1,8 @@ +.bundle/ +log/*.log +pkg/ +test/dummy/db/*.sqlite3 +test/dummy/db/*.sqlite3-journal +test/dummy/log/*.log +test/dummy/tmp/ +test/dummy/.sass-cache diff --git a/lib/open_fest/Gemfile b/lib/open_fest/Gemfile new file mode 100644 index 0000000..4007253 --- /dev/null +++ b/lib/open_fest/Gemfile @@ -0,0 +1,15 @@ +source 'https://rubygems.org' + +# Declare your gem's dependencies in open_fest.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +# To use a debugger +# gem 'byebug', group: [:development, :test] + diff --git a/lib/open_fest/Gemfile.lock b/lib/open_fest/Gemfile.lock new file mode 100644 index 0000000..dc67f1b --- /dev/null +++ b/lib/open_fest/Gemfile.lock @@ -0,0 +1,123 @@ +PATH + remote: . + specs: + open_fest (0.0.1) + devise + rails (~> 4.2.3) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.3) + actionpack (= 4.2.3) + actionview (= 4.2.3) + activejob (= 4.2.3) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.3) + actionview (= 4.2.3) + activesupport (= 4.2.3) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.3) + activesupport (= 4.2.3) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.3) + activesupport (= 4.2.3) + globalid (>= 0.3.0) + activemodel (4.2.3) + activesupport (= 4.2.3) + builder (~> 3.1) + activerecord (4.2.3) + activemodel (= 4.2.3) + activesupport (= 4.2.3) + arel (~> 6.0) + activesupport (4.2.3) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.2) + bcrypt (3.1.10) + builder (3.2.2) + devise (3.5.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + responders + thread_safe (~> 0.1) + warden (~> 1.2.3) + erubis (2.7.0) + globalid (0.3.5) + activesupport (>= 4.1.0) + i18n (0.7.0) + json (1.8.3) + loofah (2.0.2) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.7.0) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + orm_adapter (0.5.0) + rack (1.6.4) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.3) + actionmailer (= 4.2.3) + actionpack (= 4.2.3) + actionview (= 4.2.3) + activejob (= 4.2.3) + activemodel (= 4.2.3) + activerecord (= 4.2.3) + activesupport (= 4.2.3) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.3) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.6) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.3) + actionpack (= 4.2.3) + activesupport (= 4.2.3) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + responders (2.1.0) + railties (>= 4.2.0, < 5) + sprockets (3.2.0) + rack (~> 1.0) + sprockets-rails (2.3.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) + thor (0.19.1) + thread_safe (0.3.5) + tzinfo (1.2.2) + thread_safe (~> 0.1) + warden (1.2.3) + rack (>= 1.0) + +PLATFORMS + ruby + +DEPENDENCIES + open_fest! + sqlite3 + +BUNDLED WITH + 1.10.5 diff --git a/lib/open_fest/MIT-LICENSE b/lib/open_fest/MIT-LICENSE new file mode 100644 index 0000000..e042242 --- /dev/null +++ b/lib/open_fest/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright 2015 Petko Bordjukov + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/open_fest/README.rdoc b/lib/open_fest/README.rdoc new file mode 100644 index 0000000..b790d15 --- /dev/null +++ b/lib/open_fest/README.rdoc @@ -0,0 +1,3 @@ += OpenFest + +This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/lib/open_fest/Rakefile b/lib/open_fest/Rakefile new file mode 100644 index 0000000..c356783 --- /dev/null +++ b/lib/open_fest/Rakefile @@ -0,0 +1,37 @@ +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end + +require 'rdoc/task' + +RDoc::Task.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'OpenFest' + rdoc.options << '--line-numbers' + rdoc.rdoc_files.include('README.rdoc') + rdoc.rdoc_files.include('lib/**/*.rb') +end + +APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) +load 'rails/tasks/engine.rake' + + +load 'rails/tasks/statistics.rake' + + + +Bundler::GemHelper.install_tasks + +require 'rake/testtask' + +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.libs << 'test' + t.pattern = 'test/**/*_test.rb' + t.verbose = false +end + + +task default: :test diff --git a/lib/open_fest/app/assets/images/img b/lib/open_fest/app/assets/images/img new file mode 120000 index 0000000..10e8f7b --- /dev/null +++ b/lib/open_fest/app/assets/images/img @@ -0,0 +1 @@ +../../vendor/initfest/img \ No newline at end of file diff --git a/lib/open_fest/app/assets/images/open_fest/.keep b/lib/open_fest/app/assets/images/open_fest/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/app/assets/javascripts/open_fest/application.js b/lib/open_fest/app/assets/javascripts/open_fest/application.js new file mode 100644 index 0000000..646c5ab --- /dev/null +++ b/lib/open_fest/app/assets/javascripts/open_fest/application.js @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/lib/open_fest/app/assets/javascripts/open_fest/welcome.js b/lib/open_fest/app/assets/javascripts/open_fest/welcome.js new file mode 100644 index 0000000..dee720f --- /dev/null +++ b/lib/open_fest/app/assets/javascripts/open_fest/welcome.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/lib/open_fest/app/assets/stylesheets/initfest b/lib/open_fest/app/assets/stylesheets/initfest new file mode 120000 index 0000000..440ce68 --- /dev/null +++ b/lib/open_fest/app/assets/stylesheets/initfest @@ -0,0 +1 @@ +../../vendor/initfest/css \ No newline at end of file diff --git a/lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss b/lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss new file mode 100644 index 0000000..40371f0 --- /dev/null +++ b/lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss @@ -0,0 +1,140 @@ +.alert-error { + color: red; +} + +.input { + position: relative; + margin: 0 0 1em 0; + border-top: 0.1em dotted #999; + padding: 1em 0; +} + +.input label { + font-size: 1em; + display: block; + width: 12em; + float: left; +} + +.input { + input.string, input.email, input.password, select.select, input.numeric { + font-size: 1em; + width: 20em; + float: left; + } + + textarea { + height: 15em; + width: 45em; + } + + img { + padding: 5px; + display: block; + border: 1px solid #CCC; + background-color: #F1F1F1; + + } + + img+input.image_preview { + margin-left: 12.7em; + } + +} + +.input label.boolean { + margin-left: 12em; +} + +.input .hint, .input .error { + display: block; + clear: both; + font-size: 0.75em; + font-style: italic; + width: 20em; + margin: 0 0 0 16em; + padding: 1em 0 0 0; +} + +.input .error { + font-style: normal; + padding: 1em 0 0 0; + color: #F00; +} + +.input .error::before { + content: "⇧"; + display: inline-block; + font-size: 2em; + margin: 0 0.2em 0 0; + transform: translate(0, 0.1em); +} + +.btn { + display: block; + margin: 2em 0 0 13em; +} + +/* styling of the button */ +.btn { + background: #233e83; + padding: 0.4em 0.8em; + border-radius: 0.2em; + color: #FFF; + border: none; + border-bottom: 0.2em solid #7A95DC; + cursor: pointer; + transition: background 200ms, border 200ms, transform 200ms; + -webkit-transition: background 200ms, border 200ms, transform 200ms; +} + +.btn:hover { + background: #152551; +} + +.btn:active { + background: #597AD2; + border-bottom: 0.2em solid #000; + transform: translate(0, 0.1em); + -webkit-transform: translate(0, 0.1em); +} + +.centered { + text-align: center; +} + +.large { + padding: 30px; +} + +.btn-link { + background: #233e83; + padding: 0.4em 0.8em; + border-radius: 0.2em; + color: #FFF; + border: none; + border-bottom: 0.2em solid #7A95DC; + cursor: pointer; + transition: background 200ms, border 200ms, transform 200ms; + -webkit-transition: background 200ms, border 200ms, transform 200ms; +} + +.btn-link:link, .btn-link:active, .btn-link:visited { + color: #FFF; + text-decoration: none; + } + +.btn-link:hover { + background: #152551; +} + +.btn-link:active { + background: #597AD2; + border-bottom: 0.2em solid #000; + transform: translate(0, 0.1em); + -webkit-transform: translate(0, 0.1em); +} + +.btn-link-large { + font-size: 2em; +} diff --git a/lib/open_fest/app/assets/stylesheets/open_fest/application.scss b/lib/open_fest/app/assets/stylesheets/open_fest/application.scss new file mode 100644 index 0000000..604c31c --- /dev/null +++ b/lib/open_fest/app/assets/stylesheets/open_fest/application.scss @@ -0,0 +1,5 @@ +@import "font-awesome-sprockets"; +@import "font-awesome"; + +@import 'initfest/styles'; +@import 'forms'; diff --git a/lib/open_fest/app/controllers/concerns/open_fest/users/devise_controller.rb b/lib/open_fest/app/controllers/concerns/open_fest/users/devise_controller.rb new file mode 100644 index 0000000..0b252fd --- /dev/null +++ b/lib/open_fest/app/controllers/concerns/open_fest/users/devise_controller.rb @@ -0,0 +1,12 @@ +module OpenFest::Users::DeviseController + extend ActiveSupport::Concern + + included do + before_filter :require_current_conference! + layout 'open_fest/application' + end + + def signed_in_root_path(user) + root_path + end +end diff --git a/lib/open_fest/app/controllers/open_fest/application_controller.rb b/lib/open_fest/app/controllers/open_fest/application_controller.rb new file mode 100644 index 0000000..631f18c --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/application_controller.rb @@ -0,0 +1,18 @@ +module OpenFest + class ApplicationController < ActionController::Base + include ::CurrentConferenceAssigning + + before_filter :require_current_conference! + before_filter :set_locale + + def set_locale + if params[:locale] + I18n.locale = params[:locale] + end + end + + def default_url_options(options = {}) + options.merge(locale: params[:locale]) + end + end +end diff --git a/lib/open_fest/app/controllers/open_fest/events_controller.rb b/lib/open_fest/app/controllers/open_fest/events_controller.rb new file mode 100644 index 0000000..1e77dfb --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/events_controller.rb @@ -0,0 +1,35 @@ +require_dependency "open_fest/application_controller" + +module OpenFest + class EventsController < ApplicationController + def index + end + + def new + @event_type = current_conference.event_types.find(params[:type]) + @event = Event.new(event_type: @event_type) + end + + def create + @event = Event.new(event_params) + + if @event.save + # TODO (2015-08-10) Flash message? + flash[:notice] = 'Event was successfully created.' + redirect_to action: :index + else + render action: :new + end + end + + private + + def event_params + params.require(:event).permit( + :title, :subtitle, :length, :language, + :abstract, :description, :notes, :agreement, + :event_type_id + ) + end + end +end diff --git a/lib/open_fest/app/controllers/open_fest/personal_profiles_controller.rb b/lib/open_fest/app/controllers/open_fest/personal_profiles_controller.rb new file mode 100644 index 0000000..cd29086 --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/personal_profiles_controller.rb @@ -0,0 +1,42 @@ +module OpenFest + class PersonalProfilesController < ApplicationController + def new + @profile = current_user.build_personal_profile(current_conference) + end + + def create + @profile = current_user.build_personal_profile(current_conference, profile_params) + + if @profile.save + flash[:notice] = t('profile.successfully_created') + redirect_to root_path + else + render action: :new + end + end + + def edit + @profile = current_user.personal_profile(current_conference) + end + + def update + @profile = current_user.personal_profile(current_conference) + + if @profile.update_attributes(profile_params) + flash[:notice] = t('profile.successfully_updated') + redirect_to root_path + else + render action: 'edit' + end + end + + private + + def profile_params + params.require(:personal_profile).permit( + :picture, :picture_cache, :first_name, :last_name, :public_email, + :organisation, :github, :twitter, :mobile_phone, :biography + ) + end + end +end diff --git a/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb b/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb new file mode 100644 index 0000000..04ea83d --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb @@ -0,0 +1,3 @@ +class OpenFest::Users::ConfirmationsController < Devise::ConfirmationsController + include OpenFest::Users::DeviseController +end diff --git a/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb b/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb new file mode 100644 index 0000000..892c2d6 --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb @@ -0,0 +1,7 @@ +class OpenFest::Users::PasswordsController < Devise::PasswordsController + include OpenFest::Users::DeviseController + + def after_sending_reset_password_instructions_path_for(resource_name) + new_user_session_path + end +end diff --git a/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb new file mode 100644 index 0000000..bcbbdcd --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb @@ -0,0 +1,43 @@ +class OpenFest::Users::RegistrationsController < Devise::RegistrationsController + include OpenFest::Users::DeviseController + + def edit + @user = resource + end + + def update + @user = User.find(current_user.id) + + successfully_updated = + if needs_password?(@user, params) + @user.update_with_password(params_for_update) + else + # remove the virtual current_password attribute + # update_without_password doesn't know how to ignore it + params[:user].delete(:current_password) + @user.update_without_password(params_for_update) + end + + if successfully_updated + set_flash_message :notice, :updated + # Sign in the user bypassing validation in case their password changed + sign_in @user, :bypass => true + redirect_to after_update_path_for(@user) + else + render "edit" + end + end + + private + + def params_for_update + params.require(:user).permit(:email, :language, :password, :password_confirmation, :current_password) + end + + def needs_password?(user, params) + user.email != params[:user][:email] || + params[:user][:password].present? || + params[:user][:password_confirmation].present? + end + +end diff --git a/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb b/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb new file mode 100644 index 0000000..98e6f1f --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb @@ -0,0 +1,3 @@ +class OpenFest::Users::SessionsController < Devise::SessionsController + include OpenFest::Users::DeviseController +end diff --git a/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb b/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb new file mode 100644 index 0000000..f6175d9 --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb @@ -0,0 +1,3 @@ +class OpenFest::Users::UnlocksController < Devise::UnlocksController + include OpenFest::Users::DeviseController +end diff --git a/lib/open_fest/app/helpers/open_fest/application_helper.rb b/lib/open_fest/app/helpers/open_fest/application_helper.rb new file mode 100644 index 0000000..58f9765 --- /dev/null +++ b/lib/open_fest/app/helpers/open_fest/application_helper.rb @@ -0,0 +1,4 @@ +module OpenFest + module ApplicationHelper + end +end diff --git a/lib/open_fest/app/helpers/open_fest/welcome_helper.rb b/lib/open_fest/app/helpers/open_fest/welcome_helper.rb new file mode 100644 index 0000000..914f273 --- /dev/null +++ b/lib/open_fest/app/helpers/open_fest/welcome_helper.rb @@ -0,0 +1,4 @@ +module OpenFest + module WelcomeHelper + end +end diff --git a/lib/open_fest/app/vendor/initfest b/lib/open_fest/app/vendor/initfest new file mode 160000 index 0000000..2afb0ce --- /dev/null +++ b/lib/open_fest/app/vendor/initfest @@ -0,0 +1 @@ +Subproject commit 2afb0ce65bf1718252550379c4bd8c742072ebf3 diff --git a/lib/open_fest/app/views/layouts/open_fest/application.html.erb b/lib/open_fest/app/views/layouts/open_fest/application.html.erb new file mode 100644 index 0000000..a4d91b4 --- /dev/null +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -0,0 +1,22 @@ + + + + + <% if content_for? :title %> + <%= yield :title %> | + <% end %> + <%= current_conference.try :title %> + + + <%= stylesheet_link_tag "open_fest/application", media: "all" %> + <%= javascript_include_tag "open_fest/application" %> + <%= csrf_meta_tags %> + + + <%= render 'open_fest/shared/nav' %> +
+ <%= render 'open_fest/shared/flash_messages' %> + <%= yield %> +
+ + diff --git a/lib/open_fest/app/views/open_fest/events/_event_type.slim b/lib/open_fest/app/views/open_fest/events/_event_type.slim new file mode 100644 index 0000000..8c51604 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/events/_event_type.slim @@ -0,0 +1 @@ +=> link_to t('views.welcome.submit_event', event_type: event_type.name.mb_chars.downcase), new_event_path(type: event_type.id), class: 'btn-link btn-link-large' diff --git a/lib/open_fest/app/views/open_fest/events/_track.slim b/lib/open_fest/app/views/open_fest/events/_track.slim new file mode 100644 index 0000000..1818ca1 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/events/_track.slim @@ -0,0 +1,6 @@ +li + p + strong + = track.name + span<> – + = track.description diff --git a/lib/open_fest/app/views/open_fest/events/index.slim b/lib/open_fest/app/views/open_fest/events/index.slim new file mode 100644 index 0000000..a3222a3 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/events/index.slim @@ -0,0 +1,14 @@ +h1.entry-title = t :home_title, conference: current_conference.title + += simple_format current_conference.description + +p = t :what_we_ask + +ul + = render partial: 'track', collection: current_conference.tracks + +p = t :license_notice + +- if current_conference.call_for_participation.in_progress? + .centered.large + = render partial: 'event_type', collection: current_conference.event_types diff --git a/lib/open_fest/app/views/open_fest/events/new.slim b/lib/open_fest/app/views/open_fest/events/new.slim new file mode 100644 index 0000000..4d9638a --- /dev/null +++ b/lib/open_fest/app/views/open_fest/events/new.slim @@ -0,0 +1,26 @@ += simple_form_for @event, wrapper: :default do |form| + p + = form.error_notification + + h2= t('submit_event', event_type: @event_type.name) + + .form-inputs + = form.input :event_type_id, as: :hidden + + = form.input :title, autofocus: true + = form.input :subtitle + + -# TODO tracks -> indirectly through proposition? + -# form.input :track_id, collection: current_conference.tracks.map { |track| [track.name, track.id, {title: track.description}] }, required: true + + -# TODO length is different for different types of events (translation problem) + = form.input :length + + = form.input :language, collection: I18n.available_locales, include_blank: false, default: I18n.locale + = form.input :abstract + = form.input :description + = form.input :notes + + = form.input :agreement, as: :boolean, wrapper: :default + + = form.button :submit diff --git a/lib/open_fest/app/views/open_fest/personal_profiles/_form.slim b/lib/open_fest/app/views/open_fest/personal_profiles/_form.slim new file mode 100644 index 0000000..14d49d3 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/personal_profiles/_form.slim @@ -0,0 +1,19 @@ += simple_form_for @profile, wrapper: :default, url: personal_profile_path do |f| + = f.error_notification + + .form-inputs + = image_tag(@profile.picture.medium.url) if @profile.picture? + = f.input :picture, as: :file, required: true + = f.hidden_field :picture_cache + + = f.input :first_name, autofocus: true + = f.input :last_name + = f.input :public_email + = f.input :organisation + = f.input :github + = f.input :twitter + = f.input :mobile_phone + = f.input :biography + + .form-actions + = f.button :submit diff --git a/lib/open_fest/app/views/open_fest/personal_profiles/edit.slim b/lib/open_fest/app/views/open_fest/personal_profiles/edit.slim new file mode 100644 index 0000000..d48bae0 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/personal_profiles/edit.slim @@ -0,0 +1,5 @@ +- content_for(:title) { ":: #{t :personal_profile}" } + +h2.entry-title = t :personal_profile + += render 'form' diff --git a/lib/open_fest/app/views/open_fest/personal_profiles/new.slim b/lib/open_fest/app/views/open_fest/personal_profiles/new.slim new file mode 100644 index 0000000..d48bae0 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/personal_profiles/new.slim @@ -0,0 +1,5 @@ +- content_for(:title) { ":: #{t :personal_profile}" } + +h2.entry-title = t :personal_profile + += render 'form' diff --git a/lib/open_fest/app/views/open_fest/shared/_flash_messages.slim b/lib/open_fest/app/views/open_fest/shared/_flash_messages.slim new file mode 100644 index 0000000..c94abd1 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/shared/_flash_messages.slim @@ -0,0 +1,3 @@ +div#flash_messages + - flash.each do |key, value| + = content_tag :div, value, class: "flash #{key}" diff --git a/lib/open_fest/app/views/open_fest/shared/_nav.slim b/lib/open_fest/app/views/open_fest/shared/_nav.slim new file mode 100644 index 0000000..5b1dfd8 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/shared/_nav.slim @@ -0,0 +1,31 @@ +nav + .content.cf + = link_to 'http://www.openfest.org', class: 'logo' do + = image_tag 'img/logo.png', alt: 'OpenFest' + + div + ul.menu + li + a href=events_path = t('views.navigation.submit_event') + li + a href="#" = t('views.navigation.become_a_volunteer') + li + a href="#" = t('views.navigation.become_a_sponsor') + + - unless user_signed_in? + == content_tag :li, class: [('current_page_item' if controller_name == 'sessions')] do + = link_to t(:login), new_user_session_path + - else + == content_tag :li, class: [('current_page_item' if controller_name == 'registrations')] do + = link_to t(:edit_speaker_profile), edit_user_registration_path + li + = link_to t(:logout), destroy_user_session_path, method: :delete + li + - if I18n.locale == :bg + = link_to url_for(request.query_parameters.merge(locale: 'en')), hreflang: 'en' do + img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAIAAAD5gJpuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHzSURBVHjaYkxOP8IAB//+Mfz7w8Dwi4HhP5CcJb/n/7evb16/APL/gRFQDiAAw3JuAgAIBEDQ/iswEERjGzBQLEru97ll0g0+3HvqMn1SpqlqGsZMsZsIe0SICA5gt5a/AGIEarCPtFh+6N/ffwxA9OvP/7//QYwff/6fZahmePeB4dNHhi+fGb59Y4zyvHHmCEAAAW3YDzQYaJJ93a+vX79aVf58//69fvEPlpIfnz59+vDhw7t37968efP3b/SXL59OnjwIEEAsDP+YgY53b2b89++/awvLn98MDi2cVxl+/vl6mituCtBghi9f/v/48e/XL86krj9XzwEEEENy8g6gu22rfn78+NGs5Ofr16+ZC58+fvyYwX8rxOxXr169fPny+fPn1//93bJlBUAAsQADZMEBxj9/GBxb2P/9+S/R8u3vzxuyaX8ZHv3j8/YGms3w8ycQARmi2eE37t4ACCDGR4/uSkrKAS35B3TT////wADOgLOBIaXIyjBlwxKAAGKRXjCB0SOEaeu+/y9fMnz4AHQxCP348R/o+l+//sMZQBNLEvif3AcIIMZbty7Ly6t9ZmXl+fXj/38GoHH/UcGfP79//BBiYHjy9+8/oUkNAAHEwt1V/vI/KBY/QSISFqM/GBg+MzB8A6PfYC5EFiDAABqgW776MP0rAAAAAElFTkSuQmCC" title="English" alt="English" + - elsif I18n.locale == :en + = link_to url_for(request.query_parameters.merge(locale: 'bg')), hreflang: 'bg' do + img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAIAAAD5gJpuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFgSURBVHjaYvz69SsDEvj37x+ERGbAwZ9//wACiAUoysXFBST///8P0QOm//+HU0jgxYsXAAHEAlP0H5nxHxtgZGQEWgIQQCx3Pt2RYZL5+/8vQobh/z8gBIN/MAhErEwst77dAgggRoZmhjKXskefH/359weIfv/7DUJ/f//6CyR//fr7C8j99QdEyvPKH5x0ECAAhWOQAgAMg7D+/8nWNVMQDwmCvWTessZJ9VWHCIns0yWxc/MF4FgMUgCAYRBmpf9/sDqY2yWEQBbEYcK0ZuKxIY0FGZ98Z/8KFlcAsTAcYZDX/M369tefv3/+/AGSIJf8+fMbxPgDYoC4QOP//JER+XPqIANAALH83M7ALPvn3z2gcSBTQK4AOwRKQhh/fjP8+cuo8reOgQEggFiA0cP0+w+DpCRQDijK8AekE+SuP38YICQQ/f0LQUDFAAHECIznf0iIAZWLJgUEAAEGADzQZYYqa4w6AAAAAElFTkSuQmCC" title="Български" alt="Български" + - else + = I18n.locale.inspect diff --git a/lib/open_fest/app/views/open_fest/users/confirmations/new.slim b/lib/open_fest/app/views/open_fest/users/confirmations/new.slim new file mode 100644 index 0000000..d0dad8b --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/confirmations/new.slim @@ -0,0 +1,15 @@ +- content_for(:title) { ":: #{t :resend_instructions_header}" } + +h2.entry-title = t :resend_instructions_header + += simple_form_for(resource, wrapper: :default, as: :user, url: user_confirmation_path) do |f| + = f.error_notification + = f.full_error :confirmation_token + + .form-inputs + = f.input :email, required: true, autofocus: true, hint: false + + .form-actions + = f.button :submit, t(:resend_instructions_btn) + +== render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/passwords/edit.slim b/lib/open_fest/app/views/open_fest/users/passwords/edit.slim new file mode 100644 index 0000000..a49e4bc --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/passwords/edit.slim @@ -0,0 +1,18 @@ +- content_for(:title) { ":: #{t :change_pass}" } + +h2.entry-title = t :change_pass + += simple_form_for(resource, wrapper: :default, as: :user, url: user_password_path, html: { method: :put }) do |f| + = f.error_notification + + = f.input :reset_password_token, as: :hidden + = f.full_error :reset_password_token + + .form-inputs + = f.input :password, required: true, autofocus: true + = f.input :password_confirmation, required: true + + .form-actions + = f.button :submit, t(:change_pass) + += render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/passwords/new.slim b/lib/open_fest/app/views/open_fest/users/passwords/new.slim new file mode 100644 index 0000000..55f2297 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/passwords/new.slim @@ -0,0 +1,14 @@ +- content_for(:title) { ":: #{t :lostpass}" } + +h2.entry-title = t :lostpass + += simple_form_for(resource, wrapper: :default, as: :user, url: user_password_path) do |f| + = f.error_notification + + .form-inputs + = f.input :email, required: true, autofocus: true, hint: false + + .form-actions + = f.button :submit, t(:send_lostpass_instructions) + +== render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/registrations/edit.slim b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim new file mode 100644 index 0000000..e474613 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -0,0 +1,25 @@ +- content_for(:title) { t :edit_speaker_profile } + += simple_form_for(resource, wrapper: :default, as: :user, url: user_registration_path, html: { method: :put, multipart: true }) do |f| + .form_inputs + h2 + - if current_user.personal_profile(current_conference).present? + = link_to t(:personal_profile), edit_personal_profile_path + - else + = link_to t(:personal_profile), new_personal_profile_path + + .form-inputs + h3.entry-title = t :login_data + = f.input :email, required: true + = f.input :language, collection: I18n.available_locales, required: true + + - if devise_mapping.confirmable? && resource.pending_reconfirmation? + p + = t :expected_validation, email: resource.unconfirmed_email + + = f.input :password, autocomplete: "off", hint: t(:pass_update_hint1), required: false + = f.input :password_confirmation, required: false + = f.input :current_password, hint: t(:pass_update_hint2), required: true + + .form-actions + = f.button :submit, t(:update) diff --git a/lib/open_fest/app/views/open_fest/users/registrations/new.slim b/lib/open_fest/app/views/open_fest/users/registrations/new.slim new file mode 100644 index 0000000..bb5f2c2 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/registrations/new.slim @@ -0,0 +1,16 @@ +- content_for(:title) { ":: #{t :registration}" } + +h2.entry-title = t :registration + += simple_form_for(resource, wrapper: :default, as: :user, url: user_registration_path) do |f| + = f.error_notification + + .form-inputs + = f.input :email, required: true, autofocus: true + = f.input :password, required: true + = f.input :password_confirmation, required: true + + .form-actions + = f.button :submit + +== render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/sessions/new.slim b/lib/open_fest/app/views/open_fest/users/sessions/new.slim new file mode 100644 index 0000000..ad15150 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/sessions/new.slim @@ -0,0 +1,14 @@ +- content_for(:title) { "#{t :login}" } + +h2.entry-title = t :login + += simple_form_for(resource, wrapper: :default, as: :user, url: user_session_path) do |f| + .form-inputs + = f.input :email, required: false, autofocus: true, hint: false + = f.input :password, required: false, hint: false + = f.input :remember_me, as: :boolean, wrapper: :default if devise_mapping.rememberable? + + .form-actions + = f.button :submit, t(:login) + +== render 'open_fest/users/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/shared/_links.slim b/lib/open_fest/app/views/open_fest/users/shared/_links.slim new file mode 100644 index 0000000..fc5cdbd --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/shared/_links.slim @@ -0,0 +1,15 @@ +- if controller_name != 'sessions' + = link_to t(:enter), new_user_session_path + br + +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to t(:registration), new_user_registration_path + br + +- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' + = link_to t(:lostpass), new_user_password_path + br + +- if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to t(:did_not_get_confirmation), new_user_confirmation_path + br diff --git a/lib/open_fest/bin/rails b/lib/open_fest/bin/rails new file mode 100755 index 0000000..9be6078 --- /dev/null +++ b/lib/open_fest/bin/rails @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application. + +ENGINE_ROOT = File.expand_path('../..', __FILE__) +ENGINE_PATH = File.expand_path('../../lib/open_fest/engine', __FILE__) + +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) + +require 'rails/all' +require 'rails/engine/commands' diff --git a/lib/open_fest/config/locales/devise.en.yml b/lib/open_fest/config/locales/devise.en.yml new file mode 100644 index 0000000..26a10f2 --- /dev/null +++ b/lib/open_fest/config/locales/devise.en.yml @@ -0,0 +1,60 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + +en: + devise: + confirmations: + confirmed: "Your email address has been successfully confirmed." + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." + failure: + already_authenticated: "You are already signed in." + inactive: "Your account is not activated yet." + invalid: "Invalid %{authentication_keys} or password." + locked: "Your account is locked." + last_attempt: "You have one more attempt before your account is locked." + not_found_in_database: "Invalid %{authentication_keys} or password." + timeout: "Your session expired. Please sign in again to continue." + unauthenticated: "You need to sign in or sign up before continuing." + unconfirmed: "You have to confirm your email address before continuing." + mailer: + confirmation_instructions: + subject: "Confirmation instructions" + reset_password_instructions: + subject: "Reset password instructions" + unlock_instructions: + subject: "Unlock instructions" + omniauth_callbacks: + failure: "Could not authenticate you from %{kind} because \"%{reason}\"." + success: "Successfully authenticated from %{kind} account." + passwords: + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." + updated: "Your password has been changed successfully. You are now signed in." + updated_not_active: "Your password has been changed successfully." + registrations: + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." + signed_up: "Welcome! You have signed up successfully." + signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." + signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." + updated: "Your account has been updated successfully." + sessions: + signed_in: "Signed in successfully." + signed_out: "Signed out successfully." + already_signed_out: "Signed out successfully." + unlocks: + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." + unlocked: "Your account has been unlocked successfully. Please sign in to continue." + errors: + messages: + already_confirmed: "was already confirmed, please try signing in" + confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" + expired: "has expired, please request a new one" + not_found: "not found" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/lib/open_fest/config/locales/simple_form.bg.yml b/lib/open_fest/config/locales/simple_form.bg.yml new file mode 100644 index 0000000..9c04343 --- /dev/null +++ b/lib/open_fest/config/locales/simple_form.bg.yml @@ -0,0 +1,32 @@ +bg: + simple_form: + "yes": Да + "no": Не + required: + text: Задължително поле + mark: '*' + error_notification: + default_message: 'Моля, разгледайте посочените грешки във формуляра:' + hints: + user: + email: e-mail адресът Ви. Ще бъде видим само от организаторите + password: Парола с дължина между 8 и 128 символа + password_confirmation: Отново въведената отгоре парола + speaker_profile: + picture: Ваша снимка + organisation: Организацията, която представлявате + public_email: E-mail адрес, който ще бъде видим за посетителите + mobile_phone: Мобилен телефон, който ще бъде видим само за организаторите + biography: Опишете се с няколко изречения, говорейки за себе си в трето лице :) + github: Потребителското Ви име в Github + twitter: Потребителското Ви име в Twitter + event: + title: Заглавието на събитието Ви + subtitle: Подзаглавието на събитието Ви (ако има такова) + track_id: Потокът от лекции, в който искате да попадне събитието Ви + length: Продължителността на събитието може да бъде от 40 до 45 минути + language: Език, на който ще бъде водено събитието + abstract: Резюме на събитието, което да може да бъде прочетено от посетителите (1 абзац) + description: Подробно описание на събитието (няколко абзаца) + notes: Забележки, които искате да споделите с организаторския екип + agreement: Отбележете съгласни ли сте с това събитието Ви да бъде записано и публикувано под лиценз CC-BY-ND (Creative Commons – Attribution – No Derivatives) diff --git a/lib/open_fest/config/locales/simple_form.en.yml b/lib/open_fest/config/locales/simple_form.en.yml new file mode 100644 index 0000000..770e3e7 --- /dev/null +++ b/lib/open_fest/config/locales/simple_form.en.yml @@ -0,0 +1,32 @@ +en: + simple_form: + "yes": Yes + "no": No + required: + text: Required field + mark: '*' + error_notification: + default_message: 'Please see the errors below:' + hints: + user: + email: Your e-mail address. Will be visible to the organizers only. + password: Password with length between 8 and 128 symbols + password_confirmation: Repeat the password + speaker_profile: + picture: Your photo + organisation: Your organization + public_email: E-mail address, visible to the visitors + mobile_phone: Mobile phone, visible for the organizers only + biography: Describe yourself in a few sentences in third person :) + github: Your Github username + twitter: Your Twitter username + event: + title: Title of your event + subtitle: Sub-title of your event (if applicable) + track_id: Track for your event + length: The length of your event can be from 40 to 45 minutes + language: Language in which the event will be presented + abstract: Abstract of the event, for the visitors + description: Detailed description of the event, visible to the visitors + notes: Notes on your event, visible only to the organizers + agreement: Indicate if you accept that your event will be recorded and published under the CC-BY-ND (Creative Commons – Attribution – No Derivatives) license diff --git a/lib/open_fest/config/locales/views.bg.yml b/lib/open_fest/config/locales/views.bg.yml new file mode 100644 index 0000000..5281721 --- /dev/null +++ b/lib/open_fest/config/locales/views.bg.yml @@ -0,0 +1,76 @@ +bg: + views: + welcome: + submit_event: "Предложи %{event_type}" + home_title: "%{conference} - зов за лектори" + what_we_ask: 'Бихме искали да получим предложенията Ви за лекции и уъркшопи, принадлежащи към следните категории до 30 септември 2014г.:' + license_notice: 'Имайте предвид, че презентациите ви впоследствие ще бъдат публикувани с лиценз CC-BY-ND (Creative Commons – Attribution – No derivatives).' + submit_event: Предложи %{event_type} + resend_instructions_header: Повторно изпращане на инструкции за потвърждаване на акаунт + resend_instructions_btn: Изпрати отново инструкциите + + enter: Вход + login: Вход + registration: Регистрация + lostpass: Забравена парола? + did_not_get_confirmation: Не сте получили инструкции за потвърждение? + did_not_get_unlock: Не сте получили инструкции за отключване? + change_pass: Промяна на парола + send_lostpass_instructions: Изпрати ми инструкции за промяна на парола + + login_data: Данни за вход в системата + login_with: "Влез с %{with}" + + speaker_profile: Лекторски профил + please_fill_in_your_speaker_profile: Моля, попълнете данните в лекторския си профил. + expected_validation: "Очаква се потвърждение на: %{email}" + pass_update_hint1: Не попълвайте, ако не желаете да промените паролата си + pass_update_hint2: Попълнете, ако искате да промените паролата или e-mail адреса си. + update: Обнови + + resend_unlock_instructions_title: Изпрати отново инструкции за отключване + + edit_speaker_profile: Редакция на профил + + edit_workshop: Редакция на уъркшоп + + edit_title: "поток: „%{track}“, продължителност: %{len} мин." + abstract: Резюме + description: Описание + edit: Редактирай + + new_workshop_title: Предложи нов уъркшоп + + my_workshops: Моите предложения за уъркшопи + no_workshops_submitted: Все още не сте предложили уъркшоп + + edit_talk: Редакция на лекция + + submit_talk_header: Предложи нова лекция + + my_talks: Моите предложения за лекции + no_talks_submitted: Все още не сте предложили лекция + + hello: "Здравейте, %{name}" + account_locked: Акаунтът Ви беше заключен поради голям брой неуспешни опити за влизане в него. + click_to_unlock: 'Кликнете линкът отдолу, за да го отключите:' + + welcome: "Добре дошли, %{name}" + confirm_by_clicking: Можете да потвърдите акаунта си, като кликнете на линка отдолу + + someone_requested_passreset: Някой поиска линк за промяна на парола на акаунта Ви. Паролата може да бъде променена от линкът отдолу. + do_not_want_pass_reset1: Ако не желаете да смените паролата си, моля изтрийте това писмо. + do_not_want_pass_reset2: Паролата Ви няма да бъде променена, докато не кликнете горния линк и не въведете нова парола. + + home: Начало + talks: Лекции + workshops: Уъркшопи + logout: Изход + + of_motto: да споделим свободата + + meta_data: "Език: %{language}, поток: „%{track}“, продължителност: %{length} мин." + suggestion_and_speaker_count: "%{suggestions} предложения от %{speakers} лектори" + + lecture_was_successfully_confirmed: "Лекцията беше потвърдена успешно" + workshop_was_successfully_confirmed: "Уъркшопът беше потвърден успешно" diff --git a/lib/open_fest/config/locales/views.en.yml b/lib/open_fest/config/locales/views.en.yml new file mode 100644 index 0000000..61ce57a --- /dev/null +++ b/lib/open_fest/config/locales/views.en.yml @@ -0,0 +1,71 @@ +en: + home_title: "%{conference} - call for speakers" + what_we_ask: 'Please send us applications for talks and workshops in the following categories until September 30, 2014:' + license_notice: 'Keep in mind that your workshop/presentation will later be published under the CC-BY-ND (Creative Commons – Attribution – No derivatives) license.' + submit_event: Submit %{event_type} + resend_instructions_header: Re-send the instructions for confirming an account + resend_instructions_btn: Re-send instructions + enter: Login + login: Login + registration: Registration + lostpass: Lost password? + did_not_get_confirmation: Did not get confirmation instructions? + did_not_get_unlock: Did not get unlocking instructions? + change_pass: Change password + send_lostpass_instructions: Send instructions to reset lost password + + login_data: Login data + login_with: "Login with %{with}" + + speaker_profile: Speaker's profile + please_fill_in_your_speaker_profile: Please fill in your speaker profile. + expected_validation: "Expected confirmation of: %{email}" + pass_update_hint1: Do not fill, if you do not want to change your password + pass_update_hint2: Fill this if you want to change your password or e-mail. + update: Update + + resend_unlock_instructions_title: Re-send unlocking instructions + + edit_speaker_profile: Edit profile + + edit_workshop: Edit workshop + + edit_title: "track: „%{track}“, duration: %{len} min." + abstract: Abstract + description: Description + edit: Edit + + new_workshop_title: Submit new workshop + + my_workshops: My submitted workshops + no_workshops_submitted: You have no submissions for workshops + + edit_talk: Edit talk + + submit_talk_header: Submit new talk + + my_talks: My submitted talks + no_talks_submitted: You have no submissions for talks + + hello: "Hello, %{name}" + account_locked: Your account was locked because of too many failed login attempts. + click_to_unlock: 'Click on the link below to unlock it:' + + welcome: "Welcome, %{name}" + confirm_by_clicking: 'You can confirm your account by clicking on the link below:' + + someone_requested_passreset: Someone has requested a link to reset the password of your account. Your password can be changed through the link below. + do_not_want_pass_reset1: If you don't want to change your password, please delete this message. + do_not_want_pass_reset2: Your password will not be changed unless you click on the link above and enter a new password. + + home: Home + talks: Lectures + workshops: Workshops + logout: Logout + + of_motto: share the freedom + meta_data: "Language: %{language}, track: \"%{track}\", length: %{length} min." + suggestion_and_speaker_count: "%{suggestions} suggestions by %{speakers} speakers" + + lecture_was_successfully_confirmed: "The lecture was successfully confirmed" + workshop_was_successfully_confirmed: "The workshop was successfully confirmed" diff --git a/lib/open_fest/config/routes.rb b/lib/open_fest/config/routes.rb new file mode 100644 index 0000000..fae7e66 --- /dev/null +++ b/lib/open_fest/config/routes.rb @@ -0,0 +1,10 @@ +OpenFest::Engine.routes.draw do + root to: 'events#index' + + scope '(/:locale)' do + devise_for :users, module: 'open_fest/users' + + resource :personal_profile, path: 'profile' + resources :events + end +end diff --git a/lib/open_fest/lib/open_fest.rb b/lib/open_fest/lib/open_fest.rb new file mode 100644 index 0000000..cb94b59 --- /dev/null +++ b/lib/open_fest/lib/open_fest.rb @@ -0,0 +1,4 @@ +require "open_fest/engine" + +module OpenFest +end diff --git a/lib/open_fest/lib/open_fest/engine.rb b/lib/open_fest/lib/open_fest/engine.rb new file mode 100644 index 0000000..b932986 --- /dev/null +++ b/lib/open_fest/lib/open_fest/engine.rb @@ -0,0 +1,5 @@ +module OpenFest + class Engine < ::Rails::Engine + isolate_namespace OpenFest + end +end diff --git a/lib/open_fest/lib/open_fest/version.rb b/lib/open_fest/lib/open_fest/version.rb new file mode 100644 index 0000000..9ed4704 --- /dev/null +++ b/lib/open_fest/lib/open_fest/version.rb @@ -0,0 +1,3 @@ +module OpenFest + VERSION = "0.0.1" +end diff --git a/lib/open_fest/lib/tasks/open_fest_tasks.rake b/lib/open_fest/lib/tasks/open_fest_tasks.rake new file mode 100644 index 0000000..a7526ef --- /dev/null +++ b/lib/open_fest/lib/tasks/open_fest_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :open_fest do +# # Task goes here +# end diff --git a/lib/open_fest/open_fest.gemspec b/lib/open_fest/open_fest.gemspec new file mode 100644 index 0000000..59c0956 --- /dev/null +++ b/lib/open_fest/open_fest.gemspec @@ -0,0 +1,23 @@ +$:.push File.expand_path("../lib", __FILE__) + +# Maintain your gem's version: +require "open_fest/version" + +# Describe your gem and declare its dependencies: +Gem::Specification.new do |s| + s.name = "open_fest" + s.version = OpenFest::VERSION + s.authors = ["Petko Bordjukov"] + s.email = ["bordjukov@gmail.com"] + s.summary = "OpenFest CFP User-facing part" + s.license = "MIT" + + s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] + s.test_files = Dir["test/**/*"] + + s.add_dependency "rails", "~> 4.2.3" + s.add_dependency "devise", ">= 0" + s.add_dependency "font-awesome-sass", ">= 0" + + s.add_development_dependency "sqlite3" +end diff --git a/lib/open_fest/test/controllers/open_fest/welcome_controller_test.rb b/lib/open_fest/test/controllers/open_fest/welcome_controller_test.rb new file mode 100644 index 0000000..7e25155 --- /dev/null +++ b/lib/open_fest/test/controllers/open_fest/welcome_controller_test.rb @@ -0,0 +1,15 @@ +require 'test_helper' + +module OpenFest + class WelcomeControllerTest < ActionController::TestCase + setup do + @routes = Engine.routes + end + + test "should get index" do + get :index + assert_response :success + end + + end +end diff --git a/lib/open_fest/test/dummy/README.rdoc b/lib/open_fest/test/dummy/README.rdoc new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/lib/open_fest/test/dummy/README.rdoc @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/lib/open_fest/test/dummy/Rakefile b/lib/open_fest/test/dummy/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/lib/open_fest/test/dummy/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/lib/open_fest/test/dummy/app/assets/images/.keep b/lib/open_fest/test/dummy/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/dummy/app/assets/javascripts/application.js b/lib/open_fest/test/dummy/app/assets/javascripts/application.js new file mode 100644 index 0000000..8913b40 --- /dev/null +++ b/lib/open_fest/test/dummy/app/assets/javascripts/application.js @@ -0,0 +1,13 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require_tree . diff --git a/lib/open_fest/test/dummy/app/assets/stylesheets/application.css b/lib/open_fest/test/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000..f9cd5b3 --- /dev/null +++ b/lib/open_fest/test/dummy/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/lib/open_fest/test/dummy/app/controllers/application_controller.rb b/lib/open_fest/test/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/lib/open_fest/test/dummy/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/lib/open_fest/test/dummy/app/controllers/concerns/.keep b/lib/open_fest/test/dummy/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/dummy/app/helpers/application_helper.rb b/lib/open_fest/test/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/lib/open_fest/test/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/lib/open_fest/test/dummy/app/mailers/.keep b/lib/open_fest/test/dummy/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/dummy/app/models/.keep b/lib/open_fest/test/dummy/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/dummy/app/models/concerns/.keep b/lib/open_fest/test/dummy/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/dummy/app/views/layouts/application.html.erb b/lib/open_fest/test/dummy/app/views/layouts/application.html.erb new file mode 100644 index 0000000..593a778 --- /dev/null +++ b/lib/open_fest/test/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Dummy + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/lib/open_fest/test/dummy/bin/bundle b/lib/open_fest/test/dummy/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/lib/open_fest/test/dummy/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/lib/open_fest/test/dummy/bin/rails b/lib/open_fest/test/dummy/bin/rails new file mode 100755 index 0000000..5191e69 --- /dev/null +++ b/lib/open_fest/test/dummy/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/lib/open_fest/test/dummy/bin/rake b/lib/open_fest/test/dummy/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/lib/open_fest/test/dummy/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/lib/open_fest/test/dummy/bin/setup b/lib/open_fest/test/dummy/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/lib/open_fest/test/dummy/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/lib/open_fest/test/dummy/config.ru b/lib/open_fest/test/dummy/config.ru new file mode 100644 index 0000000..bd83b25 --- /dev/null +++ b/lib/open_fest/test/dummy/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/lib/open_fest/test/dummy/config/application.rb b/lib/open_fest/test/dummy/config/application.rb new file mode 100644 index 0000000..52d5d76 --- /dev/null +++ b/lib/open_fest/test/dummy/config/application.rb @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +Bundler.require(*Rails.groups) +require "open_fest" + +module Dummy + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end + diff --git a/lib/open_fest/test/dummy/config/boot.rb b/lib/open_fest/test/dummy/config/boot.rb new file mode 100644 index 0000000..6266cfc --- /dev/null +++ b/lib/open_fest/test/dummy/config/boot.rb @@ -0,0 +1,5 @@ +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__) diff --git a/lib/open_fest/test/dummy/config/database.yml b/lib/open_fest/test/dummy/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/lib/open_fest/test/dummy/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/lib/open_fest/test/dummy/config/environment.rb b/lib/open_fest/test/dummy/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/lib/open_fest/test/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/lib/open_fest/test/dummy/config/environments/development.rb b/lib/open_fest/test/dummy/config/environments/development.rb new file mode 100644 index 0000000..b55e214 --- /dev/null +++ b/lib/open_fest/test/dummy/config/environments/development.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/lib/open_fest/test/dummy/config/environments/production.rb b/lib/open_fest/test/dummy/config/environments/production.rb new file mode 100644 index 0000000..5c1b32e --- /dev/null +++ b/lib/open_fest/test/dummy/config/environments/production.rb @@ -0,0 +1,79 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/lib/open_fest/test/dummy/config/environments/test.rb b/lib/open_fest/test/dummy/config/environments/test.rb new file mode 100644 index 0000000..1c19f08 --- /dev/null +++ b/lib/open_fest/test/dummy/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/lib/open_fest/test/dummy/config/initializers/assets.rb b/lib/open_fest/test/dummy/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/lib/open_fest/test/dummy/config/initializers/backtrace_silencers.rb b/lib/open_fest/test/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/lib/open_fest/test/dummy/config/initializers/cookies_serializer.rb b/lib/open_fest/test/dummy/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/lib/open_fest/test/dummy/config/initializers/filter_parameter_logging.rb b/lib/open_fest/test/dummy/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/lib/open_fest/test/dummy/config/initializers/inflections.rb b/lib/open_fest/test/dummy/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/lib/open_fest/test/dummy/config/initializers/mime_types.rb b/lib/open_fest/test/dummy/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/lib/open_fest/test/dummy/config/initializers/session_store.rb b/lib/open_fest/test/dummy/config/initializers/session_store.rb new file mode 100644 index 0000000..e766b67 --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_dummy_session' diff --git a/lib/open_fest/test/dummy/config/initializers/wrap_parameters.rb b/lib/open_fest/test/dummy/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/lib/open_fest/test/dummy/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/lib/open_fest/test/dummy/config/locales/en.yml b/lib/open_fest/test/dummy/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/lib/open_fest/test/dummy/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/lib/open_fest/test/dummy/config/routes.rb b/lib/open_fest/test/dummy/config/routes.rb new file mode 100644 index 0000000..14ef7fd --- /dev/null +++ b/lib/open_fest/test/dummy/config/routes.rb @@ -0,0 +1,4 @@ +Rails.application.routes.draw do + + mount OpenFest::Engine => "/open_fest" +end diff --git a/lib/open_fest/test/dummy/config/secrets.yml b/lib/open_fest/test/dummy/config/secrets.yml new file mode 100644 index 0000000..47feabc --- /dev/null +++ b/lib/open_fest/test/dummy/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: 6141476e69d5ff0cc454b9755d96964cd1bd47e33d69f7a02e1cb081938e39f0b5621db41c0a266b4024fdffed06df5afd000ad907df3ae26f47a1aacbea065e + +test: + secret_key_base: dd128f1733c4a426ba24ccf0ce8f77876a81b64e7169b64714d8363dff5e5a8c7f51391823980fe98aed3487d6aad8055597c002e0183b7257f0a21a83fe947b + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/lib/open_fest/test/dummy/lib/assets/.keep b/lib/open_fest/test/dummy/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/dummy/log/.keep b/lib/open_fest/test/dummy/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/dummy/public/404.html b/lib/open_fest/test/dummy/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/lib/open_fest/test/dummy/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/lib/open_fest/test/dummy/public/422.html b/lib/open_fest/test/dummy/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/lib/open_fest/test/dummy/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/lib/open_fest/test/dummy/public/500.html b/lib/open_fest/test/dummy/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/lib/open_fest/test/dummy/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/lib/open_fest/test/dummy/public/favicon.ico b/lib/open_fest/test/dummy/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/lib/open_fest/test/integration/navigation_test.rb b/lib/open_fest/test/integration/navigation_test.rb new file mode 100644 index 0000000..97a94c9 --- /dev/null +++ b/lib/open_fest/test/integration/navigation_test.rb @@ -0,0 +1,10 @@ +require 'test_helper' + +class NavigationTest < ActionDispatch::IntegrationTest + fixtures :all + + # test "the truth" do + # assert true + # end +end + diff --git a/lib/open_fest/test/open_fest_test.rb b/lib/open_fest/test/open_fest_test.rb new file mode 100644 index 0000000..6a6e42b --- /dev/null +++ b/lib/open_fest/test/open_fest_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class OpenFestTest < ActiveSupport::TestCase + test "truth" do + assert_kind_of Module, OpenFest + end +end diff --git a/lib/open_fest/test/test_helper.rb b/lib/open_fest/test/test_helper.rb new file mode 100644 index 0000000..a3177bf --- /dev/null +++ b/lib/open_fest/test/test_helper.rb @@ -0,0 +1,20 @@ +# Configure Rails Environment +ENV["RAILS_ENV"] = "test" + +require File.expand_path("../../test/dummy/config/environment.rb", __FILE__) +ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)] +ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__) +require "rails/test_help" + +# Filter out Minitest backtrace while allowing backtrace from other libraries +# to be shown. +Minitest.backtrace_filter = Minitest::BacktraceFilter.new + +# Load support files +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } + +# Load fixtures from the engine +if ActiveSupport::TestCase.respond_to?(:fixture_path=) + ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__) + ActiveSupport::TestCase.fixtures :all +end diff --git a/spec/factories/personal_profile.rb b/spec/factories/personal_profile.rb index 081fddb..10b66e8 100644 --- a/spec/factories/personal_profile.rb +++ b/spec/factories/personal_profile.rb @@ -1,14 +1,15 @@ FactoryGirl.define do factory :personal_profile do - association :user - - first_name "Some" - last_name "Person" - picture File.open(Rails.root.join("spec/support/picture.jpg")) - mobile_phone "0883 123 456" - biography "Biography" - sequence(:public_email) { |n| "email#{n}@example.com" } - twitter "example" - github "example" + first_name 'Foo' + last_name 'Bar' + organisation 'foo inc.' + public_email 'foo@example.com' + picture { Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec', 'support', 'picture.jpg')) } + mobile_phone '+359883444555' + biography 'Just a bio' + github 'foobar' + twitter 'foobar' + user + conference end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9272a0f..155b44a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -4,28 +4,4 @@ RSpec.describe User do it 'lets Devise handle email and password validations' do expect(build(:user)).to be_a Devise::Models::Validatable end - - it "can clone a previous profile for use in a different conference" do - user = create :user - old_conference = create :conference - new_conference = create :conference - - old_profile = create :personal_profile, { - user: user, - biography: "Old profile bio", - conference: old_conference - } - - expect(user.personal_profile(old_conference)).to eq old_profile - expect(user.personal_profile(new_conference)).to be_nil - - new_profile = user.clone_recent_profile(new_conference) - expect(new_profile.biography).to eq old_profile.biography - - user.reload - user.personal_profiles << new_profile - - expect(user.personal_profile(old_conference)).to eq old_profile - expect(user.personal_profile(new_conference)).to eq new_profile - end end