From c0c40578500b1806cc4a8a7350d5b7fbd42ed784 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 16:44:06 +0300 Subject: [PATCH 01/36] Create a new mountable Rails plugin called OpenFest --- lib/open_fest/.gitignore | 8 ++ lib/open_fest/Gemfile | 15 +++ lib/open_fest/Gemfile.lock | 109 ++++++++++++++++++ lib/open_fest/MIT-LICENSE | 20 ++++ lib/open_fest/README.rdoc | 3 + lib/open_fest/Rakefile | 37 ++++++ .../app/assets/images/open_fest/.keep | 0 .../javascripts/open_fest/application.js | 13 +++ .../assets/javascripts/open_fest/welcome.js | 2 + .../stylesheets/open_fest/application.css | 15 +++ .../assets/stylesheets/open_fest/welcome.css | 4 + .../open_fest/application_controller.rb | 4 + .../open_fest/welcome_controller.rb | 8 ++ .../helpers/open_fest/application_helper.rb | 4 + .../app/helpers/open_fest/welcome_helper.rb | 4 + .../layouts/open_fest/application.html.erb | 14 +++ .../views/open_fest/welcome/index.html.erb | 2 + lib/open_fest/bin/rails | 12 ++ lib/open_fest/config/routes.rb | 5 + lib/open_fest/lib/open_fest.rb | 4 + lib/open_fest/lib/open_fest/engine.rb | 5 + lib/open_fest/lib/open_fest/version.rb | 3 + lib/open_fest/lib/tasks/open_fest_tasks.rake | 4 + lib/open_fest/open_fest.gemspec | 21 ++++ .../open_fest/welcome_controller_test.rb | 15 +++ lib/open_fest/test/dummy/README.rdoc | 28 +++++ lib/open_fest/test/dummy/Rakefile | 6 + .../test/dummy/app/assets/images/.keep | 0 .../app/assets/javascripts/application.js | 13 +++ .../app/assets/stylesheets/application.css | 15 +++ .../app/controllers/application_controller.rb | 5 + .../test/dummy/app/controllers/concerns/.keep | 0 .../dummy/app/helpers/application_helper.rb | 2 + lib/open_fest/test/dummy/app/mailers/.keep | 0 lib/open_fest/test/dummy/app/models/.keep | 0 .../test/dummy/app/models/concerns/.keep | 0 .../app/views/layouts/application.html.erb | 14 +++ lib/open_fest/test/dummy/bin/bundle | 3 + lib/open_fest/test/dummy/bin/rails | 4 + lib/open_fest/test/dummy/bin/rake | 4 + lib/open_fest/test/dummy/bin/setup | 29 +++++ lib/open_fest/test/dummy/config.ru | 4 + .../test/dummy/config/application.rb | 26 +++++ lib/open_fest/test/dummy/config/boot.rb | 5 + lib/open_fest/test/dummy/config/database.yml | 25 ++++ .../test/dummy/config/environment.rb | 5 + .../dummy/config/environments/development.rb | 41 +++++++ .../dummy/config/environments/production.rb | 79 +++++++++++++ .../test/dummy/config/environments/test.rb | 42 +++++++ .../test/dummy/config/initializers/assets.rb | 11 ++ .../initializers/backtrace_silencers.rb | 7 ++ .../config/initializers/cookies_serializer.rb | 3 + .../initializers/filter_parameter_logging.rb | 4 + .../dummy/config/initializers/inflections.rb | 16 +++ .../dummy/config/initializers/mime_types.rb | 4 + .../config/initializers/session_store.rb | 3 + .../config/initializers/wrap_parameters.rb | 14 +++ .../test/dummy/config/locales/en.yml | 23 ++++ lib/open_fest/test/dummy/config/routes.rb | 4 + lib/open_fest/test/dummy/config/secrets.yml | 22 ++++ lib/open_fest/test/dummy/lib/assets/.keep | 0 lib/open_fest/test/dummy/log/.keep | 0 lib/open_fest/test/dummy/public/404.html | 67 +++++++++++ lib/open_fest/test/dummy/public/422.html | 67 +++++++++++ lib/open_fest/test/dummy/public/500.html | 66 +++++++++++ lib/open_fest/test/dummy/public/favicon.ico | 0 .../test/integration/navigation_test.rb | 10 ++ lib/open_fest/test/open_fest_test.rb | 7 ++ lib/open_fest/test/test_helper.rb | 20 ++++ 69 files changed, 1029 insertions(+) create mode 100644 lib/open_fest/.gitignore create mode 100644 lib/open_fest/Gemfile create mode 100644 lib/open_fest/Gemfile.lock create mode 100644 lib/open_fest/MIT-LICENSE create mode 100644 lib/open_fest/README.rdoc create mode 100644 lib/open_fest/Rakefile create mode 100644 lib/open_fest/app/assets/images/open_fest/.keep create mode 100644 lib/open_fest/app/assets/javascripts/open_fest/application.js create mode 100644 lib/open_fest/app/assets/javascripts/open_fest/welcome.js create mode 100644 lib/open_fest/app/assets/stylesheets/open_fest/application.css create mode 100644 lib/open_fest/app/assets/stylesheets/open_fest/welcome.css create mode 100644 lib/open_fest/app/controllers/open_fest/application_controller.rb create mode 100644 lib/open_fest/app/controllers/open_fest/welcome_controller.rb create mode 100644 lib/open_fest/app/helpers/open_fest/application_helper.rb create mode 100644 lib/open_fest/app/helpers/open_fest/welcome_helper.rb create mode 100644 lib/open_fest/app/views/layouts/open_fest/application.html.erb create mode 100644 lib/open_fest/app/views/open_fest/welcome/index.html.erb create mode 100755 lib/open_fest/bin/rails create mode 100644 lib/open_fest/config/routes.rb create mode 100644 lib/open_fest/lib/open_fest.rb create mode 100644 lib/open_fest/lib/open_fest/engine.rb create mode 100644 lib/open_fest/lib/open_fest/version.rb create mode 100644 lib/open_fest/lib/tasks/open_fest_tasks.rake create mode 100644 lib/open_fest/open_fest.gemspec create mode 100644 lib/open_fest/test/controllers/open_fest/welcome_controller_test.rb create mode 100644 lib/open_fest/test/dummy/README.rdoc create mode 100644 lib/open_fest/test/dummy/Rakefile create mode 100644 lib/open_fest/test/dummy/app/assets/images/.keep create mode 100644 lib/open_fest/test/dummy/app/assets/javascripts/application.js create mode 100644 lib/open_fest/test/dummy/app/assets/stylesheets/application.css create mode 100644 lib/open_fest/test/dummy/app/controllers/application_controller.rb create mode 100644 lib/open_fest/test/dummy/app/controllers/concerns/.keep create mode 100644 lib/open_fest/test/dummy/app/helpers/application_helper.rb create mode 100644 lib/open_fest/test/dummy/app/mailers/.keep create mode 100644 lib/open_fest/test/dummy/app/models/.keep create mode 100644 lib/open_fest/test/dummy/app/models/concerns/.keep create mode 100644 lib/open_fest/test/dummy/app/views/layouts/application.html.erb create mode 100755 lib/open_fest/test/dummy/bin/bundle create mode 100755 lib/open_fest/test/dummy/bin/rails create mode 100755 lib/open_fest/test/dummy/bin/rake create mode 100755 lib/open_fest/test/dummy/bin/setup create mode 100644 lib/open_fest/test/dummy/config.ru create mode 100644 lib/open_fest/test/dummy/config/application.rb create mode 100644 lib/open_fest/test/dummy/config/boot.rb create mode 100644 lib/open_fest/test/dummy/config/database.yml create mode 100644 lib/open_fest/test/dummy/config/environment.rb create mode 100644 lib/open_fest/test/dummy/config/environments/development.rb create mode 100644 lib/open_fest/test/dummy/config/environments/production.rb create mode 100644 lib/open_fest/test/dummy/config/environments/test.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/assets.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/backtrace_silencers.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/cookies_serializer.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/filter_parameter_logging.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/inflections.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/mime_types.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/session_store.rb create mode 100644 lib/open_fest/test/dummy/config/initializers/wrap_parameters.rb create mode 100644 lib/open_fest/test/dummy/config/locales/en.yml create mode 100644 lib/open_fest/test/dummy/config/routes.rb create mode 100644 lib/open_fest/test/dummy/config/secrets.yml create mode 100644 lib/open_fest/test/dummy/lib/assets/.keep create mode 100644 lib/open_fest/test/dummy/log/.keep create mode 100644 lib/open_fest/test/dummy/public/404.html create mode 100644 lib/open_fest/test/dummy/public/422.html create mode 100644 lib/open_fest/test/dummy/public/500.html create mode 100644 lib/open_fest/test/dummy/public/favicon.ico create mode 100644 lib/open_fest/test/integration/navigation_test.rb create mode 100644 lib/open_fest/test/open_fest_test.rb create mode 100644 lib/open_fest/test/test_helper.rb 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..9832a39 --- /dev/null +++ b/lib/open_fest/Gemfile.lock @@ -0,0 +1,109 @@ +PATH + remote: . + specs: + open_fest (0.0.1) + 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) + builder (3.2.2) + 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) + 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) + 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) + +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/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..8913b40 --- /dev/null +++ b/lib/open_fest/app/assets/javascripts/open_fest/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/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/open_fest/application.css b/lib/open_fest/app/assets/stylesheets/open_fest/application.css new file mode 100644 index 0000000..f9cd5b3 --- /dev/null +++ b/lib/open_fest/app/assets/stylesheets/open_fest/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/app/assets/stylesheets/open_fest/welcome.css b/lib/open_fest/app/assets/stylesheets/open_fest/welcome.css new file mode 100644 index 0000000..afad32d --- /dev/null +++ b/lib/open_fest/app/assets/stylesheets/open_fest/welcome.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ 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..a6f561f --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/application_controller.rb @@ -0,0 +1,4 @@ +module OpenFest + class ApplicationController < ActionController::Base + end +end diff --git a/lib/open_fest/app/controllers/open_fest/welcome_controller.rb b/lib/open_fest/app/controllers/open_fest/welcome_controller.rb new file mode 100644 index 0000000..a09aebc --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/welcome_controller.rb @@ -0,0 +1,8 @@ +require_dependency "open_fest/application_controller" + +module OpenFest + class WelcomeController < ApplicationController + def index + end + end +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/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..1cf6ea2 --- /dev/null +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -0,0 +1,14 @@ + + + + OpenFest + <%= stylesheet_link_tag "open_fest/application", media: "all" %> + <%= javascript_include_tag "open_fest/application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/lib/open_fest/app/views/open_fest/welcome/index.html.erb b/lib/open_fest/app/views/open_fest/welcome/index.html.erb new file mode 100644 index 0000000..e21282d --- /dev/null +++ b/lib/open_fest/app/views/open_fest/welcome/index.html.erb @@ -0,0 +1,2 @@ +

Welcome#index

+

Find me in app/views/open_fest/welcome/index.html.erb

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/routes.rb b/lib/open_fest/config/routes.rb new file mode 100644 index 0000000..22efc87 --- /dev/null +++ b/lib/open_fest/config/routes.rb @@ -0,0 +1,5 @@ +OpenFest::Engine.routes.draw do + get 'welcome/index' + + root to: 'welcome#index' +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..a6932d5 --- /dev/null +++ b/lib/open_fest/open_fest.gemspec @@ -0,0 +1,21 @@ +$:.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_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 From a4c324aeaf5fc933dee3ed3e9e348febd75eae32 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 16:44:42 +0300 Subject: [PATCH 02/36] Mount the OpenFest engine to the cfp subdomain --- Gemfile | 2 ++ Gemfile.lock | 7 +++++++ config/routes.rb | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6c652c1..3f7fd76 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,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' diff --git a/Gemfile.lock b/Gemfile.lock index 246eb54..4854ce4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,12 @@ GIT specs: yaml_db (0.2.3) +PATH + remote: lib/open_fest + specs: + open_fest (0.0.1) + rails (~> 4.2.3) + GEM remote: https://rubygems.org/ specs: @@ -360,6 +366,7 @@ DEPENDENCIES jquery-rails morrisjs-rails nested_form + open_fest! pg phony_rails pry-rails diff --git a/config/routes.rb b/config/routes.rb index dd4b99c..42b40f7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Rails.application.routes.draw do - devise_for :users + mount OpenFest::Engine, at: '/', constraints: {subdomain: 'cfp'} + + devise_for :users, path: 'management' namespace :management do root to: 'home#index' From 946da39c2337faa756ce38b09509c3d25c54873e Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 17:51:51 +0300 Subject: [PATCH 03/36] OpenFest: Introduce Devise --- Gemfile.lock | 1 + lib/open_fest/Gemfile.lock | 14 + .../users/confirmations_controller.rb | 9 + .../open_fest/users/passwords_controller.rb | 9 + .../users/registrations_controller.rb | 9 + .../open_fest/users/sessions_controller.rb | 9 + .../open_fest/users/unlocks_controller.rb | 9 + .../users/confirmations/new.html.erb | 16 ++ .../mailer/confirmation_instructions.html.erb | 5 + .../reset_password_instructions.html.erb | 8 + .../users/mailer/unlock_instructions.html.erb | 7 + .../open_fest/users/passwords/edit.html.erb | 25 ++ .../open_fest/users/passwords/new.html.erb | 16 ++ .../users/registrations/edit.html.erb | 39 +++ .../users/registrations/new.html.erb | 29 ++ .../open_fest/users/sessions/new.html.erb | 26 ++ .../open_fest/users/shared/_links.html.erb | 25 ++ .../open_fest/users/unlocks/new.html.erb | 16 ++ lib/open_fest/config/initializers/devise.rb | 265 ++++++++++++++++++ lib/open_fest/config/locales/devise.en.yml | 60 ++++ lib/open_fest/config/routes.rb | 2 + lib/open_fest/open_fest.gemspec | 1 + 22 files changed, 600 insertions(+) create mode 100644 lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb create mode 100644 lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb create mode 100644 lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb create mode 100644 lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb create mode 100644 lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb create mode 100644 lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/passwords/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/registrations/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/sessions/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/shared/_links.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb create mode 100644 lib/open_fest/config/initializers/devise.rb create mode 100644 lib/open_fest/config/locales/devise.en.yml diff --git a/Gemfile.lock b/Gemfile.lock index 4854ce4..da36697 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,7 @@ PATH remote: lib/open_fest specs: open_fest (0.0.1) + devise rails (~> 4.2.3) GEM diff --git a/lib/open_fest/Gemfile.lock b/lib/open_fest/Gemfile.lock index 9832a39..dc67f1b 100644 --- a/lib/open_fest/Gemfile.lock +++ b/lib/open_fest/Gemfile.lock @@ -2,6 +2,7 @@ PATH remote: . specs: open_fest (0.0.1) + devise rails (~> 4.2.3) GEM @@ -43,7 +44,15 @@ GEM 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) @@ -58,6 +67,7 @@ GEM 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) @@ -86,6 +96,8 @@ GEM 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) @@ -97,6 +109,8 @@ GEM thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) + warden (1.2.3) + rack (>= 1.0) PLATFORMS ruby 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..45a1046 --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb @@ -0,0 +1,9 @@ +class OpenFest::Users::ConfirmationsController < Devise::ConfirmationsController + # def new + # super + # end + + # def create + # super + # end +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..cd50b4c --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb @@ -0,0 +1,9 @@ +class OpenFest::Users::PasswordsController < Devise::PasswordsController + # def new + # super + # end + + # def create + # super + # 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..f7b5238 --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb @@ -0,0 +1,9 @@ +class OpenFest::Users::RegistrationsController < Devise::RegistrationsController + # def new + # super + # end + + # def create + # super + # 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..65563ed --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb @@ -0,0 +1,9 @@ +class OpenFest::Users::SessionsController < Devise::SessionsController + # def new + # super + # end + + # def create + # super + # end +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..5b74fd1 --- /dev/null +++ b/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb @@ -0,0 +1,9 @@ +class OpenFest::Users::UnlocksController < Devise::UnlocksController + # def new + # super + # end + + # def create + # super + # end +end diff --git a/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb b/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb new file mode 100644 index 0000000..826672f --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb @@ -0,0 +1,16 @@ +

Resend confirmation instructions

+ +<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> +
+ +
+ <%= f.submit "Resend confirmation instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..dc55f64 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @email %>!

+ +

You can confirm your account email through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password. You can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb b/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb new file mode 100644 index 0000000..0ee12dd --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb @@ -0,0 +1,25 @@ +

Change your password

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :reset_password_token %> + +
+ <%= f.label :password, "New password" %>
+ <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum) + <% end %>
+ <%= f.password_field :password, autofocus: true, autocomplete: "off" %> +
+ +
+ <%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.submit "Change my password" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb b/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb new file mode 100644 index 0000000..3d6d11a --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb @@ -0,0 +1,16 @@ +

Forgot your password?

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.submit "Send me reset password instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb b/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb new file mode 100644 index 0000000..3ea40f0 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb @@ -0,0 +1,39 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %> + +
+ <%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, autocomplete: "off" %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password, autocomplete: "off" %> +
+ +
+ <%= f.submit "Update" %> +
+<% end %> + +

Cancel my account

+ +

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

+ +<%= link_to "Back", :back %> diff --git a/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb b/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb new file mode 100644 index 0000000..5a238ce --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb @@ -0,0 +1,29 @@ +

Sign up

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.label :password %> + <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum) + <% end %>
+ <%= f.password_field :password, autocomplete: "off" %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.submit "Sign up" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb b/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb new file mode 100644 index 0000000..b261cfd --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb @@ -0,0 +1,26 @@ +

Log in

+ +<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.label :password %>
+ <%= f.password_field :password, autocomplete: "off" %> +
+ + <% if devise_mapping.rememberable? -%> +
+ <%= f.check_box :remember_me %> + <%= f.label :remember_me %> +
+ <% end -%> + +
+ <%= f.submit "Log in" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb b/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb new file mode 100644 index 0000000..cd795ad --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Log in", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%> +<% end -%> diff --git a/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb b/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb new file mode 100644 index 0000000..16586bc --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb @@ -0,0 +1,16 @@ +

Resend unlock instructions

+ +<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.submit "Resend unlock instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/lib/open_fest/config/initializers/devise.rb b/lib/open_fest/config/initializers/devise.rb new file mode 100644 index 0000000..f9ebd68 --- /dev/null +++ b/lib/open_fest/config/initializers/devise.rb @@ -0,0 +1,265 @@ +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # The secret key used by Devise. Devise uses this key to generate + # random tokens. Changing this key will render invalid all existing + # confirmation, reset password and unlock tokens in the database. + # Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key` + # by default. You can change it below and use your own secret key. + # config.secret_key = 'aaaa4bb727409da4106d861012eeef418ca029ed7854ea69d98dfbc6de62ea3263a6256b575c945ed8e42e40e46aeb58db8404ab7d7f1a7bd57a38a3ccb97db7' + + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class + # with default "from" parameter. + config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' + + # Configure the class responsible to send e-mails. + # config.mailer = 'Devise::Mailer' + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [:email] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [:email] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [:email] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:database]` will + # enable it only for database authentication. The supported strategies are: + # :database = Support basic authentication with authentication key + password + # config.http_authenticatable = false + + # If 401 status code should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. 'Application' by default. + # config.http_authentication_realm = 'Application' + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # particular strategies by setting this option. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing skip: :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # By default, Devise cleans up the CSRF token on authentication to + # avoid CSRF token fixation attacks. This means that, when using AJAX + # requests for sign in and sign up, you need to get a new CSRF token + # from the server. You can disable this option at your own risk. + # config.clean_up_csrf_token_on_authentication = true + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. Note that, for bcrypt (the default + # encryptor), the cost increases exponentially with the number of stretches (e.g. + # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). + config.stretches = Rails.env.test? ? 1 : 10 + + # Setup a pepper to generate the encrypted password. + # config.pepper = '98e5bdee2de6a4f376eefc0c90f7c3132ddbe769bea1b8ecd1065b5fb3c22b8aaf4cc7f7b2722264b7ac4ddaac6a89d9e99ec276f362db331b3d7247e7080733' + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming their account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming their account, + # access will be blocked just in the third day. Default is 0.days, meaning + # the user cannot access the website without confirming their account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + # config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed, new email is stored in + # unconfirmed_email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [:email] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # Invalidates all the remember me tokens when the user signs out. + config.expire_all_remember_me_on_sign_out = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # secure: true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. + config.password_length = 8..72 + + # Email regex used to validate email formats. It simply asserts that + # one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + # config.email_regexp = /\A[^@]+@[^@]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # If true, expires auth token on session timeout. + # config.expire_auth_token_on_timeout = false + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [:email] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # Warn on the last attempt before the account is locked. + # config.last_attempt_warning = true + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [:email] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # When set to false, does not sign a user in automatically after their password is + # reset. Defaults to true, so a user is signed in automatically after a reset. + # config.sign_in_after_reset_password = true + + # ==> Configuration for :encryptable + # Allow you to use another encryption algorithm besides bcrypt (default). You can use + # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, + # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) + # and :restful_authentication_sha1 (then you should set stretches to 10, and copy + # REST_AUTH_SITE_KEY to pepper). + # + # Require the `devise-encryptable` gem when using anything other than bcrypt + # config.encryptor = :sha512 + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ['*/*', :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(scope: :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: '/my_engine' + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using OmniAuth, Devise cannot automatically set OmniAuth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = '/my_engine/users/auth' +end 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/routes.rb b/lib/open_fest/config/routes.rb index 22efc87..45e1f8c 100644 --- a/lib/open_fest/config/routes.rb +++ b/lib/open_fest/config/routes.rb @@ -2,4 +2,6 @@ OpenFest::Engine.routes.draw do get 'welcome/index' root to: 'welcome#index' + + devise_for :users, module: 'open_fest/users' end diff --git a/lib/open_fest/open_fest.gemspec b/lib/open_fest/open_fest.gemspec index a6932d5..fd2b825 100644 --- a/lib/open_fest/open_fest.gemspec +++ b/lib/open_fest/open_fest.gemspec @@ -16,6 +16,7 @@ Gem::Specification.new do |s| s.test_files = Dir["test/**/*"] s.add_dependency "rails", "~> 4.2.3" + s.add_dependency "devise", ">= 0" s.add_development_dependency "sqlite3" end From 9c84e7e5d6e93e5140718b9679406116a5de881f Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 18:12:25 +0300 Subject: [PATCH 04/36] OpenFest: Remove unnecessary initializer --- lib/open_fest/config/initializers/devise.rb | 265 -------------------- 1 file changed, 265 deletions(-) delete mode 100644 lib/open_fest/config/initializers/devise.rb diff --git a/lib/open_fest/config/initializers/devise.rb b/lib/open_fest/config/initializers/devise.rb deleted file mode 100644 index f9ebd68..0000000 --- a/lib/open_fest/config/initializers/devise.rb +++ /dev/null @@ -1,265 +0,0 @@ -# Use this hook to configure devise mailer, warden hooks and so forth. -# Many of these configuration options can be set straight in your model. -Devise.setup do |config| - # The secret key used by Devise. Devise uses this key to generate - # random tokens. Changing this key will render invalid all existing - # confirmation, reset password and unlock tokens in the database. - # Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key` - # by default. You can change it below and use your own secret key. - # config.secret_key = 'aaaa4bb727409da4106d861012eeef418ca029ed7854ea69d98dfbc6de62ea3263a6256b575c945ed8e42e40e46aeb58db8404ab7d7f1a7bd57a38a3ccb97db7' - - # ==> Mailer Configuration - # Configure the e-mail address which will be shown in Devise::Mailer, - # note that it will be overwritten if you use your own mailer class - # with default "from" parameter. - config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' - - # Configure the class responsible to send e-mails. - # config.mailer = 'Devise::Mailer' - - # ==> ORM configuration - # Load and configure the ORM. Supports :active_record (default) and - # :mongoid (bson_ext recommended) by default. Other ORMs may be - # available as additional gems. - require 'devise/orm/active_record' - - # ==> Configuration for any authentication mechanism - # Configure which keys are used when authenticating a user. The default is - # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating a user, both parameters are required. Remember that those - # parameters are used only when authenticating and not when retrieving from - # session. If you need permissions, you should implement that in a before filter. - # You can also supply a hash where the value is a boolean determining whether - # or not authentication should be aborted when the value is not present. - # config.authentication_keys = [:email] - - # Configure parameters from the request object used for authentication. Each entry - # given should be a request method and it will automatically be passed to the - # find_for_authentication method and considered in your model lookup. For instance, - # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. - # The same considerations mentioned for authentication_keys also apply to request_keys. - # config.request_keys = [] - - # Configure which authentication keys should be case-insensitive. - # These keys will be downcased upon creating or modifying a user and when used - # to authenticate or find a user. Default is :email. - config.case_insensitive_keys = [:email] - - # Configure which authentication keys should have whitespace stripped. - # These keys will have whitespace before and after removed upon creating or - # modifying a user and when used to authenticate or find a user. Default is :email. - config.strip_whitespace_keys = [:email] - - # Tell if authentication through request.params is enabled. True by default. - # It can be set to an array that will enable params authentication only for the - # given strategies, for example, `config.params_authenticatable = [:database]` will - # enable it only for database (email + password) authentication. - # config.params_authenticatable = true - - # Tell if authentication through HTTP Auth is enabled. False by default. - # It can be set to an array that will enable http authentication only for the - # given strategies, for example, `config.http_authenticatable = [:database]` will - # enable it only for database authentication. The supported strategies are: - # :database = Support basic authentication with authentication key + password - # config.http_authenticatable = false - - # If 401 status code should be returned for AJAX requests. True by default. - # config.http_authenticatable_on_xhr = true - - # The realm used in Http Basic Authentication. 'Application' by default. - # config.http_authentication_realm = 'Application' - - # It will change confirmation, password recovery and other workflows - # to behave the same regardless if the e-mail provided was right or wrong. - # Does not affect registerable. - # config.paranoid = true - - # By default Devise will store the user in session. You can skip storage for - # particular strategies by setting this option. - # Notice that if you are skipping storage for all authentication paths, you - # may want to disable generating routes to Devise's sessions controller by - # passing skip: :sessions to `devise_for` in your config/routes.rb - config.skip_session_storage = [:http_auth] - - # By default, Devise cleans up the CSRF token on authentication to - # avoid CSRF token fixation attacks. This means that, when using AJAX - # requests for sign in and sign up, you need to get a new CSRF token - # from the server. You can disable this option at your own risk. - # config.clean_up_csrf_token_on_authentication = true - - # ==> Configuration for :database_authenticatable - # For bcrypt, this is the cost for hashing the password and defaults to 10. If - # using other encryptors, it sets how many times you want the password re-encrypted. - # - # Limiting the stretches to just one in testing will increase the performance of - # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use - # a value less than 10 in other environments. Note that, for bcrypt (the default - # encryptor), the cost increases exponentially with the number of stretches (e.g. - # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). - config.stretches = Rails.env.test? ? 1 : 10 - - # Setup a pepper to generate the encrypted password. - # config.pepper = '98e5bdee2de6a4f376eefc0c90f7c3132ddbe769bea1b8ecd1065b5fb3c22b8aaf4cc7f7b2722264b7ac4ddaac6a89d9e99ec276f362db331b3d7247e7080733' - - # ==> Configuration for :confirmable - # A period that the user is allowed to access the website even without - # confirming their account. For instance, if set to 2.days, the user will be - # able to access the website for two days without confirming their account, - # access will be blocked just in the third day. Default is 0.days, meaning - # the user cannot access the website without confirming their account. - # config.allow_unconfirmed_access_for = 2.days - - # A period that the user is allowed to confirm their account before their - # token becomes invalid. For example, if set to 3.days, the user can confirm - # their account within 3 days after the mail was sent, but on the fourth day - # their account can't be confirmed with the token any more. - # Default is nil, meaning there is no restriction on how long a user can take - # before confirming their account. - # config.confirm_within = 3.days - - # If true, requires any email changes to be confirmed (exactly the same way as - # initial account confirmation) to be applied. Requires additional unconfirmed_email - # db field (see migrations). Until confirmed, new email is stored in - # unconfirmed_email column, and copied to email column on successful confirmation. - config.reconfirmable = true - - # Defines which key will be used when confirming an account - # config.confirmation_keys = [:email] - - # ==> Configuration for :rememberable - # The time the user will be remembered without asking for credentials again. - # config.remember_for = 2.weeks - - # Invalidates all the remember me tokens when the user signs out. - config.expire_all_remember_me_on_sign_out = true - - # If true, extends the user's remember period when remembered via cookie. - # config.extend_remember_period = false - - # Options to be passed to the created cookie. For instance, you can set - # secure: true in order to force SSL only cookies. - # config.rememberable_options = {} - - # ==> Configuration for :validatable - # Range for password length. - config.password_length = 8..72 - - # Email regex used to validate email formats. It simply asserts that - # one (and only one) @ exists in the given string. This is mainly - # to give user feedback and not to assert the e-mail validity. - # config.email_regexp = /\A[^@]+@[^@]+\z/ - - # ==> Configuration for :timeoutable - # The time you want to timeout the user session without activity. After this - # time the user will be asked for credentials again. Default is 30 minutes. - # config.timeout_in = 30.minutes - - # If true, expires auth token on session timeout. - # config.expire_auth_token_on_timeout = false - - # ==> Configuration for :lockable - # Defines which strategy will be used to lock an account. - # :failed_attempts = Locks an account after a number of failed attempts to sign in. - # :none = No lock strategy. You should handle locking by yourself. - # config.lock_strategy = :failed_attempts - - # Defines which key will be used when locking and unlocking an account - # config.unlock_keys = [:email] - - # Defines which strategy will be used to unlock an account. - # :email = Sends an unlock link to the user email - # :time = Re-enables login after a certain amount of time (see :unlock_in below) - # :both = Enables both strategies - # :none = No unlock strategy. You should handle unlocking by yourself. - # config.unlock_strategy = :both - - # Number of authentication tries before locking an account if lock_strategy - # is failed attempts. - # config.maximum_attempts = 20 - - # Time interval to unlock the account if :time is enabled as unlock_strategy. - # config.unlock_in = 1.hour - - # Warn on the last attempt before the account is locked. - # config.last_attempt_warning = true - - # ==> Configuration for :recoverable - # - # Defines which key will be used when recovering the password for an account - # config.reset_password_keys = [:email] - - # Time interval you can reset your password with a reset password key. - # Don't put a too small interval or your users won't have the time to - # change their passwords. - config.reset_password_within = 6.hours - - # When set to false, does not sign a user in automatically after their password is - # reset. Defaults to true, so a user is signed in automatically after a reset. - # config.sign_in_after_reset_password = true - - # ==> Configuration for :encryptable - # Allow you to use another encryption algorithm besides bcrypt (default). You can use - # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, - # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) - # and :restful_authentication_sha1 (then you should set stretches to 10, and copy - # REST_AUTH_SITE_KEY to pepper). - # - # Require the `devise-encryptable` gem when using anything other than bcrypt - # config.encryptor = :sha512 - - # ==> Scopes configuration - # Turn scoped views on. Before rendering "sessions/new", it will first check for - # "users/sessions/new". It's turned off by default because it's slower if you - # are using only default views. - # config.scoped_views = false - - # Configure the default scope given to Warden. By default it's the first - # devise role declared in your routes (usually :user). - # config.default_scope = :user - - # Set this configuration to false if you want /users/sign_out to sign out - # only the current scope. By default, Devise signs out all scopes. - # config.sign_out_all_scopes = true - - # ==> Navigation configuration - # Lists the formats that should be treated as navigational. Formats like - # :html, should redirect to the sign in page when the user does not have - # access, but formats like :xml or :json, should return 401. - # - # If you have any extra navigational formats, like :iphone or :mobile, you - # should add them to the navigational formats lists. - # - # The "*/*" below is required to match Internet Explorer requests. - # config.navigational_formats = ['*/*', :html] - - # The default HTTP method used to sign out a resource. Default is :delete. - config.sign_out_via = :delete - - # ==> OmniAuth - # Add a new OmniAuth provider. Check the wiki for more information on setting - # up on your models and hooks. - # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' - - # ==> Warden configuration - # If you want to use other strategies, that are not supported by Devise, or - # change the failure app, you can configure them inside the config.warden block. - # - # config.warden do |manager| - # manager.intercept_401 = false - # manager.default_strategies(scope: :user).unshift :some_external_strategy - # end - - # ==> Mountable engine configurations - # When using Devise inside an engine, let's call it `MyEngine`, and this engine - # is mountable, there are some extra configurations to be taken into account. - # The following options are available, assuming the engine is mounted as: - # - # mount MyEngine, at: '/my_engine' - # - # The router that invoked `devise_for`, in the example above, would be: - # config.router_name = :my_engine - # - # When using OmniAuth, Devise cannot automatically set OmniAuth path, - # so you need to do it manually. For the users scope, it would be: - # config.omniauth_path_prefix = '/my_engine/users/auth' -end From d63cbe76583c357f4e25d61cdf6ad20e27ce95c2 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 18:12:55 +0300 Subject: [PATCH 05/36] OpenFest: Remove unnecessary css's --- .../assets/stylesheets/open_fest/application.css | 15 --------------- .../app/assets/stylesheets/open_fest/welcome.css | 4 ---- 2 files changed, 19 deletions(-) delete mode 100644 lib/open_fest/app/assets/stylesheets/open_fest/application.css delete mode 100644 lib/open_fest/app/assets/stylesheets/open_fest/welcome.css diff --git a/lib/open_fest/app/assets/stylesheets/open_fest/application.css b/lib/open_fest/app/assets/stylesheets/open_fest/application.css deleted file mode 100644 index f9cd5b3..0000000 --- a/lib/open_fest/app/assets/stylesheets/open_fest/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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/app/assets/stylesheets/open_fest/welcome.css b/lib/open_fest/app/assets/stylesheets/open_fest/welcome.css deleted file mode 100644 index afad32d..0000000 --- a/lib/open_fest/app/assets/stylesheets/open_fest/welcome.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Place all the styles related to the matching controller here. - They will automatically be included in application.css. -*/ From 5fd1a1b9828f25412c391d4ca67600920697623d Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 18:13:25 +0300 Subject: [PATCH 06/36] OpenFest: Introduce initfest style sheet --- .gitmodules | 3 +++ lib/open_fest/app/assets/stylesheets/initfest | 1 + .../app/assets/stylesheets/open_fest/application.scss | 1 + lib/open_fest/app/vendor/initfest | 1 + 4 files changed, 6 insertions(+) create mode 100644 .gitmodules create mode 120000 lib/open_fest/app/assets/stylesheets/initfest create mode 100644 lib/open_fest/app/assets/stylesheets/open_fest/application.scss create mode 160000 lib/open_fest/app/vendor/initfest 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/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/application.scss b/lib/open_fest/app/assets/stylesheets/open_fest/application.scss new file mode 100644 index 0000000..5815826 --- /dev/null +++ b/lib/open_fest/app/assets/stylesheets/open_fest/application.scss @@ -0,0 +1 @@ +@import 'initfest/styles'; \ No newline at end of file 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 From f08259cba890b734759fbf3d9310699d4658c6db Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 18:26:03 +0300 Subject: [PATCH 07/36] OpenFest: Add missing assets --- Gemfile.lock | 1 + lib/open_fest/app/assets/images/img | 1 + .../app/assets/stylesheets/open_fest/application.scss | 5 ++++- lib/open_fest/open_fest.gemspec | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) create mode 120000 lib/open_fest/app/assets/images/img diff --git a/Gemfile.lock b/Gemfile.lock index da36697..49c260e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,6 +10,7 @@ PATH specs: open_fest (0.0.1) devise + font-awesome-sass rails (~> 4.2.3) GEM 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/stylesheets/open_fest/application.scss b/lib/open_fest/app/assets/stylesheets/open_fest/application.scss index 5815826..1340a6e 100644 --- a/lib/open_fest/app/assets/stylesheets/open_fest/application.scss +++ b/lib/open_fest/app/assets/stylesheets/open_fest/application.scss @@ -1 +1,4 @@ -@import 'initfest/styles'; \ No newline at end of file +@import "font-awesome-sprockets"; +@import "font-awesome"; + +@import 'initfest/styles'; diff --git a/lib/open_fest/open_fest.gemspec b/lib/open_fest/open_fest.gemspec index fd2b825..59c0956 100644 --- a/lib/open_fest/open_fest.gemspec +++ b/lib/open_fest/open_fest.gemspec @@ -17,6 +17,7 @@ Gem::Specification.new do |s| 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 From ab2cb8ca73155443a314238af45352dca34d101a Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 18:32:29 +0300 Subject: [PATCH 08/36] OpenFest: Set correct layout for Devise controllers --- .../open_fest/users/confirmations_controller.rb | 8 +------- .../controllers/open_fest/users/passwords_controller.rb | 8 +------- .../open_fest/users/registrations_controller.rb | 8 +------- .../controllers/open_fest/users/sessions_controller.rb | 8 +------- .../app/controllers/open_fest/users/unlocks_controller.rb | 8 +------- 5 files changed, 5 insertions(+), 35 deletions(-) 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 index 45a1046..1711d83 100644 --- a/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb @@ -1,9 +1,3 @@ class OpenFest::Users::ConfirmationsController < Devise::ConfirmationsController - # def new - # super - # end - - # def create - # super - # end + layout 'open_fest/application' 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 index cd50b4c..0494492 100644 --- a/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb @@ -1,9 +1,3 @@ class OpenFest::Users::PasswordsController < Devise::PasswordsController - # def new - # super - # end - - # def create - # super - # end + layout 'open_fest/application' 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 index f7b5238..8abb715 100644 --- a/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb @@ -1,9 +1,3 @@ class OpenFest::Users::RegistrationsController < Devise::RegistrationsController - # def new - # super - # end - - # def create - # super - # end + layout 'open_fest/application' 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 index 65563ed..71073fc 100644 --- a/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb @@ -1,9 +1,3 @@ class OpenFest::Users::SessionsController < Devise::SessionsController - # def new - # super - # end - - # def create - # super - # end + layout 'open_fest/application' 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 index 5b74fd1..fc1d2f9 100644 --- a/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb @@ -1,9 +1,3 @@ class OpenFest::Users::UnlocksController < Devise::UnlocksController - # def new - # super - # end - - # def create - # super - # end + layout 'open_fest/application' end From 0deb17e00b1b9edb2c40eaf4eaed98e4675fb471 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 20:46:15 +0300 Subject: [PATCH 09/36] OpenFest: Add form styling --- .../assets/stylesheets/open_fest/_forms.scss | 140 ++++++++++++++++++ .../stylesheets/open_fest/application.scss | 1 + 2 files changed, 141 insertions(+) create mode 100644 lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss 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..f5645af --- /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: 50em; + } + + 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 index 1340a6e..604c31c 100644 --- a/lib/open_fest/app/assets/stylesheets/open_fest/application.scss +++ b/lib/open_fest/app/assets/stylesheets/open_fest/application.scss @@ -2,3 +2,4 @@ @import "font-awesome"; @import 'initfest/styles'; +@import 'forms'; From 33d126071340ce21dbce5e4eb08a4739c20c2566 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 20:50:49 +0300 Subject: [PATCH 10/36] OpenFest: Add Devise views from v1 --- .../users/confirmations/new.html.erb | 16 -------- .../open_fest/users/confirmations/new.slim | 15 +++++++ .../mailer/confirmation_instructions.html.erb | 5 --- .../mailer/confirmation_instructions.text.erb | 5 +++ .../reset_password_instructions.html.erb | 8 ---- .../reset_password_instructions.text.erb | 8 ++++ .../users/mailer/unlock_instructions.html.erb | 7 ---- .../users/mailer/unlock_instructions.text.erb | 7 ++++ .../open_fest/users/passwords/edit.html.erb | 25 ------------ .../views/open_fest/users/passwords/edit.slim | 18 +++++++++ .../open_fest/users/passwords/new.html.erb | 16 -------- .../views/open_fest/users/passwords/new.slim | 14 +++++++ .../users/registrations/edit.html.erb | 39 ------------------- .../open_fest/users/registrations/edit.slim | 31 +++++++++++++++ .../users/registrations/new.html.erb | 29 -------------- .../open_fest/users/registrations/new.slim | 16 ++++++++ .../open_fest/users/sessions/new.html.erb | 26 ------------- .../views/open_fest/users/sessions/new.slim | 14 +++++++ .../open_fest/users/shared/_links.html.erb | 25 ------------ .../views/open_fest/users/shared/_links.slim | 23 +++++++++++ .../open_fest/users/unlocks/new.html.erb | 16 -------- .../views/open_fest/users/unlocks/new.slim | 15 +++++++ 22 files changed, 166 insertions(+), 212 deletions(-) delete mode 100644 lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/confirmations/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/passwords/edit.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/passwords/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/passwords/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/registrations/edit.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/registrations/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/registrations/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/sessions/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/sessions/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/shared/_links.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/shared/_links.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/unlocks/new.slim diff --git a/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb b/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb deleted file mode 100644 index 826672f..0000000 --- a/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Resend confirmation instructions

- -<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> -
- -
- <%= f.submit "Resend confirmation instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> 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..72c8dca --- /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, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) 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/mailer/confirmation_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb deleted file mode 100644 index dc55f64..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Welcome <%= @email %>!

- -

You can confirm your account email through the link below:

- -

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb new file mode 100644 index 0000000..b80b172 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb @@ -0,0 +1,5 @@ +<%= t(:welcome, name: @email) %>! + +<%= t(:confirm_by_clicking) %> + +<%= confirmation_url(@resource, confirmation_token: @token) %> diff --git a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb deleted file mode 100644 index f667dc1..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Someone has requested a link to change your password. You can do this through the link below.

- -

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

- -

If you didn't request this, please ignore this email.

-

Your password won't change until you access the link above and create a new one.

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb new file mode 100644 index 0000000..f0089f8 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb @@ -0,0 +1,8 @@ +<%= t(:hello, name: @resource.email) %>! + +<%= t(:someone_requested_passreset) %> + +<%= edit_password_url(@resource, reset_password_token: @token) %> + +<%= t(:do_not_want_pass_reset1) %> +<%= t(:do_not_want_pass_reset2) %> diff --git a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb deleted file mode 100644 index 41e148b..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

- -

Click the link below to unlock your account:

- -

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb new file mode 100644 index 0000000..4d2a69b --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb @@ -0,0 +1,7 @@ +<%= t(:hello, name: @resource.email) %>! + +<%= t(:account_locked) %> + +<%= t(:click_to_unlock) %> + +<%= unlock_url(@resource, unlock_token: @token) %> diff --git a/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb b/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb deleted file mode 100644 index 0ee12dd..0000000 --- a/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -

Change your password

- -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> - <%= f.hidden_field :reset_password_token %> - -
- <%= f.label :password, "New password" %>
- <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autofocus: true, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation, "Confirm new password" %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.submit "Change my password" %> -
-<% end %> - -<%= 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..f39bcb7 --- /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, as: resource_name, url: password_path(resource_name), 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.html.erb b/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb deleted file mode 100644 index 3d6d11a..0000000 --- a/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Forgot your password?

- -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Send me reset password instructions" %> -
-<% end %> - -<%= 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..7e1f90c --- /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, as: resource_name, url: password_path(resource_name), html: { method: :post }) 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.html.erb b/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb deleted file mode 100644 index 3ea40f0..0000000 --- a/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -

Edit <%= resource_name.to_s.humanize %>

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- - <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
- <% end %> - -
- <%= f.label :password %> (leave blank if you don't want to change it)
- <%= f.password_field :password, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.label :current_password %> (we need your current password to confirm your changes)
- <%= f.password_field :current_password, autocomplete: "off" %> -
- -
- <%= f.submit "Update" %> -
-<% end %> - -

Cancel my account

- -

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

- -<%= link_to "Back", :back %> 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..7158882 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -0,0 +1,31 @@ +- content_for(:title) { ":: #{t :edit_speaker_profile}" } + += simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f| + .form_inputs + h2.entry-title = t :speaker_profile + = f.error_notification + = f.simple_fields_for :speaker_profile do |ff| + = ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb}, required: true + = ff.input :first_name, autofocus: true + = ff.input :last_name + = ff.input :public_email + = ff.input :organisation + = ff.input :github + = ff.input :twitter + = ff.input :mobile_phone, input_html: {value: resource.speaker_profile.mobile_phone.try(:phony_formatted, format: :international)} + = ff.input :biography + + .form-inputs + h3.entry-title = t :login_data + = f.input :email, 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.html.erb b/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb deleted file mode 100644 index 5a238ce..0000000 --- a/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

Sign up

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.label :password %> - <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.submit "Sign up" %> -
-<% end %> - -<%= render "devise/shared/links" %> 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..2fe8223 --- /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, as: resource_name, url: registration_path(resource_name)) 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.html.erb b/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb deleted file mode 100644 index b261cfd..0000000 --- a/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -

Log in

- -<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.label :password %>
- <%= f.password_field :password, autocomplete: "off" %> -
- - <% if devise_mapping.rememberable? -%> -
- <%= f.check_box :remember_me %> - <%= f.label :remember_me %> -
- <% end -%> - -
- <%= f.submit "Log in" %> -
-<% end %> - -<%= 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..b53c4ae --- /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: resource_name, url: session_path(resource_name), ) 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.html.erb b/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb deleted file mode 100644 index cd795ad..0000000 --- a/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<%- if controller_name != 'sessions' %> - <%= link_to "Log in", new_session_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to "Sign up", new_registration_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> - <%= link_to "Forgot your password?", new_password_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> - <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.omniauthable? %> - <%- resource_class.omniauth_providers.each do |provider| %> - <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
- <% end -%> -<% end -%> 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..6f66289 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/shared/_links.slim @@ -0,0 +1,23 @@ +- if controller_name != 'sessions' + = link_to t(:enter), new_session_path(resource_name) + br + +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to t(:registration), new_registration_path(resource_name) + br + +- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' + = link_to t(:lostpass), new_password_path(resource_name) + br + +- if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to t(:did_not_get_confirmation), new_confirmation_path(resource_name) + br + +- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' + = link_to t(:did_not_get_unlock), new_unlock_path(resource_name) + br + +- if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to t(:login_with, with: @provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) diff --git a/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb b/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb deleted file mode 100644 index 16586bc..0000000 --- a/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Resend unlock instructions

- -<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Resend unlock instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/unlocks/new.slim b/lib/open_fest/app/views/open_fest/users/unlocks/new.slim new file mode 100644 index 0000000..0f91453 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/unlocks/new.slim @@ -0,0 +1,15 @@ +- content_for(:title) { ":: #{t :resend_unlock_instructions_title}" } + +h2 =t :resend_unlock_instructions_title + += simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + = f.full_error :unlock_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' From 95ae825096d6ce5ba169cdbdceed482cd91be055 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 20:51:34 +0300 Subject: [PATCH 11/36] OpenFest: Add view translations from v1 --- lib/open_fest/config/locales/views.bg.yml | 74 +++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib/open_fest/config/locales/views.bg.yml 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..d60d599 --- /dev/null +++ b/lib/open_fest/config/locales/views.bg.yml @@ -0,0 +1,74 @@ +bg: + home_title: "%{conference} - зов за лектори" + what_we_ask: 'Бихме искали да получим предложенията Ви за лекции и уъркшопи, принадлежащи към следните категории до 30 септември 2014г.:' + license_notice: 'Имайте предвид, че презентациите ви впоследствие ще бъдат публикувани с лиценз CC-BY-ND (Creative Commons – Attribution – No derivatives).' + submit_lecture: Предложи лекция + submit_workshop: Предложи уъркшоп + 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: "Уъркшопът беше потвърден успешно" \ No newline at end of file From 2fe1fd2f098d180b2028eb4f69e3d1c95d54e6f2 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 21:08:29 +0300 Subject: [PATCH 12/36] OpenFest: Implement WelcomeController#index view --- .../open_fest/application_controller.rb | 8 ++++++ .../layouts/open_fest/application.html.erb | 25 ++++++++++++------- .../views/open_fest/welcome/_event_type.slim | 1 + .../app/views/open_fest/welcome/_track.slim | 6 +++++ .../views/open_fest/welcome/index.html.erb | 2 -- .../app/views/open_fest/welcome/index.slim | 14 +++++++++++ lib/open_fest/config/locales/views.bg.yml | 3 +++ 7 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 lib/open_fest/app/views/open_fest/welcome/_event_type.slim create mode 100644 lib/open_fest/app/views/open_fest/welcome/_track.slim delete mode 100644 lib/open_fest/app/views/open_fest/welcome/index.html.erb create mode 100644 lib/open_fest/app/views/open_fest/welcome/index.slim diff --git a/lib/open_fest/app/controllers/open_fest/application_controller.rb b/lib/open_fest/app/controllers/open_fest/application_controller.rb index a6f561f..a8c4551 100644 --- a/lib/open_fest/app/controllers/open_fest/application_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/application_controller.rb @@ -1,4 +1,12 @@ module OpenFest class ApplicationController < ActionController::Base + before_action :set_current_conference + + private + + #TODO: Make this display a nice 404 message when the conference is not found + def set_current_conference + @current_conference ||= Conference.find(1) + end end end 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 index 1cf6ea2..162267d 100644 --- a/lib/open_fest/app/views/layouts/open_fest/application.html.erb +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -1,14 +1,21 @@ - - OpenFest - <%= stylesheet_link_tag "open_fest/application", media: "all" %> - <%= javascript_include_tag "open_fest/application" %> - <%= csrf_meta_tags %> - - + + + <% if content_for? :title %> + <%= yield :title %> | + <% end %> + <%= @current_conference.try :title %> + -<%= yield %> + <%= stylesheet_link_tag "open_fest/application", media: "all" %> + <%= javascript_include_tag "open_fest/application" %> + <%= csrf_meta_tags %> + + - +
+ <%= yield %> +
+ diff --git a/lib/open_fest/app/views/open_fest/welcome/_event_type.slim b/lib/open_fest/app/views/open_fest/welcome/_event_type.slim new file mode 100644 index 0000000..e8646be --- /dev/null +++ b/lib/open_fest/app/views/open_fest/welcome/_event_type.slim @@ -0,0 +1 @@ +=> link_to t('views.welcome.submit_event', event_type: event_type.name.mb_chars.downcase), '#', class: 'btn-link btn-link-large' diff --git a/lib/open_fest/app/views/open_fest/welcome/_track.slim b/lib/open_fest/app/views/open_fest/welcome/_track.slim new file mode 100644 index 0000000..1818ca1 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/welcome/_track.slim @@ -0,0 +1,6 @@ +li + p + strong + = track.name + span<> – + = track.description diff --git a/lib/open_fest/app/views/open_fest/welcome/index.html.erb b/lib/open_fest/app/views/open_fest/welcome/index.html.erb deleted file mode 100644 index e21282d..0000000 --- a/lib/open_fest/app/views/open_fest/welcome/index.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Welcome#index

-

Find me in app/views/open_fest/welcome/index.html.erb

diff --git a/lib/open_fest/app/views/open_fest/welcome/index.slim b/lib/open_fest/app/views/open_fest/welcome/index.slim new file mode 100644 index 0000000..ead199d --- /dev/null +++ b/lib/open_fest/app/views/open_fest/welcome/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/config/locales/views.bg.yml b/lib/open_fest/config/locales/views.bg.yml index d60d599..0fae951 100644 --- a/lib/open_fest/config/locales/views.bg.yml +++ b/lib/open_fest/config/locales/views.bg.yml @@ -1,4 +1,7 @@ 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).' From 172fcc06a29167d28a372ec2cf24547dcf4e2d7a Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 23:21:54 +0300 Subject: [PATCH 13/36] OpenFest: Add a basic navigation --- .../layouts/open_fest/application.html.erb | 2 +- .../app/views/open_fest/shared/_nav.slim | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 lib/open_fest/app/views/open_fest/shared/_nav.slim 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 index 162267d..ae0fccb 100644 --- a/lib/open_fest/app/views/layouts/open_fest/application.html.erb +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -13,7 +13,7 @@ <%= csrf_meta_tags %> - + <%= render 'open_fest/shared/nav' %>
<%= yield %>
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..7f05161 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/shared/_nav.slim @@ -0,0 +1,25 @@ +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="#" = 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 + a href="#" hreflang="en" + 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" From 8f7185810e0068f8b0125b7a480a07f561a534b0 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 23:22:08 +0300 Subject: [PATCH 14/36] OpenFest: Add a viewport meta tag --- lib/open_fest/app/views/layouts/open_fest/application.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index ae0fccb..df30c48 100644 --- a/lib/open_fest/app/views/layouts/open_fest/application.html.erb +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -7,7 +7,7 @@ <% end %> <%= @current_conference.try :title %> - + <%= stylesheet_link_tag "open_fest/application", media: "all" %> <%= javascript_include_tag "open_fest/application" %> <%= csrf_meta_tags %> From c4db0ff9201cc34c0588027b32b6bd9f0998c72d Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 20 Jul 2015 00:35:53 +0300 Subject: [PATCH 15/36] Extract current_conference assignment in a concern --- app/controllers/application_controller.rb | 6 +---- .../concerns/current_conference_assigning.rb | 26 +++++++++++++++++++ .../management/management_controller.rb | 18 ------------- 3 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 app/controllers/concerns/current_conference_assigning.rb 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..c2a6f2a --- /dev/null +++ b/app/controllers/concerns/current_conference_assigning.rb @@ -0,0 +1,26 @@ +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 and params[:conference_id].present? + @current_conference = Conference.find(params[:conference_id]) + 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 From 5d5a5a1cbf9948962e5558cb020cdf3c2e35af5c Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 20 Jul 2015 02:08:20 +0300 Subject: [PATCH 16/36] OpenFest: Make use of the current_conference helper --- config/routes.rb | 2 +- .../controllers/open_fest/application_controller.rb | 9 ++------- .../app/views/layouts/open_fest/application.html.erb | 2 +- .../views/open_fest/users/registrations/edit.slim | 12 ++++++------ lib/open_fest/app/views/open_fest/welcome/index.slim | 10 +++++----- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 42b40f7..64e9a8c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - mount OpenFest::Engine, at: '/', constraints: {subdomain: 'cfp'} + mount OpenFest::Engine, at: '/', constraints: {subdomain: 'cfp'}, conference_id: 1 devise_for :users, path: 'management' diff --git a/lib/open_fest/app/controllers/open_fest/application_controller.rb b/lib/open_fest/app/controllers/open_fest/application_controller.rb index a8c4551..1f509ad 100644 --- a/lib/open_fest/app/controllers/open_fest/application_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/application_controller.rb @@ -1,12 +1,7 @@ module OpenFest class ApplicationController < ActionController::Base - before_action :set_current_conference + include ::CurrentConferenceAssigning - private - - #TODO: Make this display a nice 404 message when the conference is not found - def set_current_conference - @current_conference ||= Conference.find(1) - end + before_filter :require_current_conference! end end 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 index df30c48..9efb4fc 100644 --- a/lib/open_fest/app/views/layouts/open_fest/application.html.erb +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -5,7 +5,7 @@ <% if content_for? :title %> <%= yield :title %> | <% end %> - <%= @current_conference.try :title %> + <%= current_conference.try :title %> <%= stylesheet_link_tag "open_fest/application", media: "all" %> 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 index 7158882..4653e82 100644 --- a/lib/open_fest/app/views/open_fest/users/registrations/edit.slim +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -1,18 +1,18 @@ -- content_for(:title) { ":: #{t :edit_speaker_profile}" } +- content_for(:title) { t :edit_speaker_profile } -= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f| += simple_form_for(resource, wrapper: :default, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f| .form_inputs - h2.entry-title = t :speaker_profile + h2.entry-title = t :personal_profile = f.error_notification - = f.simple_fields_for :speaker_profile do |ff| - = ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb}, required: true + = f.simple_fields_for :personal_profile do |ff| + = ff.input :picture, as: :file, required: true = ff.input :first_name, autofocus: true = ff.input :last_name = ff.input :public_email = ff.input :organisation = ff.input :github = ff.input :twitter - = ff.input :mobile_phone, input_html: {value: resource.speaker_profile.mobile_phone.try(:phony_formatted, format: :international)} + = ff.input :mobile_phone, input_html: {value: resource.personal_profile(current_conference).mobile_phone.try(:phony_formatted, format: :international)} = ff.input :biography .form-inputs diff --git a/lib/open_fest/app/views/open_fest/welcome/index.slim b/lib/open_fest/app/views/open_fest/welcome/index.slim index ead199d..a3222a3 100644 --- a/lib/open_fest/app/views/open_fest/welcome/index.slim +++ b/lib/open_fest/app/views/open_fest/welcome/index.slim @@ -1,14 +1,14 @@ -h1.entry-title = t :home_title, conference: @current_conference.title +h1.entry-title = t :home_title, conference: current_conference.title -= simple_format @current_conference.description += simple_format current_conference.description p = t :what_we_ask ul - = render partial: 'track', collection: @current_conference.tracks + = render partial: 'track', collection: current_conference.tracks p = t :license_notice -- if @current_conference.call_for_participation.in_progress? +- if current_conference.call_for_participation.in_progress? .centered.large - = render partial: 'event_type', collection: @current_conference.event_types + = render partial: 'event_type', collection: current_conference.event_types From fdbba323782e60c99becef59a363538f95e9f4a9 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 20 Jul 2015 02:18:31 +0300 Subject: [PATCH 17/36] OpenFest: Introduce a DeviseController mixin --- .../concerns/open_fest/users/devise_controller.rb | 8 ++++++++ .../open_fest/users/confirmations_controller.rb | 2 +- .../controllers/open_fest/users/passwords_controller.rb | 2 +- .../open_fest/users/registrations_controller.rb | 2 +- .../controllers/open_fest/users/sessions_controller.rb | 2 +- .../app/controllers/open_fest/users/unlocks_controller.rb | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 lib/open_fest/app/controllers/concerns/open_fest/users/devise_controller.rb 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..f007868 --- /dev/null +++ b/lib/open_fest/app/controllers/concerns/open_fest/users/devise_controller.rb @@ -0,0 +1,8 @@ +module OpenFest::Users::DeviseController + extend ActiveSupport::Concern + + included do + before_filter :require_current_conference! + layout 'open_fest/application' + 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 index 1711d83..04ea83d 100644 --- a/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/confirmations_controller.rb @@ -1,3 +1,3 @@ class OpenFest::Users::ConfirmationsController < Devise::ConfirmationsController - layout 'open_fest/application' + 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 index 0494492..be5e06e 100644 --- a/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb @@ -1,3 +1,3 @@ class OpenFest::Users::PasswordsController < Devise::PasswordsController - layout 'open_fest/application' + include OpenFest::Users::DeviseController 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 index 8abb715..697875e 100644 --- a/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb @@ -1,3 +1,3 @@ class OpenFest::Users::RegistrationsController < Devise::RegistrationsController - layout 'open_fest/application' + include OpenFest::Users::DeviseController 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 index 71073fc..98e6f1f 100644 --- a/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/sessions_controller.rb @@ -1,3 +1,3 @@ class OpenFest::Users::SessionsController < Devise::SessionsController - layout 'open_fest/application' + 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 index fc1d2f9..f6175d9 100644 --- a/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/unlocks_controller.rb @@ -1,3 +1,3 @@ class OpenFest::Users::UnlocksController < Devise::UnlocksController - layout 'open_fest/application' + include OpenFest::Users::DeviseController end From ce614223215fb212731a569428722dafb48a3b6c Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 5 Aug 2015 14:39:39 +0300 Subject: [PATCH 18/36] OpenFest: Devise stint --- app/models/user.rb | 19 ++++++++-- config/routes.rb | 3 +- .../open_fest/users/devise_controller.rb | 4 +++ .../users/registrations_controller.rb | 35 +++++++++++++++++++ .../open_fest/users/registrations/edit.slim | 6 ++-- spec/factories/personal_profiles.rb | 15 ++++++++ spec/models/user_spec.rb | 35 +++++++++++++++++++ 7 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 spec/factories/personal_profiles.rb diff --git a/app/models/user.rb b/app/models/user.rb index 69831b6..50e058a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,11 +8,26 @@ class User < ActiveRecord::Base has_many :lectures has_many :workshops has_many :events + has_one :personal_profile, Proc.new { |user, conference| user.personal_profiles } default_scope { order id: :desc } - def personal_profile(conference) - personal_profiles.find_by(conference_id: conference.id) + def duplicate_last_personal_profile(conference) + if personal_profiles.any? + new_personal_profile = personal_profiles.last.dup + new_personal_profile.conference = conference + new_personal_profile + end + end + + def find_or_initialize_personal_profile(conference) + if personal_profile(conference).present? + personal_profile(conference) + elsif personal_profiles.any? + duplicate_last_personal_profile(conference) + else + personal_profiles.build(conference: conference) + end end def toggle_admin! diff --git a/config/routes.rb b/config/routes.rb index 64e9a8c..1e7a448 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,9 @@ Rails.application.routes.draw do mount OpenFest::Engine, at: '/', constraints: {subdomain: 'cfp'}, conference_id: 1 - devise_for :users, path: 'management' - namespace :management do root to: 'home#index' + devise_for :users resources :conferences do resources :events 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 index f007868..0b252fd 100644 --- 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 @@ -5,4 +5,8 @@ module OpenFest::Users::DeviseController 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/users/registrations_controller.rb b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb index 697875e..85b97ed 100644 --- a/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb @@ -1,3 +1,38 @@ class OpenFest::Users::RegistrationsController < Devise::RegistrationsController include OpenFest::Users::DeviseController + + def edit + resource.find_or_initialize_personal_profile(current_conference) + end + + def update + @user = User.find(current_user.id) + + successfully_updated = if needs_password?(@user, params) + @user.update_with_password(devise_parameter_sanitizer.sanitize(:account_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(devise_parameter_sanitizer.sanitize(:account_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 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/views/open_fest/users/registrations/edit.slim b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim index 4653e82..4a654e6 100644 --- a/lib/open_fest/app/views/open_fest/users/registrations/edit.slim +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -1,10 +1,10 @@ - content_for(:title) { t :edit_speaker_profile } -= simple_form_for(resource, wrapper: :default, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f| += simple_form_for(resource, wrapper: :default, as: resource_name, url: open_fest.user_registration_path, html: { method: :put, multipart: true }) do |f| .form_inputs h2.entry-title = t :personal_profile = f.error_notification - = f.simple_fields_for :personal_profile do |ff| + = f.simple_fields_for :personal_profile, resource.personal_profile(current_conference) do |ff| = ff.input :picture, as: :file, required: true = ff.input :first_name, autofocus: true = ff.input :last_name @@ -12,7 +12,7 @@ = ff.input :organisation = ff.input :github = ff.input :twitter - = ff.input :mobile_phone, input_html: {value: resource.personal_profile(current_conference).mobile_phone.try(:phony_formatted, format: :international)} + = ff.input :mobile_phone, input_html: {value: ff.object.mobile_phone.try(:phony_formatted, format: :international)} = ff.input :biography .form-inputs diff --git a/spec/factories/personal_profiles.rb b/spec/factories/personal_profiles.rb new file mode 100644 index 0000000..10b66e8 --- /dev/null +++ b/spec/factories/personal_profiles.rb @@ -0,0 +1,15 @@ +FactoryGirl.define do + factory :personal_profile do + 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..cbae24c 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -28,4 +28,39 @@ RSpec.describe User do expect(user.personal_profile(old_conference)).to eq old_profile expect(user.personal_profile(new_conference)).to eq new_profile end + + describe '#find_or_initialize_personal_profile' do + context 'when the user has a personal profile for the specified conference' do + it 'returns the existing personal profile' do + user = create :user + conference = create :conference + personal_profile = create :personal_profile, user: user, conference: conference + + expect(user.find_or_initialize_personal_profile(conference)).to eq personal_profile + end + end + + context 'when the user has a personal profile for a previous conference' do + it 'returns a duplicate of the old profile' do + user = create :user + old_conference = create :conference + conference = create :conference + personal_profile = create :personal_profile, user: user, conference: old_conference + + expect(user.find_or_initialize_personal_profile(conference).public_email).to be_present + expect(user.find_or_initialize_personal_profile(conference).public_email).to eq personal_profile.public_email + expect(user.find_or_initialize_personal_profile(conference)).to be_new_record + end + end + + context 'when the user has no personal profiles' do + it 'returns a new personal profile' do + user = create :user + conference = create :conference + + expect(user.find_or_initialize_personal_profile(conference)).to be_new_record + expect(user.find_or_initialize_personal_profile(conference).conference).to eq conference + end + end + end end From 9d53e49fb474b0540fa1a43edf13556645a3282b Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 5 Aug 2015 14:54:17 +0300 Subject: [PATCH 19/36] OpenFest: Fix registration and login process --- app/views/devise/shared/_links.html.slim | 16 ++++------------ .../assets/javascripts/open_fest/application.js | 2 ++ .../views/layouts/open_fest/application.html.erb | 1 + .../views/open_fest/shared/_flash_messages.slim | 3 +++ .../open_fest/users/registrations/edit.slim | 2 +- .../views/open_fest/users/registrations/new.slim | 2 +- .../app/views/open_fest/users/sessions/new.slim | 2 +- .../app/views/open_fest/users/shared/_links.slim | 16 ++++------------ 8 files changed, 17 insertions(+), 27 deletions(-) create mode 100644 lib/open_fest/app/views/open_fest/shared/_flash_messages.slim 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/lib/open_fest/app/assets/javascripts/open_fest/application.js b/lib/open_fest/app/assets/javascripts/open_fest/application.js index 8913b40..646c5ab 100644 --- a/lib/open_fest/app/assets/javascripts/open_fest/application.js +++ b/lib/open_fest/app/assets/javascripts/open_fest/application.js @@ -10,4 +10,6 @@ // 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/views/layouts/open_fest/application.html.erb b/lib/open_fest/app/views/layouts/open_fest/application.html.erb index 9efb4fc..a4d91b4 100644 --- a/lib/open_fest/app/views/layouts/open_fest/application.html.erb +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -15,6 +15,7 @@ <%= render 'open_fest/shared/nav' %>
+ <%= render 'open_fest/shared/flash_messages' %> <%= yield %>
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/users/registrations/edit.slim b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim index 4a654e6..000a638 100644 --- a/lib/open_fest/app/views/open_fest/users/registrations/edit.slim +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -1,6 +1,6 @@ - content_for(:title) { t :edit_speaker_profile } -= simple_form_for(resource, wrapper: :default, as: resource_name, url: open_fest.user_registration_path, html: { method: :put, multipart: true }) do |f| += simple_form_for(resource, wrapper: :default, as: :user, url: user_registration_path, html: { method: :put, multipart: true }) do |f| .form_inputs h2.entry-title = t :personal_profile = f.error_notification 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 index 2fe8223..6f7c3fe 100644 --- a/lib/open_fest/app/views/open_fest/users/registrations/new.slim +++ b/lib/open_fest/app/views/open_fest/users/registrations/new.slim @@ -2,7 +2,7 @@ h2.entry-title = t :registration -= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| += simple_form_for(resource, as: resource_name, url: user_registration_path) do |f| = f.error_notification .form-inputs 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 index b53c4ae..baeef8e 100644 --- a/lib/open_fest/app/views/open_fest/users/sessions/new.slim +++ b/lib/open_fest/app/views/open_fest/users/sessions/new.slim @@ -2,7 +2,7 @@ h2.entry-title = t :login -= simple_form_for(resource, wrapper: :default, as: resource_name, url: session_path(resource_name), ) do |f| += simple_form_for(resource, wrapper: :default, as: resource_name, url: user_session_path) do |f| .form-inputs = f.input :email, required: false, autofocus: true, hint: false = f.input :password, required: false, hint: false 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 index 6f66289..fc5cdbd 100644 --- a/lib/open_fest/app/views/open_fest/users/shared/_links.slim +++ b/lib/open_fest/app/views/open_fest/users/shared/_links.slim @@ -1,23 +1,15 @@ - if controller_name != 'sessions' - = link_to t(:enter), new_session_path(resource_name) + = link_to t(:enter), new_user_session_path br - if devise_mapping.registerable? && controller_name != 'registrations' - = link_to t(:registration), new_registration_path(resource_name) + = link_to t(:registration), new_user_registration_path br - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' - = link_to t(:lostpass), new_password_path(resource_name) + = link_to t(:lostpass), new_user_password_path br - if devise_mapping.confirmable? && controller_name != 'confirmations' - = link_to t(:did_not_get_confirmation), new_confirmation_path(resource_name) + = link_to t(:did_not_get_confirmation), new_user_confirmation_path br - -- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' - = link_to t(:did_not_get_unlock), new_unlock_path(resource_name) - br - -- if devise_mapping.omniauthable? - - resource_class.omniauth_providers.each do |provider| - = link_to t(:login_with, with: @provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) From 9f5d7f2bb2c887c315b97180a20727f40dc5b4de Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 5 Aug 2015 14:58:24 +0300 Subject: [PATCH 20/36] Post-rebase fix --- app/controllers/concerns/current_conference_assigning.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/concerns/current_conference_assigning.rb b/app/controllers/concerns/current_conference_assigning.rb index c2a6f2a..d8ccda1 100644 --- a/app/controllers/concerns/current_conference_assigning.rb +++ b/app/controllers/concerns/current_conference_assigning.rb @@ -11,8 +11,12 @@ module CurrentConferenceAssigning end def current_conference - if not @current_conference and params[:conference_id].present? - @current_conference = Conference.find(params[:conference_id]) + 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 From f5249be3d4c71dba1b33b06414cc274a0cda027d Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 5 Aug 2015 15:05:31 +0300 Subject: [PATCH 21/36] Management fixes --- .../layouts/management/_navigation.html.slim | 2 +- app/views/management/events/index.html.slim | 7 ++++++- ...0729135818_create_participation_records.rb | 5 ++++- spec/factories/personal_profile.rb | 21 ++++++++++--------- spec/factories/personal_profiles.rb | 15 ------------- 5 files changed, 22 insertions(+), 28 deletions(-) delete mode 100644 spec/factories/personal_profiles.rb 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/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/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/factories/personal_profiles.rb b/spec/factories/personal_profiles.rb deleted file mode 100644 index 10b66e8..0000000 --- a/spec/factories/personal_profiles.rb +++ /dev/null @@ -1,15 +0,0 @@ -FactoryGirl.define do - factory :personal_profile do - 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 From adb5ca34b606bd3fb6e1ba945d24d519c88182e7 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 5 Aug 2015 15:07:07 +0300 Subject: [PATCH 22/36] Remove half-baked methods We'll think of something better later on. --- app/models/user.rb | 31 --------------------- spec/models/user_spec.rb | 59 ---------------------------------------- 2 files changed, 90 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 50e058a..b790a39 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,38 +12,7 @@ class User < ActiveRecord::Base default_scope { order id: :desc } - def duplicate_last_personal_profile(conference) - if personal_profiles.any? - new_personal_profile = personal_profiles.last.dup - new_personal_profile.conference = conference - new_personal_profile - end - end - - def find_or_initialize_personal_profile(conference) - if personal_profile(conference).present? - personal_profile(conference) - elsif personal_profiles.any? - duplicate_last_personal_profile(conference) - else - personal_profiles.build(conference: conference) - end - end - 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/spec/models/user_spec.rb b/spec/models/user_spec.rb index cbae24c..155b44a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -4,63 +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 - - describe '#find_or_initialize_personal_profile' do - context 'when the user has a personal profile for the specified conference' do - it 'returns the existing personal profile' do - user = create :user - conference = create :conference - personal_profile = create :personal_profile, user: user, conference: conference - - expect(user.find_or_initialize_personal_profile(conference)).to eq personal_profile - end - end - - context 'when the user has a personal profile for a previous conference' do - it 'returns a duplicate of the old profile' do - user = create :user - old_conference = create :conference - conference = create :conference - personal_profile = create :personal_profile, user: user, conference: old_conference - - expect(user.find_or_initialize_personal_profile(conference).public_email).to be_present - expect(user.find_or_initialize_personal_profile(conference).public_email).to eq personal_profile.public_email - expect(user.find_or_initialize_personal_profile(conference)).to be_new_record - end - end - - context 'when the user has no personal profiles' do - it 'returns a new personal profile' do - user = create :user - conference = create :conference - - expect(user.find_or_initialize_personal_profile(conference)).to be_new_record - expect(user.find_or_initialize_personal_profile(conference).conference).to eq conference - end - end - end end From 2231a652276804005f9cce6af99a1401ca658bd9 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 5 Aug 2015 16:05:42 +0300 Subject: [PATCH 23/36] OpenFest: Remove unnecessary devise views --- .../mailer/confirmation_instructions.text.erb | 5 ----- .../mailer/reset_password_instructions.text.erb | 8 -------- .../users/mailer/unlock_instructions.text.erb | 7 ------- .../app/views/open_fest/users/unlocks/new.slim | 15 --------------- 4 files changed, 35 deletions(-) delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/unlocks/new.slim diff --git a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb deleted file mode 100644 index b80b172..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb +++ /dev/null @@ -1,5 +0,0 @@ -<%= t(:welcome, name: @email) %>! - -<%= t(:confirm_by_clicking) %> - -<%= confirmation_url(@resource, confirmation_token: @token) %> diff --git a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb deleted file mode 100644 index f0089f8..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= t(:hello, name: @resource.email) %>! - -<%= t(:someone_requested_passreset) %> - -<%= edit_password_url(@resource, reset_password_token: @token) %> - -<%= t(:do_not_want_pass_reset1) %> -<%= t(:do_not_want_pass_reset2) %> diff --git a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb deleted file mode 100644 index 4d2a69b..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb +++ /dev/null @@ -1,7 +0,0 @@ -<%= t(:hello, name: @resource.email) %>! - -<%= t(:account_locked) %> - -<%= t(:click_to_unlock) %> - -<%= unlock_url(@resource, unlock_token: @token) %> diff --git a/lib/open_fest/app/views/open_fest/users/unlocks/new.slim b/lib/open_fest/app/views/open_fest/users/unlocks/new.slim deleted file mode 100644 index 0f91453..0000000 --- a/lib/open_fest/app/views/open_fest/users/unlocks/new.slim +++ /dev/null @@ -1,15 +0,0 @@ -- content_for(:title) { ":: #{t :resend_unlock_instructions_title}" } - -h2 =t :resend_unlock_instructions_title - -= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| - = f.error_notification - = f.full_error :unlock_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' From 48119a687ce278cef49d7b021ca75c0720f2ab0c Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 5 Aug 2015 16:06:35 +0300 Subject: [PATCH 24/36] OpenFest: Fix form wrapper and paths in Devise views --- .../app/controllers/open_fest/users/passwords_controller.rb | 4 ++++ .../app/views/open_fest/users/confirmations/new.slim | 2 +- lib/open_fest/app/views/open_fest/users/passwords/edit.slim | 2 +- lib/open_fest/app/views/open_fest/users/passwords/new.slim | 2 +- .../app/views/open_fest/users/registrations/new.slim | 2 +- lib/open_fest/app/views/open_fest/users/sessions/new.slim | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) 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 index be5e06e..892c2d6 100644 --- a/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/passwords_controller.rb @@ -1,3 +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/views/open_fest/users/confirmations/new.slim b/lib/open_fest/app/views/open_fest/users/confirmations/new.slim index 72c8dca..d0dad8b 100644 --- a/lib/open_fest/app/views/open_fest/users/confirmations/new.slim +++ b/lib/open_fest/app/views/open_fest/users/confirmations/new.slim @@ -2,7 +2,7 @@ h2.entry-title = t :resend_instructions_header -= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| += simple_form_for(resource, wrapper: :default, as: :user, url: user_confirmation_path) do |f| = f.error_notification = f.full_error :confirmation_token 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 index f39bcb7..a49e4bc 100644 --- a/lib/open_fest/app/views/open_fest/users/passwords/edit.slim +++ b/lib/open_fest/app/views/open_fest/users/passwords/edit.slim @@ -2,7 +2,7 @@ h2.entry-title = t :change_pass -= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| += 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 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 index 7e1f90c..55f2297 100644 --- a/lib/open_fest/app/views/open_fest/users/passwords/new.slim +++ b/lib/open_fest/app/views/open_fest/users/passwords/new.slim @@ -2,7 +2,7 @@ h2.entry-title = t :lostpass -= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| += simple_form_for(resource, wrapper: :default, as: :user, url: user_password_path) do |f| = f.error_notification .form-inputs 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 index 6f7c3fe..bb5f2c2 100644 --- a/lib/open_fest/app/views/open_fest/users/registrations/new.slim +++ b/lib/open_fest/app/views/open_fest/users/registrations/new.slim @@ -2,7 +2,7 @@ h2.entry-title = t :registration -= simple_form_for(resource, as: resource_name, url: user_registration_path) do |f| += simple_form_for(resource, wrapper: :default, as: :user, url: user_registration_path) do |f| = f.error_notification .form-inputs 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 index baeef8e..ad15150 100644 --- a/lib/open_fest/app/views/open_fest/users/sessions/new.slim +++ b/lib/open_fest/app/views/open_fest/users/sessions/new.slim @@ -2,7 +2,7 @@ h2.entry-title = t :login -= simple_form_for(resource, wrapper: :default, as: resource_name, url: user_session_path) do |f| += 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 From a75def4b952f2c9baf37ee3b9a703ddbbb2981d4 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 5 Aug 2015 16:27:10 +0300 Subject: [PATCH 25/36] Update user --- .../20150805161830_add_language_to_users.rb | 5 ++++ .../users/registrations_controller.rb | 23 +++++++++++-------- .../open_fest/users/registrations/edit.slim | 15 +----------- 3 files changed, 20 insertions(+), 23 deletions(-) create mode 100644 db/migrate/20150805161830_add_language_to_users.rb 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/app/controllers/open_fest/users/registrations_controller.rb b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb index 85b97ed..bcbbdcd 100644 --- a/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/users/registrations_controller.rb @@ -2,20 +2,21 @@ class OpenFest::Users::RegistrationsController < Devise::RegistrationsController include OpenFest::Users::DeviseController def edit - resource.find_or_initialize_personal_profile(current_conference) + @user = resource end def update @user = User.find(current_user.id) - successfully_updated = if needs_password?(@user, params) - @user.update_with_password(devise_parameter_sanitizer.sanitize(:account_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(devise_parameter_sanitizer.sanitize(:account_update)) - end + 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 @@ -29,6 +30,10 @@ class OpenFest::Users::RegistrationsController < Devise::RegistrationsController 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? || 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 index 000a638..54fd8cb 100644 --- a/lib/open_fest/app/views/open_fest/users/registrations/edit.slim +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -1,23 +1,10 @@ - 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.entry-title = t :personal_profile - = f.error_notification - = f.simple_fields_for :personal_profile, resource.personal_profile(current_conference) do |ff| - = ff.input :picture, as: :file, required: true - = ff.input :first_name, autofocus: true - = ff.input :last_name - = ff.input :public_email - = ff.input :organisation - = ff.input :github - = ff.input :twitter - = ff.input :mobile_phone, input_html: {value: ff.object.mobile_phone.try(:phony_formatted, format: :international)} - = ff.input :biography - .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 From 08290d177075444cf53e6ffb8ee5c772dc0c8fce Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 5 Aug 2015 17:17:04 +0300 Subject: [PATCH 26/36] Create or update profile --- app/models/user.rb | 10 ++++- .../open_fest/personal_profiles_controller.rb | 42 +++++++++++++++++++ .../open_fest/personal_profiles/_form.slim | 19 +++++++++ .../open_fest/personal_profiles/edit.slim | 5 +++ .../open_fest/personal_profiles/new.slim | 5 +++ .../open_fest/users/registrations/edit.slim | 7 ++++ lib/open_fest/config/routes.rb | 2 + 7 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 lib/open_fest/app/controllers/open_fest/personal_profiles_controller.rb create mode 100644 lib/open_fest/app/views/open_fest/personal_profiles/_form.slim create mode 100644 lib/open_fest/app/views/open_fest/personal_profiles/edit.slim create mode 100644 lib/open_fest/app/views/open_fest/personal_profiles/new.slim diff --git a/app/models/user.rb b/app/models/user.rb index b790a39..1124038 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,7 +8,15 @@ class User < ActiveRecord::Base has_many :lectures has_many :workshops has_many :events - has_one :personal_profile, Proc.new { |user, conference| user.personal_profiles } + + # 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 } 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/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/users/registrations/edit.slim b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim index 54fd8cb..e474613 100644 --- a/lib/open_fest/app/views/open_fest/users/registrations/edit.slim +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -1,6 +1,13 @@ - 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 diff --git a/lib/open_fest/config/routes.rb b/lib/open_fest/config/routes.rb index 45e1f8c..de7313c 100644 --- a/lib/open_fest/config/routes.rb +++ b/lib/open_fest/config/routes.rb @@ -4,4 +4,6 @@ OpenFest::Engine.routes.draw do root to: 'welcome#index' devise_for :users, module: 'open_fest/users' + + resource :personal_profile, path: 'profile' end From ded7d691695d0633575531c403713c7d778c3216 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Mon, 10 Aug 2015 14:52:45 +0300 Subject: [PATCH 27/36] Submitting events --- .../assets/stylesheets/open_fest/_forms.scss | 2 +- .../open_fest/events_controller.rb | 35 ++++++++++++++++ .../open_fest/welcome_controller.rb | 8 ---- .../views/open_fest/events/_event_type.slim | 1 + .../open_fest/{welcome => events}/_track.slim | 0 .../open_fest/{welcome => events}/index.slim | 0 .../app/views/open_fest/events/new.slim | 23 ++++++++++ .../views/open_fest/welcome/_event_type.slim | 1 - .../config/locales/simple_form.bg.yml | 42 +++++++++++++++++++ .../config/locales/simple_form.en.yml | 42 +++++++++++++++++++ lib/open_fest/config/routes.rb | 5 +-- 11 files changed, 146 insertions(+), 13 deletions(-) create mode 100644 lib/open_fest/app/controllers/open_fest/events_controller.rb delete mode 100644 lib/open_fest/app/controllers/open_fest/welcome_controller.rb create mode 100644 lib/open_fest/app/views/open_fest/events/_event_type.slim rename lib/open_fest/app/views/open_fest/{welcome => events}/_track.slim (100%) rename lib/open_fest/app/views/open_fest/{welcome => events}/index.slim (100%) create mode 100644 lib/open_fest/app/views/open_fest/events/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/welcome/_event_type.slim create mode 100644 lib/open_fest/config/locales/simple_form.bg.yml create mode 100644 lib/open_fest/config/locales/simple_form.en.yml diff --git a/lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss b/lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss index f5645af..40371f0 100644 --- a/lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss +++ b/lib/open_fest/app/assets/stylesheets/open_fest/_forms.scss @@ -25,7 +25,7 @@ textarea { height: 15em; - width: 50em; + width: 45em; } img { 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/welcome_controller.rb b/lib/open_fest/app/controllers/open_fest/welcome_controller.rb deleted file mode 100644 index a09aebc..0000000 --- a/lib/open_fest/app/controllers/open_fest/welcome_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -require_dependency "open_fest/application_controller" - -module OpenFest - class WelcomeController < ApplicationController - def index - end - end -end 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/welcome/_track.slim b/lib/open_fest/app/views/open_fest/events/_track.slim similarity index 100% rename from lib/open_fest/app/views/open_fest/welcome/_track.slim rename to lib/open_fest/app/views/open_fest/events/_track.slim diff --git a/lib/open_fest/app/views/open_fest/welcome/index.slim b/lib/open_fest/app/views/open_fest/events/index.slim similarity index 100% rename from lib/open_fest/app/views/open_fest/welcome/index.slim rename to lib/open_fest/app/views/open_fest/events/index.slim 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..a329a4b --- /dev/null +++ b/lib/open_fest/app/views/open_fest/events/new.slim @@ -0,0 +1,23 @@ += simple_form_for @event, wrapper: :default do |form| + p + = form.error_notification + + .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 + + = 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 + + -# TODO boolean hint CSS, missing divider + -# TODO error message? + = form.input :agreement, as: :boolean, wrapper_html: {class: 'input'} + + = form.button :submit diff --git a/lib/open_fest/app/views/open_fest/welcome/_event_type.slim b/lib/open_fest/app/views/open_fest/welcome/_event_type.slim deleted file mode 100644 index e8646be..0000000 --- a/lib/open_fest/app/views/open_fest/welcome/_event_type.slim +++ /dev/null @@ -1 +0,0 @@ -=> link_to t('views.welcome.submit_event', event_type: event_type.name.mb_chars.downcase), '#', class: 'btn-link btn-link-large' 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..4162687 --- /dev/null +++ b/lib/open_fest/config/locales/simple_form.bg.yml @@ -0,0 +1,42 @@ +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) + workshop: + title: Заглавието на уъркшопа Ви + subtitle: Подзаглавието на уъркшопа Ви (ако има такова) + track_id: Потокът от уъркшопи, в който искате да попадне уъркшопа Ви + length: Продължителността на всеки уъркшоп може да бъде от 30 до 120 минути + 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..227fe0c --- /dev/null +++ b/lib/open_fest/config/locales/simple_form.en.yml @@ -0,0 +1,42 @@ +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 + lecture: + title: Title of your talk + subtitle: Sub-title of your talk (if applicable) + track_id: Track for your talk + length: The length of your talk can be from 40 to 45 minutes + language: Language in which the talk will be presented + abstract: Abstract of the talk, for the visitors + description: Detailed description of the talk, visible to the visitors + notes: Notes on your talk, visible only to the organizers + agreement: Indicate if you accept your lecture to be recorded and published under the CC-BY-ND (Creative Commons – Attribution – No Derivatives) license + workshop: + title: Title of your workshop + subtitle: Sub-title of your workshop (if applicable) + track_id: Track for your workshop + length: The length of the workshop can be from 30 to 120 minutes + language: Language in which the workshop will be conducted + abstract: Abstract of the workshop, visible to the visitors + description: Detailed description of the workshop, visible to the visitors + notes: Notes, visible only to the organizers + agreement: Indicate if you accept your workshop to be recorded and published under the CC-BY-ND (Creative Commons – Attribution – No Derivatives) license diff --git a/lib/open_fest/config/routes.rb b/lib/open_fest/config/routes.rb index de7313c..bbc9bc7 100644 --- a/lib/open_fest/config/routes.rb +++ b/lib/open_fest/config/routes.rb @@ -1,9 +1,8 @@ OpenFest::Engine.routes.draw do - get 'welcome/index' - - root to: 'welcome#index' + root to: 'events#index' devise_for :users, module: 'open_fest/users' resource :personal_profile, path: 'profile' + resources :events end From cb3673551443a5f1600322e94d86665603b281b8 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Mon, 10 Aug 2015 15:03:19 +0300 Subject: [PATCH 28/36] Translations and adjustments --- .../app/views/open_fest/events/new.slim | 3 + .../app/views/open_fest/shared/_nav.slim | 2 +- .../config/locales/simple_form.bg.yml | 26 +++---- .../config/locales/simple_form.en.yml | 30 +++----- lib/open_fest/config/locales/views.bg.yml | 5 +- lib/open_fest/config/locales/views.en.yml | 71 +++++++++++++++++++ 6 files changed, 95 insertions(+), 42 deletions(-) create mode 100644 lib/open_fest/config/locales/views.en.yml diff --git a/lib/open_fest/app/views/open_fest/events/new.slim b/lib/open_fest/app/views/open_fest/events/new.slim index a329a4b..af001ac 100644 --- a/lib/open_fest/app/views/open_fest/events/new.slim +++ b/lib/open_fest/app/views/open_fest/events/new.slim @@ -2,8 +2,11 @@ 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 diff --git a/lib/open_fest/app/views/open_fest/shared/_nav.slim b/lib/open_fest/app/views/open_fest/shared/_nav.slim index 7f05161..3e6b2c5 100644 --- a/lib/open_fest/app/views/open_fest/shared/_nav.slim +++ b/lib/open_fest/app/views/open_fest/shared/_nav.slim @@ -6,7 +6,7 @@ nav div ul.menu li - a href="#" = t('views.navigation.submit_event') + a href=events_path = t('views.navigation.submit_event') li a href="#" = t('views.navigation.become_a_volunteer') li diff --git a/lib/open_fest/config/locales/simple_form.bg.yml b/lib/open_fest/config/locales/simple_form.bg.yml index 4162687..9c04343 100644 --- a/lib/open_fest/config/locales/simple_form.bg.yml +++ b/lib/open_fest/config/locales/simple_form.bg.yml @@ -21,22 +21,12 @@ bg: github: Потребителското Ви име в Github twitter: Потребителското Ви име в Twitter event: - title: Заглавието на лекцията Ви - subtitle: Подзаглавието на лекцията Ви (ако има такова) - track_id: Потокът от лекции, в който искате да попадне лекцията Ви - length: Продължителността на лекция може да бъде от 40 до 45 минути - language: Език, на който ще бъде водена лекцията - abstract: Резюме на лекцията, което да може да бъде прочетено от посетителите (1 абзац) - description: Подробно описание на лекцията (няколко абзаца) + title: Заглавието на събитието Ви + subtitle: Подзаглавието на събитието Ви (ако има такова) + track_id: Потокът от лекции, в който искате да попадне събитието Ви + length: Продължителността на събитието може да бъде от 40 до 45 минути + language: Език, на който ще бъде водено събитието + abstract: Резюме на събитието, което да може да бъде прочетено от посетителите (1 абзац) + description: Подробно описание на събитието (няколко абзаца) notes: Забележки, които искате да споделите с организаторския екип - agreement: Отбележете съгласни ли сте с това лекцията Ви да бъде записана и публикувана под лиценз CC-BY-ND (Creative Commons – Attribution – No Derivatives) - workshop: - title: Заглавието на уъркшопа Ви - subtitle: Подзаглавието на уъркшопа Ви (ако има такова) - track_id: Потокът от уъркшопи, в който искате да попадне уъркшопа Ви - length: Продължителността на всеки уъркшоп може да бъде от 30 до 120 минути - language: Език, на който ще бъде воден уъркшопа - abstract: Резюме на уъркшопа, което да може да бъде прочетено от посетителите (1 абзац) - description: Подробно описание на уъркшопа (няколко абзаца) - notes: Забележки, които искате да споделите с организаторския екип - agreement: Отбележете съгласни ли сте с това уъркшопът Ви да бъде записан и публикуван под лиценз CC-BY-ND (Creative Commons – Attribution – No Derivatives) + 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 index 227fe0c..770e3e7 100644 --- a/lib/open_fest/config/locales/simple_form.en.yml +++ b/lib/open_fest/config/locales/simple_form.en.yml @@ -20,23 +20,13 @@ en: biography: Describe yourself in a few sentences in third person :) github: Your Github username twitter: Your Twitter username - lecture: - title: Title of your talk - subtitle: Sub-title of your talk (if applicable) - track_id: Track for your talk - length: The length of your talk can be from 40 to 45 minutes - language: Language in which the talk will be presented - abstract: Abstract of the talk, for the visitors - description: Detailed description of the talk, visible to the visitors - notes: Notes on your talk, visible only to the organizers - agreement: Indicate if you accept your lecture to be recorded and published under the CC-BY-ND (Creative Commons – Attribution – No Derivatives) license - workshop: - title: Title of your workshop - subtitle: Sub-title of your workshop (if applicable) - track_id: Track for your workshop - length: The length of the workshop can be from 30 to 120 minutes - language: Language in which the workshop will be conducted - abstract: Abstract of the workshop, visible to the visitors - description: Detailed description of the workshop, visible to the visitors - notes: Notes, visible only to the organizers - agreement: Indicate if you accept your workshop to be recorded and published under the CC-BY-ND (Creative Commons – Attribution – No Derivatives) license + 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 index 0fae951..5281721 100644 --- a/lib/open_fest/config/locales/views.bg.yml +++ b/lib/open_fest/config/locales/views.bg.yml @@ -5,8 +5,7 @@ bg: home_title: "%{conference} - зов за лектори" what_we_ask: 'Бихме искали да получим предложенията Ви за лекции и уъркшопи, принадлежащи към следните категории до 30 септември 2014г.:' license_notice: 'Имайте предвид, че презентациите ви впоследствие ще бъдат публикувани с лиценз CC-BY-ND (Creative Commons – Attribution – No derivatives).' - submit_lecture: Предложи лекция - submit_workshop: Предложи уъркшоп + submit_event: Предложи %{event_type} resend_instructions_header: Повторно изпращане на инструкции за потвърждаване на акаунт resend_instructions_btn: Изпрати отново инструкциите @@ -74,4 +73,4 @@ bg: suggestion_and_speaker_count: "%{suggestions} предложения от %{speakers} лектори" lecture_was_successfully_confirmed: "Лекцията беше потвърдена успешно" - workshop_was_successfully_confirmed: "Уъркшопът беше потвърден успешно" \ No newline at end of file + 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" From fae071239d22e821efda31993f6b1f00b4332e22 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Mon, 10 Aug 2015 15:04:27 +0300 Subject: [PATCH 29/36] TODO --- lib/open_fest/app/views/open_fest/events/new.slim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/open_fest/app/views/open_fest/events/new.slim b/lib/open_fest/app/views/open_fest/events/new.slim index af001ac..9d33996 100644 --- a/lib/open_fest/app/views/open_fest/events/new.slim +++ b/lib/open_fest/app/views/open_fest/events/new.slim @@ -13,7 +13,9 @@ -# 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 From dd14ca650d73d623c424d1d797ee02974711a1fc Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Mon, 10 Aug 2015 15:35:32 +0300 Subject: [PATCH 30/36] Implement changing the language --- .../controllers/open_fest/application_controller.rb | 11 +++++++++++ lib/open_fest/app/views/open_fest/shared/_nav.slim | 10 ++++++++-- lib/open_fest/config/routes.rb | 8 +++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/lib/open_fest/app/controllers/open_fest/application_controller.rb b/lib/open_fest/app/controllers/open_fest/application_controller.rb index 1f509ad..631f18c 100644 --- a/lib/open_fest/app/controllers/open_fest/application_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/application_controller.rb @@ -3,5 +3,16 @@ module OpenFest 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/views/open_fest/shared/_nav.slim b/lib/open_fest/app/views/open_fest/shared/_nav.slim index 3e6b2c5..5b1dfd8 100644 --- a/lib/open_fest/app/views/open_fest/shared/_nav.slim +++ b/lib/open_fest/app/views/open_fest/shared/_nav.slim @@ -21,5 +21,11 @@ nav li = link_to t(:logout), destroy_user_session_path, method: :delete li - a href="#" hreflang="en" - 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" + - 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/config/routes.rb b/lib/open_fest/config/routes.rb index bbc9bc7..fae7e66 100644 --- a/lib/open_fest/config/routes.rb +++ b/lib/open_fest/config/routes.rb @@ -1,8 +1,10 @@ OpenFest::Engine.routes.draw do root to: 'events#index' - devise_for :users, module: 'open_fest/users' + scope '(/:locale)' do + devise_for :users, module: 'open_fest/users' - resource :personal_profile, path: 'profile' - resources :events + resource :personal_profile, path: 'profile' + resources :events + end end From 4d37c817e6490d18c6d312a1b652e5ac93ee88f9 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 17:07:07 +0300 Subject: [PATCH 31/36] OpenFest: Apply propper wrapper in the new event form --- lib/open_fest/app/views/open_fest/events/new.slim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/open_fest/app/views/open_fest/events/new.slim b/lib/open_fest/app/views/open_fest/events/new.slim index 9d33996..4d9638a 100644 --- a/lib/open_fest/app/views/open_fest/events/new.slim +++ b/lib/open_fest/app/views/open_fest/events/new.slim @@ -21,8 +21,6 @@ = form.input :description = form.input :notes - -# TODO boolean hint CSS, missing divider - -# TODO error message? - = form.input :agreement, as: :boolean, wrapper_html: {class: 'input'} + = form.input :agreement, as: :boolean, wrapper: :default = form.button :submit From 1c876bfeb7132c72c99f61a898f5c94aee0dbcb8 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 19:05:34 +0300 Subject: [PATCH 32/36] Fix migrations that populates the event types --- ..._create_event_types_for_all_existing_events.rb | 15 +++++++++------ ...2233_populate_event_type_of_existing_events.rb | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) 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'] From a27fd44ad04de8337d20c05516ac6c73852473e8 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 20:47:32 +0300 Subject: [PATCH 33/36] Fix foreign key constraint for Participations --- db/migrate/20150729135346_create_participations.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From 2d325c492c6d88c26aea1ba8e59e27bfc040f9c9 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 21:18:12 +0300 Subject: [PATCH 34/36] Fix an SQL query that fails on postgres --- app/models/conference.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 57dc267f78fbc96e7f30f9a6f16e812de48a93a6 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 21:40:06 +0300 Subject: [PATCH 35/36] Fix new conference creation --- app/controllers/concerns/current_conference_assigning.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/current_conference_assigning.rb b/app/controllers/concerns/current_conference_assigning.rb index d8ccda1..d39fbc3 100644 --- a/app/controllers/concerns/current_conference_assigning.rb +++ b/app/controllers/concerns/current_conference_assigning.rb @@ -12,7 +12,7 @@ module CurrentConferenceAssigning def current_conference if not @current_conference - if @conference + if @conference and not @conference.new_record? @current_conference = @conference elsif params[:conference_id].present? @current_conference = Conference.find(params[:conference_id]) From 58484957fa9392be2d06886004578dfc0b7dd17e Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 21:50:52 +0300 Subject: [PATCH 36/36] Update Capistrano configuration --- Capfile | 21 ++++++++------- Gemfile | 9 ++++--- Gemfile.lock | 41 ++++++++++++++++------------ config/deploy.rb | 23 +++++++++++----- config/deploy/production.rb | 54 +++++++++++++++++++++++++------------ 5 files changed, 95 insertions(+), 53 deletions(-) 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 3f7fd76..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' @@ -60,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 49c260e..cafa556 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,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 @@ -72,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) @@ -103,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) @@ -130,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) @@ -145,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) @@ -172,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) @@ -183,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) @@ -193,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) @@ -209,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) @@ -232,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) @@ -255,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) @@ -350,8 +355,10 @@ DEPENDENCIES bootstrap-sass-extras bootswatch-rails capistrano + capistrano-git-submodule-strategy capistrano-rails capistrano-rvm + capistrano3-puma capybara carrierwave coffee-rails 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',