Skip to content

Commit

Permalink
EPUB Support
Browse files Browse the repository at this point in the history
  • Loading branch information
withanage committed May 30, 2017
1 parent 38a6bd1 commit 927adf1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions controllers/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ def book():
)
full_file = ompdal.getLatestRevisionOfFullBookFileByPublicationFormat(
submission_id, pf.publication_format_id)
full_epub_file = ompdal.getLatestRevisionOfEBook(submission_id, pf.publication_format_id)
if full_epub_file:
publication_format.associated_items['full_epub_file'] = OMPItem(
full_epub_file, OMPSettings(ompdal.getSubmissionFileSettings(full_epub_file.file_id)))

if full_file:
publication_format.associated_items['full_file'] = OMPItem(
full_file, OMPSettings(ompdal.getSubmissionFileSettings(full_file.file_id)))
Expand Down
2 changes: 1 addition & 1 deletion modules
Submodule modules updated 2 files
+1 −0 ompbrowse.py
+21 −0 ompdal.py
25 changes: 20 additions & 5 deletions views/catalog/book.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,23 @@ <h5 style="color: #656565; margin-bottom: 0.5em; margin-top: 1.2em;">ISBN</h5>
{{=T('Download')}}
<span class="caret"></span>
</button>
{{for pf in digital_publication_formats:}}
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
{{for pf in sorted(digital_publication_formats, key=lambda s: s.settings.getLocalizedValue('name', locale)):}}
{{format_name=pf.settings.getLocalizedValue('name', locale)}}
{{full_epub_file = pf.associated_items.get('full_epub_file')}}
{{if full_epub_file:}}
<li role="presentation"><a role="menuitem" tabindex="0" href="{{=downloadLink(request, full_epub_file.attributes, myconf.take('web.url'), full_epub_file.settings.getLocalizedValue("vgWortPublic", ""))}}">{{=format_name}}</a></li>
{{pass}}
{{full_file = pf.associated_items.get('full_file')}}
{{if full_file and not "html" in full_file.attributes.file_type and not "xml" in full_file.attributes.file_type:}}
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="{{=downloadLink(request, full_file.attributes, myconf.take('web.url'), full_file.settings.getLocalizedValue("vgWortPublic", ""))}}">{{=pf.settings.getLocalizedValue('name', locale)}}</a></li>
</ul>

<li role="presentation"><a role="menuitem" tabindex="-1" href="{{=downloadLink(request, full_file.attributes, myconf.take('web.url'), full_file.settings.getLocalizedValue("vgWortPublic", ""))}}">
{{=format_name}}</a></li>


{{pass}}
{{pass}}
</ul>
</div>
{{pass}}

Expand Down Expand Up @@ -187,7 +196,10 @@ <h4>{{=subtitle}}</h4>
<div class="chapter_row table_head">
<div class="chapter_cell">{{=T('Contents')}}</div>
{{for pf in digital_publication_formats:}}
<div class="chapter_cell">{{=TD(pf.settings.getLocalizedValue('name', locale))}}</div>
{{format_name=pf.settings.getLocalizedValue('name', locale)}}
{{if format_name != 'EPUB':}}
<div class="chapter_cell">{{=TD(format_name)}}</div>
{{pass}}
{{pass}}
</div>
{{display_authors=haveMultipleAuthors(chapters)}}
Expand All @@ -207,6 +219,8 @@ <h4>{{=subtitle}}</h4>
{{pass}}
</div>
{{for pf in digital_publication_formats:}}
{{format_name=pf.settings.getLocalizedValue('name', locale)}}
{{if format_name != 'EPUB':}}
<div class="chapter_cell">
{{if c_files:}}
{{c_file = c_files.get(pf.attributes.publication_format_id)}}
Expand All @@ -223,6 +237,7 @@ <h4>{{=subtitle}}</h4>
{{pass}}
</div>
{{pass}}
{{pass}}
</div>
{{pass}}
</div>
Expand Down

0 comments on commit 927adf1

Please sign in to comment.