Jump to content

Guides

Data Lists

Description

The data list CSS module allows us to display complex lists, while rearranging the display in situations that demand it, such as on small devices.

 

Usage

A data list consists of a wrapper and individual list items, which can contain various types of data. In most cases, a data list would use one of the HTML list elements (such as ul or ol) for semantic purposes, though this isn't necessarily required.

The basic markup structure is as follows:

<ol class='ipsDataList' itemscope itemtype="http://schema.org/ItemList">
	<meta itemprop="itemListOrder" content="Descending">
	<li class='ipsDataItem ipsDataItem_unread' itemprop="itemListElement">
		...
	</li>
	<li class='ipsDataItem' itemprop="itemListElement">
		...
	</li>
	<li class='ipsDataItem' itemprop="itemListElement">
		...
	</li>
</ol>

The root element should be given the classname ipsDataList. Individual list items receive the classname ipsDataItem. To indicate unread status within a row, add the class ipsDataItem_unread to the list item. The other elements in the row may style differently in 'unread' rows to indicate that status.

Within the ipsDataItem, multiple other elements can exist which (at desktop resolution) represent cells of data. On smaller devices, these elements reflow to give a more suitable layout. These elements are outlined below. An example of a data list row showing many of these options is shown here:

  1. Pre-sales questions

    Question before you purchase? Post here and get help from both IPS and from other clients. You can also email sales@invisionpower.com for assistance.

    18,852
    Posts

 

Row Spacing

By default, rows are comfortably spaced. An additional class ipsDataList_reducedSpacing is available where reduced horizontal cell padding is desired.

 

Zebra Striping

By default, zebra striping (alternate background colors) are not included on data lists. To add them, add the class ipsDataList_zebra to the data list wrapper.

 

Main content cell - ipsDataItem_main

Represents the primary data in the row, typically containing the row title and some metadata. Expands to take up whatever space is left by the remaining cells in the row. Example:

<div class='ipsDataItem_main'>
	<h4 class='ipsDataItem_title'><a href='#'>Item title</a></h4>
	<p class='ipsDataItem_meta'>
		By testadmin, yesterday, 2:21pm
	</p>
</div>

Within this cell, ipsDataItem_title defines the title element, while ipsDataItem_meta defines some non-specific metadata associated with the title.

In the main cell, a sub-list can be specified for data such as sub-forums or sub-albums. This should appear after the ipsDataItem_meta element. An example of the markup:

<ul class='<strong>ipsDataItem_subList</strong> ipsList_inline'>
	<li><a href='#'>Sub-item 1</a></li>
	<li class='ipsDataItem_unread'><a href='#'>Sub-item 2</a></li>
</ul>

 

Statistics cell - ipsDataItem_stats

This class is applied to an element which represents statistics for this row, such as the number of replies in a topic or the number of downloads a file has. An example of its usage:

<dl class='ipsDataItem_stats'>
	<dt class='ipsDataItem_stats_number'>18,852</dt>
	<dd class='ipsDataItem_stats_type'>Posts</dd>
</dl>

The data within this element is marked up with two additional classes:

  • ipsDataItem_stats_number - represents the actual statistical value
  • ipsDataItem_stats_type - represents the type of data

The additional class ipsDataItem_statsLarge can be added to the element where the statistic is particularly important. This significantly increases the font size of the value to help it stand out.

 

Last poster cell - ipsDataItem_lastPoster

Used to represent the 'last poster' information, such as in a topic or other record. An example of its use:

<ul class='<strong>ipsDataItem_lastPoster ipsDataItem_withPhoto</strong>'>
	<li><img src='images/photo.jpeg'></li>
	<li><a href='#'>Username</a></li>
	<li><time data-short='1 dy'>Time stamp</time></li>
</ul>

Within this element are two or three more elements. If the ipsDataItem_withPhoto class is used, the first element should contain a user photo, otherwise, the first element can be omitted. The second element typically will contain the username, while the last will contain the time information.

The last element contains a time element with a data-short attribute. This attibute should contain a very short representation of the date/time, and it is used on small devices. The PHP framework generates these for you.

 

Generic cells

A number of generic cell sizes are available for custom types of data. The cell should contain the class ipsDataItem_generic and one of the following classes:

  • ipsDataItem_size1 - 50px
  • ipsDataItem_size2 - 75px
  • ipsDataItem_size3 - 100px
  • ipsDataItem_size4 - 125px
  • ipsDataItem_size5 - 150px
  • ipsDataItem_size6 - 175px
  • ipsDataItem_size7 - 200px
  • ipsDataItem_size8 - 225px
  • ipsDataItem_size9 - 250px

 

Other cell types

In addition to the main cell types above, there are additional cell classes that can be used.

  • ipsDataItem_icon - A column which contains a status icon for the row, such as a forum icon
  • ipsDataItem_modCheck - A narrow column that should hold a moderator checkbox to select the row

 

Coloring rows

Four additional classes are available to optionally add a background color to the row to denote status:

  • ipsDataItem_new - New items
  • ipsDataItem_warning - Items showing a warning state
  • ipsDataItem_error  - Items with an error
  • ipsDataItem_info - An informational state

 

Putting it together

Here is the code for the example shown at the top of the page:

<ol class='ipsDataList'>
	<li class='ipsDataItem ipsClearfix ipsDataItem_unread'>
		<div class='ipsDataItem_main'>
			<h4 class='ipsDataItem_title'><a href='#'>Pre-sales questions</a></h4>
			<p class='ipsDataItem_meta'>
				Question before you purchase? Post here and get help from both IPS and from other clients. You can also email sales@invisionpower.com for assistance.
			</p>
			<ul class='ipsDataItem_subList ipsList_inline'>
				<li><a href='#'>Company Feedback</a></li>
				<li class='ipsDataItem_unread'><a href='#'>General Suite Feedback</a></li>
			</ul>
		</div>
		<dl class='ipsDataItem_stats ipsDataItem_statsLarge'>
			<dt class='ipsDataItem_stats_number'>18,852</dt>
			<dd class='ipsDataItem_stats_type ipsType_light'>Posts</dd>
		</dl>
		<ul class='ipsDataItem_lastPoster ipsDataItem_withPhoto'>
			<li><a href='#' class='ipsUserPhoto ipsUserPhoto_mini ipsPos_left'><img src='image.jpg' alt=''></a></li>
			<li><a href='#'>BBCode’s description variable</a></li>
			<li>By <a href='#'>admin</a></li>
			<li><time class='ipsType_light' data-short='1 dy'>Yesterday</time></li>
		</ul>
		<div class='ipsDataItem_modCheck'>
			<input type='checkbox' checked>
		</div>
	</li>
</ol>

 


  Report Guide


×