Revision 1380:fa92d13876d0 plugins/redmine_bibliography

View differences:

plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb
1 1
<%- content_for :header_tags do -%>
2 2
  <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' -%>
3 3
  <%= javascript_include_tag 'bibliography', :plugin => 'redmine_bibliography' -%>
4
  <%= javascript_tag "$('.author_save_btn').live('click', toggle_fields);" -%>
4
  <%= javascript_tag "$('.author_save_btn').live('click', disable_fields);" -%>
5
  <%= javascript_tag "$('.author_edit_btn').live('click', enable_fields);" -%>
5 6
<%- end -%>
6 7

  
7 8
<div id="authors" class="fields">
......
29 30
    <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_institution") %></p>
30 31
    <p><%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") }  %></p>
31 32
    <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_email") %></p>
32
    
33

  
33 34
    <%= 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 )) -%>
34 35

  
35 36
    <%= 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 )) -%>
......
38 39
  <div>
39 40
    <p>
40 41
      <%= button_to_function l(:label_save_author), '', :id => form_tag_id(f.object_name, :edit_save_button), :class => 'author_save_btn' -%>
42

  
43
      <%= button_to_function l(:label_edit_author), '', :id => form_tag_id(f.object_name, :edit_button), :class => 'author_edit_btn' -%>
44

  
41 45
      <%= link_to_remove_fields l("remove_author"), f %>
42 46
    </p>
43 47
  </div>
plugins/redmine_bibliography/assets/javascripts/bibliography.js
5 5
	$author_info = $this.closest('div').prev();
6 6
	$author_info.children('.description').toggle();
7 7
	$author_info.find('p :input').attr("readonly", true);
8
    $author_info.find('p :input').addClass('readonly');
9

  
10
    $this.siblings('.author_edit_btn').show();
11
    $this.hide();
8 12

  
9 13
    return false;
10
}
14
}
15

  
16
function enable_fields(){
17
    $this = $(this);
18
    $author_info = $this.closest('div').prev();
19
    $author_info.children('.description').toggle();
20
    $author_info.find('p :input').attr("readonly", false);
21
    $author_info.find('p :input').removeClass('readonly');
22

  
23
    $this.siblings('.author_save_btn').show();
24
    $this.hide();
25

  
26
    return false;
27
}
plugins/redmine_bibliography/assets/stylesheets/bibliography.css
4 4
    color: #777;
5 5
}
6 6

  
7
input.readonly {
7
.readonly {
8 8
    border: none;
9 9
    padding: 0;
10 10
    margin: 0;
......
71 71
  background-image: url(../../../images/loading.gif);
72 72
}
73 73

  
74
.author_edit_btn {
75
  display:none;
76
}
77

  

Also available in: Unified diff