fix for ie8,9 for tinymce

This commit is contained in:
Harry Bomrah 2012-08-07 20:55:18 +08:00
parent 8ea7bf75cd
commit 4660c26b7a
6 changed files with 44 additions and 32 deletions

View File

@ -24,9 +24,41 @@ $(document).on('click', '#ajax_form_submit', function(){
dataType: 'html',
url:$("#ajaxForm").attr("action"),
success: function(response,status,xhr){
alert(response);
eval(response);
if(typeof tinyMCEPopup != "undefined"){
var x = response.split("#");
var returnurl = x[0],
returntitle = x[1],
returndescription = x[2];
var win = tinyMCEPopup.getWindowArg("window");
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = returnurl;
win.document.getElementById(tinyMCEPopup.getWindowArg("alt")).value = returndescription;
win.document.getElementById(tinyMCEPopup.getWindowArg("title")).value = returntitle;
if (typeof(win.ImageDialog) != "undefined") {
// we are, so update image dimensions...
if (win.ImageDialog.getImageData)
win.ImageDialog.getImageData();
// ... and preview if necessary
if (win.ImageDialog.showPreviewImage)
win.ImageDialog.showPreviewImage(returnurl);
}
tinyMCEPopup.close();
}else{
//incase if we want to do something for quick edit file upload
// $("#modal-file").modal('hide');
// var r = "";
// if(rcom.getInternetExplorerVersion() > -1){
// r = "<tr><td>" + response + "</td></tr>";
// r = r.replace("</a><a","</a></td><td><a");
// r = $(r);
// r.attr("id",r.find("span").attr("for"));
// alert(r.html())
// }else{
// r = $(response);
// }
// $('#bulletin_files tbody').append(r);
//$(response).fadeIn();
}
},
error:function(){
alert("error");

View File

@ -41,7 +41,8 @@ class Admin::AssetsController < OrbitBackendController
# end
# }
# end
render :layout => false
# render :json=>{"url"=>@asset.data.url,"title"=>"xxx","desc"=>"sss"}.to_json
render :layout=>false
else
flash[:error] = t(:create_fail)
@asset_categories = AssetCategory.all

View File

@ -1,21 +1 @@
// Uncomment and change this document.domain value if you are loading the script cross subdomains
// document.domain = 'moxiecode.com';
(function(){
var returnurl = "<%= @asset.data.url %>";
var returntitle = "<%= show_all_fields(@asset, 'title') %>";
var returndescription = "<%= show_all_fields(@asset, 'description') %>";
var win = tinyMCEPopup.getWindowArg("window");
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = returnurl;
win.document.getElementById(tinyMCEPopup.getWindowArg("alt")).value = returndescription;
win.document.getElementById(tinyMCEPopup.getWindowArg("title")).value = returntitle;
if (typeof(win.ImageDialog) != "undefined") {
// we are, so update image dimensions...
if (win.ImageDialog.getImageData)
win.ImageDialog.getImageData();
// ... and preview if necessary
if (win.ImageDialog.showPreviewImage)
win.ImageDialog.showPreviewImage(returnurl);
}
tinyMCEPopup.close();})()
<%= @asset.data.url %>#<%= show_all_fields(@asset, 'title') %>#<%= show_all_fields(@asset, 'description') %>

View File

@ -128,11 +128,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletin_file = BulletinFile.new(params[:bulletin_file])
respond_to do |format|
# respond_to do |format|
if @bulletin_file.save
format.js { render 'create_bulletin_file' }
end
render 'create_bulletin_file',:layout=>false
end
# end
else

View File

@ -1,10 +1,9 @@
<tr id="<%= dom_id list_bulletin_file %>">
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.title_translations['zh_tw'], list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description_translations['zh_tw']} ) : list_bulletin_file.title_translations['zh_tw'] %></td>
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.title_translations['en'], list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description_translations['en']} ) : list_bulletin_file.title_translations['zh_tw'] %></td>
<td>
<a href="<%= panel_announcement_back_end_bulletin_file_quick_edit_path(list_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<span class="action" for="<%= dom_id list_bulletin_file %>">
<%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %>
<%= f.hidden_field :id %>
<%= hidden_field_tag :tr, (dom_id list_bulletin_file) %>
@ -19,4 +18,3 @@

View File

@ -0,0 +1 @@
<%= render :partial => 'list_bulletin_file', :collection => [@bulletin_file] %>