diff --git a/app/components/code-climate-popup.coffee b/app/components/code-climate-popup.coffee new file mode 100644 index 00000000..206106e5 --- /dev/null +++ b/app/components/code-climate-popup.coffee @@ -0,0 +1,10 @@ +`import Ember from 'ember'` + +Component = Ember.Component.extend( + actions: + close: -> + $('.popup').removeClass('display') + return false +) + +`export default Component` diff --git a/app/components/remove-log-popup.coffee b/app/components/remove-log-popup.coffee new file mode 100644 index 00000000..4ec49473 --- /dev/null +++ b/app/components/remove-log-popup.coffee @@ -0,0 +1,23 @@ +`import Ember from 'ember'` + +Component = Ember.Component.extend( + actions: + close: -> + $('.popup').removeClass('display') + return false + + removeLog: -> + $('.popup').removeClass('display') + job = @get('job') + job.removeLog().then -> + Travis.flash(success: 'Log has been successfully removed.') + , (xhr) -> + if xhr.status == 409 + Travis.flash(error: 'Log can\'t be removed') + else if xhr.status == 401 + Travis.flash(error: 'You don\'t have sufficient access to remove the log') + else + Travis.flash(error: 'An error occured when removing the log') +) + +`export default Component` diff --git a/app/templates/components/code-climate-popup.hbs b/app/templates/components/code-climate-popup.hbs index 372f41ef..7035909b 100644 --- a/app/templates/components/code-climate-popup.hbs +++ b/app/templates/components/code-climate-popup.hbs @@ -1,6 +1,6 @@
Want test coverage for your tests?
diff --git a/app/templates/components/remove-log-popup.hbs b/app/templates/components/remove-log-popup.hbs new file mode 100644 index 00000000..ce0299b7 --- /dev/null +++ b/app/templates/components/remove-log-popup.hbs @@ -0,0 +1,10 @@ +This action will remove the log permanently!
+Do you want to continue?
++ Yes, please! + or + Cancel +
+This action will remove the log permanently!
-Do you want to continue?
-- Yes, please! - or - Cancel -
-This action will remove the log permanently!
-Do you want to continue?
-- Yes, please! - or - Cancel -
diff --git a/app/views/pre.coffee b/app/views/pre.coffee index bda4bd62..89f475d5 100644 --- a/app/views/pre.coffee +++ b/app/views/pre.coffee @@ -121,23 +121,8 @@ View = BasicView.extend @engine.autoCloseFold = !Travis.tailing.isActive() event.preventDefault() - removeLog: -> - @popupCloseAll() - if @get('canRemoveLog') - job = @get('_job') || @get('build.jobs.firstObject') - job.removeLog().then -> - Travis.flash(success: 'Log has been successfully removed.') - , (xhr) -> - if xhr.status == 409 - Travis.flash(error: 'Log can\'t be removed') - else if xhr.status == 401 - Travis.flash(error: 'You don\'t have sufficient access to remove the log') - else - Travis.flash(error: 'An error occured when removing the log') - removeLogPopup: -> if @get('canRemoveLog') - @set('active', true) @popup('remove-log-popup') return false diff --git a/remove-log-popup.coffee b/remove-log-popup.coffee new file mode 100644 index 00000000..ce0299b7 --- /dev/null +++ b/remove-log-popup.coffee @@ -0,0 +1,10 @@ +This action will remove the log permanently!
+Do you want to continue?
++ Yes, please! + or + Cancel +
+