Skip to content

Creating a new content submodule

Winona Salesky edited this page Mar 27, 2017 · 5 revisions

Creating a new Syriaca.org submodule

Add data to your app

In the your data directory (see: https://github.com/srophe/srophe-app-data for an examaple) create new subfolder in app-data/data/MODULE-NAME/tei

Follow Syriaca.org TEI conventions for data creation. (https://github.com/srophe/srophe-app-data/wiki)

Access data from the web app

Create new directory in srophe/MODULE-NAME Copy the following files from srophe/mss

  • index.html
  • browse.html
  • search.html
  • Copy rec.html from srophe/rec.html into newly created directory.

Add a new module template to srophe/templates. _This template specifies branding, css and top level navigation for the submodule. You can copy page.html and make changes to branding and navigation as necessary. _

Changes:

index.html

In the root element on index.html change data-template-with="templates/manuscripts.html" to corresponding page in srophe/templates (default is page.html).

Replace content of index.html with new module content.

rec.html

In the root element on index.html change data-template-with="templates/manuscripts.html" to corresponding page in srophe/templates (default is page.html).

This page controls the output of your TEI record. Full record is the default output, to change the element order, or to add additional functionality such as timelines, maps or relationship visualizations you add them to this page.

The following data functions are available to this page: TO COME

HTML conversion of TEI elements is handled by srophe/resources/xsl/tei2html.xsl, to change how or which elements are displaying (not all TEI elements are included in our xslt) edit this stylesheet.

browse.html

In the root element on index.html change data-template-with="templates/manuscripts.html" to corresponding page in srophe/templates (default is page.html).

Change the data-template-collection from “manuscripts” to “subjects”: <div data-template="browse:get-all" data-template-collection="manuscripts"> to <div data-template="browse:get-all" data-template-collection="subjects"> This value corresponds to the eXistdb collection that the data lives in. If not specified the browse path will start at /srophe-data/data

search.html

Change all data-template-collection attributes to match the directory the data for the new module is stored in: ie <div data-template="browse:get-all" data-template-collection="manuscripts"> To <div data-template="browse:get-all" data-template-collection="subjects">

To add/customize new search fields create a search-config.xml file in the new module directory.

search-config.xml example:

<search-config>
    <label>Search Subjects</label>
    <desc>More detailed search functions are available in each individual <a href="/">publication</a>.</desc>
    <!-- Keyword -->                            
    <input type="text" label="Headword" name="headword" element="tei:term[@type='headword']" keyboard="yes"/>
    <input type="text" label="Keyword" element="." name="qs" keyboard="yes"/>
    <input type="text" label="Related terms" element="tei:entryFree/tei:gloss/tei:term" name="related-terms" keyboard="yes"/>
</search-config>

Optional Add facets:

Add a facet-definition.xml file to the module subdirectory. Facets should be defined according to the EXPath specifications: http://expath.org/spec/facet

See example:

<facets xmlns="http://expath.org/ns/facet">
    <facet-definition name="Century">
        <range type="xs:year">
            <bucket lt="0001" name="BC dates" order="22"/>
            <bucket gt="0001-01-01" lt="0100-01-01" name="1-100" order="21"/>
        </range>
        <group-by type="xs:date">
            <sub-path>/@syriaca-computed-start</sub-path>
        </group-by>
        <max-values show="5">40</max-values>
        <order-by direction="descending">order</order-by>
    </facet-definition>
    <facet-definition name="Sex or Gender">
        <group-by>
            <sub-path>descendant::tei:sex/text()</sub-path>
        </group-by>
        <max-values show="5">40</max-values>
        <order-by direction="ascending">count</order-by>
    </facet-definition>
</facets>
Clone this wiki locally