view vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb @ 477:aeedcec4df5f feature_36

Several changes in the author forms.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 28 Jun 2011 17:42:49 +0100
parents 0ce4139187fa
children 7097dc91e58e
line wrap: on
line source
require 'bibtex'

module PublicationsHelper
  def projects_check_box_tags(name, projects)
    s = ''
    projects.sort.each do |project|
      s << "<label>#{ check_box_tag name, project.id, false } #{link_to_project project}</label>\n"
    end
    s 
  end
  
  def link_to_remove_fields(name, f)
    f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)")
  end
    
  def link_to_add_fields(name, f, association)
    new_object = f.object.class.reflect_on_association(association).klass.new
    fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
      render(association.to_s.singularize + "_fields", :f => builder)
    end    
    link_to_function(name, h("add_fields(this, '#{association}', '#{escape_javascript(fields)}')"), { :class => 'icon icon-add', :id => "add_another_author" })
  end  
end