diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/views/mini_environments/services.html.erb | 119 |
1 files changed, 72 insertions, 47 deletions
diff --git a/app/views/mini_environments/services.html.erb b/app/views/mini_environments/services.html.erb index 89c3f7c..7c6fb51 100644 --- a/app/views/mini_environments/services.html.erb +++ b/app/views/mini_environments/services.html.erb @@ -117,55 +117,68 @@ License along with the GOV.UK Mini Environment Admin. If not, see </ul> </div> - <% ( - @mini_environment.govuk_guix_revision.available_services || [] - ).each do |group| %> - <h3><%= group["name"] %></h3> - <p><%= group["description"] %></p> - - <table class="table"> - <thead> - <tr> - <th>Select?</th> - <th>Service</th> - <th>Package</th> - </tr> - </thead> - <tbody> - <% group["services"].each do |service| %> + <div id="select-buttons" + class="btn-group btn-group-lg pull-right hidden" role="group" + aria-label="..."> + <button id="unselectAllButton" type="button" class="btn btn-default">Unselect all</button> + <button id="selectAllDefaultServicesButton" type="button" class="btn btn-default">Select all default services</button> + </div> + + <h2>Services</h2> + + <div id="servicesDiv"> + <% ( + @mini_environment.govuk_guix_revision.available_services || [] + ).each do |group| %> + <h3><%= group["name"] %></h3> + <p><%= group["description"] %></p> + + <table class="table"> + <thead> <tr> - <td class="col-md-1"> - <input type="checkbox" - name="<%= service["name"] %>-selected" - <%= 'checked' if MiniEnvironmentsController::DEFAULT_SERVICES.include? service["name"] %>> - </td> - - <td class="col-md-5"> - <strong><%= service["name"] %></strong> - <br> - <%= service["description"] %> - </td> - - <% package = service["package"] %> - <td class="col-md-5"> - <input type="text" - name="<%= service["name"] %>-revision" - class="form-control" - placeholder="<%= package["version"] %>" - value="<%= package["version"] %>"> - </td> - - <td class="col-md-1"> - <a class="pull-right" - href="<%= package["homepage"] %>"> - [homepage] - </a> - </td> + <th>Select?</th> + <th>Service</th> + <th>Package</th> </tr> - <% end %> - </tbody> - </table> - <% end %> + </thead> + <tbody> + <% group["services"].each do |service| %> + <% default = MiniEnvironmentsController::DEFAULT_SERVICES.include? service["name"] %> + <tr> + <td class="col-md-1"> + <input type="checkbox" + name="<%= service["name"] %>-selected" + <%= 'data-default' if default %> + <%= 'checked' if default %>> + </td> + + <td class="col-md-5"> + <strong><%= service["name"] %></strong> + <br> + <%= service["description"] %> + </td> + + <% package = service["package"] %> + <td class="col-md-5"> + <input type="text" + name="<%= service["name"] %>-revision" + class="form-control" + placeholder="<%= package["version"] %>" + value="<%= package["version"] %>"> + </td> + + <td class="col-md-1"> + <a class="pull-right" + href="<%= package["homepage"] %>"> + [homepage] + </a> + </td> + </tr> + <% end %> + </tbody> + </table> + <% end %> + </div> <div class="row"> <div class="col-md-9"></div> @@ -175,3 +188,15 @@ License along with the GOV.UK Mini Environment Admin. If not, see </div> </div> <% end %> + +<script> + $('#unselectAllButton').on('click', function() { + $('#servicesDiv input').prop('checked', false); + }); + + $('#selectAllDefaultServicesButton').on('click', function() { + $('#servicesDiv input[data-default]').prop('checked', true); + }); + + $('#select-buttons').removeClass('hidden'); +</script> |