Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag update #6

Merged
merged 16 commits into from
May 30, 2018
Prev Previous commit
Next Next commit
done
  • Loading branch information
ro4 committed May 29, 2018
commit f28dd47eee23973f648b8e0ea9e9456aef782d2f
7 changes: 4 additions & 3 deletions public/assets/js/tagmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
html += opts.tagCloseIcon + '</a></span> ';
$el = $(html);


var typeAheadMess = $self.parents('.twitter-typeahead')[0] !== undefined;
if (opts.tagsContainer !== null) {
$(opts.tagsContainer).append($el);
Expand All @@ -167,8 +167,9 @@
var lastTagId = $self.data("tm_rndid") + '_' + --tagId;
jQuery('#' + lastTagId).after($el);
} else {
lastTagObj = $self.siblings("#" + $self.data("tm_rndid") + "_" + tlid[tlid.length - 2]);
lastTagObj.after($el);
$self.before($el);
// lastTagObj = $self.siblings("#" + $self.data("tm_rndid") + "_" + tlid[tlid.length - 2]);
// lastTagObj.after($el);
}
} else {
if (typeAheadMess) {
Expand Down
27 changes: 16 additions & 11 deletions resources/views/components/tags.blade.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<div class="card-body">
<input type="text" name="tags" placeholder="Tags" class="tm-input" @if(Auth::guest()) style="display: none;" @endif/>
<div class="card-body" style="max-width: 960px;">
<input type="text" name="tags" placeholder="Tags" class="tm-input"
@cannot('project-edit', $pageItem->id) style="display: none;" @endcannot/>
</div>


@push('script')
@if(!Auth::guest())
@cannot('project-edit', $pageItem->id)
<script>
$(function () {
$(".tm-input").tagsManager({
prefilled: "{{$pageItem->tags->pluck('name')->implode(',')}}",
CapitalizeFirstLetter: false,
AjaxPush: '/tag',
AjaxPushAllTags: true,
AjaxPushParameters: {'p': {{$pageID}} },
delimiters: [9, 13, 44],
backspace: [8],
blinkBGColor_1: '#FFFF9C',
Expand All @@ -21,19 +20,24 @@
deleteTagsOnBackspace: true,
tagsContainer: null,
tagCloseIcon: '×',
tagClass: 'tm-tag-success',
tagClass: 'tm-tag-disabled',
validator: null,
onlyTagList: false
});
});
</script>
@else
@endcannot

@can('project-edit', $pageItem->id)
<script>
$(function () {
$(".tm-input").tagsManager({
prefilled: "{{$pageItem->tags->pluck('name')->implode(',')}}",
CapitalizeFirstLetter: false,
delimiters: [9, 13, 44],
AjaxPush: '/tag',
AjaxPushAllTags: true,
AjaxPushParameters: {'p': {{$pageID}} },
delimiters: [44, 9, 13],
backspace: [8],
blinkBGColor_1: '#FFFF9C',
blinkBGColor_2: '#CDE69C',
Expand All @@ -42,11 +46,12 @@
deleteTagsOnBackspace: true,
tagsContainer: null,
tagCloseIcon: '×',
tagClass: 'tm-tag-disabled',
tagClass: 'tm-tag-success',
validator: null,
onlyTagList: false
});
});
</script>
@endif
@endcan

@endpush