Mercurial > hg > soundsoftware-site
changeset 609:3221b2ab7804 feature_36
Fixes Bug #267. New javascript logic to differentiate between edit/new actions (Not finished).
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 19 Aug 2011 16:45:59 +0100 |
parents | c7559c3a8d03 |
children | e9274ba9c1b3 |
files | vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb vendor/plugins/redmine_bibliography/assets/javascripts/authors.js |
diffstat | 4 files changed, 21 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Thu Aug 18 22:27:19 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Aug 19 16:45:59 2011 +0100 @@ -31,7 +31,7 @@ if @publication.save flash[:notice] = "Successfully created publication." - redirect_to :action => :show, :id => @publication, :project_id => @project.id + redirect_to :action => :show, :id => @publication, :project_id => @project_id else render :action => 'new', :project_id => @project_id end @@ -71,7 +71,10 @@ def edit find_project_by_project_id unless params[:project_id].nil? - + + @edit_view = true; + + @author_options = [] @publication = Publication.find(params[:id]) @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type end
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml Thu Aug 18 22:27:19 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml Fri Aug 19 16:45:59 2011 +0100 @@ -4,8 +4,7 @@ <div id="authors" class="fields"> <h4><%= l("label_author_1") %></h4> - <div id="<%= form_tag_id( f.object_name, :search_author ) %>"> - <div class="splitcontentleft"> + <div id="<%= form_tag_id( f.object_name, :search_author ) %>" style=<%= "display:none;" unless params[:action] == "new" %> > <p> <%= f.text_field :search_name, :size => 25 %> <%= observe_field( form_tag_id(f.object_name, :search_name), :frequency => 0.5, :update => form_tag_id( f.object_name, :search_results), :url => { :controller => 'publications', :action => 'autocomplete_for_author', :object_name => form_object_id(f.object_name) }, :with => 'q' ) %> @@ -18,32 +17,28 @@ <%= f.radio_button :identify_author, "correct", :onClick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });" %><%= f.label :identify_author_correct %><br /> <%= f.radio_button :identify_author, "no", :onClick => "identify_author_status($(this).value, #{form_object_id(f.object_name) });" %><%= f.label :identify_author_no %> </p> - </div> - - <div class="splitcontentright"> + <%= f.select :search_results, options_for_select(@author_options), {}, {:size => 5, :onChange => remote_function( :url => { :controller => :publications, :action => :get_user_info, :object_id => form_object_id(f.object_name) }, :with => "'value=' + value" )} %> </div> + + <div id="<%= form_tag_id( f.object_name, :edit_author_info ) %>"> + <p> + <%= f.text_field :name_on_paper, {:class => ("readonly" unless params[:action] == "new") } %><br /> + <em style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_name_on_paper") %></em><br /> + <%= f.text_field :institution, {:class => ("readonly" unless params[:action] == "new") } %><br /> + <em style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_institution") %></em><br /> + <%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %><br /> + <em style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_email") %></em><br /> + </p> </div> - <div class="box" id="<%= form_tag_id( f.object_name, :edit_author_info ) %>"> - <p> - <%= f.text_field :name_on_paper, :size => 25 %><br /> - <em><%= h l("text_author_name_on_paper") %></em><br /> - <%= f.text_field :institution, :size => 35 %><br /> - <em><%= h l("text_author_institution") %></em><br /> - <%= f.text_field :email, :size => 35 %><br /> - <em><%= h l("text_author_email") %></em><br /> - </p> - </div> <div class="box" id="<%= form_tag_id( f.object_name, :show_author_info ) %>" style="display: none"> - </div> - <%= button_to 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 )} %> <%= link_to_remove_fields l("remove_author"), f %>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Thu Aug 18 22:27:19 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Fri Aug 19 16:45:59 2011 +0100 @@ -10,6 +10,6 @@ <%= f.submit %> <% end %> <p> - <%= link_to l(:label_publication_show), { :controller => "publications", :action => "show", :id => @publication, :project_id => @project } %> | + <%= link_to l(:label_publication_show), { :controller => "publications", :action => "show", :id => @publication, :project_id => @project_id } %> | <%= link_to l(:label_publication_index), { :controller => "publications", :action => "index", :project_id => @project } %> </p>
--- a/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Thu Aug 18 22:27:19 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Fri Aug 19 16:45:59 2011 +0100 @@ -27,6 +27,9 @@ Effect.toggle(div_id, "appear", {duration:0.3}); } + + + function toggle_input_field(field){ if(field.classNames().inspect().include("readonly") == false){ field.readOnly = true;