├── log └── .keep ├── tmp └── .keep ├── lib ├── assets │ └── .keep ├── tasks │ ├── .keep │ └── auto_annotate_models.rake └── templates │ └── erb │ └── scaffold │ └── _form.html.erb ├── public ├── favicon.ico ├── apple-touch-icon.png ├── apple-touch-icon-precomposed.png ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── test ├── helpers │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── seo_test.rb │ ├── content_test.rb │ ├── parameter_test.rb │ ├── user_test.rb │ └── admin_test.rb ├── controllers │ └── .keep ├── fixtures │ ├── .keep │ ├── files │ │ └── .keep │ ├── seos.yml │ ├── contents.yml │ ├── parameters.yml │ ├── users.yml │ └── admins.yml ├── integration │ └── .keep └── test_helper.rb ├── app ├── assets │ ├── images │ │ ├── .keep │ │ ├── favicon.png │ │ └── logo-og.jpg │ ├── javascripts │ │ ├── channels │ │ │ └── .keep │ │ ├── cable.js │ │ ├── application.js │ │ └── rails_admin │ │ │ ├── custom │ │ │ └── ui.js │ │ │ └── ra.widgets.coffee │ ├── config │ │ └── manifest.js │ └── stylesheets │ │ ├── flash_messages.scss │ │ ├── application.scss │ │ ├── rails_admin │ │ └── custom │ │ │ └── theming.scss │ │ └── devise.scss ├── models │ ├── concerns │ │ ├── .keep │ │ ├── utils.rb │ │ └── rails_admin │ │ │ ├── user_admin.rb │ │ │ ├── admin_admin.rb │ │ │ ├── seo_tool_admin.rb │ │ │ ├── seo_admin.rb │ │ │ ├── parameter_admin.rb │ │ │ └── content_admin.rb │ ├── application_record.rb │ ├── seo.rb │ ├── seo_tool.rb │ ├── content.rb │ ├── parameter.rb │ ├── admin.rb │ └── user.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── site_controller.rb │ ├── application_controller.rb │ └── froala_controller.rb ├── views │ ├── layouts │ │ ├── mailer.text.erb │ │ ├── mailer.html.erb │ │ ├── devise.html.erb │ │ └── application.html.erb │ ├── kaminari │ │ ├── _gap.html.erb │ │ ├── _first_page.html.erb │ │ ├── _last_page.html.erb │ │ ├── _next_page.html.erb │ │ ├── _prev_page.html.erb │ │ ├── _page.html.erb │ │ └── _paginator.html.erb │ ├── admins │ │ ├── mailer │ │ │ ├── password_change.html.erb │ │ │ ├── confirmation_instructions.html.erb │ │ │ ├── unlock_instructions.html.erb │ │ │ └── reset_password_instructions.html.erb │ │ ├── passwords │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ ├── unlocks │ │ │ └── new.html.erb │ │ ├── confirmations │ │ │ └── new.html.erb │ │ ├── registrations │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ ├── sessions │ │ │ └── new.html.erb │ │ └── shared │ │ │ └── _links.html.erb │ ├── site │ │ └── index.html.erb │ ├── shared │ │ └── _flash_messages.html.erb │ └── rails_admin │ │ └── main │ │ └── dashboard.html.haml ├── jobs │ └── application_job.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── mailers │ └── application_mailer.rb ├── uploaders │ ├── froala_uploader.rb │ ├── attachment_uploader.rb │ └── image_uploader.rb └── helpers │ └── application_helper.rb ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── bin ├── rake ├── bundle ├── rails ├── spring ├── update └── setup ├── config ├── locales │ ├── rollincode.fr.yml │ ├── en.yml │ ├── simple_form.en.yml │ ├── simple_form.fr.yml │ ├── devise.en.yml │ ├── rails_admin.fr.yml │ ├── devise.fr.yml │ └── fr.yml ├── recaptcha.rb ├── spring.rb ├── boot.rb ├── environment.rb ├── cable.yml ├── initializers │ ├── session_store.rb │ ├── mime_types.rb │ ├── application_controller_renderer.rb │ ├── filter_parameter_logging.rb │ ├── cookies_serializer.rb │ ├── kaminari_config.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── assets.rb │ ├── inflections.rb │ ├── rails_admin.rb │ ├── new_framework_defaults.rb │ ├── friendly_id.rb │ └── devise.rb ├── routes.rb ├── schedule.rb ├── database.yml ├── application.rb ├── sitemap.rb ├── secrets.yml ├── deploy.rb ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb ├── puma.rb └── deploy │ ├── production.rb │ └── staging.rb ├── config.ru ├── Rakefile ├── .jsbeautifyrc ├── db ├── migrate │ ├── 20161209095051_create_seos.rb │ ├── 20170524131642_create_seo_tools.rb │ ├── 20161209084231_create_contents.rb │ ├── 20161209084433_create_parameters.rb │ ├── 20161209094716_create_friendly_id_slugs.rb │ ├── 20161209093436_devise_create_users.rb │ └── 20161209093430_devise_create_admins.rb ├── seeds.rb └── schema.rb ├── .scss-lint.yml ├── .gitignore ├── Capfile ├── README.md ├── .rubocop.yml ├── Gemfile └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollincode/rollinbox/HEAD/app/assets/images/favicon.png -------------------------------------------------------------------------------- /app/assets/images/logo-og.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollincode/rollinbox/HEAD/app/assets/images/logo-og.jpg -------------------------------------------------------------------------------- /app/controllers/site_controller.rb: -------------------------------------------------------------------------------- 1 | class SiteController < ApplicationController 2 | def index 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /config/locales/rollincode.fr.yml: -------------------------------------------------------------------------------- 1 | fr: 2 | admin: 3 | rollincode: 4 | number: "Nombre" 5 | show: "Voir les" -------------------------------------------------------------------------------- /app/views/kaminari/_gap.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= content_tag :a, raw(t 'views.pagination.truncate') %> 3 |
  • 4 | -------------------------------------------------------------------------------- /config/recaptcha.rb: -------------------------------------------------------------------------------- 1 | Recaptcha.configure do |config| 2 | config.public_key = 'KEY' 3 | config.private_key = 'KEY' 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /app/views/kaminari/_first_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> 3 |
  • 4 | -------------------------------------------------------------------------------- /app/views/kaminari/_last_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %> 3 |
  • 4 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /app/views/kaminari/_next_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> 3 |
  • 4 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: redis://localhost:6379/1 10 | -------------------------------------------------------------------------------- /app/views/kaminari/_prev_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %> 3 |
  • 4 | -------------------------------------------------------------------------------- /app/views/admins/mailer/password_change.html.erb: -------------------------------------------------------------------------------- 1 |

    2 | Hello <%= @resource.email %>! 3 |

    4 |

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

    5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_rollinbox_session' 4 | -------------------------------------------------------------------------------- /app/uploaders/froala_uploader.rb: -------------------------------------------------------------------------------- 1 | class FroalaUploader < CarrierWave::Uploader::Base 2 | storage :file 3 | 4 | def store_dir 5 | "uploads/froala/#{model}/#{mounted_as}" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /app/views/site/index.html.erb: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 | 5 |
    6 |
    7 |
    8 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | User-agent: * 5 | Disallow: / 6 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/models/concerns/utils.rb: -------------------------------------------------------------------------------- 1 | module Utils 2 | def self.hex_to_rgba(input, alpha) 3 | a = ( input.match /#(..?)(..?)(..?)/ )[1..3] 4 | a.map!{ |x| x + x } if input.size == 4 5 | "rgba(#{a[0].hex},#{a[1].hex},#{a[2].hex}, #{alpha})" 6 | end 7 | end -------------------------------------------------------------------------------- /app/views/admins/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

    2 | Welcome <%= @email %>! 3 |

    4 |

    You can confirm your account email through the link below:

    5 |

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

    -------------------------------------------------------------------------------- /.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "indent_size": 2, 3 | "indent_char": " ", 4 | "other": " ", 5 | "indent_level": 0, 6 | "indent_with_tabs": false, 7 | "preserve_newlines": true, 8 | "max_preserve_newlines": 2, 9 | "jslint_happy": true, 10 | "indent_handlebars": true 11 | } 12 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /db/migrate/20161209095051_create_seos.rb: -------------------------------------------------------------------------------- 1 | class CreateSeos < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :seos do |t| 4 | t.string :title, null: false 5 | t.text :description, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /db/migrate/20170524131642_create_seo_tools.rb: -------------------------------------------------------------------------------- 1 | class CreateSeoTools < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :seo_tools do |t| 4 | t.string :code, index: {unique: true}, null: false 5 | t.string :value 6 | 7 | t.timestamps null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/shared/_flash_messages.html.erb: -------------------------------------------------------------------------------- 1 | <% flash.each do |type, message| %> 2 |
    3 | 4 | <%= message %> 5 |
    6 | <% end %> 7 | -------------------------------------------------------------------------------- /db/migrate/20161209084231_create_contents.rb: -------------------------------------------------------------------------------- 1 | class CreateContents < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :contents do |t| 4 | t.string :code, index: {unique: true}, null: false 5 | t.text :content, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/kaminari_config.rb: -------------------------------------------------------------------------------- 1 | Kaminari.configure do |config| 2 | config.default_per_page = 20 3 | # config.max_per_page = nil 4 | # config.window = 4 5 | # config.outer_window = 0 6 | # config.left = 0 7 | # config.right = 0 8 | # config.page_method_name = :page 9 | # config.param_name = :page 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20161209084433_create_parameters.rb: -------------------------------------------------------------------------------- 1 | class CreateParameters < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :parameters do |t| 4 | t.string :code, index: {unique: true}, null: false 5 | t.string :value, null: false 6 | 7 | t.timestamps null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/admins/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

    2 | Hello #{@resource.email}! 3 |

    4 |

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

    5 |

    Click the link below to unlock your account:

    6 |

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

    9 | -------------------------------------------------------------------------------- /app/views/kaminari/_page.html.erb: -------------------------------------------------------------------------------- 1 | <% if page.current? %> 2 |
  • 3 | <%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %> 4 |
  • 5 | <% else %> 6 |
  • 7 | <%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %> 8 |
  • 9 | <% end %> 10 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /app/models/concerns/rails_admin/user_admin.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin::UserAdmin 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | rails_admin do 6 | navigation_label 'Users' 7 | navigation_icon 'fa fa-user' 8 | 9 | edit do 10 | end 11 | 12 | show do 13 | end 14 | 15 | list do 16 | exclude_fields :created_at, :updated_at 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%%= simple_form_for(@<%= singular_table_name %>) do |f| %> 2 | <%%= f.error_notification %> 3 | 4 |
    5 | <%- attributes.each do |attribute| -%> 6 | <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> 7 | <%- end -%> 8 |
    9 | 10 |
    11 | <%%= f.button :submit %> 12 |
    13 | <%% end %> 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the rails generate channel command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /.scss-lint.yml: -------------------------------------------------------------------------------- 1 | exclude: 2 | - '*.min.scss' 3 | - '*.min.sass' 4 | 5 | linters: 6 | PropertySortOrder: 7 | enabled: false 8 | ColorVariable: 9 | enabled: false 10 | Comment: 11 | enabled: false 12 | VendorPrefix: 13 | enabled: false 14 | IdSelector: 15 | enabled: false 16 | NestingDepth: 17 | enabled: false 18 | SelectorDepth: 19 | enabled: false 20 | QualifyingElement: 21 | enabled: false 22 | -------------------------------------------------------------------------------- /app/assets/stylesheets/flash_messages.scss: -------------------------------------------------------------------------------- 1 | .alert { 2 | z-index: 999; 3 | position: fixed; 4 | border-radius: 0; 5 | border: 0; 6 | color: #fff; 7 | width: 100%; 8 | } 9 | 10 | .alert-info { 11 | background-color: #3498db; 12 | } 13 | 14 | .alert-warning { 15 | background-color: #f1c40f; 16 | } 17 | 18 | .alert-success { 19 | background-color: #2ecc71; 20 | } 21 | 22 | .alert-danger { 23 | background-color: #e74c3c; 24 | } 25 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /app/models/seo.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: seos 4 | # 5 | # id :integer not null, primary key 6 | # title :string not null 7 | # description :text not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | 12 | class Seo < ApplicationRecord 13 | include RailsAdmin::SeoAdmin 14 | 15 | validates_presence_of :title, :description 16 | end 17 | -------------------------------------------------------------------------------- /app/models/concerns/rails_admin/admin_admin.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin::AdminAdmin 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | rails_admin do 6 | navigation_label 'Admins' 7 | navigation_icon 'fa fa-user-secret' 8 | label_plural 'Admins' 9 | 10 | edit do 11 | end 12 | 13 | show do 14 | end 15 | 16 | list do 17 | exclude_fields :created_at, :updated_at 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/models/seo_tool.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: seo_tools 4 | # 5 | # id :integer not null, primary key 6 | # code :string not null 7 | # value :string 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | # Indexes 12 | # 13 | # index_seo_tools_on_code (code) UNIQUE 14 | # 15 | 16 | class SeoTool < ActiveRecord::Base 17 | include RailsAdmin::SeoToolAdmin 18 | 19 | end 20 | -------------------------------------------------------------------------------- /app/uploaders/attachment_uploader.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | class AttachmentUploader < CarrierWave::Uploader::Base 4 | storage :file 5 | 6 | # Override the directory where uploaded files will be stored. 7 | # This is a sensible default for uploaders that are meant to be mounted: 8 | def store_dir 9 | "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" 10 | end 11 | 12 | def extension_white_list 13 | %w(pdf doc htm html docx) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/views/admins/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

    2 | Hello <%= @resource.email %>! 3 |

    4 |

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

    5 |

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

    8 |

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

    9 |

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

    10 | -------------------------------------------------------------------------------- /test/models/seo_test.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: seos 4 | # 5 | # id :integer not null, primary key 6 | # title :string not null 7 | # description :text not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | 12 | require 'test_helper' 13 | 14 | class SeoTest < ActiveSupport::TestCase 15 | # test "the truth" do 16 | # assert true 17 | # end 18 | end 19 | -------------------------------------------------------------------------------- /app/views/admins/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |

    Forgot your password?

    2 | <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 3 | <%= f.error_notification %> 4 |
    5 | <%= f.input :email, required: true, autofocus: true %> 6 |
    7 |
    8 | <%= f.button :submit, "Send me reset password instructions" %> 9 |
    10 | <% end %> 11 | <%= render "devise/shared/links" %> 12 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 3 | 4 | # USERS & ADMINISTRATION 5 | devise_for :admins 6 | mount RailsAdmin::Engine => '/admin', as: 'rails_admin' 7 | 8 | # FROALA (WYSIWYG) 9 | post '/froala_upload' => 'froala#upload' 10 | post '/froala_manage' => 'froala#manage' 11 | delete '/froala_delete' => 'froala#delete' 12 | 13 | # HOME / root 14 | root to: 'site#index' 15 | end 16 | -------------------------------------------------------------------------------- /app/views/admins/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

    Resend unlock instructions

    2 | <%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 3 | <%= f.error_notification %> 4 | <%= f.full_error :unlock_token %> 5 |
    6 | <%= f.input :email, required: true, autofocus: true %> 7 |
    8 |
    9 | <%= f.button :submit, "Resend unlock instructions" %> 10 |
    11 | <% end %> 12 | <%= render "devise/shared/links" %> 13 | -------------------------------------------------------------------------------- /app/models/concerns/rails_admin/seo_tool_admin.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin::SeoToolAdmin 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | rails_admin do 6 | navigation_label 'Seo Tools' 7 | label_plural 'Seo Tools' 8 | navigation_icon 'fa fa-google' 9 | parent Content 10 | 11 | 12 | edit do 13 | field :value 14 | end 15 | 16 | show do 17 | end 18 | 19 | list do 20 | exclude_fields :created_at, :updated_at 21 | end 22 | 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/views/admins/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |

    Resend confirmation instructions

    2 | <%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 3 | <%= f.error_notification %> 4 | <%= f.full_error :confirmation_token %> 5 |
    6 | <%= f.input :email, required: true, autofocus: true %> 7 |
    8 |
    9 | <%= f.button :submit, "Resend confirmation instructions" %> 10 |
    11 | <% end %> 12 | <%= render "devise/shared/links" %> 13 | -------------------------------------------------------------------------------- /test/models/content_test.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: contents 4 | # 5 | # id :integer not null, primary key 6 | # code :string not null 7 | # content :text not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | # Indexes 12 | # 13 | # index_contents_on_code (code) UNIQUE 14 | # 15 | 16 | require 'test_helper' 17 | 18 | class ContentTest < ActiveSupport::TestCase 19 | # test "the truth" do 20 | # assert true 21 | # end 22 | end 23 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | if spring = lockfile.specs.detect { |spec| spec.name == "spring" } 12 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 13 | gem 'spring', spring.version 14 | require 'spring/binstub' 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /test/models/parameter_test.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: parameters 4 | # 5 | # id :integer not null, primary key 6 | # code :string not null 7 | # value :string not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | # Indexes 12 | # 13 | # index_parameters_on_code (code) UNIQUE 14 | # 15 | 16 | require 'test_helper' 17 | 18 | class ParameterTest < ActiveSupport::TestCase 19 | # test "the truth" do 20 | # assert true 21 | # end 22 | end 23 | -------------------------------------------------------------------------------- /app/models/content.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: contents 4 | # 5 | # id :integer not null, primary key 6 | # code :string not null 7 | # content :text not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | # Indexes 12 | # 13 | # index_contents_on_code (code) UNIQUE 14 | # 15 | 16 | class Content < ApplicationRecord 17 | include RailsAdmin::ContentAdmin 18 | 19 | validates_presence_of :code, :content 20 | validates_uniqueness_of :code 21 | end 22 | -------------------------------------------------------------------------------- /config/schedule.rb: -------------------------------------------------------------------------------- 1 | # Use this file to easily define all of your cron jobs. 2 | # 3 | # It's helpful, but not entirely necessary to understand cron before proceeding. 4 | # http://en.wikipedia.org/wiki/Cron 5 | 6 | # Example: 7 | # 8 | # set :output, "/path/to/my/cron_log.log" 9 | # 10 | # every 2.hours do 11 | # command "/usr/bin/some_great_command" 12 | # runner "MyModel.some_method" 13 | # rake "some:great:rake:task" 14 | # end 15 | # 16 | # every 4.days do 17 | # runner "AnotherModel.prune_old_records" 18 | # end 19 | 20 | # Learn more: http://github.com/javan/whenever 21 | -------------------------------------------------------------------------------- /app/models/parameter.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: parameters 4 | # 5 | # id :integer not null, primary key 6 | # code :string not null 7 | # value :string not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | # Indexes 12 | # 13 | # index_parameters_on_code (code) UNIQUE 14 | # 15 | 16 | class Parameter < ApplicationRecord 17 | include RailsAdmin::ParameterAdmin 18 | 19 | validates_presence_of :code, :value 20 | validates_uniqueness_of :code 21 | end 22 | -------------------------------------------------------------------------------- /app/models/concerns/rails_admin/seo_admin.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin::SeoAdmin 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | rails_admin do 6 | navigation_icon 'fa fa-google' 7 | parent Content 8 | 9 | edit do 10 | field :title do 11 | required true 12 | end 13 | field :description do 14 | required true 15 | end 16 | exclude_fields :page 17 | end 18 | 19 | show do 20 | end 21 | 22 | list do 23 | exclude_fields :created_at, :updated_at 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /app/views/kaminari/_paginator.html.erb: -------------------------------------------------------------------------------- 1 | <%= paginator.render do -%> 2 | 15 | <% end -%> 16 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | 13 | Rails.application.config.assets.precompile += %w(ie.js) 14 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | before_action :load_layout_data 4 | 5 | private 6 | 7 | def load_layout_data 8 | @seo_title = Parameter.find_by_code('DEFAULT_SEO_TITLE') 9 | @seo_description = Parameter.find_by_code('DEFAULT_SEO_DESCRIPTION') 10 | @google_site_verification = SeoTool.find_by_code('GOOGLE_SITE_VERIFICATION_CODE').value 11 | @google_analytic = SeoTool.find_by_code('GOOGLE_ANALYTIC_CODE').value 12 | @google_tag_manager = SeoTool.find_by_code('GOOGLE_TAG_MANAGER_CODE').value 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/views/admins/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |

    Sign up

    2 | <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 3 | <%= f.error_notification %> 4 |
    5 | <%= f.input :email, required: true, autofocus: true %> 6 | <%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %> 7 | <%= f.input :password_confirmation, required: true %> 8 |
    9 |
    10 | <%= f.button :submit, "Sign up" %> 11 |
    12 | <% end %> 13 | <%= render "devise/shared/links" %> 14 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | Admin.create!( 2 | email: 'admin@admin.com', 3 | password: 'admin888', 4 | password_confirmation: 'admin888' 5 | ) 6 | 7 | Parameter.create!( 8 | code: 'DEFAULT_SEO_TITLE', 9 | value: 'DEFAULT TITLE' 10 | ) 11 | 12 | Parameter.create!( 13 | code: 'DEFAULT_SEO_DESCRIPTION', 14 | value: 'DEFAULT DESCRIPTION' 15 | ) 16 | 17 | SeoTool.create!( 18 | code: 'GOOGLE_SITE_VERIFICATION_CODE', 19 | value: '' 20 | ) 21 | 22 | SeoTool.create!( 23 | code: 'GOOGLE_ANALYTIC_CODE', 24 | value: '' 25 | ) 26 | 27 | SeoTool.create!( 28 | code: 'GOOGLE_TAG_MANAGER_CODE', 29 | value: '' 30 | ) -------------------------------------------------------------------------------- /app/models/concerns/rails_admin/parameter_admin.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin::ParameterAdmin 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | rails_admin do 6 | parent Content 7 | navigation_label 'Parametre' 8 | navigation_icon 'fa fa-cog' 9 | label_plural 'Parametres' 10 | 11 | edit do 12 | field :code do 13 | required true 14 | end 15 | field :value do 16 | required true 17 | end 18 | end 19 | 20 | show do 21 | end 22 | 23 | list do 24 | exclude_fields :created_at, :updated_at 25 | end 26 | 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /db/migrate/20161209094716_create_friendly_id_slugs.rb: -------------------------------------------------------------------------------- 1 | class CreateFriendlyIdSlugs < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :friendly_id_slugs do |t| 4 | t.string :slug, :null => false 5 | t.integer :sluggable_id, :null => false 6 | t.string :sluggable_type, :limit => 50 7 | t.string :scope 8 | t.datetime :created_at 9 | end 10 | add_index :friendly_id_slugs, :sluggable_id 11 | add_index :friendly_id_slugs, [:slug, :sluggable_type] 12 | add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true 13 | add_index :friendly_id_slugs, :sluggable_type 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/uploaders/image_uploader.rb: -------------------------------------------------------------------------------- 1 | class ImageUploader < CarrierWave::Uploader::Base 2 | include CarrierWave::MiniMagick 3 | 4 | storage :file 5 | 6 | def store_dir 7 | "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" 8 | end 9 | 10 | version :post_thumb, if: :post? do 11 | process resize_to_fill: [50, 50] 12 | end 13 | 14 | version :post, if: :post? do 15 | process resize_to_fill: [600, 450] 16 | end 17 | 18 | def extension_white_list 19 | %w(jpg jpeg gif png) 20 | end 21 | 22 | def content_type_whitelist 23 | /image\// 24 | end 25 | 26 | protected 27 | 28 | def post?(_picture) 29 | model.is_a?(Post) 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /app/views/layouts/devise.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Administration 6 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 7 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 8 | <%= csrf_meta_tags %> 9 | 10 | 11 | 12 |
    13 | <%= yield %> 14 |
    15 | 16 | 17 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /test/fixtures/seos.yml: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: seos 4 | # 5 | # id :integer not null, primary key 6 | # title :string not null 7 | # description :text not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | 12 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 13 | 14 | # This model initially had no columns defined. If you add columns to the 15 | # model remove the '{}' from the fixture names and add the columns immediately 16 | # below each fixture, per the syntax in the comments below 17 | # 18 | one: {} 19 | # column: value 20 | # 21 | two: {} 22 | # column: value 23 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | /tmp/* 17 | !/log/.keep 18 | !/tmp/.keep 19 | 20 | .idea/ 21 | .vscode/ 22 | .rbenv-gemsets 23 | .DS_Store 24 | public/system 25 | public/uploads 26 | public/assets/** 27 | public/sitemap.xml.gz 28 | 29 | # Ignore Byebug command history file. 30 | .byebug_history 31 | -------------------------------------------------------------------------------- /app/views/admins/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    Change your password

    2 | <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 3 | <%= f.error_notification %> 4 | <%= f.input :reset_password_token, as: :hidden %> 5 | <%= f.full_error :reset_password_token %> 6 |
    7 | <%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %> 8 | <%= f.input :password_confirmation, label: "Confirm your new password", required: true %> 9 |
    10 |
    11 | <%= f.button :submit, "Change my password" %> 12 |
    13 | <% end %> 14 | <%= render "devise/shared/links" %> 15 | -------------------------------------------------------------------------------- /test/fixtures/contents.yml: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: contents 4 | # 5 | # id :integer not null, primary key 6 | # code :string not null 7 | # content :text not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | # Indexes 12 | # 13 | # index_contents_on_code (code) UNIQUE 14 | # 15 | 16 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 17 | 18 | # This model initially had no columns defined. If you add columns to the 19 | # model remove the '{}' from the fixture names and add the columns immediately 20 | # below each fixture, per the syntax in the comments below 21 | # 22 | one: {} 23 | # column: value 24 | # 25 | two: {} 26 | # column: value 27 | -------------------------------------------------------------------------------- /test/fixtures/parameters.yml: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: parameters 4 | # 5 | # id :integer not null, primary key 6 | # code :string not null 7 | # value :string not null 8 | # created_at :datetime not null 9 | # updated_at :datetime not null 10 | # 11 | # Indexes 12 | # 13 | # index_parameters_on_code (code) UNIQUE 14 | # 15 | 16 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 17 | 18 | # This model initially had no columns defined. If you add columns to the 19 | # model remove the '{}' from the fixture names and add the columns immediately 20 | # below each fixture, per the syntax in the comments below 21 | # 22 | one: {} 23 | # column: value 24 | # 25 | two: {} 26 | # column: value 27 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Some errors were found, please take a look:" 13 | # Labels and hints examples 14 | # labels: 15 | # password: 'Password' 16 | # user: 17 | # new: 18 | # email: 'E-mail para efetuar o sign in.' 19 | # edit: 20 | # email: 'E-mail.' 21 | # hints: 22 | # username: 'User name to sign in.' 23 | # password: 'No special characters, please.' 24 | 25 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | ENV['RAILS_ADMIN_THEME'] = 'rollincode' 10 | 11 | module Rollinbox 12 | class Application < Rails::Application 13 | # Settings in config/environments/* take precedence over those specified here. 14 | # Application configuration should go into files in config/initializers 15 | # -- all .rb files in that directory are automatically loaded. 16 | config.i18n.default_locale = :en 17 | 18 | config.assets.paths << Rails.root.join('vendor', 'assets', 'images') 19 | 20 | config.to_prepare do 21 | Devise::SessionsController.layout 'devise' 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | def title(title) 3 | content_for(:title) { title } 4 | end 5 | 6 | def meta_description(meta_description) 7 | content_for(:meta_description) { meta_description } 8 | end 9 | 10 | def og_title(og_title) 11 | content_for(:og_title) { og_title } 12 | end 13 | 14 | def og_description(og_description) 15 | content_for(:og_description) { og_description } 16 | end 17 | 18 | def og_image(og_image) 19 | content_for(:og_image) { og_image } 20 | end 21 | 22 | def bootstrap_class_for(flash_type) 23 | case flash_type 24 | when 'success' 25 | 'alert-success' 26 | when 'error' 27 | 'alert-danger' 28 | when 'alert' 29 | 'alert-warning' 30 | when 'notice' 31 | 'alert-info' 32 | else 33 | flash_type.to_s 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /config/sitemap.rb: -------------------------------------------------------------------------------- 1 | # Set the host name for URL creation 2 | SitemapGenerator::Sitemap.default_host = 'http://www.example.com' 3 | 4 | SitemapGenerator::Sitemap.create do 5 | # Put links creation logic here. 6 | # 7 | # The root path '/' and sitemap index file are added automatically for you. 8 | # Links are added to the Sitemap in the order they are specified. 9 | # 10 | # Usage: add(path, options={}) 11 | # (default options are used if you don't specify) 12 | # 13 | # Defaults: :priority => 0.5, :changefreq => 'weekly', 14 | # :lastmod => Time.now, :host => default_host 15 | # 16 | # Examples: 17 | # 18 | # Add '/articles' 19 | # 20 | # add articles_path, :priority => 0.7, :changefreq => 'daily' 21 | # 22 | # Add all articles: 23 | # 24 | # Article.find_each do |article| 25 | # add article_path(article), :lastmod => article.updated_at 26 | # end 27 | end 28 | -------------------------------------------------------------------------------- /config/locales/simple_form.fr.yml: -------------------------------------------------------------------------------- 1 | fr: 2 | simple_form: 3 | "yes": 'Oui' 4 | "no": 'Non' 5 | required: 6 | # text: 'obligatoire' 7 | # mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | html: '*' 11 | error_notification: 12 | default_message: "Merci de corriger les champs ci-dessous:" 13 | labels: 14 | defaults: 15 | first_name: "Prénom" 16 | last_name: "Nom" 17 | address: "Adresse" 18 | facebook_identifier: Identifiant Facebook 19 | city: Ville 20 | postal_code: Code postal 21 | country: Pays 22 | phone: Téléphone 23 | email: E-mail 24 | birth_date: Date de naissance 25 | is_subscribed_newsletter: Inscrit à la newsletter 26 | has_accepted_rules: A accepté les règles 27 | created_at: Créé le 28 | updated_at: Mis à jour le 29 | -------------------------------------------------------------------------------- /Capfile: -------------------------------------------------------------------------------- 1 | # Load DSL and set up stages 2 | require "capistrano/setup" 3 | 4 | # Include default deployment tasks 5 | require "capistrano/deploy" 6 | 7 | # Include tasks from other gems included in your Gemfile 8 | # 9 | # For documentation on these, see for example: 10 | # 11 | # https://github.com/capistrano/rvm 12 | # https://github.com/capistrano/rbenv 13 | # https://github.com/capistrano/chruby 14 | # https://github.com/capistrano/bundler 15 | # https://github.com/capistrano/rails 16 | # https://github.com/capistrano/passenger 17 | # 18 | # require 'capistrano/rvm' 19 | require 'capistrano/rbenv' 20 | # require 'capistrano/chruby' 21 | require 'capistrano/bundler' 22 | require 'capistrano/rails/assets' 23 | require 'capistrano/rails/migrations' 24 | require 'capistrano/passenger' 25 | require "capistrano/scm/git" 26 | install_plugin Capistrano::SCM::Git 27 | 28 | # Load custom tasks from `lib/capistrano/tasks` if you have any defined 29 | Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } 30 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require bootstrap 16 | //= require turbolinks 17 | //= require_tree . 18 | //= stub rails_admin/custom/ui.js 19 | //= stub 'ie' 20 | 21 | $(document).on('turbolinks:load', init); 22 | 23 | function init() { 24 | console.log('Code ready to rocks !'); 25 | } 26 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 530117e1846b70954a81110125c146d4d2daa8c20c68cf1d3321e6846c3308a58e8b085f23c43509ba88ead030fb40db6ae1356ad90170efa641c49b6d440a05 15 | 16 | test: 17 | secret_key_base: c9baac6eec4855350d65d544a8d01c273312158168c1bf3b9410c744df3035a44d968d87370ebde3a5bd6797860a57109ebd54e544a1c2bba97cb34342d14e75 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # puts "\n== Copying sample files ==" 22 | # unless File.exist?('config/database.yml') 23 | # cp 'config/database.yml.sample', 'config/database.yml' 24 | # end 25 | 26 | puts "\n== Preparing database ==" 27 | system! 'bin/rails db:setup' 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! 'bin/rails log:clear tmp:clear' 31 | 32 | puts "\n== Restarting application server ==" 33 | system! 'bin/rails restart' 34 | end 35 | -------------------------------------------------------------------------------- /config/initializers/rails_admin.rb: -------------------------------------------------------------------------------- 1 | RailsAdmin.config do |config| 2 | ### Popular gems integration 3 | 4 | ## == Devise == 5 | config.authenticate_with do 6 | warden.authenticate! scope: :admin 7 | end 8 | config.current_user_method(&:current_admin) 9 | 10 | ## == Cancan == 11 | # config.authorize_with :cancan 12 | 13 | ## == Pundit == 14 | # config.authorize_with :pundit 15 | 16 | ## == PaperTrail == 17 | # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0 18 | 19 | ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration 20 | 21 | config.actions do 22 | dashboard # mandatory 23 | index # mandatory 24 | new do 25 | except [SeoTool] 26 | end 27 | 28 | export 29 | bulk_delete 30 | show 31 | edit 32 | delete do 33 | except [SeoTool] 34 | end 35 | 36 | ## With an audit adapter, you can add: 37 | # history_index 38 | # history_show 39 | 40 | nestable 41 | end 42 | 43 | config.main_app_name = ['Rollinbox', ''] 44 | end 45 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: users 4 | # 5 | # id :integer not null, primary key 6 | # email :string default(""), not null 7 | # encrypted_password :string default(""), not null 8 | # reset_password_token :string 9 | # reset_password_sent_at :datetime 10 | # remember_created_at :datetime 11 | # sign_in_count :integer default(0), not null 12 | # current_sign_in_at :datetime 13 | # last_sign_in_at :datetime 14 | # current_sign_in_ip :string 15 | # last_sign_in_ip :string 16 | # created_at :datetime not null 17 | # updated_at :datetime not null 18 | # 19 | # Indexes 20 | # 21 | # index_users_on_email (email) UNIQUE 22 | # index_users_on_reset_password_token (reset_password_token) UNIQUE 23 | # 24 | 25 | require 'test_helper' 26 | 27 | class UserTest < ActiveSupport::TestCase 28 | # test "the truth" do 29 | # assert true 30 | # end 31 | end 32 | -------------------------------------------------------------------------------- /test/models/admin_test.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: admins 4 | # 5 | # id :integer not null, primary key 6 | # email :string default(""), not null 7 | # encrypted_password :string default(""), not null 8 | # reset_password_token :string 9 | # reset_password_sent_at :datetime 10 | # remember_created_at :datetime 11 | # sign_in_count :integer default(0), not null 12 | # current_sign_in_at :datetime 13 | # last_sign_in_at :datetime 14 | # current_sign_in_ip :string 15 | # last_sign_in_ip :string 16 | # created_at :datetime not null 17 | # updated_at :datetime not null 18 | # 19 | # Indexes 20 | # 21 | # index_admins_on_email (email) UNIQUE 22 | # index_admins_on_reset_password_token (reset_password_token) UNIQUE 23 | # 24 | 25 | require 'test_helper' 26 | 27 | class AdminTest < ActiveSupport::TestCase 28 | # test "the truth" do 29 | # assert true 30 | # end 31 | end 32 | -------------------------------------------------------------------------------- /app/views/admins/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    2 | Edit #{resource_name.to_s.humanize} 3 |

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

    10 | Currently waiting confirmation for: #{resource.unconfirmed_email} 11 |

    12 | <% end %> 13 | <%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %> 14 | <%= f.input :password_confirmation, required: false %> 15 | <%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %> 16 |
    17 |
    18 | <%= f.button :submit, "Update" %> 19 |
    20 | <% end %> 21 |

    Cancel my account

    22 |

    23 | Unhappy? #{link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete} 24 |

    25 | <%= link_to "Back", :back %> 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Rails 5 Sandbox 2 | ============= 3 | 4 | Ready to use sandbox, back-end/front-end architecture provided. 5 | 6 | - Rollincode rails admin theme (new modern bootstrap 3) 7 | - Nested sortable models 8 | - Image and attachment uploaders 9 | - Admin and User accounts configured 10 | - Seo optimization (friendly_id) 11 | - Froala v2 + file and images manager WYSIWYG 12 | - Block system on dashboard 13 | - ... many others 14 | 15 | Model link example with slug see friendly_id 16 | 17 | ```erb 18 | <%= model_path(@model.slug) %> 19 | ``` 20 | 21 | Notifications 22 | ```ruby 23 | redirect_to root_path, flash: {success: 'My message'} 24 | ``` 25 | 26 | Block on dashboard 27 | integration example in model: 28 | ```ruby 29 | included do 30 | rails_admin do 31 | navigation_label 'Page' 32 | navigation_icon 'fa fa-book' 33 | label_plural 'Pages' 34 | ``` 35 | navigation_icon and label_plural are optional 36 | 37 | ![DASHBOARD](http://i.imgur.com/iWnBkEu.png, "block system") 38 | 39 | ![DASHBOARD](http://i.imgur.com/GJGfXVO.png, "view") 40 | 41 | ### TODO ### 42 | 43 | - [X] Rails 5 migration 44 | - [ ] Capistrano instructions 45 | - [X] Capistrano initialization 46 | - [X] Clean up 47 | -------------------------------------------------------------------------------- /app/models/admin.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: admins 4 | # 5 | # id :integer not null, primary key 6 | # email :string default(""), not null 7 | # encrypted_password :string default(""), not null 8 | # reset_password_token :string 9 | # reset_password_sent_at :datetime 10 | # remember_created_at :datetime 11 | # sign_in_count :integer default(0), not null 12 | # current_sign_in_at :datetime 13 | # last_sign_in_at :datetime 14 | # current_sign_in_ip :string 15 | # last_sign_in_ip :string 16 | # created_at :datetime not null 17 | # updated_at :datetime not null 18 | # 19 | # Indexes 20 | # 21 | # index_admins_on_email (email) UNIQUE 22 | # index_admins_on_reset_password_token (reset_password_token) UNIQUE 23 | # 24 | 25 | class Admin < ApplicationRecord 26 | include RailsAdmin::AdminAdmin 27 | # Include default devise modules. Others available are: 28 | # :confirmable, :lockable, :timeoutable and :omniauthable 29 | devise :database_authenticatable, 30 | :recoverable, :rememberable, :trackable, :validatable 31 | end 32 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: users 4 | # 5 | # id :integer not null, primary key 6 | # email :string default(""), not null 7 | # encrypted_password :string default(""), not null 8 | # reset_password_token :string 9 | # reset_password_sent_at :datetime 10 | # remember_created_at :datetime 11 | # sign_in_count :integer default(0), not null 12 | # current_sign_in_at :datetime 13 | # last_sign_in_at :datetime 14 | # current_sign_in_ip :string 15 | # last_sign_in_ip :string 16 | # created_at :datetime not null 17 | # updated_at :datetime not null 18 | # 19 | # Indexes 20 | # 21 | # index_users_on_email (email) UNIQUE 22 | # index_users_on_reset_password_token (reset_password_token) UNIQUE 23 | # 24 | 25 | class User < ApplicationRecord 26 | include RailsAdmin::UserAdmin 27 | # Include default devise modules. Others available are: 28 | # :confirmable, :lockable, :timeoutable and :omniauthable 29 | devise :database_authenticatable, :registerable, 30 | :recoverable, :rememberable, :trackable, :validatable 31 | end 32 | -------------------------------------------------------------------------------- /app/views/admins/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 | 6 | <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 7 |
    8 | 9 | 10 | 11 | <%= f.input :email, required: false, autofocus: true, label: false, placeholder: 'Adresse Email' %> 12 |
    13 |
    14 | 15 | 16 | 17 | <%= f.input :password, required: false, label: false, placeholder: 'Mot de passe' %> 18 |
    19 |
    20 | <%= f.button :submit, 'SE CONNECTER' %> 21 |
    22 | <% end %> 23 | 26 |
    27 |
    28 |
    29 |
    30 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: users 4 | # 5 | # id :integer not null, primary key 6 | # email :string default(""), not null 7 | # encrypted_password :string default(""), not null 8 | # reset_password_token :string 9 | # reset_password_sent_at :datetime 10 | # remember_created_at :datetime 11 | # sign_in_count :integer default(0), not null 12 | # current_sign_in_at :datetime 13 | # last_sign_in_at :datetime 14 | # current_sign_in_ip :string 15 | # last_sign_in_ip :string 16 | # created_at :datetime not null 17 | # updated_at :datetime not null 18 | # 19 | # Indexes 20 | # 21 | # index_users_on_email (email) UNIQUE 22 | # index_users_on_reset_password_token (reset_password_token) UNIQUE 23 | # 24 | 25 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 26 | 27 | # This model initially had no columns defined. If you add columns to the 28 | # model remove the '{}' from the fixture names and add the columns immediately 29 | # below each fixture, per the syntax in the comments below 30 | # 31 | one: {} 32 | # column: value 33 | # 34 | two: {} 35 | # column: value 36 | -------------------------------------------------------------------------------- /test/fixtures/admins.yml: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: admins 4 | # 5 | # id :integer not null, primary key 6 | # email :string default(""), not null 7 | # encrypted_password :string default(""), not null 8 | # reset_password_token :string 9 | # reset_password_sent_at :datetime 10 | # remember_created_at :datetime 11 | # sign_in_count :integer default(0), not null 12 | # current_sign_in_at :datetime 13 | # last_sign_in_at :datetime 14 | # current_sign_in_ip :string 15 | # last_sign_in_ip :string 16 | # created_at :datetime not null 17 | # updated_at :datetime not null 18 | # 19 | # Indexes 20 | # 21 | # index_admins_on_email (email) UNIQUE 22 | # index_admins_on_reset_password_token (reset_password_token) UNIQUE 23 | # 24 | 25 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 26 | 27 | # This model initially had no columns defined. If you add columns to the 28 | # model remove the '{}' from the fixture names and add the columns immediately 29 | # below each fixture, per the syntax in the comments below 30 | # 31 | one: {} 32 | # column: value 33 | # 34 | two: {} 35 | # column: value 36 | -------------------------------------------------------------------------------- /config/initializers/new_framework_defaults.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains migration options to ease your Rails 5.0 upgrade. 4 | # 5 | # Once upgraded flip defaults one by one to migrate to the new default. 6 | # 7 | # Read the Guide for Upgrading Ruby on Rails for more info on each option. 8 | 9 | # Enable per-form CSRF tokens. Previous versions had false. 10 | Rails.application.config.action_controller.per_form_csrf_tokens = true 11 | 12 | # Enable origin-checking CSRF mitigation. Previous versions had false. 13 | Rails.application.config.action_controller.forgery_protection_origin_check = true 14 | 15 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. 16 | # Previous versions had false. 17 | ActiveSupport.to_time_preserves_timezone = true 18 | 19 | # Require `belongs_to` associations by default. Previous versions had false. 20 | Rails.application.config.active_record.belongs_to_required_by_default = true 21 | 22 | # Do not halt callback chains when a callback returns false. Previous versions had true. 23 | ActiveSupport.halt_callback_chains_on_return_false = false 24 | 25 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false. 26 | Rails.application.config.ssl_options = { hsts: { subdomains: true } } 27 | -------------------------------------------------------------------------------- /app/views/admins/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <% if controller_name != 'sessions' %> 2 | <%= link_to I18n.t 'devise.shared.links.sign_in', new_session_path(resource_name) %> 3 |
    4 | <% end %> 5 | <% if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to I18n.t 'devise.shared.links.sign_up', new_registration_path(resource_name) %> 7 |
    8 | <% end %> 9 | <% if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to I18n.t 'devise.shared.links.forgot_your_password', new_password_path(resource_name) %> 11 |
    12 | <% end %> 13 | <% if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to I18n.t 'devise.shared.links.didn_t_receive_confirmation_instructions', new_confirmation_path(resource_name) %> 15 |
    16 | <% end %> 17 | <% if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to I18n.t 'devise.shared.links.didn_t_receive_unlock_instructions', new_unlock_path(resource_name) %> 19 |
    20 | <% end %> 21 | <% if devise_mapping.omniauthable? %> 22 | <% resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to I18n.t('devise.shared.links.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider) %> 24 |
    25 | <% end %> 26 | <% end %> 27 | 28 | -------------------------------------------------------------------------------- /lib/tasks/auto_annotate_models.rake: -------------------------------------------------------------------------------- 1 | # NOTE: only doing this in development as some production environments (Heroku) 2 | # NOTE: are sensitive to local FS writes, and besides -- it's just not proper 3 | # NOTE: to have a dev-mode tool do its thing in production. 4 | if Rails.env.development? 5 | task :set_annotation_options do 6 | # You can override any of these by setting an environment variable of the 7 | # same name. 8 | Annotate.set_defaults({ 9 | 'position_in_routes' => "before", 10 | 'position_in_class' => "before", 11 | 'position_in_test' => "before", 12 | 'position_in_fixture' => "before", 13 | 'position_in_factory' => "before", 14 | 'show_indexes' => "true", 15 | 'simple_indexes' => "false", 16 | 'model_dir' => "app/models", 17 | 'include_version' => "false", 18 | 'require' => "", 19 | 'exclude_tests' => "false", 20 | 'exclude_fixtures' => "false", 21 | 'exclude_factories' => "false", 22 | 'ignore_model_sub_dir' => "false", 23 | 'skip_on_db_migrate' => "false", 24 | 'format_bare' => "true", 25 | 'format_rdoc' => "false", 26 | 'format_markdown' => "false", 27 | 'sort' => "false", 28 | 'force' => "false", 29 | 'trace' => "false", 30 | }) 31 | end 32 | 33 | Annotate.load_tasks 34 | end 35 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/dashboard.html.haml: -------------------------------------------------------------------------------- 1 | - @list_bg = ['info', 'success', 'danger', 'success', 'info', 'warning', 'danger', 'info', 'success'] 2 | - if @abstract_models 3 | .row 4 | - index = 0 5 | - @abstract_models.each do |abstract_model| 6 | - if authorized? :index, abstract_model 7 | - if index == @list_bg.length 8 | - index = 0 9 | - index_path = index_path(model_name: abstract_model.to_param) 10 | - row_class = "box bg-#{ @list_bg[index].to_s } #{"link" if index_path} #{abstract_model.param_key}_links #{abstract_model.config.label_plural}" 11 | .col-sm-4 12 | .box{class: row_class, :"data-link" => index_path} 13 | %i{class: "icon-bg #{abstract_model.config.navigation_icon.present? ? abstract_model.config.navigation_icon : 'file' }"} 14 | .text-center 15 | %p= t('admin.rollincode.number')+' '+ capitalize_first_letter(abstract_model.config.label_plural) 16 | %strong= @count[abstract_model.model.name].to_s 17 | %p= link_to t('admin.rollincode.show')+' '+capitalize_first_letter(abstract_model.config.label_plural), index_path, class: 'btn btn-black pjax' 18 | - index += 1 19 | :javascript 20 | $('.breadcrumb, .nav-tabs').hide(); 21 | - if @auditing_adapter && authorized?(:history_index) 22 | #block-tables.block 23 | .content 24 | %h2= t("admin.actions.history_index.menu") 25 | = render partial: 'rails_admin/main/dashboard_history' 26 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - 'bin/**/*' 4 | - 'db/schema.rb' 5 | - 'tmp/**/*' 6 | - 'vendor/bundle/**/*' 7 | 8 | Metrics/AbcSize: 9 | Max: 15 10 | 11 | Metrics/BlockNesting: 12 | Max: 3 13 | 14 | Metrics/ClassLength: 15 | CountComments: false 16 | Max: 100 17 | 18 | Metrics/CyclomaticComplexity: 19 | Max: 6 20 | 21 | Metrics/LineLength: 22 | AllowURI: true 23 | Enabled: false 24 | 25 | Metrics/MethodLength: 26 | CountComments: false 27 | Max: 15 28 | 29 | Metrics/ModuleLength: 30 | Max: 100 31 | 32 | Metrics/ParameterLists: 33 | Max: 4 34 | CountKeywordArgs: true 35 | 36 | Metrics/PerceivedComplexity: 37 | Max: 7 38 | 39 | Style/AccessModifierIndentation: 40 | EnforcedStyle: outdent 41 | 42 | Style/CollectionMethods: 43 | PreferredMethods: 44 | map: 'collect' 45 | reduce: 'inject' 46 | find: 'detect' 47 | find_all: 'select' 48 | 49 | Style/Documentation: 50 | Enabled: false 51 | 52 | Style/DotPosition: 53 | EnforcedStyle: trailing 54 | 55 | Style/DoubleNegation: 56 | Enabled: false 57 | 58 | Style/EachWithObject: 59 | Enabled: false 60 | 61 | Style/Encoding: 62 | Enabled: false 63 | 64 | Style/FileName: 65 | Exclude: 66 | - 'lib/rails_admin/bootstrap-sass.rb' 67 | 68 | Style/Lambda: 69 | Enabled: false 70 | 71 | Style/RaiseArgs: 72 | EnforcedStyle: compact 73 | 74 | Style/SpaceInsideHashLiteralBraces: 75 | EnforcedStyle: no_space 76 | 77 | Style/TrailingCommaInLiteral: 78 | EnforcedStyleForMultiline: 'comma' 79 | -------------------------------------------------------------------------------- /app/controllers/froala_controller.rb: -------------------------------------------------------------------------------- 1 | class FroalaController < ApplicationController 2 | def upload 3 | uploader = FroalaUploader.new(params[:model], params[:type]) 4 | uploader.store!(params[:file]) 5 | 6 | respond_to do |format| 7 | format.json { render json: {status: 'OK', link: uploader.url} } 8 | end 9 | end 10 | 11 | def delete 12 | image_name = params[:src].split('/').last 13 | 14 | image_path = "uploads/froala/#{params[:model]}/image/#{image_name}" 15 | path = "#{Rails.root}/public/#{image_path}" 16 | 17 | FileUtils.rm(path) 18 | 19 | respond_to do |format| 20 | format.json { render json: {status: 'OK'} } 21 | end 22 | end 23 | 24 | def manage 25 | images = [] 26 | 27 | image_path = "uploads/froala/#{params[:model]}/image" 28 | real_image_path = "#{request.headers['HTTP_ORIGIN']}/uploads/froala/#{params[:model]}/image/" 29 | path = "#{Rails.root}/public/#{image_path}" 30 | 31 | if File.directory?(path) 32 | Dir.foreach(path) do |item| 33 | next if item == '.' || item == '..' 34 | object = ObjectImage.new 35 | object.url = real_image_path + item 36 | object.thumb = real_image_path + item 37 | object.tag = params[:model] 38 | 39 | images << object 40 | end 41 | end 42 | 43 | respond_to do |format| 44 | format.json { render json: images } 45 | end 46 | end 47 | 48 | private 49 | 50 | class ObjectImage 51 | attr_accessor :url, :thumb, :tag 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /config/deploy.rb: -------------------------------------------------------------------------------- 1 | # config valid only for current version of Capistrano 2 | lock '3.6.1' 3 | 4 | set :application, 'my_app_name' 5 | set :repo_url, 'git@example.com:me/my_repo.git' 6 | set :deploy_to, '/home/project/www' 7 | 8 | append :linked_files, 'config/database.yml', 'config/secrets.yml' 9 | set :linked_dirs, %w(bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads) 10 | 11 | set :keep_releases, 1 12 | after 'deploy:publishing', 'passenger:restart' 13 | 14 | # Default branch is :master 15 | # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp 16 | 17 | # Default deploy_to directory is /var/www/my_app_name 18 | # set :deploy_to, '/var/www/my_app_name' 19 | 20 | # Default value for :scm is :git 21 | # set :scm, :git 22 | 23 | # Default value for :format is :airbrussh. 24 | # set :format, :airbrussh 25 | 26 | # You can configure the Airbrussh format using :format_options. 27 | # These are the defaults. 28 | # set :format_options, command_output: true, log_file: 'log/capistrano.log', color: :auto, truncate: :auto 29 | 30 | # Default value for :pty is false 31 | # set :pty, true 32 | 33 | # Default value for :linked_files is [] 34 | # append :linked_files, 'config/database.yml', 'config/secrets.yml' 35 | 36 | # Default value for linked_dirs is [] 37 | # append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system' 38 | 39 | # Default value for default_env is {} 40 | # set :default_env, { path: "/opt/ruby/bin:$PATH" } 41 | 42 | # Default value for keep_releases is 5 43 | # set :keep_releases, 5 44 | -------------------------------------------------------------------------------- /db/migrate/20161209093436_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :users do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.string :current_sign_in_ip 20 | t.string :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | 34 | t.timestamps null: false 35 | end 36 | 37 | add_index :users, :email, unique: true 38 | add_index :users, :reset_password_token, unique: true 39 | # add_index :users, :confirmation_token, unique: true 40 | # add_index :users, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /db/migrate/20161209093430_devise_create_admins.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateAdmins < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :admins do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.string :current_sign_in_ip 20 | t.string :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | 34 | t.timestamps null: false 35 | end 36 | 37 | add_index :admins, :email, unique: true 38 | add_index :admins, :reset_password_token, unique: true 39 | # add_index :admins, :confirmation_token, unique: true 40 | # add_index :admins, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /app/models/concerns/rails_admin/content_admin.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin::ContentAdmin 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | rails_admin do 6 | navigation_label 'Content' 7 | navigation_icon 'fa fa-pencil-square-o' 8 | label_plural 'Contents' 9 | weight -1 10 | 11 | edit do 12 | field :code 13 | field :content, :froala do 14 | config_options do 15 | { 16 | imageUploadURL: '/froala_upload', 17 | imageUploadParam: 'file', 18 | imageUploadParams: { 19 | type: 'image', 20 | model: 'content', 21 | }, 22 | fileUploadURL: '/froala_upload', 23 | fileUploadParam: 'file', 24 | fileUploadParams: { 25 | type: 'file', 26 | model: 'content', 27 | }, 28 | imageManagerLoadMethod: 'POST', 29 | imageManagerLoadURL: '/froala_manage', 30 | imageManagerLoadParams: { 31 | model: 'content', 32 | format: 'json', 33 | }, 34 | imageManagerDeleteMethod: 'DELETE', 35 | imageManagerDeleteURL: '/froala_delete', 36 | imageManagerDeleteParams: { 37 | model: 'content', 38 | format: 'json', 39 | }, 40 | } 41 | end 42 | end 43 | end 44 | 45 | show do 46 | end 47 | 48 | list do 49 | exclude_fields :created_at, :updated_at, :content 50 | end 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require font-awesome 14 | *= require_tree . 15 | *= stub rails_admin/custom/theming.scss 16 | *= require_self 17 | */ 18 | 19 | @import 'bootstrap-sprockets'; 20 | @import 'bootstrap'; 21 | @import 'font-awesome'; 22 | 23 | $primary: #1abc9c; 24 | $secondary: #2c3e50; 25 | 26 | body { 27 | background: url('https://source.unsplash.com/1920x1080/?landscape') center fixed; 28 | background-size: cover; 29 | } 30 | 31 | .rollinbox { 32 | position: absolute; 33 | top: 50%; 34 | left: 50%; 35 | transform: translate(-50%, -50%); 36 | color: #fff; 37 | } 38 | 39 | .rounded { 40 | width: 150px; 41 | height: 150px; 42 | position: relative; 43 | border: 2px solid $primary; 44 | background: $secondary; 45 | color: #fff; 46 | border-radius: 50%; 47 | padding: 15px; 48 | font-size: 70px; 49 | } 50 | 51 | .icon-centered { 52 | left: 50%; 53 | position: absolute; 54 | top: 50%; 55 | transform: translate(-50%, -50%); 56 | } 57 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    We're sorry, but something went wrong.

    62 |
    63 |

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

    64 |
    65 | 66 | 67 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    The change you wanted was rejected.

    62 |

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

    63 |
    64 |

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

    65 |
    66 | 67 | 68 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    The page you were looking for doesn't exist.

    62 |

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

    63 |
    64 |

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

    65 |
    66 | 67 | 68 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => 'public, max-age=3600' 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum, this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. If you use this option 30 | # you need to make sure to reconnect any threads in the `on_worker_boot` 31 | # block. 32 | # 33 | # preload_app! 34 | 35 | # The code in the `on_worker_boot` will be called if you are using 36 | # clustered mode by specifying a number of `workers`. After each worker 37 | # process is booted this block will be run, if you are using `preload_app!` 38 | # option you will want to use this block to reconnect to any threads 39 | # or connections that may have been created at application boot, Ruby 40 | # cannot share connections between processes. 41 | # 42 | # on_worker_boot do 43 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 44 | # end 45 | 46 | # Allow puma to be restarted by `rails restart` command. 47 | plugin :tmp_restart 48 | -------------------------------------------------------------------------------- /config/deploy/production.rb: -------------------------------------------------------------------------------- 1 | # server-based syntax 2 | # ====================== 3 | # Defines a single server with a list of roles and multiple properties. 4 | # You can define all roles on a single server, or split them: 5 | 6 | # server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value 7 | # server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value 8 | # server 'db.example.com', user: 'deploy', roles: %w{db} 9 | 10 | 11 | 12 | # role-based syntax 13 | # ================== 14 | 15 | # Defines a role with one or multiple servers. The primary server in each 16 | # group is considered to be the first unless any hosts have the primary 17 | # property set. Specify the username and a domain or IP for the server. 18 | # Don't use `:all`, it's a meta role. 19 | 20 | # role :app, %w{deploy@example.com}, my_property: :my_value 21 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value 22 | # role :db, %w{deploy@example.com} 23 | 24 | 25 | 26 | # Configuration 27 | # ============= 28 | # You can set any configuration variable like in config/deploy.rb 29 | # These variables are then only loaded and set in this stage. 30 | # For available Capistrano configuration variables see the documentation page. 31 | # http://capistranorb.com/documentation/getting-started/configuration/ 32 | # Feel free to add new variables to customise your setup. 33 | 34 | 35 | 36 | # Custom SSH Options 37 | # ================== 38 | # You may pass any option but keep in mind that net/ssh understands a 39 | # limited set of options, consult the Net::SSH documentation. 40 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start 41 | # 42 | # Global options 43 | # -------------- 44 | # set :ssh_options, { 45 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 46 | # forward_agent: false, 47 | # auth_methods: %w(password) 48 | # } 49 | # 50 | # The server-based syntax can be used to override options: 51 | # ------------------------------------ 52 | # server 'example.com', 53 | # user: 'user_name', 54 | # roles: %w{web app}, 55 | # ssh_options: { 56 | # user: 'user_name', # overrides user setting above 57 | # keys: %w(/home/user_name/.ssh/id_rsa), 58 | # forward_agent: false, 59 | # auth_methods: %w(publickey password) 60 | # # password: 'please use keys' 61 | # } 62 | -------------------------------------------------------------------------------- /config/deploy/staging.rb: -------------------------------------------------------------------------------- 1 | # server-based syntax 2 | # ====================== 3 | # Defines a single server with a list of roles and multiple properties. 4 | # You can define all roles on a single server, or split them: 5 | 6 | # server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value 7 | # server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value 8 | # server 'db.example.com', user: 'deploy', roles: %w{db} 9 | 10 | 11 | 12 | # role-based syntax 13 | # ================== 14 | 15 | # Defines a role with one or multiple servers. The primary server in each 16 | # group is considered to be the first unless any hosts have the primary 17 | # property set. Specify the username and a domain or IP for the server. 18 | # Don't use `:all`, it's a meta role. 19 | 20 | # role :app, %w{deploy@example.com}, my_property: :my_value 21 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value 22 | # role :db, %w{deploy@example.com} 23 | 24 | 25 | 26 | # Configuration 27 | # ============= 28 | # You can set any configuration variable like in config/deploy.rb 29 | # These variables are then only loaded and set in this stage. 30 | # For available Capistrano configuration variables see the documentation page. 31 | # http://capistranorb.com/documentation/getting-started/configuration/ 32 | # Feel free to add new variables to customise your setup. 33 | 34 | 35 | 36 | # Custom SSH Options 37 | # ================== 38 | # You may pass any option but keep in mind that net/ssh understands a 39 | # limited set of options, consult the Net::SSH documentation. 40 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start 41 | # 42 | # Global options 43 | # -------------- 44 | # set :ssh_options, { 45 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 46 | # forward_agent: false, 47 | # auth_methods: %w(password) 48 | # } 49 | # 50 | # The server-based syntax can be used to override options: 51 | # ------------------------------------ 52 | # server 'example.com', 53 | # user: 'user_name', 54 | # roles: %w{web app}, 55 | # ssh_options: { 56 | # user: 'user_name', # overrides user setting above 57 | # keys: %w(/home/user_name/.ssh/id_rsa), 58 | # forward_agent: false, 59 | # auth_methods: %w(publickey password) 60 | # # password: 'please use keys' 61 | # } 62 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | if Rails.root.join('tmp/caching-dev.txt').exist? 17 | config.action_controller.perform_caching = true 18 | 19 | config.cache_store = :memory_store 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => 'public, max-age=172800' 22 | } 23 | else 24 | config.action_controller.perform_caching = false 25 | 26 | config.cache_store = :null_store 27 | end 28 | 29 | # Don't care if the mailer can't send. 30 | config.action_mailer.raise_delivery_errors = false 31 | 32 | config.action_mailer.perform_caching = false 33 | 34 | # Print deprecation notices to the Rails logger. 35 | config.active_support.deprecation = :log 36 | 37 | # Raise an error on page load if there are pending migrations. 38 | config.active_record.migration_error = :page_load 39 | 40 | # Debug mode disables concatenation and preprocessing of assets. 41 | # This option may cause significant delays in view rendering with a large 42 | # number of complex assets. 43 | config.assets.debug = true 44 | 45 | # Suppress logger output for asset requests. 46 | config.assets.quiet = true 47 | 48 | # Raises error for missing translations 49 | # config.action_view.raise_on_missing_translations = true 50 | 51 | # Use an evented file watcher to asynchronously detect changes in source code, 52 | # routes, locales, etc. This feature depends on the listen gem. 53 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 54 | 55 | # Devise 56 | config.action_mailer.default_url_options = {host: 'localhost', port: 3000} 57 | 58 | # Mailcatcher 59 | config.action_mailer.delivery_method = :smtp 60 | config.action_mailer.smtp_settings = {address: 'localhost', port: 1025} 61 | end 62 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | git_source(:github) do |repo_name| 4 | repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 5 | "https://github.com/#{repo_name}.git" 6 | end 7 | 8 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 9 | gem 'rails', '~> 5.1.5' 10 | # Use sqlite3 as the database for Active Record 11 | gem 'sqlite3' 12 | # Use Puma as the app server 13 | gem 'puma', '~> 3.7' 14 | # Use SCSS for stylesheets 15 | gem 'sass-rails', '~> 5.0' 16 | # Use Uglifier as compressor for JavaScript assets 17 | gem 'uglifier', '>= 1.3.0' 18 | # Use CoffeeScript for .coffee assets and views 19 | gem 'coffee-rails', '~> 4.2' 20 | # See https://github.com/rails/execjs#readme for more supported runtimes 21 | # gem 'therubyracer', platforms: :ruby 22 | 23 | # Use jquery as the JavaScript library 24 | gem 'jquery-rails' 25 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 26 | gem 'turbolinks', '~> 5' 27 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 28 | gem 'jbuilder', '~> 2.5' 29 | # Use Redis adapter to run Action Cable in production 30 | # gem 'redis', '~> 3.0' 31 | # Use ActiveModel has_secure_password 32 | # gem 'bcrypt', '~> 3.1.7' 33 | 34 | # gem 'pg' 35 | 36 | # Front 37 | gem 'font-awesome-rails' 38 | gem 'bootstrap-sass', '~> 3.3.6' 39 | gem 'autoprefixer-rails' 40 | gem 'recaptcha', require: 'recaptcha/rails' 41 | gem 'sitemap_generator' 42 | #gem 'webpacker', github: 'rails/webpacker' 43 | 44 | # Backend / Utils 45 | gem 'wysiwyg-rails' 46 | gem 'devise', github: 'plataformatec/devise' 47 | gem 'annotate' 48 | gem 'carrierwave' 49 | gem 'mini_magick' 50 | gem 'friendly_id' 51 | gem 'ancestry' 52 | gem 'whenever' 53 | gem 'kaminari' 54 | gem 'breadcrumbs_on_rails' 55 | gem 'simple_form' 56 | 57 | # ADMIN 58 | gem 'rails_admin_nestable', '~> 0.3.2' 59 | gem 'rails_admin_rollincode', '~> 1.1' 60 | gem 'rails_admin', '~> 1.3' 61 | 62 | group :development, :test do 63 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 64 | gem 'byebug', platform: :mri 65 | end 66 | 67 | group :development do 68 | # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 69 | gem 'web-console', '>= 3.3.0' 70 | gem 'listen', '>= 3.0.5', '< 3.2' 71 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 72 | gem 'spring' 73 | gem 'spring-watcher-listen', '~> 2.0.0' 74 | 75 | gem 'better_errors' 76 | gem 'pry-byebug' 77 | gem 'faker' 78 | 79 | # Capistrano 80 | gem 'capistrano', '~> 3.6' 81 | gem 'capistrano-rails', '~> 1.2' 82 | gem 'capistrano-bundler', '~> 1.2' 83 | gem 'capistrano-rbenv', '~> 2.0' 84 | end 85 | 86 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 87 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 88 | 89 | gem 'rails_12factor', group: :production 90 | -------------------------------------------------------------------------------- /app/assets/javascripts/rails_admin/custom/ui.js: -------------------------------------------------------------------------------- 1 | //= require froala_editor.min.js 2 | //= require plugins/align.min.js 3 | //= require plugins/char_counter.min.js 4 | //= require plugins/code_beautifier.min.js 5 | //= require plugins/code_view.min.js 6 | //= require plugins/colors.min.js 7 | //= require plugins/draggable.min.js 8 | //= require plugins/emoticons.min.js 9 | //= require plugins/entities.min.js 10 | //= require plugins/file.min.js 11 | //= require plugins/font_family.min.js 12 | //= require plugins/font_size.min.js 13 | //= require plugins/fullscreen.min.js 14 | //= require plugins/image.min.js 15 | //= require plugins/image_manager.min.js 16 | //= require plugins/inline_style.min.js 17 | //= require plugins/line_breaker.min.js 18 | //= require plugins/link.min.js 19 | //= require plugins/lists.min.js 20 | //= require plugins/paragraph_format.min.js 21 | //= require plugins/paragraph_style.min.js 22 | //= require plugins/quick_insert.min.js 23 | //= require plugins/quote.min.js 24 | //= require plugins/save.min.js 25 | //= require plugins/table.min.js 26 | //= require plugins/url.min.js 27 | //= require plugins/video.min.js 28 | //= require languages/fr.js 29 | 30 | $(document).on('ready pjax:success', function(e) { 31 | handleActiveBase(); 32 | function handleActiveBase() { 33 | $('.sub-menu').each(function () { 34 | if ($(this).hasClass('active')) { 35 | $(this).parent().prev().addClass('active'); 36 | $(this).parent().prev().addClass('open'); 37 | $(this).parent().slideDown(); 38 | } 39 | }); 40 | } 41 | // home dashboard dark theme 42 | if((new RegExp('admin/$').test(e.currentTarget.URL) 43 | || new RegExp('admin$').test(e.currentTarget.URL)) 44 | && !new RegExp('admin/admin').test(e.currentTarget.URL)){ 45 | $('.page-header, .content').addClass('dashboard'); 46 | } 47 | else { 48 | $('.page-header, .content').removeClass('dashboard'); 49 | } 50 | }); 51 | 52 | $(function () { 53 | var width = $('.nav-stacked').width(); 54 | $('.navbar-header').width(width); 55 | 56 | var array_menu = []; 57 | var lvl_1 = null; 58 | var count = 0; 59 | 60 | $('.sidebar-nav li').each(function (index, item) { 61 | if ($(item).hasClass('dropdown-header')) { 62 | lvl_1 = count++; 63 | array_menu[lvl_1] = [] 64 | } else { 65 | $(item).addClass('sub-menu sub-menu-' + lvl_1); 66 | } 67 | }); 68 | 69 | for (var i = 0; i <= array_menu.length; i++) { 70 | $('.sub-menu-' + i).wrapAll("