Revision 757:d38f5a55c590 vendor/plugins/redmine_tags/app
| vendor/plugins/redmine_tags/app/helpers/filters_helper.rb | ||
|---|---|---|
| 1 |
# This file is a part of redmine_tags |
|
| 2 |
# redMine plugin, that adds tagging support. |
|
| 3 |
# |
|
| 4 |
# Copyright (c) 2010 Aleksey V Zapparov AKA ixti |
|
| 5 |
# |
|
| 6 |
# redmine_tags is free software: you can redistribute it and/or modify |
|
| 7 |
# it under the terms of the GNU General Public License as published by |
|
| 8 |
# the Free Software Foundation, either version 3 of the License, or |
|
| 9 |
# (at your option) any later version. |
|
| 10 |
# |
|
| 11 |
# redmine_tags is distributed in the hope that it will be useful, |
|
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 14 |
# GNU General Public License for more details. |
|
| 15 |
# |
|
| 16 |
# You should have received a copy of the GNU General Public License |
|
| 17 |
# along with redmine_tags. If not, see <http://www.gnu.org/licenses/>. |
|
| 18 |
|
|
| 19 |
module FiltersHelper |
|
| 20 |
# returns link to the page with issues filtered by specified filters |
|
| 21 |
# === parameters |
|
| 22 |
# * <i>title</i> = link title text |
|
| 23 |
# * <i>filters</i> = filters to be applied (see <tt>link_to_filter_options</tt> for details) |
|
| 24 |
# * <i>options</i> = (optional) base options of the link |
|
| 25 |
# === example |
|
| 26 |
# link_to_filter 'foobar', [[ :tags, '~', 'foobar' ]] |
|
| 27 |
# link_to_filter 'foobar', [[ :tags, '~', 'foobar' ]], :project_id => project |
|
| 28 |
def link_to_filter(title, filters, options = {})
|
|
| 29 |
options.merge! link_to_filter_options(filters) |
|
| 30 |
link_to title, options |
|
| 31 |
end |
|
| 32 |
|
|
| 33 |
|
|
| 34 |
# returns hash suitable for passing it to the <tt>to_link</tt> |
|
| 35 |
# === parameters |
|
| 36 |
# * <i>filters</i> = array of arrays. each child array is an array of strings: |
|
| 37 |
# name, operator and value |
|
| 38 |
# === example |
|
| 39 |
# link_to 'foobar', link_to_filter_options [[ :tags, '~', 'foobar' ]] |
|
| 40 |
# |
|
| 41 |
# filters = [[ :tags, '~', 'bazbaz' ], [:status_id, 'o']] |
|
| 42 |
# link_to 'bazbaz', link_to_filter_options filters |
|
| 43 |
def link_to_filter_options(filters) |
|
| 44 |
options = {
|
|
| 45 |
:controller => 'issues', |
|
| 46 |
:action => 'index', |
|
| 47 |
:set_filter => 1, |
|
| 48 |
:fields => [], |
|
| 49 |
:values => {},
|
|
| 50 |
:operators => {}
|
|
| 51 |
} |
|
| 52 |
|
|
| 53 |
filters.each do |f| |
|
| 54 |
name, operator, value = f |
|
| 55 |
options[:fields].push(name) |
|
| 56 |
options[:operators][name] = operator |
|
| 57 |
options[:values][name] = [value] |
|
| 58 |
end |
|
| 59 |
|
|
| 60 |
options |
|
| 61 |
end |
|
| 62 |
end |
|
| vendor/plugins/redmine_tags/app/helpers/tags_helper.rb | ||
|---|---|---|
| 1 |
# This file is a part of redmine_tags |
|
| 2 |
# redMine plugin, that adds tagging support. |
|
| 3 |
# |
|
| 4 |
# Copyright (c) 2010 Aleksey V Zapparov AKA ixti |
|
| 5 |
# |
|
| 6 |
# redmine_tags is free software: you can redistribute it and/or modify |
|
| 7 |
# it under the terms of the GNU General Public License as published by |
|
| 8 |
# the Free Software Foundation, either version 3 of the License, or |
|
| 9 |
# (at your option) any later version. |
|
| 10 |
# |
|
| 11 |
# redmine_tags is distributed in the hope that it will be useful, |
|
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 14 |
# GNU General Public License for more details. |
|
| 15 |
# |
|
| 16 |
# You should have received a copy of the GNU General Public License |
|
| 17 |
# along with redmine_tags. If not, see <http://www.gnu.org/licenses/>. |
|
| 18 |
|
|
| 19 |
module TagsHelper |
|
| 20 |
include ActsAsTaggableOn::TagsHelper |
|
| 21 |
include FiltersHelper |
|
| 22 |
|
|
| 23 |
|
|
| 24 |
# Returns tag link |
|
| 25 |
# === Parameters |
|
| 26 |
# * <i>tag</i> = Instance of Tag |
|
| 27 |
# * <i>options</i> = (optional) Options (override system settings) |
|
| 28 |
# * show_count - Boolean. Whenever show tag counts |
|
| 29 |
# * open_only - Boolean. Whenever link to the filter with "open" issues |
|
| 30 |
# only limit. |
|
| 31 |
def render_tag_link(tag, options = {})
|
|
| 32 |
filters = [[:tags, '=', tag.name]] |
|
| 33 |
filters << [:status_id, 'o'] if options[:open_only] |
|
| 34 |
|
|
| 35 |
content = link_to_filter tag.name, filters, :project_id => @project |
|
| 36 |
if options[:show_count] |
|
| 37 |
content << content_tag('span', "(#{tag.count})", :class => 'tag-count')
|
|
| 38 |
end |
|
| 39 |
|
|
| 40 |
content_tag('span', content, :class => 'tag-label')
|
|
| 41 |
end |
|
| 42 |
|
|
| 43 |
def render_project_tag_link(tag) |
|
| 44 |
content = link_to tag.name, :controller => :projects, :action => :index, :project => { :tag_list => tag.name }
|
|
| 45 |
content_tag('span', content, :class => 'tag-label')
|
|
| 46 |
end |
|
| 47 |
|
|
| 48 |
|
|
| 49 |
# Renders list of tags |
|
| 50 |
# Clouds are rendered as block <tt>div</tt> with internal <tt>span</t> per tag. |
|
| 51 |
# Lists are rendered as unordered lists <tt>ul</tt>. Lists are ordered by |
|
| 52 |
# <tt>tag.count</tt> descending. |
|
| 53 |
# === Parameters |
|
| 54 |
# * <i>tags</i> = Array of Tag instances |
|
| 55 |
# * <i>options</i> = (optional) Options (override system settings) |
|
| 56 |
# * show_count - Boolean. Whenever show tag counts |
|
| 57 |
# * open_only - Boolean. Whenever link to the filter with "open" issues |
|
| 58 |
# only limit. |
|
| 59 |
# * style - list, cloud |
|
| 60 |
def render_tags_list(tags, options = {})
|
|
| 61 |
unless tags.nil? or tags.empty? |
|
| 62 |
content, style = '', options.delete(:style) |
|
| 63 |
|
|
| 64 |
tags.sort! { |a,b| b.count <=> a.count }
|
|
| 65 |
|
|
| 66 |
if :list == style |
|
| 67 |
list_el, item_el = 'ul', 'li' |
|
| 68 |
elsif :cloud == style |
|
| 69 |
list_el, item_el = 'div', 'span' |
|
| 70 |
tags = cloudify(tags) |
|
| 71 |
else |
|
| 72 |
raise "Unknown list style" |
|
| 73 |
end |
|
| 74 |
|
|
| 75 |
tag_cloud tags, (1..8).to_a do |tag, weight| |
|
| 76 |
content << " " + content_tag(item_el, render_tag_link(tag, options), :class => "tag-nube-#{weight}") + " "
|
|
| 77 |
end |
|
| 78 |
|
|
| 79 |
content_tag(list_el, content, :class => 'tags') |
|
| 80 |
end |
|
| 81 |
end |
|
| 82 |
|
|
| 83 |
private |
|
| 84 |
# put most massive tags in the middle |
|
| 85 |
def cloudify(tags) |
|
| 86 |
temp, tags, trigger = tags, [], true |
|
| 87 |
temp.each do |tag| |
|
| 88 |
tags.send((trigger ? 'push' : 'unshift'), tag) |
|
| 89 |
trigger = !trigger |
|
| 90 |
end |
|
| 91 |
tags |
|
| 92 |
end |
|
| 93 |
|
|
| 94 |
end |
|
| vendor/plugins/redmine_tags/app/views/auto_completes/_tag_list.html.erb | ||
|---|---|---|
| 1 |
<ul> |
|
| 2 |
<% @tags.each do |tag| -%> |
|
| 3 |
<%= content_tag 'li', h('%s (%d)' % [tag.name, tag.count]), :name => tag.name %>
|
|
| 4 |
<% end -%> |
|
| 5 |
<%= content_tag 'li', l(:auto_complete_new_tag) % @name, :name => @name %> |
|
| 6 |
</ul> |
|
| vendor/plugins/redmine_tags/app/views/issues/_tags.html.erb | ||
|---|---|---|
| 1 |
<% unless issue.tag_list.empty? %> |
|
| 2 |
<tr> |
|
| 3 |
<td><b><%=l(:tags)%>:</b></td> |
|
| 4 |
<td><%= issue.tag_counts.collect{ |t| render_tag_link(t, :show_count => false, :open_only => false) }.join(', ') %></td>
|
|
| 5 |
</tr> |
|
| 6 |
<% end %> |
|
| vendor/plugins/redmine_tags/app/views/issues/_tags_form.html.erb | ||
|---|---|---|
| 1 |
<% fields_for :issue, issue, :builder => TabularFormBuilder do |f| -%> |
|
| 2 |
<div> |
|
| 3 |
<p id="issue_tags"><%= f.text_field :tag_list, :label => :tags, :size => 60, :class => 'hol' %></p> |
|
| 4 |
<div id="issue_tag_candidates" class="autocomplete"></div> |
|
| 5 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> |
|
| 6 |
<%= javascript_tag "observeIssueTagsField('#{url_for(:controller => 'auto_completes', :action => 'issue_tags', :project_id => issue.project)}')" %>
|
|
| 7 |
</div> |
|
| 8 |
<% end -%> |
|
| vendor/plugins/redmine_tags/app/views/issues/_tags_sidebar.html.erb | ||
|---|---|---|
| 1 |
<% unless sidebar_tags.empty? -%> |
|
| 2 |
<%= stylesheet_link_tag 'redmine_tags', :plugin => 'redmine_tags' %> |
|
| 3 |
<h3><%= l(:tags) %></h3> |
|
| 4 |
<%= render_sidebar_tags %> |
|
| 5 |
<% end -%> |
|
| vendor/plugins/redmine_tags/app/views/projects/_filter_tags.rhtml | ||
|---|---|---|
| 1 |
<p class='tag'> |
|
| 2 |
<% fields_for @project, :builder => TabularFormBuilder do |f| -%> |
|
| 3 |
<div> |
|
| 4 |
<p id="project_tags"> |
|
| 5 |
<%= f.text_field :tag_list, :label => :tags, :size => 60, :class => 'hol' %> |
|
| 6 |
</p> |
|
| 7 |
<div id="project_tag_candidates" class="autocomplete"></div> |
|
| 8 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> |
|
| 9 |
|
|
| 10 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags')}')" %>
|
|
| 11 |
</div> |
|
| 12 |
<% end -%> |
|
| 13 |
</p> |
|
| vendor/plugins/redmine_tags/app/views/projects/_filtered_projects.rhtml | ||
|---|---|---|
| 1 |
<%= render_project_table_with_filtering(@filtered_projects, @question) %> |
|
| vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml | ||
|---|---|---|
| 1 |
<fieldset id="filters" class="collapsible"> |
|
| 2 |
<legend onclick="toggleFieldset(this);"><%= l(:label_my_projects) %></legend> |
|
| 3 |
<% if @user_projects %> |
|
| 4 |
<div> |
|
| 5 |
<%= render_my_project_hierarchy(@user_projects)%> |
|
| 6 |
</div> |
|
| 7 |
<% end %> |
|
| 8 |
</fieldset> |
|
| vendor/plugins/redmine_tags/app/views/projects/_tags.html.erb | ||
|---|---|---|
| 1 |
<% unless @project.tag_list.empty? %> |
|
| 2 |
<tr> |
|
| 3 |
<td><b><%=l(:tags)%>:</b></td> |
|
| 4 |
<td><%= @project.tag_counts.collect{ |t| render_project_tag_link(t) }.join(', ') %></td>
|
|
| 5 |
</tr> |
|
| 6 |
<% end %> |
|
| vendor/plugins/redmine_tags/app/views/projects/_tags_form.html.erb | ||
|---|---|---|
| 1 |
<% fields_for :project, project, :builder => TabularFormBuilder do |f| -%> |
|
| 2 |
<div> |
|
| 3 |
<p id="project_tags"><%= f.text_field :tag_list, :label => :tags, :size => 60, :class => 'hol' %></p> |
|
| 4 |
<div id="project_tag_candidates" class="autocomplete"></div> |
|
| 5 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> |
|
| 6 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags', :project_id => project)}')" %>
|
|
| 7 |
</div> |
|
| 8 |
<% end -%> |
|
| vendor/plugins/redmine_tags/app/views/projects/index.rhtml | ||
|---|---|---|
| 1 |
<% content_for :header_tags do %> |
|
| 2 |
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
|
| 3 |
<% end %> |
|
| 4 |
|
|
| 5 |
<div class="contextual"> |
|
| 6 |
<%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%>
|
|
| 7 |
<%= '| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
|
| 8 |
</div> |
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
<div style="clear:both;"></div> |
|
| 13 |
<% if User.current.logged? %> |
|
| 14 |
<%= render :partial => 'my_projects' %> |
|
| 15 |
<% end %> |
|
| 16 |
|
|
| 17 |
|
|
| 18 |
<div style="clear:both;"></div> |
|
| 19 |
<% form_tag('/projects', :method => :get, :id => :project_filtering) do %>
|
|
| 20 |
<fieldset id="filters" class="collapsible"> |
|
| 21 |
<legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> |
|
| 22 |
<div> |
|
| 23 |
<p class='q'> |
|
| 24 |
<%= label_tag 'q', l('project_filtering_q_label') %>
|
|
| 25 |
<%= text_field_tag 'q', @question, :size => 30, :id => 'search-input' %> |
|
| 26 |
</p> |
|
| 27 |
|
|
| 28 |
<div id='filter_tags'> |
|
| 29 |
<%= render :partial => 'filter_tags' %> |
|
| 30 |
</div> |
|
| 31 |
|
|
| 32 |
<p class='buttons'><%= submit_tag( l('button_filter'), :id => 'filter_button') -%></p>
|
|
| 33 |
</div> |
|
| 34 |
</fieldset> |
|
| 35 |
<% end %> |
|
| 36 |
|
|
| 37 |
<div style="clear:both;"></div> |
|
| 38 |
<h2> |
|
| 39 |
<%= l("label_project_all") %>
|
|
| 40 |
</h2> |
|
| 41 |
|
|
| 42 |
<div id="projects"> |
|
| 43 |
<%= render :partial => 'filtered_projects' %> |
|
| 44 |
</div> |
|
| 45 |
|
|
| 46 |
<p class="pagination"><%= pagination_links_full @project_pages, @project_count %></p> |
|
| 47 |
|
|
| 48 |
|
|
| 49 |
<% other_formats_links do |f| %> |
|
| 50 |
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
|
| 51 |
<% end %> |
|
| 52 |
|
|
| 53 |
<% html_title(l(:label_project_plural)) -%> |
|
| vendor/plugins/redmine_tags/app/views/tags/_settings.html.erb | ||
|---|---|---|
| 1 |
<fieldset><legend><%= l(:setting_issue_tags) %></legend> |
|
| 2 |
<p> |
|
| 3 |
<label><%= l(:issues_sidebar) %></label> |
|
| 4 |
<%= select_tag 'settings[issues_sidebar]', options_for_select(%w(none list cloud).collect{|v| [l("issue_tags_sidebar_#{v}"), v]}, @settings[:issues_sidebar]) %>
|
|
| 5 |
</p> |
|
| 6 |
<p> |
|
| 7 |
<label><%= l(:issues_show_count) %></label> |
|
| 8 |
<%= check_box_tag 'settings[issues_show_count]', 1, 1 == @settings[:issues_show_count].to_i %> |
|
| 9 |
</p> |
|
| 10 |
<p> |
|
| 11 |
<label><%= l(:issues_open_only) %></label> |
|
| 12 |
<%= check_box_tag 'settings[issues_open_only]', 1, 1 == @settings[:issues_open_only].to_i %> |
|
| 13 |
</p> |
|
| 14 |
</fieldset> |
|
Also available in: Unified diff