Revision 1080:5bd8c86cfa6a vendor/plugins

View differences:

vendor/plugins/redmine_bibliography/app/models/publication.rb
19 19

  
20 20
  before_save :set_initial_author_order
21 21

  
22
  acts_as_activity_provider :type => 'publication',
23
                            :timestamp => "#{Publication.table_name}.created_at",
24
                            :author_key => "#{Publication.table_name}.builder_id",
25
                            :find_options => {:joins => "INNER JOIN projects_publications ON #{Publication.table_name}.id = projects_publications.publication_id JOIN #{Project.table_name} ON #{Project.table_name}.id = projects_publications.project_id"}
26

  
27
  acts_as_event :title => Proc.new {|o| o.title },
28
                :datetime => :created_at,
29
                :author =>  nil,
30
                :type => 'publications',
31
                #todo - need too move the cache from the helper to the model
32
                :description => Proc.new {|o| o.print_entry(:ieee)},
33
                :project => Project.first
34
                # :url => Proc.new {|o| {:controller => 'publications', :action => 'show', :id => o.id }}
35

  
36

  
22 37
  # Ensure error message uses proper text instead of
23 38
  # bibtex_entry.entry_type (#268).  There has to be a better way to
24 39
  # do this!
vendor/plugins/redmine_bibliography/app/views/activities/index.html.erb
1
<h2><%=
2
  if @author.nil?
3
    if @institution_name.blank?
4
      l(:label_activity)
5
    else
6
      l(:label_institution_activity, h(@institution_name))
7
    end
8
  else
9
    l(:label_user_activity, link_to_user(@author))
10
  end
11
  %></h2>
12
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p>
13

  
14
<div id="activity">
15
<% @events_by_day.keys.sort.reverse.each do |day| %>
16
<h3><%= format_activity_day(day) %></h3>
17
<dl>
18
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
19
  <%- if e.class != Publication -%>
20
    <dt class="<%= e.event_type %>  <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
21
      <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
22
      <span class="time"><%= format_time(e.event_datetime, false) %></span>
23
      <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %>
24
      <%= link_to format_activity_title(e.event_title), e.event_url %>
25
    </dt>
26
    <dd>
27
      <span class="description"><%= format_activity_description(e.event_description) %></span>
28
      <span class="author"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span>
29
    </dd>
30
  <%- else -%>
31
    <dt class="<%= e.event_type %>  <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
32
      <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
33
      <span class="time"><%= format_time(e.event_datetime, false) %></span>
34
      <%= link_to format_activity_title(e.event_title), e.event_url %>
35
      was added to the following
36
      <% if e.projects.count > 1 %>
37
        projects:
38
      <%- else -%>
39
        project:
40
      <%- end -%>
41
      <%= content_tag('span', e.projects.join(', ')) -%>
42
    </dt>
43
    <dd>
44
      <span class="description"><%= e.event_description -%></span>
45
      <span class="author"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span>
46
    </dd>
47
  <% end -%>
48
<%- end -%>
49
</dl>
50
<% end -%>
51
</div>
52

  
53
<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
54

  
55
<div style="float:left;">
56
<%= link_to_content_update("\xc2\xab " + l(:label_previous),
57
                   params.merge(:from => @date_to - @days - 1),
58
                   :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))) %>
59
</div>
60
<div style="float:right;">
61
<%= link_to_content_update(l(:label_next) + " \xc2\xbb",
62
                   params.merge(:from => @date_to + @days - 1),
63
                   :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to >= Date.today %>
64
</div>
65
&nbsp;
66
<% other_formats_links do |f| %>
67
  <%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %>
68
<% end %>
69

  
70
<% content_for :header_tags do %>
71
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
72
<% end %>
73

  
74
<% content_for :sidebar do %>
75
<% form_tag({}, :method => :get) do %>
76
<h3><%= l(:label_activity) %></h3>
77
<p><% @activity.event_types.each do |t| %>
78
<%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
79
<label for="show_<%=t%>"><%= link_to(l("label_#{t.singularize}_plural"), {"show_#{t}" => 1, :user_id => params[:user_id]})%></label>
80
<br />
81
<% end %></p>
82
<% if @project && @project.descendants.active.any? %>
83
    <%= hidden_field_tag 'with_subprojects', 0 %>
84
    <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
85
<% end %>
86
<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %>
87
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
88
<% end %>
89
<% end %>
90

  
91
<% html_title(l(:label_activity), @author) -%>
vendor/plugins/redmine_bibliography/init.rb
51 51
  menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :param => :project_id, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] },
52 52
   :if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? }
53 53

  
54
  activity_provider :publication, :class_name => 'Publication', :default => true
55

  
54 56
end
57

  
58

  
59

  

Also available in: Unified diff