summaryrefslogtreecommitdiff
path: root/web-ui/app/js/tags/data
diff options
context:
space:
mode:
authorAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-12-17 19:19:25 -0200
committerAlexandre Pretto Nunes <anunes@thoughtworks.com>2015-01-06 16:27:26 -0200
commit7ab9f9423004adf1df9cc1be1b2a5ae7eade4a95 (patch)
treebb8aeadbc6f9ce4798ce1eaabc40d66972ba1f5b /web-ui/app/js/tags/data
parent0ff59644d8e804bcab928d184b31a5e6cdc2f6ed (diff)
Separate auto-refresh for mails and tags, and start moving away from having the left_pane_dispatcher as a middleman
Diffstat (limited to 'web-ui/app/js/tags/data')
-rw-r--r--web-ui/app/js/tags/data/tags.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/web-ui/app/js/tags/data/tags.js b/web-ui/app/js/tags/data/tags.js
index 40614fea..401b41f7 100644
--- a/web-ui/app/js/tags/data/tags.js
+++ b/web-ui/app/js/tags/data/tags.js
@@ -14,12 +14,12 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['flight/lib/component', 'page/events', 'helpers/monitored_ajax', 'mixins/with_feature_toggle'], function (defineComponent, events, monitoredAjax, withFeatureToggle) {
+define(['flight/lib/component', 'page/events', 'helpers/monitored_ajax', 'mixins/with_feature_toggle', 'mixins/with_auto_refresh'], function (defineComponent, events, monitoredAjax, withFeatureToggle, withAutoRefresh) {
'use strict';
var DataTags = defineComponent(dataTags, withFeatureToggle('tags', function() {
$(document).trigger(events.ui.mails.refresh);
- }));
+ }), withAutoRefresh('refreshTags'));
DataTags.all = {
name: 'all',
@@ -34,13 +34,11 @@ define(['flight/lib/component', 'page/events', 'helpers/monitored_ajax', 'mixins
}
};
- return DataTags;
-
function dataTags() {
function sendTagsBackTo(on, params) {
return function(data) {
data.push(DataTags.all);
- on.trigger(params.caller, events.tags.received, {tags: data, skipMailListRefresh: params.skipMailListRefresh});
+ on.trigger(params.caller, events.tags.received, {tags: data});
};
}
@@ -53,8 +51,14 @@ define(['flight/lib/component', 'page/events', 'helpers/monitored_ajax', 'mixins
.done(sendTagsBackTo(this, params));
};
+ this.refreshTags = function() {
+ this.fetchTags(null, {caller: document});
+ };
+
this.after('initialize', function () {
this.on(document, events.tags.want, this.fetchTags);
});
}
+
+ return DataTags;
});