|
40 | 40 | </strong>
|
41 | 41 | </h6>
|
42 | 42 | </div>
|
43 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 43 | + <% if write_allowed? %> |
44 | 44 | <div class="col col-auto toggle-block-when-off">
|
45 | 45 | <button class="btn btn-outline-secondary js-toggle-trigger" data-toggle="collapse" data-target="#add-actor">Add an actor</button>
|
46 | 46 | </div>
|
|
73 | 73 | </h6>
|
74 | 74 | </div>
|
75 | 75 | <div class="col col-auto">
|
76 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 76 | + <% if write_allowed? %> |
77 | 77 | <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post">
|
78 | 78 | <%== csrf_input_tag %>
|
79 | 79 | <input type="hidden" name="operation" value="disable">
|
|
102 | 102 | </strong>
|
103 | 103 | </h6>
|
104 | 104 | </div>
|
105 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 105 | + <% if write_allowed? %> |
106 | 106 | <div class="col col-auto toggle-block-when-off">
|
107 | 107 | <button class="btn btn-outline-secondary js-toggle-trigger" data-toggle="collapse" data-target="#add-actor">Add a group</button>
|
108 | 108 | </div>
|
|
138 | 138 | <h6 class="m-0"><%= item %></h6>
|
139 | 139 | </div>
|
140 | 140 | <div class="col col-auto">
|
141 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 141 | + <% if write_allowed? %> |
142 | 142 | <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post">
|
143 | 143 | <%== csrf_input_tag %>
|
144 | 144 | <input type="hidden" name="operation" value="disable">
|
|
160 | 160 | <div class="col col-mr-auto">
|
161 | 161 | <h6 class="m-0"><strong class="<%= "text-muted" unless @feature.percentage_of_actors_value > 0 %>">Enabled for <%= @feature.percentage_of_actors_value %>% of actors</strong></h6>
|
162 | 162 | </div>
|
163 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 163 | + <% if write_allowed? %> |
164 | 164 | <div class="col col-auto toggle-block-when-off">
|
165 | 165 | <button class="btn btn-outline-secondary js-toggle-trigger">Edit</button>
|
166 | 166 | </div>
|
|
171 | 171 | </div>
|
172 | 172 | </div>
|
173 | 173 |
|
174 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 174 | + <% if write_allowed? %> |
175 | 175 | <div class="card-body border-bottom toggle-block-when-on bg-lightest">
|
176 | 176 | <div class="row">
|
177 | 177 | <div class="col-12 col-md-6 mb-3 mb-md-0">
|
|
203 | 203 | <div class="col col-mr-auto">
|
204 | 204 | <h6 class="m-0"><strong class="<%= "text-muted" unless @feature.percentage_of_time_value > 0 %>">Enabled for <%= @feature.percentage_of_time_value %>% of time</strong></h6>
|
205 | 205 | </div>
|
206 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 206 | + <% if write_allowed? %> |
207 | 207 | <div class="col col-auto toggle-block-when-off">
|
208 | 208 | <button class="btn btn-outline-secondary js-toggle-trigger">Edit</button>
|
209 | 209 | </div>
|
|
214 | 214 | </div>
|
215 | 215 | </div>
|
216 | 216 |
|
217 |
| - <% unless Flipper::UI.configuration.read_only %> |
| 217 | + <% if write_allowed? %> |
218 | 218 | <div class="card-body border-bottom toggle-block-when-on bg-lightest">
|
219 | 219 | <div class="row">
|
220 | 220 | <div class="col-12 col-md-6 mb-3 mb-md-0">
|
|
240 | 240 | </div>
|
241 | 241 | <% end %>
|
242 | 242 |
|
243 |
| - <div class="card-body"> |
244 |
| - <form action="<%= script_name %>/features/<%= @feature.key %>/boolean" method="post"> |
245 |
| - <%== csrf_input_tag %> |
| 243 | + <% if write_allowed? %> |
| 244 | + <div class="card-body"> |
| 245 | + <form action="<%= script_name %>/features/<%= @feature.key %>/boolean" method="post"> |
| 246 | + <%== csrf_input_tag %> |
246 | 247 |
|
247 |
| - <div class="row"> |
248 |
| - <% unless @feature.boolean_value %> |
249 |
| - <div class="col"> |
250 |
| - <button type="submit" name="action" value="Enable" <% if Flipper::UI.configuration.confirm_fully_enable %>id="enable_feature__button"<% end %> class="btn btn-outline-success btn-block" <% if Flipper::UI.configuration.read_only %>disabled<% end %>> |
251 |
| - <span class="d-block" data-toggle="tooltip" |
252 |
| - <% if Flipper::UI.configuration.confirm_fully_enable %> |
253 |
| - data-confirmation-text="<%= feature_name %>" |
254 |
| - <% end %> |
255 |
| - <% if Flipper::UI.configuration.read_only %> |
256 |
| - title="Fully enable is not allowed in read only mode." |
257 |
| - <% else %> |
258 |
| - title="Enable for everyone" |
259 |
| - <% end %> |
260 |
| - > |
261 |
| - Fully Enable |
262 |
| - </span> |
263 |
| - </button> |
264 |
| - </div> |
265 |
| - <% end %> |
| 248 | + <div class="row"> |
| 249 | + <% unless @feature.boolean_value %> |
| 250 | + <div class="col"> |
| 251 | + <button type="submit" name="action" value="Enable" <% if Flipper::UI.configuration.confirm_fully_enable %>id="enable_feature__button"<% end %> class="btn btn-outline-success btn-block"> |
| 252 | + <span class="d-block" data-toggle="tooltip" |
| 253 | + <% if Flipper::UI.configuration.confirm_fully_enable %> |
| 254 | + data-confirmation-text="<%= feature_name %>" |
| 255 | + <% end %> |
| 256 | + title="Enable for everyone" |
| 257 | + > |
| 258 | + Fully Enable |
| 259 | + </span> |
| 260 | + </button> |
| 261 | + </div> |
| 262 | + <% end %> |
266 | 263 |
|
267 |
| - <% unless @feature.off? %> |
268 |
| - <div class="col"> |
269 |
| - <button type="submit" name="action" value="Disable" class="btn btn-outline-danger btn-block" <% if Flipper::UI.configuration.read_only %>disabled<% end %>> |
270 |
| - <span class="d-block" data-toggle="tooltip" |
271 |
| - <% if Flipper::UI.configuration.read_only %> |
272 |
| - title="Disable is not allowed in read only mode."> |
273 |
| - <% else %> |
274 |
| - title="Disable for everyone by clearing all percentages, groups and actors."> |
275 |
| - <% end %> |
276 |
| - Disable |
277 |
| - </span> |
278 |
| - </button> |
279 |
| - </div> |
280 |
| - <% end %> |
281 |
| - </div> |
282 |
| - </form> |
283 |
| - </div> |
| 264 | + <% unless @feature.off? %> |
| 265 | + <div class="col"> |
| 266 | + <button type="submit" name="action" value="Disable" class="btn btn-outline-danger btn-block"> |
| 267 | + <span class="d-block" data-toggle="tooltip" title="Disable for everyone by clearing all percentages, groups and actors."> |
| 268 | + Disable |
| 269 | + </span> |
| 270 | + </button> |
| 271 | + </div> |
| 272 | + <% end %> |
| 273 | + </div> |
| 274 | + </form> |
| 275 | + </div> |
| 276 | + <% end %> |
284 | 277 | </div>
|
285 | 278 | </div>
|
286 | 279 | </div>
|
287 | 280 |
|
288 |
| -<% if !Flipper::UI.configuration.read_only && Flipper::UI.configuration.feature_removal_enabled %> |
| 281 | +<% if write_allowed? && Flipper::UI.configuration.feature_removal_enabled %> |
289 | 282 | <div class="row">
|
290 | 283 | <div class="col">
|
291 | 284 | <div class="card border">
|
|
0 commit comments