US #954: Tasks #1116 #1117: Create the Feedback form

stable
Juanfran 2014-10-01 15:56:55 +02:00 committed by David Barragán Merino
parent 7423b09137
commit 3d687576eb
5 changed files with 62 additions and 0 deletions

View File

@ -220,6 +220,7 @@ modules = [
"taigaNavMenu",
"taigaProject",
"taigaUserSettings",
"taigaFeedback",
"taigaPlugins",
# Vendor modules

View File

@ -0,0 +1,43 @@
taiga = @.taiga
groupBy = @.taiga.groupBy
bindOnce = @.taiga.bindOnce
mixOf = @.taiga.mixOf
debounce = @.taiga.debounce
trim = @.taiga.trim
module = angular.module("taigaFeedback", [])
FeedbackDirective = ($lightboxService, $navurls, $location, $route)->
link = ($scope, $el, $attrs) ->
form = $el.find("form").checksley()
project = null
submit = debounce 2000, ->
if not form.validate()
return
$scope.$on "feedback:show", (ctx, newProject)->
project = newProject
$scope.$apply ->
$scope.issueTypes = _.sortBy(project.issue_types, "order")
$scope.feedback = {
project: project.id
type: project.default_issue_type
}
$lightboxService.open($el)
$el.find("textarea").focus()
$el.on "submit", (event) ->
submit()
$el.on "click", ".button-green", (event) ->
event.preventDefault()
submit()
return {link:link}
module.directive("tgFeedback", ["lightboxService", "$tgNavUrls", "$tgLocation", "$route", FeedbackDirective])

View File

@ -262,6 +262,7 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
<li><a href="" title="User Profile", tg-nav="user-settings-user-profile:project=project.slug">User Profile</a></li>
<li><a href="" title="Change Password", tg-nav="user-settings-user-change-password:project=project.slug">Change Password</a></li>
<li><a href="" title="Notifications", tg-nav="user-settings-mail-notifications:project=project.slug">Notifications</a></li>
<li><a href="" class="feedback" title="Feedback"">Feedback</a></li>
<li><a href="" title="Logout" class="logout">Logout</a></li>
</ul>
<a href="" title="User preferences" class="avatar" id="nav-user-settings">
@ -371,6 +372,10 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
event.preventDefault()
$rootscope.$broadcast("search-box:show", project)
$el.on "click", ".feedback", (event) ->
event.preventDefault()
$rootscope.$broadcast("feedback:show", project)
$scope.$on "projects:loaded", (listener) ->
$el.addClass("hidden")
listener.stopPropagation()

View File

@ -31,6 +31,8 @@ html(lang="en", ng-app="taiga")
include partials/views/modules/lightbox-generic-error
div.lightbox.lightbox-search(tg-search-box)
include partials/views/modules/lightbox-search
div.lightbox.lightbox-feedback.lightbox-generic-form(tg-lb-feedback)
include partials/views/modules/lightbox-feedback
include partials/views/modules/loader

View File

@ -0,0 +1,11 @@
a.close(href="", title="close")
span.icon.icon-delete
form
h2.title Tell us something...
fieldset
textarea(ng-model="feedback.comment", data-required="true",
placeholder="...a bug, some suggestions, something cool... or even your worst nightmare with Taiga")
fieldset
input.hidden(type="submit")
a.button.button-green(href="", title="Send feedback")
span Send feedback