# HG changeset patch # User luisf # Date 1321631333 0 # Node ID eb3e9e1ffc1304c966808e48cdc4432f51c546e3 # Parent 62a8d632451c0e1a00da69c94c7f342f955acb14 Fixes Bug #339. Might need some JS refactoring later on… diff -r 62a8d632451c -r eb3e9e1ffc13 vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb --- a/vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb Fri Nov 18 14:24:31 2011 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb Fri Nov 18 15:48:53 2011 +0000 @@ -7,7 +7,7 @@
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> - <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags', :project_id => Project.first.id)}')" %> + <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags', :project_id => Project.first.id)}', true)" %> <% end -%>

diff -r 62a8d632451c -r eb3e9e1ffc13 vendor/plugins/redmine_tags/assets/javascripts/projects_index.js --- a/vendor/plugins/redmine_tags/assets/javascripts/projects_index.js Fri Nov 18 14:24:31 2011 +0000 +++ b/vendor/plugins/redmine_tags/assets/javascripts/projects_index.js Fri Nov 18 15:48:53 2011 +0000 @@ -1,7 +1,3 @@ -// Event.observe(window, 'load', function() { -// }); - - function toggleFieldsetWithState(this_field){ id = Element.up(this_field, 'fieldset').id; // is the fieldset collapsed? @@ -19,3 +15,7 @@ asynchronous: true }); } + +function submitForm(){ + $('submitButton').click(); return false; +} \ No newline at end of file diff -r 62a8d632451c -r eb3e9e1ffc13 vendor/plugins/redmine_tags/assets/javascripts/tags_input.js --- a/vendor/plugins/redmine_tags/assets/javascripts/tags_input.js Fri Nov 18 14:24:31 2011 +0000 +++ b/vendor/plugins/redmine_tags/assets/javascripts/tags_input.js Fri Nov 18 15:48:53 2011 +0000 @@ -21,12 +21,14 @@ var Redmine = Redmine || {}; Redmine.TagsInput = Class.create({ - initialize: function(element) { + initialize: function(element, update) { this.element = $(element); 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(); + this.update = update; + Event.observe(this.button, 'click', this.readTags.bind(this)); Event.observe(this.input, 'keypress', this.onKeyPress.bindAsEventListener(this)); @@ -35,15 +37,16 @@ this.addTagsList(this.element.value); }, - readTags: function() { + readTags: function() { this.addTagsList(this.input.value); this.input.value = ''; + if(this.update){submitForm();}; }, onKeyPress: function(event) { if (Event.KEY_RETURN == event.keyCode) { this.readTags(event); - Event.stop(event); + Event.stop(event); } }, @@ -57,10 +60,13 @@ this.element.value = this.getTagsList(); this.element.insert({ 'before': label }); + if(this.update){submitForm();}; + Event.observe(button, 'click', function(){ this.tags.unset(tag); this.element.value = this.getTagsList(); label.remove(); + if(this.update){submitForm();}; }.bind(this)); }, @@ -90,9 +96,13 @@ function observeIssueTagsField(url) { - new Redmine.TagsInput('issue_tag_list').autocomplete('issue_tag_candidates', url); + new Redmine.TagsInput('issue_tag_list', false).autocomplete('issue_tag_candidates', url); } -function observeProjectTagsField(url) { - new Redmine.TagsInput('project_tag_list').autocomplete('project_tag_candidates', url); +function observeProjectTagsField(url, update) { + if(!update) { + var update = false; + }; + + new Redmine.TagsInput('project_tag_list', update).autocomplete('project_tag_candidates', url); } \ No newline at end of file