Skip to content

Modifications for Preview page

Context

Some modifications needed in either the client side as well as the server side for the export/preview functionality. The changes should be implemented in:

Proposal

Design

Implementation (if applicable)

  • The queries that we need here are getSpecificTemplates, getPagedPreviewerLink, and exportBook. For the exportBook mutation an example can be found here
  • The getSpecificTemplates query should take as arguments the following $where:TemplatesWhereInput! (this new query as well as the new input should be created in the server, see below).
  • Create a new query here called getSpecificTemplates the output of that should be [Template!]
  • Create a new type here called TemplatesWhereInput with properties target:String! and trimSize:String
  • Implement the logic in this controller file which will interact with the db and it will return all the templates of a given target (e.g. pagedjs, epub) and more specifically for the case of target pagedjs and only for that trimSize should be used too. As an example the existing getTemplates should be used.
  • Remove mode from here, here and here
  • Create a new input declaration here with name AdditionalExportOptionsInput and properties includeTOC:Boolean, includeCopyrights:Boolean, includeTitlePage:Boolean
  • Add property additionalExportOptions here of type AdditionalExportOptionsInput
  • Make sure that after all the changes above you also update previewer.queries.js with the new types/inputs and declarations

Alternative approaches (if applicable)

Edited by Alexandros Georgantas