Skip to content

Commit

Permalink
Added search, bumped version to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybaroneee committed Sep 23, 2015
1 parent 0af33db commit 0665208
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
20 changes: 20 additions & 0 deletions flourish.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
display: none !important;
}

.x-card-collaborators-info-text {
display: none;
}

.x-collaborator-select-active-image,
.x-collaborator-select-inactive-image {
width: 30px;
Expand All @@ -20,4 +24,20 @@

.x-card-collaborators-editor .x-card-collaborators-select {
display: block;
}

input[type="text"].people-search {
width: 100%;
font-size: 14px;
cursor: text;
border-color: transparent;
border-bottom-color: #ccc;
margin-bottom: 15px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

input[type="text"].people-search:focus {
border-color: transparent;
border-bottom-color: #ccc;
}
39 changes: 35 additions & 4 deletions flourish.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@ function runFlourish(evt) {
});
};

var cleanupCollabState = function() {
$('.people-search').val('');
$('.x-card-collaborators-select').show();
};

// On people picker open, fix up people items.
$(document).on('click', '.x-card-collaborators-launch-area', function(e) {
var $people = $('.x-card-collaborators-editor'),
$peopleli = $people.children('.x-card-collaborators-select');
$peopleItems = $people.children('.x-card-collaborators-select');

// Touch up collab picker on show, if it hasn't been done yet, or has been destroyed.
if ($people.is(':visible') && !$people.data('fixed-up')) {
addNames($peopleli);
$peopleli.sort(function(a, b) {
addNames($peopleItems);
$peopleItems.sort(function(a, b) {
var an = $(a).find('.x-collaborator-select-tooltip-content').text().toUpperCase(),
bn = $(b).find('.x-collaborator-select-tooltip-content').text().toUpperCase();

Expand All @@ -38,10 +45,34 @@ function runFlourish(evt) {
}
return 0;
});
$peopleItems.detach().appendTo($people);

// Add text search
$people.prepend($('<input />')
.attr('type', 'text')
.attr('placeholder', 'Find someone...')
.addClass('people-search')
);

$peopleli.detach().appendTo($people);
$people.data('fixed-up', true);
}

// Auto-focus search
cleanupCollabState();
setTimeout(function() {
$('.people-search').focus();
}, 0);
});

// Respond to keystrokes in people search
$(document).on('keyup', '.people-search', function(e) {
var searchInput = e.currentTarget.value.toLowerCase();
$('.x-card-collaborators-select').each(function(i, el) {
var $el = $(el),
match = $el.find('.x-collaborator-select-tooltip-content').text().toLowerCase().indexOf(searchInput) > -1
if (match) $el.show()
else $el.hide()
});
});

// Hack to fix people names upon selection/de-selection (since we can't use click listeners)
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Flourish",
"version": "1.0.0",
"version": "1.1.0",
"description": "Simple usability improvements for Blossom.",
"icons": {
"128": "images/flourish128.png"
Expand Down

0 comments on commit 0665208

Please sign in to comment.