##// END OF EJS Templates
fixed french issue_edit mail template...
fixed french issue_edit mail template git-svn-id: http://redmine.rubyforge.org/svn/trunk@203 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r97:918123cd0663
r200:18fd46ab6b9b
Show More
custom_fields_helper.rb
77 lines | 3.0 KiB | text/x-ruby | RubyLexer
/ app / helpers / custom_fields_helper.rb
Jean-Philippe Lang
Initial commit...
r2 # redMine - project management software
# Copyright (C) 2006 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module CustomFieldsHelper
Jean-Philippe Lang
0.3 unstable...
r10
Jean-Philippe Lang
custom field tags...
r18 # Return custom field html tag corresponding to its format
Jean-Philippe Lang
0.3 unstable...
r10 def custom_field_tag(custom_value)
custom_field = custom_value.custom_field
field_name = "custom_fields[#{custom_field.id}]"
Jean-Philippe Lang
notice messages translation...
r15 field_id = "custom_fields_#{custom_field.id}"
Jean-Philippe Lang
0.3 unstable...
r10 case custom_field.field_format
Jean-Philippe Lang
date picker...
r27 when "string", "int"
Jean-Philippe Lang
custom field tags...
r18 text_field 'custom_value', 'value', :name => field_name, :id => field_id
Jean-Philippe Lang
date picker...
r27 when "date"
text_field('custom_value', 'value', :name => field_name, :id => field_id, :size => 10) +
calendar_for(field_id)
Jean-Philippe Lang
0.3 unstable...
r10 when "text"
Jean-Philippe Lang
custom field tags...
r18 text_area 'custom_value', 'value', :name => field_name, :id => field_id, :cols => 60, :rows => 3
Jean-Philippe Lang
0.3 unstable...
r10 when "bool"
Jean-Philippe Lang
custom field tags...
r18 check_box 'custom_value', 'value', :name => field_name, :id => field_id
Jean-Philippe Lang
0.3 unstable...
r10 when "list"
Jean-Philippe Lang
custom field tags...
r18 select 'custom_value', 'value', custom_field.possible_values.split('|'), { :include_blank => true }, :name => field_name, :id => field_id
Jean-Philippe Lang
0.3 unstable...
r10 end
end
Jean-Philippe Lang
custom field tags...
r18 # Return custom field label tag
Jean-Philippe Lang
0.3 unstable...
r10 def custom_field_label_tag(custom_value)
content_tag "label", custom_value.custom_field.name +
Jean-Philippe Lang
notice messages translation...
r15 (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""),
Jean-Philippe Lang
tables and forms redesign,...
r19 :for => "custom_fields_#{custom_value.custom_field.id}",
:class => (custom_value.errors.empty? ? nil : "error" )
Jean-Philippe Lang
0.3 unstable...
r10 end
Jean-Philippe Lang
custom field tags...
r18 # Return custom field tag with its label tag
Jean-Philippe Lang
0.3 unstable...
r10 def custom_field_tag_with_label(custom_value)
Jean-Philippe Lang
tables and forms redesign,...
r19 custom_field_label_tag(custom_value) + custom_field_tag(custom_value)
Jean-Philippe Lang
0.3 unstable...
r10 end
Jean-Philippe Lang
custom field tags...
r18 # Return a string used to display a custom value
Jean-Philippe Lang
0.3 unstable...
r10 def show_value(custom_value)
Jean-Philippe Lang
* single/multiple issues pdf export added...
r35 return "" unless custom_value
Jean-Philippe Lang
improved issues change history...
r52 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)
return "" unless value
case field_format
Jean-Philippe Lang
git-svn-id: http://redmine.rubyforge.org/svn/trunk@31 e93f8b46-1217-0410-a6f0-8f06a7374b81
r29 when "date"
Jean-Philippe Lang
improved issues change history...
r52 value.empty? ? "" : l_date(value.to_date)
Jean-Philippe Lang
0.3 unstable...
r10 when "bool"
Jean-Philippe Lang
improved issues change history...
r52 l_YesNo(value == "1")
Jean-Philippe Lang
0.3 unstable...
r10 else
Jean-Philippe Lang
improved issues change history...
r52 value
end
Jean-Philippe Lang
0.3 unstable...
r10 end
Jean-Philippe Lang
custom field tags...
r18 # Return an array of custom field formats which can be used in select_tag
Jean-Philippe Lang
0.3 unstable...
r10 def custom_field_formats_for_select
Jean-Philippe Lang
* code and views cleaning...
r97 CustomField::FIELD_FORMATS.sort {|a,b| a[1][:order]<=>b[1][:order]}.collect { |k| [ l(k[1][:name]), k[0] ] }
Jean-Philippe Lang
0.3 unstable...
r10 end
Jean-Philippe Lang
Initial commit...
r2 end