Mercurial > hg > soundsoftware-site
changeset 1376:6ba24edae331 luisf
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.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 30 Aug 2013 17:33:05 +0100 |
parents | a2e51c0a7860 |
children | f0da42a09a3c |
files | plugins/redmine_bibliography/app/views/publications/_form.html.erb plugins/redmine_bibliography/app/views/publications/edit.html.erb plugins/redmine_bibliography/app/views/publications/new.html.erb plugins/redmine_bibliography/app/views/publications/show.html.erb plugins/redmine_bibliography/assets/javascripts/bibliography.js plugins/redmine_bibliography/assets/javascripts/order_authorships.js |
diffstat | 6 files changed, 41 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- 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; + });" + -%> <h3><%= f.text_field :title, :required => true, :size => 70 %></h3>
--- 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 %> <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 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 %>
--- 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)}'}); + } + }); + }); +" -%> <h2><%=l(:label_publication_show)%></h2>
--- 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
--- 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'}); - } - }); - }); - - - - - -