mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
UI Cleanup - Updated Navbar, Profile, Quality and Release subtrees.
This commit is contained in:
@@ -5,38 +5,55 @@ var QueueView = require('../Activity/Queue/QueueView');
|
||||
require('./Search');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Navbar/NavbarLayoutTemplate',
|
||||
regions : {
|
||||
template : 'Navbar/NavbarLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
health : '#x-health',
|
||||
queue : '#x-queue-count'
|
||||
},
|
||||
ui : {
|
||||
|
||||
ui : {
|
||||
search : '.x-series-search',
|
||||
collapse : '.x-navbar-collapse'
|
||||
},
|
||||
events : {"click a" : 'onClick'},
|
||||
onRender : function(){
|
||||
|
||||
events : {
|
||||
'click a' : 'onClick'
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this.ui.search.bindSearch();
|
||||
this.health.show(new HealthView());
|
||||
this.queue.show(new QueueView());
|
||||
},
|
||||
onClick : function(event){
|
||||
|
||||
onClick : function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var target = $(event.target);
|
||||
|
||||
//look down for <a/>
|
||||
var href = event.target.getAttribute('href');
|
||||
if(!href && target.closest('a') && target.closest('a')[0]) {
|
||||
|
||||
//if couldn't find it look up'
|
||||
if (!href && target.closest('a') && target.closest('a')[0]) {
|
||||
|
||||
var linkElement = target.closest('a')[0];
|
||||
|
||||
href = linkElement.getAttribute('href');
|
||||
this.setActive(linkElement);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.setActive(event.target);
|
||||
}
|
||||
if($(window).width() < 768) {
|
||||
|
||||
if ($(window).width() < 768) {
|
||||
this.ui.collapse.collapse('hide');
|
||||
}
|
||||
},
|
||||
setActive : function(element){
|
||||
|
||||
setActive : function(element) {
|
||||
//Todo: Set active on first load
|
||||
this.$('a').removeClass('active');
|
||||
$(element).addClass('active');
|
||||
}
|
||||
|
||||
+29
-28
@@ -5,32 +5,33 @@ var Backbone = require('backbone');
|
||||
var SeriesCollection = require('../Series/SeriesCollection');
|
||||
require('typeahead');
|
||||
|
||||
module.exports = (function(){
|
||||
vent.on(vent.Hotkeys.NavbarSearch, function(){
|
||||
$('.x-series-search').focus();
|
||||
vent.on(vent.Hotkeys.NavbarSearch, function() {
|
||||
$('.x-series-search').focus();
|
||||
});
|
||||
|
||||
var substringMatcher = function() {
|
||||
return function findMatches (q, cb) {
|
||||
var matches = _.select(SeriesCollection.toJSON(), function(series) {
|
||||
return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1;
|
||||
});
|
||||
cb(matches);
|
||||
};
|
||||
};
|
||||
|
||||
$.fn.bindSearch = function() {
|
||||
$(this).typeahead({
|
||||
hint : true,
|
||||
highlight : true,
|
||||
minLength : 1
|
||||
}, {
|
||||
name : 'series',
|
||||
displayKey : 'title',
|
||||
source : substringMatcher()
|
||||
});
|
||||
$.fn.bindSearch = function(){
|
||||
$(this).typeahead({
|
||||
hint : true,
|
||||
highlight : true,
|
||||
minLength : 1
|
||||
}, {
|
||||
name : 'series',
|
||||
displayKey : 'title',
|
||||
source : substringMatcher()
|
||||
});
|
||||
$(this).on('typeahead:selected typeahead:autocompleted', function(e, series){
|
||||
this.blur();
|
||||
$(this).val('');
|
||||
Backbone.history.navigate('/series/{0}'.format(series.titleSlug), {trigger : true});
|
||||
});
|
||||
};
|
||||
var substringMatcher = function(){
|
||||
return function findMatches (q, cb){
|
||||
var matches = _.select(SeriesCollection.toJSON(), function(series){
|
||||
return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1;
|
||||
});
|
||||
cb(matches);
|
||||
};
|
||||
};
|
||||
}).call(this);
|
||||
|
||||
$(this).on('typeahead:selected typeahead:autocompleted', function(e, series) {
|
||||
this.blur();
|
||||
$(this).val('');
|
||||
Backbone.history.navigate('/series/{0}'.format(series.titleSlug), { trigger : true });
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user