Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #130 from nashby/add-select-all-button

add select all checkboxes button fro problems page, closes #111
  • Loading branch information...
commit e5875d949ff38e3126723adb9891b58913512d31 2 parents 3fb56db + 383d610
@ndbroadbent ndbroadbent authored
Showing with 31 additions and 19 deletions.
  1. +2 −2 app/views/errs/_table.html.haml
  2. +29 −17 public/javascripts/application.js
View
4 app/views/errs/_table.html.haml
@@ -3,7 +3,7 @@
%table.errs.selectable
%thead
%tr
- %th
+ %th= check_box_tag "toggle_problems_checkboxes"
%th= link_for_sort "App"
%th= link_for_sort "What & Where".html_safe, "message"
%th= link_for_sort "Latest", "last_notice_at"
@@ -42,7 +42,7 @@
%td.resolve= link_to image_tag("thumbs-up.png"), resolve_app_err_path(problem.app, problem), :title => "Resolve", :method => :put, :confirm => err_confirm, :class => 'resolve' if problem.unresolved?
- if errs.none?
%tr
- %td{:colspan => (@app ? 5 : 6)}
+ %td{:colspan => (@app ? 6 : 7)}
%em No errs here
= paginate errs
.tab-bar
View
46 public/javascripts/application.js
@@ -1,39 +1,41 @@
// App JS
$(function() {
-
+
var currentTab = "summary";
-
+
function init() {
-
+
activateTabbedPanels();
-
+
activateSelectableRows();
-
+
+ toggleProblemsCheckboxes();
+
$('#watcher_name').live("click", function() {
$(this).closest('form').find('.show').removeClass('show');
$('#app_watchers_attributes_0_user_id').addClass('show');
});
-
+
$('#watcher_email').live("click", function() {
$(this).closest('form').find('.show').removeClass('show');
$('#app_watchers_attributes_0_email').addClass('show');
});
-
+
$('a.copy_config').live("click", function() {
$('select.choose_other_app').show().focus();
});
-
+
$('select.choose_other_app').live("change", function() {
var loc = window.location;
window.location.href = loc.protocol + "//" + loc.host + loc.pathname +
"?copy_attributes_from=" + $(this).val();
});
-
+
$('input[type=submit][data-action]').click(function() {
$(this).closest('form').attr('action', $(this).attr('data-action'));
});
-
+
$('.notice-pagination').each(function() {
$('.notice-pagination a').pjax('#content', { timeout: 2000});
$('#content').bind('pjax:start', function() {
@@ -46,7 +48,7 @@ $(function() {
});
});
}
-
+
function activateTabbedPanels() {
$('.tab-bar a').each(function(){
var tab = $(this);
@@ -54,25 +56,35 @@ $(function() {
panel.addClass('panel');
panel.find('h3').hide();
});
-
+
$('.tab-bar a').click(function(){
activateTab($(this));
return(false);
});
activateTab($('.tab-bar ul li a.button[rel=' + currentTab + ']'));
}
-
+
function activateTab(tab) {
tab = $(tab);
var panel = $('#'+tab.attr('rel'));
-
+
tab.closest('.tab-bar').find('a.active').removeClass('active');
tab.addClass('active');
-
+
$('.panel').hide();
panel.show();
}
-
+
+ function toggleProblemsCheckboxes() {
+ var checkboxToggler = $('#toggle_problems_checkboxes');
+
+ checkboxToggler.live("click", function() {
+ $('input[name^="problems"]').each(function() {
+ this.checked = checkboxToggler.get(0).checked;
+ });
+ });
+ }
+
function activateSelectableRows() {
$('.selectable tr').click(function(event) {
if(!_.include(['A', 'INPUT', 'BUTTON', 'TEXTAREA'], event.target.nodeName)) {
@@ -81,6 +93,6 @@ $(function() {
}
});
}
-
+
init();
});
Please sign in to comment.
Something went wrong with that request. Please try again.