6 |
7 |
--------------------------------------------------------------------------------
/spec/dummy/app/admin/pages.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.register Page do
2 | form do |f|
3 | f.inputs do
4 | f.input :title
5 | f.input :content, as: :html_editor
6 | end
7 |
8 | f.actions
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/stylesheets/active_admin.css.scss:
--------------------------------------------------------------------------------
1 | // Active Admin CSS Styles
2 | @import "active_admin/mixins";
3 | @import "active_admin/base";
4 |
5 | // To customize the Active Admin interfaces, add your
6 | // styles here:
7 |
--------------------------------------------------------------------------------
/lib/generators/active_admin/editor/templates/active_admin_editor.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin::Editor.configure do |config|
2 | # config.s3_bucket = ''
3 | # config.aws_access_key_id = ''
4 | # config.aws_access_secret = ''
5 | # config.storage_dir = 'uploads'
6 | end
7 |
--------------------------------------------------------------------------------
/spec/dummy/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Sample localization file for English. Add more files in this directory for other locales.
2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3 |
4 | en:
5 | hello: "Hello world"
6 |
--------------------------------------------------------------------------------
/lib/active_admin/editor.rb:
--------------------------------------------------------------------------------
1 | require 'activeadmin'
2 |
3 | require 'active_admin/editor/version'
4 | require 'active_admin/editor/parser_rules'
5 | require 'active_admin/editor/config'
6 | require 'active_admin/editor/policy'
7 | require 'active_admin/editor/engine'
8 |
--------------------------------------------------------------------------------
/spec/dummy/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 | # Mime::Type.register_alias "text/html", :iphone
6 |
--------------------------------------------------------------------------------
/spec/dummy/db/migrate/20121224200305_create_pages.rb:
--------------------------------------------------------------------------------
1 | class CreatePages < ActiveRecord::Migration
2 | def change
3 | create_table :pages do |t|
4 | t.string :title
5 | t.text :content
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/spec/factories.rb:
--------------------------------------------------------------------------------
1 | FactoryGirl.define do
2 | sequence :email do |n|
3 | "email#{n}@factory.com"
4 | end
5 |
6 | factory :admin_user do
7 | email
8 | password { 'password' }
9 | password_confirmation { 'password' }
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/app/assets/javascripts/active_admin/editor.js:
--------------------------------------------------------------------------------
1 | //= require wysihtml5
2 | //= require active_admin/editor/config
3 | //= require active_admin/editor/editor
4 |
5 | ;(function(window, $) {
6 | $(function() { $('.html_editor').editor(window.AA.editor_config) })
7 | })(window, jQuery)
8 |
--------------------------------------------------------------------------------
/spec/dummy/config/boot.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3 |
4 | if File.exist?(gemfile)
5 | ENV['BUNDLE_GEMFILE'] = gemfile
6 | require 'bundler'
7 | Bundler.setup
8 | end
9 |
10 | $:.unshift File.expand_path('../../../../lib', __FILE__)
--------------------------------------------------------------------------------
/spec/dummy/Rakefile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env rake
2 | # Add your own tasks in files placed in lib/tasks ending in .rake,
3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4 |
5 | require File.expand_path('../config/application', __FILE__)
6 |
7 | Dummy::Application.load_tasks
8 |
--------------------------------------------------------------------------------
/spec/dummy/script/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3 |
4 | APP_PATH = File.expand_path('../../config/application', __FILE__)
5 | require File.expand_path('../../config/boot', __FILE__)
6 | require 'rails/commands'
7 |
--------------------------------------------------------------------------------
/spec/dummy/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Dummy
5 | <%= stylesheet_link_tag "application", :media => "all" %>
6 | <%= javascript_include_tag "application" %>
7 | <%= csrf_meta_tags %>
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/spec/support/sign_in_helpers.rb:
--------------------------------------------------------------------------------
1 | module SignInHelpers
2 | def sign_in(user)
3 | visit new_admin_user_session_path
4 | fill_in 'Email', :with => user.email
5 | fill_in 'Password', :with => user.password
6 | click_on 'Login'
7 | end
8 | end
9 |
10 | RSpec.configure do |config|
11 | config.include SignInHelpers, :type => :request
12 | end
13 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/konacha.rb:
--------------------------------------------------------------------------------
1 | Konacha.configure do |config|
2 | require 'capybara/poltergeist'
3 | config.driver = :poltergeist
4 |
5 | def Konacha.spec_root
6 | File.expand_path('../../../../../spec/javascripts', __FILE__)
7 | end
8 |
9 | Rails.application.config.assets.paths << Konacha.spec_root
10 | end if defined?(Konacha)
11 |
--------------------------------------------------------------------------------
/spec/javascripts/templates/editor.jst.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/spec/requests/editor_request_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'Editor', :js => true do
4 | before do
5 | sign_in create(:admin_user)
6 | visit new_admin_page_path
7 | end
8 |
9 | it 'adds the input as an html_editor input' do
10 | expect(page).to have_selector('li.html_editor')
11 | end
12 |
13 | it 'intitalizes the editor' do
14 | expect(page).to have_selector('li.html_editor .toolbar')
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/lib/generators/active_admin/editor/editor_generator.rb:
--------------------------------------------------------------------------------
1 | module ActiveAdmin
2 | module Generators
3 | class EditorGenerator < Rails::Generators::Base
4 | desc 'Installs the active admin html5 editor.'
5 |
6 | source_root File.expand_path('../templates', __FILE__)
7 |
8 | def copy_initializer
9 | template 'active_admin_editor.rb', 'config/initializers/active_admin_editor.rb'
10 | end
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/spec/dummy/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 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4 |
5 | # Use the database for sessions instead of the cookie-based default,
6 | # which shouldn't be used to store highly confidential information
7 | # (create the session table with "rails generate session_migration")
8 | # Dummy::Application.config.session_store :active_record_store
9 |
--------------------------------------------------------------------------------
/spec/dummy/app/models/admin_user.rb:
--------------------------------------------------------------------------------
1 | class AdminUser < ActiveRecord::Base
2 | # Include default devise modules. Others available are:
3 | # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable,
5 | :recoverable, :rememberable, :trackable, :validatable
6 |
7 | # Setup accessible (or protected) attributes for your model
8 | attr_accessible :email, :password, :password_confirmation, :remember_me
9 | # attr_accessible :title, :body
10 | end
11 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 | # Make sure the secret is at least 30 characters and all random,
6 | # no regular words or you'll be exposed to dictionary attacks.
7 | Dummy::Application.config.secret_token = '7eb151084ac9c928baf810ee400751d4ac9fc7807ab6fe4108595ee7ddcc8d279624918d38d185b9a7b195c815ccacc9d619605f97e7b6460d0d69bd9e816028'
8 |
--------------------------------------------------------------------------------
/spec/dummy/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 | # Disable root element in JSON by default.
12 | ActiveSupport.on_load(:active_record) do
13 | self.include_root_in_json = false
14 | end
15 |
--------------------------------------------------------------------------------
/spec/dummy/db/migrate/20121224120152_create_admin_notes.rb:
--------------------------------------------------------------------------------
1 | class CreateAdminNotes < ActiveRecord::Migration
2 | def self.up
3 | create_table :admin_notes do |t|
4 | t.string :resource_id, :null => false
5 | t.string :resource_type, :null => false
6 | t.references :admin_user, :polymorphic => true
7 | t.text :body
8 | t.timestamps
9 | end
10 | add_index :admin_notes, [:resource_type, :resource_id]
11 | add_index :admin_notes, [:admin_user_type, :admin_user_id]
12 | end
13 |
14 | def self.down
15 | drop_table :admin_notes
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/dummy/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
4 | # (all these examples are active by default):
5 | # ActiveSupport::Inflector.inflections do |inflect|
6 | # inflect.plural /^(ox)$/i, '\1en'
7 | # inflect.singular /^(ox)en/i, '\1'
8 | # inflect.irregular 'person', 'people'
9 | # inflect.uncountable %w( fish sheep )
10 | # end
11 | #
12 | # These inflection rules are supported but not enabled by default:
13 | # ActiveSupport::Inflector.inflections do |inflect|
14 | # inflect.acronym 'RESTful'
15 | # end
16 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
9 | * compiled file, but it's generally better to create a new file per style scope.
10 | *
11 | *= require_self
12 | *= require_tree .
13 | */
14 |
--------------------------------------------------------------------------------
/app/inputs/html_editor_input.rb:
--------------------------------------------------------------------------------
1 | class HtmlEditorInput < Formtastic::Inputs::TextInput
2 | def upload_enabled?
3 | ActiveAdmin::Editor.configuration.s3_configured?
4 | end
5 |
6 | def policy
7 | ActiveAdmin::Editor::Policy.new
8 | end
9 |
10 | def wrapper_html_options
11 | return super unless upload_enabled?
12 | super.merge( :data => { :policy => policy.to_json })
13 | end
14 |
15 | def to_html
16 | html = '
'
17 | html << builder.text_area(method, input_html_options)
18 | html << '
'
19 | html << ''
20 | input_wrapping do
21 | label_html << html.html_safe
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/spec/dummy/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 | development:
7 | adapter: sqlite3
8 | database: db/development.sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | # Warning: The database defined as "test" will be erased and
13 | # re-generated from your development database when you run "rake".
14 | # Do not set this db to the same as development or production.
15 | test:
16 | adapter: sqlite3
17 | database: db/test.sqlite3
18 | pool: 5
19 | timeout: 5000
20 |
21 | production:
22 | adapter: sqlite3
23 | database: db/production.sqlite3
24 | pool: 5
25 | timeout: 5000
26 |
--------------------------------------------------------------------------------
/spec/dummy/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 vendor/assets/javascripts of plugins, if any, 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 | // the compiled file.
9 | //
10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11 | // GO AFTER THE REQUIRES BELOW.
12 | //
13 | //= require jquery
14 | //= require jquery_ujs
15 | //= require_tree .
16 |
--------------------------------------------------------------------------------
/app/assets/javascripts/active_admin/editor/config.js.erb:
--------------------------------------------------------------------------------
1 | ;(function(window) {
2 | window.AA = (window.AA || {})
3 | var config = window.AA.editor_config = (window.AA.editor_config || {})
4 |
5 | <% %w(aws_access_key_id s3_bucket storage_dir).each do |option| %>
6 | config.<%= option %> = '<%= ActiveAdmin::Editor.configuration.send(option.to_sym) %>'
7 | <% end %>
8 |
9 | config.stylesheets = <%= ActiveAdmin::Editor.configuration.stylesheets.map { |stylesheet| asset_path stylesheet }.to_json %>
10 | config.spinner = '<%= asset_path 'active_admin/editor/loader.gif' %>'
11 | config.uploads_enabled = <%= ActiveAdmin::Editor.configuration.s3_configured? %>
12 | config.parserRules = <%= ActiveAdmin::Editor.configuration.parser_rules.to_json %>
13 | })(window)
14 |
--------------------------------------------------------------------------------
/spec/dummy/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
17 |
18 |
19 |
20 |
21 |
50 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Dummy::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # Code is not reloaded between requests
5 | config.cache_classes = true
6 |
7 | # Full error reports are disabled and caching is turned on
8 | config.consider_all_requests_local = false
9 | config.action_controller.perform_caching = true
10 |
11 | # Disable Rails's static asset server (Apache or nginx will already do this)
12 | config.serve_static_assets = false
13 |
14 | # Compress JavaScripts and CSS
15 | config.assets.compress = true
16 |
17 | # Don't fallback to assets pipeline if a precompiled asset is missed
18 | config.assets.compile = false
19 |
20 | # Generate digests for assets URLs
21 | config.assets.digest = true
22 |
23 | # Defaults to nil and saved in location specified by config.assets.prefix
24 | # config.assets.manifest = YOUR_PATH
25 |
26 | # Specifies the header that your server uses for sending files
27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29 |
30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31 | # config.force_ssl = true
32 |
33 | # See everything in the log (default is :info)
34 | # config.log_level = :debug
35 |
36 | # Prepend all log lines with the following tags
37 | # config.log_tags = [ :subdomain, :uuid ]
38 |
39 | # Use a different logger for distributed setups
40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41 |
42 | # Use a different cache store in production
43 | # config.cache_store = :mem_cache_store
44 |
45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server
46 | # config.action_controller.asset_host = "http://assets.example.com"
47 |
48 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49 | # config.assets.precompile += %w( search.js )
50 |
51 | # Disable delivery errors, bad email addresses will be ignored
52 | # config.action_mailer.raise_delivery_errors = false
53 |
54 | # Enable threaded mode
55 | # config.threadsafe!
56 |
57 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58 | # the I18n.default_locale when a translation can not be found)
59 | config.i18n.fallbacks = true
60 |
61 | # Send deprecation notices to registered listeners
62 | config.active_support.deprecation = :notify
63 |
64 | # Log the query plan for queries taking more than this (works
65 | # with SQLite, MySQL, and PostgreSQL)
66 | # config.active_record.auto_explain_threshold_in_seconds = 0.5
67 | end
68 |
--------------------------------------------------------------------------------
/spec/dummy/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | Bundler.require
6 | require 'active_admin_editor'
7 |
8 | module Dummy
9 | class Application < Rails::Application
10 | # Settings in config/environments/* take precedence over those specified here.
11 | # Application configuration should go into files in config/initializers
12 | # -- all .rb files in that directory are automatically loaded.
13 |
14 | # Custom directories with classes and modules you want to be autoloadable.
15 | # config.autoload_paths += %W(#{config.root}/extras)
16 |
17 | # Only load the plugins named here, in the order given (default is alphabetical).
18 | # :all can be used as a placeholder for all plugins not explicitly named.
19 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20 |
21 | # Activate observers that should always be running.
22 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23 |
24 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26 | # config.time_zone = 'Central Time (US & Canada)'
27 |
28 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30 | # config.i18n.default_locale = :de
31 |
32 | # Configure the default encoding used in templates for Ruby 1.9.
33 | config.encoding = "utf-8"
34 |
35 | # Configure sensitive parameters which will be filtered from the log file.
36 | config.filter_parameters += [:password]
37 |
38 | # Enable escaping HTML in JSON.
39 | config.active_support.escape_html_entities_in_json = true
40 |
41 | # Use SQL instead of Active Record's schema dumper when creating the database.
42 | # This is necessary if your schema can't be completely dumped by the schema dumper,
43 | # like if you have constraints or database-specific column types
44 | # config.active_record.schema_format = :sql
45 |
46 | # Enforce whitelist mode for mass assignment.
47 | # This will create an empty whitelist of attributes available for mass-assignment for all models
48 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49 | # parameters by using an attr_accessible or attr_protected declaration.
50 | config.active_record.whitelist_attributes = true
51 |
52 | # Enable the asset pipeline
53 | config.assets.enabled = true
54 |
55 | # Version of your assets, change this if you want to expire all your assets
56 | config.assets.version = '1.0'
57 | end
58 | end
59 |
60 |
--------------------------------------------------------------------------------
/spec/dummy/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended to check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(:version => 20121224200305) do
15 |
16 | create_table "active_admin_comments", :force => true do |t|
17 | t.string "resource_id", :null => false
18 | t.string "resource_type", :null => false
19 | t.integer "author_id"
20 | t.string "author_type"
21 | t.text "body"
22 | t.datetime "created_at", :null => false
23 | t.datetime "updated_at", :null => false
24 | t.string "namespace"
25 | end
26 |
27 | add_index "active_admin_comments", ["author_type", "author_id"], :name => "index_active_admin_comments_on_author_type_and_author_id"
28 | add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
29 | add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"
30 |
31 | create_table "admin_users", :force => true do |t|
32 | t.string "email", :default => "", :null => false
33 | t.string "encrypted_password", :default => "", :null => false
34 | t.string "reset_password_token"
35 | t.datetime "reset_password_sent_at"
36 | t.datetime "remember_created_at"
37 | t.integer "sign_in_count", :default => 0
38 | t.datetime "current_sign_in_at"
39 | t.datetime "last_sign_in_at"
40 | t.string "current_sign_in_ip"
41 | t.string "last_sign_in_ip"
42 | t.datetime "created_at", :null => false
43 | t.datetime "updated_at", :null => false
44 | end
45 |
46 | add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
47 | add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true
48 |
49 | create_table "pages", :force => true do |t|
50 | t.string "title"
51 | t.text "content"
52 | t.datetime "created_at", :null => false
53 | t.datetime "updated_at", :null => false
54 | end
55 |
56 | end
57 |
--------------------------------------------------------------------------------
/spec/dummy/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | errors:
5 | messages:
6 | expired: "has expired, please request a new one"
7 | not_found: "not found"
8 | already_confirmed: "was already confirmed, please try signing in"
9 | not_locked: "was not locked"
10 | not_saved:
11 | one: "1 error prohibited this %{resource} from being saved:"
12 | other: "%{count} errors prohibited this %{resource} from being saved:"
13 |
14 | devise:
15 | failure:
16 | already_authenticated: 'You are already signed in.'
17 | unauthenticated: 'You need to sign in or sign up before continuing.'
18 | unconfirmed: 'You have to confirm your account before continuing.'
19 | locked: 'Your account is locked.'
20 | invalid: 'Invalid email or password.'
21 | invalid_token: 'Invalid authentication token.'
22 | timeout: 'Your session expired, please sign in again to continue.'
23 | inactive: 'Your account was not activated yet.'
24 | sessions:
25 | signed_in: 'Signed in successfully.'
26 | signed_out: 'Signed out successfully.'
27 | passwords:
28 | send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29 | updated: 'Your password was changed successfully. You are now signed in.'
30 | updated_not_active: 'Your password was changed successfully.'
31 | send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
32 | confirmations:
33 | send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34 | send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
35 | confirmed: 'Your account was successfully confirmed. You are now signed in.'
36 | registrations:
37 | signed_up: 'Welcome! You have signed up successfully.'
38 | signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
39 | signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
40 | signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
41 | updated: 'You updated your account successfully.'
42 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
43 | destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
44 | unlocks:
45 | send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
46 | unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
47 | send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
48 | omniauth_callbacks:
49 | success: 'Successfully authorized from %{kind} account.'
50 | failure: 'Could not authorize you from %{kind} because "%{reason}".'
51 | mailer:
52 | confirmation_instructions:
53 | subject: 'Confirmation instructions'
54 | reset_password_instructions:
55 | subject: 'Reset password instructions'
56 | unlock_instructions:
57 | subject: 'Unlock Instructions'
58 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Active Admin Editor
2 | [](https://travis-ci.org/ejholmes/active_admin_editor) [](https://codeclimate.com/github/ejholmes/active_admin_editor)
3 |
4 | This is a wysiwyg html editor for the [Active Admin](http://activeadmin.info/)
5 | interface using [wysihtml5](https://github.com/xing/wysihtml5).
6 |
7 | 
8 |
9 | [Demo](http://active-admin-editor-demo.herokuapp.com/admin/pages/new)
10 |
11 | ## Installation
12 |
13 | Add the following to your `Gemfile`:
14 |
15 | ```ruby
16 | gem 'active_admin_editor'
17 | ```
18 |
19 | And include the wysiwyg styles in your `application.css`:
20 |
21 | ```scss
22 | //= require active_admin/editor/wysiwyg
23 | ```
24 |
25 | Then run the following to install the default intializer:
26 |
27 | ```bash
28 | $ rails g active_admin:editor
29 | ```
30 |
31 | ## Usage
32 |
33 | This gem provides you with a custom formtastic input called `:html_editor` to build out a wysihtml5 enabled input.
34 | All you have to do is specify the `:as` option for your inputs.
35 |
36 | **Example**
37 |
38 | ```ruby
39 | ActiveAdmin.register Page do
40 | form do |f|
41 | f.inputs do
42 | f.input :title
43 | f.input :content, as: :html_editor
44 | end
45 |
46 | f.buttons
47 | end
48 | end
49 | ```
50 |
51 | ## Uploads
52 |
53 | The editor supports uploading of assets directly to an S3 bucket. Edit the initializer that
54 | was installed when you ran `rails g active_admin:editor`.
55 |
56 | ```ruby
57 | ActiveAdmin::Editor.configure do |config|
58 | config.s3_bucket = ''
59 | config.aws_access_key_id = ''
60 | config.aws_access_secret = ''
61 | # config.storage_dir = 'uploads'
62 | end
63 | ```
64 |
65 | Then add the following CORS configuration to the S3 bucket:
66 |
67 | ```xml
68 |
69 |
70 |
71 | *
72 | PUT
73 | POST
74 | GET
75 | HEAD
76 | 3000
77 | Location
78 | *
79 |
80 |
81 | ```
82 |
83 | ## Configuration
84 |
85 | You can configure the editor in the initializer installed with `rails g
86 | active_admin:editor` or you can configure the editor during
87 | `ActiveAdmin.setup`:
88 |
89 | ```ruby
90 | ActiveAdmin.setup do |config|
91 | # ...
92 | config.editor.aws_access_key_id = ''
93 | config.editor.s3_bucket = 'bucket'
94 | end
95 | ```
96 |
97 | ## Parser Rules
98 |
99 | [Parser rules](https://github.com/xing/wysihtml5/tree/master/parser_rules) can
100 | be configured through the initializer:
101 |
102 | ```ruby
103 | ActiveAdmin::Editor.configure do |config|
104 | config.parser_rules['tags']['strike'] = {
105 | 'remove' => 0
106 | }
107 | end
108 | ```
109 |
110 | Be sure to clear your rails cache after changing the config:
111 |
112 | ```bash
113 | rm -rf tmp/cache
114 | ```
115 |
116 | ## Heroku
117 |
118 | Since some of the javascript files need to be compiled with access to the env
119 | vars, it's recommended that you add the [user-env-compile](https://devcenter.heroku.com/articles/labs-user-env-compile)
120 | labs feature to your app.
121 |
122 | 1. Tell your rails app to run initializers on asset compilation
123 |
124 | ```ruby
125 | # config/environments/production.rb
126 | config.initialize_on_precompile = true
127 | ```
128 | 2. Add the labs feature
129 |
130 | ```bash
131 | heroku labs:enable user-env-compile -a myapp
132 | ```
133 |
134 | ## Contributing
135 |
136 | 1. Fork it
137 | 2. Create your feature branch (`git checkout -b my-new-feature`)
138 | 3. Commit your changes (`git commit -am 'Added some feature'`)
139 | 4. Push to the branch (`git push origin my-new-feature`)
140 | 5. Create new Pull Request
141 |
142 | ### Tests
143 |
144 | Run RSpec tests with `bundle exec rake`. Run JavaScript specs with `bundle
145 | exec rake konacha:serve`.
146 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/active_admin.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.setup do |config|
2 |
3 | # == Site Title
4 | #
5 | # Set the title that is displayed on the main layout
6 | # for each of the active admin pages.
7 | #
8 | config.site_title = "Dummy"
9 |
10 | # Set the link url for the title. For example, to take
11 | # users to your main site. Defaults to no link.
12 | #
13 | # config.site_title_link = "/"
14 |
15 | # Set an optional image to be displayed for the header
16 | # instead of a string (overrides :site_title)
17 | #
18 | # Note: Recommended image height is 21px to properly fit in the header
19 | #
20 | # config.site_title_image = "/images/logo.png"
21 |
22 | # == Default Namespace
23 | #
24 | # Set the default namespace each administration resource
25 | # will be added to.
26 | #
27 | # eg:
28 | # config.default_namespace = :hello_world
29 | #
30 | # This will create resources in the HelloWorld module and
31 | # will namespace routes to /hello_world/*
32 | #
33 | # To set no namespace by default, use:
34 | # config.default_namespace = false
35 | #
36 | # Default:
37 | # config.default_namespace = :admin
38 | #
39 | # You can customize the settings for each namespace by using
40 | # a namespace block. For example, to change the site title
41 | # within a namespace:
42 | #
43 | # config.namespace :admin do |admin|
44 | # admin.site_title = "Custom Admin Title"
45 | # end
46 | #
47 | # This will ONLY change the title for the admin section. Other
48 | # namespaces will continue to use the main "site_title" configuration.
49 |
50 | # == User Authentication
51 | #
52 | # Active Admin will automatically call an authentication
53 | # method in a before filter of all controller actions to
54 | # ensure that there is a currently logged in admin user.
55 | #
56 | # This setting changes the method which Active Admin calls
57 | # within the controller.
58 | config.authentication_method = :authenticate_admin_user!
59 |
60 |
61 | # == Current User
62 | #
63 | # Active Admin will associate actions with the current
64 | # user performing them.
65 | #
66 | # This setting changes the method which Active Admin calls
67 | # to return the currently logged in user.
68 | config.current_user_method = :current_admin_user
69 |
70 |
71 | # == Logging Out
72 | #
73 | # Active Admin displays a logout link on each screen. These
74 | # settings configure the location and method used for the link.
75 | #
76 | # This setting changes the path where the link points to. If it's
77 | # a string, the strings is used as the path. If it's a Symbol, we
78 | # will call the method to return the path.
79 | #
80 | # Default:
81 | config.logout_link_path = :destroy_admin_user_session_path
82 |
83 | # This setting changes the http method used when rendering the
84 | # link. For example :get, :delete, :put, etc..
85 | #
86 | # Default:
87 | # config.logout_link_method = :get
88 |
89 |
90 | # == Admin Comments
91 | #
92 | # Admin comments allow you to add comments to any model for admin use.
93 | # Admin comments are enabled by default.
94 | #
95 | # Default:
96 | # config.allow_comments = true
97 | #
98 | # You can turn them on and off for any given namespace by using a
99 | # namespace config block.
100 | #
101 | # Eg:
102 | # config.namespace :without_comments do |without_comments|
103 | # without_comments.allow_comments = false
104 | # end
105 |
106 |
107 | # == Controller Filters
108 | #
109 | # You can add before, after and around filters to all of your
110 | # Active Admin resources from here.
111 | #
112 | # config.before_filter :do_something_awesome
113 |
114 |
115 | # == Register Stylesheets & Javascripts
116 | #
117 | # We recommend using the built in Active Admin layout and loading
118 | # up your own stylesheets / javascripts to customize the look
119 | # and feel.
120 | #
121 | # To load a stylesheet:
122 | # config.register_stylesheet 'my_stylesheet.css'
123 | #
124 | # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
125 | # config.register_stylesheet 'my_print_stylesheet.css', :media => :print
126 | #
127 | # To load a javascript file:
128 | # config.register_javascript 'my_javascript.js'
129 |
130 | config.editor.s3_bucket = ENV['S3_BUCKET']
131 | config.editor.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
132 | config.editor.aws_access_secret = ENV['AWS_ACCESS_SECRET']
133 | config.editor.parser_rules['tags']['strike'] = {
134 | 'remove' => 0
135 | }
136 | end
137 |
--------------------------------------------------------------------------------
/app/assets/javascripts/active_admin/editor/editor.js:
--------------------------------------------------------------------------------
1 | //= require_tree ./templates
2 |
3 | ;(function(window, wysihtml5) {
4 | window.AA = (window.AA || {})
5 | var config
6 |
7 | var Editor = function(options, el) {
8 | config = options
9 | var _this = this
10 | this.$el = $(el)
11 | this.$textarea = this.$el.find('textarea')
12 | this.policy = this.$el.data('policy')
13 |
14 | this._addToolbar()
15 | this._attachEditor()
16 | }
17 |
18 | /**
19 | * Returns the wysihtml5 editor instance for this editor.
20 | */
21 | Editor.prototype.editor = function() {
22 | return this._editor
23 | }
24 |
25 | /**
26 | * Adds the wysihtml5 toolbar. If uploads are enabled, also adds the
27 | * necessary file inputs for uploading.
28 | */
29 | Editor.prototype._addToolbar = function() {
30 | var template = JST['active_admin/editor/templates/toolbar']({
31 | id: this.$el.attr('id') + '-toolbar'
32 | })
33 |
34 | this.$toolbar = $(template)
35 |
36 | if (config.uploads_enabled) {
37 | var _this = this
38 | this.$toolbar.find('input.uploadable').each(function() {
39 | _this._addUploader(this)
40 | })
41 | }
42 |
43 | this.$el.find('.wrap').prepend(this.$toolbar)
44 | }
45 |
46 | /**
47 | * Adds a file input attached to the supplied text input. And upload is
48 | * triggered if the source of the input is changed.
49 | *
50 | * @input Text input to attach a file input to.
51 | */
52 | Editor.prototype._addUploader = function(input) {
53 | var $input = $(input)
54 |
55 | var template = JST['active_admin/editor/templates/uploader']({ spinner: config.spinner })
56 | var $uploader = $(template)
57 |
58 | var $dialog = $input.closest('[data-wysihtml5-dialog]')
59 | $dialog.append($uploader)
60 |
61 | var _this = this
62 | $uploader.find('input:file').on('change', function() {
63 | var file = this.files[0]
64 | if (file) {
65 | $input.val('')
66 | _this.upload(file, function(location) {
67 | $input.val(location)
68 | })
69 | }
70 | })
71 | }
72 |
73 | /**
74 | * Initializes the wysihtml5 editor for the textarea.
75 | */
76 | Editor.prototype._attachEditor = function() {
77 | this._editor = new wysihtml5.Editor(this.$textarea.attr('id'), {
78 | toolbar: this.$toolbar.attr('id'),
79 | stylesheets: config.stylesheets,
80 | parserRules: config.parserRules
81 | })
82 | }
83 |
84 | /**
85 | * Sets the internal uploading state to true or false. Adds the .uploading
86 | * class to the root element for stying.
87 | *
88 | * @uploading {Boolean} Whether or not something is being uploaded.
89 | */
90 | Editor.prototype._uploading = function(uploading) {
91 | this.__uploading = uploading
92 | this.$el.toggleClass('uploading', this.__uploading)
93 | return this.__uploading
94 | }
95 |
96 | /**
97 | * Uploads a file to S3. When the upload is complete, calls callback with the
98 | * location of the uploaded file.
99 | *
100 | * @file The file to upload
101 | * @callback A function to be called when the upload completes.
102 | */
103 | Editor.prototype.upload = function(file, callback) {
104 | var _this = this
105 | _this._uploading(true)
106 |
107 | var xhr = new XMLHttpRequest()
108 | , fd = new FormData()
109 | , key = config.storage_dir + '/' + Date.now().toString() + '-' + file.name
110 |
111 | fd.append('key', key)
112 | fd.append('AWSAccessKeyId', config.aws_access_key_id)
113 | fd.append('acl', 'public-read')
114 | fd.append('policy', this.policy.document)
115 | fd.append('signature', this.policy.signature)
116 | fd.append('Content-Type', file.type)
117 | fd.append('file', file)
118 |
119 | xhr.upload.addEventListener('progress', function(e) {
120 | _this.loaded = e.loaded
121 | _this.total = e.total
122 | _this.progress = e.loaded / e.total
123 | }, false)
124 |
125 | xhr.onreadystatechange = function() {
126 | if (xhr.readyState != 4) { return }
127 | _this._uploading(false)
128 | if (xhr.status == 204) {
129 | callback(xhr.getResponseHeader('Location'))
130 | } else {
131 | alert('Failed to upload file. Have you configured S3 properly?')
132 | }
133 | }
134 |
135 | xhr.open('POST', 'https://' + config.s3_bucket + '.s3.amazonaws.com', true)
136 | xhr.send(fd)
137 |
138 | return xhr
139 | }
140 |
141 | window.AA.Editor = Editor
142 | })(window, wysihtml5)
143 |
144 | ;(function(window, $) {
145 | if ($.widget) {
146 | $.widget.bridge('editor', window.AA.Editor)
147 | }
148 | })(window, jQuery)
149 |
--------------------------------------------------------------------------------
/spec/javascripts/editor_spec.js:
--------------------------------------------------------------------------------
1 | //= require spec_helper
2 | //= require support/mock_wysihtml5
3 | //= require active_admin/editor/editor
4 |
5 | describe('Editor', function() {
6 | beforeEach(function() {
7 | this.xhr = sinon.useFakeXMLHttpRequest()
8 | $('body').append(JST['templates/editor']())
9 | this.config = sinon.stub()
10 | this.editor = new window.AA.Editor(this.config, $('.html_editor'))
11 | })
12 |
13 | afterEach(function() {
14 | this.xhr.restore()
15 | })
16 |
17 | it('sets .$el', function() {
18 | expect(this.editor.$el).to.exist
19 | })
20 |
21 | it('sets .$textarea', function() {
22 | expect(this.editor.$textarea).to.exist
23 | })
24 |
25 | it('sets .$toolbar', function() {
26 | expect(this.editor.$toolbar).to.exist
27 | })
28 |
29 | it('sets .policy', function() {
30 | expect(this.editor.policy.document).to.eq('policy document')
31 | })
32 |
33 | it('sets .signature', function() {
34 | expect(this.editor.policy.signature).to.eq('policy signature')
35 | })
36 |
37 | it('attaches wysihtml5', function() {
38 | expect(wysihtml5.Editor).to.have.been.calledWith('page_content')
39 | })
40 |
41 | describe('.editor', function() {
42 | it('returns the wysihtml5 editor', function() {
43 | expect(this.editor.editor()).to.eq(this.editor._editor)
44 | })
45 | })
46 |
47 | describe('._uploading', function() {
48 | describe('when set to true', function() {
49 | beforeEach(function() {
50 | this.uploading = this.editor._uploading(true)
51 | })
52 |
53 | it('returns true', function() {
54 | expect(this.uploading).to.be.true
55 | })
56 |
57 | it('sets ._uploading', function() {
58 | expect(this.editor.__uploading).to.be.true
59 | })
60 |
61 | it('adds the .uploading class', function() {
62 | expect(this.editor.$el).to.have.class('uploading')
63 | })
64 | })
65 |
66 | describe('when set to false', function() {
67 | beforeEach(function() {
68 | this.uploading = this.editor._uploading(false)
69 | })
70 |
71 | it('returns false', function() {
72 | expect(this.uploading).to.be.false
73 | })
74 |
75 | it('sets ._uploading', function() {
76 | expect(this.editor.__uploading).to.be.false
77 | })
78 |
79 | it('adds the .uploading class', function() {
80 | expect(this.editor.$el).to.not.have.class('uploading')
81 | })
82 | })
83 | })
84 |
85 | describe('.upload', function() {
86 | beforeEach(function() {
87 | this.xhr.prototype.upload = { addEventListener: sinon.stub() }
88 | })
89 |
90 | it('opens the connection to the proper bucket', function() {
91 | this.xhr.prototype.open = sinon.stub()
92 | this.xhr.prototype.send = sinon.stub()
93 | this.config.s3_bucket = 'bucket'
94 | xhr = this.editor.upload(sinon.stub(), function() {})
95 | expect(xhr.open).to.have.been.calledWith('POST', 'https://bucket.s3.amazonaws.com', true)
96 | })
97 |
98 | it('sends the request', function() {
99 | this.xhr.prototype.send = sinon.stub()
100 | xhr = this.editor.upload(sinon.stub(), function() {})
101 | expect(xhr.send).to.have.been.called
102 | })
103 |
104 | describe('when the upload succeeds', function() {
105 | it('calls the callback with the location', function(done) {
106 | this.xhr.prototype.open = sinon.stub()
107 | this.xhr.prototype.send = sinon.stub()
108 | this.config.s3_bucket = 'bucket'
109 | xhr = this.editor.upload(sinon.stub(), function(location) {
110 | expect(location).to.eq('foo')
111 | done()
112 | })
113 | xhr.getResponseHeader = sinon.stub().returns('foo')
114 | xhr.readyState = 4
115 | xhr.status = 204
116 | xhr.onreadystatechange()
117 | })
118 | })
119 |
120 | describe('when the upload fails', function() {
121 | it('shows an alert', function() {
122 | this.xhr.prototype.open = sinon.stub()
123 | this.xhr.prototype.send = sinon.stub()
124 | this.config.s3_bucket = 'bucket'
125 | alert = sinon.stub()
126 | xhr = this.editor.upload(sinon.stub(), function() {})
127 | xhr.readyState = 4
128 | xhr.status = 403
129 | xhr.onreadystatechange()
130 | expect(alert).to.have.been.calledWith('Failed to upload file. Have you configured S3 properly?')
131 | })
132 | })
133 |
134 | describe('form data', function() {
135 | beforeEach(function() {
136 | file = this.file = { name: 'foobar', type: 'image/jpg' }
137 | append = this.append = sinon.stub()
138 | FormData = function() { return { append: append } }
139 |
140 | Date.now = function() { return { toString: function() { return '1234' } } }
141 |
142 | this.xhr.prototype.open = sinon.stub()
143 | this.xhr.prototype.send = sinon.stub()
144 |
145 | this.config.s3_bucket = 'bucket'
146 | this.config.storage_dir = 'uploads'
147 | this.config.aws_access_key_id = 'access key'
148 |
149 | this.editor.upload(file, function() {})
150 | })
151 |
152 | it('sets "key"', function() {
153 | expect(this.append).to.have.been.calledWith('key', 'uploads/1234-foobar')
154 | })
155 |
156 | it('sets "AWSAccessKeyId"', function() {
157 | expect(this.append).to.have.been.calledWith('AWSAccessKeyId', 'access key')
158 | })
159 |
160 | it('sets "acl"', function() {
161 | expect(this.append).to.have.been.calledWith('acl', 'public-read')
162 | })
163 |
164 | it('sets "policy"', function() {
165 | expect(this.append).to.have.been.calledWith('policy', 'policy document')
166 | })
167 |
168 | it('sets "signature"', function() {
169 | expect(this.append).to.have.been.calledWith('signature', 'policy signature')
170 | })
171 |
172 | it('sets "Content-Type"', function() {
173 | expect(this.append).to.have.been.calledWith('Content-Type', 'image/jpg')
174 | })
175 |
176 | it('sets "file"', function() {
177 | expect(this.append).to.have.been.calledWith('file', this.file)
178 | })
179 | })
180 | })
181 | })
182 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: .
3 | specs:
4 | active_admin_editor (1.1.0)
5 | activeadmin (>= 0.4.0)
6 | ejs
7 | rails (>= 3.0.0)
8 |
9 | GEM
10 | remote: http://rubygems.org/
11 | specs:
12 | actionmailer (3.2.9)
13 | actionpack (= 3.2.9)
14 | mail (~> 2.4.4)
15 | actionpack (3.2.9)
16 | activemodel (= 3.2.9)
17 | activesupport (= 3.2.9)
18 | builder (~> 3.0.0)
19 | erubis (~> 2.7.0)
20 | journey (~> 1.0.4)
21 | rack (~> 1.4.0)
22 | rack-cache (~> 1.2)
23 | rack-test (~> 0.6.1)
24 | sprockets (~> 2.2.1)
25 | activeadmin (0.5.1)
26 | arbre (>= 1.0.1)
27 | bourbon (>= 1.0.0)
28 | devise (>= 1.1.2)
29 | fastercsv
30 | formtastic (>= 2.0.0)
31 | inherited_resources (>= 1.3.1)
32 | jquery-rails (>= 1.0.0)
33 | kaminari (>= 0.13.0)
34 | meta_search (>= 0.9.2)
35 | rails (>= 3.0.0)
36 | sass (>= 3.1.0)
37 | activemodel (3.2.9)
38 | activesupport (= 3.2.9)
39 | builder (~> 3.0.0)
40 | activerecord (3.2.9)
41 | activemodel (= 3.2.9)
42 | activesupport (= 3.2.9)
43 | arel (~> 3.0.2)
44 | tzinfo (~> 0.3.29)
45 | activeresource (3.2.9)
46 | activemodel (= 3.2.9)
47 | activesupport (= 3.2.9)
48 | activesupport (3.2.9)
49 | i18n (~> 0.6)
50 | multi_json (~> 1.0)
51 | arbre (1.0.1)
52 | activesupport (>= 3.0.0)
53 | arel (3.0.2)
54 | bcrypt-ruby (3.0.1)
55 | bourbon (3.0.1)
56 | sass (>= 3.2.0)
57 | thor
58 | builder (3.0.4)
59 | capybara (1.1.4)
60 | mime-types (>= 1.16)
61 | nokogiri (>= 1.3.3)
62 | rack (>= 1.0.0)
63 | rack-test (>= 0.5.4)
64 | selenium-webdriver (~> 2.0)
65 | xpath (~> 0.1.4)
66 | chai-jquery-rails (0.0.3)
67 | railties (~> 3.1)
68 | sprockets
69 | childprocess (0.3.9)
70 | ffi (~> 1.0, >= 1.0.11)
71 | coffee-rails (3.2.2)
72 | coffee-script (>= 2.2.0)
73 | railties (~> 3.2.0)
74 | coffee-script (2.2.0)
75 | coffee-script-source
76 | execjs
77 | coffee-script-source (1.4.0)
78 | colorize (0.5.8)
79 | database_cleaner (0.9.1)
80 | devise (2.1.2)
81 | bcrypt-ruby (~> 3.0)
82 | orm_adapter (~> 0.1)
83 | railties (~> 3.1)
84 | warden (~> 1.2.1)
85 | diff-lcs (1.1.3)
86 | ejs (1.1.1)
87 | erubis (2.7.0)
88 | eventmachine (1.0.0)
89 | execjs (1.4.0)
90 | multi_json (~> 1.0)
91 | factory_girl (4.1.0)
92 | activesupport (>= 3.0.0)
93 | factory_girl_rails (4.1.0)
94 | factory_girl (~> 4.1.0)
95 | railties (>= 3.0.0)
96 | faker (1.1.2)
97 | i18n (~> 0.5)
98 | fastercsv (1.5.5)
99 | faye-websocket (0.4.6)
100 | eventmachine (>= 0.12.0)
101 | ffi (1.9.0)
102 | formtastic (2.2.1)
103 | actionpack (>= 3.0)
104 | has_scope (0.5.1)
105 | hike (1.2.1)
106 | http_parser.rb (0.5.3)
107 | i18n (0.6.1)
108 | inherited_resources (1.3.1)
109 | has_scope (~> 0.5.0)
110 | responders (~> 0.6)
111 | journey (1.0.4)
112 | jquery-rails (2.1.4)
113 | railties (>= 3.0, < 5.0)
114 | thor (>= 0.14, < 2.0)
115 | json (1.7.6)
116 | kaminari (0.14.1)
117 | actionpack (>= 3.0.0)
118 | activesupport (>= 3.0.0)
119 | konacha (2.1.0)
120 | actionpack (~> 3.1)
121 | capybara
122 | colorize
123 | railties (~> 3.1)
124 | sprockets
125 | mail (2.4.4)
126 | i18n (>= 0.4.0)
127 | mime-types (~> 1.16)
128 | treetop (~> 1.4.8)
129 | meta_search (1.1.3)
130 | actionpack (~> 3.1)
131 | activerecord (~> 3.1)
132 | activesupport (~> 3.1)
133 | polyamorous (~> 0.5.0)
134 | mime-types (1.19)
135 | multi_json (1.7.7)
136 | nokogiri (1.5.6)
137 | orm_adapter (0.4.0)
138 | poltergeist (1.0.2)
139 | capybara (~> 1.1)
140 | childprocess (~> 0.3)
141 | faye-websocket (~> 0.4, >= 0.4.4)
142 | http_parser.rb (~> 0.5.3)
143 | multi_json (~> 1.0)
144 | polyamorous (0.5.0)
145 | activerecord (~> 3.0)
146 | polyglot (0.3.3)
147 | rack (1.4.1)
148 | rack-cache (1.2)
149 | rack (>= 0.4)
150 | rack-ssl (1.3.2)
151 | rack
152 | rack-test (0.6.2)
153 | rack (>= 1.0)
154 | rails (3.2.9)
155 | actionmailer (= 3.2.9)
156 | actionpack (= 3.2.9)
157 | activerecord (= 3.2.9)
158 | activeresource (= 3.2.9)
159 | activesupport (= 3.2.9)
160 | bundler (~> 1.0)
161 | railties (= 3.2.9)
162 | railties (3.2.9)
163 | actionpack (= 3.2.9)
164 | activesupport (= 3.2.9)
165 | rack-ssl (~> 1.3.2)
166 | rake (>= 0.8.7)
167 | rdoc (~> 3.4)
168 | thor (>= 0.14.6, < 2.0)
169 | rake (10.0.3)
170 | rdoc (3.12)
171 | json (~> 1.4)
172 | responders (0.9.3)
173 | railties (~> 3.1)
174 | rspec (2.12.0)
175 | rspec-core (~> 2.12.0)
176 | rspec-expectations (~> 2.12.0)
177 | rspec-mocks (~> 2.12.0)
178 | rspec-core (2.12.2)
179 | rspec-expectations (2.12.1)
180 | diff-lcs (~> 1.1.3)
181 | rspec-mocks (2.12.1)
182 | rspec-rails (2.12.0)
183 | actionpack (>= 3.0)
184 | activesupport (>= 3.0)
185 | railties (>= 3.0)
186 | rspec-core (~> 2.12.0)
187 | rspec-expectations (~> 2.12.0)
188 | rspec-mocks (~> 2.12.0)
189 | rubyzip (0.9.9)
190 | sass (3.2.4)
191 | sass-rails (3.2.5)
192 | railties (~> 3.2.0)
193 | sass (>= 3.1.10)
194 | tilt (~> 1.3)
195 | selenium-webdriver (2.33.0)
196 | childprocess (>= 0.2.5)
197 | multi_json (~> 1.0)
198 | rubyzip
199 | websocket (~> 1.0.4)
200 | sinon-chai-rails (1.0.2)
201 | railties (>= 3.1)
202 | sinon-rails (1.4.2.1)
203 | railties (>= 3.1)
204 | sprockets (2.2.2)
205 | hike (~> 1.2)
206 | multi_json (~> 1.0)
207 | rack (~> 1.0)
208 | tilt (~> 1.1, != 1.3.0)
209 | sqlite3 (1.3.6)
210 | thor (0.16.0)
211 | tilt (1.3.3)
212 | treetop (1.4.12)
213 | polyglot
214 | polyglot (>= 0.3.1)
215 | tzinfo (0.3.35)
216 | uglifier (1.3.0)
217 | execjs (>= 0.3.0)
218 | multi_json (~> 1.0, >= 1.0.2)
219 | warden (1.2.1)
220 | rack (>= 1.0)
221 | websocket (1.0.7)
222 | xpath (0.1.4)
223 | nokogiri (~> 1.3)
224 |
225 | PLATFORMS
226 | ruby
227 |
228 | DEPENDENCIES
229 | active_admin_editor!
230 | activeadmin
231 | capybara (~> 1.1.4)
232 | chai-jquery-rails
233 | coffee-rails
234 | database_cleaner (~> 0.9.1)
235 | ejs
236 | factory_girl_rails
237 | faker
238 | jquery-rails
239 | konacha
240 | meta_search
241 | poltergeist (~> 1.0.2)
242 | rspec (~> 2.12.0)
243 | rspec-rails (~> 2.12.0)
244 | sass-rails
245 | sinon-chai-rails
246 | sinon-rails
247 | sqlite3
248 | uglifier
249 |
--------------------------------------------------------------------------------
/spec/dummy/README.rdoc:
--------------------------------------------------------------------------------
1 | == Welcome to Rails
2 |
3 | Rails is a web-application framework that includes everything needed to create
4 | database-backed web applications according to the Model-View-Control pattern.
5 |
6 | This pattern splits the view (also called the presentation) into "dumb"
7 | templates that are primarily responsible for inserting pre-built data in between
8 | HTML tags. The model contains the "smart" domain objects (such as Account,
9 | Product, Person, Post) that holds all the business logic and knows how to
10 | persist themselves to a database. The controller handles the incoming requests
11 | (such as Save New Account, Update Product, Show Post) by manipulating the model
12 | and directing data to the view.
13 |
14 | In Rails, the model is handled by what's called an object-relational mapping
15 | layer entitled Active Record. This layer allows you to present the data from
16 | database rows as objects and embellish these data objects with business logic
17 | methods. You can read more about Active Record in
18 | link:files/vendor/rails/activerecord/README.html.
19 |
20 | The controller and view are handled by the Action Pack, which handles both
21 | layers by its two parts: Action View and Action Controller. These two layers
22 | are bundled in a single package due to their heavy interdependence. This is
23 | unlike the relationship between the Active Record and Action Pack that is much
24 | more separate. Each of these packages can be used independently outside of
25 | Rails. You can read more about Action Pack in
26 | link:files/vendor/rails/actionpack/README.html.
27 |
28 |
29 | == Getting Started
30 |
31 | 1. At the command prompt, create a new Rails application:
32 | rails new myapp (where myapp is the application name)
33 |
34 | 2. Change directory to myapp and start the web server:
35 | cd myapp; rails server (run with --help for options)
36 |
37 | 3. Go to http://localhost:3000/ and you'll see:
38 | "Welcome aboard: You're riding Ruby on Rails!"
39 |
40 | 4. Follow the guidelines to start developing your application. You can find
41 | the following resources handy:
42 |
43 | * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44 | * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45 |
46 |
47 | == Debugging Rails
48 |
49 | Sometimes your application goes wrong. Fortunately there are a lot of tools that
50 | will help you debug it and get it back on the rails.
51 |
52 | First area to check is the application log files. Have "tail -f" commands
53 | running on the server.log and development.log. Rails will automatically display
54 | debugging and runtime information to these files. Debugging info will also be
55 | shown in the browser on requests from 127.0.0.1.
56 |
57 | You can also log your own messages directly into the log file from your code
58 | using the Ruby logger class from inside your controllers. Example:
59 |
60 | class WeblogController < ActionController::Base
61 | def destroy
62 | @weblog = Weblog.find(params[:id])
63 | @weblog.destroy
64 | logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65 | end
66 | end
67 |
68 | The result will be a message in your log file along the lines of:
69 |
70 | Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71 |
72 | More information on how to use the logger is at http://www.ruby-doc.org/core/
73 |
74 | Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75 | several books available online as well:
76 |
77 | * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78 | * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79 |
80 | These two books will bring you up to speed on the Ruby language and also on
81 | programming in general.
82 |
83 |
84 | == Debugger
85 |
86 | Debugger support is available through the debugger command when you start your
87 | Mongrel or WEBrick server with --debugger. This means that you can break out of
88 | execution at any point in the code, investigate and change the model, and then,
89 | resume execution! You need to install ruby-debug to run the server in debugging
90 | mode. With gems, use sudo gem install ruby-debug. Example:
91 |
92 | class WeblogController < ActionController::Base
93 | def index
94 | @posts = Post.all
95 | debugger
96 | end
97 | end
98 |
99 | So the controller will accept the action, run the first line, then present you
100 | with a IRB prompt in the server window. Here you can do things like:
101 |
102 | >> @posts.inspect
103 | => "[#nil, "body"=>nil, "id"=>"1"}>,
105 | #"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107 | >> @posts.first.title = "hello from a debugger"
108 | => "hello from a debugger"
109 |
110 | ...and even better, you can examine how your runtime objects actually work:
111 |
112 | >> f = @posts.first
113 | => #nil, "body"=>nil, "id"=>"1"}>
114 | >> f.
115 | Display all 152 possibilities? (y or n)
116 |
117 | Finally, when you're ready to resume execution, you can enter "cont".
118 |
119 |
120 | == Console
121 |
122 | The console is a Ruby shell, which allows you to interact with your
123 | application's domain model. Here you'll have all parts of the application
124 | configured, just like it is when the application is running. You can inspect
125 | domain models, change values, and save to the database. Starting the script
126 | without arguments will launch it in the development environment.
127 |
128 | To start the console, run rails console from the application
129 | directory.
130 |
131 | Options:
132 |
133 | * Passing the -s, --sandbox argument will rollback any modifications
134 | made to the database.
135 | * Passing an environment name as an argument will load the corresponding
136 | environment. Example: rails console production.
137 |
138 | To reload your controllers and models after launching the console run
139 | reload!
140 |
141 | More information about irb can be found at:
142 | link:http://www.rubycentral.org/pickaxe/irb.html
143 |
144 |
145 | == dbconsole
146 |
147 | You can go to the command line of your database directly through rails
148 | dbconsole. You would be connected to the database with the credentials
149 | defined in database.yml. Starting the script without arguments will connect you
150 | to the development database. Passing an argument will connect you to a different
151 | database, like rails dbconsole production. Currently works for MySQL,
152 | PostgreSQL and SQLite 3.
153 |
154 | == Description of Contents
155 |
156 | The default directory structure of a generated Ruby on Rails application:
157 |
158 | |-- app
159 | | |-- assets
160 | | |-- images
161 | | |-- javascripts
162 | | `-- stylesheets
163 | | |-- controllers
164 | | |-- helpers
165 | | |-- mailers
166 | | |-- models
167 | | `-- views
168 | | `-- layouts
169 | |-- config
170 | | |-- environments
171 | | |-- initializers
172 | | `-- locales
173 | |-- db
174 | |-- doc
175 | |-- lib
176 | | `-- tasks
177 | |-- log
178 | |-- public
179 | |-- script
180 | |-- test
181 | | |-- fixtures
182 | | |-- functional
183 | | |-- integration
184 | | |-- performance
185 | | `-- unit
186 | |-- tmp
187 | | |-- cache
188 | | |-- pids
189 | | |-- sessions
190 | | `-- sockets
191 | `-- vendor
192 | |-- assets
193 | `-- stylesheets
194 | `-- plugins
195 |
196 | app
197 | Holds all the code that's specific to this particular application.
198 |
199 | app/assets
200 | Contains subdirectories for images, stylesheets, and JavaScript files.
201 |
202 | app/controllers
203 | Holds controllers that should be named like weblogs_controller.rb for
204 | automated URL mapping. All controllers should descend from
205 | ApplicationController which itself descends from ActionController::Base.
206 |
207 | app/models
208 | Holds models that should be named like post.rb. Models descend from
209 | ActiveRecord::Base by default.
210 |
211 | app/views
212 | Holds the template files for the view that should be named like
213 | weblogs/index.html.erb for the WeblogsController#index action. All views use
214 | eRuby syntax by default.
215 |
216 | app/views/layouts
217 | Holds the template files for layouts to be used with views. This models the
218 | common header/footer method of wrapping views. In your views, define a layout
219 | using the layout :default and create a file named default.html.erb.
220 | Inside default.html.erb, call <% yield %> to render the view using this
221 | layout.
222 |
223 | app/helpers
224 | Holds view helpers that should be named like weblogs_helper.rb. These are
225 | generated for you automatically when using generators for controllers.
226 | Helpers can be used to wrap functionality for your views into methods.
227 |
228 | config
229 | Configuration files for the Rails environment, the routing map, the database,
230 | and other dependencies.
231 |
232 | db
233 | Contains the database schema in schema.rb. db/migrate contains all the
234 | sequence of Migrations for your schema.
235 |
236 | doc
237 | This directory is where your application documentation will be stored when
238 | generated using rake doc:app
239 |
240 | lib
241 | Application specific libraries. Basically, any kind of custom code that
242 | doesn't belong under controllers, models, or helpers. This directory is in
243 | the load path.
244 |
245 | public
246 | The directory available for the web server. Also contains the dispatchers and the
247 | default HTML files. This should be set as the DOCUMENT_ROOT of your web
248 | server.
249 |
250 | script
251 | Helper scripts for automation and generation.
252 |
253 | test
254 | Unit and functional tests along with fixtures. When using the rails generate
255 | command, template test files will be generated for you and placed in this
256 | directory.
257 |
258 | vendor
259 | External libraries that the application depends on. Also includes the plugins
260 | subdirectory. If the app has frozen rails, those gems also go here, under
261 | vendor/rails/. This directory is in the load path.
262 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # Use this hook to configure devise mailer, warden hooks and so forth.
2 | # Many of these configuration options can be set straight in your model.
3 | Devise.setup do |config|
4 | # ==> Mailer Configuration
5 | # Configure the e-mail address which will be shown in Devise::Mailer,
6 | # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7 | config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
8 |
9 | # Configure the class responsible to send e-mails.
10 | # config.mailer = "Devise::Mailer"
11 |
12 | # ==> ORM configuration
13 | # Load and configure the ORM. Supports :active_record (default) and
14 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
15 | # available as additional gems.
16 | require 'devise/orm/active_record'
17 |
18 | # ==> Configuration for any authentication mechanism
19 | # Configure which keys are used when authenticating a user. The default is
20 | # just :email. You can configure it to use [:username, :subdomain], so for
21 | # authenticating a user, both parameters are required. Remember that those
22 | # parameters are used only when authenticating and not when retrieving from
23 | # session. If you need permissions, you should implement that in a before filter.
24 | # You can also supply a hash where the value is a boolean determining whether
25 | # or not authentication should be aborted when the value is not present.
26 | # config.authentication_keys = [ :email ]
27 |
28 | # Configure parameters from the request object used for authentication. Each entry
29 | # given should be a request method and it will automatically be passed to the
30 | # find_for_authentication method and considered in your model lookup. For instance,
31 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
32 | # The same considerations mentioned for authentication_keys also apply to request_keys.
33 | # config.request_keys = []
34 |
35 | # Configure which authentication keys should be case-insensitive.
36 | # These keys will be downcased upon creating or modifying a user and when used
37 | # to authenticate or find a user. Default is :email.
38 | config.case_insensitive_keys = [ :email ]
39 |
40 | # Configure which authentication keys should have whitespace stripped.
41 | # These keys will have whitespace before and after removed upon creating or
42 | # modifying a user and when used to authenticate or find a user. Default is :email.
43 | config.strip_whitespace_keys = [ :email ]
44 |
45 | # Tell if authentication through request.params is enabled. True by default.
46 | # It can be set to an array that will enable params authentication only for the
47 | # given strategies, for example, `config.params_authenticatable = [:database]` will
48 | # enable it only for database (email + password) authentication.
49 | # config.params_authenticatable = true
50 |
51 | # Tell if authentication through HTTP Basic Auth is enabled. False by default.
52 | # It can be set to an array that will enable http authentication only for the
53 | # given strategies, for example, `config.http_authenticatable = [:token]` will
54 | # enable it only for token authentication.
55 | # config.http_authenticatable = false
56 |
57 | # If http headers should be returned for AJAX requests. True by default.
58 | # config.http_authenticatable_on_xhr = true
59 |
60 | # The realm used in Http Basic Authentication. "Application" by default.
61 | # config.http_authentication_realm = "Application"
62 |
63 | # It will change confirmation, password recovery and other workflows
64 | # to behave the same regardless if the e-mail provided was right or wrong.
65 | # Does not affect registerable.
66 | # config.paranoid = true
67 |
68 | # By default Devise will store the user in session. You can skip storage for
69 | # :http_auth and :token_auth by adding those symbols to the array below.
70 | # Notice that if you are skipping storage for all authentication paths, you
71 | # may want to disable generating routes to Devise's sessions controller by
72 | # passing :skip => :sessions to `devise_for` in your config/routes.rb
73 | config.skip_session_storage = [:http_auth]
74 |
75 | # ==> Configuration for :database_authenticatable
76 | # For bcrypt, this is the cost for hashing the password and defaults to 10. If
77 | # using other encryptors, it sets how many times you want the password re-encrypted.
78 | #
79 | # Limiting the stretches to just one in testing will increase the performance of
80 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
81 | # a value less than 10 in other environments.
82 | config.stretches = Rails.env.test? ? 1 : 10
83 |
84 | # Setup a pepper to generate the encrypted password.
85 | # config.pepper = "5e3c9f8d9beca0072c4b0099be80b8509062915d1f41d5f7b7116b8da5251d8fe513329891f916f1d6ddb460a64bb77d9afd1dfe1dcb0757e6c4575c8f7d05b8"
86 |
87 | # ==> Configuration for :confirmable
88 | # A period that the user is allowed to access the website even without
89 | # confirming his account. For instance, if set to 2.days, the user will be
90 | # able to access the website for two days without confirming his account,
91 | # access will be blocked just in the third day. Default is 0.days, meaning
92 | # the user cannot access the website without confirming his account.
93 | # config.allow_unconfirmed_access_for = 2.days
94 |
95 | # If true, requires any email changes to be confirmed (exctly the same way as
96 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
97 | # db field (see migrations). Until confirmed new email is stored in
98 | # unconfirmed email column, and copied to email column on successful confirmation.
99 | config.reconfirmable = true
100 |
101 | # Defines which key will be used when confirming an account
102 | # config.confirmation_keys = [ :email ]
103 |
104 | # ==> Configuration for :rememberable
105 | # The time the user will be remembered without asking for credentials again.
106 | # config.remember_for = 2.weeks
107 |
108 | # If true, extends the user's remember period when remembered via cookie.
109 | # config.extend_remember_period = false
110 |
111 | # Options to be passed to the created cookie. For instance, you can set
112 | # :secure => true in order to force SSL only cookies.
113 | # config.cookie_options = {}
114 |
115 | # ==> Configuration for :validatable
116 | # Range for password length. Default is 6..128.
117 | # config.password_length = 6..128
118 |
119 | # Email regex used to validate email formats. It simply asserts that
120 | # an one (and only one) @ exists in the given string. This is mainly
121 | # to give user feedback and not to assert the e-mail validity.
122 | # config.email_regexp = /\A[^@]+@[^@]+\z/
123 |
124 | # ==> Configuration for :timeoutable
125 | # The time you want to timeout the user session without activity. After this
126 | # time the user will be asked for credentials again. Default is 30 minutes.
127 | # config.timeout_in = 30.minutes
128 |
129 | # ==> Configuration for :lockable
130 | # Defines which strategy will be used to lock an account.
131 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
132 | # :none = No lock strategy. You should handle locking by yourself.
133 | # config.lock_strategy = :failed_attempts
134 |
135 | # Defines which key will be used when locking and unlocking an account
136 | # config.unlock_keys = [ :email ]
137 |
138 | # Defines which strategy will be used to unlock an account.
139 | # :email = Sends an unlock link to the user email
140 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
141 | # :both = Enables both strategies
142 | # :none = No unlock strategy. You should handle unlocking by yourself.
143 | # config.unlock_strategy = :both
144 |
145 | # Number of authentication tries before locking an account if lock_strategy
146 | # is failed attempts.
147 | # config.maximum_attempts = 20
148 |
149 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
150 | # config.unlock_in = 1.hour
151 |
152 | # ==> Configuration for :recoverable
153 | #
154 | # Defines which key will be used when recovering the password for an account
155 | # config.reset_password_keys = [ :email ]
156 |
157 | # Time interval you can reset your password with a reset password key.
158 | # Don't put a too small interval or your users won't have the time to
159 | # change their passwords.
160 | config.reset_password_within = 6.hours
161 |
162 | # ==> Configuration for :encryptable
163 | # Allow you to use another encryption algorithm besides bcrypt (default). You can use
164 | # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
165 | # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
166 | # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
167 | # REST_AUTH_SITE_KEY to pepper)
168 | # config.encryptor = :sha512
169 |
170 | # ==> Configuration for :token_authenticatable
171 | # Defines name of the authentication token params key
172 | # config.token_authentication_key = :auth_token
173 |
174 | # ==> Scopes configuration
175 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
176 | # "users/sessions/new". It's turned off by default because it's slower if you
177 | # are using only default views.
178 | # config.scoped_views = false
179 |
180 | # Configure the default scope given to Warden. By default it's the first
181 | # devise role declared in your routes (usually :user).
182 | # config.default_scope = :user
183 |
184 | # Configure sign_out behavior.
185 | # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
186 | # The default is true, which means any logout action will sign out all active scopes.
187 | # config.sign_out_all_scopes = true
188 |
189 | # ==> Navigation configuration
190 | # Lists the formats that should be treated as navigational. Formats like
191 | # :html, should redirect to the sign in page when the user does not have
192 | # access, but formats like :xml or :json, should return 401.
193 | #
194 | # If you have any extra navigational formats, like :iphone or :mobile, you
195 | # should add them to the navigational formats lists.
196 | #
197 | # The "*/*" below is required to match Internet Explorer requests.
198 | # config.navigational_formats = ["*/*", :html]
199 |
200 | # The default HTTP method used to sign out a resource. Default is :delete.
201 | config.sign_out_via = :delete
202 |
203 | # ==> OmniAuth
204 | # Add a new OmniAuth provider. Check the wiki for more information on setting
205 | # up on your models and hooks.
206 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
207 |
208 | # ==> Warden configuration
209 | # If you want to use other strategies, that are not supported by Devise, or
210 | # change the failure app, you can configure them inside the config.warden block.
211 | #
212 | # config.warden do |manager|
213 | # manager.intercept_401 = false
214 | # manager.default_strategies(:scope => :user).unshift :some_external_strategy
215 | # end
216 | end
217 |
--------------------------------------------------------------------------------
/lib/active_admin/editor/parser_rules.rb:
--------------------------------------------------------------------------------
1 | module ActiveAdmin
2 | module Editor
3 | # Full HTML5 compatibility rule set
4 | # These rules define which tags and CSS classes are supported and which tags should be specially treated.
5 | #
6 | # Examples based on this rule set:
7 | #
8 | # foo
9 | # ... becomes ...
10 | # foo
11 | #
12 | #
13 | # ... becomes ...
14 | #
15 | #
16 | #