Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View Rails_Admin.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
# 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.