Skip to content

@JohnGoodman /Rails_Admin.rb secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# RailsAdmin config file. Generated on December 05, 2011 07:13
# See github.com/sferik/rails_admin for more informations
RailsAdmin.config do |config|
# If your default_local is different from :en, uncomment the following 2 lines and set your default locale here:
# require 'i18n'
# I18n.default_locale = :de
config.current_user_method { current_user } # auto-generated
# Set the admin name here (optional second array element will appear in a beautiful RailsAdmin red ©)
config.main_app_name = ['Meta More Phosis', 'Admin']
# or for a dynamic name:
# config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.titleize, controller.params['action'].titleize] }
# ==> Authentication (before_filter)
# This is run inside the controller instance so you can setup any authentication you need to.
# By default, the authentication will run via warden if available.
# and will run on the default user scope.
# If you use devise, this will authenticate the same as authenticate_user!
# Example Devise admin
# RailsAdmin.config do |config|
# config.authenticate_with do
# authenticate_admin!
# end
# end
# Example Custom Warden
# RailsAdmin.config do |config|
# config.authenticate_with do
# warden.authenticate! :scope => :paranoid
# end
# end
# ==> Authorization
# Use cancan https://github.com/ryanb/cancan for authorization:
config.authorize_with :cancan
# Or use simple custom authorization rule:
# config.authorize_with do
# redirect_to root_path unless warden.user.is_admin?
# end
# Use a specific role for ActiveModel's :attr_acessible :attr_protected
# Default is :default
# config.attr_accessible_role { :default }
# _current_user is accessible in the block if you need to make it user specific:
# config.attr_accessible_role { _current_user.role.to_sym }
# ==> Global show view settings
# Display empty fields in show views
# config.compact_show_view = false
# ==> Global list view settings
# Number of default rows per-page:
# config.default_items_per_page = 20
# ==> Included models
# Add all excluded models here:
# config.excluded_models = [User]
config.excluded_models = [Ckeditor::Asset, Ckeditor::AttachmentFile, Ckeditor::Picture]
# Add models here if you want to go 'whitelist mode':
# config.included_models = [User]
# Application wide tried label methods for models' instances
# config.label_methods << :description # Default is [:name, :title]
# ==> Global models configuration
# config.models do
# # Configuration here will affect all included models in all scopes, handle with care!
#
# list do
# # Configuration here will affect all included models in list sections (same for show, export, edit, update, create)
#
# fields_of_type :date do
# # Configuration here will affect all date fields, in the list section, for all included models. See README for a comprehensive type list.
# end
# end
# end
#
# ==> Model specific configuration
# Keep in mind that *all* configuration blocks are optional.
# RailsAdmin will try his best to provide the best defaults for each section, for each field!
# Try to override as few things as possible, in the most generic way. Try to avoid setting labels for models and attributes, use ActiveRecord I18n API instead.
# Less code is better code!
# config.model MyModel do
# # Here goes your cross-section field configuration for ModelName.
# object_label_method :name # Name of the method called for pretty printing an *instance* of ModelName
# label 'My model' # Name of ModelName (smartly defaults to ActiveRecord's I18n API)
# label_plural 'My models' # Same, plural
# weight -1 # Navigation priority. Bigger is higher.
# parent OtherModel # Set parent model for navigation. MyModel will be nested below. OtherModel will be on first position of the dropdown
# navigation_label # Sets dropdown entry's name in navigation. Only for parents!
# # Section specific configuration:
# list do
# filters [:id, :name] # Array of field names which filters should be shown by default in the table header
# items_per_page 100 # Override default_items_per_page
# sort_by :id # Sort column (default is primary key)
# sort_reverse true # Sort direction (default is true for primary key, last created first)
# # Here goes the fields configuration for the list view
# end
# show do
# # Here goes the fields configuration for the show view
# end
# export do
# # Here goes the fields configuration for the export view (CSV, yaml, XML)
# end
# edit do
# # Here goes the fields configuration for the edit view (for create and update view)
# end
# create do
# # Here goes the fields configuration for the create view, overriding edit section settings
# end
# update do
# # Here goes the fields configuration for the update view, overriding edit section settings
# end
# end
# Your model's configuration, to help you get started:
# All fields marked as 'hidden' won't be shown anywhere in the rails_admin unless you mark them as visible.
# There can be different reasons for that:
# - belongs_to _id and _type (polymorphic) columns are hidden in favor of their associations
# - associations are hidden if they have no matchable model found (model not included or non-existant)
# - they are part of a bigger plan in a plugin (Devise/Paperclip) and hidden by contract
# Some fields may be hidden depending on the section, if they aren't deemed suitable for display or edition on that section
# - non-editable columns (:id, :created_at, ..) in edit sections
# - has_many/has_one associations in list section (hidden by default for performance reasons)
# Fields may also be marked as read_only (and thus not editable) if they are not mass-assignable by current_user
# config.model User do
# # Found associations:
# # Found columns:
# configure :id, :integer
# configure :email, :string
# configure :password, :password
# configure :password_confirmation, :password
# configure :reset_password_token, :string # Hidden
# configure :reset_password_sent_at, :datetime
# configure :remember_created_at, :datetime
# configure :sign_in_count, :integer
# configure :current_sign_in_at, :datetime
# configure :last_sign_in_at, :datetime
# configure :current_sign_in_ip, :string
# configure :last_sign_in_ip, :string
# configure :created_at, :datetime
# configure :updated_at, :datetime # # Sections:
# list do; end
# export do; end
# show do; end
# edit do; end
# create do; end
# update do; end
# end
config.actions do
# root actions
dashboard # mandatory
# collection actions
index # mandatory
new
export
history_index
bulk_delete
# member actions
show
edit
delete
history_show
show_in_app
duplicate_program
end
config.model Organization do
navigation_label 'Management Items'
weight 1
configure :logo do
help 'Please format to 220px X 80px or similar ratio'
end
configure :send_team_leader_welcome_email, :text do ckeditor true end
configure :executive_welcome_message, :text do ckeditor true end
list do
field :name
field :user_count
field :campaign_count
end
edit do
configure :campaigns do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
end
end
config.model User do
navigation_label 'Management Items'
weight 2
configure :day_infos do
visible false
end
configure :scores do
visible false
end
configure :browser_infos do
visible false
end
configure :user_surveys do
visible false
end
configure :campaign do
visible false
end
list do
field :name
field :email
field :organization
field :campaign_name
field :role_names
end
edit do
field :first_name
field :last_name
configure :organization do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
configure :organization_id, :hidden do
visible do
true if bindings[:view]._current_user.max_role_name == 'organization_admin'
end
default_value do
bindings[:view]._current_user.organization_id if bindings[:view]._current_user.max_role_name == 'organization_admin'
end
end
include_all_fields
exclude_fields :reset_password_sent_at, :remember_created_at, :current_sign_in_at,
:last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip, :sign_in_count, :fitness_accept_terms
end
end
config.model Campaign do
navigation_label 'Management Items'
weight 4
configure :day_infos do
visible false
end
list do
field :name
field :organization
field :deck
field :user_count
field :start_date
end
edit do
configure :users do
visible false
end
configure :deck do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
configure :program do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
end
end
config.model Program do
navigation_label 'Management Items'
weight 3
#
# config.actions do
# member :duplicate_program do
# visible true
# end
# end
list do
field :name
field :week_count
field :campaigns
field :created_at
field :updated_at
end
end
config.model Week do
visible false
# weight 4
#
# object_label_method do
# :long_name
# end
#
# field :name
# field :position
# field :days do
# orderable true
#
# associated_collection_scope do
# week = bindings[:object]
# Proc.new { |scope| scope = scope.where(week_id: week.id) }
# end
# end
#
# list do
# sort_by :position
# end
#
# include_all_fields
end
config.model Day do
navigation_label 'Main Content'
# visible false
weight 0
object_label_method do
:long_name
end
configure :completion_message, :text do ckeditor true end
configure :push_pull_box do
ckeditor true
help 'Optional. Populating this field will overwrite the quote of the day.'
end
configure :team_leader_content do
ckeditor true
help 'Optional. This is content that only the team leader will see. Use this to help them along the journey.'
end
configure :day_infos do
visible false
end
list do
sort_by :week_name
field :name
field :day_number_in_program
field :week_name
# field :week_number
# field :week do
# sortable :position
# end
field :day_program_name do
label 'Program'
end
field :mbs_group
# field :program_name
# field :position
end
edit do
configure :position do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
configure :week do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
configure :name do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
end
end
config.model ActionStep do
visible false
configure :journal_question, :text do ckeditor true end
field :title
field :content, :text do ckeditor true end
include_all_fields
edit do
configure :playlists do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
end
end
config.model MbsHabit do
visible false
configure :journal_question, :text do ckeditor true end
field :mbs_group
field :title
field :content, :text do ckeditor true end
include_all_fields
edit do
configure :video do
visible do
bindings[:view]._current_user.max_role_name == 'organization_admin' ? false : true
end
end
end
end
config.model Playlist do
navigation_label 'Main Content'
weight 2
field :title
field :tracks do
orderable true
help 'Tracks in the left list will be destroyed upon save.'
end
include_all_fields
end
config.model Track do
visible false
exclude_fields :position
end
config.model Deck do
navigation_label 'Manage Decks and Cards'
end
config.model Card do
parent Deck
end
config.model DayInfo do
visible false
end
config.model Score do
visible false
end
config.model ScoreAmount do
navigation_label 'Specific Program Wording Items'
weight 2
configure :scores do
visible false
end
end
config.model Quote do
navigation_label 'Specific Program Wording Items'
weight 1
end
config.model ActionPhrase do
navigation_label 'Specific Program Wording Items'
# visible false
weight 3
# configure :phrase, :text do ckeditor true end
list do
sort_by :phrase_type
field :phrase_type
field :phrase
end
end
config.model Role do
visible false
end
config.model Ad do
weight 8
navigation_label 'Ad Manager'
configure :image do
help 'Please format to 240px X 300px'
end
edit do
field :campaign
field :image
field :url
end
end
config.model UserSurvey do
visible false
end
config.model BrowserInfo do
visible false
end
config.model Team do
navigation_label 'Management Items'
weight 5
configure :leaders do
visible false
end
end
config.model Leader do
visible false
end
config.model BackgroundImage do
visible false
end
config.model VisionBoardImage do
visible false
end
config.model VisionBoardText do
visible false
end
config.model OrganizationSignupLog do
navigation_label 'Signup Logs'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.