Mercurial > hg > soundsoftware-site
comparison vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb @ 787:a36cce722860 feature_14
Merge from branch "cannam"
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 18 Nov 2011 16:53:34 +0000 |
parents | ebca856bd627 |
children | 75351d69e2ba |
comparison
equal
deleted
inserted
replaced
786:ae82810661da | 787:a36cce722860 |
---|---|
10 end | 10 end |
11 | 11 |
12 def projects_check_box_tags(name, projects) | 12 def projects_check_box_tags(name, projects) |
13 s = '' | 13 s = '' |
14 projects.sort.each do |project| | 14 projects.sort.each do |project| |
15 s << "<label>#{ check_box_tag name, project.id, false } #{link_to_project project}</label>\n" | 15 if User.current.allowed_to?(:edit_publication, project) |
16 s << "<label>#{ check_box_tag name, project.id, false } #{link_to_project project}</label>\n" | |
17 s << '<br />' | |
18 end | |
16 end | 19 end |
20 | |
17 s | 21 s |
18 end | 22 end |
19 | 23 |
20 def choose_author_link(object_name, items) | 24 def choose_author_link(object_name, items) |
21 # called by autocomplete_for_author (publications' action/view) | 25 # called by autocomplete_for_author (publications' action/view) |
41 | 45 |
42 def link_to_remove_fields(name, f) | 46 def link_to_remove_fields(name, f) |
43 f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') | 47 f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') |
44 end | 48 end |
45 | 49 |
46 def link_to_add_fields(name, f, association) | 50 def link_to_add_author_fields(name, f, association, action) |
47 new_object = f.object.class.reflect_on_association(association).klass.new | 51 new_object = f.object.class.reflect_on_association(association).klass.new |
48 fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| | 52 fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| |
49 render(association.to_s.singularize + "_fields", :f => builder) | 53 render(association.to_s.singularize + "_fields", :f => builder) |
50 end | 54 end |
51 link_to_function(name, h("add_fields(this, '#{association}', '#{escape_javascript(fields)}')"), { :class => 'icon icon-add', :id => "add_another_author" }) | 55 link_to_function(name, h("add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')"), { :class => 'icon icon-add', :id => "add_another_author" }) |
52 end | 56 end |
53 | 57 |
54 def sanitized_object_name(object_name) | 58 def sanitized_object_name(object_name) |
55 object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") | 59 object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") |
56 end | 60 end |