Nuevo plugin Redmine CKEditor 1.1.5
This commit is contained in:
parent
64924a6376
commit
698e4e7c3c
635 changed files with 24046 additions and 0 deletions
|
@ -0,0 +1,5 @@
|
|||
//
|
||||
//= require rich/editor/ckeditor_path
|
||||
//= require ckeditor-releases/ckeditor
|
||||
//= require rich/editor/rich_editor
|
||||
//= require rich/editor/rich_picker
|
|
@ -0,0 +1,4 @@
|
|||
//= require fileuploader
|
||||
//= require rich/browser/extensions
|
||||
//= require rich/browser/uploader
|
||||
//= require rich/browser/filebrowser
|
|
@ -0,0 +1,69 @@
|
|||
class RedmineCkeditorSetting
|
||||
def self.setting
|
||||
Setting[:plugin_redmine_ckeditor] || {}
|
||||
end
|
||||
|
||||
def self.default
|
||||
["1", true].include?(setting["default"])
|
||||
end
|
||||
|
||||
def self.toolbar_string
|
||||
setting["toolbar"] || RedmineCkeditor.default_toolbar
|
||||
end
|
||||
|
||||
def self.toolbar
|
||||
bars = []
|
||||
bar = []
|
||||
toolbar_string.split(",").each {|item|
|
||||
case item
|
||||
when '/'
|
||||
bars.push(bar, item)
|
||||
bar = []
|
||||
when '--'
|
||||
bars.push(bar)
|
||||
bar = []
|
||||
else
|
||||
bar.push(item)
|
||||
end
|
||||
}
|
||||
|
||||
bars.push(bar) unless bar.empty?
|
||||
bars
|
||||
end
|
||||
|
||||
def self.skin
|
||||
setting["skin"] || "moono-lisa"
|
||||
end
|
||||
|
||||
def self.ui_color
|
||||
setting["ui_color"] || "#f4f4f4"
|
||||
end
|
||||
|
||||
def self.enter_mode
|
||||
(setting["enter_mode"] || 1).to_i
|
||||
end
|
||||
|
||||
def self.shift_enter_mode
|
||||
enter_mode == 2 ? 1 : 2
|
||||
end
|
||||
|
||||
def self.show_blocks
|
||||
(setting["show_blocks"] || 1).to_i == 1
|
||||
end
|
||||
|
||||
def self.toolbar_can_collapse
|
||||
setting["toolbar_can_collapse"].to_i == 1
|
||||
end
|
||||
|
||||
def self.toolbar_location
|
||||
setting["toolbar_location"] || "top"
|
||||
end
|
||||
|
||||
def self.width
|
||||
setting["width"]
|
||||
end
|
||||
|
||||
def self.height
|
||||
setting["height"] || 400
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
<%
|
||||
# when quoting a private journal, check the private checkbox
|
||||
if @journal && @journal.private_notes?
|
||||
%>
|
||||
$('#issue_private_notes').attr('checked', true);
|
||||
<% end %>
|
||||
|
||||
CKEDITOR.instances['issue_notes'].setData(<%= @content.inspect.html_safe %>);
|
||||
showAndScrollTo("update", "issue_notes");
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rich Browser</title>
|
||||
<%= javascript_heads %>
|
||||
<%= stylesheet_link_tag "application", :plugin => "redmine_ckeditor" %>
|
||||
<%= ckeditor_javascripts %>
|
||||
<%= javascript_include_tag "browser", :plugin => "redmine_ckeditor" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
<%= render :file => "messages/quote" %>
|
||||
CKEDITOR.instances['message_content'].setData($('#message_content').val());
|
12
plugins/redmine_ckeditor/app/views/rich/files/_file.html.erb
Normal file
12
plugins/redmine_ckeditor/app/views/rich/files/_file.html.erb
Normal file
|
@ -0,0 +1,12 @@
|
|||
<li class="clickable">
|
||||
<img id="file<%= file.id %>"
|
||||
src="<%= thumb_for_file(file) %>"
|
||||
data-uris="<%= file.uri_cache %>"
|
||||
data-relative-url-root="<%= Redmine::Utils.relative_url_root %>"
|
||||
data-rich-asset-id="<%= file.id %>"
|
||||
data-rich-asset-type="<%= file.simplified_type %>"
|
||||
data-rich-asset-name="<%= file.rich_file_file_name %>"
|
||||
/>
|
||||
<p><%= file.rich_file_file_name %></p>
|
||||
<%= link_to "delete", file.id.to_s, :method => :delete, :remote => true, :data => { :confirm => t(:delete_confirm) }, :class => "delete", :title => t(:delete) %>
|
||||
</li>
|
142
plugins/redmine_ckeditor/app/views/settings/_ckeditor.html.erb
Normal file
142
plugins/redmine_ckeditor/app/views/settings/_ckeditor.html.erb
Normal file
|
@ -0,0 +1,142 @@
|
|||
<%= ckeditor_javascripts %>
|
||||
<%= stylesheet_link_tag 'editor', :plugin => 'redmine_ckeditor'%>
|
||||
<%= stylesheet_link_tag 'selector', :plugin => 'redmine_ckeditor'%>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_skin) %>
|
||||
<%= select_tag "settings[skin]", RedmineCkeditor.skin_options %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_ui_color) %>
|
||||
<%= text_field_tag "settings[ui_color]", RedmineCkeditorSetting.ui_color %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_width) %>
|
||||
<%= text_field_tag "settings[width]", RedmineCkeditorSetting.width %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_height) %>
|
||||
<%= text_field_tag "settings[height]", RedmineCkeditorSetting.height %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_enter_mode) %>
|
||||
<%= select_tag "settings[enter_mode]", RedmineCkeditor.enter_mode_options %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_startup_show_blocks) %>
|
||||
<%= hidden_field_tag "settings[show_blocks]", 0 %>
|
||||
<%= check_box_tag "settings[show_blocks]", 1, RedmineCkeditorSetting.show_blocks %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_toolbar_can_collapse) %>
|
||||
<%= hidden_field_tag "settings[toolbar_can_collapse]", 0 %>
|
||||
<%= check_box_tag "settings[toolbar_can_collapse]", 1, RedmineCkeditorSetting.toolbar_can_collapse %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_toolbar_location) %>
|
||||
<%= select_tag "settings[toolbar_location]", RedmineCkeditor.toolbar_location_options %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag :label, l(:ckeditor_toolbar_buttons) %>
|
||||
</p>
|
||||
|
||||
<div class="selector-container">
|
||||
<%= hidden_field_tag "settings[toolbar]", RedmineCkeditorSetting.toolbar_string %>
|
||||
|
||||
<select id="left" multiple="multiple" size="10">
|
||||
</select>
|
||||
|
||||
<div class="container">
|
||||
<input type="button" class="button" value="<%= t(:add) %> >>"
|
||||
onclick="moveItem('left', 'right')"/><br/>
|
||||
<input type="button" class="button" value="<%= t(:remove) %> <<"
|
||||
onclick="moveItem('right', 'left')"/><br/><br/>
|
||||
<input type="button" class="button" value="<%= t(:separator) %> >>"
|
||||
onclick="addItem('-')"/><br/>
|
||||
<input type="button" class="button" value="<%= t(:subgroup) %> >>"
|
||||
onclick="addItem('--')"/><br/>
|
||||
<input type="button" class="button" value="<%= t(:line_break) %> >>"
|
||||
onclick="addItem('/')"/>
|
||||
</div>
|
||||
|
||||
<select id="right" multiple="multiple" size="10">
|
||||
</select>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div id="toolbar"></div>
|
||||
</div>
|
||||
|
||||
<%= javascript_tag do %>
|
||||
function moveItem(from, to) {
|
||||
from = $("#" + from);
|
||||
to = $("#" + to);
|
||||
var selected = to.find("option:selected").first();
|
||||
from.find("option:selected").remove().each(function() {
|
||||
if (this.value == '-' || this.value == '--' || this.value == '/') return;
|
||||
selected.size() ? selected.before(this) : to.append(this);
|
||||
});
|
||||
to.prop("selectedIndex", -1);
|
||||
changeHandler();
|
||||
}
|
||||
|
||||
function addItem(item) {
|
||||
var option = $("<option/>").val(item).text(item);
|
||||
var to = $("#right");
|
||||
var selected = to.find("option:selected").first();
|
||||
selected.size() ? selected.before(option) : to.append(option);
|
||||
changeHandler();
|
||||
}
|
||||
|
||||
function changeHandler() {
|
||||
var values = $("#right").find("option").map(function() {
|
||||
return this.value;
|
||||
});
|
||||
$("#settings_toolbar").val(values.toArray().join(","));
|
||||
|
||||
var bars = [];
|
||||
var bar = [];
|
||||
values.each(function() {
|
||||
var value = this.toString();
|
||||
if (value == "/") {
|
||||
bars.push(bar, value);
|
||||
bar = [];
|
||||
} else if (value == "--") {
|
||||
bars.push(bar);
|
||||
bar = [];
|
||||
} else {
|
||||
bar.push(value);
|
||||
}
|
||||
});
|
||||
if (bar.length > 0) bars.push(bar);
|
||||
|
||||
CKEDITOR.instances['toolbar'].destroy();
|
||||
updateCkeditor(bars);
|
||||
}
|
||||
|
||||
function updateCkeditor(toolbar) {
|
||||
var options = <%= RedmineCkeditor.options.to_json.html_safe %>;
|
||||
options.toolbar = toolbar;
|
||||
CKEDITOR.replace('toolbar', options);
|
||||
}
|
||||
|
||||
CKEDITOR.on('instanceReady', function() {
|
||||
CKEDITOR.removeListener('instanceReady', arguments.callee);
|
||||
|
||||
var left = $("#left");
|
||||
var right = $("#right");
|
||||
var rightItems = $("#settings_toolbar").val().split(",");
|
||||
|
||||
var dict = {};
|
||||
$.each(CKEDITOR.instances.toolbar.ui.items, function(key, value) {
|
||||
if (key == '-') return;
|
||||
dict[key] = value.label;
|
||||
if (rightItems.indexOf(key) < 0) {
|
||||
left.append($("<option/>").val(key).text(dict[key] || key));
|
||||
}
|
||||
});
|
||||
$.each(rightItems, function() {
|
||||
right.append($("<option/>").val(this).text(dict[this] || this));
|
||||
});
|
||||
});
|
||||
|
||||
updateCkeditor(<%= RedmineCkeditorSetting.toolbar.to_json.html_safe %>);
|
||||
<% end %>
|
Loading…
Add table
Add a link
Reference in a new issue