Show enabled features for admins in manager
This commit is contained in:
parent
5fd1c28007
commit
482b306920
6 changed files with 31 additions and 7 deletions
2
Gemfile
2
Gemfile
|
@ -97,7 +97,7 @@ gem 'scenic'
|
||||||
|
|
||||||
gem 'sanitize-url'
|
gem 'sanitize-url'
|
||||||
|
|
||||||
gem 'flipflop'
|
gem 'flipflop', github: 'voormedia/flipflop'
|
||||||
|
|
||||||
# Cron jobs
|
# Cron jobs
|
||||||
gem 'delayed_job_active_record'
|
gem 'delayed_job_active_record'
|
||||||
|
|
11
Gemfile.lock
11
Gemfile.lock
|
@ -1,3 +1,10 @@
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/voormedia/flipflop.git
|
||||||
|
revision: a6e639c6c631cdb5e74cb84a1a2a314ca3420579
|
||||||
|
specs:
|
||||||
|
flipflop (2.3.1)
|
||||||
|
activesupport (>= 4.0)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/breckenedge/delayed_job_web.git
|
remote: https://github.com/breckenedge/delayed_job_web.git
|
||||||
revision: 6bcb10e61ea2b9a44ffa16be8536dff46ad51449
|
revision: 6bcb10e61ea2b9a44ffa16be8536dff46ad51449
|
||||||
|
@ -203,8 +210,6 @@ GEM
|
||||||
ffi (1.9.23)
|
ffi (1.9.23)
|
||||||
fission (0.5.0)
|
fission (0.5.0)
|
||||||
CFPropertyList (~> 2.2)
|
CFPropertyList (~> 2.2)
|
||||||
flipflop (2.3.1)
|
|
||||||
activesupport (>= 4.0)
|
|
||||||
fog (1.42.0)
|
fog (1.42.0)
|
||||||
fog-aliyun (>= 0.1.0)
|
fog-aliyun (>= 0.1.0)
|
||||||
fog-atmos
|
fog-atmos
|
||||||
|
@ -805,7 +810,7 @@ DEPENDENCIES
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
draper
|
draper
|
||||||
factory_bot
|
factory_bot
|
||||||
flipflop
|
flipflop!
|
||||||
fog
|
fog
|
||||||
fog-openstack
|
fog-openstack
|
||||||
font-awesome-rails
|
font-awesome-rails
|
||||||
|
|
|
@ -15,6 +15,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
||||||
procedures: Field::HasMany.with_options(limit: 20),
|
procedures: Field::HasMany.with_options(limit: 20),
|
||||||
registration_state: Field::String.with_options(searchable: false),
|
registration_state: Field::String.with_options(searchable: false),
|
||||||
current_sign_in_at: Field::DateTime,
|
current_sign_in_at: Field::DateTime,
|
||||||
|
features: FeaturesField
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# COLLECTION_ATTRIBUTES
|
# COLLECTION_ATTRIBUTES
|
||||||
|
@ -38,6 +39,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:registration_state,
|
:registration_state,
|
||||||
:current_sign_in_at,
|
:current_sign_in_at,
|
||||||
|
:features,
|
||||||
:procedures,
|
:procedures,
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
|
4
app/fields/features_field.rb
Normal file
4
app/fields/features_field.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require "administrate/field/base"
|
||||||
|
|
||||||
|
class FeaturesField < Administrate::Field::Base
|
||||||
|
end
|
7
app/views/fields/features_field/_show.html.haml
Normal file
7
app/views/fields/features_field/_show.html.haml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
%table
|
||||||
|
- Flipflop.feature_set.features.each do |feature|
|
||||||
|
- if !feature.group || feature.group.key != :production
|
||||||
|
%tr
|
||||||
|
%td= feature.title
|
||||||
|
%td
|
||||||
|
= check_box_tag "Enabled", "enabled", field.data[feature.name], disabled: true
|
|
@ -1,14 +1,20 @@
|
||||||
Flipflop.configure do
|
Flipflop.configure do
|
||||||
strategy :cookie
|
strategy :cookie,
|
||||||
|
secure: Rails.env.production?,
|
||||||
|
httponly: true
|
||||||
strategy :active_record
|
strategy :active_record
|
||||||
strategy :user_preference
|
strategy :user_preference
|
||||||
strategy :default
|
strategy :default
|
||||||
|
|
||||||
group :champs do
|
group :champs do
|
||||||
feature :champ_pj
|
feature :champ_pj,
|
||||||
feature :champ_siret
|
title: "Champ pièce justificative"
|
||||||
|
feature :champ_siret,
|
||||||
|
title: "Champ SIRET"
|
||||||
end
|
end
|
||||||
|
|
||||||
feature :web_hook
|
feature :web_hook
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
feature :remote_storage,
|
feature :remote_storage,
|
||||||
default: Rails.env.production? || Rails.env.staging?
|
default: Rails.env.production? || Rails.env.staging?
|
||||||
|
|
Loading…
Add table
Reference in a new issue