Revision 1278:f8bb7ccc6fac plugins/redmine_bibliography

View differences:

plugins/redmine_bibliography/app/helpers/publications_helper.rb
52 52
    fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
53 53
      render(association.to_s.singularize + "_fields", :f => builder)
54 54
    end
55
    link_to_function(name, h("add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')"), { :class => 'icon icon-add', :id => "add_another_author" })
55
    link_to_function(name, "add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')", { :class => 'icon icon-add', :id => "add_another_author" })
56 56
  end
57 57

  
58 58
  def sanitized_object_name(object_name)
plugins/redmine_bibliography/assets/javascripts/authors.js
1
function remove_fields(link) {
2
    $(link).previous("input[type=hidden]").value = "1";
3
    $(link).up(".fields").hide();
1
function add_author_fields(link, association, content, action) {
2
    var new_id = new Date().getTime();
3
    var regexp = new RegExp("new_" + association, "g");
4

  
5
    $(link).before(content.replace(regexp, new_id));
6

  
7
    if(action != "new"){
8
        toggle_save_author(new_id, $(link));
9
    }
4 10
}
5 11

  
6
function add_author_fields(link, association, content, action) {
7
	var new_id = new Date().getTime();
8
  var regexp = new RegExp("new_" + association, "g");
9
  $(link).insert({
10
		before: content.replace(regexp, new_id)
11
  });
12
	if(action != "new"){
13
		toggle_save_author(new_id, $(link));
14
	};
12
function remove_fields(link) {
13
  $(link).prev("input[type=hidden]").val("1");
14
  $(link).closest(".fields").hide();
15 15
}
16 16

  
17 17
function identify_author_status(status, object_id) {

Also available in: Unified diff