diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js new file mode 100644 index 00000000..c97d2b1d --- /dev/null +++ b/app/assets/javascripts/admin.js @@ -0,0 +1,8 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs \ No newline at end of file diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ecc46ce0..13d92690 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -6,34 +6,4 @@ // //= require jquery //= require jquery_ujs -//= require_tree . - -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults - -$(function () { - $('#panel_sidebar a, #panel_main a.nav').live('click', - function () { - $.getScript(this.href); - history.pushState(null, document.title, this.href); - return false; - } - ); - - $('#panel_main a.reload').live('click', - function () { - $.getScript(this.href); - history.replaceState(null, document.title, this.href); - return false; - } - ); - - $('.form').live('submit', function () { - $.post(this.action, $(this).serialize(), null, 'script'); - return false; - }); - - $(window).bind("popstate", function () { - $.getScript(location.href); - }); -}); +//= require_tree . \ No newline at end of file diff --git a/app/assets/javascripts/design.js b/app/assets/javascripts/design.js index dee720fa..e67989c4 100644 --- a/app/assets/javascripts/design.js +++ b/app/assets/javascripts/design.js @@ -1,2 +1,71 @@ -// Place all the behaviors and hooks related to the matching controller here. -// All this logic will automatically be available in application.js. +function r_editor(tgetUrl,tpostUrl,tfilename,toption){ + if(!toption){ toption =new Array();} + if(!toption['width']){toption['width']=400;} + if(!toption['height']){toption['height']=300;} + var editor = this; + editor.filename = tfilename; + editor.getUrl = tgetUrl; + editor.postUrl = tpostUrl; + editor.nodeToBeChanged="" + editor.width = toption['width']; + editor.height = toption['height']; + var html=''; + editor.init = function(){ + code = ""; + html = $(code); + html.children("textarea").load(editor.getUrl); + html.children("input.discard").click(function(){ + editor.destroy(); + }); + html.children("input.send").click(function(){ + editor.send(); + }); + return html; + }; + editor.reload = function(){ + $.get(editor.getUrl,function(data){ + html.children("textarea").text(data); + }); + }; + editor.send = function(){ + $.post(editor.postUrl,{filename:editor.filename,context:html.children("textarea").val(),authenticity_token:$('meta[name=csrf-token]').attr('content')},null,"script"); + }; + editor.destroy = function(){ + html.remove(); + }; +} + +$(".r_edit").live("click",function(){ + new_editor = new r_editor($(this).attr("path"),"edit_file",$(this).attr("filename")); + $(this).after(new_editor.init()); +}); + + +$(".r_snapshot").live({ + mouseenter: + function(){ + $(this).append($("").html('
')); + }, + mouseleave: + function(){ + $(this).find("span:last").remove(); + } + } +); + +$('input.multi_files').live("change", function(){ + $(this).parent().prev("ul").append("diff --git a/app/views/admin/designs/_stylesheet_field.html.erb b/app/views/admin/designs/_stylesheet_field.html.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/admin/user_attribute_models/edit.html.erb b/app/views/admin/user_attribute_models/edit.html.erb index 810da772..b70e5275 100644 --- a/app/views/admin/user_attribute_models/edit.html.erb +++ b/app/views/admin/user_attribute_models/edit.html.erb @@ -1,5 +1,3 @@ -<% content_for :body_id do %><%= "#{@attribute}s_list" %><% end -%> -