Feature #1358 » linkable_custom_fields.diff
| app/helpers/queries_helper.rb (working copy) | ||
|---|---|---|
|
def column_content(column, issue)
|
||
|
if column.is_a?(QueryCustomFieldColumn)
|
||
|
cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id}
|
||
|
show_value(cv)
|
||
|
show_value_plain(cv)
|
||
|
else
|
||
|
value = issue.send(column.name)
|
||
|
if value.is_a?(Date)
|
||
| app/helpers/timelog_helper.rb (working copy) | ||
|---|---|---|
|
entry.hours.to_s.gsub('.', decimal_separator),
|
||
|
entry.comments
|
||
|
]
|
||
|
fields += custom_fields.collect {|f| show_value(entry.custom_value_for(f)) }
|
||
|
fields += custom_fields.collect {|f| show_value_plain(entry.custom_value_for(f)) }
|
||
|
|
||
|
csv << fields.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end }
|
||
|
end
|
||
| app/helpers/custom_fields_helper.rb (working copy) | ||
|---|---|---|
|
def custom_field_tag_with_label(name, custom_value)
|
||
|
custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value)
|
||
|
end
|
||
|
|
||
|
# Return a clean URL for a given custom field value
|
||
|
def url_format(custom_value)
|
||
|
url = custom_value.custom_field.url.strip
|
||
|
return false unless url.length > 0
|
||
|
# Return a string used to display a custom value
|
||
|
formatted_value = format_value(custom_value.value, custom_value.custom_field.field_format)
|
||
|
while (url.sub!(/__VALUE__/, h(formatted_value.strip)))
|
||
|
end
|
||
|
return url
|
||
|
end
|
||
|
# Return a formatted string used to display a custom value (including link if URL defined on custom_field)
|
||
|
def show_value(custom_value)
|
||
|
return "" unless custom_value
|
||
|
format_value(custom_value.value, custom_value.custom_field.field_format)
|
||
|
formatted_value = format_value(custom_value.value, custom_value.custom_field.field_format)
|
||
|
if (value = url_format(custom_value))
|
||
|
return link_to formatted_value, value, :target=>'_blank'
|
||
|
else
|
||
|
return h(format_value(custom_value.value, custom_value.custom_field.field_format))
|
||
|
end
|
||
|
end
|
||
|
# Return an escaped string used to display a custom value
|
||
|
def show_value_plain(custom_value)
|
||
|
return "" unless custom_value
|
||
|
return h(format_value(custom_value.value, custom_value.custom_field.field_format))
|
||
|
end
|
||
|
|
||
|
# Return a string used to display a custom value
|
||
|
def format_value(value, field_format)
|
||
| app/views/custom_fields/_form.rhtml (working copy) | ||
|---|---|---|
|
p_regexp = $("custom_field_regexp");
|
||
|
p_values = $("custom_field_possible_values");
|
||
|
p_searchable = $("custom_field_searchable");
|
||
|
p_url = $("custom_field_url");
|
||
|
p_default = $("custom_field_default_value");
|
||
|
|
||
|
p_default.setAttribute('type','text');
|
||
| ... | ... | |
|
:rows => 15 %>
|
||
|
<br /><em><%= l(:text_custom_field_possible_values_info) %></em></p>
|
||
|
<p><%= @custom_field.field_format == 'bool' ? f.check_box(:default_value) : f.text_field(:default_value) %></p>
|
||
|
<p><%= f.text_field :url, :size => 60 %>
|
||
|
<br /><%= l(:text_custom_field_url_info) %></p>
|
||
|
</div>
|
||
|
<div class="box">
|
||
| app/views/mailer/_issue_text_plain.rhtml (working copy) | ||
|---|---|---|
|
<%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
|
||
|
<%=l(:field_category)%>: <%= issue.category %>
|
||
|
<%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
|
||
|
<% issue.custom_values.each do |c| %><%= c.custom_field.name %>: <%= show_value(c) %>
|
||
|
<% issue.custom_values.each do |c| %><%= c.custom_field.name %>: <%= show_value_plain(c) %>
|
||
|
<% end %>
|
||
|
<%= issue.description %>
|
||
| app/views/projects/show.rhtml (working copy) | ||
|---|---|---|
|
<% end %>
|
||
|
<% @project.custom_values.each do |custom_value| %>
|
||
|
<% if !custom_value.value.empty? %>
|
||
|
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
|
||
|
<li><%= custom_value.custom_field.name%>: <%= show_value(custom_value) %></li>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
</ul>
|
||
| app/views/account/show.rhtml (working copy) | ||
|---|---|---|
|
<% end %>
|
||
|
<% for custom_value in @custom_values %>
|
||
|
<% if !custom_value.value.empty? %>
|
||
|
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
|
||
|
<li><%= custom_value.custom_field.name%>: <%= show_value(custom_value) %></li>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
<li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
|
||
| app/views/issues/show.rhtml (working copy) | ||
|---|---|---|
|
<tr>
|
||
|
<% n = 0 -%>
|
||
|
<% @issue.custom_values.each do |value| -%>
|
||
|
<td valign="top"><b><%=h value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(h(show_value(value))) %></td>
|
||
|
<td valign="top"><b><%=h value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(show_value(value)) %></td>
|
||
|
<% n = n + 1
|
||
|
if (n > 1)
|
||
|
n = 0 %>
|
||
| config/locales/en.yml (working copy) | ||
|---|---|---|
|
text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
|
||
|
text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
|
||
|
text_custom_field_possible_values_info: 'One line for each value'
|
||
|
text_custom_field_url_info: '(__VALUE__ is a placeholder for each of the field values, eg. http://www.google.com/search?q=__VALUE__)'
|
||
|
|
||
|
default_role_manager: Manager
|
||
|
default_role_developper: Developer
|
||
| db/migrate/20090304184821_add_custom_fields_url.rb (revision 0) | ||
|---|---|---|
|
class AddCustomFieldsUrl < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
add_column :custom_fields, :url, :string, :limit=>255, :default=>"", :null=>false
|
||
|
end
|
||
|
def self.down
|
||
|
remove_column :custom_fields, :url
|
||
|
end
|
||
|
end
|
||