mirror of
https://github.com/owncloud/bookmarks.git
synced 2024-11-29 04:24:11 +01:00
Add more tag filtering capabilities
This commit is contained in:
parent
ca0fa16812
commit
c156399c60
@ -155,7 +155,7 @@
|
|||||||
|
|
||||||
#addBm ul.tagit { background:white; }
|
#addBm ul.tagit { background:white; }
|
||||||
|
|
||||||
#addBm input.ui-autocomplete-input{
|
#addBm input.ui-autocomplete-input, #tag_filter input.ui-autocomplete-input{
|
||||||
box-shadow:none;
|
box-shadow:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,18 +167,18 @@
|
|||||||
#tag_filter {
|
#tag_filter {
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
}
|
}
|
||||||
#leftcontent hr {
|
|
||||||
background-color:#DDDDDD;
|
#leftcontent > ul > li, .leftcontent li {
|
||||||
border:0;
|
|
||||||
color:#DDDDDD;
|
|
||||||
height:1px;
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
|
||||||
#leftcontent li, .leftcontent li {
|
|
||||||
padding: 0.2em;
|
padding: 0.2em;
|
||||||
padding-left:1em;
|
padding-left:1em;
|
||||||
}
|
}
|
||||||
|
#leftcontent > label {
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 0.7em;
|
||||||
|
display: block;
|
||||||
|
padding-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
#leftcontent .tag_list > li .tag , #leftcontent .share_list > li .tag{
|
#leftcontent .tag_list > li .tag , #leftcontent .share_list > li .tag{
|
||||||
background: none repeat scroll 0 0 #DEE7F8;
|
background: none repeat scroll 0 0 #DEE7F8;
|
||||||
border: 1px solid #CAD8F3;
|
border: 1px solid #CAD8F3;
|
||||||
@ -204,4 +204,28 @@
|
|||||||
li:hover .tags_actions {
|
li:hover .tags_actions {
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
li:hover em { display : none; }
|
li:hover em { display : none; }
|
||||||
|
#tag_filter li, #tag_filter li:hover{
|
||||||
|
background: none repeat scroll 0 0 #F8F8F8;
|
||||||
|
|
||||||
|
}
|
||||||
|
#tag_filter ul.tagit li.tagit-choice {
|
||||||
|
background: none repeat scroll 0 0 #DEE7F8;
|
||||||
|
padding: 0.2em 18px 0.2em 0.5em;
|
||||||
|
/* padding:0; */
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag_filter a {
|
||||||
|
display: inline;
|
||||||
|
float: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
#tag_filter ul.tagit li.tagit-choice .close{
|
||||||
|
margin-top: -8px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: -8px;
|
||||||
|
position: absolute;
|
||||||
|
right: 0.1em;
|
||||||
|
top: 50%;
|
||||||
|
}
|
14
index.php
14
index.php
@ -31,13 +31,19 @@ OCP\App::setActiveNavigationEntry( 'bookmarks_index' );
|
|||||||
|
|
||||||
OCP\Util::addscript('bookmarks','bookmarks');
|
OCP\Util::addscript('bookmarks','bookmarks');
|
||||||
OCP\Util::addStyle('bookmarks', 'bookmarks');
|
OCP\Util::addStyle('bookmarks', 'bookmarks');
|
||||||
$tags = explode(',', isset($_GET['tag']) ? $_GET['tag'] : '');
|
|
||||||
if($tags[0] =='') unset($tags[0]);
|
OCP\Util::addscript('bookmarks','tag-it');
|
||||||
$qtags = OC_Bookmarks_Bookmarks::findTags($tags);
|
OCP\Util::addStyle('bookmarks', 'jquery.tagit');
|
||||||
|
$qtags = OC_Bookmarks_Bookmarks::findTags();
|
||||||
$shared = OC_Bookmarks_Bookmarks::findSharing();
|
$shared = OC_Bookmarks_Bookmarks::findSharing();
|
||||||
|
|
||||||
|
$tags = array();
|
||||||
|
foreach($qtags as $tag) {
|
||||||
|
$tags[] = $tag['tag'];
|
||||||
|
}
|
||||||
|
|
||||||
$tmpl = new OCP\Template( 'bookmarks', 'list', 'user' );
|
$tmpl = new OCP\Template( 'bookmarks', 'list', 'user' );
|
||||||
$tmpl->assign('req_tag',isset($_GET['tag']) ? $_GET['tag'] : '');
|
$tmpl->assign('req_tag',isset($_GET['tag']) ? $_GET['tag'] : '');
|
||||||
$tmpl->assign('tags', $qtags);
|
$tmpl->assign('tags', json_encode($tags), false);
|
||||||
$tmpl->assign('shared', $shared);
|
$tmpl->assign('shared', $shared);
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
@ -10,8 +10,22 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
$(window).resize();
|
$(window).resize();
|
||||||
$('.bookmarks_list').scroll(updateOnBottom).empty().width($('#rightcontent').width());
|
$('.bookmarks_list').scroll(updateOnBottom).empty().width($('#rightcontent').width());
|
||||||
|
$('#tag_filter input').tagit({
|
||||||
|
allowSpaces: true,
|
||||||
|
availableTags: fullTags,
|
||||||
|
onTagRemoved: filterTagsChanged
|
||||||
|
}).tagit('option', 'onTagAdded', filterTagsChanged);
|
||||||
|
|
||||||
|
|
||||||
getBookmarks();
|
getBookmarks();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function addFilterTag(event)
|
||||||
|
{
|
||||||
|
event.preventDefault();
|
||||||
|
$('#tag_filter input').tagit('createTag', $(this).text());
|
||||||
|
}
|
||||||
|
|
||||||
function updateTagsList(tag) {
|
function updateTagsList(tag) {
|
||||||
$('.tag_list').append('<li><a href="" class="tag">'+tag['tag']+'</a>'+
|
$('.tag_list').append('<li><a href="" class="tag">'+tag['tag']+'</a>'+
|
||||||
'<p class="tags_actions">'+
|
'<p class="tags_actions">'+
|
||||||
@ -25,13 +39,19 @@ function updateTagsList(tag) {
|
|||||||
'<em>'+tag['nbr']+'</em>'+
|
'<em>'+tag['nbr']+'</em>'+
|
||||||
'</li>');
|
'</li>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterTagsChanged()
|
||||||
|
{
|
||||||
|
$('#bookmarkFilterTag').val($('#tag_filter input:hidden').val());
|
||||||
|
bookmarks_page = 0;
|
||||||
|
$('.bookmarks_list').empty();
|
||||||
|
getBookmarks();
|
||||||
|
}
|
||||||
function getBookmarks() {
|
function getBookmarks() {
|
||||||
if(bookmarks_loading) {
|
if(bookmarks_loading) {
|
||||||
//have patience :)
|
//have patience :)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('#bookmarkFilterTag').val($('#tag_filter input').val());
|
|
||||||
|
|
||||||
//Update Rel Tags
|
//Update Rel Tags
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -42,6 +62,7 @@ function getBookmarks() {
|
|||||||
for(var i in tags.data) {
|
for(var i in tags.data) {
|
||||||
updateTagsList(tags.data[i]);
|
updateTagsList(tags.data[i]);
|
||||||
}
|
}
|
||||||
|
$('.tag_list a.tag').click(addFilterTag);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -201,7 +222,7 @@ function updateOnBottom() {
|
|||||||
// use a bit of margin to begin loading before we are really at the
|
// use a bit of margin to begin loading before we are really at the
|
||||||
// bottom
|
// bottom
|
||||||
if (top < height * 1.2) {
|
if (top < height * 1.2) {
|
||||||
getBookmarks();
|
// getBookmarks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,8 +725,6 @@
|
|||||||
|
|
||||||
tag = $(tag);
|
tag = $(tag);
|
||||||
|
|
||||||
this._trigger('onTagRemoved', null, tag);
|
|
||||||
|
|
||||||
if (this.options.singleField) {
|
if (this.options.singleField) {
|
||||||
var tags = this.assignedTags();
|
var tags = this.assignedTags();
|
||||||
var removedTagLabel = this.tagLabel(tag);
|
var removedTagLabel = this.tagLabel(tag);
|
||||||
@ -743,6 +741,8 @@
|
|||||||
} else {
|
} else {
|
||||||
tag.remove();
|
tag.remove();
|
||||||
}
|
}
|
||||||
|
this._trigger('onTagRemoved', null, tag);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAll: function() {
|
removeAll: function() {
|
||||||
|
@ -13,14 +13,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="leftcontent">
|
<div id="leftcontent">
|
||||||
<p id="tag_filter">
|
<p id="tag_filter">
|
||||||
<input type="text" placeholder="Filter By tag" value="<?php echo $_['req_tag']; ?>"/> <a href="javascript:bookmarks_page = 0; $('.bookmarks_list').empty();getBookmarks()">go</a>
|
<input type="text" placeholder="Filter By tag" value="<?php echo $_['req_tag']; ?>"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<label><?php echo $l->t('Related Tags'); ?></label>
|
<label><?php echo $l->t('Related Tags'); ?></label>
|
||||||
<ul class="tag_list">
|
<ul class="tag_list">
|
||||||
</ul>
|
</ul>
|
||||||
<label><?php echo $l->t('Shared with'); ?></label>
|
<label><?php echo $l->t('Shared with'); ?></label>
|
||||||
<hr />
|
|
||||||
<ul class="share_list">
|
<ul class="share_list">
|
||||||
<?php foreach($_['shared'] as $users):?>
|
<?php foreach($_['shared'] as $users):?>
|
||||||
<li><span class="tag"><?php echo $users['name'];?></span>
|
<li><span class="tag"><?php echo $users['name'];?></span>
|
||||||
@ -47,4 +47,7 @@
|
|||||||
require_once(OC_App::getAppPath('bookmarks') .'/templates/bookmarklet.php');
|
require_once(OC_App::getAppPath('bookmarks') .'/templates/bookmarklet.php');
|
||||||
createBookmarklet();
|
createBookmarklet();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
var fullTags = <?php echo $_['tags'];?>;
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user