Merge pull request #1054 from taigaio/bug/4345/disable-drag-and-drop-on-wiki-links-without-permissions
Bug#4345: Disable drag and drop on wikilink without permissionsstable
commit
8cdab3c1bf
|
@ -45,6 +45,9 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $analytics, $loading, $t
|
||||||
itemEl = null
|
itemEl = null
|
||||||
tdom = $el.find(".sortable")
|
tdom = $el.find(".sortable")
|
||||||
|
|
||||||
|
addWikiLinkPermission = $scope.project.my_permissions.indexOf("add_wiki_link") > -1
|
||||||
|
|
||||||
|
if addWikiLinkPermission
|
||||||
drake = dragula([tdom[0]], {
|
drake = dragula([tdom[0]], {
|
||||||
direction: 'vertical',
|
direction: 'vertical',
|
||||||
copySortSource: false,
|
copySortSource: false,
|
||||||
|
@ -69,6 +72,7 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $analytics, $loading, $t
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
if addWikiLinkPermission
|
||||||
drake.destroy()
|
drake.destroy()
|
||||||
|
|
||||||
linkWikiLinks = ($scope, $el, $attrs) ->
|
linkWikiLinks = ($scope, $el, $attrs) ->
|
||||||
|
|
|
@ -18,7 +18,12 @@ nav
|
||||||
)
|
)
|
||||||
|
|
||||||
ul.sortable
|
ul.sortable
|
||||||
li.wiki-link(ng-repeat="link in wikiLinks", data-id!="{{ $index }}", tg-bind-scope)
|
li.wiki-link(
|
||||||
|
ng-repeat="link in wikiLinks"
|
||||||
|
data-id!="{{ $index }}"
|
||||||
|
tg-bind-scope
|
||||||
|
tg-class-permission="{'is-sortable': 'add_wiki_link'}"
|
||||||
|
)
|
||||||
<% if (addWikiLinkPermission) { %>
|
<% if (addWikiLinkPermission) { %>
|
||||||
tg-svg.dragger(svg-icon="icon-drag")
|
tg-svg.dragger(svg-icon="icon-drag")
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
@include font-type(text);
|
@include font-type(text);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 1px solid $gray-light;
|
border-bottom: 1px solid $gray-light;
|
||||||
cursor: move;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 1rem 0;
|
padding: 1rem 0;
|
||||||
|
@ -22,6 +21,9 @@
|
||||||
transition-delay: .2s;
|
transition-delay: .2s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.is-sortable {
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
.dragger {
|
.dragger {
|
||||||
margin-right: .5rem;
|
margin-right: .5rem;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
Loading…
Reference in New Issue