add create project in the project nav
parent
c6179e4a06
commit
0db30f2894
|
@ -9,6 +9,8 @@ CreateProject = ($repo, $confirm, $location, $navurls) ->
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
|
|
||||||
onSuccessSubmit = (response) ->
|
onSuccessSubmit = (response) ->
|
||||||
|
$el.addClass("hidden")
|
||||||
|
|
||||||
$confirm.notify("success", "Success") #TODO: i18n
|
$confirm.notify("success", "Success") #TODO: i18n
|
||||||
|
|
||||||
url = $navurls.resolve('project')
|
url = $navurls.resolve('project')
|
||||||
|
@ -27,6 +29,7 @@ CreateProject = ($repo, $confirm, $location, $navurls) ->
|
||||||
promise.then(onSuccessSubmit, onErrorSubmit)
|
promise.then(onSuccessSubmit, onErrorSubmit)
|
||||||
|
|
||||||
$scope.$on "projects:create", ->
|
$scope.$on "projects:create", ->
|
||||||
|
$scope.data = {}
|
||||||
$el.removeClass("hidden")
|
$el.removeClass("hidden")
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
$el.on "click", ".close", (event) ->
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
taiga = @.taiga
|
taiga = @.taiga
|
||||||
module = angular.module("taigaProject")
|
module = angular.module("taigaProject")
|
||||||
|
|
||||||
|
class ProjectNavController extends taiga.Controller
|
||||||
|
@.$inject = ["$rootScope"]
|
||||||
|
|
||||||
|
constructor: (@rootscope) ->
|
||||||
|
|
||||||
|
newProject: ->
|
||||||
|
@rootscope.$broadcast("projects:create")
|
||||||
|
|
||||||
|
module.controller("ProjectNavController", ProjectNavController)
|
||||||
|
|
||||||
class ProjectsController extends taiga.Controller
|
class ProjectsController extends taiga.Controller
|
||||||
@.$inject = ["$scope", "$tgResources", "$rootScope"]
|
@.$inject = ["$scope", "$tgResources", "$rootScope"]
|
||||||
|
|
||||||
|
@ -53,42 +63,6 @@ class ProjectController extends taiga.Controller
|
||||||
|
|
||||||
module.controller("ProjectController", ProjectController)
|
module.controller("ProjectController", ProjectController)
|
||||||
|
|
||||||
CreateProjectDirective = ($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-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
|
|
||||||
already in use.") #TODO: i18n
|
|
||||||
|
|
||||||
submit = ->
|
|
||||||
if not form.validate()
|
|
||||||
return
|
|
||||||
|
|
||||||
promise = $repo.create("projects", $scope.data)
|
|
||||||
promise.then(onSuccessSubmit, onErrorSubmit)
|
|
||||||
|
|
||||||
$el.on "submit", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
submit()
|
|
||||||
|
|
||||||
$el.on "click", "a.button-create", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
submit()
|
|
||||||
|
|
||||||
return {link:link}
|
|
||||||
|
|
||||||
module.directive("tgCreateProject", ["$tgRepo", "$tgConfirm", "$location", "$tgNavUrls", CreateProjectDirective])
|
|
||||||
|
|
||||||
ProjectsPaginationDirective = ($timeout) ->
|
ProjectsPaginationDirective = ($timeout) ->
|
||||||
nextPage = (element, pageSize, callback) ->
|
nextPage = (element, pageSize, callback) ->
|
||||||
top = parseInt(element.css('top'), 10)
|
top = parseInt(element.css('top'), 10)
|
||||||
|
|
|
@ -23,6 +23,3 @@ block content
|
||||||
|
|
||||||
.create-project-button-wrapper
|
.create-project-button-wrapper
|
||||||
a.button.button-green(href="", ng-click="ctrl.newProject()") 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
|
|
|
@ -3,13 +3,19 @@
|
||||||
img(src="/images/logo.png", alt="TAIGA")
|
img(src="/images/logo.png", alt="TAIGA")
|
||||||
p Loading project...
|
p Loading project...
|
||||||
|
|
||||||
nav.projects-nav(tg-projects-nav)
|
div.lightbox.lightbox_create-project.hidden(tg-lb-create-project)
|
||||||
|
include lightbox_create-project
|
||||||
|
|
||||||
|
nav.projects-nav(ng-controller="ProjectNavController as ctrl", tg-projects-nav)
|
||||||
h1 Your projects
|
h1 Your projects
|
||||||
form
|
form
|
||||||
fieldset
|
fieldset
|
||||||
input(type="text" placeholder="Search in...", ng-model="projectsSearch.$")
|
input(type="text" placeholder="Search in...", ng-model="projectsSearch.$")
|
||||||
a.icon.icon-search
|
a.icon.icon-search
|
||||||
|
|
||||||
|
.create-project-button
|
||||||
|
a.button.button-green(href="", ng-click="ctrl.newProject()") Create project
|
||||||
|
|
||||||
div.projects-pagination(tg-projects-pagination, active="projects.length && !projectsSearch.$.length")
|
div.projects-pagination(tg-projects-pagination, active="projects.length && !projectsSearch.$.length")
|
||||||
ul.projects-list
|
ul.projects-list
|
||||||
li(ng-repeat="project in projects|filter:projectsSearch:strict track by project.id")
|
li(ng-repeat="project in projects|filter:projectsSearch:strict track by project.id")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 9999;
|
z-index: 99920;
|
||||||
&.active {
|
&.active {
|
||||||
@include transform(translateY(0));
|
@include transform(translateY(0));
|
||||||
@include transition (all .6s ease-in-out);
|
@include transition (all .6s ease-in-out);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 999;
|
z-index: 99910;
|
||||||
.close {
|
.close {
|
||||||
@extend %large;
|
@extend %large;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -374,4 +374,3 @@
|
||||||
width: 600px;
|
width: 600px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,13 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
.create-project-button {
|
||||||
|
margin-top: 1rem;
|
||||||
|
a {
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
.v-pagination-previous,
|
.v-pagination-previous,
|
||||||
.v-pagination-next {
|
.v-pagination-next {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
@ -88,7 +95,7 @@
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 99999;
|
z-index: 99900;
|
||||||
div {
|
div {
|
||||||
margin: 10% auto;
|
margin: 10% auto;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
Loading…
Reference in New Issue