Browse code

code clean

devnewton authored on 06/03/2017 at 14:16:17
Showing 1 changed files
... ...
@@ -1,30 +1,27 @@
1
-riot
2
-        .tag(
3
-                'jb3-revisions-modal',
4
-                '\
5
-				<div class="c-overlay" if="{ opts.visible }" onclick="{ hide }"></div>\
6
-				<div class="o-modal"  if="{ opts.visible }" style="height: 80%; overflow: scroll">\
7
-				  <header class="o-modal__header">\
8
-				    <button type="button" class="c-button c-button--close" onclick="{ hide }">×</button>\
9
-				    <h3 class="c-heading c-heading--small">{ opts.title }</h3>\
10
-				  </header>\
11
-				  <div class="o-modal__body">\
12
-				  	<jb3-raw content="{ opts.revisions }"></jb3-raw>\
13
-				  </div>\
14
-				</div>\
15
-',
16
-                function (opts) {
17
-                    var self = this;
18
-                    //self.raw = self.tags['jb3-raw'];
19
-                    this.on('show', function (revisions) {
20
-                        this.opts.revisions = revisions;
21
-                        this.opts.visible = true;
22
-                        this.update();
23
-                        //  self.raw.content = revisions;
24
-                        //self.raw.update();
25
-                    });
26
-                    this.hide = function () {
27
-                        self.opts.visible = false;
28
-                        self.update();
29
-                    };
30
-                });
31 1
\ No newline at end of file
2
+function jb3RevisionsModalConstructor(opts) {
3
+    var self = this;
4
+    this.on('show', function (revisions) {
5
+        this.opts.revisions = revisions;
6
+        this.opts.visible = true;
7
+        this.update();
8
+    });
9
+    this.hide = function () {
10
+        self.opts.visible = false;
11
+        self.update();
12
+    };
13
+}
14
+
15
+var jb3RevisionsModalTemplate = '\
16
+<div class="c-overlay" if="{ opts.visible }" onclick="{ hide }"></div>\
17
+<div class="o-modal"  if="{ opts.visible }" style="height: 80%; overflow: scroll">\
18
+    <header class="o-modal__header">\
19
+        <button type="button" class="c-button c-button--close" onclick="{ hide }">×</button>\
20
+        <h3 class="c-heading c-heading--small">{ opts.title }</h3>\
21
+    </header>\
22
+    <div class="o-modal__body">\
23
+        <jb3-raw content="{ opts.revisions }"></jb3-raw>\
24
+    </div>\
25
+</div>\
26
+';
27
+
28
+riot.tag('jb3-revisions-modal', jb3RevisionsModalTemplate, jb3RevisionsModalConstructor);
32 29
\ No newline at end of file