parent
3d687576eb
commit
cde5b7040e
|
@ -38,6 +38,8 @@ class ConfigService extends taiga.Service
|
||||||
|
|
||||||
termsOfServiceUrl: null
|
termsOfServiceUrl: null
|
||||||
privacyPolicyUrl: null
|
privacyPolicyUrl: null
|
||||||
|
|
||||||
|
feedbackEnabled: true
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize: (localconfig) ->
|
initialize: (localconfig) ->
|
||||||
|
|
|
@ -1,3 +1,24 @@
|
||||||
|
###
|
||||||
|
# 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
|
taiga = @.taiga
|
||||||
|
|
||||||
groupBy = @.taiga.groupBy
|
groupBy = @.taiga.groupBy
|
||||||
|
@ -8,28 +29,22 @@ trim = @.taiga.trim
|
||||||
|
|
||||||
module = angular.module("taigaFeedback", [])
|
module = angular.module("taigaFeedback", [])
|
||||||
|
|
||||||
FeedbackDirective = ($lightboxService, $navurls, $location, $route)->
|
FeedbackDirective = ($lightboxService, $repo, $confirm)->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
project = null
|
|
||||||
|
|
||||||
submit = debounce 2000, ->
|
submit = debounce 2000, ->
|
||||||
if not form.validate()
|
if not form.validate()
|
||||||
return
|
return
|
||||||
|
|
||||||
$scope.$on "feedback:show", (ctx, newProject)->
|
promise = $repo.create("feedback", $scope.feedback)
|
||||||
project = newProject
|
|
||||||
|
|
||||||
$scope.$apply ->
|
promise.then (data) ->
|
||||||
$scope.issueTypes = _.sortBy(project.issue_types, "order")
|
$lightboxService.close($el)
|
||||||
|
$confirm.notify("success", "\\o/ we'll be happy to read your")
|
||||||
|
|
||||||
$scope.feedback = {
|
promise.then null, ->
|
||||||
project: project.id
|
$confirm.notify("error")
|
||||||
type: project.default_issue_type
|
|
||||||
}
|
|
||||||
|
|
||||||
$lightboxService.open($el)
|
|
||||||
$el.find("textarea").focus()
|
|
||||||
|
|
||||||
$el.on "submit", (event) ->
|
$el.on "submit", (event) ->
|
||||||
submit()
|
submit()
|
||||||
|
@ -38,6 +53,16 @@ FeedbackDirective = ($lightboxService, $navurls, $location, $route)->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
submit()
|
submit()
|
||||||
|
|
||||||
|
$scope.$on "feedback:show", ->
|
||||||
|
$scope.$apply ->
|
||||||
|
$scope.feedback = {}
|
||||||
|
|
||||||
|
$lightboxService.open($el)
|
||||||
|
$el.find("textarea").focus()
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgFeedback", ["lightboxService", "$tgNavUrls", "$tgLocation", "$route", FeedbackDirective])
|
module.directive("tgLbFeedback", ["lightboxService", "$tgRepo", "$tgConfirm", FeedbackDirective])
|
||||||
|
|
|
@ -200,7 +200,7 @@ module.directive("tgProjectsNav", ["$rootScope", "animationFrame", "$timeout", "
|
||||||
## Project
|
## Project
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $navUrls) ->
|
ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $navUrls, $config) ->
|
||||||
menuEntriesTemplate = _.template("""
|
menuEntriesTemplate = _.template("""
|
||||||
<div class="menu-container">
|
<div class="menu-container">
|
||||||
<ul class="main-nav">
|
<ul class="main-nav">
|
||||||
|
@ -262,7 +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="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="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="" 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="" class="feedback" title="Feedback"">Feedback</a></li>
|
||||||
|
<% } %>
|
||||||
<li><a href="" title="Logout" class="logout">Logout</a></li>
|
<li><a href="" title="Logout" class="logout">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<a href="" title="User preferences" class="avatar" id="nav-user-settings">
|
<a href="" title="User preferences" class="avatar" id="nav-user-settings">
|
||||||
|
@ -326,7 +328,14 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
|
||||||
renderMenuEntries = ($el, targetScope, project={}) ->
|
renderMenuEntries = ($el, targetScope, project={}) ->
|
||||||
container = $el.find(".menu-container")
|
container = $el.find(".menu-container")
|
||||||
sectionName = targetScope.section
|
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("a.active").removeClass("active")
|
||||||
dom.find("#nav-#{sectionName} > a").addClass("active")
|
dom.find("#nav-#{sectionName} > a").addClass("active")
|
||||||
|
|
||||||
|
@ -374,7 +383,7 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
|
||||||
|
|
||||||
$el.on "click", ".feedback", (event) ->
|
$el.on "click", ".feedback", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
$rootscope.$broadcast("feedback:show", project)
|
$rootscope.$broadcast("feedback:show")
|
||||||
|
|
||||||
$scope.$on "projects:loaded", (listener) ->
|
$scope.$on "projects:loaded", (listener) ->
|
||||||
$el.addClass("hidden")
|
$el.addClass("hidden")
|
||||||
|
@ -391,4 +400,4 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
|
||||||
return {link: link}
|
return {link: link}
|
||||||
|
|
||||||
module.directive("tgProjectMenu", ["$log", "$compile", "$tgAuth", "$rootScope", "$tgAuth", "$tgLocation",
|
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/issue": "/api/v1/issues/attachments"
|
||||||
"attachments/task": "/api/v1/tasks/attachments"
|
"attachments/task": "/api/v1/tasks/attachments"
|
||||||
"attachments/wiki_page": "/api/v1/wiki/attachments"
|
"attachments/wiki_page": "/api/v1/wiki/attachments"
|
||||||
|
|
||||||
|
# Feedback
|
||||||
|
"feedback": "/api/v1/feedback"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize api urls service
|
# Initialize api urls service
|
||||||
|
|
|
@ -12,6 +12,8 @@ config = {
|
||||||
publicRegisterEnabled: true
|
publicRegisterEnabled: true
|
||||||
privacyPolicyUrl: null
|
privacyPolicyUrl: null
|
||||||
termsOfServiceUrl: null
|
termsOfServiceUrl: null
|
||||||
|
|
||||||
|
feedbackEnabled: true
|
||||||
}
|
}
|
||||||
|
|
||||||
angular.module("taigaLocalConfig", []).value("localconfig", config)
|
angular.module("taigaLocalConfig", []).value("localconfig", config)
|
||||||
|
|
Loading…
Reference in New Issue