Merge pull request #383 from taigaio/bug/2409/csv-regenerate-popup-only-when-needed

Bug#2409 CSV regenerate popup only showed when you are overwriting the p...
stable
David Barragán Merino 2015-03-11 16:06:41 +01:00
commit 52d720a8f4
1 changed files with 17 additions and 12 deletions

View File

@ -647,20 +647,25 @@ class CsvExporterController extends taiga.Controller
setCsvUuid: =>
@scope.csvUuid = @scope.project["#{@.type}_csv_uuid"]
_generateUuid: (finish) =>
promise = @rs.projects["regenerate_#{@.type}_csv_uuid"](@scope.projectId)
promise.then (data) =>
@scope.csvUuid = data.data?.uuid
promise.then null, =>
@confirm.notify("error")
promise.finally ->
finish()
return promise
regenerateUuid: ->
#TODO: i18n
@confirm.ask("Change URL", "You going to change the CSV data access url. The previous url will be disabled. Are you sure?").then (finish) =>
promise = @rs.projects["regenerate_#{@.type}_csv_uuid"](@scope.projectId)
promise.then (data) =>
@scope.csvUuid = data.data?.uuid
promise.then null, =>
@confirm.notify("error")
promise.finally ->
finish()
return promise
if @scope.csvUuid
@confirm.ask("Change URL", "You going to change the CSV data access url. The previous url will be disabled. Are you sure?").then @._generateUuid
else
@._generateUuid(_.identity)
class CsvExporterUserstoriesController extends CsvExporterController
type: "userstories"