Mercurial > hg > soundsoftware-site
changeset 1381:5b8bd53fd65c cannam
Merge from luisf branch
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Thu, 05 Sep 2013 16:50:10 +0100 |
parents | c28ce1a71a22 (current diff) fa92d13876d0 (diff) |
children | ac411172d897 cd304b50908c |
files | plugins/redmine_bibliography/assets/javascripts/bibliography.js plugins/redmine_bibliography/assets/javascripts/order_authorships.js |
diffstat | 8 files changed, 92 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Thu Aug 29 12:13:16 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Thu Sep 05 16:50:10 2013 +0100 @@ -1,6 +1,9 @@ -<% content_for :header_tags do %> - <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> -<% end %> +<%- content_for :header_tags do -%> + <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' -%> + <%= javascript_include_tag 'bibliography', :plugin => 'redmine_bibliography' -%> + <%= javascript_tag "$('.author_save_btn').live('click', disable_fields);" -%> + <%= javascript_tag "$('.author_edit_btn').live('click', enable_fields);" -%> +<%- end -%> <div id="authors" class="fields"> <div id="<%= form_tag_id( f.object_name, :search_author ) %>" style=<%= "display:none;" unless params[:action] == "new" %> > @@ -15,34 +18,32 @@ <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 )) %> <%= 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 )) %> <%= l(:identify_author_no) %> </label><br /> - </p> + <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 )) %> <%= l(:identify_author_no) %> </label><br /> + </p> </div> <div class='author_edit' id="<%= form_tag_id( f.object_name, :edit_author_info ) %>"> - <p> - <%= f.text_field :name_on_paper, {:class => ("readonly" unless params[:action] == "new") } %></p> - <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_name_on_paper") %></p> - <p><%= f.text_field :institution, {:class => ("readonly" unless params[:action] == "new") } %></p> - <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_institution") %></p> - <p><%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %></p> - <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_email") %></p> - </p> - <%= hidden_field_tag(:search_author_class, '', :name => form_tag_name(f.object_name,:search_author_class ), :id => form_tag_id( f.object_name, :search_author_class )) -%> + <p><%= f.text_field :name_on_paper, {:class => ("readonly" unless params[:action] == "new") } %></p> + <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_name_on_paper") %></p> - <%= hidden_field_tag(:search_author_id, '', :name => form_tag_name(f.object_name,:search_author_id ), :id => form_tag_id( f.object_name, :search_author_id )) -%> + <p><%= f.text_field :institution, {:class => ("readonly" unless params[:action] == "new") } %></p> + <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_institution") %></p> + <p><%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %></p> + <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_email") %></p> + + <%= hidden_field_tag(:search_author_class, '', :name => form_tag_name(f.object_name,:search_author_class ), :id => form_tag_id( f.object_name, :search_author_class )) -%> + + <%= hidden_field_tag(:search_author_id, '', :name => form_tag_name(f.object_name,:search_author_id ), :id => form_tag_id( f.object_name, :search_author_id )) -%> </div> + <div> + <p> + <%= button_to_function l(:label_save_author), '', :id => form_tag_id(f.object_name, :edit_save_button), :class => 'author_save_btn' -%> - <div class="box" id="<%= form_tag_id( f.object_name, :show_author_info ) %>" style="display: none"> + <%= button_to_function l(:label_edit_author), '', :id => form_tag_id(f.object_name, :edit_button), :class => 'author_edit_btn' -%> + <%= link_to_remove_fields l("remove_author"), f %> + </p> </div> +</div> - <p> - - <%= button_to_function l(:label_save_author), {}, :id => form_tag_id( f.object_name, :edit_save_button ) %> - - <%= link_to_remove_fields l("remove_author"), f %> - </p> -</div> -<br/>
--- a/plugins/redmine_bibliography/app/views/publications/_form.html.erb Thu Aug 29 12:13:16 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/_form.html.erb Thu Sep 05 16:50:10 2013 +0100 @@ -1,4 +1,18 @@ <%= error_messages_for 'publication' %> + <%= javascript_tag " + $('#publication_bibtex_entry_attributes_entry_type').live('change', function() { + $this = $(this); + $.ajax({ + type: 'get', + url: '#{url_for(:controller => :publications, :action => :show_bibtex_fields)}', + data: { + value: $this.val() + }, + dataType: 'script' + }); + return false; + });" + -%> <h3><%= f.text_field :title, :required => true, :size => 70 %></h3>
--- a/plugins/redmine_bibliography/app/views/publications/edit.html.erb Thu Aug 29 12:13:16 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/edit.html.erb Thu Sep 05 16:50:10 2013 +0100 @@ -1,7 +1,7 @@ <% content_for :header_tags do %> <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> - <%= javascript_include_tag 'bibliography', :plugin => 'redmine_bibliography' %> <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <%= javascript_tag "$(document).ready(function() { $('#publication_bibtex_entry_attributes_entry_type').trigger('change'); });" %> <% end %> <h2><%=l(:label_publication_show)%></h2> @@ -16,3 +16,4 @@ <%= 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/plugins/redmine_bibliography/app/views/publications/new.html.erb Thu Aug 29 12:13:16 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/new.html.erb Thu Sep 05 16:50:10 2013 +0100 @@ -1,6 +1,5 @@ <% content_for :header_tags do %> <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> - <%= javascript_include_tag 'bibliography', :plugin => 'redmine_bibliography' %> <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> <% end %>
--- a/plugins/redmine_bibliography/app/views/publications/show.html.erb Thu Aug 29 12:13:16 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/show.html.erb Thu Sep 05 16:50:10 2013 +0100 @@ -1,4 +1,26 @@ -<%= javascript_include_tag 'order_authorships', :plugin => 'redmine_bibliography' %> +<%= javascript_tag "$(document).ready(function(){ + + $('#authorships').sortable({ + axis: 'y', + dropOnEmpty: false, + handle: '.handle', + cursor: 'crosshair', + items: 'li', + opacity: 0.4, + scroll: true, + update: function(){ + $.ajax({ + type: 'post', + data: $('#authorships').sortable('serialize'), + dataType: 'script', + complete: function(request){ + $('#authorship').effect('highlight'); + }, + url: '#{url_for(:controller => :authorships, :action => :sort)}'}); + } + }); + }); +" -%> <h2><%=l(:label_publication_show)%></h2>
--- a/plugins/redmine_bibliography/assets/javascripts/bibliography.js Thu Aug 29 12:13:16 2013 +0100 +++ b/plugins/redmine_bibliography/assets/javascripts/bibliography.js Thu Sep 05 16:50:10 2013 +0100 @@ -1,18 +1,27 @@ +// bibliography.js -$("#publication_bibtex_entry_attributes_entry_type").live("change", function() { - $this = $(this); +function disable_fields(){ + $this = $(this); + $author_info = $this.closest('div').prev(); + $author_info.children('.description').toggle(); + $author_info.find('p :input').attr("readonly", true); + $author_info.find('p :input').addClass('readonly'); - $.ajax({ - type: "get", - url: "/publications/show_bibtex_fields", - data: { - value: $this.val() - }, - dataType: "script" - }); + $this.siblings('.author_edit_btn').show(); + $this.hide(); return false; -}); -$(document).ready(function() { - $("#publication_bibtex_entry_attributes_entry_type").trigger('change'); -}); \ No newline at end of file +} + +function enable_fields(){ + $this = $(this); + $author_info = $this.closest('div').prev(); + $author_info.children('.description').toggle(); + $author_info.find('p :input').attr("readonly", false); + $author_info.find('p :input').removeClass('readonly'); + + $this.siblings('.author_save_btn').show(); + $this.hide(); + + return false; +}
--- a/plugins/redmine_bibliography/assets/javascripts/order_authorships.js Thu Aug 29 12:13:16 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -$(document).ready(function(){ - - $('#authorships').sortable({ - axis: 'y', - dropOnEmpty: false, - handle: '.handle', - cursor: 'crosshair', - items: 'li', - opacity: 0.4, - scroll: true, - update: function(){ - $.ajax({ - type: 'post', - data: $('#authorships').sortable('serialize'), - dataType: 'script', - complete: function(request){ - $('#authorship').effect('highlight'); - }, - url: '/authorships/sort'}); - } - }); - }); - - - - - -
--- a/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Thu Aug 29 12:13:16 2013 +0100 +++ b/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Thu Sep 05 16:50:10 2013 +0100 @@ -4,7 +4,7 @@ color: #777; } -input.readonly { +.readonly { border: none; padding: 0; margin: 0; @@ -71,3 +71,7 @@ background-image: url(../../../images/loading.gif); } +.author_edit_btn { + display:none; +} +