active admin CRUD for app feature
This commit is contained in:
parent
86d77df2c9
commit
041ebccaf1
|
|
@ -0,0 +1,21 @@
|
||||||
|
ActiveAdmin.register JamRuby::AppFeature, as: 'App Features' do
|
||||||
|
|
||||||
|
menu parent: 'Misc', label: 'App Features'
|
||||||
|
|
||||||
|
config.sort_order = 'created_at ASC'
|
||||||
|
config.batch_actions = false
|
||||||
|
config.filters = false
|
||||||
|
config.per_page = 50
|
||||||
|
config.paginate = true
|
||||||
|
|
||||||
|
form do |f|
|
||||||
|
f.inputs 'Fields' do
|
||||||
|
f.input(:feature_type, as: :select, collection: JamRuby::AppFeature::FEATURE_TYPES)
|
||||||
|
f.input(:handle, :input_html => { :maxlength => 1025 })
|
||||||
|
f.input(:is_enabled, as: :boolean)
|
||||||
|
f.input(:env, as: :select, collection: %w(production staging development))
|
||||||
|
end
|
||||||
|
f.actions
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
module JamRuby
|
class JamRuby::AppFeature < ActiveRecord::Base
|
||||||
class AppFeature < ActiveRecord::Base
|
|
||||||
self.primary_key = 'id'
|
|
||||||
self.table_name = 'app_features'
|
|
||||||
|
|
||||||
attr_accessible :feature_type, :handle, :is_enabled, :env
|
FEATURE_TYPES = %w(page)
|
||||||
|
|
||||||
|
attr_accessible :feature_type, :handle, :is_enabled, :env, as: :admin
|
||||||
|
|
||||||
|
#self.table_name = 'app_features'
|
||||||
|
|
||||||
|
validates :feature_type, presence: true, inclusion: {in: FEATURE_TYPES}
|
||||||
|
validates :handle, presence: true, length: {maximum: 255}
|
||||||
|
validates :is_enabled, inclusion: {in: [true, false]}
|
||||||
|
validates :env, presence: true, inclusion: {in: %w(production staging development)}
|
||||||
end
|
end
|
||||||
end
|
|
||||||
Loading…
Reference in New Issue