Revision 785:32d853e2e7ed vendor/plugins/redmine_tags/assets

View differences:

vendor/plugins/redmine_tags/assets/javascripts/projects_index.js
1
Event.observe(window, 'load', function() {
2

  
3
});
4

  
5

  
6 1
function toggleFieldsetWithState(this_field){
7 2
	id = Element.up(this_field, 'fieldset').id;	
8 3
	// is the fieldset collapsed?
......
19 14
	 	parameters: {field_id: id, status: nstatus},
20 15
    	asynchronous: true
21 16
  	});
17
}
18

  
19
function submitForm(){
20
	$('submitButton').click(); return false;
22 21
}
vendor/plugins/redmine_tags/assets/javascripts/tags_input.js
21 21
var Redmine = Redmine || {};
22 22

  
23 23
Redmine.TagsInput = Class.create({
24
  initialize: function(element) {
24
  initialize: function(element, update) {
25 25
    this.element  = $(element);
26 26
    this.input    = new Element('input', { 'type': 'text', 'autocomplete': 'off', 'size': 10 });
27 27
    this.button   = new Element('span', { 'class': 'tag-add icon icon-add' });
28 28
    this.tags     = new Hash();
29 29
    
30
		this.update = update;
31

  
30 32
    Event.observe(this.button, 'click', this.readTags.bind(this));
31 33
    Event.observe(this.input, 'keypress', this.onKeyPress.bindAsEventListener(this));
32 34

  
......
35 37
    this.addTagsList(this.element.value);
36 38
  },
37 39

  
38
  readTags: function() {
40
  readTags: function() {		
39 41
    this.addTagsList(this.input.value);
40 42
    this.input.value = '';
43
		if(this.update){submitForm();};
41 44
  },
42 45

  
43 46
  onKeyPress: function(event) {
44 47
    if (Event.KEY_RETURN == event.keyCode) {
45 48
      this.readTags(event);
46
      Event.stop(event);
49
      Event.stop(event);			
47 50
    }
48 51
  },
49 52

  
......
57 60
    this.element.value = this.getTagsList();
58 61
    this.element.insert({ 'before': label });
59 62

  
63
		if(this.update){submitForm();};
64

  
60 65
    Event.observe(button, 'click', function(){
61 66
      this.tags.unset(tag);
62 67
      this.element.value = this.getTagsList();
63 68
      label.remove();
69
		  if(this.update){submitForm();};
64 70
    }.bind(this));
65 71
  },
66 72

  
......
90 96

  
91 97

  
92 98
function observeIssueTagsField(url) {
93
  new Redmine.TagsInput('issue_tag_list').autocomplete('issue_tag_candidates', url);
99
  new Redmine.TagsInput('issue_tag_list', false).autocomplete('issue_tag_candidates', url);
94 100
}
95 101

  
96
function observeProjectTagsField(url) {
97
	new Redmine.TagsInput('project_tag_list').autocomplete('project_tag_candidates', url);
102
function observeProjectTagsField(url, update) {
103
	if(!update) { 
104
			var update = false;
105
		};
106
	
107
	new Redmine.TagsInput('project_tag_list', update).autocomplete('project_tag_candidates', url);
98 108
}

Also available in: Unified diff