Revision 1281:e9bfba17e791 plugins/redmine_bibliography

View differences:

plugins/redmine_bibliography/app/helpers/publications_helper.rb
37 37

  
38 38
   if @results.size > 0
39 39
     s = select_tag( form_tag_name(object_name, :author_search_results), options_for_select(@author_options), { :id => form_tag_id(object_name, :author_search_results), :size => 3} )
40
     s << observe_field( form_tag_id(object_name, :author_search_results), :on => 'click', :function => "alert('Element changed')", :with => 'q')
41 40
   else
42 41
     s = "<em>No Authors found that match your search… sorry!</em>"
43 42
   end
plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb
1
<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %>
2

  
1
<% content_for :header_tags do %>
2
  <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %>
3
<% end %>
3 4

  
4 5
<div id="authors" class="fields">
5
<!--  <h4><%= l("label_author_1") %></h4> -->
6
  <div id="<%= form_tag_id( f.object_name, :search_author ) %>" style=<%= "display:none;" unless params[:action] == "new" %> >
7
    <p>
8
      <%= f.text_field :search_name, :size => 25, :class => "author_search" %>
9
    </p>
6 10

  
7
  <div id="<%= form_tag_id( f.object_name, :search_author ) %>" style=<%= "display:none;" unless params[:action] == "new" %> >
8
      <p>
9
        <%= f.text_field :search_name, :size => 25 %>
10
      <p>
11
        <%= f.select :search_results, options_for_select(@author_options) %>
12
	    </p>
11
    <p style="margin-bottom: -2.5em; padding-bottom; 0"><label><%= l(:identify_author_question) %></label></p>
12
    <p class="author_identify">
13
      <label class='inline'><%= radio_button_tag(:identify_author, "yes", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_yes ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_yes) %> </label><br />
13 14

  
14
      <p style="margin-bottom: -2.5em; padding-bottom; 0"><label><%= l(:identify_author_question) %></label></p>
15
      <p class="author_identify">
16
        <label class='inline'><%= radio_button_tag(:identify_author, "yes", false, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_yes ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_yes) %> </label><br />
17

  
18
        <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 ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_correct) %> </label><br />
15
    <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 ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_correct) %> </label><br />
19 16

  
20 17
        <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 ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_no) %> </label><br />
21 18
      </p>
plugins/redmine_bibliography/assets/javascripts/authors.js
14 14
  $(link).closest(".fields").hide();
15 15
}
16 16

  
17
$(".author_search").live('keyup.autocomplete', function(){
18
    $this = $(this);
19

  
20
    $.ajax({
21
        type: "POST",
22
        url: "/publications/autocomplete_for_author",
23
        dataType: "json",
24
        data: {
25
            q: $this.val()
26
        },
27

  
28
        success: function(data, type) {
29
            console.log("OK: " + data);
30
            items = data;
31
            response(items);
32
        },
33

  
34
        error: function(data, type){
35
            console.log("ERROR: " + type);
36
        }
37
    });
38
});
39

  
40

  
17 41
function identify_author_status(status, object_id) {
18 42
    $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
19 43
	if(status == "no"){

Also available in: Unified diff