editor: fix - check for success before changing current element
[fnpeditor.git] / src / editor / modules / indicator / indicator.js
1 define([
2 'libs/jquery',
3 'libs/underscore',
4 'libs/text!./template.html'
5 ], function($, _, template) {
6
7 'use strict';
8
9 return function(sandbox) {
10
11     var view = {
12         dom: $(_.template(template)())
13     };
14
15     return {
16         start: function() { sandbox.publish('ready'); },
17         getView: function() { return view.dom; },
18         showMessage: function(msg) {
19             view.dom.html('<span>' + msg + '</span>').show();
20         },
21         clearMessage: function(report) {
22             view.dom.empty();
23             if(report && report.message) {
24                 view.dom.html('<span class="success">' + report.message + '</span>').show().fadeOut(4000);
25             }
26         }
27         
28     };
29
30 };
31
32 });