# HG changeset patch # User Chris Cannam # Date 1378396210 -3600 # Node ID 5b8bd53fd65c66368ce427f3af77e463ccb7e7ef # Parent c28ce1a71a2238a79b5c406db3f26b5eb0df90ae# Parent fa92d13876d007069bac14be954a0bcbd307d13d Merge from luisf branch diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb --- 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 -%>
> @@ -15,34 +18,32 @@
-
-

+
+

-

- <%= f.text_field :name_on_paper, {:class => ("readonly" unless params[:action] == "new") } %>

-

><%= h l("text_author_name_on_paper") %>

-

<%= f.text_field :institution, {:class => ("readonly" unless params[:action] == "new") } %>

-

><%= h l("text_author_institution") %>

-

<%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %>

-

><%= h l("text_author_email") %>

-

- <%= 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 )) -%> +

<%= f.text_field :name_on_paper, {:class => ("readonly" unless params[:action] == "new") } %>

+

><%= h l("text_author_name_on_paper") %>

- <%= 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 )) -%> +

<%= f.text_field :institution, {:class => ("readonly" unless params[:action] == "new") } %>

+

><%= h l("text_author_institution") %>

+

<%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %>

+

><%= h l("text_author_email") %>

+ + <%= 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 )) -%>
+
+

+ <%= button_to_function l(:label_save_author), '', :id => form_tag_id(f.object_name, :edit_save_button), :class => 'author_save_btn' -%> -

+
-

- - <%= 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 %> -

-
-
diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/app/views/publications/_form.html.erb --- 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; + });" + -%>

<%= f.text_field :title, :required => true, :size => 70 %>

diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/app/views/publications/edit.html.erb --- 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 %>

<%=l(:label_publication_show)%>

@@ -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 } %>

+ diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/app/views/publications/new.html.erb --- 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 %> diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/app/views/publications/show.html.erb --- 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)}'}); + } + }); + }); +" -%>

<%=l(:label_publication_show)%>

diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/assets/javascripts/bibliography.js --- 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; +} diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/assets/javascripts/order_authorships.js --- 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'}); - } - }); - }); - - - - - - diff -r c28ce1a71a22 -r 5b8bd53fd65c plugins/redmine_bibliography/assets/stylesheets/bibliography.css --- 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; +} +