Minor (incomplete) changes on navurls service.
parent
eeb8e17584
commit
56dc4e54c7
|
@ -22,6 +22,7 @@
|
|||
|
||||
taiga = @.taiga
|
||||
trim = @.taiga.trim
|
||||
bindOnce = @.taiga.bindOnce
|
||||
|
||||
parseNav = (data, scope) ->
|
||||
options = {}
|
||||
|
@ -35,6 +36,7 @@ parseNav = (data, scope) ->
|
|||
|
||||
return [name, options]
|
||||
|
||||
|
||||
formatUrl = (url, ctx={}) ->
|
||||
replacer = (match) ->
|
||||
match = trim(match, ":")
|
||||
|
@ -53,10 +55,19 @@ class NavigationUrlsService extends taiga.Service
|
|||
return @.urls[name]
|
||||
|
||||
|
||||
NavigationUrlsDirective = ($navurls, $auth) ->
|
||||
NavigationUrlsDirective = ($navurls, $auth, $q) ->
|
||||
# Example:
|
||||
# link(tg-nav="project-backlog:project='sss',")
|
||||
|
||||
|
||||
# TODO: almost all menu entries requires project
|
||||
# model available in scope, but project is only
|
||||
# eventually available on child scopes
|
||||
# TODO: this need an other aproximation :(((
|
||||
|
||||
# bindOnceP = ($scope, attr) ->
|
||||
# defered = $q.defer()
|
||||
|
||||
link = ($scope, $el, $attrs) ->
|
||||
[name, options] = parseNav($attrs.tgNav, $scope)
|
||||
|
||||
|
@ -66,6 +77,8 @@ NavigationUrlsDirective = ($navurls, $auth) ->
|
|||
url = $navurls.resolve(name)
|
||||
fullUrl = formatUrl(url, options)
|
||||
|
||||
console.log url, $attrs.tgNav
|
||||
|
||||
$el.attr("href", fullUrl)
|
||||
|
||||
return {link: link}
|
||||
|
@ -73,6 +86,6 @@ NavigationUrlsDirective = ($navurls, $auth) ->
|
|||
|
||||
module = angular.module("taigaBase")
|
||||
module.service("$tgNavUrls", NavigationUrlsService)
|
||||
module.directive("tgNav", ["$tgNavUrls", "$tgAuth", NavigationUrlsDirective])
|
||||
module.directive("tgNav", ["$tgNavUrls", "$tgAuth", "$q", NavigationUrlsDirective])
|
||||
|
||||
|
||||
|
|
|
@ -1,44 +1,45 @@
|
|||
nav.menu
|
||||
h1.logo
|
||||
a(href="", title="Home")
|
||||
img(src="/images/logo.png", alt="Taiga")
|
||||
ul.main-nav
|
||||
li(data-name="search")
|
||||
a(href="", title="Search")
|
||||
span.icon.icon-search
|
||||
span.item Search
|
||||
li(data-name="backlog")
|
||||
a.active(href="", title="Backlog")
|
||||
span.icon.icon-backlog
|
||||
span.item Backlog
|
||||
li(data-name="kanban")
|
||||
a(href="", title="Kanban")
|
||||
span.icon.icon-kanban
|
||||
span.item Kanban
|
||||
li(data-name="issues")
|
||||
a(href="", title="Issues")
|
||||
span.icon.icon-issues
|
||||
span.item Issues
|
||||
li(data-name="wiki")
|
||||
a(href="", title="Wiki")
|
||||
span.icon.icon-wiki
|
||||
span.item Wiki
|
||||
li(data-name"video")
|
||||
a(href="", title="Video")
|
||||
span.icon.icon-video
|
||||
span.item Video
|
||||
div.user
|
||||
div.user-settings
|
||||
ul.popover
|
||||
li
|
||||
a(href="", title="Change profile photo") Change profile photo
|
||||
li
|
||||
a(href="", title="Account settings") Account settings
|
||||
li
|
||||
a(href="", title="Logout") Logout
|
||||
a.avatar(href="", title="User preferences")
|
||||
img(src="http://thecodeplayer.com/u/uifaces/12.jpg", alt="username")
|
||||
div.settings
|
||||
a(href="", title="User preferences") Pilar
|
||||
a(href="", title="Site preferences")
|
||||
span.icon.icon-settings
|
||||
h1.logo
|
||||
a(href="", title="Home")
|
||||
img(src="/images/logo.png", alt="Taiga")
|
||||
ul.main-nav
|
||||
li(data-name="search")
|
||||
a(href="", title="Search", tg-nav="project-search:project=project.slug")
|
||||
span.icon.icon-search
|
||||
span.item Search
|
||||
li(data-name="backlog", tg-nav="project-backlog:project=project.slug")
|
||||
a.active(href="", title="Backlog")
|
||||
span.icon.icon-backlog
|
||||
span.item Backlog
|
||||
li(data-name="kanban")
|
||||
a(href="", title="Kanban")
|
||||
span.icon.icon-kanban
|
||||
span.item Kanban
|
||||
li(data-name="issues")
|
||||
a(href="", title="Issues", tg-nav="project-issues:project=project.slug")
|
||||
span.icon.icon-issues
|
||||
span.item Issues
|
||||
li(data-name="wiki")
|
||||
a(href="", title="Wiki")
|
||||
span.icon.icon-wiki
|
||||
span.item Wiki
|
||||
li(data-name"video")
|
||||
a(href="", title="Video")
|
||||
span.icon.icon-video
|
||||
span.item Video
|
||||
div.user
|
||||
div.user-settings
|
||||
ul.popover
|
||||
li
|
||||
a(href="", title="Change profile photo") Change profile photo
|
||||
li
|
||||
a(href="", title="Account settings") Account settings
|
||||
li
|
||||
a(href="", title="Logout") Logout
|
||||
a.avatar(href="", title="User preferences")
|
||||
img(src="http://thecodeplayer.com/u/uifaces/12.jpg", alt="username")
|
||||
|
||||
div.settings
|
||||
a(href="", title="User preferences") Pilar
|
||||
a(href="", title="Site preferences")
|
||||
span.icon.icon-settings
|
||||
|
|
Loading…
Reference in New Issue