Bug#2409 CSV regenerate popup only showed when you are overwriting the previous url

stable
Jesús Espino 2015-03-11 12:28:45 +01:00 committed by David Barragán Merino
parent 3a94af6df0
commit 3108df4553
1 changed files with 17 additions and 12 deletions

View File

@ -647,20 +647,25 @@ class CsvExporterController extends taiga.Controller
setCsvUuid: => setCsvUuid: =>
@scope.csvUuid = @scope.project["#{@.type}_csv_uuid"] @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: -> regenerateUuid: ->
#TODO: i18n #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) => if @scope.csvUuid
promise = @rs.projects["regenerate_#{@.type}_csv_uuid"](@scope.projectId) @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
promise.then (data) => @._generateUuid(_.identity)
@scope.csvUuid = data.data?.uuid
promise.then null, =>
@confirm.notify("error")
promise.finally ->
finish()
return promise
class CsvExporterUserstoriesController extends CsvExporterController class CsvExporterUserstoriesController extends CsvExporterController
type: "userstories" type: "userstories"