Skip to content

Commit

Permalink
Allow series and magazines tabs to be disabled in config
Browse files Browse the repository at this point in the history
  • Loading branch information
philborman committed May 9, 2017
1 parent 58a0ada commit c5dd150
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
33 changes: 33 additions & 0 deletions data/interfaces/bookstrap/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,39 @@ <h1>${title}</h1>
<input type="checkbox" id="book_img" name="book_img" value="1" ${checked} />
Show Book Images</label>
</div>
<div class="checkbox">
<%
if lazylibrarian.CONFIG['MAG_IMG'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<label for="mag_img" class="control-label">
<input type="checkbox" id="mag_img" name="mag_img" value="1" ${checked} />
Show Magazine Images</label>
</div>
<div class="checkbox">
<%
if lazylibrarian.CONFIG['SERIES_TAB'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<label for="series_tab" class="control-label">
<input type="checkbox" id="series_tab" name="series_tab" value="1" ${checked} />
Show Series</label>
</div>
<div class="checkbox">
<%
if lazylibrarian.CONFIG['MAG_TAB'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<label for="mag_tab" class="control-label">
<input type="checkbox" id="mag_tab" name="mag_tab" value="1" ${checked} />
Show Magazines</label>
</div>
<div class="form-group">
<label for="http_look">Interface:</label>
<select id="http_look" name="http_look" class="form-control">
Expand Down
27 changes: 27 additions & 0 deletions data/interfaces/default/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,33 @@ <h5>Appearance</h5>
<input type="checkbox" name="book_img" value=1 ${checked} />
<label> Show Book Images</label>
<br>
<%
if lazylibrarian.CONFIG['MAG_IMG'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<input type="checkbox" name="mag_img" value=1 ${checked} />
<label> Show Magazine Images</label>
<br>
<%
if lazylibrarian.CONFIG['SERIES_TAB'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<input type="checkbox" name="" value=1 ${checked} />
<label> Show Series</label>
<br>
<%
if lazylibrarian.CONFIG['MAG_TAB'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<input type="checkbox" name="" value=1 ${checked} />
<label> Show Magazines</label>
<br>
<h5>Interface: <select name="http_look" style="float:right;"></h5>
%for http_look in config['http_look_list']:
<%
Expand Down
8 changes: 8 additions & 0 deletions lazylibrarian/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
'MAG_SINGLE': ('bool', 'General', 1),
'AUTHOR_IMG': ('bool', 'General', 1),
'BOOK_IMG': ('bool', 'General', 1),
'MAG_IMG': ('bool', 'General', 1),
'SERIES_TAB': ('bool', 'General', 1),
'MAG_TAB': ('bool', 'General', 1),
'LAUNCH_BROWSER': ('bool', 'General', 1),
'API_ENABLED': ('bool', 'General', 0),
'API_KEY': ('str', 'General', ''),
Expand Down Expand Up @@ -661,7 +664,12 @@ def config_write():
SHOW_SERIES = len(series_list)
if CONFIG['ADD_SERIES']:
SHOW_SERIES = 1
if not CONFIG['SERIES_TAB']:
SHOW_SERIES = 0

SHOW_MAGS = len(CONFIG['MAG_DEST_FOLDER'])
if not CONFIG['MAG_TAB']:
SHOW_MAGS = 0

msg = None
try:
Expand Down
4 changes: 3 additions & 1 deletion lazylibrarian/webServe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,8 @@ def magazines(self):
this_mag['safetitle'] = urllib.quote_plus(mag['Title'].encode(lazylibrarian.SYS_ENCODING))
mags.append(this_mag)

if not lazylibrarian.CONFIG['MAG_IMG']:
covercount = 0
return serve_template(templatename="magazines.html", title="Magazines", magazines=mags, covercount=covercount)

@cherrypy.expose
Expand Down Expand Up @@ -1178,7 +1180,7 @@ def issuePage(self, title):
mod_issues.append(this_issue)
logger.debug("Found %s cover%s" % (covercount, plural(covercount)))

if lazylibrarian.CONFIG['IMP_CONVERT'] == 'None': # special flag to say "no covers required"
if not lazylibrarian.CONFIG['MAG_IMG'] or lazylibrarian.CONFIG['IMP_CONVERT'] == 'None':
covercount = 0

return serve_template(templatename="issues.html", title=title, issues=mod_issues, covercount=covercount)
Expand Down

0 comments on commit c5dd150

Please sign in to comment.