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.

DatasetSummaryPublished
3.0 Files (Changed File Metadata: 1); View Details March 8, 2017
2.0 Additional Citation Metadata: (1 Added); View Details January 25, 2017
1.1Additional Citation Metadata: (1 Added); View Details October 25, 2016
1.0 This is the first published version. September 19, 2016
<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.

Description Text is required.
<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>

Buttons

There are various types of buttons for various actions, so we have many components to use, including the CommandButton component and CommandLink component from PrimeFaces, as well as the basic JSF Link component and OutputLink component. Those are styled using the Buttons component, Button Groups component and Buttons Dropdowns component from Bootstrap.

Action Buttons

For action buttons on a page, we include an icon and text label. Action buttons are generally aligned to the right side of the page.

<div class="btn-group" jsf:rendered="#{true}">
  <button type="button" id="editDataSet" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
    <span class="glyphicon glyphicon-pencil"/> Edit <span class="caret"></span>
  </button>
  <ul class="dropdown-menu pull-right text-left" role="menu">
    <li>
      <h:outputLink> ... </h:outputLink>
    </li>
    <li class="dropdown-submenu pull-left">
      <a tabindex="-1" href="#">Option</a>
      <ul class="dropdown-menu">
        <li>
          <h:link> ... </h:link>
        </li>
        <li>
          <h:link> ... </h:link>
        </li>
      </ul>
    </li>
    ...
  </ul>
</div>

Form Buttons

Form buttons typically appear at the bottom of a form, aligned to the left. They do not have icons, just text labels.

<div class="button-block">
  <p:commandButton id="save" styleClass="btn btn-default" value="#{bundle.saveChanges}" action="#{page.save}" update="@form,:messagePanel" />
  <p:commandButton id="cancel" styleClass="btn btn-default" value="#{bundle.cancel}" action="#{page.cancel}" process="@this" update="@form">
    <p:resetInput target="@form" />
  </p:commandButton>
</div>

Icon-Only Buttons

There are a few places where we use icon-only buttons with no text label. For these buttons, we do utilize tooltips that display on hover, containing a text label.

We use the style class .no-text with the .glyphicon class to fix spacing issues from margins and padding applied to buttons with text labels.

<p:commandLink styleClass="btn btn-default btn-sm bootstrap-button-tooltip" title="#{bundle.add}" actionListener="#{Page.add(valCount.index + 1)}">
  <h:outputText styleClass="glyphicon glyphicon-plus no-text"/>
</p:commandLink>
<p:commandLink styleClass="btn btn-default btn-sm bootstrap-button-tooltip" title="#{bundle.delete}" actionListener="#{Page.remove(valCount.index)}">
  <h:outputText styleClass="glyphicon glyphicon-minus no-text"/>
</p:commandLink>

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).

Version 2.0 DRAFT In Review Geospatial Unpublished Deaccessioned
<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.

 Edit Dataset Metadata - Add more metadata about this dataset to help others easily find it.
 Success! – The metadata for this dataset has been updated.
 File Upload in Progress – This dataset is locked while the data files are being transferred and verified.
 Error – The username, email address, or password you entered is invalid. Need assistance accessing your account? If you believe this is an error, please contact Root Support for assistance.
<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 dataverses to feature on the homepage of this dataverse.

Search query returned 1,000 datasets!

Permissions with an asterisk icon indicate actions that can be performed by users not logged into Dataverse.

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.

image-responsive
<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.

Basic panel example
Panel Heading  
<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 &#160;<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>