-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from flip to flipflop. Fixes #2599
- Loading branch information
Showing
16 changed files
with
106 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
.form-tab-content { | ||
margin: 15px 10px; | ||
} | ||
|
||
/* For the admin page */ | ||
td.status { | ||
width: 2rem; | ||
font-size: 1.1rem; | ||
|
||
span { | ||
@extend .label; | ||
@extend .badge; | ||
&.on { @extend .label-success; } | ||
&.off { @extend .label-default; } | ||
} | ||
} | ||
|
||
td.toggle { | ||
input[type=submit] { | ||
@extend .btn; | ||
@extend .btn-sm; | ||
&.active { @extend .btn-primary; } | ||
&:not(.active) { @extend .btn-default; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
module Sufia | ||
class Feature < ActiveRecord::Base | ||
self.table_name = 'sufia_features' | ||
extend Flip::Declarable | ||
|
||
strategy Flip::CookieStrategy | ||
strategy Flip::DatabaseStrategy | ||
strategy Flip::DeclarationStrategy | ||
default false | ||
|
||
feature :assign_admin_set, | ||
default: true, | ||
description: "Ability to assign uploaded items to an admin set" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<% content_for :page_header do %> | ||
<h1><span class="fa fa-cog"></span> Settings</h1> | ||
<% end %> | ||
<div class="flip row"> | ||
<div class="col-md-12"> | ||
<div class="panel"> | ||
<div class="panel-body"> | ||
<div class="table-responsive"> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
<th class="name">Feature</th> | ||
<th class="description">Description</th> | ||
<th>Action</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @feature_set.features.each do |feature| -%> | ||
<tr data-feature="<%= feature.name.dasherize.parameterize %>"> | ||
<td class="status"> | ||
<span class="<%= @feature_set.status(feature) -%>"><%= @feature_set.status(feature) -%></span> | ||
</td> | ||
<td class="name"><%= feature.name.humanize -%></td> | ||
<td class="description"><%= feature.description -%></td> | ||
|
||
<% @feature_set.strategies.each do |strategy| -%> | ||
<% next unless strategy.is_a? Flipflop::Strategies::ActiveRecordStrategy %> | ||
<td class="toggle" data-strategy="<%= strategy.name.dasherize.parameterize %>"> | ||
<div class="toolbar"> | ||
<%= form_tag(sufia.admin_feature_strategy_path(feature.key, strategy.key), method: :put) do -%> | ||
<div class="btn-group"> | ||
<%= submit_tag "on", | ||
type: "submit", | ||
class: Flipflop.enabled?(feature.name.to_sym) ? 'active' : nil, | ||
disabled: !strategy.switchable? | ||
-%> | ||
|
||
<%= submit_tag "off", | ||
type: "submit", | ||
class: Flipflop.enabled?(feature.name.to_sym) ? nil : 'active', | ||
disabled: !strategy.switchable? | ||
-%> | ||
</div> | ||
<% end -%> | ||
</div> | ||
</td> | ||
<% end -%> | ||
</tr> | ||
<% end -%> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Flipflop.configure do | ||
# Strategies will be used in the order listed here. | ||
strategy :cookie | ||
strategy :active_record, class: Sufia::Feature | ||
strategy :default | ||
|
||
feature :assign_admin_set, | ||
default: true, | ||
description: "Ability to assign uploaded items to an admin set" | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters