diff --git a/.gitignore b/.gitignore index 1f6dd72..bab620d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,15 +13,9 @@ # Ignore all logfiles and tempfiles. /log/* +/tmp/* !/log/.keep -/tmp -.idea/ -.vscode/ -.rbenv-gemsets -.DS_Store -public/system -public/uploads -public/assets/** -public/sitemap.xml.gz +!/tmp/.keep + +# Ignore Byebug command history file. .byebug_history -/*.iml diff --git a/.jsbeautifyrc b/.jsbeautifyrc new file mode 100644 index 0000000..f4b0e8c --- /dev/null +++ b/.jsbeautifyrc @@ -0,0 +1,11 @@ +{ + "indent_size": 2, + "indent_char": " ", + "other": " ", + "indent_level": 0, + "indent_with_tabs": false, + "preserve_newlines": true, + "max_preserve_newlines": 2, + "jslint_happy": true, + "indent_handlebars": true +} diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..c1817e7 --- /dev/null +++ b/Capfile @@ -0,0 +1,27 @@ +# Load DSL and set up stages +require "capistrano/setup" + +# Include default deployment tasks +require "capistrano/deploy" + +# Include tasks from other gems included in your Gemfile +# +# For documentation on these, see for example: +# +# https://github.com/capistrano/rvm +# https://github.com/capistrano/rbenv +# 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/passenger' + +# 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 cb8d4d2..a02050f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,69 +1,83 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.5' +gem 'rails', '~> 5.0.0', '>= 5.0.0.1' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# Use Puma as the app server +gem 'puma', '~> 3.0' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.1.0' -gem 'bootstrap-sass', '~> 3.3.6' - -#gem 'pg' +gem 'coffee-rails', '~> 4.2' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' -gem 'jquery-turbolinks' -gem 'react-rails', '~> 1.6.0' -# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks -gem 'turbolinks' +# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks +gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.0' -# bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc +gem 'jbuilder', '~> 2.5' +# Use Redis adapter to run Action Cable in production +# gem 'redis', '~> 3.0' +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# gem 'pg' -#### ADDED GEMS ### -gem 'rake', '~> 11.1' +# Front gem 'font-awesome-rails' +gem 'bootstrap-sass', '~> 3.3.6' +gem 'autoprefixer-rails' +gem 'recaptcha', require: 'recaptcha/rails' +gem 'sitemap_generator' + +# Backend / Utils gem 'simple_form' gem 'wysiwyg-rails' -gem 'cocoon' -gem 'icheck-rails' gem 'devise' gem 'annotate' gem 'carrierwave' -gem 'autoprefixer-rails' gem 'mini_magick' gem 'kaminari' -gem 'friendly_id', '~> 5.1.0' +gem 'friendly_id' gem 'ancestry' -gem 'recaptcha', require: 'recaptcha/rails' +gem 'whenever' + +# ADMIN gem 'rails_admin_nestable', '~> 0.3.2' gem 'rails_admin_rollincode', '~> 1.1' gem 'rails_admin', '~> 1.0' -gem 'breadcrumbs_on_rails' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug' + gem 'byebug', platform: :mri +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. + gem 'web-console' + gem 'listen', '~> 3.0.5' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' + gem 'better_errors' - gem 'binding_of_caller' - gem 'quiet_assets' gem 'pry-byebug' gem 'faker' - gem 'letter_opener' - gem 'puma' - gem 'rename' - # Use sqlite3 as the database for Active Record - gem 'sqlite3' + # Capistrano + gem 'capistrano', '~> 3.6' + gem 'capistrano-rails', '~> 1.2' + gem 'capistrano-bundler', '~> 1.2' + gem 'capistrano-passenger' + gem 'capistrano-rbenv', '~> 2.0' end -group :development do - # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console', '~> 2.0' +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] - # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem 'spring' -end +gem 'rails_12factor', group: :production diff --git a/Gemfile.lock b/Gemfile.lock index bdaf38f..2f26ca9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,84 +1,97 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.5) - actionpack (= 4.2.5) - actionview (= 4.2.5) - activejob (= 4.2.5) + actioncable (5.0.0.1) + actionpack (= 5.0.0.1) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.5) - actionview (= 4.2.5) - activesupport (= 4.2.5) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.0.1) + actionview (= 5.0.0.1) + activesupport (= 5.0.0.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.5) - activesupport (= 4.2.5) + actionview (5.0.0.1) + activesupport (= 5.0.0.1) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.5) - activesupport (= 4.2.5) - globalid (>= 0.3.0) - activemodel (4.2.5) - activesupport (= 4.2.5) - builder (~> 3.1) - activerecord (4.2.5) - activemodel (= 4.2.5) - activesupport (= 4.2.5) - arel (~> 6.0) - activesupport (4.2.5) + activejob (5.0.0.1) + activesupport (= 5.0.0.1) + globalid (>= 0.3.6) + activemodel (5.0.0.1) + activesupport (= 5.0.0.1) + activerecord (5.0.0.1) + activemodel (= 5.0.0.1) + activesupport (= 5.0.0.1) + arel (~> 7.0) + activesupport (5.0.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.4.0) + airbrussh (1.1.1) + sshkit (>= 1.6.1, != 1.7.0) ancestry (2.2.2) activerecord (>= 3.0.0) - annotate (2.7.1) - activerecord (>= 3.2, < 6.0) - rake (>= 10.4, < 12.0) - arel (6.0.3) - autoprefixer-rails (6.5.1.1) + annotate (2.6.5) + activerecord (>= 2.3.0) + rake (>= 0.8.7) + arel (7.1.4) + autoprefixer-rails (6.5.2) execjs - babel-source (5.8.35) - babel-transpiler (0.7.0) - babel-source (>= 4.0, < 6) - execjs (~> 2.0) bcrypt (3.1.11) better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) rack (>= 0.9.0) - binding_of_caller (0.7.2) - debug_inspector (>= 0.0.1) bootstrap-sass (3.3.7) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) - breadcrumbs_on_rails (3.0.1) builder (3.2.2) byebug (9.0.6) + capistrano (3.6.1) + airbrussh (>= 1.0.0) + capistrano-harrow + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (1.2.0) + capistrano (~> 3.1) + sshkit (~> 1.2) + capistrano-harrow (0.5.3) + capistrano-passenger (0.2.0) + capistrano (~> 3.0) + capistrano-rails (1.2.0) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) + capistrano-rbenv (2.0.4) + capistrano (~> 3.1) + sshkit (~> 1.3) carrierwave (0.11.2) activemodel (>= 3.2.0) activesupport (>= 3.2.0) json (>= 1.7) mime-types (>= 1.16) mimemagic (>= 0.3.0) - cocoon (1.2.9) + chronic (0.10.2) coderay (1.1.1) - coffee-rails (4.1.1) + coffee-rails (4.2.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 4.0.0, < 5.2.x) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.11.1) concurrent-ruby (1.0.2) - connection_pool (2.2.0) debug_inspector (0.0.2) devise (4.2.0) bcrypt (~> 3.0) @@ -90,6 +103,7 @@ GEM execjs (2.7.0) faker (1.6.6) i18n (~> 0.5) + ffi (1.9.14) font-awesome-rails (4.7.0.0) railties (>= 3.2, < 5.1) friendly_id (5.1.0) @@ -110,30 +124,22 @@ GEM nokogiri (~> 1.6.0) ruby_parser (~> 3.5) i18n (0.7.0) - icheck-rails (1.0.2.2) - jquery-rails - rails (>= 3.1.0) - sass-rails - jbuilder (2.6.0) + jbuilder (2.6.1) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) jquery-rails (4.2.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jquery-turbolinks (2.1.0) - railties (>= 3.1.0) - turbolinks jquery-ui-rails (5.0.5) railties (>= 3.2.16) json (1.8.3) kaminari (0.17.0) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - launchy (2.4.3) - addressable (~> 2.3) - letter_opener (1.4.1) - launchy (~> 2.2) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.4) @@ -145,9 +151,13 @@ GEM mimemagic (0.3.2) mini_magick (4.5.1) mini_portile2 (2.1.0) - minitest (5.9.1) + minitest (5.10.1) multi_json (1.12.1) nested_form (0.3.2) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (3.2.0) + nio4r (1.2.1) nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) orm_adapter (0.5.0) @@ -158,34 +168,33 @@ GEM pry-byebug (3.4.0) byebug (~> 9.0) pry (~> 0.10) - puma (3.6.0) - quiet_assets (1.1.0) - railties (>= 3.1, < 5.0) - rack (1.6.4) + puma (3.6.2) + rack (2.0.1) rack-pjax (1.0.0) nokogiri (~> 1.5) rack (>= 1.1) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.5) - actionmailer (= 4.2.5) - actionpack (= 4.2.5) - actionview (= 4.2.5) - activejob (= 4.2.5) - activemodel (= 4.2.5) - activerecord (= 4.2.5) - activesupport (= 4.2.5) + rails (5.0.0.1) + actioncable (= 5.0.0.1) + actionmailer (= 5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) + activemodel (= 5.0.0.1) + activerecord (= 5.0.0.1) + activesupport (= 5.0.0.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.5) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) + railties (= 5.0.0.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.1) + activesupport (>= 4.2.0, < 6.0) nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) + rails_12factor (0.0.3) + rails_serve_static_assets + rails_stdout_logging rails_admin (1.1.0) builder (~> 3.1) coffee-rails (~> 4.0) @@ -206,26 +215,21 @@ GEM sass-rails rails_admin_rollincode (1.1) rails (>= 4.0, < 6) - railties (4.2.5) - actionpack (= 4.2.5) - activesupport (= 4.2.5) + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.5) + railties (5.0.0.1) + actionpack (= 5.0.0.1) + activesupport (= 5.0.0.1) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (11.3.0) - rdoc (4.2.2) - json (~> 1.4) - react-rails (1.6.2) - babel-transpiler (>= 0.7.0) - coffee-script-source (~> 1.8) - connection_pool - execjs - rails (>= 3.2) - tilt + rake (12.0.0) + rb-fsevent (0.9.8) + rb-inotify (0.9.7) + ffi (>= 0.5.0) recaptcha (3.4.0) json remotipart (1.3.1) - rename (1.0.2) - rails (>= 3.0.0) responders (2.3.0) railties (>= 4.2.0, < 5.1) ruby_parser (3.8.3) @@ -237,16 +241,18 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sdoc (0.4.2) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) sexp_processor (4.7.0) simple_form (3.3.1) actionpack (> 4, < 5.1) activemodel (> 4, < 5.1) + sitemap_generator (5.2.0) + builder (~> 3.0) slop (3.6.0) spring (2.0.0) activesupport (>= 4.2) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) sprockets (3.7.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -255,7 +261,10 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.12) - thor (0.19.1) + sshkit (1.11.4) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) + thor (0.19.4) thread_safe (0.3.5) tilt (2.0.5) turbolinks (5.0.1) @@ -263,15 +272,20 @@ GEM turbolinks-source (5.0.0) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.3) + uglifier (3.0.4) execjs (>= 0.3.0, < 3) warden (1.2.6) rack (>= 1.0) - web-console (2.3.0) - activemodel (>= 4.0) - binding_of_caller (>= 0.7.2) - railties (>= 4.0) - sprockets-rails (>= 2.0, < 4.0) + web-console (3.4.0) + actionview (>= 5.0) + activemodel (>= 5.0) + debug_inspector + railties (>= 5.0) + websocket-driver (0.6.4) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) + whenever (0.9.7) + chronic (>= 0.6.3) wysiwyg-rails (2.3.5) font-awesome-rails (~> 4.4, >= 4.4.0.0) railties (>= 3.2, < 6.0) @@ -284,44 +298,44 @@ DEPENDENCIES annotate autoprefixer-rails better_errors - binding_of_caller bootstrap-sass (~> 3.3.6) - breadcrumbs_on_rails byebug + capistrano (~> 3.6) + capistrano-bundler (~> 1.2) + capistrano-passenger + capistrano-rails (~> 1.2) + capistrano-rbenv (~> 2.0) carrierwave - cocoon - coffee-rails (~> 4.1.0) + coffee-rails (~> 4.2) devise faker font-awesome-rails - friendly_id (~> 5.1.0) - icheck-rails - jbuilder (~> 2.0) + friendly_id + jbuilder (~> 2.5) jquery-rails - jquery-turbolinks kaminari - letter_opener + listen (~> 3.0.5) mini_magick pry-byebug - puma - quiet_assets - rails (= 4.2.5) + puma (~> 3.0) + rails (~> 5.0.0, >= 5.0.0.1) + rails_12factor rails_admin (~> 1.0) rails_admin_nestable (~> 0.3.2) rails_admin_rollincode (~> 1.1) - rake (~> 11.1) - react-rails (~> 1.6.0) recaptcha - rename sass-rails (~> 5.0) - sdoc (~> 0.4.0) simple_form + sitemap_generator spring + spring-watcher-listen (~> 2.0.0) sqlite3 - turbolinks + turbolinks (~> 5) + tzinfo-data uglifier (>= 1.3.0) - web-console (~> 2.0) + web-console + whenever wysiwyg-rails BUNDLED WITH - 1.12.5 + 1.13.6 diff --git a/README.md b/README.md index d2bba44..03bb957 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Rails Sandbox +Rails 5 Sandbox ============= Ready to use sandbox, back-end/front-end architecture provided. @@ -7,15 +7,15 @@ Ready to use sandbox, back-end/front-end architecture provided. - Nested sortable models - Image and attachment uploaders - Admin and User accounts configured -- Page handle & seo optimization (friendly_id) +- Seo optimization (friendly_id) - Froala v2 + file and images manager WYSIWYG - Block system on dashboard - ... many others -Page link example with slug +Model link example with slug see friendly_id ```erb -<%= page_path(@page.slug) %> +<%= model_path(@model.slug) %> ``` Notifications @@ -40,5 +40,6 @@ navigation_icon and label_plural are optional ### TODO ### -- [ ] Capistrano initialization +- [] Rails 5 migration +- [X] Capistrano initialization - [X] Clean up diff --git a/Rakefile b/Rakefile index ba6b733..e85f913 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +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__) +require_relative 'config/application' Rails.application.load_tasks diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000..b16e53d --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/images/app_logo.png b/app/assets/images/app_logo.png deleted file mode 100644 index 7e17817..0000000 Binary files a/app/assets/images/app_logo.png and /dev/null differ diff --git a/app/assets/images/main_app_logo.png b/app/assets/images/main_app_logo.png deleted file mode 100644 index 7e17817..0000000 Binary files a/app/assets/images/main_app_logo.png and /dev/null differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c4b9179..e0f03e1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -5,19 +5,21 @@ // 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. +// compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery -//= require jquery.turbolinks //= require jquery_ujs //= require bootstrap -//= require react -//= require react_ujs -//= require components -//= require_tree . //= require turbolinks +//= require_tree . //= stub rails_admin/custom/ui.js //= stub 'ie' + +$(document).on('turbolinks:load', init); + +function init() { + console.log('Code ready to rocks !'); +} diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js new file mode 100644 index 0000000..71ee1e6 --- /dev/null +++ b/app/assets/javascripts/cable.js @@ -0,0 +1,13 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the rails generate channel command. +// +//= require action_cable +//= require_self +//= require_tree ./channels + +(function() { + this.App || (this.App = {}); + + App.cable = ActionCable.createConsumer(); + +}).call(this); diff --git a/app/models/.keep b/app/assets/javascripts/channels/.keep similarity index 100% rename from app/models/.keep rename to app/assets/javascripts/channels/.keep diff --git a/app/assets/javascripts/components.js b/app/assets/javascripts/components.js deleted file mode 100644 index 9ce7a4f..0000000 --- a/app/assets/javascripts/components.js +++ /dev/null @@ -1 +0,0 @@ -//= require_tree ./components diff --git a/app/assets/javascripts/pages.coffee b/app/assets/javascripts/pages.coffee deleted file mode 100644 index 24f83d1..0000000 --- a/app/assets/javascripts/pages.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 875ee6a..8a07f17 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -6,50 +6,51 @@ * 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. + * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS + * files in this directory. Styles in this file should be added after the last require_* statement. + * It is generally better to create a new file per style scope. * - *= required _colors - *= require font-awesome *= require_tree . *= stub rails_admin/custom/theming.scss *= require_self -*/ + */ + @import 'bootstrap-sprockets'; @import 'bootstrap'; @import 'font-awesome'; -@import 'colors'; -@import 'mixins'; -body { - height: 100vh; - color: #FFF; - background: linear-gradient(-20deg, #09b7b9 30%, #1c51a4 100%); -} +$primary: #1abc9c; +$secondary: #2c3e50; -.navbar-brand { - padding-top: 12px; +body { + background: url('https://source.unsplash.com/1920x1080/?landscape') center fixed; + background-size: cover; } -.alert { - z-index: 999; - position: fixed; - border-radius: 0; - border: 0; +.rollinbox { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); color: #fff; - width: 100%; -} - -.alert-info { - background-color: #3498db; } -.alert-success { - background-color: #2ecc71; +.rounded { + width: 150px; + height: 150px; + position: relative; + border: 2px solid $primary; + background: $secondary; + color: #fff; + border-radius: 50%; + padding: 15px; + font-size: 70px; } -.alert-danger { - background-color: #e74c3c; +.icon-centered { + left: 50%; + position: absolute; + top: 50%; + transform: translate(-50%, -50%); } diff --git a/app/assets/stylesheets/devise.scss b/app/assets/stylesheets/devise.scss index 54f3794..751ad3a 100644 --- a/app/assets/stylesheets/devise.scss +++ b/app/assets/stylesheets/devise.scss @@ -15,12 +15,13 @@ *= require_self */ - $primary: #1c2c41; - $secondary: #304158; - $light: #47566c; - $blue: #0C457D; - $grey: #706f6f; - $tertiary: #81C784; + input:-webkit-autofill, + input:-webkit-autofill:active, + input:-webkit-autofill:focus, + input:-webkit-autofill:hover { + transition: background-color 5000s ease-in-out 0s; + -webkit-text-fill-color: #fff !important; + } .devise { font-family: 'Raleway', sans-serif; @@ -36,29 +37,8 @@ } .bckg-dark { - background: linear-gradient(-20deg, #09b7b9 30%, #1c51a4 100%); -} - -.bckg-login { -} - -.logo { - display: inline-block; - margin: 0 auto; - width: 130px; -} - -.app-logo { - margin: 50px 0 25px; - width: 70%; -} - -.bckg-dark-light { - background: $secondary; -} - -.bckg-blue { - background: $blue; + background: url('https://source.unsplash.com/1920x1080/?landscape') center fixed; + background-size: cover; } .centered { @@ -68,91 +48,17 @@ transform: translate(-50%, -50%); } -.login-form-user { - width: 25%; - color: #fff; - margin: 0 auto; - margin-bottom: 25px; - - .content-width { - width: 90%; - padding-top: 1px; - padding-bottom: 1px; - } - - .lost_id { - color: #fff; - margin-bottom: 15px; - display: block; - font-size: .9em; - width: 90%; - } - - .form-actions { - display: inline-block; - width: 90%; - margin-bottom: 10px; - .col-sm-6 { - padding: 0; - } - input { - float: left; - .label { - float: left; - } - } - input[type="checkbox"] { - margin-top: 0; - } - .input-group { - float: left; - } - .checkbox { - margin: 0; - margin-top: 10px; - float: left; - label { - font-size: .8em; - } - } - } - form { - margin-top: 30px; - } - .input-group { - width: 90%; - margin-bottom: 15px; - } - input { - border: 0; - } - input[type="submit"] { - background: $grey; - border: 0; - border-radius: 0; - cursor: pointer; - float: right; - color: white; - } - h2 { - background: $grey; - display: block; - padding: 10px 15px; - text-align: left; - font-size: 1.3em; - } -} - .login-form { + background: #1c2c41; color: #fff; width: 30%; .links-form { a { - color: $light; + color: #47566c; text-decoration: none; &:hover { - color: $light; + color: #47566c; } } } @@ -189,7 +95,7 @@ input[type="submit"] { cursor: pointer; - background: $tertiary; + background: #304158; color: #fff; border-radius: 3px; border: 0; @@ -199,23 +105,24 @@ margin-bottom: 45px; margin-top: 55px; &:hover { - background: darken($tertiary, 5%); + background: darken(#304158, 5%); } } input[type="text"], input[type="email"], input[type="password"] { background-color: transparent; border: 0; - border-bottom: 1px solid $light; + border-bottom: 1px solid #47566c; color: #fff; margin-top: 15px; padding-bottom: 15px; + width: 100%; } .input-group-addon { background-color: transparent; border: 0; - border-bottom: 1px solid $light; + border-bottom: 1px solid #47566c; color: #fff; margin-top: 15px; padding-bottom: 15px; diff --git a/app/assets/stylesheets/flash_messages.scss b/app/assets/stylesheets/flash_messages.scss new file mode 100644 index 0000000..7c3cd45 --- /dev/null +++ b/app/assets/stylesheets/flash_messages.scss @@ -0,0 +1,24 @@ +.alert { + z-index: 999; + position: fixed; + border-radius: 0; + border: 0; + color: #fff; + width: 100%; +} + +.alert-info { + background-color: #3498db; +} + +.alert-warning { + background-color: #f1c40f; +} + +.alert-success { + background-color: #2ecc71; +} + +.alert-danger { + background-color: #e74c3c; +} diff --git a/app/assets/stylesheets/mixins.scss b/app/assets/stylesheets/mixins.scss deleted file mode 100644 index 17c1747..0000000 --- a/app/assets/stylesheets/mixins.scss +++ /dev/null @@ -1,18 +0,0 @@ -@mixin transition($time) { - -webkit-transition: all $time ease-in; - -moz-transition: all $time ease-in; - -o-transition: all $time ease-in; - transition: all $time ease-in; -} - -@mixin lol() { - .row { - display: table; - } - - [class*="col-"] { - float: none; - display: table-cell; - vertical-align: top; - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/pages.scss b/app/assets/stylesheets/pages.scss deleted file mode 100644 index 0d6878a..0000000 --- a/app/assets/stylesheets/pages.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the pages controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/rails_admin/custom/theming.scss b/app/assets/stylesheets/rails_admin/custom/theming.scss index ffa80d8..29a3ab8 100644 --- a/app/assets/stylesheets/rails_admin/custom/theming.scss +++ b/app/assets/stylesheets/rails_admin/custom/theming.scss @@ -2,7 +2,6 @@ *= require froala_editor.min.css *= require froala_style.min.css */ - @import 'froala_editor.min'; @import 'froala_style.min'; @import 'plugins/char_counter.min'; @@ -19,37 +18,41 @@ @import 'plugins/table.min'; @import 'plugins/video.min'; @import 'font-awesome'; -@import 'icheck/flat/all'; - -$RAprimary: #1c2c41; -$RAgreen: #37BC9B; -$RAblue: #3BAFDA; -$RAred: #E9573F; -$RAyellow: #F6BB42; +$ra-primary: #1c2c41; +$ra-green: #37bc9b; +$ra-blue: #3bafda; +$ra-red: #e9573f; +$ra-yellow: #f6bb42; body { background: rgb(59, 78, 89); } .page-header.dashboard { - border-color: $RAprimary; + border-color: $ra-primary; } .breadcrumb { - background: $RAblue; - .false a, .false:before { - color: darken($RAblue, 30%) !important; + background: $ra-blue; + + .false a, + .false:before { + color: darken($ra-blue, 30%) !important; } - .active, .active:before { - color: #FFF; + + .active, + .active:before { + color: #fff; } } .table-striped { - border-top-color: $RAblue; + border-top-color: $ra-blue; + .links ul li { padding-right: 0; + a { border-radius: 50%; } @@ -57,82 +60,93 @@ body { } .content { - margin: 20px 0 15px 0; + margin: 20px 0 15px; padding: 8px; + &.dashboard { background: rgb(59, 78, 89); } } a.delete { - color: #FFF; + color: #fff; } .box { padding: 15px; margin-bottom: 30px; - border: 1px solid $RAprimary; + border: 1px solid $ra-primary; position: relative; min-height: 170px; - transition: all 0.3s ease; - color: rgba(255,255,255,0.7); + transition: all .3s ease; + color: rgba(255, 255, 255, .7); overflow: hidden; - &:hover, &:focus { - border-color: #FFF; + + &:focus, + &:hover { + border-color: #fff; + .icon-bg { transform: scale(1.5) rotate(20deg); } } + p { min-height: 30px; font-size: 15px; font-weight: 600; + a.btn { - border-radius: 3px; - color: rgba(255,255,255,0.7) !important; + border-radius: 4px; + color: rgba(255, 255, 255, 0.7) !important; display: inline-block; margin-bottom: 0; font-weight: normal; text-align: center; vertical-align: middle; cursor: pointer; - background-color: rgba(0, 0, 0, 0.19); + background-color: rgba(0, 0, 0, .19); border: 1px solid transparent; white-space: nowrap; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; - border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } } + strong { font-size: 36px; font-weight: 600; } + .icon-bg { position: absolute; right: 0; bottom: 0; font-size: 100px; color: #000; - opacity: 0.08; + opacity: .08; filter: alpha(opacity=8); transition: all 1s ease; } + &.bg-info { - background-color: $RAblue; + background-color: $ra-blue; } + &.bg-success { - background-color: $RAgreen; + background-color: $ra-green; } + &.bg-warning { - background-color: $RAyellow; + background-color: $ra-yellow; } + &.bg-danger { - background-color: $RAred; + background-color: $ra-red; } } diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb new file mode 100644 index 0000000..d672697 --- /dev/null +++ b/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb new file mode 100644 index 0000000..0ff5442 --- /dev/null +++ b/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8065d9..b8f5255 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,11 @@ class ApplicationController < ActionController::Base - protect_from_forgery + protect_from_forgery with: :exception + before_action :load_layout_data + +private + + def load_layout_data + @seo_title = Parameter.find_by_code('DEFAULT_SEO_TITLE') + @seo_description = Parameter.find_by_code('DEFAULT_SEO_DESCRIPTION') + end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb deleted file mode 100644 index 410d072..0000000 --- a/app/controllers/home_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class HomeController < ApplicationController - - def index - end -end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb deleted file mode 100644 index 2532e57..0000000 --- a/app/controllers/pages_controller.rb +++ /dev/null @@ -1,14 +0,0 @@ -class PagesController < ApplicationController - before_filter :find_page - - def show - @page = Page.friendly.find params[:id] - end - - def find_page - @page = Page.friendly.find params[:id] - if request.path != page_path(@page) - return redirect_to @page, status: :moved_permanently - end - end -end diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb new file mode 100644 index 0000000..3d71b98 --- /dev/null +++ b/app/controllers/site_controller.rb @@ -0,0 +1,4 @@ +class SiteController < ApplicationController + def index + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a59d0e0..f7d0d53 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,12 @@ module ApplicationHelper + def title(title) + content_for(:title) { title } + end + + def meta_description(meta_description) + content_for(:meta_description) { meta_description } + end + def bootstrap_class_for(flash_type) case flash_type when 'success' diff --git a/app/helpers/froala_helper.rb b/app/helpers/froala_helper.rb deleted file mode 100644 index d122f62..0000000 --- a/app/helpers/froala_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module FroalaHelper -end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb deleted file mode 100644 index 23de56a..0000000 --- a/app/helpers/home_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module HomeHelper -end diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb deleted file mode 100644 index 2c057fd..0000000 --- a/app/helpers/pages_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PagesHelper -end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000..a009ace --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index d25d889..286b223 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,4 @@ class ApplicationMailer < ActionMailer::Base - default from: "from@example.com" + default from: 'from@example.com' layout 'mailer' end diff --git a/app/models/admin.rb b/app/models/admin.rb index 4acea39..61b5567 100644 --- a/app/models/admin.rb +++ b/app/models/admin.rb @@ -1,28 +1,4 @@ -# == Schema Information -# -# Table name: admins -# -# id :integer not null, primary key -# email :string default(""), not null -# encrypted_password :string default(""), not null -# reset_password_token :string -# reset_password_sent_at :datetime -# remember_created_at :datetime -# sign_in_count :integer default("0"), not null -# current_sign_in_at :datetime -# last_sign_in_at :datetime -# current_sign_in_ip :string -# last_sign_in_ip :string -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_admins_on_email (email) UNIQUE -# index_admins_on_reset_password_token (reset_password_token) UNIQUE -# - -class Admin < ActiveRecord::Base +class Admin < ApplicationRecord include RailsAdmin::AdminAdmin # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000..10a4cba --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/concerns/rails_admin/.DS_Store b/app/models/concerns/rails_admin/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/app/models/concerns/rails_admin/.DS_Store differ diff --git a/app/models/concerns/rails_admin/admin_admin.rb b/app/models/concerns/rails_admin/admin_admin.rb index 941dba0..7a614ec 100644 --- a/app/models/concerns/rails_admin/admin_admin.rb +++ b/app/models/concerns/rails_admin/admin_admin.rb @@ -6,7 +6,6 @@ module RailsAdmin::AdminAdmin navigation_label 'Admins' navigation_icon 'fa fa-user-secret' label_plural 'Admins' - parent User edit do end diff --git a/app/models/concerns/rails_admin/content_admin.rb b/app/models/concerns/rails_admin/content_admin.rb index 263464b..22e628b 100644 --- a/app/models/concerns/rails_admin/content_admin.rb +++ b/app/models/concerns/rails_admin/content_admin.rb @@ -6,6 +6,7 @@ module RailsAdmin::ContentAdmin navigation_label 'Content' navigation_icon 'fa fa-pencil-square-o' label_plural 'Contents' + weight -1 edit do field :code diff --git a/app/models/concerns/rails_admin/page_admin.rb b/app/models/concerns/rails_admin/page_admin.rb deleted file mode 100644 index 9f203f1..0000000 --- a/app/models/concerns/rails_admin/page_admin.rb +++ /dev/null @@ -1,58 +0,0 @@ -module RailsAdmin::PageAdmin - extend ActiveSupport::Concern - - included do - rails_admin do - navigation_label 'Page' - navigation_icon 'fa fa-book' - label_plural 'Pages' - nestable_tree(position_field: :position, - max_depth: 4) - - edit do - field :title - field :content, :froala do - config_options do - { - imageUploadURL: '/froala_upload', - imageUploadParam: 'file', - imageUploadParams: { - type: 'image', - model: 'page', - }, - fileUploadURL: '/froala_upload', - fileUploadParam: 'file', - fileUploadParams: { - type: 'file', - model: 'page', - }, - imageManagerLoadMethod: 'POST', - imageManagerLoadURL: '/froala_manage', - imageManagerLoadParams: { - model: 'page', - format: 'json', - }, - imageManagerDeleteMethod: 'DELETE', - imageManagerDeleteURL: '/froala_delete', - imageManagerDeleteParams: { - model: 'page', - format: 'json', - }, - } - end - end - field :seo do - active true - required true - end - end - - show do - end - - list do - exclude_fields :created_at, :updated_at, :content, :position, :ancestry - end - end - end -end diff --git a/app/models/concerns/rails_admin/seo_admin.rb b/app/models/concerns/rails_admin/seo_admin.rb index 71dd95c..ed62ed4 100644 --- a/app/models/concerns/rails_admin/seo_admin.rb +++ b/app/models/concerns/rails_admin/seo_admin.rb @@ -3,8 +3,7 @@ module RailsAdmin::SeoAdmin included do rails_admin do - navigation_label 'SEO' - navigation_icon 'fa fa-info-circle' + navigation_icon 'fa fa-google' parent Content edit do diff --git a/app/models/content.rb b/app/models/content.rb index a9e017e..7f9d756 100644 --- a/app/models/content.rb +++ b/app/models/content.rb @@ -1,20 +1,6 @@ -# == Schema Information -# -# Table name: contents -# -# id :integer not null, primary key -# code :string not null -# content :text not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_contents_on_code (code) UNIQUE -# - -class Content < ActiveRecord::Base +class Content < ApplicationRecord include RailsAdmin::ContentAdmin - validates_presence_of :code + validates_presence_of :code, :content + validates_uniqueness_of :code end diff --git a/app/models/page.rb b/app/models/page.rb deleted file mode 100644 index 3944e42..0000000 --- a/app/models/page.rb +++ /dev/null @@ -1,40 +0,0 @@ -# == Schema Information -# -# Table name: pages -# -# id :integer not null, primary key -# title :string not null -# code :string -# content :text not null -# position :integer -# created_at :datetime not null -# updated_at :datetime not null -# ancestry :string -# slug :string -# -# Indexes -# -# index_pages_on_ancestry (ancestry) -# index_pages_on_code (code) -# - -class Page < ActiveRecord::Base - extend FriendlyId - include RailsAdmin::PageAdmin - - has_one :seo, dependent: :destroy - has_ancestry - friendly_id :title, use: :history - - accepts_nested_attributes_for :seo, allow_destroy: true - - validates_presence_of :title - - def seo_id - self.seo.try :id - end - - def draft_id=(id) - self.seo = Seo.find_by_id(id) - end -end diff --git a/app/models/parameter.rb b/app/models/parameter.rb index 3be3d09..8780ac5 100644 --- a/app/models/parameter.rb +++ b/app/models/parameter.rb @@ -1,18 +1,6 @@ -# == Schema Information -# -# Table name: parameters -# -# id :integer not null, primary key -# code :string not null -# value :string not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_parameters_on_code (code) UNIQUE -# - -class Parameter < ActiveRecord::Base +class Parameter < ApplicationRecord include RailsAdmin::ParameterAdmin + + validates_presence_of :code, :value + validates_uniqueness_of :code end diff --git a/app/models/seo.rb b/app/models/seo.rb index 2630619..4c71a03 100644 --- a/app/models/seo.rb +++ b/app/models/seo.rb @@ -1,20 +1,5 @@ -# == Schema Information -# -# Table name: seos -# -# id :integer not null, primary key -# title :string not null -# description :text not null -# page_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_seos_on_page_id (page_id) -# - -class Seo < ActiveRecord::Base +class Seo < ApplicationRecord include RailsAdmin::SeoAdmin - belongs_to :page + + validates_presence_of :title, :description end diff --git a/app/models/user.rb b/app/models/user.rb index c1ff5d4..9629dc2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,34 +1,7 @@ -# == Schema Information -# -# Table name: users -# -# id :integer not null, primary key -# email :string default(""), not null -# encrypted_password :string default(""), not null -# reset_password_token :string -# reset_password_sent_at :datetime -# remember_created_at :datetime -# sign_in_count :integer default("0"), not null -# current_sign_in_at :datetime -# last_sign_in_at :datetime -# current_sign_in_ip :string -# last_sign_in_ip :string -# adress :text -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_users_on_email (email) UNIQUE -# index_users_on_reset_password_token (reset_password_token) UNIQUE -# - -class User < ActiveRecord::Base +class User < ApplicationRecord include RailsAdmin::UserAdmin - # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable - devise :database_authenticatable, + devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable - end diff --git a/app/uploaders/froala_uploader.rb b/app/uploaders/froala_uploader.rb index 2c8abbd..67c6c8e 100644 --- a/app/uploaders/froala_uploader.rb +++ b/app/uploaders/froala_uploader.rb @@ -4,5 +4,4 @@ class FroalaUploader < CarrierWave::Uploader::Base def store_dir "uploads/froala/#{model}/#{mounted_as}" end - end diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index 9d7d27c..e8a7fd5 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -7,20 +7,25 @@ def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end - #version :example, if: :is_example? do - #process :resize_to_fill => [200, 150] - #end + version :post_thumb, if: :post? do + process resize_to_fill: [50, 50] + end + + version :post, if: :post? do + process resize_to_fill: [600, 450] + end def extension_white_list %w(jpg jpeg gif png) end - + def content_type_whitelist /image\// end - protected - #def is_example?(picture) - # model.kind_of?(ExampleModel) - #end +protected + + def post?(_picture) + model.is_a?(Post) + end end diff --git a/app/views/devise/menu/_login_items.html.erb b/app/views/devise/menu/_login_items.html.erb deleted file mode 100644 index b917e93..0000000 --- a/app/views/devise/menu/_login_items.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% if user_signed_in? %> -
  • - <%= link_to destroy_user_session_path, :method => :delete do %> - Se déconnecter - <% end %> -
  • -<% end %> \ No newline at end of file diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb deleted file mode 100644 index fbaec91..0000000 --- a/app/views/home/index.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -
    -
    -

    <%= fa_icon 'rocket' %> Rollinbox

    -
    -
    diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb deleted file mode 100644 index bf23ff0..0000000 --- a/app/views/kaminari/_first_page.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
  • - <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> -
  • diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb deleted file mode 100644 index 6d3a149..0000000 --- a/app/views/kaminari/_gap.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
  • - <%= content_tag :a, raw(t 'views.pagination.truncate') %> -
  • diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb deleted file mode 100644 index fb619ea..0000000 --- a/app/views/kaminari/_last_page.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
  • - <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %> -
  • diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb deleted file mode 100644 index 15e10e4..0000000 --- a/app/views/kaminari/_next_page.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
  • - <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> -
  • diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb deleted file mode 100644 index 8028b45..0000000 --- a/app/views/kaminari/_page.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<% if page.current? %> -
  • - <%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %> -
  • -<% else %> -
  • - <%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %> -
  • -<% end %> diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb deleted file mode 100644 index 2c8757b..0000000 --- a/app/views/kaminari/_paginator.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<%= paginator.render do -%> - -<% end -%> diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb deleted file mode 100644 index d94a50a..0000000 --- a/app/views/kaminari/_prev_page.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
  • - <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %> -
  • diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb deleted file mode 100644 index 325e5c5..0000000 --- a/app/views/layouts/_header.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'layouts/menu' %> diff --git a/app/views/layouts/_menu.html.erb b/app/views/layouts/_menu.html.erb deleted file mode 100644 index 8a84af6..0000000 --- a/app/views/layouts/_menu.html.erb +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 42123ed..b8e4862 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,29 +1,32 @@ - - - - - APP TITLE - - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - - - + + + + <% if yield(:title).present? %> + <%= yield(:title) %> + <% else %> + <%= @seo_title.value %> + <% end %> + + <% if yield(:meta_description).present? %> + + <% else %> + + <% end %> + <%= csrf_meta_tags %> -<%= render partial: 'shared/flash_messages', flash: flash %> + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> -<%= render 'layouts/header' %> + + + -
    - <%= yield %> -
    + + <%= render partial: 'shared/flash_messages', flash: flash %> -<%= render 'layouts/footer' %> - - + <%= yield %> + diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb index 4b024f5..c5854f5 100644 --- a/app/views/layouts/devise.html.erb +++ b/app/views/layouts/devise.html.erb @@ -2,7 +2,7 @@ - APP TITLE + Administration <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 3edcd7a..cbd34d2 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,6 +1,13 @@ - + - + + + + + + <%= yield %> diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb new file mode 100644 index 0000000..d21ca0c --- /dev/null +++ b/app/views/site/index.html.erb @@ -0,0 +1,7 @@ +
    +
    +
    + +
    +
    +
    diff --git a/app/views/users/confirmations/new.html.erb b/app/views/users/confirmations/new.html.erb deleted file mode 100644 index 52e6252..0000000 --- a/app/views/users/confirmations/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

    Resend confirmation instructions

    - -<%= 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 %> - -
    - <%= f.input :email, required: true, autofocus: true %> -
    - -
    - <%= f.button :submit, "Resend confirmation instructions" %> -
    -<% end %> - -<%= render "users/shared/links" %> diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb deleted file mode 100644 index dc55f64..0000000 --- a/app/views/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/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb deleted file mode 100644 index b41daf4..0000000 --- a/app/views/users/mailer/password_change.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -

    Hello <%= @resource.email %>!

    - -

    We're contacting you to notify you that your password has been changed.

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb deleted file mode 100644 index f667dc1..0000000 --- a/app/views/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/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb deleted file mode 100644 index 41e148b..0000000 --- a/app/views/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/app/views/users/passwords/edit.html.erb b/app/views/users/passwords/edit.html.erb deleted file mode 100644 index 3a69792..0000000 --- a/app/views/users/passwords/edit.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -

    Change your password

    - -<%= 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 %> - -
    - <%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %> - <%= f.input :password_confirmation, label: "Confirm your new password", required: true %> -
    - -
    - <%= f.button :submit, "Change my password" %> -
    -<% end %> - -<%= render "users/shared/links" %> diff --git a/app/views/users/passwords/new.html.erb b/app/views/users/passwords/new.html.erb deleted file mode 100644 index bd50b25..0000000 --- a/app/views/users/passwords/new.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

    Forgot your password?

    - -<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= f.error_notification %> - -
    - <%= f.input :email, required: true, autofocus: true %> -
    - -
    - <%= f.button :submit, "Send me reset password instructions" %> -
    -<% end %> - -<%= render "users/shared/links" %> diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb deleted file mode 100644 index 5db350b..0000000 --- a/app/views/users/registrations/edit.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -

    Edit <%= resource_name.to_s.humanize %>

    - -<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= f.error_notification %> - -
    - <%= f.input :email, required: true, autofocus: true %> - - <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -

    Currently waiting confirmation for: <%= resource.unconfirmed_email %>

    - <% end %> - - <%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %> - <%= f.input :password_confirmation, required: false %> - <%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %> -
    - -
    - <%= f.button :submit, "Update" %> -
    -<% end %> - -

    Cancel my account

    - -

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

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

    Sign up

    - -<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= f.error_notification %> - -
    - <%= f.input :email, required: true, autofocus: true %> - <%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %> - <%= f.input :password_confirmation, required: true %> -
    - -
    - <%= f.button :submit, "Sign up" %> -
    -<% end %> - -<%= render "users/shared/links" %> diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb deleted file mode 100644 index 30ce336..0000000 --- a/app/views/users/sessions/new.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -
    -
    - -
    - -
    -
    -
    \ No newline at end of file diff --git a/app/views/users/shared/_links.html.erb b/app/views/users/shared/_links.html.erb deleted file mode 100644 index 2923dc2..0000000 --- a/app/views/users/shared/_links.html.erb +++ /dev/null @@ -1,26 +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 #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %> -
    - <% end %> -<% end %> diff --git a/app/views/users/unlocks/new.html.erb b/app/views/users/unlocks/new.html.erb deleted file mode 100644 index 9fa02cf..0000000 --- a/app/views/users/unlocks/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

    Resend unlock instructions

    - -<%= 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 %> - -
    - <%= f.input :email, required: true, autofocus: true %> -
    - -
    - <%= f.button :submit, "Resend unlock instructions" %> -
    -<% end %> - -<%= render "users/shared/links" %> diff --git a/bin/rails b/bin/rails index 0138d79..5badb2f 100755 --- a/bin/rails +++ b/bin/rails @@ -4,6 +4,6 @@ begin rescue LoadError => e raise unless e.message.include?('spring') end -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup index acdb2c1..e620b4d 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,34 @@ #!/usr/bin/env ruby require 'pathname' +require 'fileutils' +include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) -Dir.chdir APP_ROOT do +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do # This script is a starting point to setup your application. - # Add necessary setup steps to this file: + # Add necessary setup steps to this file. - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system "bin/rake db:setup" + system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" + system! 'bin/rails restart' end diff --git a/bin/spring b/bin/spring index 7fe232c..9bc076b 100755 --- a/bin/spring +++ b/bin/spring @@ -7,9 +7,10 @@ unless defined?(Spring) require 'rubygems' require 'bundler' - if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) - Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } - gem 'spring', match[1] + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + if spring = lockfile.specs.detect { |spec| spec.name == "spring" } + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version require 'spring/binstub' end end diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..a8e4462 --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/config.ru b/config.ru index 253d04d..f7ba0b5 100644 --- a/config.ru +++ b/config.ru @@ -1,2 +1,5 @@ -require ::File.expand_path('../config/environment', __FILE__) +# This file is used by Rack-based servers to start the application. + +require_relative 'config/environment' + run Rails.application diff --git a/config/application.rb b/config/application.rb index 59cefb2..6b7e8e1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,16 +1,6 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' -require "rails" -# Pick the frameworks you want: -require "active_model/railtie" -require "active_job/railtie" -require "active_record/railtie" -require "action_controller/railtie" -require "action_mailer/railtie" -require "action_view/railtie" -require "sprockets/railtie" - -# require "rails/test_unit/railtie" +require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -23,22 +13,12 @@ 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. + config.i18n.default_locale = :en - # 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 = :fr - - # Do not swallow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true - config.assets.paths << Rails.root.join('vendor', 'assets', 'images') config.to_prepare do - Devise::SessionsController.layout "devise" + Devise::SessionsController.layout 'devise' end end end diff --git a/config/boot.rb b/config/boot.rb index 6b750f0..30f5120 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,3 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..0bbde6f --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,9 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 diff --git a/config/database.yml b/config/database.yml index 2d80564..1c1a37c 100644 --- a/config/database.yml +++ b/config/database.yml @@ -22,10 +22,4 @@ test: production: <<: *default - adapter: postgresql - encoding: unicode - host: <%= ENV["DATABASE_HOST"] %> - database: <%= ENV["DATABASE_NAME"] %> - pool: 5 - username: <%= ENV["DATABASE_USERNAME"] %> - password: <%= ENV["DATABASE_PASSWORD"] %> + database: db/production.sqlite3 diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..ccbf53f --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,43 @@ +# config valid only for current version of Capistrano +lock '3.6.1' + +set :application, 'my_app_name' +set :repo_url, 'git@example.com:me/my_repo.git' +set :deploy_to, '/home/project/www' + +append :linked_files, 'config/database.yml', 'config/secrets.yml' +set :linked_dirs, %w(bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads) + +set :keep_releases, 1 +after 'deploy:publishing', 'passenger:restart' + +# Default branch is :master +# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp + +# Default deploy_to directory is /var/www/my_app_name +# set :deploy_to, '/var/www/my_app_name' + +# Default value for :scm is :git +# set :scm, :git + +# Default value for :format is :airbrussh. +# set :format, :airbrussh + +# You can configure the Airbrussh format using :format_options. +# These are the defaults. +# set :format_options, command_output: true, log_file: 'log/capistrano.log', color: :auto, truncate: :auto + +# Default value for :pty is false +# set :pty, true + +# Default value for :linked_files is [] +# append :linked_files, 'config/database.yml', 'config/secrets.yml' + +# Default value for linked_dirs is [] +# append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system' + +# Default value for default_env is {} +# set :default_env, { path: "/opt/ruby/bin:$PATH" } + +# Default value for keep_releases is 5 +# set :keep_releases, 5 diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 0000000..4fc06fa --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,61 @@ +# server-based syntax +# ====================== +# 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 'db.example.com', user: 'deploy', roles: %w{db} + + + +# 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. + + + +# Custom SSH Options +# ================== +# You may pass any option but keep in mind that net/ssh understands a +# 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, { +# keys: %w(/home/rlisowski/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(password) +# } +# +# The server-based syntax can be used to override options: +# ------------------------------------ +# server 'example.com', +# user: 'user_name', +# roles: %w{web app}, +# ssh_options: { +# user: 'user_name', # overrides user setting above +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(publickey password) +# # password: 'please use keys' +# } diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb new file mode 100644 index 0000000..4fc06fa --- /dev/null +++ b/config/deploy/staging.rb @@ -0,0 +1,61 @@ +# server-based syntax +# ====================== +# 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 'db.example.com', user: 'deploy', roles: %w{db} + + + +# 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. + + + +# Custom SSH Options +# ================== +# You may pass any option but keep in mind that net/ssh understands a +# 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, { +# keys: %w(/home/rlisowski/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(password) +# } +# +# The server-based syntax can be used to override options: +# ------------------------------------ +# server 'example.com', +# user: 'user_name', +# roles: %w{web app}, +# ssh_options: { +# user: 'user_name', # overrides user setting above +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(publickey password) +# # password: 'please use keys' +# } diff --git a/config/environment.rb b/config/environment.rb index 9c98239..426333b 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! - -require 'carrierwave/orm/activerecord' diff --git a/config/environments/development.rb b/config/environments/development.rb index 8c1d8f1..e7a87b8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -9,13 +9,28 @@ # 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 + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=172800' + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + config.action_mailer.perform_caching = false + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -27,22 +42,20 @@ # 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 + # Suppress logger output for asset requests. + config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker + # Devise - config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } - + config.action_mailer.default_url_options = {host: 'localhost', port: 3000} + # Mailcatcher config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 } + config.action_mailer.smtp_settings = {address: 'localhost', port: 1025} end diff --git a/config/environments/production.rb b/config/environments/production.rb index b17f780..309d626 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,15 +14,9 @@ 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? + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -31,16 +25,20 @@ # 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 + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + # 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 + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true @@ -49,16 +47,15 @@ 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) + config.log_tags = [ :request_id ] # 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' + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "rollinbox_#{Rails.env}" + config.action_mailer.perform_caching = false # 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. @@ -74,8 +71,16 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - - config.action_mailer.delivery_method = :sendmail end diff --git a/config/environments/test.rb b/config/environments/test.rb index 1c19f08..30587ef 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,9 +12,11 @@ # 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' + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=3600' + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -25,15 +27,13 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = 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 diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000..51639b6 --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index bc7abf6..3d74144 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,4 +9,5 @@ # 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 ) -Rails.application.config.assets.precompile += %w( ie.js ) + +Rails.application.config.assets.precompile += %w(ie.js) diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7f70458..5a6a32d 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 8de4202..3cf406e 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -4,9 +4,9 @@ # 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` + # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. - config.secret_key = '<%= ENV["SECRET_KEY_BASE"] %>' + # config.secret_key = '0503a48e545de2e433b8d3b77da0cc888cec5025a871bac08754e2b3789b7a1e267b3e7a6b63f101974c1cec726c104808b9b8db77e380a210524932675394f0' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, @@ -17,6 +17,9 @@ # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' + # Configure the parent class responsible to send e-mails. + # config.parent_mailer = 'ActionMailer::Base' + # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be @@ -87,19 +90,25 @@ # from the server. You can disable this option at your own risk. # config.clean_up_csrf_token_on_authentication = true + # When false, Devise will not attempt to reload routes on eager load. + # This can reduce the time taken to boot the app but if your application + # requires the Devise mappings to be loaded during boot time the application + # won't boot properly. + # config.reload_routes = 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. + # For bcrypt, this is the cost for hashing the password and defaults to 11. If + # using other algorithms, it sets how many times you want the password to be hashed. # # 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. + # algorithm), 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 + config.stretches = Rails.env.test? ? 1 : 11 - # Setup a pepper to generate the encrypted password. - # config.pepper = '7d21df87b56ac2fb6dc3efbca0fa14204f97f0e3951878dc3b5d5f7c3ec49acae06d2849881b109f696ea782fcb6f87f12de6fc5527582cde7bebe314e926ed9' + # Set up a pepper to generate the hashed password. + # config.pepper = 'e4d24decca0c0472c1868617325aeed136df6a5b4e4e9918c264ae83aea200c826441f071d61582e3f4cf17b64693621c4ea263f3d74aca0147bb5a12af40efc' # Send a notification email when the user's password is changed # config.send_password_change_notification = false @@ -145,12 +154,12 @@ # ==> Configuration for :validatable # Range for password length. - config.password_length = 8..72 + config.password_length = 6..128 # 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/ + config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this @@ -198,11 +207,11 @@ # 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). + # Allow you to use another hashing or encryption algorithm besides bcrypt (default). + # You can use :sha1, :sha512 or algorithms 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 diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb deleted file mode 100644 index b1d87b0..0000000 --- a/config/initializers/kaminari_config.rb +++ /dev/null @@ -1,10 +0,0 @@ -Kaminari.configure do |config| - # config.default_per_page = 25 - # config.max_per_page = nil - # config.window = 4 - # config.outer_window = 0 - # config.left = 0 - # config.right = 0 - # config.page_method_name = :page - # config.param_name = :page -end diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb new file mode 100644 index 0000000..0706caf --- /dev/null +++ b/config/initializers/new_framework_defaults.rb @@ -0,0 +1,24 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Read the Rails 5.0 release notes for more info on each option. + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = true + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = true + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = true + +# Require `belongs_to` associations by default. Previous versions had false. +Rails.application.config.active_record.belongs_to_required_by_default = true + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = false + +# Configure SSL options to enable HSTS with subdomains. Previous versions had false. +Rails.application.config.ssl_options = { hsts: { subdomains: true } } diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb index 73ce6ad..27e5e30 100644 --- a/config/initializers/rails_admin.rb +++ b/config/initializers/rails_admin.rb @@ -30,11 +30,11 @@ delete ## With an audit adapter, you can add: - #history_index - #history_show + # history_index + # history_show nestable end - config.main_app_name = ['APP-TITLE', ''] + config.main_app_name = ['Rollinbox', ''] end diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index ca9e97c..e465e50 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: '_rollincodesandbox_session' +Rails.application.config.session_store :cookie_store, key: '_rollinbox_session' diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index de558c6..934487a 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -97,7 +97,7 @@ # config.item_wrapper_class = nil # How the label text should be generated altogether with the required text. - config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" } + # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil @@ -117,7 +117,7 @@ # in this configuration, which is recommended due to some quirks from different browsers. # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, # change this configuration to true. - config.browser_validations = true + config.browser_validations = false # Collection of methods to detect if a file type was given. # config.file_methods = [ :mounted_as, :file?, :public_filename ] @@ -125,7 +125,7 @@ # Custom mappings for input types. This should be a hash containing a regexp # to match as key, and the input type that will be used when the field name # matches the regexp as value. - config.input_mappings = { /country/ => :string } + # config.input_mappings = { /count/ => :integer } # Custom wrappers for input types. This should be a hash containing an input # type as key and the wrapper that will be used for all inputs with specified type. diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb deleted file mode 100644 index 6ca0ccb..0000000 --- a/config/initializers/simple_form_bootstrap.rb +++ /dev/null @@ -1,172 +0,0 @@ -# Use this setup block to configure all options available in SimpleForm. -SimpleForm.setup do |config| - config.error_notification_class = 'alert alert-danger' - config.button_class = 'btn btn-default' - config.boolean_label_class = nil - - config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.use :placeholder - b.optional :maxlength - b.optional :pattern - b.optional :min_max - b.optional :readonly - b.use :label, class: 'control-label' - - b.use :input, class: 'form-control' - b.use :error, wrap_with: { tag: 'span', class: 'help-block' } - b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - - config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.use :placeholder - b.optional :maxlength - b.optional :readonly - b.use :label, class: 'control-label' - - b.use :input - b.use :error, wrap_with: { tag: 'span', class: 'help-block' } - b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - - config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.optional :readonly - - b.wrapper tag: 'div', class: 'checkbox' do |ba| - ba.use :label_input - end - - b.use :error, wrap_with: { tag: 'span', class: 'help-block' } - b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - - config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.optional :readonly - b.use :label, class: 'control-label' - b.use :input - b.use :error, wrap_with: { tag: 'span', class: 'help-block' } - b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - - config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.use :placeholder - b.optional :maxlength - b.optional :pattern - b.optional :min_max - b.optional :readonly - b.use :label, class: 'col-sm-3 control-label' - - b.wrapper tag: 'div', class: 'col-sm-9' do |ba| - ba.use :input, class: 'form-control' - ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } - ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - end - - config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.use :placeholder - b.optional :maxlength - b.optional :readonly - b.use :label, class: 'col-sm-3 control-label' - - b.wrapper tag: 'div', class: 'col-sm-9' do |ba| - ba.use :input - ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } - ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - end - - config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.optional :readonly - - b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr| - wr.wrapper tag: 'div', class: 'checkbox' do |ba| - ba.use :label_input - end - - wr.use :error, wrap_with: { tag: 'span', class: 'help-block' } - wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - end - - config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.optional :readonly - - b.use :label, class: 'col-sm-3 control-label' - - b.wrapper tag: 'div', class: 'col-sm-9' do |ba| - ba.use :input - ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } - ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - end - - config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.use :placeholder - b.optional :maxlength - b.optional :pattern - b.optional :min_max - b.optional :readonly - b.use :label, class: 'sr-only' - - b.use :input, class: 'form-control' - b.use :error, wrap_with: { tag: 'span', class: 'help-block' } - b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - - config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| - b.use :html5 - b.optional :readonly - b.use :label, class: 'control-label' - b.wrapper tag: 'div', class: 'form-inline' do |ba| - ba.use :input, class: 'form-control' - ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } - ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - end - # Wrappers for forms and inputs using the Bootstrap toolkit. - # Check the Bootstrap docs (http://getbootstrap.com) - # to learn about the different styles for forms and inputs, - # buttons and other elements. - config.default_wrapper = :vertical_form - config.wrapper_mappings = { - check_boxes: :vertical_radio_and_checkboxes, - radio_buttons: :vertical_radio_and_checkboxes, - file: :vertical_file_input, - boolean: :vertical_boolean, - datetime: :multi_select, - date: :multi_select, - time: :multi_select - } - - 1.upto(12) do |col| - config.wrappers "inline_field#{col}".to_sym, tag: 'div', class: "col-sm-#{col}", error_class: 'has-error' do |ic| - ic.use :html5 - ic.use :placeholder - ic.use :label, class: 'sr-only' - ic.use :input, class: 'form-control' - ic.use :error, wrap_with: { tag: 'span', class: 'help-block' } - ic.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - - config.wrappers "inline_bool#{col}".to_sym, tag: 'div', class: "col-sm-#{col}", error_class: 'has-error' do |ib| - ib.use :html5 - ib.optional :readonly - - ib.wrapper tag: 'div', class: 'checkbox' do |ba| - ba.use :input - ba.use :label - end - ib.use :error, wrap_with: { tag: 'span', class: 'help-block' } - ib.use :hint, wrap_with: { tag: 'p', class: 'help-block' } - end - end -end diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e9..bbfc396 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,10 +5,10 @@ # 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) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 9e54fb7..bd4c3eb 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -1,3 +1,5 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + en: devise: confirmations: diff --git a/config/locales/en.yml b/config/locales/en.yml index d002480..0653957 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1 +1,23 @@ -en: \ No newline at end of file +# 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/config/locales/fr.yml b/config/locales/fr.yml index 0a4d0bc..b987f40 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -23,6 +23,9 @@ fr: parameter: one: Paramètre other: Paramètres + content: + one: Contenu + other: Contenu attributes: parameter: value: Valeur @@ -246,4 +249,4 @@ fr: last: Dernier » next: Suivant › previous: "‹ Précédent" - truncate: "…" + truncate: "…" diff --git a/config/locales/rails_admin.fr.yml b/config/locales/rails_admin.fr.yml deleted file mode 100644 index b08ea54..0000000 --- a/config/locales/rails_admin.fr.yml +++ /dev/null @@ -1,148 +0,0 @@ -fr: - admin: - js: - true: Vrai - false: Faux - is_present: Est présent - is_blank: Est vide - date: Date ... - between_and_: Entre le ... et le ... - today: "Aujourd'hui" - yesterday: Hier - this_week: Cette semaine - last_week: Semaine précédente - number: Nombre ... - contains: Contient - is_exactly: Est exactement - starts_with: Commence par - ends_with: Termine par - loading: "Chargement..." - home: - name: Accueil - pagination: - previous: "« Préc." - next: "Suiv. »" - truncate: "…" - misc: - filter_date_format: "dd/mm/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done! - search: "Rechercher" - filter: "Filtrer" - refresh: "Rafraîchir" - show_all: "Voir tout" - add_filter: "Ajouter un filtre..." - bulk_menu_title: "Objets sélectionnés..." - remove: "Enlever" - add_new: "Ajouter nouveau" - chosen: "%{name} choisis" - chose_all: "Prendre tout" - clear_all: "Tout enlever" - up: "Monter" - down: "Descendre" - navigation: "Navigation" - navigation_static_label: "Liens" - log_out: "Log out" - ago: "" - flash: - successful: "%{name} a été %{action} avec succès" - error: "%{name} n'a pas pu être %{action}" - noaction: "Aucune action !" - model_not_found: "Le model '%{model}' n'a pas été trouvé" - object_not_found: "%{model} avec id '%{id}' n'a pas été trouvé" - table_headers: - model_name: "Nom du modèle" - last_used: "Utilisé" - records: "Enregistrements" - username: "Utilisateur" - changes: "Changements" - created_at: "Date/Heure" - item: "Objet" - message: "Message" - actions: - dashboard: - title: "Administration" - menu: "Administration" - breadcrumb: "Administration" - index: - title: "Listing des %{model_label_plural}" - menu: "Liste" - breadcrumb: "%{model_label_plural}" - show: - title: "Détails pour %{model_label} '%{object_label}'" - menu: "Voir" - breadcrumb: "%{object_label}" - show_in_app: - menu: "Voir dans l'application" - new: - title: "Création d'un(e) %{model_label}" - menu: "Nouveau" - breadcrumb: "Nouveau" - link: "Ajouter un(e) %{model_label}" - done: "créé(e)" - edit: - title: "Édition %{model_label} '%{object_label}'" - menu: "Édition" - breadcrumb: "Édition" - link: "Éditer ce(tte) %{model_label}" - done: "modifié(e)" - delete: - title: "Suppression %{model_label} '%{object_label}'" - menu: "Supprimer" - breadcrumb: "Suppression" - link: "Supprimer '%{object_label}'" - done: "supprimé(e)" - bulk_delete: - title: "Suppression de %{model_label_plural}" - menu: "Délétion multiple" - breadcrumb: "Délétion multiple" - bulk_link: "Supprimer les %{model_label_plural} sélectionné(e)s" - export: - title: "Export de %{model_label_plural}" - menu: "Export" - breadcrumb: "Export" - link: "Export des %{model_label_plural} trouvé(e)s" - bulk_link: "Exporter les %{model_label_plural} sélectionné(e)s" - done: "exporté(e)s" - history_index: - title: "Historique des %{model_label_plural}" - menu: "Historique" - breadcrumb: "Historique" - history_show: - title: "Historique %{model_label} '%{object_label}'" - menu: "Historique" - breadcrumb: "Historique" - form: - cancel: "Annuler" - basic_info: "Informations de base" - required: "Obligatoire" - optional: "Facultatif" - one_char: "caractère" - char_length_up_to: "longueur jusqu'à" - char_length_of: "longueur de" - save: "Enregistrer" - save_and_add_another: "Enregistrer et créer un(e) autre" - save_and_edit: "Enregistrer et re-modifier" - all_of_the_following_related_items_will_be_deleted: " ? Les objets suivants peuvent être affectés (supprimés ou orphelins) : " - are_you_sure_you_want_to_delete_the_object: "Êtes-vous sûr de vouloir supprimer cet(te) %{model_name}" - confirmation: "Oui, je suis sûr(e)" - bulk_delete: "Les objets suivants seront supprimés, ce qui pourrait supprimer ou rendre orpheline les dépendances affichées :" - new_model: "%{name} (nouveau)" - export: - confirmation: "Exporter en %{name}" - select: "Sélectionner les champs à exporter" - select_all_fields: "Selectionner Tous Les Champs" - fields_from: "Champs pour '%{name}'" - fields_from_associated: "Champs pour l'association '%{name}'" - display: "Afficher %{name} : %{type}" - options_for: "Options pour %{name}" - empty_value_for_associated_objects: "" - click_to_reverse_selection: 'Cliquer pour inverser la sélection' - csv: - header_for_root_methods: "%{name}" # 'model' is available - header_for_association_methods: "%{name} [%{association}]" - encoding_to: "Encoder en..." - encoding_to_help: "Choisir l'encodage de sortie. Laisser vide pour garder l'encodage d'entrée : (%{name})" - skip_header: "Pas d'en-tête" - skip_header_help: "Ne pas afficher d'en-tête (pas de champs de description)" - default_col_sep: ";" - col_sep: "Séparateur de colonnes" - col_sep_help: "Laisser vide pour utiliser la valeur par défaut recommandée pour votre système ('%{value}')" diff --git a/config/locales/rollincode.en.yml b/config/locales/rollincode.en.yml deleted file mode 100644 index 1faf542..0000000 --- a/config/locales/rollincode.en.yml +++ /dev/null @@ -1,5 +0,0 @@ -en: - admin: - rollincode: - number: "Number" - show: "Show" \ No newline at end of file diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 7241e18..2374383 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -3,11 +3,11 @@ en: "yes": 'Yes' "no": 'No' required: - # text: 'required' - # mark: '*' + text: 'required' + mark: '*' # You can uncomment the line below if you need to overwrite the whole required html. # When using html, text and mark won't be used. - html: '*' + # html: '*' error_notification: default_message: "Please review the problems below:" # Examples diff --git a/config/locales/simple_form.fr.yml b/config/locales/simple_form.fr.yml deleted file mode 100644 index 47d10f5..0000000 --- a/config/locales/simple_form.fr.yml +++ /dev/null @@ -1,28 +0,0 @@ -fr: - simple_form: - "yes": 'Oui' - "no": 'Non' - required: - # text: 'obligatoire' - # mark: '*' - # You can uncomment the line below if you need to overwrite the whole required html. - # When using html, text and mark won't be used. - html: '*' - error_notification: - default_message: "Merci de corriger les champs ci-dessous:" - labels: - defaults: - first_name: "Nom" - last_name: "Prénom" - address: "Adresse" - facebook_identifier: Identifiant Facebook - city: Ville - postal_code: Code postal - country: Pays - phone: Téléphone - email: E-mail - birth_date: Date de naissance - is_subscribed_newsletter: Inscrit à la newsletter - has_accepted_rules: A accepté les règles - created_at: Créé le - updated_at: Mis à jour le diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..c7f311f --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,47 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/recaptcha.rb b/config/recaptcha.rb new file mode 100644 index 0000000..6a46144 --- /dev/null +++ b/config/recaptcha.rb @@ -0,0 +1,4 @@ +Recaptcha.configure do |config| + config.public_key = 'KEY' + config.private_key = 'KEY' +end diff --git a/config/routes.rb b/config/routes.rb index 4654481..4092618 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,17 +1,15 @@ Rails.application.routes.draw do + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + # USERS & ADMINISTRATION devise_for :admins - devise_for :users mount RailsAdmin::Engine => '/admin', as: 'rails_admin' - # HOME - root to: 'home#index' - - # PAGE - get '/pages/:id' => 'pages#show', as: 'page' - # FROALA (WYSIWYG) post '/froala_upload' => 'froala#upload' post '/froala_manage' => 'froala#manage' delete '/froala_delete' => 'froala#delete' + + # HOME / root + root to: 'site#index' end diff --git a/config/schedule.rb b/config/schedule.rb new file mode 100644 index 0000000..de75cf9 --- /dev/null +++ b/config/schedule.rb @@ -0,0 +1,20 @@ +# Use this file to easily define all of your cron jobs. +# +# It's helpful, but not entirely necessary to understand cron before proceeding. +# http://en.wikipedia.org/wiki/Cron + +# Example: +# +# set :output, "/path/to/my/cron_log.log" +# +# every 2.hours do +# command "/usr/bin/some_great_command" +# runner "MyModel.some_method" +# rake "some:great:rake:task" +# end +# +# every 4.days do +# runner "AnotherModel.prune_old_records" +# end + +# Learn more: http://github.com/javan/whenever diff --git a/config/secrets.yml b/config/secrets.yml index 89075bf..9d722a9 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -5,16 +5,16 @@ # 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. +# You can use `rails 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: YOUR_SECRET_KEY_BASE + secret_key_base: 530117e1846b70954a81110125c146d4d2daa8c20c68cf1d3321e6846c3308a58e8b085f23c43509ba88ead030fb40db6ae1356ad90170efa641c49b6d440a05 test: - secret_key_base: YOUR_SECRET_KEY_BASE + secret_key_base: c9baac6eec4855350d65d544a8d01c273312158168c1bf3b9410c744df3035a44d968d87370ebde3a5bd6797860a57109ebd54e544a1c2bba97cb34342d14e75 # Do not keep production secrets in the repository, # instead read values from the environment. diff --git a/config/sitemap.rb b/config/sitemap.rb new file mode 100644 index 0000000..7e3ace7 --- /dev/null +++ b/config/sitemap.rb @@ -0,0 +1,27 @@ +# Set the host name for URL creation +SitemapGenerator::Sitemap.default_host = 'http://www.example.com' + +SitemapGenerator::Sitemap.create do + # Put links creation logic here. + # + # The root path '/' and sitemap index file are added automatically for you. + # Links are added to the Sitemap in the order they are specified. + # + # Usage: add(path, options={}) + # (default options are used if you don't specify) + # + # Defaults: :priority => 0.5, :changefreq => 'weekly', + # :lastmod => Time.now, :host => default_host + # + # Examples: + # + # Add '/articles' + # + # add articles_path, :priority => 0.7, :changefreq => 'daily' + # + # Add all articles: + # + # Article.find_each do |article| + # add article_path(article), :lastmod => article.updated_at + # end +end diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 0000000..c9119b4 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } diff --git a/db/migrate/20160520090646_create_pages.rb b/db/migrate/20160520090646_create_pages.rb deleted file mode 100644 index 213bbf1..0000000 --- a/db/migrate/20160520090646_create_pages.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreatePages < ActiveRecord::Migration - def change - create_table :pages do |t| - t.string :title, null: false - t.string :code, unique: true, index: true - t.text :content, null: false - t.integer :position - - t.timestamps null: false - end - end -end diff --git a/db/migrate/20160520094338_add_ancestry_to_page.rb b/db/migrate/20160520094338_add_ancestry_to_page.rb deleted file mode 100644 index 5f93b65..0000000 --- a/db/migrate/20160520094338_add_ancestry_to_page.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddAncestryToPage < ActiveRecord::Migration - def change - add_column :pages, :ancestry, :string - add_index :pages, :ancestry - end -end diff --git a/db/migrate/20160520094950_add_slug_to_pages.rb b/db/migrate/20160520094950_add_slug_to_pages.rb deleted file mode 100644 index 57f7987..0000000 --- a/db/migrate/20160520094950_add_slug_to_pages.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSlugToPages < ActiveRecord::Migration - def change - add_column :pages, :slug, :string - end -end diff --git a/db/migrate/20160225110329_create_contents.rb b/db/migrate/20161209084231_create_contents.rb similarity index 78% rename from db/migrate/20160225110329_create_contents.rb rename to db/migrate/20161209084231_create_contents.rb index 7e3f855..19022a7 100644 --- a/db/migrate/20160225110329_create_contents.rb +++ b/db/migrate/20161209084231_create_contents.rb @@ -1,4 +1,4 @@ -class CreateContents < ActiveRecord::Migration +class CreateContents < ActiveRecord::Migration[5.0] def change create_table :contents do |t| t.string :code, index: {unique: true}, null: false diff --git a/db/migrate/20160217161425_create_parameters.rb b/db/migrate/20161209084433_create_parameters.rb similarity index 77% rename from db/migrate/20160217161425_create_parameters.rb rename to db/migrate/20161209084433_create_parameters.rb index 701ccac..28ffddf 100644 --- a/db/migrate/20160217161425_create_parameters.rb +++ b/db/migrate/20161209084433_create_parameters.rb @@ -1,4 +1,4 @@ -class CreateParameters < ActiveRecord::Migration +class CreateParameters < ActiveRecord::Migration[5.0] def change create_table :parameters do |t| t.string :code, index: {unique: true}, null: false diff --git a/db/migrate/20160217160430_devise_create_admins.rb b/db/migrate/20161209093430_devise_create_admins.rb similarity index 84% rename from db/migrate/20160217160430_devise_create_admins.rb rename to db/migrate/20161209093430_devise_create_admins.rb index 0127b2d..1b875c3 100644 --- a/db/migrate/20160217160430_devise_create_admins.rb +++ b/db/migrate/20161209093430_devise_create_admins.rb @@ -1,9 +1,9 @@ -class DeviseCreateAdmins < ActiveRecord::Migration +class DeviseCreateAdmins < ActiveRecord::Migration[5.0] def change - create_table(:admins) do |t| + create_table :admins do |t| ## Database authenticatable - t.string :email, null: false, default: '' - t.string :encrypted_password, null: false, default: '' + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token @@ -29,6 +29,8 @@ def change # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts # t.string :unlock_token # Only if unlock strategy is :email or :both # t.datetime :locked_at + + t.timestamps null: false end diff --git a/db/migrate/20160120220908_devise_create_users.rb b/db/migrate/20161209093436_devise_create_users.rb similarity index 82% rename from db/migrate/20160120220908_devise_create_users.rb rename to db/migrate/20161209093436_devise_create_users.rb index 251d20e..1fefeee 100644 --- a/db/migrate/20160120220908_devise_create_users.rb +++ b/db/migrate/20161209093436_devise_create_users.rb @@ -1,9 +1,9 @@ -class DeviseCreateUsers < ActiveRecord::Migration +class DeviseCreateUsers < ActiveRecord::Migration[5.0] def change - create_table(:users) do |t| + create_table :users do |t| ## Database authenticatable - t.string :email, null: false, default: '' - t.string :encrypted_password, null: false, default: '' + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token @@ -19,9 +19,6 @@ def change t.string :current_sign_in_ip t.string :last_sign_in_ip - ## Custom - t.text :adress - ## Confirmable # t.string :confirmation_token # t.datetime :confirmed_at @@ -33,6 +30,7 @@ def change # t.string :unlock_token # Only if unlock strategy is :email or :both # t.datetime :locked_at + t.timestamps null: false end diff --git a/db/migrate/20160520095019_create_friendly_id_slugs.rb b/db/migrate/20161209094716_create_friendly_id_slugs.rb similarity index 100% rename from db/migrate/20160520095019_create_friendly_id_slugs.rb rename to db/migrate/20161209094716_create_friendly_id_slugs.rb diff --git a/db/migrate/20160520092946_create_seos.rb b/db/migrate/20161209095051_create_seos.rb similarity index 67% rename from db/migrate/20160520092946_create_seos.rb rename to db/migrate/20161209095051_create_seos.rb index d1693ef..21971e7 100644 --- a/db/migrate/20160520092946_create_seos.rb +++ b/db/migrate/20161209095051_create_seos.rb @@ -1,11 +1,9 @@ -class CreateSeos < ActiveRecord::Migration +class CreateSeos < ActiveRecord::Migration[5.0] def change create_table :seos do |t| t.string :title, null: false t.text :description, null: false - t.belongs_to :page, index: true - t.timestamps null: false end end diff --git a/db/schema.rb b/db/schema.rb index 8dfc1b1..224405f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -11,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160520095019) do +ActiveRecord::Schema.define(version: 20161209095051) do create_table "admins", force: :cascade do |t| t.string "email", default: "", null: false @@ -26,66 +25,45 @@ t.string "last_sign_in_ip" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["email"], name: "index_admins_on_email", unique: true + t.index ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true end - add_index "admins", ["email"], name: "index_admins_on_email", unique: true - add_index "admins", ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true - create_table "contents", force: :cascade do |t| t.string "code", null: false t.text "content", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["code"], name: "index_contents_on_code", unique: true end - add_index "contents", ["code"], name: "index_contents_on_code", unique: true - create_table "friendly_id_slugs", force: :cascade do |t| t.string "slug", null: false t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 50 t.string "scope" t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" - - create_table "pages", force: :cascade do |t| - t.string "title", null: false - t.string "code" - t.text "content", null: false - t.integer "position" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "ancestry" - t.string "slug" - end - - add_index "pages", ["ancestry"], name: "index_pages_on_ancestry" - add_index "pages", ["code"], name: "index_pages_on_code" - create_table "parameters", force: :cascade do |t| t.string "code", null: false t.string "value", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["code"], name: "index_parameters_on_code", unique: true end - add_index "parameters", ["code"], name: "index_parameters_on_code", unique: true - create_table "seos", force: :cascade do |t| t.string "title", null: false t.text "description", null: false - t.integer "page_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - add_index "seos", ["page_id"], name: "index_seos_on_page_id" - create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -97,12 +75,10 @@ t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.text "adress" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end - add_index "users", ["email"], name: "index_users_on_email", unique: true - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - end diff --git a/db/seeds.rb b/db/seeds.rb index 0b4b1c6..dfc40ca 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,6 +1,15 @@ -# Admin default Admin.create!( email: 'admin@admin.com', password: 'admin888', password_confirmation: 'admin888' ) + +Parameter.create!( + code: 'DEFAULT_SEO_TITLE', + value: 'DEFAULT TITLE' +) + +Parameter.create!( + code: 'DEFAULT_SEO_DESCRIPTION', + value: 'DEFAULT DESCRIPTION' +) diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake deleted file mode 100644 index 10d37e2..0000000 --- a/lib/tasks/auto_annotate_models.rake +++ /dev/null @@ -1,47 +0,0 @@ -# NOTE: only doing this in development as some production environments (Heroku) -# NOTE: are sensitive to local FS writes, and besides -- it's just not proper -# NOTE: to have a dev-mode tool do its thing in production. -if Rails.env.development? - task :set_annotation_options do - # You can override any of these by setting an environment variable of the - # same name. - Annotate.set_defaults( - 'routes' => 'false', - 'position_in_routes' => 'before', - 'position_in_class' => 'before', - 'position_in_test' => 'before', - 'position_in_fixture' => 'before', - 'position_in_factory' => 'before', - 'position_in_serializer' => 'before', - 'show_foreign_keys' => 'true', - 'show_indexes' => 'true', - 'simple_indexes' => 'false', - 'model_dir' => 'app/models', - 'root_dir' => '', - 'include_version' => 'false', - 'require' => '', - 'exclude_tests' => 'false', - 'exclude_fixtures' => 'false', - 'exclude_factories' => 'false', - 'exclude_serializers' => 'false', - 'exclude_scaffolds' => 'false', - 'exclude_controllers' => 'false', - 'exclude_helpers' => 'false', - 'ignore_model_sub_dir' => 'false', - 'ignore_columns' => nil, - 'ignore_unknown_models' => 'false', - 'hide_limit_column_types' => 'integer,boolean', - 'skip_on_db_migrate' => 'false', - 'format_bare' => 'true', - 'format_rdoc' => 'false', - 'format_markdown' => 'false', - 'sort' => 'false', - 'force' => 'false', - 'trace' => 'false', - 'wrapper_open' => nil, - 'wrapper_close' => nil, - ) - end - - Annotate.load_tasks -end diff --git a/app/assets/javascripts/components/.gitkeep b/public/apple-touch-icon-precomposed.png similarity index 100% rename from app/assets/javascripts/components/.gitkeep rename to public/apple-touch-icon-precomposed.png diff --git a/app/assets/stylesheets/colors.scss b/public/apple-touch-icon.png similarity index 100% rename from app/assets/stylesheets/colors.scss rename to public/apple-touch-icon.png diff --git a/app/views/layouts/_footer.html.erb b/test/controllers/.keep similarity index 100% rename from app/views/layouts/_footer.html.erb rename to test/controllers/.keep diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/admins.yml b/test/fixtures/admins.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/admins.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/contents.yml b/test/fixtures/contents.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/contents.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/parameters.yml b/test/fixtures/parameters.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/parameters.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/seos.yml b/test/fixtures/seos.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/seos.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/helpers/.keep b/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/models/admin_test.rb b/test/models/admin_test.rb new file mode 100644 index 0000000..ab20b8c --- /dev/null +++ b/test/models/admin_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class AdminTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/content_test.rb b/test/models/content_test.rb new file mode 100644 index 0000000..530663b --- /dev/null +++ b/test/models/content_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ContentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/parameter_test.rb b/test/models/parameter_test.rb new file mode 100644 index 0000000..a57d24f --- /dev/null +++ b/test/models/parameter_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ParameterTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/seo_test.rb b/test/models/seo_test.rb new file mode 100644 index 0000000..9ec7b1a --- /dev/null +++ b/test/models/seo_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SeoTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..92e39b2 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/tmp/.keep b/tmp/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/animate.css b/vendor/assets/stylesheets/animate.css similarity index 100% rename from app/assets/stylesheets/animate.css rename to vendor/assets/stylesheets/animate.css