Révision 4003efde
Ajouté par Assos Assos il y a environ 4 ans
drupal7/sites/all/modules/views/js/ajax_view.js | ||
---|---|---|
80 | 80 |
// Add a trigger to update this view specifically. |
81 | 81 |
var self_settings = this.element_settings; |
82 | 82 |
self_settings.event = 'RefreshView'; |
83 |
this.refreshViewAjax = new Drupal.ajax(this.selector, this.$view, self_settings); |
|
83 |
var self = this; |
|
84 |
this.$view.once('refresh', function () { |
|
85 |
self.refreshViewAjax = new Drupal.ajax(self.selector, self.$view, self_settings); |
|
86 |
}); |
|
84 | 87 |
}; |
85 | 88 |
|
86 | 89 |
Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() { |
... | ... | |
101 | 104 |
* Attach the ajax behavior to each link. |
102 | 105 |
*/ |
103 | 106 |
Drupal.views.ajaxView.prototype.attachPagerAjax = function() { |
104 |
this.$view.find('ul.pager > li > a, th.views-field a, .attachment .views-summary a') |
|
107 |
this.$view.find('ul.pager > li > a, ol.pager > li > a, th.views-field a, .attachment .views-summary a')
|
|
105 | 108 |
.each(jQuery.proxy(this.attachPagerLinkAjax, this)); |
106 | 109 |
}; |
107 | 110 |
|
108 | 111 |
/** |
109 |
* Attach the ajax behavior to a singe link. |
|
112 |
* Attach the ajax behavior to a single link.
|
|
110 | 113 |
*/ |
111 | 114 |
Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) { |
112 | 115 |
var $link = $(link); |
116 |
var viewData = {}; |
|
117 |
var href = $link.attr('href'); |
|
113 | 118 |
// Don't attach to pagers inside nested views. |
114 |
if ($link.closest('.view')[0] !== this.$view[0]) { |
|
119 |
if ($link.closest('.view')[0] !== this.$view[0] && |
|
120 |
$link.closest('.view').parent().hasClass('attachment') === false) { |
|
115 | 121 |
return; |
116 | 122 |
} |
117 |
var viewData = {}; |
|
118 |
var href = $link.attr('href'); |
|
119 | 123 |
|
120 | 124 |
// Provide a default page if none has been set. This must be done |
121 | 125 |
// prior to merging with settings to avoid accidentally using the |
... | ... | |
127 | 131 |
// Construct an object using the settings defaults and then overriding |
128 | 132 |
// with data specific to the link. |
129 | 133 |
$.extend( |
130 |
viewData, |
|
131 |
this.settings, |
|
132 |
Drupal.Views.parseQueryString(href), |
|
133 |
// Extract argument data from the URL. |
|
134 |
Drupal.Views.parseViewArgs(href, this.settings.view_base_path) |
|
134 |
viewData,
|
|
135 |
this.settings,
|
|
136 |
Drupal.Views.parseQueryString(href),
|
|
137 |
// Extract argument data from the URL.
|
|
138 |
Drupal.Views.parseViewArgs(href, this.settings.view_base_path)
|
|
135 | 139 |
); |
136 | 140 |
|
137 | 141 |
// For anchor tags, these will go to the target of the anchor rather |
Formats disponibles : Unified diff
Weekly update of contrib modules