Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'origin/2.1.0-wip'

Conflicts:
	HISTORY.md
	init.rb
  • Loading branch information...
commit 5dd7751a1435354d1da10dfda97541a45d60b9d2 2 parents 1743f36 + 3e6442d
@ixti authored
View
10 HISTORY.md
@@ -1,4 +1,12 @@
-## 2.0.1 (unreleased)
+# HISTORY
+
+## 2.5.0 // WIP
- Added Simplified Chinese translation. Thanks to archonwang.
- Added Bulgarian translation. Thanks to Ivan Cenov.
+- Resolved #69.
+ Tags autocomplete now can be either "cached" (available list of tags is
+ included right into the issue edit form and Autocompleter.Local is used) or
+ non-cached (as it was before - using Ajax.Autocompleter).
+- Removed Ajax.Autocompleter view script. AutoComplete controller now returns
+ JSON array instead.
View
20 app/helpers/issues_helper.rb
@@ -22,16 +22,34 @@ module IssuesHelper
def sidebar_tags
unless @sidebar_tags
@sidebar_tags = []
+
if :none != RedmineTags.settings[:issues_sidebar].to_sym
@sidebar_tags = Issue.available_tags({
:project => @project,
- :open_only => (RedmineTags.settings[:issues_open_only].to_i == 1)
+ :open_only => (1 == RedmineTags.settings[:issues_open_only].to_i)
})
end
end
+
@sidebar_tags
end
+
+ def inline_tags_cache
+ if @inline_tags_cache.nil?
+ @inline_tags_cache = false
+
+ if 1 == RedmineTags.settings[:inline_cache].to_i
+ @inline_tags_cache = Issue.available_tags({
+ :project => @project
+ }).map{ |v| v.to_s }
+ end
+ end
+
+ @inline_tags_cache
+ end
+
+
def render_sidebar_tags
render_tags_list(sidebar_tags, {
:show_count => (RedmineTags.settings[:issues_show_count].to_i == 1),
View
6 app/views/auto_completes/_tag_list.html.erb
@@ -1,6 +0,0 @@
-<ul>
-<% @tags.each do |tag| -%>
- <%= content_tag 'li', h('%s (%d)' % [tag.name, tag.count]), :name => tag.name %>
-<% end -%>
-<%= content_tag 'li', l(:auto_complete_new_tag) % @name, :name => @name %>
-</ul>
View
1  app/views/issues/_tags_form.html.erb
@@ -3,6 +3,7 @@
<p id="issue_tags"><%= f.text_field :tag_list, :label => :tags, :size => 60, :class => 'hol' %></p>
<div id="issue_tag_candidates" class="autocomplete"></div>
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %>
+ <%= javascript_tag "window.redmine_tags_cache = #{JSON.dump inline_tags_cache};" %>
<%= javascript_tag "observeIssueTagsField('#{url_for(:controller => 'auto_completes', :action => 'issue_tags', :project_id => issue.project)}')" %>
</div>
<% end -%>
View
7 app/views/tags/_settings.html.erb
@@ -1,3 +1,10 @@
+<fieldset><legend><%= l(:setting_tags) %></legend>
+ <p>
+ <label><%= l(:inline_cache) %></label>
+ <%= check_box_tag 'settings[inline_cache]', 1, 1 == @settings[:inline_cache].to_i %>
+ </p>
+</fieldset>
+
<fieldset><legend><%= l(:setting_issue_tags) %></legend>
<p>
<label><%= l(:issues_sidebar) %></label>
View
41 assets/javascripts/tags_input.js
@@ -26,7 +26,7 @@ Redmine.TagsInput = Class.create({
this.input = new Element('input', { 'type': 'text', 'autocomplete': 'off', 'size': 10 });
this.button = new Element('span', { 'class': 'tag-add icon icon-add' });
this.tags = new Hash();
-
+
Event.observe(this.button, 'click', this.readTags.bind(this));
Event.observe(this.input, 'keypress', this.onKeyPress.bindAsEventListener(this));
@@ -76,15 +76,36 @@ Redmine.TagsInput = Class.create({
},
autocomplete: function(container, url) {
- new Ajax.Autocompleter(this.input, container, url, {
- 'minChars': 1,
- 'frequency': 0.5,
- 'paramName': 'q',
- 'updateElement': function(el) {
- this.input.value = el.getAttribute('name');
- this.readTags();
- }.bind(this)
- });
+ var updater;
+
+ if (!!window.redmine_tags_cache) {
+ updater = new Autocompleter.Local(this.input, container, window.redmine_tags_cache, {
+ 'updateElement': function(el) {
+ this.input.value = el.textContent;
+ this.readTags();
+ }.bind(this)
+ });
+ } else {
+ updater = new Ajax.Autocompleter(this.input, container, url, {
+ 'minChars': 1,
+ 'frequency': 0.5,
+ 'paramName': 'q',
+ 'updateElement': function(el) {
+ this.input.value = el.getAttribute('name');
+ this.readTags();
+ }.bind(this)
+ });
+
+ updater.options.onComplete = function (response) {
+ var tags, q = updater.getToken(), r = '<strong>' + q + '</strong>';
+
+ tags = response.responseJSON.collect(function (t) {
+ return '<li name="' + t + '">' + t.replace(q, r) + '</li>';
+ }).join('');
+
+ updater.updateChoices('<ul>' + tags + '</ul>');
+ };
+ }
}
});
View
4 config/locales/bg.yml
@@ -23,6 +23,10 @@ bg:
tags: Маркери
field_tags: Маркери
field_tag_list: Маркери
+
+ setting_tags: translation missing, (en) General Settings
+ inline_cache: translation missing, (en) Use cached autocomplete
+
setting_issue_tags: Маркери на задачите
issues_sidebar: Показване на страничния панел като
issues_show_count: Показване на броя на задачите
View
4 config/locales/de.yml
@@ -25,6 +25,10 @@ de:
tags: Tags
field_tags: Tags
field_tag_list: Tags
+
+ setting_tags: translation missing, (en) General Settings
+ inline_cache: translation missing, (en) Use cached autocomplete
+
setting_issue_tags: Ticket Tags
issues_sidebar: Zeige die Tags auf der Sidebar
issues_show_count: Zeige die Ticketanzahl an
View
6 config/locales/en.yml
@@ -23,12 +23,16 @@ en:
tags: Tags
field_tags: Tags
field_tag_list: Tags
+
+ setting_tags: General Settings
+ inline_cache: Use cached autocomplete
+
setting_issue_tags: Issues Tags
issues_sidebar: Display tags on sidebar as
issues_show_count: Display amount of issues
issues_open_only: Display open issues only
issues_sort_by: Sort tags by
-
+
issue_tags_sidebar_none: None
issue_tags_sidebar_list: List
issue_tags_sidebar_cloud: Cloud
View
16 config/locales/fr.yml
@@ -23,19 +23,23 @@ fr:
tags: Tags
field_tags: Tags
field_tag_list: Tags
+
+ setting_tags: translation missing, (en) General Settings
+ inline_cache: translation missing, (en) Use cached autocomplete
+
setting_issue_tags: Tags des demandes
issues_sidebar: Afficher les Tags comme
issues_show_count: Afficher le nombre de demande
issues_open_only: N'afficher que les demandes ouvertes
- issues_sort_by: (en) Sort tags by
-
+ issues_sort_by: translation missing, (en) Sort tags by
+
issue_tags_sidebar_none: Ne pas afficher
issue_tags_sidebar_list: Liste
issue_tags_sidebar_cloud: Nuage
- issues_sort_by_name: (en) Name
- issues_sort_by_count: (en) Issues amount
- issues_sort_order_asc: (en) Ascending
- issues_sort_order_desc: (en) Descending
+ issues_sort_by_name: translation missing, (en) Name
+ issues_sort_by_count: translation missing, (en) Issues amount
+ issues_sort_order_asc: translation missing, (en) Ascending
+ issues_sort_order_desc: translation missing, (en) Descending
auto_complete_new_tag: Nouveau...
View
6 config/locales/ru.yml
@@ -23,12 +23,16 @@ ru:
tags: Метки
field_tags: Метки
field_tag_list: Метки
+
+ setting_tags: Общие Настройки
+ inline_cache: Кэшированное автодополнение
+
setting_issue_tags: Метки задач
issues_sidebar: Боковую панель как
issues_show_count: Показать кол-во задач
issues_open_only: Только открытые задачи
issues_sort_by: Упорядочить метки по
-
+
issue_tags_sidebar_none: Не показывать
issue_tags_sidebar_list: Список
issue_tags_sidebar_cloud: Облако
View
5 init.rb
@@ -27,7 +27,7 @@
name 'redmine_tags'
author 'Aleksey V Zapparov AKA "ixti"'
description 'redMine tagging support'
- version '2.0.1-dev'
+ version '2.1.0-dev'
url 'https://github.com/ixti/redmine_tags/'
author_url 'http://www.ixti.net/'
@@ -38,7 +38,8 @@
:issues_show_count => 0,
:issues_open_only => 0,
:issues_sort_by => 'name',
- :issues_sort_order => 'asc'
+ :issues_sort_order => 'asc',
+ :inline_cache => 1
}, :partial => 'tags/settings'
end
View
8 lib/redmine_tags/patches/auto_completes_controller_patch.rb
@@ -32,12 +32,10 @@ def self.included(base)
module InstanceMethods
def issue_tags
- @name = params[:q].to_s
- @tags = Issue.available_tags({
+ render :json => Issue.available_tags({
:project_id => @project,
- :name_like => @name
- })
- render :layout => false, :partial => 'tag_list'
+ :name_like => params[:q].to_s
+ }).map{ |v| v.to_s }
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.