Merge branch 'design_team' of github.com:Rulingcom/orbit into design_team

This commit is contained in:
Christophe Vilayphiou 2012-05-17 06:26:21 +08:00
commit aab030efa9
8 changed files with 99 additions and 50 deletions

View File

@ -4,7 +4,7 @@ function load_tinymce() {
// General options // General options
theme: 'advanced', theme: 'advanced',
file_browser_callback : 'myFileBrowser', 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 options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
@ -42,13 +42,12 @@ function load_tinymce() {
staffid : "991234" staffid : "991234"
} }
}); });
function myFileBrowser (field_name, url, type, win) { }
function myFileBrowser(field_name, url, type, win) {
var cmsURL = window.location.toString(); var cmsURL = window.location.toString();
cmsURL = cmsURL.split("/"); cmsURL = cmsURL.split("/");
// cmsURL = "http://<?php echo $_SITE['domain'].$_SITE['rel_path']; ?>/modules/modules/filemanager/"; cmsURL = "<%= Rails.application.routes.url_helpers.new_admin_asset_path %>";
console.log(cmsURL);
// script URL - use an absolute path! // script URL - use an absolute path!
if (cmsURL.indexOf("?") < 0) { if (cmsURL.indexOf("?") < 0) {
//add the type as the only query parameter //add the type as the only query parameter
@ -70,7 +69,7 @@ function load_tinymce() {
close_previous : "no" close_previous : "no"
}, { }, {
window : win, window : win,
input : field_name input : field_name,
}); });
return false; return false;
} }
@ -83,7 +82,6 @@ function load_tinymce() {
alert(ed.getContent()); alert(ed.getContent());
}, 3000); }, 3000);
} }
}
$(document).ready(function() { $(document).ready(function() {
load_tinymce(); load_tinymce();

View File

@ -30,8 +30,8 @@ class Admin::AssetsController < OrbitBackendController
@asset = Asset.new(params[:asset]) @asset = Asset.new(params[:asset])
if @asset.save if @asset.save
respond_to do |format| respond_to do |format|
format.html { redirect_to admin_assets_url } format.html { render :text => @asset.data.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.js {}
end end
else else
respond_to do |format| respond_to do |format|

View File

@ -1,16 +1,11 @@
<div id='pop_up_content' class="main2"> <div id='pop_up_content' class="main2">
<h1><%= t('admin.new_asset') %></h1> <h1><%= t('admin.new_asset') %></h1>
<%= 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 %> <%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %> <%= render :partial => "form", :locals => { :f => f } %>
<div class="button_bar"> <div class="button_bar">
<% if is_html %>
<%= link_back %>
<%= f.submit t(:create) %>
<% else %>
<a id='ajax_form_submit' class="new"><%= t(:create) %></a> <a id='ajax_form_submit' class="new"><%= t(:create) %></a>
<% end %>
</div> </div>
<% end %> <% end %>
</div> </div>

File diff suppressed because one or more lines are too long

View File

@ -6,9 +6,3 @@
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<script>
$(document).ready(function() {
load_tinymce();
});
</script>

View File

@ -1 +1,44 @@
$('#back_main').html("<%= j render(:partial => 'edit') %>"); $('#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"
}
});