Permalink
Browse files

top search bar autocompletes user names

There hasn't been an easy way of searching for a particular user, until now.
The top search bar shows a list of matching users underneath, as you type. Clicking on a name will take you to that user's profile.
Pressing enter or clicking the search icon takes you to the editor item search page.
  • Loading branch information...
1 parent 8539a03 commit d0a07bd3d8423f7f717e9990657fda004fa7b2de @christianp christianp committed Jul 22, 2016
Showing with 6 additions and 348 deletions.
  1. +2 −347 editor/static/css/main.css
  2. +4 −1 editor/static/js/editor.js
@@ -70,351 +70,6 @@ body:not(.loaded) .loaded-content {
background-color: #ffbf00;
}
-
-/*
-ul.no-bullets, ol.no-bullets {
- list-style-type: none;
- margin-left: 10px;
-}
-
-html {
- height: 100%;
-
-}
-
-body {
- font: normal 1em arial, sans-serif;
- background: #acdeff;
- padding-left: 20px;
- padding-right: 20px;
-}
-
-th a {
- color: black;
-}
-
-th a:hover {
- color: black;
- text-decoration: none;
-}
-
-.noselect {
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-#container-fluid {
- max-width: 1200px;
- margin-left: auto;
- margin-right: auto;
-}
-
-.left {
- float: left;
- width: auto;
-
-}
-
-.right {
- float: right;
- width: auto;
-
-}
-
-.center {
- display: block;
- text-align: center;
- margin: 0 auto;
-
-}
-
-[contenteditable=true]:empty:before {
- content: attr(placeholder);
- display: block;
- font-style: italic;
- opacity: 0.6;
-}
-
-button, .btn {
- background: #acdeff;
- border: 1px solid #999;
- border-radius: 2px;
- text-shadow: none;
-}
-button {
- margin: 0.1em 0.3em;
- padding: 0.3em 0.5em;
-}
-
-button:hover, button:focus, .btn:hover, .btn:focus {
- background-color: #f90;
-}
-
-.dropdown-menu li>a:hover {
- background: #f90;
-}
-
-#header {
- padding-top: 1em;
- padding-bottom: 1em;
-}
-
-#header a {
- color: black;
-}
-
-#site_content {
- padding-bottom: 2em;
- margin-bottom: 1em;
-}
-
-#menu a:hover {
- color: #999;
-}
-
-#menu .help a {
- color: #f90;
-}
-
-.nav-tabs > .active > a:hover {
- cursor: pointer;
-}
-
-.nav-tabs .divider {
- padding: 1px 30px 1px 0;
-}
-
-.hint {
- font-style: italic;
-}
-
-#session {
- text-align: right;
-}
-
-#session .account-links a {
- text-decoration: underline;
-}
-
-#session .account-links {
- margin-left: 2em;
-}
-
-.top-dropdown {
- font-size: 1em;
- margin-left: 1em;
-}
-
-.top-dropdown .dropdown-menu {
- width: 280px;
- max-height: 30em;
- overflow-y: auto;
-}
-
-.top-dropdown .dropdown-toggle {
- border: none;
- background: white;
- cursor: default;
- padding: 3px;
- width: 15px;
- height: 15px;
-}
-.top-dropdown .dropdown-toggle.disabled {
- opacity: 1;
-}
-
-.top-dropdown.open .dropdown-toggle:active {
- box-shadow: none;
-}
-
-.top-dropdown.active .dropdown-toggle {
- background-color: red;
-}
-
-.top-dropdown.active .dropdown-toggle .icon use {
- fill: white;
-}
-
-.top-dropdown a {
- text-decoration: none;
-}
-
-.top-dropdown .dropdown-menu a:hover {
- background: none;
-}
-.top-dropdown .dropdown-menu li:hover {
- background: rgba(255,153,0,0.3);
-}
-
-.top-dropdown .dropdown-menu li>a {
- white-space: normal;
-}
-
-.top-dropdown a.action {
- font-weight: bold;
- color: #08c;
-}
-
-#notifications .notification .target {
- font-weight: bold;
-}
-
-#notifications .notification .time {
- font-size: 0.9em;
- color: #888;
-}
-
-#question_basket {
- position: relative;
-}
-
-.top-dropdown .counter {
- display: none;
- position: absolute;
- top: -0.5em;
- right: -0.5em;
- background: white;
- border-radius: 50%;
- width: 1em;
- font-size: 0.7em;
- height: 1em;
- line-height: 1em;
- z-index: 3;
- text-align: center;
-}
-.top-dropdown.active .counter {
- display: block;
-}
-
-#question_basket .question-list {
- list-style: none;
-}
-
-#question_basket .question {
- position: relative;
-}
-
-#question_basket .question .remove {
- position: absolute;
- left: -1em;
- top: 4px;
- border: none;
- padding: 0;
- margin: 0;
- width: 14px;
- height: 14px;
- line-height: 14px;
- background: none;
-}
-#question_basket .question .remove .icon use {
- fill: red;
-}
-
-ul#menu li {
- font-size: 1.2em;
-}
-
-#site_content {
- background: white;
-}
-
-#footer {
- font: 75% sans-serif;
- text-align: center;
- background: transparent;
- color: #333;
-}
-
-#footer a, #footer a:hover {
- color: #888;
- text-decoration: none;
-}
-
-#footer a:hover {
- color: #333;
-}
-
-button.search {
- background: white url(../images/search.png) no-repeat 50%;
- border: none;
- background-color: transparent;
- width: 16px;
- height: 16px;
- margin: 0;
-}
-
-button.search.loading {
- background-image: url(../images/busy.gif);
-}
-
-.tab-content > .tab-pane, .pill-content > .pill-pane {
- display: inherit;
- position: absolute;
- left: -100000px;
- top: -1000000px;
-}
-.tab-content > .active, .pill-content > .active {
- position: inherit;
-}
-
-.nav-tabs > li > a {
- border-radius: inherit;
- -webkit-border-radius: inherit;
- -moz-border-radius: inherit;
-}
-
-.well-small {
- padding: 4px;
-}
-
-.errorlist {
- background: black;
- color: white;
- padding: 5px;
- border-radius: 3px;
-}
-
-.errorlist, .messages {
- list-style: none;
- display: inline-block;
-}
-
-.stamp-status {
- font-weight: bold;
- padding: 2px 4px;
- border-radius: 2px;
- display: inline-block;
-}
-
-.stamp-status.ok {
- background-color: green;
- color: white;
-}
-
-.stamp-status.problem {
- background-color: #888;
- color: white;
-}
-
-.stamp-status.broken {
- background-color: red;
- color: white;
-}
-
-.stamp-status.dontuse {
- background-color: black;
- color: yellow;
-}
-
-.stamp-status.pleasetest {
- background-color: #ffbf00;
-}
-
-.alert > p:last-child {
- margin-bottom: 0;
+.ui-autocomplete {
+ z-index: 2000;
}
-*/
@@ -1621,7 +1621,7 @@ $(document).ready(function() {
.success(function(data) {
var things = [];
var things = data.map(function(d) {
- return {label: d.autocomplete_entry, value: d.name, id: d.id}
+ return {label: d.autocomplete_entry, value: d.name, id: d.id, profile: d.profile}
});
callback(things);
})
@@ -1637,4 +1637,7 @@ $(document).ready(function() {
element.autocomplete($.extend({source: source, select: set_user, html: true},options));
}
+ Editor.user_search_autocomplete($('#top-search-bar'),{select: function(e,ui) {
+ window.location.href = ui.item.profile;
+ }});
});

0 comments on commit d0a07bd

Please sign in to comment.