Sha256: 72b21f34605ed2fc52769cd790cdc272054170137231ee813995d0b7e7098a39
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
<%= File.read(settings.root + '/admin/jquery.js') %> jQuery.noConflict(); (function($) { $(function() { function clickable() { $('._copy_editable').addClass('_copy_clickable'); } function unclickable() { $('._copy_editable').removeClass('_copy_clickable'); } $('head').append('<style style="text/css"><%= File.read(settings.root + '/admin/copy.css').gsub(/\n/, " \\\n") %></style>'); $('._copy_clickable').live('click', function() { var copy = $(this); unclickable(); $.ajax({ url: '/_copy/'+copy.attr('data-name'), success: function(html) { $('body').prepend(html); $('#_copy').css({ margin:'-'+($('#_copy').height() / 2)+'px 0 0 -'+($('#_copy').width() / 2)+'px' }); $('#_copy textarea').get(0).focus(); } }); }); $('._copy_cancel').live('click', function() { $('#_copy').remove(); clickable(); }); $('._copy_edit_form').live('submit', function() { var form = $(this); var original = $('[data-name="'+form.attr('data-content-name')+'"]'); form.find(':submit').attr('disabled', 'disabled'); $.ajax({ type: 'PUT', url: form.attr('action'), data: { content: form.find('textarea').val(), wrap_tag: original.get(0).tagName.toLowerCase() }, success: function(html) { $('#_copy').remove(); original.replaceWith(html); } }) return false; }) clickable(); }); })(jQuery);
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
copy-0.0.2 | lib/copy/admin/index.js.erb |
copy-0.0.1 | lib/copy/admin/index.js.erb |