fl 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +44 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +173 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/app/admin/options.rb +46 -0
- data/app/admin/pages.rb +55 -0
- data/app/admin/users.rb +34 -0
- data/app/assets/javascripts/active_admin.coffee.erb +20 -0
- data/app/assets/javascripts/application.coffee.erb +40 -0
- data/app/assets/javascripts/ckeditor/basepath.coffee.erb +21 -0
- data/app/assets/javascripts/ckeditor/config.coffee.erb +146 -0
- data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +232 -0
- data/app/assets/javascripts/ckeditor/plugins/autogrow/samples/autogrow.html +102 -0
- data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +158 -0
- data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/assets/sample.css +70 -0
- data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +85 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/dialog.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie7.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie8.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_iequirks.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/editor.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/arrow.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/close.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/close.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock-open.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/refresh.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/lock-open.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/lock.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/images/refresh.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/readme.md +7 -0
- data/app/assets/javascripts/ckeditor/skins/minimalist/skin.js +10 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie7.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie8.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_iequirks.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/editor.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_gecko.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie7.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie8.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_iequirks.css +5 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/icons.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/icons_hidpi.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/arrow.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/close.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/close.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock-open.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/refresh.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock-open.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/refresh.png +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/images/spinner.gif +0 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/readme.md +51 -0
- data/app/assets/javascripts/ckeditor/skins/moonocolor/skin.js +10 -0
- data/app/assets/javascripts/components/confirm.coffee +51 -0
- data/app/assets/javascripts/components/modals.coffee +29 -0
- data/app/assets/stylesheets/_defaults.yml +106 -0
- data/app/assets/stylesheets/_functions.sass.erb +75 -0
- data/app/assets/stylesheets/active_admin.sass +117 -0
- data/app/assets/stylesheets/application.sass.erb +46 -0
- data/app/assets/stylesheets/styles/reset.sass +139 -0
- data/app/assets/stylesheets/styles/structure.sass +69 -0
- data/app/assets/stylesheets/styles/ui/flash.sass +128 -0
- data/app/assets/stylesheets/styles/ui/fonts.sass +32 -0
- data/app/assets/stylesheets/styles/ui/modals.sass +61 -0
- data/app/assets/stylesheets/styles/ui/tooltips.sass +139 -0
- data/app/controllers/application_controller.rb +87 -0
- data/app/helpers/fl/application_helper.rb +53 -0
- data/app/helpers/fl/asset_helper.rb +50 -0
- data/app/helpers/fl/liquid_helper.rb +29 -0
- data/app/helpers/fl/meta_helper.rb +118 -0
- data/app/lib/active_record/concerns/base.rb +55 -0
- data/app/lib/active_record/concerns/seeds.rb +78 -0
- data/app/liquid/filters/meta_filter.rb +6 -0
- data/app/liquid/tags/google_analytics_tag.rb +32 -0
- data/app/liquid/tags/icon_tag.rb +37 -0
- data/app/liquid/tags/meta_tag.rb +120 -0
- data/app/mailers/application_mailer.rb +28 -0
- data/app/models/application_record.rb +3 -0
- data/app/models/asset.rb +95 -0
- data/app/models/association.rb +21 -0
- data/app/models/meta.rb +27 -0
- data/app/models/node.rb +59 -0
- data/app/models/profile.rb +49 -0
- data/app/models/user.rb +49 -0
- data/app/service/flash.rb +8 -0
- data/app/views/layouts/_admin.haml +6 -0
- data/app/views/layouts/_application.haml +17 -0
- data/app/views/layouts/base.haml +26 -0
- data/app/views/mailers/layouts/mailer.haml +8 -0
- data/app/views/mailers/layouts/mailer.text.erb +1 -0
- data/app/views/mailers/new_user.erb +4 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/initializers/active_admin.rb +266 -0
- data/config/initializers/ckeditor.rb +63 -0
- data/config/initializers/devise.rb +279 -0
- data/config/initializers/friendly_id.rb +92 -0
- data/config/initializers/inflections.rb +20 -0
- data/config/initializers/liquid.rb +87 -0
- data/config/initializers/sass.rb +45 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/en.yml +13 -0
- data/config/puma.rb +59 -0
- data/config/routes.rb +56 -0
- data/db/migrate/20160616060637_create_nodes.rb +26 -0
- data/db/migrate/20160707080248_create_users.rb +52 -0
- data/db/migrate/20160707094704_create_slugs.rb +33 -0
- data/db/migrate/20160710095916_create_associations.rb +20 -0
- data/db/migrate/20160713061948_create_profiles.rb +27 -0
- data/db/migrate/20161115101221_create_assets.rb +25 -0
- data/db/migrate/20170725060408_create_active_admin_comments.rb +22 -0
- data/db/seeds.rb +81 -0
- data/fl.gemspec +73 -0
- data/lib/fl.rb +28 -0
- data/lib/fl/constants.rb +52 -0
- data/lib/fl/engine.rb +160 -0
- data/lib/fl/hash.rb +34 -0
- data/lib/generators/fl/sass_vars_generator.rb +16 -0
- data/lib/generators/fl/templates/sass.yml +56 -0
- data/lib/tasks/ckeditor.rake +37 -0
- data/lib/tasks/favicon.rake +37 -0
- data/readme/fl.jpg +0 -0
- metadata +416 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
class Association < ApplicationRecord
|
2
|
+
|
3
|
+
####################################################################
|
4
|
+
|
5
|
+
# Central "Association" Model -- Stores every association between nodes
|
6
|
+
##########################################
|
7
|
+
|
8
|
+
belongs_to :associatiable, polymorphic: :true
|
9
|
+
belongs_to :associated, polymorphic: true
|
10
|
+
|
11
|
+
# Nested attributes
|
12
|
+
#classes = Meta::Property.all
|
13
|
+
#if classes.any?
|
14
|
+
# classes.each do |klass| # => Class reserved
|
15
|
+
# accepts_nested_attributes_for klass.ref.to_sym, allow_destroy: true
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
|
19
|
+
####################################################################
|
20
|
+
|
21
|
+
end
|
data/app/models/meta.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
class Meta
|
2
|
+
|
3
|
+
####################################################################
|
4
|
+
####################################################################
|
5
|
+
|
6
|
+
# => Table Exists?
|
7
|
+
if ActiveRecord::Base.connection.data_source_exists? :nodes
|
8
|
+
|
9
|
+
if classes = Node.where(ref: "meta")
|
10
|
+
|
11
|
+
# => Each Meta model
|
12
|
+
classes.each do |klass| #-> "class" is reserved
|
13
|
+
meta = klass.val
|
14
|
+
self.const_set meta.titleize, Class.new(Node) do
|
15
|
+
accepts_nested_attributes_for :associations
|
16
|
+
has_many meta.pluralize.to_sym, through: :associations, source: :associated, source_type: "Meta::" + meta.titleize, class_name: "Meta::" + meta.titleize
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
####################################################################
|
25
|
+
####################################################################
|
26
|
+
|
27
|
+
end
|
data/app/models/node.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
class Node < ApplicationRecord
|
2
|
+
|
3
|
+
####################################################################
|
4
|
+
|
5
|
+
# Central Repository
|
6
|
+
##########################################
|
7
|
+
|
8
|
+
# Virtual attrs
|
9
|
+
attr_accessor :seed # => https://richonrails.com/articles/skipping-validations-in-ruby-on-rails
|
10
|
+
|
11
|
+
# Associations
|
12
|
+
# http://blog.bigbinary.com/2016/02/15/rails-5-makes-belong-to-association-required-by-default.html
|
13
|
+
belongs_to :user, optional: true
|
14
|
+
|
15
|
+
# Validations
|
16
|
+
validates :ref, :val, length: { minimum: 2, message: "2 characters minimum" }, unless: :seed
|
17
|
+
validates :ref, exclusion: { in: %w(meta role), message: "%{value} is reserved" }, unless: :seed # => http://stackoverflow.com/a/17668634/1143732
|
18
|
+
validates :ref, uniqueness: { message: "%{value} cannot be duplicate" }, unless: :seed
|
19
|
+
validates :val, uniqueness: { scope: :ref, message: "%{value} cannot be duplicate" }
|
20
|
+
|
21
|
+
# Friendly ID
|
22
|
+
extend FriendlyId
|
23
|
+
friendly_id :title
|
24
|
+
|
25
|
+
##########################################
|
26
|
+
|
27
|
+
# Aliases
|
28
|
+
alias_attribute :title, :ref
|
29
|
+
alias_attribute :value, :val
|
30
|
+
alias_attribute :content, :val
|
31
|
+
alias_attribute :description, :val
|
32
|
+
|
33
|
+
##########################################
|
34
|
+
|
35
|
+
# Instance (private)
|
36
|
+
###################
|
37
|
+
|
38
|
+
# => Partial Path
|
39
|
+
# => https://www.cookieshq.co.uk/posts/rails-tips-to-partial-path/
|
40
|
+
def to_partial_path
|
41
|
+
self.class.name.underscore # => http://blog.obiefernandez.com/content/2012/01/rendering-collections-of-heterogeneous-objects-in-rails-32.html
|
42
|
+
end
|
43
|
+
|
44
|
+
# => For form
|
45
|
+
def is_destroyable?
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
49
|
+
# Class (public)
|
50
|
+
###################
|
51
|
+
|
52
|
+
# => Ref / Val
|
53
|
+
# => Meta::Role.val "admin"
|
54
|
+
scope :ref, ->(ref) { find_by ref: ref }
|
55
|
+
scope :val, ->(val) { find_by val: val }
|
56
|
+
|
57
|
+
####################################################################
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class Profile < ApplicationRecord
|
2
|
+
|
3
|
+
####################################################################
|
4
|
+
|
5
|
+
# User
|
6
|
+
belongs_to :user, inverse_of: :profile
|
7
|
+
|
8
|
+
# Role
|
9
|
+
belongs_to :role, class_name: "Meta::Role", primary_key: :ref, foreign_key: :role
|
10
|
+
|
11
|
+
# Avatar
|
12
|
+
has_one :avatar, class_name: "Asset", as: :assetable, dependent: :destroy
|
13
|
+
accepts_nested_attributes_for :avatar, reject_if: :all_blank
|
14
|
+
|
15
|
+
# Validation
|
16
|
+
validates :name, length: { minimum: 2 }, allow_blank: true # => http://stackoverflow.com/a/22323406/1143732
|
17
|
+
|
18
|
+
# Nilify Blanks
|
19
|
+
# Used for "name" validation -- submit nil if doesn't show
|
20
|
+
nilify_blanks only: [:name]
|
21
|
+
|
22
|
+
# Names
|
23
|
+
alias_attribute :ref, :name
|
24
|
+
|
25
|
+
# Slug
|
26
|
+
extend FriendlyId
|
27
|
+
friendly_id :name
|
28
|
+
|
29
|
+
####################################################################
|
30
|
+
|
31
|
+
# Instance (private)
|
32
|
+
###################
|
33
|
+
|
34
|
+
# => Name
|
35
|
+
def name
|
36
|
+
self[:name] || user.email
|
37
|
+
end
|
38
|
+
|
39
|
+
# => First Name
|
40
|
+
def first_name
|
41
|
+
name.split.first
|
42
|
+
end
|
43
|
+
|
44
|
+
# Class (public)
|
45
|
+
###################
|
46
|
+
|
47
|
+
####################################################################
|
48
|
+
|
49
|
+
end
|
data/app/models/user.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
class User < ApplicationRecord
|
2
|
+
# Include default devise modules. Others available are:
|
3
|
+
# :confirmable, :lockable, :timeoutable and :omniauthable
|
4
|
+
devise :database_authenticatable, :recoverable, :trackable, :validatable#, :registerable,
|
5
|
+
|
6
|
+
####################################################################
|
7
|
+
|
8
|
+
# Virtual Attrs
|
9
|
+
attr_accessor :send_email
|
10
|
+
|
11
|
+
# Alias Attributes
|
12
|
+
alias_attribute :ref, :email
|
13
|
+
|
14
|
+
# Profile
|
15
|
+
has_one :profile, dependent: :destroy, inverse_of: :user
|
16
|
+
before_create :build_profile, unless: :profile
|
17
|
+
|
18
|
+
# Associations
|
19
|
+
has_many :nodes
|
20
|
+
has_many :associations, as: :associatiable, dependent: :destroy
|
21
|
+
|
22
|
+
# Delegate
|
23
|
+
delegate :name, :first_name, :slug, :avatar, :role, to: :profile
|
24
|
+
|
25
|
+
# Options
|
26
|
+
after_create Proc.new { |u| ApplicationMailer.new_user(u).deliver }, if: :send_email
|
27
|
+
|
28
|
+
####################################################################
|
29
|
+
|
30
|
+
# Instance (private)
|
31
|
+
###################
|
32
|
+
|
33
|
+
# => For form
|
34
|
+
def is_destroyable?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
# => Admin?
|
39
|
+
def admin?
|
40
|
+
return false if ("Meta::Role".constantize rescue nil).nil?
|
41
|
+
role == Meta::Role.val("admin")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Class (public)
|
45
|
+
###################
|
46
|
+
|
47
|
+
####################################################################
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/ Header
|
2
|
+
- haml_tag_if content_for?(:header), "%header" do
|
3
|
+
= liquidize yield(:header)
|
4
|
+
|
5
|
+
%header= link_to "Header Area", "http://gooogle.com", title: "TEST srtwertwretsdf sdf sdf sdf sdf sdf ", data: { placement: :left }
|
6
|
+
|
7
|
+
/ Main
|
8
|
+
%main
|
9
|
+
- %i(inner_header main inner_footer).each do |element|
|
10
|
+
- haml_tag_if content_for?(element), element.to_s.split("_").last do
|
11
|
+
= liquidize yield (element == :main ? nil : element)
|
12
|
+
|
13
|
+
/ Footer
|
14
|
+
- haml_tag_if content_for?(:footer), "%footer" do
|
15
|
+
= liquidize yield(:footer)
|
16
|
+
|
17
|
+
%footer= link_to "Footer Area", "http://gooogle.com", title: "TEST"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
= title yield(:title) + (" - " if content_for(:title)) + Rails.application.secrets.app[:name]
|
5
|
+
|
6
|
+
= meta :js, (admin? ? "admin" : "application"), "//js.pusher.com/3.2/pusher.min.js", "data-turbolinks-track" => :reload
|
7
|
+
= meta :stylesheet, (admin? ? "admin" : "application"), "//fonts.googleapis.com/css?family=Montserrat|Open+Sans", media: :all, "data-turbolinks-track" => :reload
|
8
|
+
|
9
|
+
= meta :description, Rails.application.secrets[:app][:description]
|
10
|
+
= meta :keywords, Rails.application.secrets[:app][:keywords]
|
11
|
+
= meta :author, Rails.application.secrets[:app][:author]
|
12
|
+
|
13
|
+
= meta :meta, "pinterest, no pin"
|
14
|
+
= meta :viewport, "width=device-width, initial-scale=1"
|
15
|
+
|
16
|
+
= meta :favicon
|
17
|
+
= meta :robots
|
18
|
+
= meta :csrf
|
19
|
+
|
20
|
+
%body{class: ("admin" if admin?)}
|
21
|
+
= render "layouts/" + (admin? ? "admin" : "application")
|
22
|
+
%modal
|
23
|
+
%main
|
24
|
+
TEST TEST TEST
|
25
|
+
%br asdfadsfaf
|
26
|
+
%br adsfasdf
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fl"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,266 @@
|
|
1
|
+
# => Check if ActiveAdmin loaded
|
2
|
+
if Gem.loaded_specs.has_key?('activeadmin')
|
3
|
+
#puts defined?(ActiveAdmin)
|
4
|
+
|
5
|
+
# => Engine
|
6
|
+
# => https://github.com/activeadmin/activeadmin/wiki/define-a-resource-inside-an-engine
|
7
|
+
ActiveAdmin.application.load_paths += [File.join(__dir__, '..', '..', 'app', 'admin')]
|
8
|
+
|
9
|
+
# => Use this hook to configure ActiveAdmin
|
10
|
+
ActiveAdmin.setup do |config|
|
11
|
+
|
12
|
+
# == Site Title
|
13
|
+
#
|
14
|
+
# Set the title that is displayed on the main layout
|
15
|
+
# for each of the active admin pages.
|
16
|
+
#
|
17
|
+
config.site_title = Rails.application.secrets.app[:title]
|
18
|
+
|
19
|
+
# Set the link url for the title. For example, to take
|
20
|
+
# users to your main site. Defaults to no link.
|
21
|
+
#
|
22
|
+
# config.site_title_link = "/"
|
23
|
+
#config.site_title_link = "/"
|
24
|
+
|
25
|
+
# Set an optional image to be displayed for the header
|
26
|
+
# instead of a string (overrides :site_title)
|
27
|
+
#
|
28
|
+
# Note: Recommended image height is 21px to properly fit in the header
|
29
|
+
#
|
30
|
+
# config.site_title_image = "/images/logo.png"
|
31
|
+
|
32
|
+
# == Default Namespace
|
33
|
+
#
|
34
|
+
# Set the default namespace each administration resource
|
35
|
+
# will be added to.
|
36
|
+
#
|
37
|
+
# eg:
|
38
|
+
# config.default_namespace = :hello_world
|
39
|
+
#
|
40
|
+
# This will create resources in the HelloWorld module and
|
41
|
+
# will namespace routes to /hello_world/*
|
42
|
+
#
|
43
|
+
# To set no namespace by default, use:
|
44
|
+
# config.default_namespace = false
|
45
|
+
#
|
46
|
+
# Default:
|
47
|
+
# config.default_namespace = :admin
|
48
|
+
#
|
49
|
+
# You can customize the settings for each namespace by using
|
50
|
+
# a namespace block. For example, to change the site title
|
51
|
+
# within a namespace:
|
52
|
+
#
|
53
|
+
# config.namespace :admin do |admin|
|
54
|
+
# admin.site_title = "Custom Admin Title"
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# This will ONLY change the title for the admin section. Other
|
58
|
+
# namespaces will continue to use the main "site_title" configuration.
|
59
|
+
|
60
|
+
# == User Authentication
|
61
|
+
#
|
62
|
+
# Active Admin will automatically call an authentication
|
63
|
+
# method in a before filter of all controller actions to
|
64
|
+
# ensure that there is a currently logged in admin user.
|
65
|
+
#
|
66
|
+
# This setting changes the method which Active Admin calls
|
67
|
+
# within the controller.
|
68
|
+
config.authentication_method = :authenticate_user!
|
69
|
+
|
70
|
+
|
71
|
+
# == Current User
|
72
|
+
#
|
73
|
+
# Active Admin will associate actions with the current
|
74
|
+
# user performing them.
|
75
|
+
#
|
76
|
+
# This setting changes the method which Active Admin calls
|
77
|
+
# to return the currently logged in user.
|
78
|
+
config.current_user_method = :current_user
|
79
|
+
|
80
|
+
|
81
|
+
# == Logging Out
|
82
|
+
#
|
83
|
+
# Active Admin displays a logout link on each screen. These
|
84
|
+
# settings configure the location and method used for the link.
|
85
|
+
#
|
86
|
+
# This setting changes the path where the link points to. If it's
|
87
|
+
# a string, the strings is used as the path. If it's a Symbol, we
|
88
|
+
# will call the method to return the path.
|
89
|
+
#
|
90
|
+
# Default:
|
91
|
+
config.logout_link_path = :destroy_user_session_path
|
92
|
+
|
93
|
+
# This setting changes the http method used when rendering the
|
94
|
+
# link. For example :get, :delete, :put, etc..
|
95
|
+
#
|
96
|
+
# Default:
|
97
|
+
# config.logout_link_method = :get
|
98
|
+
|
99
|
+
# == Root
|
100
|
+
#
|
101
|
+
# Set the action to call for the root path. You can set different
|
102
|
+
# roots for each namespace.
|
103
|
+
#
|
104
|
+
# Default:
|
105
|
+
config.root_to = 'options#index'
|
106
|
+
|
107
|
+
# == Admin Comments
|
108
|
+
#
|
109
|
+
# Admin comments allow you to add comments to any model for admin use.
|
110
|
+
# Admin comments are enabled by default.
|
111
|
+
#
|
112
|
+
# Default:
|
113
|
+
config.comments = false
|
114
|
+
#
|
115
|
+
# You can turn them on and off for any given namespace by using a
|
116
|
+
# namespace config block.
|
117
|
+
#
|
118
|
+
# Eg:
|
119
|
+
# config.namespace :without_comments do |without_comments|
|
120
|
+
# without_comments.allow_comments = false
|
121
|
+
# end
|
122
|
+
|
123
|
+
# == Localize Date/Time Format
|
124
|
+
#
|
125
|
+
# Set the localize format to display dates and times.
|
126
|
+
# To understand how to localize your app with I18n, read more at
|
127
|
+
# https://github.com/svenfuchs/i18n/blob/master/lib%2Fi18n%2Fbackend%2Fbase.rb#L52
|
128
|
+
#
|
129
|
+
config.localize_format = :short
|
130
|
+
|
131
|
+
# == Setting a Favicon
|
132
|
+
config.favicon = 'favicon.ico'
|
133
|
+
|
134
|
+
# == Meta Tags
|
135
|
+
#
|
136
|
+
# Add additional meta tags to the head element of active admin pages.
|
137
|
+
#
|
138
|
+
# Add tags to all pages logged in users see:
|
139
|
+
config.meta_tags = {
|
140
|
+
author: Rails.application.secrets.app[:author],
|
141
|
+
keywords: Rails.application.secrets.app[:keywords],
|
142
|
+
description: Rails.application.secrets.app[:description]
|
143
|
+
}
|
144
|
+
|
145
|
+
# By default, sign up/sign in/recover password pages are excluded
|
146
|
+
# from showing up in search engine results by adding a robots meta
|
147
|
+
# tag. You can reset the hash of meta tags included in logged out
|
148
|
+
# pages:
|
149
|
+
# config.meta_tags_for_logged_out_pages = {}
|
150
|
+
|
151
|
+
# == Removing Breadcrumbs
|
152
|
+
#
|
153
|
+
# Breadcrumbs are enabled by default. You can customize them for individual
|
154
|
+
# resources or you can disable them globally from here.
|
155
|
+
#
|
156
|
+
# config.breadcrumb = false
|
157
|
+
|
158
|
+
# == Create Another Checkbox
|
159
|
+
#
|
160
|
+
# Create another checkbox is disabled by default. You can customize it for individual
|
161
|
+
# resources or you can enable them globally from here.
|
162
|
+
#
|
163
|
+
# config.create_another = true
|
164
|
+
|
165
|
+
# == Register Stylesheets & Javascripts
|
166
|
+
#
|
167
|
+
# We recommend using the built in Active Admin layout and loading
|
168
|
+
# up your own stylesheets / javascripts to customize the look
|
169
|
+
# and feel.
|
170
|
+
#
|
171
|
+
# To load a stylesheet:
|
172
|
+
# config.register_stylesheet 'my_stylesheet.css'
|
173
|
+
#
|
174
|
+
# You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
|
175
|
+
# config.register_stylesheet 'my_print_stylesheet.css', media: :print
|
176
|
+
#
|
177
|
+
# To load a javascript file:
|
178
|
+
# This is deprecated
|
179
|
+
# config.register_javascript 'my_javascript.js'
|
180
|
+
|
181
|
+
# == CSV options
|
182
|
+
#
|
183
|
+
# Set the CSV builder separator
|
184
|
+
# config.csv_options = { col_sep: ';' }
|
185
|
+
#
|
186
|
+
# Force the use of quotes
|
187
|
+
# config.csv_options = { force_quotes: true }
|
188
|
+
|
189
|
+
# == Menu System
|
190
|
+
#
|
191
|
+
# You can add a navigation menu to be used in your application, or configure a provided menu
|
192
|
+
#
|
193
|
+
# To change the default utility navigation to show a link to your website & a logout btn
|
194
|
+
#
|
195
|
+
# config.namespace :admin do |admin|
|
196
|
+
# admin.build_menu :utility_navigation do |menu|
|
197
|
+
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
|
198
|
+
# admin.add_logout_button_to_menu menu
|
199
|
+
# end
|
200
|
+
# end
|
201
|
+
#
|
202
|
+
# If you wanted to add a static menu item to the default menu provided:
|
203
|
+
#
|
204
|
+
# config.namespace :admin do |admin|
|
205
|
+
# admin.build_menu :default do |menu|
|
206
|
+
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
|
207
|
+
# end
|
208
|
+
# end
|
209
|
+
|
210
|
+
# == Download Links
|
211
|
+
#
|
212
|
+
# You can disable download links on resource listing pages,
|
213
|
+
# or customize the formats shown per namespace/globally
|
214
|
+
#
|
215
|
+
# To disable/customize for the :admin namespace:
|
216
|
+
#
|
217
|
+
# config.namespace :admin do |admin|
|
218
|
+
#
|
219
|
+
# # Disable the links entirely
|
220
|
+
# admin.download_links = false
|
221
|
+
#
|
222
|
+
# # Only show XML & PDF options
|
223
|
+
# admin.download_links = [:xml, :pdf]
|
224
|
+
#
|
225
|
+
# # Enable/disable the links based on block
|
226
|
+
# # (for example, with cancan)
|
227
|
+
# admin.download_links = proc { can?(:view_download_links) }
|
228
|
+
#
|
229
|
+
# end
|
230
|
+
|
231
|
+
# == Pagination
|
232
|
+
#
|
233
|
+
# Pagination is enabled by default for all resources.
|
234
|
+
# You can control the default per page count for all resources here.
|
235
|
+
#
|
236
|
+
# config.default_per_page = 30
|
237
|
+
#
|
238
|
+
# You can control the max per page count too.
|
239
|
+
#
|
240
|
+
# config.max_per_page = 10_000
|
241
|
+
|
242
|
+
# == Filters
|
243
|
+
#
|
244
|
+
# By default the index screen includes a "Filters" sidebar on the right
|
245
|
+
# hand side with a filter for each attribute of the registered model.
|
246
|
+
# You can enable or disable them for all resources here.
|
247
|
+
#
|
248
|
+
# config.filters = true
|
249
|
+
#
|
250
|
+
# By default the filters include associations in a select, which means
|
251
|
+
# that every record will be loaded for each association.
|
252
|
+
# You can enabled or disable the inclusion
|
253
|
+
# of those filters by default here.
|
254
|
+
#
|
255
|
+
# config.include_default_association_filters = true
|
256
|
+
|
257
|
+
# == Footer
|
258
|
+
#
|
259
|
+
# By default, the footer shows the current Active Admin version. You can
|
260
|
+
# override the content of the footer here.
|
261
|
+
#
|
262
|
+
config.footer = "<b><a href=\"#{Rails.application.secrets[:app][:domain]}\">#{Rails.application.secrets[:app][:name]}</a></b> © #{Date.today.year}".html_safe
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|