Commit dc9f49b6 by Matthew Mongeau

Show dropdown on click.

parent 3521d421
...@@ -2,6 +2,7 @@ class @DiscussionThreadListView extends Backbone.View ...@@ -2,6 +2,7 @@ class @DiscussionThreadListView extends Backbone.View
template: _.template($("#thread-list-template").html()) template: _.template($("#thread-list-template").html())
events: events:
"click .search": "showSearch" "click .search": "showSearch"
"click .browse": "toggleTopicDrop"
"keyup .post-search-field": "performSearch" "keyup .post-search-field": "performSearch"
"click .sort-bar a": "sortThreads" "click .sort-bar a": "sortThreads"
...@@ -32,10 +33,18 @@ class @DiscussionThreadListView extends Backbone.View ...@@ -32,10 +33,18 @@ class @DiscussionThreadListView extends Backbone.View
@$("a[data-id='#{thread_id}']").addClass("active") @$("a[data-id='#{thread_id}']").addClass("active")
showSearch: -> showSearch: ->
@$(".search").addClass('is-open'); @$(".search").addClass('is-open')
@$(".browse").removeClass('is-open'); @$(".browse").removeClass('is-open')
setTimeout (-> @$(".post-search-field").focus()), 200 setTimeout (-> @$(".post-search-field").focus()), 200
toggleTopicDrop: ->
@$(".browse").toggleClass('is-dropped')
if @$(".browse").hasClass('is-dropped')
@$(".board-drop-menu").show()
else
@$(".board-drop-menu").hide()
sortThreads: (event) -> sortThreads: (event) ->
@$(".sort-bar a").removeClass("active") @$(".sort-bar a").removeClass("active")
$(event.target).addClass("active") $(event.target).addClass("active")
......
...@@ -26,8 +26,8 @@ var SIDEBAR_HEADER_HEIGHT = 87; ...@@ -26,8 +26,8 @@ var SIDEBAR_HEADER_HEIGHT = 87;
$(document).ready(function() { $(document).ready(function() {
$body = $('body'); $body = $('body');
$browse = $('.browse-search .browse'); $browse = $('.browse-search .browse');
// $search = $('.browse-search .search'); $search = $('.browse-search .search');
// $searchField = $('.post-search-field'); $searchField = $('.post-search-field');
$topicDrop = $('.board-drop-menu'); $topicDrop = $('.board-drop-menu');
$currentBoard = $('.current-board'); $currentBoard = $('.current-board');
$tooltip = $('<div class="tooltip"></div>'); $tooltip = $('<div class="tooltip"></div>');
...@@ -43,7 +43,7 @@ $(document).ready(function() { ...@@ -43,7 +43,7 @@ $(document).ready(function() {
sidebarXOffset = $sidebar.offset().top; sidebarXOffset = $sidebar.offset().top;
$browse.bind('click', showTopicDrop); $browse.bind('click', showTopicDrop);
// $search.bind('click', showSearch); $search.bind('click', showSearch);
$topicDrop.bind('click', setTopic); $topicDrop.bind('click', setTopic);
$formTopicDropBtn.bind('click', showFormTopicDrop); $formTopicDropBtn.bind('click', showFormTopicDrop);
$formTopicDropMenu.bind('click', setFormTopic); $formTopicDropMenu.bind('click', setFormTopic);
...@@ -111,13 +111,13 @@ function showBrowse(e) { ...@@ -111,13 +111,13 @@ function showBrowse(e) {
$searchField.val(''); $searchField.val('');
} }
// function showSearch(e) { function showSearch(e) {
// $search.addClass('is-open'); $search.addClass('is-open');
// $browse.removeClass('is-open'); $browse.removeClass('is-open');
// setTimeout(function() { setTimeout(function() {
// $searchField.focus(); $searchField.focus();
// }, 200); }, 200);
// } }
function showTopicDrop(e) { function showTopicDrop(e) {
e.preventDefault(); e.preventDefault();
...@@ -229,4 +229,4 @@ function updateSidebarDimensions(e) { ...@@ -229,4 +229,4 @@ function updateSidebarDimensions(e) {
$postListWrapper.css('height', (sidebarHeight - SIDEBAR_HEADER_HEIGHT - 4) + 'px'); $postListWrapper.css('height', (sidebarHeight - SIDEBAR_HEADER_HEIGHT - 4) + 'px');
$sidebarWidthStyles.html('.discussion-body .post-list a .title { width: ' + titleWidth + 'px !important; }'); $sidebarWidthStyles.html('.discussion-body .post-list a .title { width: ' + titleWidth + 'px !important; }');
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment