Mercurial > hg > soundsoftware-site
changeset 709:7fd36e4a99a1 feature_36
Merge from branch live
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Tue, 20 Sep 2011 10:57:43 +0100 |
parents | 065041087084 (diff) 37e39e437b2c (current diff) |
children | 7db874627e11 a1e0728d1e02 |
files | |
diffstat | 4 files changed, 20 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Tue Sep 20 10:57:26 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Tue Sep 20 10:57:43 2011 +0100 @@ -43,12 +43,12 @@ f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') end - def link_to_add_fields(name, f, association) + def link_to_add_author_fields(name, f, association, action) 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" }) + link_to_function(name, h("add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')"), { :class => 'icon icon-add', :id => "add_another_author" }) end def sanitized_object_name(object_name)
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml Tue Sep 20 10:57:26 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml Tue Sep 20 10:57:43 2011 +0100 @@ -19,11 +19,11 @@ <p style="margin-bottom: -2.5em; padding-bottom; 0"><label><%= l(:identify_author_question) %></label></p> <p class="author_identify"> - <label class='inline'><%= radio_button_tag(:identify_author, "yes", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_yes ), :onclick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_yes) %> </label><br /> + <label class='inline'><%= radio_button_tag(:identify_author, "yes", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_yes ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_yes) %> </label><br /> - <label class='inline'><%= radio_button_tag(:identify_author, "correct", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_corrections ), :onclick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_correct) %> </label><br /> + <label class='inline'><%= radio_button_tag(:identify_author, "correct", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_corrections ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_correct) %> </label><br /> - <label class='inline'><%= radio_button_tag(:identify_author, "no", true, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_no ), :onclick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_no) %> </label><br /> + <label class='inline'><%= radio_button_tag(:identify_author, "no", true, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_no ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_no) %> </label><br /> </p> </div> @@ -45,12 +45,11 @@ <p> - <% if params[:action] == 'new' %> - <%= button_to_function l(:label_save_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> - <% else %> -<%= button_to_function l(:label_edit_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> - - <% end %> + <%- if params[:action] == 'new' -%> + <%= button_to_function l(:label_save_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> + <%- else -%> + <%= button_to_function l(:label_edit_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> + <%- end -%> <%= link_to_remove_fields l("remove_author"), f %>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Tue Sep 20 10:57:26 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Tue Sep 20 10:57:43 2011 +0100 @@ -24,7 +24,7 @@ <% f.fields_for :authorships do |builder| -%> <%= render "authorship_fields", :f => builder %> <%- end -%> - <%= link_to_add_fields l(:label_add_an_author), f, :authorships %> + <%= link_to_add_author_fields l(:label_add_an_author), f, :authorships, params[:action] %> </div> </div>
--- a/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Tue Sep 20 10:57:26 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Tue Sep 20 10:57:43 2011 +0100 @@ -3,12 +3,15 @@ $(link).up(".fields").hide(); } -function add_fields(link, association, content) { - var new_id = new Date().getTime(); - var regexp = new RegExp("new_" + association, "g") - $(link).insert({ - before: content.replace(regexp, new_id) - }); +function add_author_fields(link, association, content, action) { + var new_id = new Date().getTime(); + var regexp = new RegExp("new_" + association, "g"); + $(link).insert({ + before: content.replace(regexp, new_id) + }); + if(action != "new"){ + toggle_save_author(new_id, $(link)); + }; } function identify_author_status(status, object_id) {