diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js
index 70bc22bd..f5fed368 100644
--- a/app/assets/javascripts/new_admin.js
+++ b/app/assets/javascripts/new_admin.js
@@ -16,4 +16,4 @@
//= require orbit-bar-search
//= require side_bar_history
//= require rss
-//= require ajax_form
\ No newline at end of file
+//= require ajax_form
diff --git a/app/assets/javascripts/tinymce_orbit.js b/app/assets/javascripts/tinymce_orbit.js.erb
similarity index 61%
rename from app/assets/javascripts/tinymce_orbit.js
rename to app/assets/javascripts/tinymce_orbit.js.erb
index 9e0853e3..1a9d063d 100644
--- a/app/assets/javascripts/tinymce_orbit.js
+++ b/app/assets/javascripts/tinymce_orbit.js.erb
@@ -4,7 +4,7 @@ function load_tinymce() {
// General options
theme: 'advanced',
file_browser_callback : 'myFileBrowser',
- plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
+ plugins : "autolink,lists,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
@@ -42,37 +42,36 @@ function load_tinymce() {
staffid : "991234"
}
});
- function myFileBrowser (field_name, url, type, win) {
+}
+function myFileBrowser(field_name, url, type, win) {
+ var cmsURL = window.location.toString();
+ cmsURL = cmsURL.split("/");
+ cmsURL = "<%= Rails.application.routes.url_helpers.new_admin_asset_path %>";
+ console.log(cmsURL);
+ // script URL - use an absolute path!
+ if (cmsURL.indexOf("?") < 0) {
+ //add the type as the only query parameter
+ cmsURL = cmsURL + "?type=" + type;
+ }
+ else {
+ //add the type as an additional query parameter
+ // (PHP session ID is now included if there is one at all)
+ cmsURL = cmsURL + "&type=" + type;
+ }
-
- var cmsURL = window.location.toString();
- cmsURL = cmsURL.split("/");
- // cmsURL = "http:///modules/modules/filemanager/";
-
- // script URL - use an absolute path!
- if (cmsURL.indexOf("?") < 0) {
- //add the type as the only query parameter
- cmsURL = cmsURL + "?type=" + type;
- }
- else {
- //add the type as an additional query parameter
- // (PHP session ID is now included if there is one at all)
- cmsURL = cmsURL + "&type=" + type;
- }
-
- tinyMCE.activeEditor.windowManager.open({
- file : cmsURL,
- title : 'File Browser',
- width : 850, // Your dimensions may differ - toy around with them!
- height : 455,
- resizable : "no",
- inline : "no", // This parameter only has an effect if you use the inlinepopups plugin!
- close_previous : "no"
- }, {
- window : win,
- input : field_name
- });
- return false;
+ tinyMCE.activeEditor.windowManager.open({
+ file : cmsURL,
+ title : 'File Browser',
+ width : 850, // Your dimensions may differ - toy around with them!
+ height : 455,
+ resizable : "no",
+ inline : "no", // This parameter only has an effect if you use the inlinepopups plugin!
+ close_previous : "no"
+ }, {
+ window : win,
+ input : field_name,
+ });
+ return false;
}
function ajaxSave() {
var ed = tinyMCE.get('content');
@@ -83,7 +82,6 @@ function load_tinymce() {
alert(ed.getContent());
}, 3000);
}
-}
$(document).ready(function() {
load_tinymce();
diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb
index b595ed5b..89fd41b7 100644
--- a/app/controllers/admin/assets_controller.rb
+++ b/app/controllers/admin/assets_controller.rb
@@ -30,8 +30,8 @@ class Admin::AssetsController < OrbitBackendController
@asset = Asset.new(params[:asset])
if @asset.save
respond_to do |format|
- format.html { redirect_to admin_assets_url }
- format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'append', :id => 'tbody_assets', :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
+ format.html { render :text => @asset.data.url }
+ format.js {}
end
else
respond_to do |format|
diff --git a/app/views/admin/assets/_new.html.erb b/app/views/admin/assets/_new.html.erb
index 85d3c2e5..5d770a2e 100644
--- a/app/views/admin/assets/_new.html.erb
+++ b/app/views/admin/assets/_new.html.erb
@@ -1,16 +1,11 @@
<%= t('admin.new_asset') %>
- <%= form_for :asset, :url => admin_assets_path, :html => {:id => (is_html ? nil : 'ajaxForm'), :multipart => true } do |f| %>
+ <%= form_for :asset, :url => admin_assets_path, :html => {:id => 'ajaxForm', :multipart => true } do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>
diff --git a/app/views/admin/assets/create.js.erb b/app/views/admin/assets/create.js.erb
new file mode 100644
index 00000000..38c7992c
--- /dev/null
+++ b/app/views/admin/assets/create.js.erb
@@ -0,0 +1,19 @@
+
+// Uncomment and change this document.domain value if you are loading the script cross subdomains
+// document.domain = 'moxiecode.com';
+
+var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/page_parts/edit.js.erb b/app/views/admin/page_parts/edit.js.erb
index 5dd8351c..3e50360c 100644
--- a/app/views/admin/page_parts/edit.js.erb
+++ b/app/views/admin/page_parts/edit.js.erb
@@ -1 +1,44 @@
-$('#back_main').html("<%= j render(:partial => 'edit') %>");
\ No newline at end of file
+$('#back_main').html("<%= j render(:partial => 'edit') %>");
+tinymce.init({
+ // General options
+ mode: 'textareas',
+ theme: 'advanced',
+ file_browser_callback : 'myFileBrowser',
+ plugins : "autolink,lists,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
+
+ // Theme options
+ theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
+ theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor",
+ theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen",
+ theme_advanced_toolbar_location : "top",
+ theme_advanced_toolbar_align : "left",
+ theme_advanced_statusbar_location : "bottom",
+ theme_advanced_resizing : true,
+
+ // Skin options
+ skin : "o2k7",
+ skin_variant : "silver",
+
+ // Drop lists for link/image/media/template dialogs
+ template_external_list_url : "js/template_list.js",
+ // external_link_list_url : "js/link_list.js",
+ // external_image_list_url : "js/image_list.js",
+ // media_external_list_url : "js/media_list.js"
+
+ // Style formats
+ style_formats : [
+ {title : 'Bold text', inline : 'b'},
+ {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
+ {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
+ {title : 'Example 1', inline : 'span', classes : 'example1'},
+ {title : 'Example 2', inline : 'span', classes : 'example2'},
+ {title : 'Table styles'},
+ {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
+ ],
+
+ // Replace values for the template plugin
+ template_replace_values : {
+ username : "Some User",
+ staffid : "991234"
+ }
+});
\ No newline at end of file