# HG changeset patch # User luisf # Date 1380127488 -3600 # Node ID 8580d1d1150ea27a5ab2a8869dd3f633c63dfbd6 # Parent ac480b6a13cf42b6186fb3f1a8a82719f6aefb11 Adding 2 new js scripts; added the code removed from the partials. Minor cleaning. diff -r ac480b6a13cf -r 8580d1d1150e plugins/redmine_bibliography/app/views/publications/edit.html.erb --- a/plugins/redmine_bibliography/app/views/publications/edit.html.erb Wed Sep 25 17:44:05 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/edit.html.erb Wed Sep 25 17:44:48 2013 +0100 @@ -1,19 +1,37 @@ <% content_for :header_tags do %> - <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> - <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> - <%= javascript_tag "$(document).ready(function() { $('#publication_bibtex_entry_attributes_entry_type').trigger('change'); });" %> + <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' -%> + <%= javascript_include_tag 'bibliography', :plugin => 'redmine_bibliography' -%> + <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' -%> + + <%= javascript_include_tag 'edit_publication', :plugin => 'redmine_bibliography' -%> + + <%= 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; });" -%> + <% end %> +<%= error_messages_for 'publication' %> +

<%=l(:label_publication_show)%>

<%= labelled_form_for @publication, :url => { :project_id => @project, :action => :update } do |f| -%> - <%= render :partial => 'form', :locals => { :f => f } %> -
- <%= f.submit %> + <%= render :partial => 'form', :locals => { :f => f } %> + +
+ <%= f.submit %> <% end %> +

- <%= 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 } %> + <%= 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 ac480b6a13cf -r 8580d1d1150e plugins/redmine_bibliography/app/views/publications/new.html.erb --- a/plugins/redmine_bibliography/app/views/publications/new.html.erb Wed Sep 25 17:44:05 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/new.html.erb Wed Sep 25 17:44:48 2013 +0100 @@ -1,12 +1,32 @@ <% content_for :header_tags do %> <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <%= javascript_include_tag 'bibliography', :plugin => 'redmine_bibliography' -%> + <%= javascript_include_tag 'new_publication', :plugin => 'redmine_bibliography' -%> + <%= 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; + });"-%> + <% end %> +<%= error_messages_for 'publication' %> +

<%=l(:label_publication_new)%>

<%= labelled_form_for @publication, :url => { :project_id => @project, :action => :create } do |f| -%> + <%= render :partial => 'form', :locals => { :f => f } %> +
<%= f.submit %> <% end %>