commit
5b8f0663b9
|
@ -220,6 +220,7 @@ modules = [
|
|||
"taigaNavMenu",
|
||||
"taigaProject",
|
||||
"taigaUserSettings",
|
||||
"taigaFeedback",
|
||||
"taigaPlugins",
|
||||
|
||||
# Vendor modules
|
||||
|
|
|
@ -38,6 +38,8 @@ class ConfigService extends taiga.Service
|
|||
|
||||
termsOfServiceUrl: null
|
||||
privacyPolicyUrl: null
|
||||
|
||||
feedbackEnabled: true
|
||||
}
|
||||
|
||||
initialize: (localconfig) ->
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
###
|
||||
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
|
||||
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
|
||||
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# File: modules/feedback.coffee
|
||||
###
|
||||
|
||||
taiga = @.taiga
|
||||
|
||||
groupBy = @.taiga.groupBy
|
||||
bindOnce = @.taiga.bindOnce
|
||||
mixOf = @.taiga.mixOf
|
||||
debounce = @.taiga.debounce
|
||||
trim = @.taiga.trim
|
||||
|
||||
module = angular.module("taigaFeedback", [])
|
||||
|
||||
FeedbackDirective = ($lightboxService, $repo, $confirm)->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
form = $el.find("form").checksley()
|
||||
|
||||
submit = debounce 2000, ->
|
||||
if not form.validate()
|
||||
return
|
||||
|
||||
promise = $repo.create("feedback", $scope.feedback)
|
||||
|
||||
promise.then (data) ->
|
||||
$lightboxService.close($el)
|
||||
$confirm.notify("success", "\\o/ we'll be happy to read your")
|
||||
|
||||
promise.then null, ->
|
||||
$confirm.notify("error")
|
||||
|
||||
$el.on "submit", (event) ->
|
||||
submit()
|
||||
|
||||
$el.on "click", ".button-green", (event) ->
|
||||
event.preventDefault()
|
||||
submit()
|
||||
|
||||
$scope.$on "feedback:show", ->
|
||||
$scope.$apply ->
|
||||
$scope.feedback = {}
|
||||
|
||||
$lightboxService.open($el)
|
||||
$el.find("textarea").focus()
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
$el.off()
|
||||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgLbFeedback", ["lightboxService", "$tgRepo", "$tgConfirm", FeedbackDirective])
|
|
@ -200,7 +200,7 @@ module.directive("tgProjectsNav", ["$rootScope", "animationFrame", "$timeout", "
|
|||
## Project
|
||||
#############################################################################
|
||||
|
||||
ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $navUrls) ->
|
||||
ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $navUrls, $config) ->
|
||||
menuEntriesTemplate = _.template("""
|
||||
<div class="menu-container">
|
||||
<ul class="main-nav">
|
||||
|
@ -262,6 +262,9 @@ 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>
|
||||
<% if (feedbackEnabled) { %>
|
||||
<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">
|
||||
|
@ -325,7 +328,14 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
|
|||
renderMenuEntries = ($el, targetScope, project={}) ->
|
||||
container = $el.find(".menu-container")
|
||||
sectionName = targetScope.section
|
||||
dom = $compile(menuEntriesTemplate({user: $auth.getUser(), project: project}))(targetScope)
|
||||
|
||||
ctx = {
|
||||
user: $auth.getUser(),
|
||||
project: project,
|
||||
feedbackEnabled: $config.get("feedbackEnabled")
|
||||
}
|
||||
dom = $compile(menuEntriesTemplate(ctx))(targetScope)
|
||||
|
||||
dom.find("a.active").removeClass("active")
|
||||
dom.find("#nav-#{sectionName} > a").addClass("active")
|
||||
|
||||
|
@ -371,6 +381,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")
|
||||
|
||||
$scope.$on "projects:loaded", (listener) ->
|
||||
$el.addClass("hidden")
|
||||
listener.stopPropagation()
|
||||
|
@ -386,4 +400,4 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
|
|||
return {link: link}
|
||||
|
||||
module.directive("tgProjectMenu", ["$log", "$compile", "$tgAuth", "$rootScope", "$tgAuth", "$tgLocation",
|
||||
"$tgNavUrls", ProjectMenuDirective])
|
||||
"$tgNavUrls", "$tgConfig", ProjectMenuDirective])
|
||||
|
|
|
@ -94,6 +94,9 @@ urls = {
|
|||
"attachments/issue": "/api/v1/issues/attachments"
|
||||
"attachments/task": "/api/v1/tasks/attachments"
|
||||
"attachments/wiki_page": "/api/v1/wiki/attachments"
|
||||
|
||||
# Feedback
|
||||
"feedback": "/api/v1/feedback"
|
||||
}
|
||||
|
||||
# Initialize api urls service
|
||||
|
|
|
@ -12,6 +12,8 @@ config = {
|
|||
publicRegisterEnabled: true
|
||||
privacyPolicyUrl: null
|
||||
termsOfServiceUrl: null
|
||||
|
||||
feedbackEnabled: true
|
||||
}
|
||||
|
||||
angular.module("taigaLocalConfig", []).value("localconfig", config)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue