Working
Implementation of metadata for the exclusion of certain columns
This commit is contained in:
@@ -965,13 +965,14 @@ th.header {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
border-right: 1px solid #dad9c7;
|
border-right: 1px solid #dad9c7;
|
||||||
|
border-left: 1px solid #dad9c7;
|
||||||
margin-left: -1px;
|
margin-left: -1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
th.headerSortUp {
|
th.headerSortUp {
|
||||||
background: #3399FF url("data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7") no-repeat center right;
|
background: #F9F9F9 url("data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7") no-repeat center right;
|
||||||
}
|
}
|
||||||
|
|
||||||
th.headerSortDown {
|
th.headerSortDown {
|
||||||
background: #3399FF url("data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7") no-repeat center right;
|
background: #F9F9F9 url("data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7") no-repeat center right;
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Mini browser --
|
// -- Mini browser --
|
||||||
miniBrowser = function (root, url){
|
miniBrowser = function (root, url){
|
||||||
|
|||||||
116
templates/admin/default/assets/js/tablesorter/jquery.metadata.js
Normal file
116
templates/admin/default/assets/js/tablesorter/jquery.metadata.js
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Metadata - jQuery plugin for parsing metadata from elements
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 John Resig, Yehuda Katz, Jörn Zaefferer, Paul McLanahan
|
||||||
|
*
|
||||||
|
* Dual licensed under the MIT and GPL licenses:
|
||||||
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
||||||
|
* in the JSON will become a property of the element itself.
|
||||||
|
*
|
||||||
|
* There are three supported types of metadata storage:
|
||||||
|
*
|
||||||
|
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
||||||
|
*
|
||||||
|
* class: Inside the class attribute, wrapped in curly braces: { }
|
||||||
|
*
|
||||||
|
* elem: Inside a child element (e.g. a script tag). The
|
||||||
|
* name parameter indicates *which* element.
|
||||||
|
*
|
||||||
|
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
||||||
|
*
|
||||||
|
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
||||||
|
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
||||||
|
*
|
||||||
|
* @name $.metadata.setType
|
||||||
|
*
|
||||||
|
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||||
|
* @before $.metadata.setType("class")
|
||||||
|
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||||
|
* @desc Reads metadata from the class attribute
|
||||||
|
*
|
||||||
|
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||||
|
* @before $.metadata.setType("attr", "data")
|
||||||
|
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||||
|
* @desc Reads metadata from a "data" attribute
|
||||||
|
*
|
||||||
|
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
||||||
|
* @before $.metadata.setType("elem", "script")
|
||||||
|
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||||
|
* @desc Reads metadata from a nested script element
|
||||||
|
*
|
||||||
|
* @param String type The encoding type
|
||||||
|
* @param String name The name of the attribute to be used to get metadata (optional)
|
||||||
|
* @cat Plugins/Metadata
|
||||||
|
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
||||||
|
* @type undefined
|
||||||
|
* @see metadata()
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
$.extend({
|
||||||
|
metadata : {
|
||||||
|
defaults : {
|
||||||
|
type: 'class',
|
||||||
|
name: 'metadata',
|
||||||
|
cre: /(\{.*\})/,
|
||||||
|
single: 'metadata'
|
||||||
|
},
|
||||||
|
setType: function( type, name ){
|
||||||
|
this.defaults.type = type;
|
||||||
|
this.defaults.name = name;
|
||||||
|
},
|
||||||
|
get: function( elem, opts ){
|
||||||
|
var data, m, e, attr,
|
||||||
|
settings = $.extend({},this.defaults,opts);
|
||||||
|
// check for empty string in single property
|
||||||
|
if ( !settings.single.length ) { settings.single = 'metadata'; }
|
||||||
|
|
||||||
|
data = $.data(elem, settings.single);
|
||||||
|
// returned cached data if it already exists
|
||||||
|
if ( data ) { return data; }
|
||||||
|
|
||||||
|
data = "{}";
|
||||||
|
|
||||||
|
if ( settings.type === "class" ) {
|
||||||
|
m = settings.cre.exec( elem.className );
|
||||||
|
if ( m ) { data = m[1]; }
|
||||||
|
} else if ( settings.type === "elem" ) {
|
||||||
|
if( !elem.getElementsByTagName ) { return undefined; }
|
||||||
|
e = elem.getElementsByTagName(settings.name);
|
||||||
|
if ( e.length ) { data = $.trim(e[0].innerHTML); }
|
||||||
|
} else if ( elem.getAttribute !== undefined ) {
|
||||||
|
attr = elem.getAttribute( settings.name );
|
||||||
|
if ( attr ) { data = attr; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( data.indexOf( '{' ) <0 ) { data = "{" + data + "}"; }
|
||||||
|
|
||||||
|
data = eval("(" + data + ")");
|
||||||
|
|
||||||
|
$.data( elem, settings.single, data );
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the metadata object for the first member of the jQuery object.
|
||||||
|
*
|
||||||
|
* @name metadata
|
||||||
|
* @descr Returns element's metadata object
|
||||||
|
* @param Object opts An object contianing settings to override the defaults
|
||||||
|
* @type jQuery
|
||||||
|
* @cat Plugins/Metadata
|
||||||
|
*/
|
||||||
|
$.fn.metadata = function( opts ){
|
||||||
|
return $.metadata.get( this[0], opts );
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -118,9 +118,9 @@
|
|||||||
<section class="row-fluid">
|
<section class="row-fluid">
|
||||||
<div class="span12 general-block-decorator">
|
<div class="span12 general-block-decorator">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<caption>
|
<caption class="clearfix">
|
||||||
Rules
|
Rules
|
||||||
<a class="btn btn-primary btn-add-item" title="Add a new rule">
|
<a class="btn btn-primary pull-right" title="Add a new rule">
|
||||||
<span class="icon-plus-sign icon-white"></span>
|
<span class="icon-plus-sign icon-white"></span>
|
||||||
</a>
|
</a>
|
||||||
</caption>
|
</caption>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Expiration date</th>
|
<th>Expiration date</th>
|
||||||
<th>Usage left</th>
|
<th>Usage left</th>
|
||||||
<th>Actions</th>
|
<th class="{literal}{sorter: false}{/literal}">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Expiration date</th>
|
<th>Expiration date</th>
|
||||||
<th>Usage left</th>
|
<th>Usage left</th>
|
||||||
<th>Actions</th>
|
<th class="{literal}{sorter: false}{/literal}">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -180,6 +180,10 @@
|
|||||||
<script src="{$asset_url}"></script>
|
<script src="{$asset_url}"></script>
|
||||||
{/javascripts}
|
{/javascripts}
|
||||||
|
|
||||||
|
{javascripts file='../assets/js/tablesorter/jquery.metadata.js'}
|
||||||
|
<script src="{$asset_url}"></script>
|
||||||
|
{/javascripts}
|
||||||
|
|
||||||
{javascripts file='../assets/js/main.js'}
|
{javascripts file='../assets/js/main.js'}
|
||||||
<script src="{$asset_url}"></script>
|
<script src="{$asset_url}"></script>
|
||||||
{/javascripts}
|
{/javascripts}
|
||||||
|
|||||||
Reference in New Issue
Block a user