Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/assets/javascripts/users.coffee

This file was deleted.

21 changes: 21 additions & 0 deletions app/assets/javascripts/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var ready = function() {
$('#check_all').on("click", function(){
var project_checkboxes = $('.project_checkbox');
var metric_checkboxes = $('.metric_checkbox');
if (this.checked) {
check_all(project_checkboxes);
check_all(metric_checkboxes);
}
});
};

var check_all = function(checkboxes) {
$.each(checkboxes, function(index, el) {
if (el.checked !== true) {
el.click();
}
});
}

$(document).on('turbolinks:load', ready);
$(document).ready(ready);
7 changes: 5 additions & 2 deletions app/views/users/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
%h1 Preference Settings
%div
= check_box_tag "check_all", 0, true
= label_tag "check_all", "Check all"
= form_tag user_path, :method => :put do
%div#project-preference-list
%h4 Check projects to monitor:
- @all_projects.each do |project|
%div
= check_box_tag "projects[#{project.id}]", 0, (@preferred_projects.include? project)
= check_box_tag "projects[#{project.id}]", 0, (@preferred_projects.include? project), :class => "project_checkbox"
= label_tag "projects_#{project.id}", project.name
%div#metric-preference-list
%h4 Check Metrics to monitor:
- @all_metrics.each do |metric|
%div
= check_box_tag "metrics[#{metric}]", 0, (@preferred_metrics.include? metric)
= check_box_tag "metrics[#{metric}]", 0, (@preferred_metrics.include? metric), :class => "metric_checkbox"
= label_tag "metrics_#{metric}", metric.camelcase
%br
= submit_tag "Save", :id => "project_preference_submit", :class => "btn btn-default"
Expand Down