Revision 802:4719c1f813fc vendor/plugins/redmine_tags/assets

View differences:

vendor/plugins/redmine_tags/assets/javascripts/projects_index.js
5 5
	change_session(id, status);
6 6
	
7 7
	toggleFieldset(this_field);
8

  
8 9
};
9 10

  
11
	function submitForm(){
12
		$('submitButton').click();		
13
	};
14

  
10 15
function change_session(id, nstatus) {
11 16
	var url = "projects/set_fieldset_status";
12 17
 	var request = new Ajax.Request(url, {
......
16 21
  	});
17 22
}
18 23

  
19
function submitForm(){
20
	$('submitButton').click(); return false;
21
}
22

  
23 24
function keypressHandler (event){
24
    var key = event.which || event.keyCode;
25
    switch (key) {
26
        default:
27
        break;
28
        case Event.KEY_RETURN:
29
            $('submitButton').click(); return false;
30
        break;   
31
    }
32
}
25
  var key = event.which || event.keyCode;
26
  switch (key) {
27
      default:
28
      break;
29
      case Event.KEY_RETURN:
30
          $('submitButton').click(); return false;
31
      break;   
32
  };
33
};
33 34

  
34 35
document.observe("dom:loaded", function() {
35 36
	$('search-input').observe('keypress', keypressHandler);	
vendor/plugins/redmine_tags/assets/javascripts/tags_input.js
28 28
    this.tags     = new Hash();
29 29
    
30 30
		this.update = update;
31

  
31
		
32
		var uri_params = window.location.href.toQueryParams();
33
		if (uri_params["project[tag_list]"] != undefined){
34
			this.addTag(uri_params["project[tag_list]"], true);			
35
		};
36
		
32 37
    Event.observe(this.button, 'click', this.readTags.bind(this));
33 38
    Event.observe(this.input, 'keypress', this.onKeyPress.bindAsEventListener(this));
34 39

  
......
40 45
  readTags: function() {		
41 46
    this.addTagsList(this.input.value);
42 47
    this.input.value = '';
43
		if(this.update){submitForm();};
48
		if(this.update){
49
			submitForm();
50
		};
44 51
  },
45 52

  
46 53
  onKeyPress: function(event) {
......
50 57
    }
51 58
  },
52 59

  
53
  addTag: function(tag) {
60
  addTag: function(tag, noSubmit) {
54 61
    if (tag.blank() || this.tags.get(tag)) return;
55 62

  
63
		if(noSubmit==undefined){noSubmit=false;}
64

  
56 65
    var button = new Element('span', { 'class': 'tag-delete icon icon-del' });
57 66
    var label  = new Element('span', { 'class': 'tag-label' }).insert(tag).insert(button);
58 67

  
......
60 69
    this.element.value = this.getTagsList();
61 70
    this.element.insert({ 'before': label });
62 71

  
63
		if(this.update){submitForm();};
72
		if(noSubmit==false){
73
			if(this.update){
74
				submitForm();
75
			};
76
		};
64 77

  
65 78
    Event.observe(button, 'click', function(){
66 79
      this.tags.unset(tag);

Also available in: Unified diff