<%= stylesheet_link_tag "scaffold" %>
- <%= javascript_include_tag 'jquery', 'jquery.cookie', 'jrails' %>
+ <%= javascript_include_tag 'jquery-1.4.2.min', 'jquery.cookie' %>
<%= @page_title -%>
diff --git a/app/views/layouts/standard.html.erb b/app/views/layouts/standard.html.erb
index 45e832ff..8de0db59 100644
--- a/app/views/layouts/standard.html.erb
+++ b/app/views/layouts/standard.html.erb
@@ -2,10 +2,11 @@
- <%= stylesheet_link_tag 'standard','superfish','niftyCorners','jquery-ui', 'jquery.autocomplete', :cache => true %>
+ <%= stylesheet_link_tag 'standard','superfish','niftyCorners', 'jquery-ui-1.8.5.custom', :cache => true %>
<%= stylesheet_link_tag "print", :media => "print" %>
- <%= javascript_include_tag 'jquery','jquery-ui','jquery.cookie', 'jquery.blockUI','jquery.jeditable','jquery.autocomplete', 'jquery.truncator', 'jrails', :cache => 'jquery-all' %>
- <%= javascript_include_tag 'hoverIntent','superfish','application', 'accesskey-hints','niftycube','swfobject', :cache => 'tracks' %>
+ <%= javascript_include_tag 'jquery-1.4.2.min', 'jquery-ui-1.8.5.custom.min', 'jquery.truncator', 'jquery.jeditable.mini', 'jquery.cookie', :cache => 'jquery-all' %>
+ <%= javascript_include_tag 'hoverIntent','superfish','application',
+ 'accesskey-hints','niftycube','swfobject', :cache => 'tracks' %>
<%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %>
<%= javascript_tag "var SOURCE_VIEW = '#{@source_view}';" %>
<%= javascript_tag "var TAG_NAME = '#{@tag_name}';" if @tag_name %>
diff --git a/public/javascripts/jquery.cookie.js b/public/javascripts/jquery.cookie.js
new file mode 100644
index 00000000..76fb2c59
--- /dev/null
+++ b/public/javascripts/jquery.cookie.js
@@ -0,0 +1,145 @@
+/**
+ * Cookie plugin
+ *
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+/**
+ * Create a cookie with the given name and value and other optional parameters.
+ *
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Set the value of a cookie.
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
+ * @desc Create a cookie with all available options.
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Create a session cookie.
+ * @example $.cookie('the_cookie', null);
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
+ * used when the cookie was set.
+ *
+ * @param String name The name of the cookie.
+ * @param String value The value of the cookie.
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
+ * when the the browser exits.
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
+ * require a secure protocol (like HTTPS).
+ * @type undefined
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+
+/**
+ * Create multiple cookies at once stored in an object, with optional parameters affecting them all.
+ *
+ * @example $.cookie({ 'the_cookie' : 'the_value' });
+ * @desc Set/delete multiple cookies at once.
+ * @example $.cookie({ 'the_cookie' : 'the_value' }, { expires: 7, path: '/', domain: 'jquery.com', secure: true });
+ * @desc Set/delete multiple cookies with options.
+ *
+ * @param Object name An object with multiple cookie name-value pairs.
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
+ * when the the browser exits.
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
+ * require a secure protocol (like HTTPS).
+ * @type undefined
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+
+/**
+ * Get the value of a cookie with the given name.
+ *
+ * @example $.cookie('the_cookie');
+ * @desc Get the value of a cookie.
+ *
+ * @param String name The name of the cookie.
+ * @return The value of the cookie.
+ * @type String
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+
+/**
+ * Get the names and values of all cookies for the page.
+ *
+ * @example $.cookie();
+ * @desc Get all the cookies for the page
+ *
+ * @return an object with the name-value pairs of all available cookies.
+ * @type Object
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+
+
+jQuery.cookie = function(name, value, options) {
+ if (typeof value != 'undefined' || (name && typeof name != 'string')) { // name and value given, set cookie
+ if (typeof name == 'string') {
+ options = options || {};
+ if (value === null) {
+ value = '';
+ options.expires = -1;
+ }
+ var expires = '';
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
+ var date;
+ if (typeof options.expires == 'number') {
+ date = new Date();
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
+ } else {
+ date = options.expires;
+ }
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
+ }
+ // CAUTION: Needed to parenthesize options.path and options.domain
+ // in the following expressions, otherwise they evaluate to undefined
+ // in the packed version for some reason...
+ var path = options.path ? '; path=' + (options.path) : '';
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
+ var secure = options.secure ? '; secure' : '';
+ document.cookie = name + '=' + encodeURIComponent(value) + expires + path + domain + secure;
+ } else { // `name` is really an object of multiple cookies to be set.
+ for (var n in name) { jQuery.cookie(n, name[n], value||options); }
+ }
+ } else { // get cookie (or all cookies if name is not provided)
+ var returnValue = {};
+ if (document.cookie) {
+ var cookies = document.cookie.split(';');
+ for (var i = 0; i < cookies.length; i++) {
+ var cookie = jQuery.trim(cookies[i]);
+ // Does this cookie string begin with the name we want?
+ if (!name) {
+ var nameLength = cookie.indexOf('=');
+ returnValue[ cookie.substr(0, nameLength)] = decodeURIComponent(cookie.substr(nameLength+1));
+ } else if (cookie.substr(0, name.length + 1) == (name + '=')) {
+ returnValue = decodeURIComponent(cookie.substr(name.length + 1));
+ break;
+ }
+ }
+ }
+ return returnValue;
+ }
+};
+
diff --git a/public/javascripts/jquery.jeditable.mini.js b/public/javascripts/jquery.jeditable.mini.js
new file mode 100644
index 00000000..ef885f06
--- /dev/null
+++ b/public/javascripts/jquery.jeditable.mini.js
@@ -0,0 +1,38 @@
+
+(function($){$.fn.editable=function(target,options){if('disable'==target){$(this).data('disabled.editable',true);return;}
+if('enable'==target){$(this).data('disabled.editable',false);return;}
+if('destroy'==target){$(this).unbind($(this).data('event.editable')).removeData('disabled.editable').removeData('event.editable');return;}
+var settings=$.extend({},$.fn.editable.defaults,{target:target},options);var plugin=$.editable.types[settings.type].plugin||function(){};var submit=$.editable.types[settings.type].submit||function(){};var buttons=$.editable.types[settings.type].buttons||$.editable.types['defaults'].buttons;var content=$.editable.types[settings.type].content||$.editable.types['defaults'].content;var element=$.editable.types[settings.type].element||$.editable.types['defaults'].element;var reset=$.editable.types[settings.type].reset||$.editable.types['defaults'].reset;var callback=settings.callback||function(){};var onedit=settings.onedit||function(){};var onsubmit=settings.onsubmit||function(){};var onreset=settings.onreset||function(){};var onerror=settings.onerror||reset;if(settings.tooltip){$(this).attr('title',settings.tooltip);}
+settings.autowidth='auto'==settings.width;settings.autoheight='auto'==settings.height;return this.each(function(){var self=this;var savedwidth=$(self).width();var savedheight=$(self).height();$(this).data('event.editable',settings.event);if(!$.trim($(this).html())){$(this).html(settings.placeholder);}
+$(this).bind(settings.event,function(e){if(true===$(this).data('disabled.editable')){return;}
+if(self.editing){return;}
+if(false===onedit.apply(this,[settings,self])){return;}
+e.preventDefault();e.stopPropagation();if(settings.tooltip){$(self).removeAttr('title');}
+if(0==$(self).width()){settings.width=savedwidth;settings.height=savedheight;}else{if(settings.width!='none'){settings.width=settings.autowidth?$(self).width():settings.width;}
+if(settings.height!='none'){settings.height=settings.autoheight?$(self).height():settings.height;}}
+if($(this).html().toLowerCase().replace(/(;|")/g,'')==settings.placeholder.toLowerCase().replace(/(;|")/g,'')){$(this).html('');}
+self.editing=true;self.revert=$(self).html();$(self).html('');var form=$('');if(settings.cssclass){if('inherit'==settings.cssclass){form.attr('class',$(self).attr('class'));}else{form.attr('class',settings.cssclass);}}
+if(settings.style){if('inherit'==settings.style){form.attr('style',$(self).attr('style'));form.css('display',$(self).css('display'));}else{form.attr('style',settings.style);}}
+var input=element.apply(form,[settings,self]);var input_content;if(settings.loadurl){var t=setTimeout(function(){input.disabled=true;content.apply(form,[settings.loadtext,settings,self]);},100);var loaddata={};loaddata[settings.id]=self.id;if($.isFunction(settings.loaddata)){$.extend(loaddata,settings.loaddata.apply(self,[self.revert,settings]));}else{$.extend(loaddata,settings.loaddata);}
+$.ajax({type:settings.loadtype,url:settings.loadurl,data:loaddata,async:false,success:function(result){window.clearTimeout(t);input_content=result;input.disabled=false;}});}else if(settings.data){input_content=settings.data;if($.isFunction(settings.data)){input_content=settings.data.apply(self,[self.revert,settings]);}}else{input_content=self.revert;}
+content.apply(form,[input_content,settings,self]);input.attr('name',settings.name);buttons.apply(form,[settings,self]);$(self).append(form);plugin.apply(form,[settings,self]);$(':input:visible:enabled:first',form).focus();if(settings.select){input.select();}
+input.keydown(function(e){if(e.keyCode==27){e.preventDefault();reset.apply(form,[settings,self]);}});var t;if('cancel'==settings.onblur){input.blur(function(e){t=setTimeout(function(){reset.apply(form,[settings,self]);},500);});}else if('submit'==settings.onblur){input.blur(function(e){t=setTimeout(function(){form.submit();},200);});}else if($.isFunction(settings.onblur)){input.blur(function(e){settings.onblur.apply(self,[input.val(),settings]);});}else{input.blur(function(e){});}
+form.submit(function(e){if(t){clearTimeout(t);}
+e.preventDefault();if(false!==onsubmit.apply(form,[settings,self])){if(false!==submit.apply(form,[settings,self])){if($.isFunction(settings.target)){var str=settings.target.apply(self,[input.val(),settings]);$(self).html(str);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}}else{var submitdata={};submitdata[settings.name]=input.val();submitdata[settings.id]=self.id;if($.isFunction(settings.submitdata)){$.extend(submitdata,settings.submitdata.apply(self,[self.revert,settings]));}else{$.extend(submitdata,settings.submitdata);}
+if('PUT'==settings.method){submitdata['_method']='put';}
+$(self).html(settings.indicator);var ajaxoptions={type:'POST',data:submitdata,dataType:'html',url:settings.target,success:function(result,status){if(ajaxoptions.dataType=='html'){$(self).html(result);}
+self.editing=false;callback.apply(self,[result,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}},error:function(xhr,status,error){onerror.apply(form,[settings,self,xhr]);}};$.extend(ajaxoptions,settings.ajaxoptions);$.ajax(ajaxoptions);}}}
+$(self).attr('title',settings.tooltip);return false;});});this.reset=function(form){if(this.editing){if(false!==onreset.apply(form,[settings,self])){$(self).html(self.revert);self.editing=false;if(!$.trim($(self).html())){$(self).html(settings.placeholder);}
+if(settings.tooltip){$(self).attr('title',settings.tooltip);}}}};});};$.editable={types:{defaults:{element:function(settings,original){var input=$('');$(this).append(input);return(input);},content:function(string,settings,original){$(':input:first',this).val(string);},reset:function(settings,original){original.reset(this);},buttons:function(settings,original){var form=this;if(settings.submit){if(settings.submit.match(/>$/)){var submit=$(settings.submit).click(function(){if(submit.attr("type")!="submit"){form.submit();}});}else{var submit=$('');submit.html(settings.submit);}
+$(this).append(submit);}
+if(settings.cancel){if(settings.cancel.match(/>$/)){var cancel=$(settings.cancel);}else{var cancel=$('');cancel.html(settings.cancel);}
+$(this).append(cancel);$(cancel).click(function(event){if($.isFunction($.editable.types[settings.type].reset)){var reset=$.editable.types[settings.type].reset;}else{var reset=$.editable.types['defaults'].reset;}
+reset.apply(form,[settings,original]);return false;});}}},text:{element:function(settings,original){var input=$('');if(settings.width!='none'){input.width(settings.width);}
+if(settings.height!='none'){input.height(settings.height);}
+input.attr('autocomplete','off');$(this).append(input);return(input);}},textarea:{element:function(settings,original){var textarea=$('');if(settings.rows){textarea.attr('rows',settings.rows);}else if(settings.height!="none"){textarea.height(settings.height);}
+if(settings.cols){textarea.attr('cols',settings.cols);}else if(settings.width!="none"){textarea.width(settings.width);}
+$(this).append(textarea);return(textarea);}},select:{element:function(settings,original){var select=$('');$(this).append(select);return(select);},content:function(data,settings,original){if(String==data.constructor){eval('var json = '+data);}else{var json=data;}
+for(var key in json){if(!json.hasOwnProperty(key)){continue;}
+if('selected'==key){continue;}
+var option=$('').val(key).append(json[key]);$('select',this).append(option);}
+$('select',this).children().each(function(){if($(this).val()==json['selected']||$(this).text()==$.trim(original.revert)){$(this).attr('selected','selected');}});}}},addInputType:function(name,input){$.editable.types[name]=input;}};$.fn.editable.defaults={name:'value',id:'id',type:'text',width:'auto',height:'auto',event:'click.editable',onblur:'cancel',loadtype:'GET',loadtext:'Loading...',placeholder:'Click to edit',loaddata:{},submitdata:{},ajaxoptions:{}};})(jQuery);
\ No newline at end of file
diff --git a/public/javascripts/jquery.truncator.js b/public/javascripts/jquery.truncator.js
new file mode 100644
index 00000000..0274d3df
--- /dev/null
+++ b/public/javascripts/jquery.truncator.js
@@ -0,0 +1,81 @@
+// HTML Truncator for jQuery
+// by Henrik Nyh 2008-02-28.
+// modified by Eric Allen 2010-04-02
+// Free to modify and redistribute with credit.
+
+(function($) {
+
+ var trailing_whitespace = true;
+
+ $.fn.truncate = function(options) {
+
+ var opts = $.extend({}, $.fn.truncate.defaults, options);
+
+ $(this).each(function() {
+
+ var content_length = $.trim(squeeze($(this).text())).length;
+ if (content_length <= opts.max_length)
+ return; // bail early if not overlong
+
+ var actual_max_length = opts.max_length - opts.more.length - 3; // 3 for " ()"
+ var truncated_node = recursivelyTruncate(this, actual_max_length);
+ var full_node = $(this).hide();
+
+ truncated_node.insertAfter(full_node);
+
+ findNodeForMore(truncated_node).append('...');
+ });
+ }
+
+ // Note that the " (…more)" bit counts towards the max length – so a max
+ // length of 10 would truncate "1234567890" to "12 (…more)".
+ $.fn.truncate.defaults = {
+ max_length: 100,
+ more: '…more',
+ less: 'less'
+ };
+
+ function recursivelyTruncate(node, max_length) {
+ return (node.nodeType == 3) ? truncateText(node, max_length) : truncateNode(node, max_length);
+ }
+
+ function truncateNode(node, max_length) {
+ var node = $(node);
+ var new_node = node.clone().empty();
+ var truncatedChild;
+ node.contents().each(function() {
+ var remaining_length = max_length - new_node.text().length;
+ if (remaining_length == 0) return; // breaks the loop
+ truncatedChild = recursivelyTruncate(this, remaining_length);
+ if (truncatedChild) new_node.append(truncatedChild);
+ });
+ return new_node;
+ }
+
+ function truncateText(node, max_length) {
+ var text = squeeze(node.data);
+ if (trailing_whitespace) // remove initial whitespace if last text
+ text = text.replace(/^ /, ''); // node had trailing whitespace.
+ trailing_whitespace = !!text.match(/ $/);
+ var text = text.slice(0, max_length);
+ // Ensure HTML entities are encoded
+ // http://debuggable.com/posts/encode-html-entities-with-jquery:480f4dd6-13cc-4ce9-8071-4710cbdd56cb
+ text = $('').text(text).html();
+ return text;
+ }
+
+ // Collapses a sequence of whitespace into a single space.
+ function squeeze(string) {
+ return string.replace(/\s+/g, ' ');
+ }
+
+ // Finds the last, innermost block-level element
+ function findNodeForMore(node) {
+ var $node = $(node);
+ var last_child = $node.children(":last");
+ if (!last_child) return node;
+ var display = last_child.css('display');
+ if (!display || display=='inline') return $node;
+ return findNodeForMore(last_child);
+ };
+})(jQuery);