Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendenInhelder committed Feb 11, 2023
1 parent c082721 commit 6f079bc
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 36 deletions.
2 changes: 1 addition & 1 deletion openlibrary/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def new_list(self, name, description, seeds, tags=None):
"type": {"key": "/type/list"},
"name": name,
"description": description,
"seeds": seeds,
#"seeds": seeds,
"tags": tags,
}
return self._site.new(key, doc)
Expand Down
50 changes: 35 additions & 15 deletions openlibrary/templates/account/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,40 @@
<li><a href="/people/$username/books/sponsorships" data-ol-link-track="MyBooksSidebar|Sponsorships" $('class=selected' if key == 'sponsorships' else '')><span class="li-count">$sponsorship_count</span>$_('Sponsoring')</a></li>
</ul>
<ul class="sidebar-section">
<li class="section-header section-header-split"><span>$_('Lists')</span> <a href="/people/$username/lists" data-ol-link-track="MyBooksSidebar|AllLists" class="li-count">$_('See All') ($len(lists))</a></li>
<div class="list-overflow">
$ placeholder_name = _('Untitled list')
$for lst in lists:
$# e.g. OL1L from /people/mekBot/lists/OL1L
$ list_id = lst.key.split('/')[-1]
$ class_list = ''
$if key == 'list':
$# e.g. /people/openlibrary/lists/OL1L/MyList
$ path_id = ctx.path.split('/')[4]
$if list_id == path_id:
$ class_list = class_list + 'selected'
<li><a class="$class_list" data-ol-link-track="MyBooksSidebar|PatronList" href="/people/$username/lists/$list_id"><span class="li-count">$(len(lst.seeds))</span>$(lst['name'] if lst['name'] else '[%s]' % placeholder_name)</a></li>
</div>
$if owners_page:
<li class="section-header section-header-split"><span>$_('My Lists')</span> <a href="/people/$username/lists" data-ol-link-track="MyBooksSidebar|AllLists" class="li-count">$_('Edit') ($len(lists))</a></li>
<div class="list-overflow">
$ placeholder_name = _('Untitled list')
$for lst in lists:
$# e.g. OL1L from /people/mekBot/lists/OL1L
$ list_id = lst.key.split('/')[-1]
$ class_list = ''
$if key == 'list':
$# e.g. /people/openlibrary/lists/OL1L/MyList
$ path_id = ctx.path.split('/')[4]
$if list_id == path_id:
$ class_list = class_list + 'selected'
<li><a class="$class_list" data-ol-link-track="MyBooksSidebar|PatronList" href="/people/$username/lists/$list_id"><span class="li-count">$(len(lst.seeds))</span>$(lst['name'] if lst['name'] else '[%s]' % placeholder_name)</a></li>
</div>
$ user_lists = []
$:macros.ReadingLogDropper(user_lists)
$else:
<li class="section-header section-header-split"><span>$_('Lists')</span> <a href="/people/$username/lists" data-ol-link-track="MyBooksSidebar|AllLists" class="li-count">$_('See All') ($len(lists))</a></li>
<div class="list-overflow">
$ placeholder_name = _('Untitled list')
$for lst in lists:
$# e.g. OL1L from /people/mekBot/lists/OL1L
$ list_id = lst.key.split('/')[-1]
$ class_list = ''
$if key == 'list':
$# e.g. /people/openlibrary/lists/OL1L/MyList
$ path_id = ctx.path.split('/')[4]
$if list_id == path_id:
$ class_list = class_list + 'selected'
<li><a class="$class_list" data-ol-link-track="MyBooksSidebar|PatronList" href="/people/$username/lists/$list_id"><span class="li-count">$(len(lst.seeds))</span>$(lst['name'] if lst['name'] else '[%s]' % placeholder_name)</a></li>
</div>
$ user_lists = []
$:macros.ReadingLogDropper(user_lists)
</ul>
</div>
$ component_times['Sidebar'] = time() - component_times['Sidebar']
$ component_times['Sidebar'] = time() - component_times['Sidebar']
2 changes: 1 addition & 1 deletion openlibrary/templates/type/list/view_body.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h1>$list.name</h1>

window.q.push(function(){
\$(".listDelete a").on('click', function() {
if (get_seed_count() > 1) {
if (get_seed_count() >= 0) {
\$("#remove-seed-dialog")
.data("seed-key", \$(this).closest("[data-seed-key]").data('seed-key'))
.dialog("open");
Expand Down
11 changes: 8 additions & 3 deletions openlibrary/templates/type/user/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ <h2>$_('Reading Log')</h2>

$if "lists" in ctx.features and lists:
<div id="listsDisplay">
<h2>$_('Lists')
<span class="sansserif small"><a href="$page.key/lists">$_('See all')</a></span>
</h2>
$if owners_page:
<h2>$_('My Lists')
<span class="sansserif small"><a href="$page.key/lists">$_('Edit')</a></span>
</h2>
$else:
<h2>$_('Lists')
<span class="sansserif small"><a href="$page.key/lists">$_('See all')</a></span>
</h2>
<div class="mybooks-list--clean mybooks-list">
<ul id="listResults">
$for list in lists:
Expand Down
84 changes: 68 additions & 16 deletions static/css/components/mybooks.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,71 @@
* http://localhost:8080/account/books/want-to-read
*/

// Layout
.mybooks {
display: flex;
flex-direction: row;
border-top: 0;
margin-top: 0;
font-size: .9em;
}
@media only screen and (max-width: @width-breakpoint-tablet) {
.mybooks {
flex-direction: column;
}
}
@import (less) "components/mybooks-list.less";
@import (less) "components/mybooks-menu.less";
@import (less) "components/mybooks-details.less";
// Layout
.mybooks {
display: flex;
flex-direction: row;
border-top: 0;
margin-top: 0;
font-size: .9em;
}

.sidebar-section a.dropclick {
display: none;
}
//.sidebar-section .arrow.arrow-activated {
// display: none;
//}

.sidebar-section .dropdown {
display: block !important;
}

.sidebar-section .dropdown .my-lists{
background-color: inherit !important;
padding: 0 !important;
}

.sidebar-section .dropper.on {
background-color: inherit !important;
box-shadow: none !important;
}

.sidebar-section .create {
float: left !important;
clear: both;
}

.sidebar-section .create-new-list {
align-items: center;
position: relative;
font-size: .875em !important;
width: 100%;
display: block;
border: 0;
border-radius: 5px;
//margin-top: 5px;
box-sizing: border-box;
cursor: pointer;
font-family: "Lucida Grande", Verdana, Geneva, Helvetica, Arial, sans-serif;
text-align: center;
padding: 7px;
white-space: nowrap;
line-height: 1.5em;
transition: background-color 0.2s;
background-color: #0376b8;
color: #fff !important;
text-decoration: none;
//max-width: 100px !important;
margin: auto !important;
font-weight: 700 !important;
}

@media only screen and (max-width: @width-breakpoint-tablet) {
.mybooks {
flex-direction: column;
}
}
@import (less) "components/mybooks-list.less";
@import (less) "components/mybooks-menu.less";
@import (less) "components/mybooks-details.less";

0 comments on commit 6f079bc

Please sign in to comment.