Enablig create new sprint in backlog

stable
Alejandro Alonso 2014-06-26 10:50:04 +02:00
parent 0457399f7e
commit 5fcf32592c
12 changed files with 238 additions and 49 deletions

View File

@ -21,7 +21,7 @@
CreateEditUserstoryDirective = ($repo, $model, $rs) ->
editDescription = ($scope, $el) ->
editDescription = ($scope, $el) ->
$el.find('.markdown-preview a').removeClass("active")
$el.find('.markdown-preview a.edit').addClass("active")
descriptionDOM = $el.find("textarea.description")
@ -120,6 +120,9 @@ CreateEditUserstoryDirective = ($repo, $model, $rs) ->
angular.element(event.currentTarget).toggleClass("selected")
$scope.us.client_requirement = not $scope.us.client_requirement
$scope.$on "$destroy", ->
$el.off()
return {link: link}
CreateBulkUserstroriesDirective = ($repo, $rs, $rootscope) ->
@ -144,13 +147,39 @@ CreateBulkUserstroriesDirective = ($repo, $rs, $rootscope) ->
$rootscope.$broadcast("usform:bulk:success", result)
$el.addClass("hidden")
$scope.$on "$destroy", ->
$el.off()
return {link: link}
CreateSprint = ($repo, $rs, $rootscope) ->
link = ($scope, $el, attrs) ->
$scope.$on "sprintform:create", ->
$el.removeClass("hidden")
$scope.sprint = {
project: $scope.projectId
name: null
estimated_start: null
estimated_finish: null
}
$el.on "click", ".close", (event) ->
event.preventDefault()
$el.addClass("hidden")
$el.on "click", ".button-green", (event) ->
event.preventDefault()
$repo.create("milestones", $scope.sprint).then (data) ->
$el.addClass("hidden")
$rootscope.$broadcast("sprintform:create:success", data)
$scope.$on "$destroy", ->
$el.off()
return {link: link}
module = angular.module("taigaBacklog")
module.directive("tgLbCreateEditUserstory", ["$tgRepo", "$tgModel", "$tgResources", CreateEditUserstoryDirective])
module.directive("tgLbCreateBulkUserstories", [
"$tgRepo",
"$tgResources",
"$rootScope",
CreateBulkUserstroriesDirective
])
module.directive("tgLbCreateBulkUserstories", ["$tgRepo", "$tgResources", "$rootScope", CreateBulkUserstroriesDirective])
module.directive("tgLbCreateSprint", ["$tgRepo", "$tgResources", "$rootScope", CreateSprint])

View File

@ -31,6 +31,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin)
console.log "FAIL"
@rootscope.$on("usform:bulk:success", @.loadUserstories)
@rootscope.$on("sprintform:create:success", @.loadSprints)
loadProjectStats: ->
return @rs.projects.stats(@scope.projectId).then (stats) =>
@ -123,6 +124,8 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin)
when "standard" then @rootscope.$broadcast("usform:new")
when "bulk" then @rootscope.$broadcast("usform:bulk")
addNewSprint: () ->
@rootscope.$broadcast("sprintform:create")
#############################################################################
## Backlog Directive

View File

@ -56,7 +56,17 @@ SprintProgressBarDirective = ->
return {link: link}
DateSelectorDirective =->
link = ($scope, $el, $attrs, $model) ->
picker = new Pikaday({field: $el[0]})
return {
link: link
require: "ngModel"
}
module = angular.module("taigaCommon")
module.directive("tgDateRange", DateRangeDirective)
module.directive("tgSprintProgressbar", SprintProgressBarDirective)
module.directive("tgDateSelector", DateSelectorDirective)

View File

@ -29,5 +29,5 @@ block content
include views/modules/lightbox_add-new-us
div.lightbox.lightbox_add-bulk.hidden(tg-lb-create-bulk-userstories)
include views/modules/lightbox_add-bulk
div.lightbox.lightbox_add-sprint.hidden
div.lightbox.lightbox_add-sprint.hidden(tg-lb-create-sprint)
include views/modules/lightbox_add-sprint

View File

@ -16,3 +16,5 @@ div.row.us-item-row(ng-repeat="us in visibleUserstories track by us.id")
a.us-points(href="", title="Points") 0
a.icon.icon-drag-v(href="", title="Drag")
hr.doom-line

View File

@ -6,38 +6,3 @@ section.backlog-table-header
span Points
section.backlog-table-body
include ../components/backlog-row
// - for (var x = 0; x < 40; x++)
// div.row
// div.user-stories
// div.user-story-name
// input(type="checkbox", name="")
// a(href="") Crear el perfil de usuario Senior en el admin
// span.us-settings
// a.icon.icon-edit(href="", title="Edit")
// a.icon.icon-delete(href="", title="Delete")
// div.user-story-tags
// - for(var y = 0; y < 3; y++)
// include ../components/tag
// div.status.width-2
// a(href="", title="Status Name") Status Name
// ul.popover.pop-status
// li
// a(href="", title="Status 1") Status 1
// li
// a(href="", title="Status 2") Status 2
// li
// a(href="", title="Status 3") Status 3
// div.points
// a(href="", title="") 24
// div.points
// a(href="", title="Total Points") 43
// ul.popover.pop-status
// li
// a(href="", title="Status 1") Status 1
// li
// a(href="", title="Status 2") Status 2
// li
// a(href="", title="Status 3") Status 3
// a.icon.icon-drag-v(href="", title="Drag")
// hr.doom-line

View File

@ -4,9 +4,9 @@ form
h2.title New Sprint
fieldset
label.last-sprint-name last sprint is <strong> {{sprintname}} ;-) </strong>
input(type="text", placeholder="sprint name")
input(ng-model="sprint.name", type="text", placeholder="sprint name", name="name")
fieldset.dates
input.date-start(type="text", placeholder="Estimated Start")
input.date-end(type="text", placeholder="Estimated End")
input.date-start(tg-date-selector, ng-model="sprint.estimated_start", type="text", placeholder="Estimated Start")
input.date-end(tg-date-selector, ng-model="sprint.estimated_finish", type="text", placeholder="Estimated End")
a.button.button-green(href="", title="Save")
span Create

View File

@ -7,7 +7,7 @@ section.sprints
span.number(tg-bo-html="stats.total_milestones") --
span.description <br/>sprints
div.new-sprint
a.button.button-green(href="", title="Add New US")
a.button.button-green(ng-click="ctrl.addNewSprint()", href="", title="Add New US")
span.text + New sprint
section.sprint(ng-repeat="sprint in sprints track by sprint.id", tg-backlog-sprint="sprint")

View File

@ -72,3 +72,6 @@ $prefix-for-spec: true;
@import 'layout/admin-membership';
@import 'layout/project-colors';
@import 'layout/kanban';
//Vendor
@import 'vendor/pikaday'

173
app/styles/vendor/pikaday.scss vendored Normal file
View File

@ -0,0 +1,173 @@
@charset "UTF-8";
/*!
* Pikaday
* Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/
*/
.pika-single {
z-index: 9999;
display: block;
position: relative;
width: 240px;
padding: 8px;
color: #333;
background: #fff;
border: 1px solid #ccc;
border-bottom-color: #bbb;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.pika-single.is-hidden {
display: none;
}
.pika-single.is-bound {
position: absolute;
box-shadow: 0 5px 15px -5px rgba(0,0,0,.5);
}
.pika-title {
position: relative;
text-align: center;
}
.pika-label {
display: inline-block;
*display: inline;
position: relative;
z-index: 9999;
overflow: hidden;
margin: 0;
padding: 5px 3px;
font-size: 14px;
line-height: 20px;
font-weight: bold;
background-color: #fff;
}
.pika-title select {
cursor: pointer;
position: absolute;
z-index: 9998;
margin: 0;
left: 0;
top: 5px;
filter: alpha(opacity=0);
opacity: 0;
}
.pika-prev,
.pika-next {
display: block;
cursor: pointer;
position: relative;
outline: none;
border: 0;
padding: 0;
width: 20px;
height: 30px;
/* hide text using text-indent trick, using width value (it's enough) */
text-indent: 20px;
white-space: nowrap;
overflow: hidden;
background-color: transparent;
background-position: center center;
background-repeat: no-repeat;
background-size: 75% 75%;
opacity: .5;
*position: absolute;
*top: 0;
}
.pika-prev:hover,
.pika-next:hover {
opacity: 1;
}
.pika-prev,
.is-rtl .pika-next {
float: left;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg==');
*left: 0;
}
.pika-next,
.is-rtl .pika-prev {
float: right;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII=');
*right: 0;
}
.pika-prev.is-disabled,
.pika-next.is-disabled {
cursor: default;
opacity: .2;
}
.pika-select {
display: inline-block;
*display: inline;
}
.pika-table {
width: 100%;
border-collapse: collapse;
border-spacing: 0;
border: 0;
}
.pika-table th,
.pika-table td {
width: 14.285714285714286%;
padding: 0;
}
.pika-table th {
color: #999;
font-size: 12px;
line-height: 25px;
font-weight: bold;
text-align: center;
}
.pika-button {
cursor: pointer;
display: block;
outline: none;
border: 0;
margin: 0;
width: 100%;
padding: 5px;
color: #666;
font-size: 12px;
line-height: 15px;
text-align: right;
background: #f5f5f5;
}
.is-today .pika-button {
color: #33aaff;
font-weight: bold;
}
.is-selected .pika-button {
color: #fff;
font-weight: bold;
background: #33aaff;
box-shadow: inset 0 1px 3px #178fe5;
border-radius: 3px;
}
.is-disabled .pika-button {
pointer-events: none;
cursor: default;
color: #999;
opacity: .3;
}
.pika-button:hover {
color: #fff !important;
background: #ff8000 !important;
box-shadow: none !important;
border-radius: 3px !important;
}

View File

@ -77,5 +77,8 @@
"moment": "~2.6.0",
"jquery": "~2.1.1"
},
"private": true
"private": true,
"devDependencies": {
"pikaday": "~1.2.0"
}
}

View File

@ -55,7 +55,8 @@ paths = {
"app/vendor/i18next/i18next.js",
"app/js/Sortable.js",
"app/vendor/moment/min/moment-with-langs.js",
"app/vendor/checksley/checksley.js"
"app/vendor/checksley/checksley.js",
"app/vendor/pikaday/pikaday.js"
]
}