Skip to content

Commit

Permalink
pulling the configuration of tinyMCE from a configuration file instead
Browse files Browse the repository at this point in the history
  • Loading branch information
maleko committed Jun 15, 2012
1 parent ca40a90 commit d629e1b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 30 deletions.
6 changes: 3 additions & 3 deletions app/views/shared/_rich_editor_javascript.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<% ids = @editor_configuration[:ids].split %>

<% if is_enabled and ids.any? %>
<%= render :partial => "shared/editor_engines/#{@editor_configuration[:current_editor].underscore}",
:locals => { :ids => ids } %>
<% end %>
<%= render :partial => "shared/editor_engines/#{@editor_configuration[:current_editor].underscore}",
:locals => { :ids => ids } %>
<% end %>
33 changes: 6 additions & 27 deletions app/views/shared/editor_engines/_tiny_mce.html.erb
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
<script type="text/javascript">
$(function() {
var myConfig = { dompath: true };
var ids = [<%= ids.map{|id| "'#{id}'"}.join(', ') %>]
$.each(ids, function(index, id) {
if ($('textarea#' + id).length) {
tinyMCE.init({
mode : "exact",
elements : id,
theme : "advanced",
language : '<%= I18n.locale.to_s.split('-')[0].downcase %>',
skin : "o2k7",
width : "594",
plugins : "safari,style,layer,table,advhr,advimage,inlinepopups,insertdatetime,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

// Theme options
theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,fullscreen,|,charmap,media,advhr,|,visualchars,blockquote",
theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,sub,sup,|,bullist,numlist,|,outdent,indent,blockquote,|,",
theme_advanced_buttons3 : "styleselect,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor",
theme_advanced_buttons4 : "tablecontrols,|,hr,removeformat,visualaid",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false
});
}
});
});
<script type="text/javascript">
$(function() {
var myConfig = { dompath: true };
var ids = [<%= ids.map{|id| "'textarea##{id}'"}.join(', ') %>];
tinyMCE.init(<%= raw TinyMCE::Rails.configuration.options.merge({ :elements => ids.join(',') }).to_json %>);
});
</script>
18 changes: 18 additions & 0 deletions config/tinymce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
mode : "exact"
theme : "advanced"
language : "<%= I18n.locale.to_s.split('-')[0].downcase %>"
skin : "o2k7"
width : "594"
plugins : "safari,style,layer,table,advhr,advimage,inlinepopups,insertdatetime,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template"

# Theme options
theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,fullscreen,|,charmap,media,advhr,|,visualchars,blockquote"
theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,sub,sup,|,bullist,numlist,|,outdent,indent,blockquote,|,"
theme_advanced_buttons3 : "styleselect,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor"
theme_advanced_buttons4 : "tablecontrols,|,hr,removeformat,visualaid"
theme_advanced_toolbar_location : "top"
theme_advanced_toolbar_align : "left"
theme_advanced_statusbar_location : "top"
theme_advanced_resizing : false


0 comments on commit d629e1b

Please sign in to comment.