diff --git a/app/gist/controller.js b/app/gist/controller.js index 428dda56..471be69f 100644 --- a/app/gist/controller.js +++ b/app/gist/controller.js @@ -24,6 +24,12 @@ export default Em.Controller.extend({ */ buildErrors: null, + /** + * Whether user wishes the code to automatically run + * @type {boolean} + */ + isAutorun: true, + /** * Build the application and set the iframe code */ @@ -59,8 +65,10 @@ export default Em.Controller.extend({ } }), - rebuildApp: Em.observer('model.files.@each.content', function() { - Em.run.debounce(this, this.buildApp, 500); + rebuildApp: Em.observer('model.files.@each.content', 'isAutorun', function() { + if (this.get('isAutorun')) { + Em.run.debounce(this, this.buildApp, 500); + } }), actions: { @@ -68,6 +76,10 @@ export default Em.Controller.extend({ this.set('activeEditor', editor); }, + runNow () { + this.buildApp(); + }, + deleteGist (gist) { gist.destroyRecord(); this.transitionToRoute('gist.new'); diff --git a/app/gist/template.hbs b/app/gist/template.hbs index 67f1d36a..388b7aa3 100644 --- a/app/gist/template.hbs +++ b/app/gist/template.hbs @@ -97,7 +97,7 @@
- + {{#if isBuilding}} Building... {{else}} @@ -110,6 +110,12 @@ {{/if}}
+
+ + {{#unless isAutorun}} + + {{/unless}} +
{{applicationUrl}}
diff --git a/app/styles/app.scss b/app/styles/app.scss index 0b88ad4d..b7d4e595 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -202,4 +202,14 @@ body { padding:3px; background: #fff; border: 1px solid #ddd; -} \ No newline at end of file +} + +.run-now { + margin-left: 10px; + padding: 1px 6px 3px; +} + +.run-or-autorun { + margin: 10px 25px; + text-align: right; +}