summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/projects_controller.rb7
-rw-r--r--app/helpers/application_helper.rb3
-rw-r--r--app/helpers/custom_fields_helper.rb2
-rw-r--r--app/models/custom_field.rb12
-rw-r--r--app/views/account/show.rhtml2
-rw-r--r--app/views/custom_fields/_form.rhtml96
-rw-r--r--app/views/custom_fields/edit.rhtml8
-rw-r--r--app/views/custom_fields/list.rhtml2
-rw-r--r--app/views/custom_fields/new.rhtml11
-rw-r--r--app/views/issues/show.rhtml2
-rw-r--r--app/views/my/blocks/_documents.rhtml1
-rw-r--r--app/views/my/blocks/_latest_news.rhtml1
-rw-r--r--app/views/projects/changelog.rhtml4
-rw-r--r--app/views/projects/list_files.rhtml2
-rw-r--r--app/views/projects/move_issues.rhtml2
-rw-r--r--app/views/projects/show.rhtml2
-rw-r--r--doc/CHANGELOG3
17 files changed, 93 insertions, 67 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 4151e734c..b0b00bebf 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -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
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 196d91fca..0ca2568ae 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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),
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 9df5c50a3..75b8a45cd 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -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
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 2f5f2749f..7dab23392 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -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
diff --git a/app/views/account/show.rhtml b/app/views/account/show.rhtml
index 985238951..c686b709c 100644
--- a/app/views/account/show.rhtml
+++ b/app/views/account/show.rhtml
@@ -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>
diff --git a/app/views/custom_fields/_form.rhtml b/app/views/custom_fields/_form.rhtml
index f7f968e33..cf658fb2a 100644
--- a/app/views/custom_fields/_form.rhtml
+++ b/app/views/custom_fields/_form.rhtml
@@ -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>
-&nbsp;
-
-<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>
+<% 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>
+ &nbsp;
+ <p><%= f.check_box :is_required %></p>
+ <p><%= f.check_box :is_for_all %></p>
+
+<% when "UserCustomField" %>
+ <p><%= f.check_box :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>
diff --git a/app/views/custom_fields/edit.rhtml b/app/views/custom_fields/edit.rhtml
index 201047a8d..ef056fa41 100644
--- a/app/views/custom_fields/edit.rhtml
+++ b/app/views/custom_fields/edit.rhtml
@@ -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 %>
diff --git a/app/views/custom_fields/list.rhtml b/app/views/custom_fields/list.rhtml
index 858590c49..8e4573aed 100644
--- a/app/views/custom_fields/list.rhtml
+++ b/app/views/custom_fields/list.rhtml
@@ -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>
diff --git a/app/views/custom_fields/new.rhtml b/app/views/custom_fields/new.rhtml
index 3b215dc9f..2e8aa2750 100644
--- a/app/views/custom_fields/new.rhtml
+++ b/app/views/custom_fields/new.rhtml
@@ -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 %>
diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml
index 93b8cd008..8390f8282 100644
--- a/app/views/issues/show.rhtml
+++ b/app/views/issues/show.rhtml
@@ -60,7 +60,7 @@ end %>
<%= submit_tag l(:button_change) %>
<%= end_form_tag %>
<% end %>
-
+&nbsp;
</div>
<div id="history" class="box">
diff --git a/app/views/my/blocks/_documents.rhtml b/app/views/my/blocks/_documents.rhtml
index 8e7f6bc50..eb8c16a58 100644
--- a/app/views/my/blocks/_documents.rhtml
+++ b/app/views/my/blocks/_documents.rhtml
@@ -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? %> \ No newline at end of file
diff --git a/app/views/my/blocks/_latest_news.rhtml b/app/views/my/blocks/_latest_news.rhtml
index 625603ac0..4bad9a542 100644
--- a/app/views/my/blocks/_latest_news.rhtml
+++ b/app/views/my/blocks/_latest_news.rhtml
@@ -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? %> \ No newline at end of file
diff --git a/app/views/projects/changelog.rhtml b/app/views/projects/changelog.rhtml
index e59df059d..250957a8c 100644
--- a/app/views/projects/changelog.rhtml
+++ b/app/views/projects/changelog.rhtml
@@ -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> \ No newline at end of file
diff --git a/app/views/projects/list_files.rhtml b/app/views/projects/list_files.rhtml
index 881829a44..61c6d2c80 100644
--- a/app/views/projects/list_files.rhtml
+++ b/app/views/projects/list_files.rhtml
@@ -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 %>
diff --git a/app/views/projects/move_issues.rhtml b/app/views/projects/move_issues.rhtml
index 380d47fd5..772cdeb0d 100644
--- a/app/views/projects/move_issues.rhtml
+++ b/app/views/projects/move_issues.rhtml
@@ -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>
diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml
index 46f17d9b9..d5da126e2 100644
--- a/app/views/projects/show.rhtml
+++ b/app/views/projects/show.rhtml
@@ -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>
diff --git a/doc/CHANGELOG b/doc/CHANGELOG
index ce9d933ac..4c4ba17c7 100644
--- a/doc/CHANGELOG
+++ b/doc/CHANGELOG
@@ -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