From c42fdcd26abe8075e8f98639a0721bf066ea9bac Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 18 May 2011 02:46:24 +0000 Subject: [PATCH] remove trailing white-spaces from application helper source. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5832 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 88 +++++++++++++++---------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c2b8e3543..f6b1b2bf7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -63,7 +63,7 @@ module ApplicationHelper # Displays a link to +issue+ with its subject. # Examples: - # + # # link_to_issue(issue) # => Defect #6: This is the subject # link_to_issue(issue, :truncate => 6) # => Defect #6: This i... # link_to_issue(issue, :subject => false) # => Defect #6 @@ -80,7 +80,7 @@ module ApplicationHelper subject = truncate(subject, :length => options[:truncate]) end end - s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, + s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, :class => issue.css_classes, :title => title s << ": #{h subject}" if subject @@ -109,7 +109,7 @@ module ApplicationHelper link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => rev}, :title => l(:label_revision_id, format_revision(revision))) end - + # Generates a link to a message def link_to_message(message, options={}, html_options = nil) link_to( @@ -126,7 +126,7 @@ module ApplicationHelper # Generates a link to a project if active # Examples: - # + # # link_to_project(project) # => link to the specified project overview # link_to_project(project, :action=>'settings') # => link to project settings # link_to_project(project, {:only_path => false}, :class => "project") # => 3rd arg adds html options @@ -160,15 +160,15 @@ module ApplicationHelper html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" link_to name, {}, html_options end - + def format_activity_title(text) h(truncate_single_line(text, :length => 100)) end - + def format_activity_day(date) date == Date.today ? l(:label_today).titleize : format_date(date) end - + def format_activity_description(text) h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "
") end @@ -180,7 +180,7 @@ module ApplicationHelper h("#{version.project} - #{version}") end end - + def due_date_distance_in_words(date) if date l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date)) @@ -202,7 +202,7 @@ module ApplicationHelper end content end - + # Renders flash messages def render_flash_messages s = '' @@ -211,7 +211,7 @@ module ApplicationHelper end s end - + # Renders tabs and their content def render_tabs(tabs) if tabs.any? @@ -220,7 +220,7 @@ module ApplicationHelper content_tag 'p', l(:label_no_data), :class => "nodata" end end - + # Renders the project quick-jump box def render_project_jump_box return unless User.current.logged? @@ -236,7 +236,7 @@ module ApplicationHelper s end end - + def project_tree_options_for_select(projects, options = {}) s = '' project_tree(projects) do |project, level| @@ -252,14 +252,14 @@ module ApplicationHelper end s end - + # Yields the given block for each project with its level in the tree # # Wrapper for Project#project_tree def project_tree(projects, &block) Project.project_tree(projects, &block) end - + def project_nested_ul(projects, &block) s = '' if projects.any? @@ -270,7 +270,7 @@ module ApplicationHelper else ancestors.pop s << "" - while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) + while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) ancestors.pop s << "\n" end @@ -283,20 +283,20 @@ module ApplicationHelper end s end - + def principals_check_box_tags(name, principals) s = '' principals.sort.each do |principal| s << "\n" end - s + s end # Truncates and returns the string as a single line def truncate_single_line(string, *args) truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ') end - + # Truncates at line break after 250 characters or options[:length] def truncate_lines(string, options={}) length = options[:length] || 250 @@ -314,7 +314,7 @@ module ApplicationHelper def authoring(created, author, options={}) l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)) end - + def time_tag(time) text = distance_of_time_in_words(Time.now, time) if @project @@ -345,7 +345,7 @@ module ApplicationHelper html << (pagination_links_each(paginator, options) do |n| link_to_content_update(n.to_s, url_param.merge(page_param => n)) end || '') - + if paginator.current.next html << ' ' + link_to_content_update((l(:label_next) + ' »'), url_param.merge(page_param => paginator.current.next)) end @@ -359,14 +359,14 @@ module ApplicationHelper html end - + def per_page_links(selected=nil) links = Setting.per_page_options_array.collect do |n| n == selected ? n : link_to_content_update(n, params.merge(:per_page => n)) end links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil end - + def reorder_links(name, url) link_to(image_tag('2uparrow.png', :alt => l(:label_sort_highest)), url.merge({"#{name}[move_to]" => 'highest'}), :method => :post, :title => l(:label_sort_highest)) + link_to(image_tag('1uparrow.png', :alt => l(:label_sort_higher)), url.merge({"#{name}[move_to]" => 'higher'}), :method => :post, :title => l(:label_sort_higher)) + @@ -378,13 +378,13 @@ module ApplicationHelper elements = args.flatten elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil end - + def other_formats_links(&block) concat('

' + l(:label_export_to)) yield Redmine::Views::OtherFormatsBuilder.new(self) concat('

') end - + def page_header_title if @project.nil? || @project.new_record? h(Setting.app_title) @@ -457,21 +457,21 @@ module ApplicationHelper only_path = options.delete(:only_path) == false ? false : true text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr) { |macro, args| exec_macro(macro, obj, args) } - + @parsed_headings = [] text = parse_non_pre_blocks(text) do |text| [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links, :parse_headings].each do |method_name| send method_name, text, project, obj, attr, only_path, options end end - + if @parsed_headings.any? replace_toc(text, @parsed_headings) end - + text end - + def parse_non_pre_blocks(text) s = StringScanner.new(text) tags = [] @@ -500,13 +500,13 @@ module ApplicationHelper end parsed end - + def parse_inline_attachments(text, project, obj, attr, only_path, options) # when using an image link, try to use an attachment, if possible if options[:attachments] || (obj && obj.respond_to?(:attachments)) attachments = nil text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| - filename, ext, alt, alttext = $1.downcase, $2, $3, $4 + filename, ext, alt, alttext = $1.downcase, $2, $3, $4 attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse # search for the picture in attachments if found = attachments.detect { |att| att.filename.downcase == filename } @@ -569,7 +569,7 @@ module ApplicationHelper end end end - + # Redmine links # # Examples: @@ -692,14 +692,14 @@ module ApplicationHelper leading + (link || "#{project_prefix}#{prefix}#{sep}#{identifier}") end end - + HEADING_RE = /]+)?>(.+?)<\/h(1|2|3|4)>/i unless const_defined?(:HEADING_RE) - + # Headings and TOC # Adds ids and links to headings unless options[:headings] is set to false def parse_headings(text, project, obj, attr, only_path, options) return if options[:headings] == false - + text.gsub!(HEADING_RE) do level, attrs, content = $1.to_i, $2, $3 item = strip_tags(content).strip @@ -708,9 +708,9 @@ module ApplicationHelper "\n#{content}" end end - + TOC_RE = /

\{\{([<>]?)toc\}\}<\/p>/i unless const_defined?(:TOC_RE) - + # Renders the TOC with given headings def replace_toc(text, headings) text.gsub!(TOC_RE) do @@ -793,13 +793,13 @@ module ApplicationHelper ), :class => 'progress', :style => "width: #{width};") + content_tag('p', legend, :class => 'pourcent') end - + def checked_image(checked=true) if checked image_tag 'toggle_check.png' end end - + def context_menu(url) unless @context_menu_included content_for :header_tags do @@ -852,10 +852,10 @@ module ApplicationHelper else '' # use language end - + javascript_include_tag('calendar/calendar') + javascript_include_tag("calendar/lang/calendar-#{current_language.to_s.downcase}.js") + - javascript_tag(start_of_week) + + javascript_tag(start_of_week) + javascript_include_tag('calendar/calendar-setup') + stylesheet_link_tag('calendar') end @@ -888,7 +888,7 @@ module ApplicationHelper '' end end - + # Returns the javascript tags that are included in the html layout head def javascript_heads tags = javascript_include_tag(:defaults) @@ -905,7 +905,7 @@ module ApplicationHelper def robot_exclusion_tag '' end - + # Returns true if arg is expected in the API response def include_in_api_response?(arg) unless @included_in_api_response @@ -927,7 +927,7 @@ module ApplicationHelper options end end - + private def wiki_helper @@ -935,7 +935,7 @@ module ApplicationHelper extend helper return self end - + def link_to_content_update(text, url_params = {}, html_options = {}) link_to(text, url_params, html_options) end -- 2.39.5