Skip to content

Add post ID to offers/inquiries reports #581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/decorators/post_report_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def name(extension)

def headers
[
"",
@type.model_name.human,
User.model_name.human
]
Expand All @@ -23,10 +24,11 @@ def rows
grouped_rows = []

@collection.each do |category, posts|
grouped_rows << [category.try(:name) || "-", ""]
grouped_rows << ["", category.try(:name) || "-", ""]

posts.each do |post|
grouped_rows << [
post.id,
post.title,
"#{post.user} (#{post.member_uid})"
]
Expand Down
28 changes: 24 additions & 4 deletions app/views/application/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,31 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<ul class="nav nav-pills actions-menu">
<%= render 'application/menus/user_list_link' %>
<%= render 'application/menus/offers_list_link' %>
<%= render 'application/menus/inquiries_list_link' %>
<li class="<%= "active" if current_page?(users_path) %>">
<%= link_to users_path do %>
<%= glyph :user %>
<%= t("users.index.members") %>
<% end %>
</li>
<li class="<%= "active" if current_page?(offers_path) %>">
<%= link_to offers_path do %>
<%= glyph :offer %>
<%= Offer.model_name.human(count: :many) %>
<% end %>
</li>
<li class="<%= "active" if current_page?(inquiries_path) %>">
<%= link_to inquiries_path do %>
<%= glyph :inquiry %>
<%= Inquiry.model_name.human(count: :many) %>
<% end %>
</li>
<% if current_user.manages? current_organization %>
<%= render 'application/menus/offers_by_tag_link' %>
<li class="<%= "active" if current_page?(alpha_grouped_index_tags_path(post_type: "offer")) %>">
<%= link_to alpha_grouped_index_tags_path(post_type: "offer") do %>
<%= glyph :tags %>
<%= t ".tags" %>
<% end %>
</li>
<%= render 'application/menus/organization_reports_menu' %>
<%= render 'application/menus/organization_statistics_menu' %>
<%= render 'application/menus/organization_listings_menu' %>
Expand Down
6 changes: 0 additions & 6 deletions app/views/application/menus/_inquiries_list_link.html.erb

This file was deleted.

6 changes: 0 additions & 6 deletions app/views/application/menus/_offers_by_tag_link.html.erb

This file was deleted.

6 changes: 0 additions & 6 deletions app/views/application/menus/_offers_list_link.html.erb

This file was deleted.

11 changes: 0 additions & 11 deletions app/views/application/menus/_organization_switcher.html.erb

This file was deleted.

13 changes: 12 additions & 1 deletion app/views/application/menus/_user_admin_menu_items.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<% if current_user.organizations.count > 1 %>
<%= render 'application/menus/organization_switcher' %>
<li class="disabled">
<a href="#"><%= current_organization.name %></a>
</li>
<% (current_user.organizations - [current_organization]).each do |org| %>
<li>
<%= link_to set_current_organization_path(org), method: :post do %>
<%= glyph(:retweet) %>
<%= org.name %>
<% end %>
</li>
<% end %>

<li class="divider" role="presentation"></li>
<% end %>

Expand Down
6 changes: 0 additions & 6 deletions app/views/application/menus/_user_list_link.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/inquiries/index.js.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/offers/index.js.erb

This file was deleted.

6 changes: 4 additions & 2 deletions app/views/reports/post_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
</colgroup>
<thead>
<tr>
<th></th>
<th><%= @post_type.model_name.human %></th>
<th><%= User.model_name.human %></th>
</tr>
</thead>
<tbody>
<% @posts.each do |cat, ps| %>
<tr class="success">
<td colspan="2"><h4><%= cat || '—' %></h4></td>
<tr class="info">
<td colspan="3"><h4><%= cat || '—' %></h4></td>
</tr>
<% ps.each do |post| %>
<tr>
<td><%= post.id %></td>
<td><strong><%= post.title %></strong></td>
<td><%= "#{post.user} (#{post.member_uid})" %></td>
</tr>
Expand Down
3 changes: 0 additions & 3 deletions app/views/reports/user_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<table class="table table-condensed table-bordered table-striped">
<thead>
<tr>
<!-- %th= User.human_attribute_name(:registration_number)
-->
<th>N</th>
<th><%= User.human_attribute_name :username %></th>
<th><%= User.human_attribute_name :email %></th>
Expand All @@ -22,6 +20,5 @@
</tr>
<% end %>
</tbody>
<tfoot></tfoot>
</table>
</div>
5 changes: 3 additions & 2 deletions spec/decorators/post_report_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

it "#headers" do
expect(decorator.headers).to eq([
"",
Offer.model_name.human,
User.model_name.human
])
Expand All @@ -34,8 +35,8 @@
offer = org.offers.of_active_members.active.first

expect(decorator.rows).to eq([
[category.name, ""],
[offer.title, "#{offer.user} (#{offer.member_uid})"]
["", category.name, ""],
[offer.id, offer.title, "#{offer.user} (#{offer.member_uid})"]
])
end
end