Fix some forms of the admin panel

stable
David Barragán Merino 2014-08-07 16:35:05 +02:00
parent b125aec5d7
commit c8e7fc3891
11 changed files with 155 additions and 77 deletions

View File

@ -119,8 +119,7 @@ ProjectFeaturesDirective = ($log, $repo, $confirm) ->
$scope.$emit("project:loaded", $scope.project)
promise.then null, (data) ->
console.log "FAIL"
# TODO
$confirm.notify("error", data._error_message)
$el.on "submit", "form", (event) ->
event.preventDefault()

View File

@ -142,8 +142,7 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location) ->
$confirm.notify("success")
promise.then null, (data) ->
console.log "FAIL"
# TODO
$confirm.notify("error", data._error_message)
$el.on "submit", "form", (event) ->
event.preventDefault()
@ -171,6 +170,7 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location) ->
initializeNewValue()
promise.then null, (data) ->
$confirm.notify("error")
form.setErrors(data)
$el.on "click", ".delete-new", (event) ->
@ -200,6 +200,7 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location) ->
row.siblings(".visualization").css("display": "flex")
promise.then null, (data) ->
$confirm.notify("error")
form.setErrors(data)
$el.on "click", ".cancel", (event) ->
@ -218,8 +219,11 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location) ->
title = "Delete"
subtitle = value.name
$confirm.ask(title, subtitle).then =>
$repo.remove(value).then =>
onSucces = ->
$ctrl.loadValues()
onError = ->
$confirm.notify("error")
$repo.remove(value).then(onSucces, onError)
link = ($scope, $el, $attrs) ->
linkDragAndDrop($scope, $el, $attrs)

View File

@ -115,7 +115,7 @@ RolesDirective = ->
module.directive("tgRoles", RolesDirective)
NewRoleDirective = ($tgrepo) ->
NewRoleDirective = ($tgrepo, $confirm) ->
DEFAULT_PERMISSIONS = ["view_project", "view_milestones", "view_us", "view_tasks", "view_issues"]
link = ($scope, $el, $attrs) ->
@ -145,10 +145,15 @@ NewRoleDirective = ($tgrepo) ->
$el.find(".new").addClass("hidden")
$el.find(".new").val('')
$tgrepo.create("roles", newRole).then (role) ->
onSuccess = (role) ->
$scope.roles.push(role)
$ctrl.setRole(role)
$el.find(".add-button").show()
$el.find(".add-button").show()
onError = ->
$confirm.notify("error")
$tgrepo.create("roles", newRole).then(onSuccess, onError)
else if event.keyCode == 27 # ESC key
target = angular.element(event.currentTarget)
@ -158,44 +163,44 @@ NewRoleDirective = ($tgrepo) ->
return {link:link}
module.directive("tgNewRole", ["$tgRepo", NewRoleDirective])
module.directive("tgNewRole", ["$tgRepo", "$tgConfirm", NewRoleDirective])
# Use category-config.scss styles
RolePermissionsDirective = ($repo, $confirm) ->
resumeTemplate = _.template("""
<div class="resume-title"><%- category.name %></div>
<div class="count"><%- category.activePermissions %>/<%- category.permissions.length %></div>
<div class="summary-role">
<% _.each(category.permissions, function(permission) { %>
<div class="role-summary-single <% if(permission.active) { %>active<% } %>" title="<%- permission.description %>"></div>
<% }) %>
</div>
<div class="icon icon-arrow-bottom"></div>
<div class="resume-title"><%- category.name %></div>
<div class="count"><%- category.activePermissions %>/<%- category.permissions.length %></div>
<div class="summary-role">
<% _.each(category.permissions, function(permission) { %>
<div class="role-summary-single <% if(permission.active) { %>active<% } %>"
title="<%- permission.description %>"></div>
<% }) %>
</div>
<div class="icon icon-arrow-bottom"></div>
""")
categoryTemplate = _.template("""
<div class="category-config" data-id="<%- index %>">
<div class="resume">
</div>
<div class="category-items">
<div class="items-container">
<% _.each(category.permissions, function(permission) { %>
<div class="category-config" data-id="<%- index %>">
<div class="resume">
</div>
<div class="category-items">
<div class="items-container">
<% _.each(category.permissions, function(permission) { %>
<div class="category-item" data-id="<%- permission.key %>"> <%- permission.description %>
<div class="check">
<input type="checkbox" <% if(permission.active) { %>checked="checked"<% } %>/>
<div></div>
</div>
<div class="check">
<input type="checkbox" <% if(permission.active) { %>checked="checked"<% } %>/>
<div></div>
</div>
</div>
<% }) %>
</div>
<% }) %>
</div>
</div>
</div>
</div>
""")
baseTemplate = _.template("""
<div class="category-config-list">
</div>
<div class="category-config-list"></div>
""")
link = ($scope, $el, $attrs) ->

View File

@ -24,8 +24,10 @@ block content
span Backlog
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sagittis quam augue, quis bibendum lectus porta eget. Nunc dictum imperdiet venenatis. Curabitur vitae augue ut est rhoncus pellentesque. Nunc sed ultricies est, tincidunt euismod nunc. Nunc nec posuere metus.
div.activate
input.activate-input(type="checkbox", id="functionality-backlog", ng-model="project.is_backlog_activated")
label.button.button-gray(ng-switch="project.is_backlog_activated", for="functionality-backlog")
input.activate-input(type="checkbox", id="functionality-backlog",
ng-model="project.is_backlog_activated")
label.button.button-gray(ng-switch="project.is_backlog_activated",
for="functionality-backlog")
span(ng-switch-when="true") Disable
span(ng-switch-when="false") Enable
@ -35,11 +37,13 @@ block content
p
span Kanban
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sagittis quam augue, quis bibendum lectus porta eget. Nunc dictum imperdiet venenatis. Curabitur vitae augue ut est rhoncus pellentesque. Nunc sed ultricies est, tincidunt euismod nunc. Nunc nec posuere metus.
div.activate
input.activate-input(type="checkbox", id="functionality-kanban", ng-model="project.is_kanban_activated")
label.button.button-gray(ng-switch="project.is_kanban_activated", for="functionality-kanban")
span(ng-switch-when="true") Disable
span(ng-switch-when="false") Enable
div.activate
input.activate-input(type="checkbox", id="functionality-kanban",
ng-model="project.is_kanban_activated")
label.button.button-gray(ng-switch="project.is_kanban_activated",
for="functionality-kanban")
span(ng-switch-when="true") Disable
span(ng-switch-when="false") Enable
div.functionality(ng-class="{true:'active', false:''}[project.is_issues_activated]")
div.icon.icon-issues
@ -48,8 +52,10 @@ block content
span Issues
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sagittis quam augue, quis bibendum lectus porta eget. Nunc dictum imperdiet venenatis. Curabitur vitae augue ut est rhoncus pellentesque. Nunc sed ultricies est, tincidunt euismod nunc. Nunc nec posuere metus.
div.activate
input.activate-input(type="checkbox", id="functionality-issues", ng-model="project.is_issues_activated")
label.button.button-gray(ng-switch="project.is_issues_activated", for="functionality-issues")
input.activate-input(type="checkbox", id="functionality-issues",
ng-model="project.is_issues_activated")
label.button.button-gray(ng-switch="project.is_issues_activated",
for="functionality-issues")
span(ng-switch-when="true") Disable
span(ng-switch-when="false") Enable
@ -60,8 +66,10 @@ block content
span Wiki
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sagittis quam augue, quis bibendum lectus porta eget. Nunc dictum imperdiet venenatis. Curabitur vitae augue ut est rhoncus pellentesque. Nunc sed ultricies est, tincidunt euismod nunc. Nunc nec posuere metus.
div.activate
input.activate-input(type="checkbox", id="functionality-wiki", ng-model="project.is_wiki_activated")
label.button.button-gray(ng-switch="project.is_wiki_activated", for="functionality-wiki")
input.activate-input(type="checkbox", id="functionality-wiki",
ng-model="project.is_wiki_activated")
label.button.button-gray(ng-switch="project.is_wiki_activated",
for="functionality-wiki")
span(ng-switch-when="true") Disable
span(ng-switch-when="false") Enable
@ -72,13 +80,18 @@ block content
span Video
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sagittis quam augue, quis bibendum lectus porta eget. Nunc dictum imperdiet venenatis. Curabitur vitae augue ut est rhoncus pellentesque. Nunc sed ultricies est, tincidunt euismod nunc. Nunc nec posuere metus.
div.activate
input.activate-input(type="checkbox", id="functionality-video", ng-model="isVideoconferenceActivated")
label.button.button-gray(ng-switch="isVideoconferenceActivated", for="functionality-video")
input.activate-input(type="checkbox", id="functionality-video",
ng-model="isVideoconferenceActivated")
label.button.button-gray(ng-switch="isVideoconferenceActivated",
for="functionality-video")
span(ng-switch-when="true") Disable
span(ng-switch-when="false") Enable
div.videoconference-attributes.hidden
select(ng-model="project.videoconferences", ng-options="e.id as e.name for e in [{'id':'appear-in', 'name':'AppearIn'},{'id':'talky', 'name': 'Talky'}]")
input(type="text", ng-model="project.videoconferences_salt", placeholder="write a name for the chat room (ej. the name of the project)")
select(ng-model="project.videoconferences",
ng-options="e.id as e.name for e in [{'id':'appear-in', 'name':'AppearIn'},{'id':'talky', 'name': 'Talky'}]")
option(value="") Select a videoconference system
input(type="text", ng-model="project.videoconferences_salt",
placeholder="If you want you can append a salt code to the name of the chat room")
input(type="submit", class="hidden")
a.button.button-green(href="") Save

View File

@ -19,25 +19,28 @@ block content
form
fieldset
label(for="project-name") Project Name
input(type="text", placeholder="Project name", id="project-name" ng-model="project.name", data-required="true")
input(type="text", placeholder="Project name", id="project-name",
ng-model="project.name", data-required="true")
fieldset
label(for="project-slug") Project Slug
input(type="text", placeholder="Slug", id="project-slug", ng-model="project.slug", data-required="true")
input(type="text", placeholder="Slug", id="project-slug",
ng-model="project.slug", data-required="true")
fieldset
label(for="project-sprints") Number of sprints
input(type="text", placeholder="Number of sprints",
ng-model="project.total_milestones", id="project-sprints", data-type="digits")
input(type="number", placeholder="Number of sprints", id="project-sprints",
ng-model="project.total_milestones", data-type="digits")
fieldset
label(for="total-story-points") Number of US points
input(type="text", placeholder="Number of US points",
ng-model="project.total_story_points", id="total-story-points", data-type="digits", data-required="true")
input(type="number", placeholder="Number of US points", id="total-story-points",
ng-model="project.total_story_points", data-type="digits", data-required="true")
fieldset
label(for="project-description") Description
textarea(placeholder="Description", ng-model="project.description", id="project-description", data-required="true")
textarea(placeholder="Description", id="project-description",
ng-model="project.description", data-required="true")
input(type="submit", class="hidden")
a.button.button-green(href="") Save

View File

@ -2,31 +2,38 @@ section.default-values
form
fieldset
label(for="default-points") Default value for points selector
select(id="default-points", ng-model="project.default_points", ng-options="s.id as s.name for s in pointsList")
select(id="default-points", ng-model="project.default_points",
ng-options="s.id as s.name for s in pointsList")
fieldset
label(for="default-value-us") Default value for US status selector
select(id="default-value-us", ng-model="project.default_us_status", ng-options="s.id as s.name for s in usStatusList")
select(id="default-value-us", ng-model="project.default_us_status",
ng-options="s.id as s.name for s in usStatusList")
fieldset
label(for="default-value-task") Default value for task status selector
select(id="default-value-task", ng-model="project.default_task_status", ng-options="s.id as s.name for s in taskStatusList")
select(id="default-value-task", ng-model="project.default_task_status",
ng-options="s.id as s.name for s in taskStatusList")
fieldset
label(for="default-value-priority") Default value for priority selector
select(id="default-value-priority", ng-model="project.default_priority", ng-options="s.id as s.name for s in prioritiesList")
select(id="default-value-priority", ng-model="project.default_priority",
ng-options="s.id as s.name for s in prioritiesList")
fieldset
label(for="default-value-severity") Default value for severity selector
select(id="default-value-severity", ng-model="project.default_severity", ng-options="s.id as s.name for s in severitiesList")
select(id="default-value-severity", ng-model="project.default_severity",
ng-options="s.id as s.name for s in severitiesList")
fieldset
label(for="default-value-issue-type") Default value for issue type selector
select(id="default-value-issue-type", ng-model="project.default_issue_type", ng-options="s.id as s.name for s in issueTypesList")
select(id="default-value-issue-type", ng-model="project.default_issue_type",
ng-options="s.id as s.name for s in issueTypesList")
fieldset
label(for="default-value-issue-status") Default value for issue status selector
select(id="default-value-issue-status", ng-model="project.default_issue_status", ng-options="s.id as s.name for s in issueStatusList")
select(id="default-value-issue-status", ng-model="project.default_issue_status",
ng-options="s.id as s.name for s in issueStatusList")
fieldset
input(type="submit", class="hidden")

View File

@ -12,19 +12,26 @@ section.project-values-table
div(ng-repeat="value in values")
div.project-values-row.row.table-main.visualization
span.icon.icon-drag-v
div.project-values-name
span {{ value.name }}
span {{ value.name }}
div.project-values-value
span {{ value.value }}
div.project-values-settings
a.edit-value.icon.icon-edit(href="", title="Edit value")
a.delete-value.icon.icon-delete(href="", title="Delete value")
div.project-values-row.row.table-main.edition.hidden
div.project-values-name
input(name="name", type="text", placeholder="Name", ng-model="value.name")
input(name="name", type="text", placeholder="Name", ng-model="value.name",
data-required="true")
div.project-values-value
input(name="name", type="text", placeholder="Value", ng-model="value.value")
input(name="name", type="text", placeholder="Value", ng-model="value.value",
data-type="number")
div.project-values-settings
a.save.icon.icon-floppy(href="", title="Add")
a.cancel.icon.icon-delete(href="", title="Delete")
@ -32,9 +39,12 @@ section.project-values-table
form
div.project-values-row.new-value.hidden
div.project-values-name
input(name="name", type="text", placeholder="Name", ng-model="newValue.name")
input(name="name", type="text", placeholder="Name", ng-model="newValue.name",
data-required="true")
div.project-values-value
input("name=value", type="text", placeholder="Value", ng-model="newValue.value")
input("name=value", type="text", placeholder="Value", ng-model="newValue.value",
data-type="number")
div.project-values-settings
a.add-new.icon.icon-floppy(href="", title="Add")

View File

@ -13,10 +13,13 @@ section.colors-table
span.icon.icon-drag-v
div.color-column
div.current-color(style="background: {{ value.color }}")
div.status-name
span {{ value.name }}
div.is-closed-column
div.icon.icon-check-square(ng-show="value.is_closed")
div.options-column
a.edit-value.icon.icon-edit(href="", title="Edit value")
a.delete-value.icon.icon-delete(href="", title="Delete value")
@ -27,9 +30,13 @@ section.colors-table
include ../../components/select-color
div.status-name
input(name="name", type="text", placeholder="Write a name for the new status", ng-model="value.name", data-required="true", data-maxlength="255")
input(name="name", type="text", placeholder="Write a name for the new status",
ng-model="value.name", data-required="true", data-maxlength="255")
div.is-closed-column
select(name="is_closed", ng-model="value.is_closed", ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]", data-required="true")
select(name="is_closed", ng-model="value.is_closed", data-required="true",
ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]")
div.options-column
a.save.icon.icon-floppy(href="", title="Add")
a.cancel.icon.icon-delete(href="", title="Delete")
@ -41,9 +48,13 @@ section.colors-table
include ../../components/select-color
div.status-name
input(name="name", type="text", placeholder="Write a name for the new status", ng-model="newValue.name", data-required="true", data-maxlength="255")
input(name="name", type="text", placeholder="Write a name for the new status",
ng-model="newValue.name", data-required="true", data-maxlength="255")
div.is-closed-column
select(name="is_closed", ng-model="newValue.is_closed", ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]", data-required="true")
select(name="is_closed", ng-model="newValue.is_closed", data-required="true",
ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]")
div.options-column
a.add-new.icon.icon-floppy(href="", title="Add")
a.delete-new.icon.icon-delete(href="", title="Delete")

View File

@ -10,10 +10,13 @@ section.colors-table
div(ng-repeat="value in values")
div.row.table-main.visualization
span.icon.icon-drag-v
div.color-column
div.current-color(style="background: {{ value.color }}")
div.status-name
span {{ value.name }}
div.options-column
a.edit-value.icon.icon-edit(href="", title="Edit value")
a.delete-value.icon.icon-delete(href="", title="Delete value")
@ -24,7 +27,9 @@ section.colors-table
include ../../components/select-color
div.status-name
input(name="name", type="text", placeholder="Write a name for the new element", ng-model="value.name", data-required="true", data-maxlength="255")
input(name="name", type="text", placeholder="Write a name for the new element",
ng-model="value.name", data-required="true", data-maxlength="255")
div.options-column
a.save.icon.icon-floppy(href="", title="Add")
a.cancel.icon.icon-delete(href="", title="Delete")
@ -36,7 +41,9 @@ section.colors-table
include ../../components/select-color
div.status-name
input(name="name", type="text", placeholder="Write a name for the new element", ng-model="newValue.name", data-required="true", data-maxlength="255")
input(name="name", type="text", placeholder="Write a name for the new element",
ng-model="newValue.name", data-required="true", data-maxlength="255")
div.options-column
a.add-new.icon.icon-floppy(href="", title="Add")
a.delete-new.icon.icon-delete(href="", title="Delete")

View File

@ -12,14 +12,19 @@ section.colors-table
div(ng-repeat="value in values")
div.row.table-main.visualization
span.icon.icon-drag-v
div.color-column
div.current-color(style="background: {{ value.color }}")
div.status-name
span {{ value.name }}
div.is-closed-column
div.icon.icon-check-square(ng-show="value.is_closed")
div.status-wip-limit
span {{ value.wip_limit }}
div.options-column
a.edit-value.icon.icon-edit(href="", title="Edit value")
a.delete-value.icon.icon-delete(href="", title="Delete value")
@ -30,11 +35,16 @@ section.colors-table
include ../../components/select-color
div.status-name
input(name="name", type="text", placeholder="Write a name for the new status", ng-model="value.name", data-required="true", data-maxlength="255")
input(name="name", type="text", placeholder="Write a name for the new status",
ng-model="value.name", data-required="true", data-maxlength="255")
div.is-closed-column
select(name="is_closed", ng-model="value.is_closed", ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]", data-required="true")
select(name="is_closed", ng-model="value.is_closed", data-required="true",
ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]")
div.status-wip-limit
input(name="wip_limit", type="text", placeholder="WIP Limit", ng-model="value.wip_limit")
input(name="wip_limit", type="number", placeholder="WIP Limit",
ng-model="value.wip_limit", data-type="digits")
div.options-column
a.save.icon.icon-floppy(href="", title="Add")
a.cancel.icon.icon-delete(href="", title="Delete")
@ -46,9 +56,17 @@ section.colors-table
include ../../components/select-color
div.status-name
input(name="name", type="text", placeholder="Write a name for the new status", ng-model="newValue.name", data-required="true", data-maxlength="255")
input(name="name", type="text", placeholder="Write a name for the new status",
ng-model="newValue.name", data-required="true", data-maxlength="255")
div.is-closed-column
select(name="is_closed", ng-model="newValue.is_closed", ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]", data-required="true")
select(name="is_closed", ng-model="newValue.is_closed", data-required="true",
ng-options="e.id as e.name for e in [{'id':true, 'name':'Yes'},{'id':false, 'name': 'No'}]")
div.status-wip-limit
input(name="wip_limit", type="number", placeholder="WIP Limit",
ng-model="newValue.wip_limit", data-type="digits")
div.options-column
a.add-new.icon.icon-floppy(href="", title="Add")
a.delete-new.icon.icon-delete(href="", title="Delete")

View File

@ -7,6 +7,7 @@ fieldset {
}
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],