angular1.3

stable
Juanfran 2014-11-26 11:56:26 +01:00
parent 63d6f4c829
commit 098b794d83
14 changed files with 57 additions and 29 deletions

View File

@ -134,7 +134,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
{templateUrl: "/partials/permission-denied.html"}) {templateUrl: "/partials/permission-denied.html"})
$routeProvider.otherwise({redirectTo: '/not-found'}) $routeProvider.otherwise({redirectTo: '/not-found'})
$locationProvider.html5Mode(true) $locationProvider.html5Mode({enabled: true, requireBase: false})
defaultHeaders = { defaultHeaders = {
"Content-Type": "application/json" "Content-Type": "application/json"
@ -154,20 +154,24 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
# Add next param when user try to access to a secction need auth permissions. # Add next param when user try to access to a secction need auth permissions.
authHttpIntercept = ($q, $location, $confirm, $navUrls, $lightboxService) -> authHttpIntercept = ($q, $location, $confirm, $navUrls, $lightboxService) ->
return (promise) -> httpResponseError = (response) ->
return promise.then null, (response) -> if response.status == 0
if response.status == 0 $lightboxService.closeAll()
$lightboxService.closeAll() $location.path($navUrls.resolve("error"))
$location.path($navUrls.resolve("error")) $location.replace()
$location.replace() else if response.status == 401
else if response.status == 401 nextPath = $location.path()
nextPath = $location.path() $location.url($navUrls.resolve("login")).search("next=#{nextPath}")
$location.url($navUrls.resolve("login")).search("next=#{nextPath}") return $q.reject(response)
return $q.reject(response)
return {
responseError: httpResponseError
}
$provide.factory("authHttpIntercept", ["$q", "$location", "$tgConfirm", "$tgNavUrls", $provide.factory("authHttpIntercept", ["$q", "$location", "$tgConfirm", "$tgNavUrls",
"lightboxService", authHttpIntercept]) "lightboxService", authHttpIntercept])
$httpProvider.responseInterceptors.push('authHttpIntercept')
$httpProvider.interceptors.push('authHttpIntercept');
window.checksley.updateValidators({ window.checksley.updateValidators({
linewidth: (val, width) -> linewidth: (val, width) ->

View File

@ -22,6 +22,7 @@
taiga = @.taiga taiga = @.taiga
mixOf = @.taiga.mixOf mixOf = @.taiga.mixOf
bindMethods = @.taiga.bindMethods
module = angular.module("taigaAdmin") module = angular.module("taigaAdmin")
@ -47,7 +48,7 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q,
@location, @navUrls, @analytics, @appTitle) -> @location, @navUrls, @analytics, @appTitle) ->
_.bindAll(@) bindMethods(@)
@scope.sectionName = "Manage Members" #i18n @scope.sectionName = "Manage Members" #i18n
@scope.project = {} @scope.project = {}

View File

@ -24,6 +24,7 @@ taiga = @.taiga
mixOf = @.taiga.mixOf mixOf = @.taiga.mixOf
bindOnce = @.taiga.bindOnce bindOnce = @.taiga.bindOnce
debounce = @.taiga.debounce debounce = @.taiga.debounce
bindMethods = @.taiga.bindMethods
module = angular.module("taigaAdmin") module = angular.module("taigaAdmin")
@ -47,7 +48,7 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
] ]
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @appTitle) -> constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @appTitle) ->
_.bindAll(@) bindMethods(@)
@scope.sectionName = "Permissions" #i18n @scope.sectionName = "Permissions" #i18n
@scope.project = {} @scope.project = {}

View File

@ -22,6 +22,7 @@
taiga = @.taiga taiga = @.taiga
mixOf = @.taiga.mixOf mixOf = @.taiga.mixOf
bindMethods = @.taiga.bindMethods
module = angular.module("taigaAdmin") module = angular.module("taigaAdmin")
@ -40,7 +41,7 @@ class GithubController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
] ]
constructor: (@scope, @repo, @rs, @params, @appTitle) -> constructor: (@scope, @repo, @rs, @params, @appTitle) ->
_.bindAll(@) bindMethods(@)
@scope.sectionName = "Github" #i18n @scope.sectionName = "Github" #i18n
@scope.project = {} @scope.project = {}

View File

@ -27,6 +27,7 @@ scopeDefer = @.taiga.scopeDefer
bindOnce = @.taiga.bindOnce bindOnce = @.taiga.bindOnce
groupBy = @.taiga.groupBy groupBy = @.taiga.groupBy
timeout = @.taiga.timeout timeout = @.taiga.timeout
bindMethods = @.taiga.bindMethods
module = angular.module("taigaBacklog") module = angular.module("taigaBacklog")
@ -53,7 +54,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q,
@location, @appTitle, @navUrls, @events, @analytics, tgLoader) -> @location, @appTitle, @navUrls, @events, @analytics, tgLoader) ->
_.bindAll(@) bindMethods(@)
@scope.sectionName = "Backlog" @scope.sectionName = "Backlog"
@showTags = false @showTags = false
@ -444,6 +445,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
return obj return obj
plainStatuses = _.map(@scope.userstories, "status") plainStatuses = _.map(@scope.userstories, "status")
plainStatuses = _.filter plainStatuses, (status) => plainStatuses = _.filter plainStatuses, (status) =>
if status if status
return status return status

View File

@ -143,6 +143,7 @@ class RepositoryService extends taiga.Service
queryMany: (name, params, options={}) -> queryMany: (name, params, options={}) ->
url = @urls.resolve(name) url = @urls.resolve(name)
httpOptions = {headers: {}} httpOptions = {headers: {}}
if not options.enablePagination if not options.enablePagination
httpOptions.headers["x-disable-pagination"] = "1" httpOptions.headers["x-disable-pagination"] = "1"

View File

@ -22,6 +22,7 @@
taiga = @.taiga taiga = @.taiga
sizeFormat = @.taiga.sizeFormat sizeFormat = @.taiga.sizeFormat
bindOnce = @.taiga.bindOnce bindOnce = @.taiga.bindOnce
bindMethods = @.taiga.bindMethods
module = angular.module("taigaCommon") module = angular.module("taigaCommon")
@ -30,7 +31,7 @@ class AttachmentsController extends taiga.Controller
@.$inject = ["$scope", "$rootScope", "$tgRepo", "$tgResources", "$tgConfirm", "$q"] @.$inject = ["$scope", "$rootScope", "$tgRepo", "$tgResources", "$tgConfirm", "$q"]
constructor: (@scope, @rootscope, @repo, @rs, @confirm, @q) -> constructor: (@scope, @rootscope, @repo, @rs, @confirm, @q) ->
_.bindAll(@) bindMethods(@)
@.type = null @.type = null
@.objectId = null @.objectId = null
@.projectId = null @.projectId = null

View File

@ -23,7 +23,7 @@ taiga = @.taiga
timeout = @.taiga.timeout timeout = @.taiga.timeout
cancelTimeout = @.taiga.cancelTimeout cancelTimeout = @.taiga.cancelTimeout
debounce = @.taiga.debounce debounce = @.taiga.debounce
bindMethods = @.taiga.bindMethods
NOTIFICATION_MSG = { NOTIFICATION_MSG = {
"success": "success":
@ -42,7 +42,7 @@ class ConfirmService extends taiga.Service
@.$inject = ["$q", "lightboxService", "$tgLoading"] @.$inject = ["$q", "lightboxService", "$tgLoading"]
constructor: (@q, @lightboxService, @loading) -> constructor: (@q, @lightboxService, @loading) ->
_.bindAll(@) bindMethods(@)
hide: (el)-> hide: (el)->
if el if el

View File

@ -21,13 +21,14 @@
taiga = @.taiga taiga = @.taiga
startswith = @.taiga.startswith startswith = @.taiga.startswith
bindMethods = @.taiga.bindMethods
module = angular.module("taigaEvents", []) module = angular.module("taigaEvents", [])
class EventsService class EventsService
constructor: (@win, @log, @config, @auth) -> constructor: (@win, @log, @config, @auth) ->
_.bindAll(@) bindMethods(@)
initialize: (sessionId) -> initialize: (sessionId) ->
@.sessionId = sessionId @.sessionId = sessionId

View File

@ -27,6 +27,7 @@ scopeDefer = @.taiga.scopeDefer
bindOnce = @.taiga.bindOnce bindOnce = @.taiga.bindOnce
groupBy = @.taiga.groupBy groupBy = @.taiga.groupBy
timeout = @.taiga.timeout timeout = @.taiga.timeout
bindMethods = @.taiga.bindMethods
module = angular.module("taigaKanban") module = angular.module("taigaKanban")
@ -66,7 +67,9 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
@appTitle, @navUrls, @events, @analytics, tgLoader) -> @appTitle, @navUrls, @events, @analytics, tgLoader) ->
_.bindAll(@)
bindMethods(@)
@scope.sectionName = "Kanban" @scope.sectionName = "Kanban"
@scope.statusViewModes = {} @scope.statusViewModes = {}
@.initializeEventHandlers() @.initializeEventHandlers()

View File

@ -26,6 +26,7 @@ groupBy = @.taiga.groupBy
bindOnce = @.taiga.bindOnce bindOnce = @.taiga.bindOnce
scopeDefer = @.taiga.scopeDefer scopeDefer = @.taiga.scopeDefer
timeout = @.taiga.timeout timeout = @.taiga.timeout
bindMethods = @.taiga.bindMethods
module = angular.module("taigaTaskboard") module = angular.module("taigaTaskboard")
@ -53,7 +54,7 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @appTitle, @location, @navUrls, constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @appTitle, @location, @navUrls,
@events, @analytics, tgLoader) -> @events, @analytics, tgLoader) ->
_.bindAll(@) bindMethods(@)
@scope.sectionName = "Taskboard" @scope.sectionName = "Taskboard"
@.initializeEventHandlers() @.initializeEventHandlers()

View File

@ -23,6 +23,16 @@ nl2br = (str) =>
breakTag = '<br />' breakTag = '<br />'
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2') return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2')
bindMethods = (object) =>
dependencies = _.keys(object)
methods = []
_.forIn object, (value, key) =>
if key not in dependencies
methods.push(key)
_.bindAll(object, methods)
bindOnce = (scope, attr, continuation) => bindOnce = (scope, attr, continuation) =>
val = scope.$eval(attr) val = scope.$eval(attr)
@ -133,6 +143,7 @@ sizeFormat = (input, precision=1) ->
taiga = @.taiga taiga = @.taiga
taiga.nl2br = nl2br taiga.nl2br = nl2br
taiga.bindMethods = bindMethods
taiga.bindOnce = bindOnce taiga.bindOnce = bindOnce
taiga.mixOf = mixOf taiga.mixOf = mixOf
taiga.trim = trim taiga.trim = trim

View File

@ -16,7 +16,7 @@ block content
span.us-number(tg-bo-ref="issue.ref") span.us-number(tg-bo-ref="issue.ref")
span.us-name(tg-editable-subject, ng-model="issue", required-perm="modify_issue") span.us-name(tg-editable-subject, ng-model="issue", required-perm="modify_issue")
p.us-related-task(ng-if="issue.generated_user_stories") This issue has been promoted to US: p.us-related-task(ng-if="issue.generated_user_stories.length") This issue has been promoted to US:
a(ng-repeat="us in issue.generated_user_stories", a(ng-repeat="us in issue.generated_user_stories",
tg-check-permission="view_us", href="", tg-check-permission="view_us", href="",
tg-bo-title="'#' + us.ref + ' ' + us.subject", tg-bo-title="'#' + us.ref + ' ' + us.subject",

View File

@ -50,11 +50,11 @@
"lodash": "~2.4.1", "lodash": "~2.4.1",
"emoticons": "~0.1.7", "emoticons": "~0.1.7",
"jquery-flot": "~0.8.2", "jquery-flot": "~0.8.2",
"angular": "1.2.21", "angular": "1.3.4",
"angular-route": "1.2.21", "angular-route": "1.3.4",
"angular-animate": "1.2.21", "angular-animate": "1.3.4",
"angular-sanitize": "1.2.21", "angular-sanitize": "1.3.4",
"angular-mocks": "1.2.21", "angular-mocks": "1.3.4",
"kalendae": "~0.4.1", "kalendae": "~0.4.1",
"checksley": "~0.6.0", "checksley": "~0.6.0",
"i18next": "~1.7.1", "i18next": "~1.7.1",
@ -78,7 +78,8 @@
"resolutions": { "resolutions": {
"lodash": "~2.4.1", "lodash": "~2.4.1",
"moment": "~2.6.0", "moment": "~2.6.0",
"jquery": "~2.1.1" "jquery": "~2.1.1",
"angular": "1.3.4"
}, },
"private": true "private": true
} }