diff --git a/resources/content_server/browse/browse.css b/resources/content_server/browse/browse.css index 22eee3e05e..0f954a8647 100644 --- a/resources/content_server/browse/browse.css +++ b/resources/content_server/browse/browse.css @@ -12,6 +12,9 @@ body { background-color: #F6F3E9; margin-left: auto; margin-right: auto; + -moz-box-shadow: 5px 5px 5px #ccc; + -webkit-box-shadow: 5px 5px 5px #ccc; + box-shadow: 5px 5px 5px #ccc; } #header { @@ -23,7 +26,19 @@ body { max-width: 1000px; min-width: 400px; min-height: 100px; - padding-bottom: 30px; +} + +#main { + padding-left: 0.5em; + padding-right: 0.5em; + +} + +#footer { + font-size: small; + color: #a6a399; + text-align: right; + margin-right: 30px; } /* Header {{{ */ @@ -36,6 +51,7 @@ body { font-size: xx-large; font-family: monospace; overflow: hidden; + z-index: 2; } #header .bubble { @@ -53,15 +69,37 @@ body { text-align: center; } +#header a { + text-decoration: none; + color: white; + cursor: pointer; + white-space: nowrap; + text-shadow: #27211b 2px 2px 2px; +} + +#header a:hover { + background-color: #39a9cf; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + text-shadow: #27211b 1px 1px 1px; +} + +#nav-container { + position: relative; + height: 130px; + top: -130px; + left: 0%; +} + ul#primary-nav { display: block; margin-right: 60px; text-align: right; - margin-top: 60px; + margin-top: 90px; line-height: 20px; cursor: default; position: relative; - top: -100px; + top: -2ex; } ul#primary-nav li { @@ -71,22 +109,11 @@ ul#primary-nav li { ul#primary-nav li a { padding: 6px; - color: white; - text-decoration: none; font-variant: small-caps; - /*text-transform: uppercase;*/ - font-size: 80%; font-weight: bold; white-space: nowrap; - text-shadow: #27211b 2px 2px 2px; } -ul#primary-nav li a:hover { - background-color: #39a9cf; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - text-shadow: #27211b 1px 1px 1px; -} #donate { display: block; @@ -94,10 +121,20 @@ ul#primary-nav li a:hover { height: 38px; overflow: hidden; position: relative; - top: -230px; + top: -260px; left: 65%; } +#calibre-home-link { + position: relative; + top: -298px; + left: 0%; + z-index: 2; + height: 130px; + width: 230px; + cursor: pointer; +} + h2.library_name { font-family: monospace; font-size: 50px; @@ -120,7 +157,18 @@ h2.library_name { /* Sort select {{{ */ -.sort_select { float: left; margin-left: 1em; margin-top: 2ex; font-size: small; } +.sort_select { + float: left; + margin-left: 1em; + margin-top: 2ex; + font-size: small; + max-height: 2.75em; + overflow: hidden; +} + +.sort_select label { + font-size: medium; +} /* }}} */ @@ -131,9 +179,40 @@ h2.library_name { margin-right: 1em; margin-top: 2ex; font-size: small; + max-height: 2.75em; + overflow: hidden; } #search_box .search_input { padding: 0.35em } /* }}} */ + +/* Top level {{{ */ +.toplevel ul { + list-style-type: none; + margin: 0; + padding: 0; +} + +.toplevel li { + margin: 0.75em; + padding: 0.75em; + text-align: center; + cursor: pointer; +} + +.toplevel li:hover { + background-color: #d6d3c9; + font-weight: bold; + -moz-box-shadow: 5px 5px 5px #ccc; + -webkit-box-shadow: 5px 5px 5px #ccc; + box-shadow: 5px 5px 5px #ccc; + +} + +.toplevel li span { display: none } + +/* }}} */ + + diff --git a/resources/content_server/browse/browse.html b/resources/content_server/browse/browse.html index 3f8002e303..9ae37e5c43 100644 --- a/resources/content_server/browse/browse.html +++ b/resources/content_server/browse/browse.html @@ -33,16 +33,18 @@ + @@ -68,11 +71,21 @@ +
 
+
 
+
 
+ +
+ {main} +
+ diff --git a/resources/content_server/browse/browse.js b/resources/content_server/browse/browse.js index b917a1646d..20b85df915 100644 --- a/resources/content_server/browse/browse.js +++ b/resources/content_server/browse/browse.js @@ -109,6 +109,7 @@ function init_sort_combobox() { function init() { $("#container").corner("30px"); $("#header").corner("30px"); + $("#calibre-home-link").click(function() { window.location = "http://calibre-ebook.com"; }); init_sort_combobox(); @@ -117,5 +118,13 @@ function init() { // Top-level feed {{{ function toplevel() { + $(".sort_select").hide(); + + $(".toplevel li").corner("15px"); + + $(".toplevel li").click(function() { + var href = $(this).children("span").html(); + window.location = href; + }); } // }}} diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index d8f59b8db7..6e510cbfa5 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -73,6 +73,8 @@ class SearchBox2(QComboBox): self.normal_background = 'rgb(255, 255, 255, 0%)' self.line_edit = SearchLineEdit(self) self.setLineEdit(self.line_edit) + c = self.line_edit.completer() + c.setCompletionMode(c.PopupCompletion) self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.DirectConnection) self.line_edit.mouse_released.connect(self.mouse_released, diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index 028ef16b27..e058ccd4f3 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -63,13 +63,37 @@ class BrowseServer(object): # Catalogs {{{ def browse_catalog(self, category=None): if category == None: - #categories = self.categories_cache() + categories = self.categories_cache() + category_meta = self.db.field_metadata + cats = [ + (_('Newest'), 'newest'), + ] + def getter(x): + return category_meta[x]['name'].lower() + for category in sorted(categories, + cmp=lambda x,y: cmp(getter(x), getter(y))): + if len(categories[category]) == 0: + continue + if category == 'formats': + continue + meta = category_meta.get(category, None) + if meta is None: + continue + cats.append((meta['name'], category)) + cats = ['
  • {0}/browse/category/{1}
  • '.format(xml(x, True), + xml(y), xml(_('Browse books by'))) for x, y in cats] + + main = '

    {0}

    '\ + .format(_('Choose a category to browse by:'), '\n\n'.join(cats)) ans = self.browse_template().format(title='', - script='toplevel();') + script='toplevel();', main=main) else: raise cherrypy.HTTPError(404, 'Not found') + cherrypy.response.headers['Content-Type'] = 'text/html' - cherrypy.response.headers['Last-Modified'] = self.last_modified(self.build_time) + updated = self.db.last_modified() + cherrypy.response.headers['Last-Modified'] = \ + self.last_modified(max(updated, self.build_time)) return ans # }}} diff --git a/src/calibre/library/server/cache.py b/src/calibre/library/server/cache.py index 87bd9ed0c5..29602a114c 100644 --- a/src/calibre/library/server/cache.py +++ b/src/calibre/library/server/cache.py @@ -30,7 +30,10 @@ class Cache(object): def categories_cache(self, restrict_to=frozenset([])): base_restriction = self.search_cache('') - restrict_to = frozenset(restrict_to).intersection(base_restriction) + if restrict_to: + restrict_to = frozenset(restrict_to).intersection(base_restriction) + else: + restrict_to = base_restriction old = self._category_cache.pop(frozenset(restrict_to), None) if old is None or old[0] <= self.db.last_modified(): categories = self.db.get_categories(ids=restrict_to)