Patterns
Patterns are what emerge when using the foundation elements together with basic objects like buttons and alerts, more complex Javascript components from Bootstrap like tooltips and dropdowns, and AJAX components from PrimeFaces like datatables and commandlinks.
Tables
Most tables use the DataTable components from PrimeFaces and are styled using the Tables component from Bootstrap.
<p:dataTable id="itemTable" styleClass="headerless-table margin-top" value="#{page.item}" var="item" widgetVar="itemTable">
<p:column>
...
</p:column>
</p:dataTable>
Forms
Forms fulfill various functions across the site, but we try to style them consistently. We use the .form-horizontal
layout, which uses .form-group
to create a grid of rows for the labels and inputs. The consistent style of forms is maintained using the Forms component from Bootstrap. Form elements like the InputText component from PrimeFaces are kept looking clean and consistent across each page.
<div class="form-horizontal">
<div class="form-group">
<label for="userNameEmail" class="col-sm-3 control-label">
#{bundle['user.username']}
</label>
<div class="col-sm-4">
<p:inputText id="userName" styleClass="form-control"></p>
</div>
</div>
</div>
Here are additional form elements that are common across many pages, including required asterisks, icon tooltips, placeholder text, input info message with popover link, and validation error message.
This field supports only certain HTML tags.
<div class="form-group form-col-container col-sm-9 edit-compound-field">
<div class="form-col-container col-sm-12">
<p class="help-block">
<h:outputFormat value="#{bundle.htmlAllowedMsg}" escape="false">
<f:param value="#{bundle.htmlAllowedTags}"/>
</h:outputFormat>
</p>
<label class="control-label" for="metadata_#{subdsf.datasetFieldType.name}">
#{subdsf.datasetFieldType.localeTitle}
<h:outputText styleClass="glyphicon glyphicon-asterisk text-danger" value="" />
<span class="glyphicon glyphicon-question-sign tooltip-icon" data-toggle="tooltip" data-placement="auto right" data-original-title="#{subdsf.datasetFieldType.localeDescription}"></span>
</label>
<div>
<p:inputTextarea value="#{dsfv.valueForEdit}" id="description" tabindex="#{block.index+1}" rows="5" cols="60" styleClass="form-control" />
<div class="alert-danger" jsf:rendered="#{!empty subdsf.validationMessage}">
<strong>#{subdsf.validationMessage}</strong>
</div>
</div>
</div>
</div>
Pagination
We use the Pagination component from Bootstrap for paging through search results.
<ul class="pagination">
<li class="#{include.page == '1' ? 'disabled' : ''}">
<h:outputLink value="#{page.page}">
<h:outputText value="«"/>
...
</h:outputLink>
</li>
<li class="#{include.page == '1' ? 'disabled' : ''}">
<h:outputLink value="#{page.page}">
<h:outputText value="< #{bundle.previous}"/>
...
</h:outputLink>
</li>
...
<li class="#{include.page == include.totalPages ? 'disabled' : ''}">
<h:outputLink value="#{page.page}">
<h:outputText value="#{bundle.next} >"/>
...
</h:outputLink>
</li>
<li class="#{include.page == include.totalPages ? 'disabled' : ''}">
<h:outputLink value="#{page.page}">
<h:outputText value="»"/>
...
</h:outputLink>
</li>
</ul>
Labels
The Labels component from Bootstrap is used for publication status (DRAFT, In Review, Unpublished, Deaccessioned), and Dataset version, as well as Tabular Data Tags (Survey, Time Series, Panel, Event, Genomics, Network, Geospatial).
<span class="label label-default">Version 2.0</span>
<span class="label label-primary">DRAFT</span>
<span class="label label-success">In Review</span>
<span class="label label-info">Geospatial</span>
<span class="label label-warning">Unpublished</span>
<span class="label label-danger">Deaccessioned</span>
Alerts
For our help/information, success, warning, and error message blocks we use a custom built UI component based on the Alerts component from Bootstrap.
<div class="alert alert-success" role="alert">...</div>
<div class="alert alert-info" role="alert">...</div>
<div class="alert alert-warning" role="alert">...</div>
<div class="alert alert-danger" role="alert">...</div>
Message Classes
Style classes can be added to p
, div
, span
and other elements to add emphasis to inline message blocks.
Select Dataverse collections to feature on the homepage of this Dataverse collection.
Search query returned 1,000 datasets!
Permissions with an asterisk icon indicate actions that can be performed by users not logged into the Dataverse installation.
Are you sure you want to remove all roles for user dataverseUser?
Please select two versions to view the differences.
<p class="help-block">
<span class="text-muted">...</span>
</p>
<p class="help-block">
<span class="glyphicon glyphicon-ok-sign text-success"></span> <span class="text-success">...</span>
</p>
<p class="help-block">
<span class="glyphicon glyphicon-asterisk text-info"></span> <span class="text-info">...</span>
</p>
<p class="help-block">
<span class="glyphicon glyphicon-warning-sign text-warning"></span> <span class="text-warning">...</span>
</p>
<p class="help-block">
<span class="glyphicon glyphicon-exclamation-sign text-danger"></span> <span class="text-danger">...</span>
</p>
Images
For images, we use the GraphicImage component from PrimeFaces, or the basic JSF GraphicImage component.
To display images in a responsive way, they are styled with .img-responsive
, an Images CSS class from Bootstrap.
<p:graphicImage styleClass="img-responsive" value="#{Page.imageId}?imageThumb=400" />
Panels
The most common of our containers, the Panels component from Bootstrap is used to add a border and padding around sections of content like metadata blocks. Displayed with a header and/or footer, it can also be used with the Collapse plugin from Bootstrap.
<div class="panel panel-default">
<div class="panel-body">
Basic panel example
</div>
</div>
<div class="panel panel-default">
<div data-toggle="collapse" data-target="#panelCollapse0" class="panel-heading">
<span class="text-info">Panel Heading  <span class="glyphicon glyphicon-chevron-up"/></span>
</div>
<div id="panelCollapse0" class="panel-body form-horizontal collapse in">
<div class="form-group">
<label class="col-sm-4 control-label">
Label
</label>
<div class="col-sm-6">
Value
</div>
</div>
</div>
</div>
Tabs
Tabs are used to provide content panes on a page that allow the user to view different sections of content without navigating to a different page.
We use the TabView component from PrimeFaces, which is styled using the Tab component from Bootstrap.
<p:tabView id="tabView" widgetVar="content" activeIndex="#{Page.selectedTabIndex}">
<p:ajax event="tabChange" listener="#{Page.tabChanged}" update="@this" />
<p:tab id="dataTab" title="#{bundle.files}">
...
</p:tab>
...
</p:tabView>
Modals
Modals are dialog prompts that act as popup overlays, but don’t create a new browser window. We use them for confirmation on a delete to make sure the user is aware of the consequences of their actions. We also use them to allow users to execute simple actions on a page without requiring them to navigate to and from a separate page.
Buttons usually provide the UI prompt. A user clicks the button, which then opens a Dialog component or Confirm Dialog component from PrimeFaces that displays the modal with the necessary information and actions to take.
The modal is styled using the Modal component from Bootstrap, for a popup window that prompts a user for information, with overlay and a backdrop, then header, content, and buttons. We can use style classes from Bootstrap for large (.bs-example-modal-lg
) and small (.bs-example-modal-sm
) width options.
<!-- Large modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>
<div class="modal bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
...
</div>
</div>
</div>