Owen Leonard
eb92d94be1
The goal of this theme is to provide a fully-responsive OPAC which offers a high level of functionality across multiple devices with varied viewport sizes. Its style is based on the CCSR theme, with elements of the Bootstrap framework providing default styling of buttons, menus, modals, etc. The Bootstrap grid is used everywhere, but Bootstrap's default responsive breakpoints have been expanded to allow for better flexibility for our needs. All non-translation-depended files are in the root directory of this new theme: css, images, itemtypeimg, js, less, and lib. Languages.pm has been modified to ignore the new directories when parsing the theme language directories. This theme introduces the use of LESS (http://lesscss.org/) to build CSS. Three LESS files can be found in the "less" directory: mixins.less, opac.less, and responsive.less. These three files are compiled into one CSS file for production: opac.css. "Base" theme styles are found in opac.less. A few "mixins" (http://lesscss.org/#-mixins) are found in mixins.less. Any CSS which is conditional on specific media queries is found in responsive.less. At the template level some general sturctural changes have been made. For the most part JavaScript is now at the end of each template as is recommended for performance reasons. JavaScript formerly in doc-head-close.inc is now in opac-bottom.inc. In order to be able to maintain this structure and accommodate page-specific scripts at the same time the use of BLOCK and PROCESS are added. By default opac-bottom.inc will PROCESS a "jsinclude" block: [% PROCESS jsinclude %] Each page template in the theme must contain this block, even if it is empty: [% BLOCK jsinclude %][% END %] Pages which require that page-specific JavaScript be inserted can add it to the jsinclude block and it will appear correctly at the bottom of the rendered page. The same is true for page-specific CSS. Each page contains a cssinclude block: [% BLOCK cssinclude %][% END %] ...which is processed in doc-head-close.inc: [% PROCESS cssinclude %] Using these methods helps us maintain a strict separation of CSS links and blocks (at the top of each page) and JavaScript (at the bottom). A few exceptions are made for some JavaScript which must be processed sooner: respond.js (https://github.com/scottjehl/Respond, conditionally applied to Internet Explorer versions < 9 to allow for layout responsiveness), the _() function required for JS translatability, and Modernizr (http://modernizr.com/, a script which detects browser features and allows us to conditionally load JavaScript based on available features--or lack thereof). Another new JavaScript dependency in this theme is enquire.js (http://wicky.nillia.ms/enquire.js/), which lets us trigger JavaScript events based on viewport size. I have made an effort to re-indent the templates in a sane way, eliminating trailing spaces and tabs. However, I have not wrapped lines at a specific line length. In order to improve template legibility I have also tried to insert comments indicating the origin of closing tags like <div> or template directives like [% END %]: </div> <!-- / .container-fluid --> [% END # / IF ( OpacBrowseResults && busc ) %] TESTING Proper testing of this theme is no easy task: Every template has been touched. Each page should work reasonable well at a variety of screen dimensions. Pages should be tested under many conditions which are controlled by toggling OPAC system preferences on and off. A variety of devices, platforms, and browsers should be tested. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
100 lines
No EOL
3.6 KiB
JavaScript
100 lines
No EOL
3.6 KiB
JavaScript
// These default options are for translation but can be used
|
|
// for any other datatables settings
|
|
// MSG_DT_* variables comes from datatables-strings.inc
|
|
// To use it, write:
|
|
// $("#table_id").dataTable($.extend(true, {}, dataTableDefaults, {
|
|
// // other settings
|
|
// } ) );
|
|
var dataTablesDefaults = {
|
|
"oLanguage": {
|
|
"oPaginate": {
|
|
"sFirst" : window.MSG_DT_FIRST || "First",
|
|
"sLast" : window.MSG_DT_LAST || "Last",
|
|
"sNext" : window.MSG_DT_NEXT || "Next",
|
|
"sPrevious" : window.MSG_DT_PREVIOUS || "Previous"
|
|
},
|
|
"sEmptyTable" : window.MSG_DT_EMPTY_TABLE || "No data available in table",
|
|
"sInfo" : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries",
|
|
"sInfoEmpty" : window.MSG_DT_INFO_EMPTY || "No entries to show",
|
|
"sInfoFiltered" : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)",
|
|
"sLengthMenu" : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries",
|
|
"sLoadingRecords" : window.MSG_DT_LOADING_RECORDS || "Loading...",
|
|
"sProcessing" : window.MSG_DT_PROCESSING || "Processing...",
|
|
"sSearch" : window.MSG_DT_SEARCH || "Search:",
|
|
"sZeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found"
|
|
},
|
|
// "aaSorting": [$(" - select row position of th -")],
|
|
"sDom": 't',
|
|
"bPaginate": false,
|
|
// "fnHeaderCallback": function() {
|
|
// return $('th.sorting.nosort,th.sorting_desc.nosort,th.sorting_asc.nosort').removeClass("sorting sorting_desc sorting_asc").unbind("click");
|
|
// }
|
|
};
|
|
|
|
/* Plugin to allow sorting on data stored in a span's title attribute
|
|
*
|
|
* Ex: <td><span title="[% ISO_date %]">[% formatted_date %]</span></td>
|
|
*
|
|
* In DataTables config:
|
|
* "aoColumns": [
|
|
* { "sType": "title-string" },
|
|
* ]
|
|
* http://datatables.net/plug-ins/sorting#hidden_title_string
|
|
*/
|
|
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
|
|
"title-string-pre": function ( a ) {
|
|
return a.match(/title="(.*?)"/)[1].toLowerCase();
|
|
},
|
|
|
|
"title-string-asc": function ( a, b ) {
|
|
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
|
},
|
|
|
|
"title-string-desc": function ( a, b ) {
|
|
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
|
}
|
|
} );
|
|
|
|
(function() {
|
|
|
|
/* Plugin to allow text sorting to ignore articles
|
|
*
|
|
* In DataTables config:
|
|
* "aoColumns": [
|
|
* { "sType": "anti-the" },
|
|
* ]
|
|
* Based on the plugin found here:
|
|
* http://datatables.net/plug-ins/sorting#anti_the
|
|
* Modified to exclude HTML tags from sorting
|
|
* Extended to accept a string of space-separated articles
|
|
* from a configuration file (in English, "a," "an," and "the")
|
|
*/
|
|
|
|
if(CONFIG_EXCLUDE_ARTICLES_FROM_SORT){
|
|
var articles = CONFIG_EXCLUDE_ARTICLES_FROM_SORT.split(" ");
|
|
var rpattern = "";
|
|
for(i=0;i<articles.length;i++){
|
|
rpattern += "^" + articles[i] + " ";
|
|
if(i < articles.length - 1){ rpattern += "|"; }
|
|
}
|
|
var re = new RegExp(rpattern, "i");
|
|
}
|
|
|
|
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
|
|
"anti-the-pre": function ( a ) {
|
|
var x = String(a).replace( /<[\s\S]*?>/g, "" );
|
|
var y = x.trim();
|
|
var z = y.replace(re, "").toLowerCase();
|
|
return z;
|
|
},
|
|
|
|
"anti-the-asc": function ( a, b ) {
|
|
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
|
},
|
|
|
|
"anti-the-desc": function ( a, b ) {
|
|
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
|
}
|
|
});
|
|
|
|
}()); |