Project

General

Profile

Patch #2459 » Links-and-filters-for-project-and-author-in-search-and-activity.diff

Patch v1 - Nikos Dimitrakopoulos, 2009-01-07 16:32

View differences:

app/views/search/index.rhtml (working copy)
26 26
    <h3><%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)</h3>
27 27
    <dl id="search-results">
28 28
      <% @results.each do |e| %>
29
        <dt class="<%= e.event_type %>"><%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate(e.event_title, 255), @tokens), e.event_url %></dt>
29
        <dt class="<%= e.event_type %>">
30
          <% if @project != e.project -%>
31
            <span class="project">
32
              <%= link_to(h(e.project), { :action => :show, :id => e.project } ) %>
33
              <%= content_tag('span', link_to(l(:label_filter).downcase, params.merge(:id => e.project, :scope => 'subprojects')), { :class => 'filter' }) %>
34
            </span>
35
          <% end -%>
36
          <%= link_to highlight_tokens(truncate(e.event_title, 255), @tokens), e.event_url %>
37
        </dt>
30 38
        <dd><span class="description"><%= highlight_tokens(e.event_description, @tokens) %></span>
31 39
        <span class="author"><%= format_time(e.event_datetime) %></span></dd>
32 40
      <% end %>
app/views/projects/activity.rhtml (working copy)
9 9
  <dt class="<%= e.event_type %>  <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
10 10
	<%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
11 11
  <span class="time"><%= format_time(e.event_datetime, false) %></span>
12
  <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %>
12
  <% if @project.nil? || @project != e.project -%>
13
    <span class="project">
14
      <%= link_to(h(e.project), { :action => :show, :id => e.project } ) %>
15
      <%= content_tag('span', link_to(l(:label_filter).downcase, params.merge(:id => e.project)), { :class => 'filter' }) %>
16
    </span>
17
  <% end -%>
13 18
  <%= link_to format_activity_title(e.event_title), e.event_url %></dt>
14 19
  <dd><span class="description"><%= format_activity_description(e.event_description) %></span>
15
  <span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd>
20
  <span class="author">
21
    <% if e.respond_to?(:event_author) -%>
22
      <%= link_to(e.event_author, :controller => :account, :action => :show, :id => e.event_author) %>
23
      <%= content_tag('span', link_to(l(:label_filter).downcase, params.merge(:user_id => e.event_author)), { :class => 'filter' }) %>
24
    <% end %>
25
  </span></dd>
16 26
<% end -%>
17 27
</dl>
18 28
<% end -%>
lang/en.yml (working copy)
304 304
label_document_new: New document
305 305
label_document_plural: Documents
306 306
label_document_added: Document added
307
label_filter: Filter
307 308
label_role: Role
308 309
label_role_plural: Roles
309 310
label_role_new: New role
public/stylesheets/application.css (working copy)
192 192
div#activity dt .time { color: #777; font-size: 80%; }
193 193
div#activity dd .description, #search-results dd .description { font-style: italic; }
194 194
div#activity span.project:after, #search-results span.project:after { content: " -"; }
195
div#activity span.filter:before, #search-results span.filter:before { content: "("; }
196
div#activity span.filter:after, #search-results span.filter:after { content: ")"; }
197
div#activity span.filter:hover a, #search-results span.filter:hover a,
198
div#activity span.filter:hover:before, #search-results span.filter:hover:before,
199
div#activity span.filter:hover:after, #search-results span.filter:hover:after { text-decoration: underline; }
200
div#activity span.filter a, #search-results span.filter a,
201
div#activity span.filter:before, #search-results span.filter:before,
202
div#activity span.filter:after, #search-results span.filter:after { color: #777; font-size: 85%; }
195 203
div#activity dd span.description, #search-results dd span.description { display:block; }
196 204

  
197 205
#search-results dd { margin-bottom: 1em; padding-left: 20px; margin-left:0px; }
(1-1/3)