test/dummy/tmp/cache/assets/E8C/480/sprockets%2Fdacb331ac961cf7b7cbc69abe8fb74dd in cytoplasm-0.2.8 vs test/dummy/tmp/cache/assets/E8C/480/sprockets%2Fdacb331ac961cf7b7cbc69abe8fb74dd in cytoplasm-0.2.9

- old
+ new

@@ -1,8 +1,8 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1359747859.0577312: @value"Æ{I" +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1360345539.8455548: @value"{I" class:EFI"BundledAsset;FI"logical_path;FI"cytoplasm/cytoTable.js;FI" pathname;FI"f/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoTable.js.erb;FI"content_type;FI"application/javascript;FI" -mtime;FI"2013-02-01T14:44:16-05:00;FI" length;FiÙ I" digest;F"%32584d00801805c357eb18e75c2ab7a8I" source;FI"Ù // CytoTable v0.1 +mtime;FI"2013-02-08T12:45:39-05:00;FI" length;Fi!I" digest;F"%abde8fbffee4cb61b5e4646a2fecb3eaI" source;FI"!// CytoTable v0.1 // By MacKinley Smith (function($){ var defaults = { widget:{ table:{ @@ -25,25 +25,42 @@ }, elements:[], types:{ header:{ css:{}, - tag:"h3" + tag:{ + css:{ + margin:0, + padding:0 + }, + type:"h3" + } }, icon:{ css:{ width:16, cursor:'pointer' + }, + hover:{ + + }, + img:{ + css:{ + opacity:0.5 + }, + hover:{ + opacity:0.8 + } } }, info:{ css:{} }, label:{ css:{ - width:100, font:"13px TitilliumTextLight", + width:100 } } } } } @@ -84,34 +101,71 @@ switch (type) { case "header": td.attr('colspan',colspan); var tag = settings.widget.table.tr.td.types.header.tag; if (td.data('tag')!=null) tag = td.data('tag'); + + // Find or create tag if (!td.children(tag).length) { tag = $('<'+tag+'>').html(td.html()) td.html("").append(tag); - } else { - tag = td.children(tag); - tag.css("margin",0); - } + } else tag = td.children(tag); + + // Apply styling + tag.css({margin:0,padding:0}); break; case "icon": - + var img = td.children("img").css(settings.widget.table.tr.td.types.icon.img.css); + var originalBg = $.Color(td,"background-color"); + var darkenedBg = originalBg.lightness("-=100"); + //console.log(originalBg); + td.hover(function(e){ + td.css("background-color",darkenedBg).css(settings.widget.table.tr.td.types.icon.hover); + img.css(settings.widget.table.tr.td.types.icon.img.hover); + },function(e){ + td.css("background-color",originalBg).css(settings.widget.table.tr.td.types.icon.css); + img.css(settings.widget.table.tr.td.types.icon.img.css); + }); break; case "info": td.attr('colspan',colspan); break; - case "label": + break; } } }); $this.data('cytoTable',settings); }); }, + setIconClick:function(icon,click){ + if (typeof icon != "string") return console.warn("$.CytoTable's setIconClick method requires a string to be passed as the first parameter!"); + if (typeof click != "function") return console.warn("$.CytoTable's setIconClick method requires a function to be passed as the second parameter!"); + return $(this).each(function(){ + var $this = $(this); + var settings = $this.data('cytoTable',settings); + if (settings==null) return console.warn("You must initialize $.CytoTable before you can call the setIconClick method!"); + + // Attempt to find the iconcell + var iconcell = $this.find('td[data-type=icon][title="'+icon+'"]'); + if (!iconcell.is("*")) return console.warn("This CytoTable does not have a '"+icon+"' icon."); + + // Assign the click handler + iconcell.unbind("click.cytoTable-iconClick").bind("click.cytoTable-iconClick",click); + }); + }, + setIconClicks:function(icons){ + if (typeof icons != "object") return console.warn("$.CytoTable's setIconClicks method requires an object to be passed as the first parameter!"); + return this.each(function(){ + var $this = $(this); + var settings = $this.data('cytoTable',settings); + if (settings==null) return console.warn("You must initialize $.CytoTable before you can call the setIconClicks method!"); + $.each(icons,function(icon,click){methods.setIconClick.apply($this,[icon,click]);}); + }); + }, resize:function(){ return this.each(function(){ }); }, @@ -129,6 +183,6 @@ }; $(window).resize(function(){$('.cytoTable').cytoTable('resize');}); $.Cytoplasm("ready",function(){$('.cytoTable').cytoTable();}); })(jQuery); -;FI"required_assets_digest;F"%6a9cca55b02a7369c33214c39a578636I" _version;F"%6776f581a4329e299531e1d52aa59832 +;FI"required_assets_digest;F"%f5742a47e7d58b564afeb81ea7a42defI" _version;F"%6776f581a4329e299531e1d52aa59832 \ No newline at end of file