create project lightbox
parent
798457b7d9
commit
c1f07bf8c3
|
@ -24,7 +24,6 @@
|
|||
configure = ($routeProvider, $locationProvider, $httpProvider, $provide) ->
|
||||
|
||||
$routeProvider.when("/", {templateUrl: "/partials/projects.html"})
|
||||
$routeProvider.when("/create-project", {templateUrl: "/partials/create-project.html"})
|
||||
$routeProvider.when("/project/:pslug/", {templateUrl: "/partials/project.html"})
|
||||
$routeProvider.when("/project/:pslug/backlog", {templateUrl: "/partials/backlog.html"})
|
||||
$routeProvider.when("/project/:pslug/taskboard/:id", {templateUrl: "/partials/taskboard.html"})
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
module = angular.module("taigaProject", [])
|
|
@ -0,0 +1,42 @@
|
|||
taiga = @.taiga
|
||||
bindOnce = @.taiga.bindOnce
|
||||
|
||||
module = angular.module("taigaProject")
|
||||
|
||||
CreateProject = ($repo, $confirm, $location, $navurls) ->
|
||||
link = ($scope, $el, attrs) ->
|
||||
$scope.data = {}
|
||||
form = $el.find("form").checksley()
|
||||
|
||||
onSuccessSubmit = (response) ->
|
||||
$confirm.notify("success", "Success") #TODO: i18n
|
||||
|
||||
url = $navurls.resolve('project')
|
||||
fullUrl = $navurls.formatUrl(url, {'project': response.slug})
|
||||
|
||||
$location.url(fullUrl)
|
||||
|
||||
onErrorSubmit = (response) ->
|
||||
$confirm.notify("light-error", "According to our Oompa Loompas, project name is
|
||||
already in use.") #TODO: i18n
|
||||
|
||||
submit = ->
|
||||
if not form.validate()
|
||||
return
|
||||
promise = $repo.create("projects", $scope.data)
|
||||
promise.then(onSuccessSubmit, onErrorSubmit)
|
||||
|
||||
$scope.$on "projects:create", ->
|
||||
$el.removeClass("hidden")
|
||||
|
||||
$el.on "click", ".close", (event) ->
|
||||
event.preventDefault()
|
||||
$el.addClass("hidden")
|
||||
|
||||
$el.on "click", "a.button-green", (event) ->
|
||||
event.preventDefault()
|
||||
submit()
|
||||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgLbCreateProject", ["$tgRepo", "$tgConfirm", "$location", "$tgNavUrls", CreateProject])
|
|
@ -1,11 +1,10 @@
|
|||
taiga = @.taiga
|
||||
module = angular.module("taigaProject", [])
|
||||
|
||||
module = angular.module("taigaProject")
|
||||
|
||||
class ProjectsController extends taiga.Controller
|
||||
@.$inject = ["$scope", "$tgResources"]
|
||||
@.$inject = ["$scope", "$tgResources", "$rootScope"]
|
||||
|
||||
constructor: (@scope, @rs) ->
|
||||
constructor: (@scope, @rs, @rootscope) ->
|
||||
@scope.hideMenu = true
|
||||
@.projects = []
|
||||
@.loadInitialData()
|
||||
|
@ -14,8 +13,10 @@ class ProjectsController extends taiga.Controller
|
|||
return @rs.projects.list().then (projects) =>
|
||||
@.projects = {'recents': projects.slice(0, 8), 'all': projects.slice(8)}
|
||||
|
||||
module.controller("ProjectsController", ProjectsController)
|
||||
newProject: ->
|
||||
@rootscope.$broadcast("projects:create")
|
||||
|
||||
module.controller("ProjectsController", ProjectsController)
|
||||
|
||||
class ProjectController extends taiga.Controller
|
||||
@.$inject = ["$scope", "$tgResources", "$tgRepo", "$routeParams", "$q", "$rootScope"]
|
|
@ -1,23 +0,0 @@
|
|||
extends dummy-layout
|
||||
|
||||
block head
|
||||
title Taiga Project management web application with scrum in mind!
|
||||
|
||||
block content
|
||||
div.wrapper
|
||||
div.create-project
|
||||
div.create-project-container(tg-create-project)
|
||||
h1 Create Project
|
||||
form
|
||||
fieldset
|
||||
input(type="text", name="name", ng-model="data.name", data-required="true",
|
||||
placeholder="Name")
|
||||
fieldset
|
||||
input(type="text", name="description", ng-model="data.description", data-required="true",
|
||||
placeholder="Description")
|
||||
fieldset
|
||||
input(type="text", name="total_story_point", ng-model="data.total_story_point", data-required="true",
|
||||
placeholder="Total story point")
|
||||
fieldset
|
||||
a.button.button-create.button-gray(href="", title="Create") Create
|
||||
input(type="submit", class="hidden")
|
|
@ -7,7 +7,7 @@ block content
|
|||
div.wrapper(ng-controller="ProjectController as ctrl")
|
||||
section.main.single-project
|
||||
h1
|
||||
span.green(tg-bo-html="ctrl.project.name")
|
||||
span.green(tg-bo-html="project.name")
|
||||
div.summary
|
||||
ul.home-project-info-list
|
||||
li
|
||||
|
@ -28,4 +28,3 @@ block content
|
|||
li(ng-repeat="member in project.active_memberships")
|
||||
figure.avatar
|
||||
img(src="{{member.photo}}", alt="{{member.full_name}}")
|
||||
|
||||
|
|
|
@ -22,4 +22,7 @@ block content
|
|||
a.button(href="", tg-bo-html="project.name", tg-nav="project:project=project.slug")
|
||||
|
||||
.create-project-button-wrapper
|
||||
a.button.button-green(href="", tg-nav="create-project") Create project
|
||||
a.button.button-green(href="", ng-click="ctrl.newProject()") Create project
|
||||
|
||||
div.lightbox.lightbox_create-project.hidden(tg-lb-create-project)
|
||||
include views/modules/lightbox_create-project
|
|
@ -0,0 +1,17 @@
|
|||
a.close(href="", title="close")
|
||||
span.icon.icon-delete
|
||||
form
|
||||
h2.title Create Project
|
||||
form
|
||||
fieldset
|
||||
input(type="text", name="name", ng-model="data.name", data-required="true",
|
||||
placeholder="Name")
|
||||
fieldset
|
||||
input(type="text", name="description", ng-model="data.description", data-required="true",
|
||||
placeholder="Description")
|
||||
fieldset
|
||||
input(type="text", name="total_story_point", ng-model="data.total_story_point", data-required="true",
|
||||
placeholder="Total story point")
|
||||
fieldset
|
||||
a.button.button-green(href="", title="Create") Create
|
||||
input(type="submit", class="hidden")
|
|
@ -368,3 +368,9 @@
|
|||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.lightbox_create-project {
|
||||
form {
|
||||
width: 600px;
|
||||
}
|
||||
}
|
|
@ -48,6 +48,7 @@ paths = {
|
|||
"app/coffee/modules/tasks/*.coffee",
|
||||
"app/coffee/modules/wiki/*.coffee",
|
||||
"app/coffee/modules/admin/*.coffee",
|
||||
"app/coffee/modules/projects/*.coffee",
|
||||
"app/coffee/modules/locales/*.coffee",
|
||||
"app/coffee/modules/base/*.coffee",
|
||||
"app/coffee/modules/resources/*.coffee",
|
||||
|
|
Loading…
Reference in New Issue