require 'symphonia/object' require 'authlogic' require 'cancancan' require 'scrypt' require 'will_paginate' require 'api-pagination' require 'rails_i18n' require 'rdiscount' require 'sortable-table' require 'bootstrap_form' module Symphonia class Engine < ::Rails::Engine isolate_namespace Symphonia config.autoload_paths << File.expand_path("..", __dir__) config.generators do |g| g.test_framework :rspec, fixture: false g.fixture_replacement :factory_bot, dir: 'spec/factories' end initializer :symphonia_extensions do ActiveSupport.on_load(:action_controller_base) do # prepend Symphonia::ApplicationController helper Symphonia::ApplicationHelper helper Symphonia::BootstrapModalHelper end end initializer :symphonia_setup do |_app| Mime::Type.register 'application/pdf', :pdf config.i18n.available_locales ||= %i[cs en] config.i18n.default_locale = :cs WillPaginate.per_page = 20 Symphonia.configure do |config| config.after_login_path = ->(h) { h.symphonia.user_current_path } config.allow_registrations = true config.default_locale = :cs end end initializer :append_migrations do |app| if app.root.to_s != root.to_s && app.root != root.join("spec/dummy") config.paths['db/migrate'].expanded.each do |expanded_path| app.config.paths['db/migrate'] << expanded_path end end end initializer :load_helper, before: :load_config_initializers do |app| if Rails.env.development? config.action_mailer.default_url_options ||= { host: 'symphonia.app' } config.action_mailer.preview_path = "{#{app.root.join('spec/mailers/previews')},#{root.join('spec/mailers/previews')}}" end end # initializer :wicked_pdf do |_app| # WickedPdf.config = { # layout: 'application.pdf', # print_media_type: true, # viewport_size: '1280x800', zoom: 0.7, dpi: 300 # } # end initializer :api_paginate do ApiPagination.configure do |config| # If you have both gems included, you can choose a paginator. config.paginator = :will_paginate # By default, this is set to 'Total' config.total_header = 'X-Total' # By default, this is set to 'Per-Page' config.per_page_header = 'X-Per-Page' # Optional: set this to add a header with the current page number. config.page_header = 'X-Page' # Optional: what parameter should be used to set the page option # config.page_param = :page # # or # config.page_param do |params| # params[:page][:number] # end # # # Optional: what parameter should be used to set the per page option # config.per_page_param = :per_page # # or # config.per_page_param do |params| # params[:page][:size] # end end end end end