create project
parent
e0dffa0a32
commit
332dc5c433
|
@ -31,6 +31,12 @@ class NavigationUrlsService extends taiga.Service
|
|||
update: (urls) ->
|
||||
@.urls = _.merge({}, @.urls, urls or {})
|
||||
|
||||
formatUrl: (url, ctx={}) ->
|
||||
replacer = (match) ->
|
||||
match = trim(match, ":")
|
||||
return ctx[match] or "undefined"
|
||||
return url.replace(/(:\w+)/g, replacer)
|
||||
|
||||
resolve: (name) ->
|
||||
return @.urls[name]
|
||||
|
||||
|
@ -63,12 +69,6 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
|
|||
options[key] = $scope.$eval(value)
|
||||
return [name, options]
|
||||
|
||||
formatUrl = (url, ctx={}) ->
|
||||
replacer = (match) ->
|
||||
match = trim(match, ":")
|
||||
return ctx[match] or "undefined"
|
||||
return url.replace(/(:\w+)/g, replacer)
|
||||
|
||||
link = ($scope, $el, $attrs) ->
|
||||
$el.on "click", (event) ->
|
||||
event.preventDefault()
|
||||
|
@ -80,7 +80,7 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
|
|||
|
||||
url = $navurls.resolve(name)
|
||||
|
||||
fullUrl = formatUrl(url, options)
|
||||
fullUrl = $navurls.formatUrl(url, options)
|
||||
$location.url(fullUrl)
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
|
@ -92,5 +92,3 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
|
|||
module = angular.module("taigaBase")
|
||||
module.service("$tgNavUrls", NavigationUrlsService)
|
||||
module.directive("tgNav", ["$tgNavUrls", "$tgAuth", "$q", "$location", NavigationUrlsDirective])
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class ProjectsController extends taiga.Controller
|
|||
|
||||
loadInitialData: ->
|
||||
return @rs.projects.list().then (projects) =>
|
||||
@.projects = {'recents': projects.slice(0, 8), 'all': projects.slice(6)}
|
||||
@.projects = {'recents': projects.slice(0, 8), 'all': projects.slice(8)}
|
||||
|
||||
module.controller("ProjectsController", ProjectsController)
|
||||
|
||||
|
@ -48,14 +48,18 @@ class ProjectController extends taiga.Controller
|
|||
|
||||
module.controller("ProjectController", ProjectController)
|
||||
|
||||
CreateProjectDirective = ($repo, $confirm, $location) ->
|
||||
CreateProjectDirective = ($repo, $confirm, $location, $navurls) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
$scope.data = {}
|
||||
form = $el.find("form").checksley()
|
||||
|
||||
onSuccessSubmit = (response) ->
|
||||
$confirm.notify("success", "Our Oompa Loompas are happy, wellcome to Taiga.") #TODO: i18n
|
||||
$location.path("/")
|
||||
$confirm.notify("success", "Success") #TODO: i18n
|
||||
|
||||
url = $navurls.resolve('project-backlog')
|
||||
fullUrl = $navurls.formatUrl(url, {'project': response.slug})
|
||||
|
||||
$location.url(fullUrl)
|
||||
|
||||
onErrorSubmit = (response) ->
|
||||
$confirm.notify("light-error", "According to our Oompa Loompas, project name is
|
||||
|
@ -78,7 +82,7 @@ CreateProjectDirective = ($repo, $confirm, $location) ->
|
|||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgCreateProject", ["$tgRepo", "$tgConfirm", "$location", CreateProjectDirective])
|
||||
module.directive("tgCreateProject", ["$tgRepo", "$tgConfirm", "$location", "$tgNavUrls", CreateProjectDirective])
|
||||
|
||||
ProjectsPaginationDirective = ($timeout) ->
|
||||
nextPage = (element, pageSize, callback) ->
|
||||
|
|
Loading…
Reference in New Issue