# HG changeset patch
# User luisf
# Date 1377880385 -3600
# Node ID 6ba24edae331e8c76a9c02d2be2b32ae442c2c48
# Parent a2e51c0a78608833203a2691a51995c1596cdb67
Moved the code in bibliography.js and order_authorships.js from the js files to the view files - so that I can use ERB to build the AJAX call paths - otherwise I woudl have problems with redmine installations in subfolders.
diff -r a2e51c0a7860 -r 6ba24edae331 plugins/redmine_bibliography/app/views/publications/_form.html.erb
--- a/plugins/redmine_bibliography/app/views/publications/_form.html.erb Mon Aug 19 16:33:09 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/_form.html.erb Fri Aug 30 17:33:05 2013 +0100
@@ -1,4 +1,20 @@
<%= 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 a2e51c0a7860 -r 6ba24edae331 plugins/redmine_bibliography/app/views/publications/edit.html.erb
--- a/plugins/redmine_bibliography/app/views/publications/edit.html.erb Mon Aug 19 16:33:09 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/edit.html.erb Fri Aug 30 17:33:05 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 a2e51c0a7860 -r 6ba24edae331 plugins/redmine_bibliography/app/views/publications/new.html.erb
--- a/plugins/redmine_bibliography/app/views/publications/new.html.erb Mon Aug 19 16:33:09 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/new.html.erb Fri Aug 30 17:33:05 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 a2e51c0a7860 -r 6ba24edae331 plugins/redmine_bibliography/app/views/publications/show.html.erb
--- a/plugins/redmine_bibliography/app/views/publications/show.html.erb Mon Aug 19 16:33:09 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/show.html.erb Fri Aug 30 17:33:05 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 a2e51c0a7860 -r 6ba24edae331 plugins/redmine_bibliography/assets/javascripts/bibliography.js
--- a/plugins/redmine_bibliography/assets/javascripts/bibliography.js Mon Aug 19 16:33:09 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-$("#publication_bibtex_entry_attributes_entry_type").live("change", function() {
- $this = $(this);
-
- $.ajax({
- type: "get",
- url: "/publications/show_bibtex_fields",
- data: {
- value: $this.val()
- },
- dataType: "script"
- });
-
- return false;
-});
-$(document).ready(function() {
- $("#publication_bibtex_entry_attributes_entry_type").trigger('change');
-});
\ No newline at end of file
diff -r a2e51c0a7860 -r 6ba24edae331 plugins/redmine_bibliography/assets/javascripts/order_authorships.js
--- a/plugins/redmine_bibliography/assets/javascripts/order_authorships.js Mon Aug 19 16:33:09 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'});
- }
- });
- });
-
-
-
-
-
-