:date
end
end
+
+ def parse_size(size, width_range, width_default, height_range, height_default)
+ size = size.split(",")
+ size[0] = width_default if size.length != 2 || !size[0].match(/\d{1,9}/)
+ size[1] = height_default if size.length != 2 || !size[1].match(/\d{1,9}/)
+ size[0] = size[0].to_i
+ size[1] = size[1].to_i
+ size[0] = width_default unless width_range.include?(size[0])
+ size[1] = height_default unless height_range.include?(size[1])
+
+ size
+ end
end
+<%
+ dialog_size = parse_size(Setting.plugin_quick_edit['input_dialog_base_size'], 480...2048, 480, 280...2048,280)
+ dialog_size[0] += 227 if @dialog_params[:field_type] == :text || @dialog_params[:field_type] == :string
+ dialog_size[1] += 134 if @dialog_params[:field_type] == :text
+ dialog_size[1] += 31 if @dialog_params[:attribute_name]==:description
+ dialog_size[1] += 50 unless @dialog_params[:description].nil?
+
+ textarea_size = parse_size(Setting.plugin_quick_edit['textarea_size'], 10...256, 80, 10...256, 10)
+%>
<div id="quick_edit_input_dialog" title="Quick Edit - <%= @dialog_params[:caption] %>" style="background-color: white;">
<%= form_tag({:controller=>'issues', :action=>:bulk_update}) do %>
<div style="padding-top: 9px; padding-bottom: 15px; padding-left: 10px;">
<span style="vertical-align: middle; font-size: 0.85em;">for: <% @issues.each do |issue| %><%= "\##{issue.id}" %> <% end %></span>
</div>
<div class="box" style="font-size: 0.9em; font-weight: normal; padding-left: 10px; padding-right: 10px; padding-bottom: 12px; margin-bottom:0px;">
- <div>
- <span><%= @dialog_params[:caption] %>:</span></div>
+ <span><%= @dialog_params[:caption] %>:</span>
+ <div style="text-align: middle;">
<% case @dialog_params[:field_type] %>
<% when :date %>
<input id="new_value"
<% when :text %>
<textarea id="new_value"
name="<%= @dialog_params[:target_specifier] %>"
- cols="80"
- rows="10"
+ cols="<%= textarea_size[0] %>"
+ rows="<%= textarea_size[1] %>"
style="vertical-align:middle;"><%= @dialog_params[:default_value] %></textarea>
<% if @dialog_params[:attribute_name].to_sym == :description %>
<%= wikitoolbar_for 'new_value' %>
<script>
//<![CDATA[
$(".ui-autocomplete").css("z-index",200);
- var width = <%= (@dialog_params[:field_type] == :int || @dialog_params[:field_type] == :date) ? 480 : 707 %>;
- var height = <%= ((@dialog_params[:field_type] == :text) ? 414 : 280) + ((@dialog_params[:description].nil?) ? 0 : 50) + ((@dialog_params[:attribute_name]==:description)?31:0)%>;
$("#quick_edit_input_dialog").dialog({
modal: true,
closeOnEscape: false,
- width: width,
- height: height,
+ width: <%= dialog_size[0] %>,
+ height: <%= dialog_size[1] %>,
buttons: {
"Submit" : quick_edit_input_dialog_submit,
"Cancel" : quick_edit_input_dialog_cancel
close: quick_edit_input_dialog_close
});
- quick_edit_log("input_dialog open.");
+ quick_edit_log("input_dialog open. size=<%=dialog_size[0]%>,<%=dialog_size[1]%>");
//]]>
</script>
--- /dev/null
+<table>
+ <tr>
+ <th>Dialog base size:</th>
+ <td>
+ <input type="text" id="settings_input_dialog_base_size" name="settings[input_dialog_base_size]" value="<%= settings['input_dialog_base_size'] %>"></input>
+ </td>
+ <td>
+ </td>
+ </tr>
+ <tr>
+ <th>Textarea size:</th>
+ <td>
+ <input type="text" id="settings_textarea_size" name="settings[textarea_size]" value="<%= settings['textarea_size'] %>"></input>
+ </td>
+ <td>
+ </td>
+ </tr>
+ <tr>
+ <th>Pattern of name for exclude custom fields:</th>
+ <td>
+ <input type="text" id="settings_custom_field_exclude_names" name="settings[custom_field_exclude_names]" value="<%= settings['custom_field_exclude_names'] %>"></input>
+ </td>
+ <td>
+ </td>
+ </tr>
+</table>
# plugin name depends to plugin directory
plugin_name = File.dirname(File.expand_path(__FILE__))
-plugin_name = File.basename(plugin_name)
+plugin_name = File.basename(plugin_name).to_sym
Redmine::Plugin.register plugin_name do
name 'Quick Edit plugin'
version '0.0.7.1'
permission :manage_quick_edit_relations, {:quick_edit_relations => [:create, :destroy]}, :public => true
+
+ settings :default => {'custom_field_exclude_names'=>'',
+ 'textarea_size'=>'80,10',
+ 'input_dialog_base_size'=>'480,280'},
+ :partial => 'quick_edit_issues/settings'
end