aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-24 13:55:37 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-24 13:55:37 +0100
commitd89f324f8fafd43fcad3c6072e5fd6f0a732e70d (patch)
tree4ab26797292bdae90dfd8f68ad13050c0d36e8e5
parentac45ed064b096f715805d21638ee9286804d12ef (diff)
downloadgovuk-mini-environment-admin-d89f324f8fafd43fcad3c6072e5fd6f0a732e70d.tar
govuk-mini-environment-admin-d89f324f8fafd43fcad3c6072e5fd6f0a732e70d.tar.gz
Add a couple of buttons to speed up service selection
-rw-r--r--app/views/mini_environments/services.html.erb119
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>