-
-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
159 additions
and
3 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
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,75 @@ | ||
/* The switch - the box around the slider */ | ||
.switch { | ||
position: relative; | ||
display: inline-block; | ||
width: 60px; | ||
height: 34px; | ||
} | ||
|
||
/* Hide default HTML checkbox */ | ||
.switch input { | ||
opacity: 0; | ||
width: 0; | ||
height: 0; | ||
} | ||
|
||
/* The slider */ | ||
.slider { | ||
position: absolute; | ||
cursor: pointer; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: #4a6cf7; | ||
-webkit-transition: .4s; | ||
transition: .4s; | ||
} | ||
|
||
.slider:before { | ||
position: absolute; | ||
content: ""; | ||
height: 26px; | ||
width: 26px; | ||
left: 4px; | ||
bottom: 4px; | ||
background-color: white; | ||
-webkit-transition: .4s; | ||
transition: .4s; | ||
} | ||
|
||
input:checked + .slider { | ||
background-color: #4a6cf7; | ||
} | ||
|
||
input:focus + .slider { | ||
box-shadow: 0 0 1px #4a6cf7; | ||
} | ||
|
||
input:checked + .slider:before { | ||
-webkit-transform: translateX(26px); | ||
-ms-transform: translateX(26px); | ||
transform: translateX(26px); | ||
} | ||
|
||
/* Rounded sliders */ | ||
.slider.round-on { | ||
border-radius: 34px; | ||
padding-left: 100px; | ||
} | ||
span.slider.round-off { | ||
border-radius: 34px; | ||
padding-left: 100px; | ||
} | ||
|
||
.slider.round-off:before { | ||
border-radius: 50%; | ||
} | ||
|
||
|
||
|
||
.custom-switch .custom-control-label::before { | ||
border-radius: 50%; /* Makes the toggle button round */ | ||
width: 2rem; /* Adjust the width as needed */ | ||
height: 2rem; /* Adjust the height as needed */ | ||
} |
18 changes: 18 additions & 0 deletions
18
app/controllers/all_casa_admins/feature_flags_controller.rb
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,18 @@ | ||
class AllCasaAdmins::FeatureFlagsController < AllCasaAdminsController | ||
|
||
def index | ||
@feature_flags = FeatureFlag.all | ||
end | ||
|
||
|
||
# update: toggle | ||
# feature is disabled, when clicked on, update it to enabled | ||
|
||
def update | ||
byebug | ||
@feature_flag = FeatureFlag.find(params[:id]) | ||
@feature_flag.update(enabled: !@feature_flag.enabled) | ||
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 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<h1>Feature Flags</h1> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @feature_flags.each do |feature_flag| %> | ||
<tr> | ||
<td><%= feature_flag.name %></td> | ||
<td> | ||
<%= form_with(model: [ :all_casa_admins, feature_flag ], url: all_casa_admins_feature_flag_path(feature_flag), method: :patch, local: true) do |form| %> | ||
<div class="feature-flag-div"> | ||
<label class="switch"> | ||
<input type="checkbox"> | ||
<span class="slider round-<%= feature_flag.enabled ? 'on' : 'off' %>"></span> | ||
</label> | ||
</div> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
|
||
|
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 |
---|---|---|
|
@@ -3859,4 +3859,4 @@ h6, | |
font-weight: 800; } | ||
|
||
.fw-900 { | ||
font-weight: 900; } | ||
font-weight: 900; } |
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,4 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Admin::FeatureFlagDecorator do | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rails_helper' | ||
|
||
# Specs in this file have access to a helper object that includes | ||
# the Admin::FeatureFlagsHelper. For example: | ||
# | ||
# describe Admin::FeatureFlagsHelper do | ||
# describe "string concat" do | ||
# it "concats two strings with spaces" do | ||
# expect(helper.concat_strings("this","that")).to eq("this that") | ||
# end | ||
# end | ||
# end | ||
RSpec.describe Admin::FeatureFlagsHelper, type: :helper do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "Admin::FeatureFlags", type: :request do | ||
describe "GET /index" do | ||
pending "add some examples (or delete) #{__FILE__}" | ||
end | ||
end |