Module: ProjectsQueriesHelper

Includes:
ApplicationHelper
Included in:
ProjectsController
Defined in:
app/helpers/projects_queries_helper.rb

Overview

Redmine - project management software Copyright © 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.

Constant Summary

Constants included from ApplicationHelper

ApplicationHelper::ATTACHMENT_CONTAINER_LINK, ApplicationHelper::HEADING_RE, ApplicationHelper::LINKS_RE, ApplicationHelper::MACROS_RE, ApplicationHelper::MACRO_SUB_RE, ApplicationHelper::RECORD_LINK, ApplicationHelper::TOC_RE

Constants included from IconsHelper

IconsHelper::DEFAULT_ICON_SIZE, IconsHelper::DEFAULT_SPRITE

Instance Method Summary collapse

Methods included from ApplicationHelper

#accesskey, #actions_dropdown, #anchor, #api_meta, #authoring, #authorize_for, #back_url_hidden_field_tag, #body_css_classes, #breadcrumb, #bulk_edit_error_messages, #calendar_for, #cancel_button_tag, #catch_macros, #check_all_links, #checked_image, #context_menu, #copy_object_url_link, #default_search_project_scope, #delete_link, #due_date_distance_in_words, #email_delivery_enabled?, #error_messages_for, #export_csv_encoding_select_tag, #export_csv_separator_select_tag, #favicon, #favicon_path, #favicon_url, #form_tag_html, #format_activity_day, #format_activity_description, #format_activity_title, #format_changeset_comments, #format_object, #format_version_name, #get_tab_action, #heads_for_auto_complete, #html_hours, #html_title, #image_tag, #include_calendar_headers_tags, #include_in_api_response?, #inject_macros, #javascript_heads, #javascript_include_tag, #labelled_fields_for, #labelled_form_for, #lang_options_for_select, #link_to_attachment, #link_to_attachment_container, #link_to_context_menu, #link_to_function, #link_to_group, #link_to_if_authorized, #link_to_issue, #link_to_message, #link_to_month, #link_to_next_month, #link_to_previous_month, #link_to_principal, #link_to_project, #link_to_project_settings, #link_to_record, #link_to_revision, #link_to_user, #link_to_version, #option_tag, #other_formats_links, #page_header_title, #parse_headings, #parse_hires_images, #parse_inline_attachments, #parse_non_pre_blocks, #parse_redmine_links, #parse_sections, #parse_wiki_links, #principals_check_box_tags, #principals_options_for_select, #progress_bar, #project_tree, #project_tree_options_for_select, #projects_for_jump_box, #raw_json, #render_error_messages, #render_flash_messages, #render_if_exist, #render_page_hierarchy, #render_project_jump_box, #render_project_nested_lists, #render_projects_for_jump_box, #render_tabs, #reorder_handle, #replace_toc, #robot_exclusion_tag, #sanitize_anchor_name, #sidebar_content?, #simple_format_without_paragraph, #stylesheet_link_tag, #syntax_highlight, #syntax_highlight_lines, #textilizable, #thumbnail_tag, #time_tag, #title, #to_path_param, #toggle_checkboxes_link, #toggle_link, #truncate_lines, #truncate_single_line_raw, #update_data_sources_for_auto_complete, #view_layouts_base_sidebar_hook_response, #wiki_page_path

Methods included from IconsHelper

#activity_event_type_icon, #file_icon, #principal_icon, #sprite_icon

Methods included from Redmine::Helpers::URL

#uri_with_link_safe_scheme?, #uri_with_safe_scheme?

Methods included from Redmine::Hook::Helper

#call_hook

Methods included from Redmine::Themes::Helper

#current_theme, #heads_for_theme

Methods included from Redmine::SudoMode::Helper

#hash_to_hidden_fields

Methods included from Redmine::Pagination::Helper

#pagination_links_each, #pagination_links_full, #per_page_links, #per_page_options

Methods included from Redmine::I18n

#abbr_day_name, #current_language, #day_letter, #day_name, #find_language, #format_date, #format_hours, #format_time, included, #l, #l_hours, #l_hours_short, #l_or_humanize, #languages_options, #ll, #lu, #month_name, #normalize_float, #set_language_if_valid, #valid_languages

Methods included from Redmine::WikiFormatting::Macros::Definitions

#exec_macro, #extract_macro_options, #macro_exists?

Instance Method Details

#column_value(column, item, value) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/helpers/projects_queries_helper.rb', line 22

def column_value(column, item, value)
  if item.is_a?(Project)
    case column.name
    when :name
      link_to_project(item) +
        (tag.span(sprite_icon('user', l(:label_my_projects), icon_only: true), class: 'icon-only icon-user my-project') if User.current.member_of?(item)) +
        (tag.span(sprite_icon('bookmarked', l(:label_my_bookmarks), icon_only: true), class: 'icon-only icon-bookmarked-project') if User.current.bookmarked_project_ids.include?(item.id))
    when :short_description
      if item.description?
        # Sets :inline_attachments to false to avoid performance issues
        # caused by unnecessary loading of attachments
        ('div', textilizable(item, :short_description, :inline_attachments => false), :class => 'wiki')
      else
        ''
      end
    when :homepage
      item.homepage? ? ('div', textilizable(item, :homepage), :class => "wiki") : ''
    when :status
      get_project_status_label[column.value_object(item)]
    when :parent_id
      link_to_project(item.parent) unless item.parent.nil?
    when :last_activity_date
      formatted_value = super
      if value.present? && formatted_value.present?
        link_to(
          formatted_value,
          project_activity_path(item, :from => User.current.time_to_date(value))
        )
      else
        formatted_value
      end
    else
      super
    end
  end
end

#csv_value(column, object, value) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'app/helpers/projects_queries_helper.rb', line 59

def csv_value(column, object, value)
  if object.is_a?(Project)
    case column.name
    when :status
      get_project_status_label[column.value_object(object)]
    when :parent_id
      object.parent.name unless object.parent.nil?
    else
      super
    end
  end
end