quality_gates.noQualityGates=No Quality Gates
quality_gates.create=Create Quality Gate
quality_gates.rename=Rename Quality Gate
+quality_gates.delete=Delete Quality Gate
quality_gates.copy=Copy Quality Gate
quality_gates.conditions=Conditions
quality_gates.projects=Projects
quality_gates.add_condition=Add Condition
quality_gates.no_conditions=No Conditions
+quality_gates.delete_condition=Delete Condition
quality_gates.introduction=Only project measures are checked against thresholds. Sub-projects, directories and files are ignored.
quality_gates.health_icons=Project health icons represent:
quality_gates.projects_for_default=Every project not specifically associated to a quality gate will be associated to this one by default.
'<%= pkg.assets %>js/top-search.js'
'<%= pkg.assets %>js/sortable.js'
'<%= pkg.assets %>js/common/inputs.js'
+ '<%= pkg.assets %>js/common/dialogs.js'
'<%= pkg.assets %>js/application.js'
'<%= pkg.assets %>js/dashboard.js'
'<%= pkg.assets %>js/duplication.js'
'<%= pkg.assets %>js/top-search.js'
'<%= pkg.assets %>js/sortable.js'
'<%= pkg.assets %>js/common/inputs.js'
+ '<%= pkg.assets %>js/common/dialogs.js'
'<%= pkg.assets %>js/application.js'
'<%= pkg.assets %>js/dashboard.js'
'<%= pkg.assets %>js/duplication.js'
--- /dev/null
+$ = jQuery
+
+window.confirmDialog = (options) ->
+ settings = _.extend window.confirmDialog.defaults, options
+ dialog = $ """
+ <div>
+ <div class='modal-head'><h2>#{settings.title}</h2></div>
+ <div class='modal-body'>#{settings.html}</div>
+ <div class='modal-foot'>
+ <button data-confirm='yes'>#{settings.yesLabel}</button>
+ <a data-confirm='no' class='action'>#{settings.noLabel}</a>
+ </div>
+ </div>
+ """
+
+ $('[data-confirm=yes]', dialog).on 'click', ->
+ dialog.dialog 'close'
+ settings.yesHandler()
+ settings.always()
+ $('[data-confirm=no]', dialog).on 'click', ->
+ dialog.dialog 'close'
+ settings.noHandler()
+ settings.always()
+
+ dialog.dialog
+ modal: true
+ minHeight: null
+ width: 540
+
+
+window.confirmDialog.defaults =
+ title: 'Confirmation'
+ html: ''
+ yesLabel: 'Yes'
+ noLabel: 'Cancel'
+ yesHandler: ->
+ noHandler: ->
+ always: ->
\ No newline at end of file
errorInput: '[name=error]'
actionsBox: '.quality-gate-condition-actions'
updateButton: '.update-condition'
+ deleteButton: '.delete-condition'
events:
'click @ui.updateButton': 'saveCondition'
- 'click .delete-condition': 'deleteCondition'
+ 'click @ui.deleteButton': 'deleteCondition'
'click .add-condition': 'saveCondition'
'click .cancel-add-condition': 'cancelAddCondition'
'keyup :input': 'enableUpdate'
deleteCondition: ->
- if confirm t('quality_gates.delete_condition.confirm.message')
- @showSpinner()
- @model.delete().done =>
- @options.collectionView.collection.remove @model
- @options.collectionView.updateConditions()
- @close()
+ confirmDialog
+ title: t 'quality_gates.delete_condition'
+ html: t('quality_gates.delete_condition.confirm.message')
+ yesHandler: =>
+ @showSpinner()
+ @model.delete().done =>
+ @options.collectionView.collection.remove @model
+ @options.collectionView.updateConditions()
+ @close()
+ always: => @ui.deleteButton.blur()
cancelAddCondition: ->
deleteQualityGate: ->
message = if @model.get 'default' then 'quality_gates.delete.confirm.default' else 'quality_gates.delete.confirm.message'
- if confirm t(message).replace('{0}', @model.get 'name')
- @showSpinner()
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/qualitygates/destroy"
- data: id: @model.id
- .always =>
- @hideSpinner()
- .done =>
- @options.app.deleteQualityGate @model.id
- else
- @ui.deleteButton.blur()
+ message = tp message, @model.get('name')
+ confirmDialog
+ title: t 'quality_gates.delete'
+ html: message
+ yesHandler: =>
+ @showSpinner()
+ jQuery.ajax
+ type: 'POST'
+ url: "#{baseUrl}/api/qualitygates/destroy"
+ data: id: @model.id
+ .always => @hideSpinner()
+ .done => @options.app.deleteQualityGate @model.id
+ always: => @ui.deleteButton.blur()
changeDefault: (set) ->
"quality_gates.conditions",
"quality_gates.copy",
"quality_gates.create",
+ "quality_gates.delete",
"quality_gates.health_icons",
"quality_gates.introduction",
"quality_gates.no_conditions",
+ "quality_gates.delete_condition",
"quality_gates.noQualityGates",
"quality_gates.operator.LT",
"quality_gates.operator.GT",