Skip to content

Loading…

Make sure these functions don't bleed into the global scope #70

Merged
merged 4 commits into from

3 participants

@tswicegood

This makes sure that all of these functions are assigned to variables
assigned to the current scope, rather than the global scope. It also adds a
trailing semi-colon to make sure various linters are happy.

tswicegood added some commits
@tswicegood tswicegood Make sure these functions don't bleed into the global scope
This makes sure that all of these functions are assigned to variables
assigned to the current scope, rather than the global scope.  It also
adds a trailing semi-colon to make sure various linters are happy.
c647065
@tswicegood tswicegood Remove `var` declaration---this variable is already delcared as an ar…
…gument
67fd30e
@tswicegood tswicegood Add missing semi-colons 6e3b996
@tswicegood tswicegood Swap out to === for the true comparison to avoid possible coercion is…
…sues
f92c7c5
@adrianholovaty
Django member

Thanks for this cleanup, @tswicegood!

@adrianholovaty adrianholovaty merged commit 4b75546 into django:master
@jezdez
Django member

Hm, seems like there was a ticket open, too. Please for the love of god, mention ticket numbers when creating pull requests.

@tswicegood

Doh! Didn't see the issue when I searched. :-/

@tswicegood

Oh wait -- was it the ticket I opened? I did the reverse reference from it to here I thought...? My workflow is generally create the PR first, then the ticket in Trac as housekeeping assuming it looks good to other people.

I'll try to make sure to update the description on PRs once a ticket is open though.

@jezdez
Django member

Right, the problem occurs when a pull request is merged without knowing there is a ticket. The green button is rather tempting ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 16, 2012
  1. @tswicegood

    Make sure these functions don't bleed into the global scope

    tswicegood committed
    This makes sure that all of these functions are assigned to variables
    assigned to the current scope, rather than the global scope.  It also
    adds a trailing semi-colon to make sure various linters are happy.
  2. @tswicegood
  3. @tswicegood

    Add missing semi-colons

    tswicegood committed
  4. @tswicegood
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 11 deletions.
  1. +11 −11 django/contrib/admin/static/admin/js/actions.js
View
22 django/contrib/admin/static/admin/js/actions.js
@@ -3,7 +3,7 @@
var options = $.extend({}, $.fn.actions.defaults, opts);
var actionCheckboxes = $(this);
var list_editable_changed = false;
- checker = function(checked) {
+ var checker = function(checked) {
if (checked) {
showQuestion();
} else {
@@ -11,7 +11,7 @@
}
$(actionCheckboxes).attr("checked", checked)
.parent().parent().toggleClass(options.selectedClass, checked);
- }
+ },
updateCounter = function() {
var sel = $(actionCheckboxes).filter(":checked").length;
$(options.counterContainer).html(interpolate(
@@ -29,30 +29,30 @@
}
return value;
});
- }
+ },
showQuestion = function() {
$(options.acrossClears).hide();
$(options.acrossQuestions).show();
$(options.allContainer).hide();
- }
+ },
showClear = function() {
$(options.acrossClears).show();
$(options.acrossQuestions).hide();
$(options.actionContainer).toggleClass(options.selectedClass);
$(options.allContainer).show();
$(options.counterContainer).hide();
- }
+ },
reset = function() {
$(options.acrossClears).hide();
$(options.acrossQuestions).hide();
$(options.allContainer).hide();
$(options.counterContainer).show();
- }
+ },
clearAcross = function() {
reset();
$(options.acrossInput).val(0);
$(options.actionContainer).removeClass(options.selectedClass);
- }
+ };
// Show counter by default
$(options.counterContainer).show();
// Check state of checkboxes and reinit state if needed
@@ -81,9 +81,9 @@
});
lastChecked = null;
$(actionCheckboxes).click(function(event) {
- if (!event) { var event = window.event; }
+ if (!event) { event = window.event; }
var target = event.target ? event.target : event.srcElement;
- if (lastChecked && $.data(lastChecked) != $.data(target) && event.shiftKey == true) {
+ if (lastChecked && $.data(lastChecked) != $.data(target) && event.shiftKey === true) {
var inrange = false;
$(lastChecked).attr("checked", target.checked)
.parent().parent().toggleClass(options.selectedClass, target.checked);
@@ -124,7 +124,7 @@
}
}
});
- }
+ };
/* Setup plugin defaults */
$.fn.actions.defaults = {
actionContainer: "div.actions",
@@ -135,5 +135,5 @@
acrossClears: "div.actions span.clear",
allToggle: "#action-toggle",
selectedClass: "selected"
- }
+ };
})(django.jQuery);
Something went wrong with that request. Please try again.