@@ -10340,7 +10340,6 @@ define('pat-utils',[
10340
10340
hideOrShow: hideOrShow,
10341
10341
addURLQueryParameter: addURLQueryParameter
10342
10342
};
10343
-
10344
10343
return utils;
10345
10344
});
10346
10345
@@ -11094,6 +11093,17 @@ define('pat-jquery-ext',["jquery"], function($) {
11094
11093
$.expr[":"].Contains = function(a, i, m) {
11095
11094
return $(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
11096
11095
};
11096
+
11097
+ $.fn.scopedFind = function (selector) {
11098
+ /* If the selector starts with an object id do a global search,
11099
+ * otherwise do a local search.
11100
+ */
11101
+ if (selector.startsWith('#')) {
11102
+ return $(selector);
11103
+ } else {
11104
+ return this.find(selector);
11105
+ }
11106
+ };
11097
11107
});
11098
11108
11099
11109
/**
@@ -15089,9 +15099,10 @@ define('pat-checkedflag',[
15089
15099
*/
15090
15100
define('pat-checklist',[
15091
15101
"jquery",
15102
+ "pat-jquery-ext",
15092
15103
"pat-parser",
15093
15104
"pat-registry"
15094
- ], function($, Parser, registry) {
15105
+ ], function($, dummy, Parser, registry) {
15095
15106
var parser = new Parser("checklist");
15096
15107
parser.add_argument("select", ".select-all");
15097
15108
parser.add_argument("deselect", ".deselect-all");
@@ -15107,9 +15118,9 @@ define('pat-checklist',[
15107
15118
options = parser.parse($trigger, opts, false);
15108
15119
15109
15120
$trigger.data("patternChecklist", options);
15110
- $trigger.find (options.select)
15121
+ $trigger.scopedFind (options.select)
15111
15122
.on("click.pat-checklist", {trigger: $trigger}, _.onSelectAll);
15112
- $trigger.find (options.deselect)
15123
+ $trigger.scopedFind (options.deselect)
15113
15124
.on("click.pat-checklist", {trigger: $trigger}, _.onDeselectAll);
15114
15125
$trigger.on("change.pat-checklist", {trigger: $trigger}, _.onChange);
15115
15126
// update select/deselect button status
@@ -15121,8 +15132,8 @@ define('pat-checklist',[
15121
15132
return $el.each(function() {
15122
15133
var $trigger = $(this),
15123
15134
options = $trigger.data("patternChecklist");
15124
- $trigger.find (options.select).off(".pat-checklist");
15125
- $trigger.find (options.deselect).off(".pat-checklist");
15135
+ $trigger.scopedFind (options.select).off(".pat-checklist");
15136
+ $trigger.scopedFind (options.deselect).off(".pat-checklist");
15126
15137
$trigger.off(".pat-checklist", "input[type=checkbox]");
15127
15138
$trigger.data("patternChecklist", null);
15128
15139
});
@@ -15131,8 +15142,8 @@ define('pat-checklist',[
15131
15142
onChange: function(event) {
15132
15143
var $trigger = event.data.trigger,
15133
15144
options = $trigger.data("patternChecklist"),
15134
- deselect = $trigger.find (options.deselect),
15135
- select = $trigger.find (options.select);
15145
+ deselect = $trigger.scopedFind (options.deselect),
15146
+ select = $trigger.scopedFind (options.select);
15136
15147
if ($trigger.find("input[type=checkbox]:visible:checked").length===0) {
15137
15148
deselect.prop("disabled", true);
15138
15149
} else {
@@ -15152,10 +15163,10 @@ define('pat-checklist',[
15152
15163
$trigger.find("input[type=checkbox]:not(:checked)").each(function () {
15153
15164
$(this).prop("checked", true).trigger("change");
15154
15165
});
15155
- $trigger.find (options.deselect).each(function () {
15166
+ $trigger.scopedFind (options.deselect).each(function () {
15156
15167
$(this).prop("disabled", false);
15157
15168
});
15158
- $trigger.find (options.select).each(function () {
15169
+ $trigger.scopedFind (options.select).each(function () {
15159
15170
$(this).attr({disabled: "disabled"});
15160
15171
});
15161
15172
event.preventDefault();
@@ -15167,10 +15178,10 @@ define('pat-checklist',[
15167
15178
$trigger.find("input[type=checkbox]:checked").each(function () {
15168
15179
$(this).prop("checked", false).trigger("change");
15169
15180
});
15170
- $trigger.find (options.select).each(function () {
15181
+ $trigger.scopedFind (options.select).each(function () {
15171
15182
$(this).prop("disabled", false);
15172
15183
});
15173
- $trigger.find (options.deselect).each(function () {
15184
+ $trigger.scopedFind (options.deselect).each(function () {
15174
15185
$(this).attr({disabled: "disabled"});
15175
15186
});
15176
15187
event.preventDefault();
@@ -16988,7 +16999,20 @@ define('pat-inject',[
16988
16999
$el.on("pat-ajax-success.pat-inject", onSuccess);
16989
17000
$el.on("pat-ajax-error.pat-inject", onError);
16990
17001
16991
- ajax.request($el, {url: cfgs[0].url});
17002
+ if (cfgs[0].url.length) {
17003
+ ajax.request($el, {url: cfgs[0].url});
17004
+ } else {
17005
+ // If there is no url specified, then content is being fetched
17006
+ // from the same page.
17007
+ // No need to do an ajax request for this, so we spoof the ajax
17008
+ // event.
17009
+ $el.trigger({
17010
+ type: "pat-ajax-success",
17011
+ jqxhr: {
17012
+ responseText: $("body").html()
17013
+ }
17014
+ });
17015
+ }
16992
17016
},
16993
17017
16994
17018
_inject: function inject_inject(trigger, $source, $target, cfg) {
@@ -47614,7 +47638,7 @@ define('pat-switch',[
47614
47638
},
47615
47639
47616
47640
_onClick: function(ev) {
47617
- if ($(ev.target ).is("a")) {
47641
+ if ($(ev.currentTarget ).is("a")) {
47618
47642
ev.preventDefault();
47619
47643
}
47620
47644
switcher._go($(this));
0 commit comments