* code and views cleaning
* javascript added on custom field form to show/hide fields according to the format of custom field git-svn-id: http://redmine.rubyforge.org/svn/trunk@100 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
2b86ef8e28
commit
918123cd06
|
@ -293,8 +293,11 @@ class ProjectsController < ApplicationController
|
|||
new_project = Project.find(params[:new_project_id])
|
||||
new_tracker = Tracker.find(params[:new_tracker_id])
|
||||
@issues.each { |i|
|
||||
# category is project dependent
|
||||
i.category = nil unless i.project_id == new_project.id
|
||||
# project dependent properties
|
||||
unless i.project_id == new_project.id
|
||||
i.category = nil
|
||||
i.fixed_version = nil
|
||||
end
|
||||
# move the issue
|
||||
i.project = new_project
|
||||
i.tracker = new_tracker
|
||||
|
|
|
@ -161,6 +161,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
|
|||
(field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector|
|
||||
src = <<-END_SRC
|
||||
def #{selector}(field, options = {})
|
||||
return super if options.delete :no_label
|
||||
label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
|
||||
label = @template.content_tag("label", label_text,
|
||||
:class => (@object.errors[field] ? "error" : nil),
|
||||
|
@ -171,7 +172,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
|
|||
class_eval src, __FILE__, __LINE__
|
||||
end
|
||||
|
||||
def select(field, choices, options = {})
|
||||
def select(field, choices, options = {}, html_options = {})
|
||||
label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
|
||||
label = @template.content_tag("label", label_text,
|
||||
:class => (@object.errors[field] ? "error" : nil),
|
||||
|
|
|
@ -72,6 +72,6 @@ module CustomFieldsHelper
|
|||
|
||||
# Return an array of custom field formats which can be used in select_tag
|
||||
def custom_field_formats_for_select
|
||||
CustomField::FIELD_FORMATS.keys.collect { |k| [ l(CustomField::FIELD_FORMATS[k]), k ] }
|
||||
CustomField::FIELD_FORMATS.sort {|a,b| a[1][:order]<=>b[1][:order]}.collect { |k| [ l(k[1][:name]), k[0] ] }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
class CustomField < ActiveRecord::Base
|
||||
has_many :custom_values, :dependent => true
|
||||
|
||||
FIELD_FORMATS = { "list" => :label_list,
|
||||
"date" => :label_date,
|
||||
"bool" => :label_boolean,
|
||||
"int" => :label_integer,
|
||||
"string" => :label_string,
|
||||
"text" => :label_text
|
||||
FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 },
|
||||
"text" => { :name => :label_text, :order => 2 },
|
||||
"int" => { :name => :label_integer, :order => 3 },
|
||||
"list" => { :name => :label_list, :order => 4 },
|
||||
"date" => { :name => :label_date, :order => 5 },
|
||||
"bool" => { :name => :label_boolean, :order => 6 }
|
||||
}.freeze
|
||||
|
||||
validates_presence_of :name, :field_format
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
|
||||
<% for custom_value in @custom_values %>
|
||||
<% if !custom_value.value.empty? %>
|
||||
<li><%= custom_value.custom_field.name%>: <%= show_value(custom_value) %></li>
|
||||
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -1,52 +1,70 @@
|
|||
<%= error_messages_for 'custom_field' %>
|
||||
|
||||
<script>
|
||||
function toggle_custom_field_format() {
|
||||
format = $("custom_field_field_format");
|
||||
p_length = $("custom_field_min_length");
|
||||
p_regexp = $("custom_field_regexp");
|
||||
p_values = $("custom_field_possible_values");
|
||||
switch (format.value) {
|
||||
case "list":
|
||||
Element.hide(p_length.parentNode);
|
||||
Element.hide(p_regexp.parentNode);
|
||||
Element.show(p_values.parentNode);
|
||||
break;
|
||||
case "int":
|
||||
case "string":
|
||||
case "text":
|
||||
Element.show(p_length.parentNode);
|
||||
Element.show(p_regexp.parentNode);
|
||||
Element.hide(p_values.parentNode);
|
||||
break;
|
||||
case "date":
|
||||
case "bool":
|
||||
Element.hide(p_length.parentNode);
|
||||
Element.hide(p_regexp.parentNode);
|
||||
Element.hide(p_values.parentNode);
|
||||
break;
|
||||
default:
|
||||
Element.show(p_length.parentNode);
|
||||
Element.show(p_regexp.parentNode);
|
||||
Element.show(p_values.parentNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--[form:custom_field]-->
|
||||
<div class="box">
|
||||
<p><label for="custom_field_name"><%=l(:field_name)%><span class="required"> *</span></label>
|
||||
<%= text_field 'custom_field', 'name' %></p>
|
||||
|
||||
<p><label for="custom_field_field_format"><%=l(:field_field_format)%></label>
|
||||
<%= select("custom_field", "field_format", custom_field_formats_for_select) %></p>
|
||||
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.select :field_format, custom_field_formats_for_select, {}, :onchange => "toggle_custom_field_format();" %></p>
|
||||
<p><label for="custom_field_min_length"><%=l(:label_min_max_length)%></label>
|
||||
<%= text_field 'custom_field', 'min_length', :size => 5 %> -
|
||||
<%= text_field 'custom_field', 'max_length', :size => 5 %><br>(<%=l(:text_min_max_length_info)%>)</p>
|
||||
|
||||
<p><label for="custom_field_regexp"><%=l(:field_regexp)%></label>
|
||||
<%= text_field 'custom_field', 'regexp', :size => 50 %><br>(<%=l(:text_regexp_info)%>)</p>
|
||||
|
||||
<p><label for="custom_field_possible_values"><%=l(:field_possible_values)%></label>
|
||||
<%= text_area 'custom_field', 'possible_values', :rows => 5, :cols => 60 %><br>(<%=l(:text_possible_values_info)%>)</p>
|
||||
<%= f.text_field :min_length, :size => 5, :no_label => true %> -
|
||||
<%= f.text_field :max_length, :size => 5, :no_label => true %><br>(<%=l(:text_min_max_length_info)%>)</p>
|
||||
<p><%= f.text_field :regexp, :size => 50 %><br>(<%=l(:text_regexp_info)%>)</p>
|
||||
<p><%= f.text_area :possible_values, :rows => 5, :cols => 60 %><br>(<%=l(:text_possible_values_info)%>)</p>
|
||||
</div>
|
||||
<%= javascript_tag "toggle_custom_field_format();" %>
|
||||
<!--[eoform:custom_field]-->
|
||||
|
||||
<div class="box">
|
||||
<% case type.to_s
|
||||
when "IssueCustomField" %>
|
||||
|
||||
<fieldset><legend><%=l(:label_tracker_plural)%></legend>
|
||||
<% for tracker in @trackers %>
|
||||
<input type="checkbox"
|
||||
name="tracker_ids[]"
|
||||
value="<%= tracker.id %>"
|
||||
<%if @custom_field.trackers.include? tracker%>checked="checked"<%end%>
|
||||
> <%= tracker.name %>
|
||||
<% end %></fieldset>
|
||||
|
||||
<% case @custom_field.type.to_s
|
||||
when "IssueCustomField" %>
|
||||
|
||||
<fieldset><legend><%=l(:label_tracker_plural)%></legend>
|
||||
<% for tracker in @trackers %>
|
||||
<%= check_box_tag "tracker_ids[]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<p><%= f.check_box :is_for_all %></p>
|
||||
|
||||
<% when "UserCustomField" %>
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
|
||||
<p><label for="custom_field_is_required"><%=l(:field_is_required)%></label>
|
||||
<%= check_box 'custom_field', 'is_required' %></p>
|
||||
|
||||
<p><label for="custom_field_is_for_all"><%=l(:field_is_for_all)%></label>
|
||||
<%= check_box 'custom_field', 'is_for_all' %></p>
|
||||
|
||||
<% when "UserCustomField" %>
|
||||
<p><label for="custom_field_is_required"><%=l(:field_is_required)%></label>
|
||||
<%= check_box 'custom_field', 'is_required' %></p>
|
||||
|
||||
<% when "ProjectCustomField" %>
|
||||
<p><label for="custom_field_is_required"><%=l(:field_is_required)%></label>
|
||||
<%= check_box 'custom_field', 'is_required' %></p>
|
||||
<% when "ProjectCustomField" %>
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<h2><%=l(:label_custom_field)%> (<%=l(@custom_field.type_name)%>)</h2>
|
||||
|
||||
<%= start_form_tag({:action => 'edit', :id => @custom_field}, :class => "tabular") %>
|
||||
<%= render :partial => 'form', :locals => { :type => @custom_field.type } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
<% labelled_tabular_form_for :custom_field, @custom_field, :url => { :action => "edit", :id => @custom_field } do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= link_to custom_field.name, :action => 'edit', :id => custom_field %></td>
|
||||
<td align="center"><%= l(custom_field.type_name) %></td>
|
||||
<td align="center"><%= l(CustomField::FIELD_FORMATS[custom_field.field_format]) %></td>
|
||||
<td align="center"><%= l(CustomField::FIELD_FORMATS[custom_field.field_format][:name]) %></td>
|
||||
<td align="center"><%= image_tag 'true' if custom_field.is_required? %></td>
|
||||
<td align="center"><%= image_tag 'true' if custom_field.is_for_all? %></td>
|
||||
<td align="center"><%= custom_field.projects.count.to_s + ' ' + lwr(:label_project, custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<h2><%=l(:label_custom_field_new)%> (<%=l(@custom_field.type_name)%>)</h2>
|
||||
|
||||
<%= start_form_tag({:action => 'new'}, :class => "tabular") %>
|
||||
<%= render :partial => 'form', :locals => { :type => @custom_field.type } %>
|
||||
<%= hidden_field_tag 'type', @custom_field.type %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
<% labelled_tabular_form_for :custom_field, @custom_field, :url => { :action => "new" } do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= hidden_field_tag 'type', @custom_field.type %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
|
|
|
@ -60,7 +60,7 @@ end %>
|
|||
<%= submit_tag l(:button_change) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="history" class="box">
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
<%= render(:partial => 'documents/document',
|
||||
:collection => Document.find(:all,
|
||||
:limit => 10,
|
||||
:order => 'documents.created_on DESC',
|
||||
:conditions => "documents.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
|
||||
:include => [:project])) unless @user.projects.empty? %>
|
|
@ -3,5 +3,6 @@
|
|||
<%= render (:partial => 'news/news',
|
||||
:collection => News.find(:all,
|
||||
:limit => 10,
|
||||
:order => 'news.created_on DESC',
|
||||
:conditions => "news.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
|
||||
:include => [:project, :author])) unless @user.projects.empty? %>
|
|
@ -17,12 +17,12 @@
|
|||
@fixed_issues.each do |issue| %>
|
||||
<% unless ver_id == issue.fixed_version_id %>
|
||||
<% if ver_id %></ul><% end %>
|
||||
<h3><%= l(:label_version) %>: <%= issue.fixed_version.name %></h3>
|
||||
<h3><%= issue.fixed_version.name %></h3>
|
||||
<p><%= format_date(issue.fixed_version.effective_date) %><br />
|
||||
<%=h issue.fixed_version.description %></p>
|
||||
<ul>
|
||||
<% ver_id = issue.fixed_version_id
|
||||
end %>
|
||||
<li><%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %> [<%= issue.tracker.name %>]: <%=h issue.subject %></li>
|
||||
<li><%= link_to "#{issue.tracker.name} #{issue.id}", :controller => 'issues', :action => 'show', :id => issue %>: <%=h issue.subject %></li>
|
||||
<% end %>
|
||||
</div>
|
|
@ -31,7 +31,7 @@
|
|||
<% if delete_allowed %>
|
||||
<td align="center">
|
||||
<div class="contextual">
|
||||
<%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy_file', :id => version, :attachment_id => file}, :confirm => l(:text_are_you_sure), :post => true, :class => 'pic picDelete' %>
|
||||
<%= link_to_if_authorized '', {:controller => 'versions', :action => 'destroy_file', :id => version, :attachment_id => file}, :confirm => l(:text_are_you_sure), :post => true, :class => 'pic picDelete' %>
|
||||
</div>
|
||||
</td>
|
||||
<% end %>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="box">
|
||||
<p><label><%= l(:label_issue_plural) %>:</label>
|
||||
<% for issue in @issues %>
|
||||
<b><%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %></b> - <%= issue.subject %>
|
||||
<b><%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %></b> - <%=h issue.subject %>
|
||||
<%= hidden_field_tag "issue_ids[]", issue.id %><br />
|
||||
<% end %>
|
||||
<i>(<%= @issues.length%> <%= lwr(:label_issue, @issues.length)%>)</i></p>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<h2><%=l(:label_overview)%></h2>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<%= simple_format(auto_link(h @project.description)) %>
|
||||
<%= simple_format(auto_link(h(@project.description))) %>
|
||||
<ul>
|
||||
<% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
|
||||
<li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
|
||||
|
|
|
@ -9,6 +9,7 @@ http://redmine.org/
|
|||
|
||||
* comments can now be added on news
|
||||
* "my page" is now customizable
|
||||
* more powerfull and savable filters for issues lists
|
||||
* improved issues change history
|
||||
* new functionality: move an issue to another project or tracker
|
||||
* new functionality: add a note to an issue
|
||||
|
@ -29,8 +30,10 @@ http://redmine.org/
|
|||
* csv output encoded to ISO-8859-1
|
||||
* user custom field displayed on account/show
|
||||
* default configuration improved (default roles, trackers, status, permissions and workflows)
|
||||
* javascript added on custom field form to show/hide fields according to the format of custom field
|
||||
* fixed: custom fields not in csv exports
|
||||
* fixed: project settings now displayed according to user's permissions
|
||||
* fixed: application error when no version is selected on projects/add_file
|
||||
|
||||
== 10/08/2006 v0.3.0
|
||||
|
||||
|
|
Loading…
Reference in New Issue