Added authorization + issues dashboard

This commit is contained in:
Shrey 2015-05-26 18:12:43 +05:30 committed by Matt Amos
parent 453f758f91
commit d49922eb63
11 changed files with 124 additions and 6 deletions

View file

@ -31,6 +31,8 @@
<%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => diary_entry.user.display_name, :id => diary_entry.id %>
<% end %>
<li><%= link_to 'Report', new_issue_url(reportable_id: diary_entry.id, reportable_type: diary_entry.class.name, user: diary_entry.user.id) %></li>
<%= if_administrator(:li) do %>
<%= link_to t('diary_entry.diary_entry.hide_link'), hide_diary_entry_path(:display_name => diary_entry.user.display_name, :id => diary_entry.id), :method => :post, :data => { :confirm => t('diary_entry.diary_entry.confirm') } %>
<% end %>

View file

@ -0,0 +1,11 @@
<% reports.each do |report| %>
<div class="reports">
<div class="display:inline">
<%= user_thumbnail report.user %>
<%= report.details %>
</div>
<span class="deemphasize"><%= raw(t('Reported by:',:link_user => (link_to h(report.user.display_name), :controller => :user, :action => :view, :display_name => report.user.display_name), :comment_created_at => link_to(l(report.created_at,:format => :friendly)))) %>
on <%= l report.created_at.to_datetime, :format => :long %> </span>
</div>
<hr>
<% end %>

View file

@ -1,2 +1,36 @@
<h1>Issues#index</h1>
<p>Find me in app/views/issues/index.html.erb</p>
<p id= "notice"><%= notice %></p>
<% content_for :heading do %>
<h1>List of existing Issues:</h1>
<% end %>
<table>
<thead>
<tr>
<tr>
<td style="text-align:center"><b> # </b> </td>
<td style="text-align:center"><b>Issue Type </b></td>
<td style="text-align:center"><b> Status </b></td>
<td style="text-align:center"><b> Number of Reports</b></td>
<td style="text-align:center"><b> Link to instance </b></td>
<td style="text-align:center"><b> Reported User </b></td>
<td style="text-align:center"></td>
</tr>
</tr>
</thead>
<tbody>
<% @issues.each do |issue| %>
<tr>
<td style="text-align:center">Issue #<%= issue.id %> </td>
<td style="text-align:center"> <%= issue.reportable_type %></td>
<td style="text-align:center"><span class="count-number"> <strong><%= issue.status %></strong></span> </td>
<td style="text-align:center"><%= issue.reports.count %></td>
<td style="text-align:center"> <%= reportable_url(issue.reportable) %></td>
<td style="text-align:center"><%= link_to issue.user.display_name , :controller => :user, :action => :view,:display_name => issue.user.display_name %></td>
<td style="text-align:center"><%= link_to "Show Issue", issue %></td>
</tr>
<% end %>
</tbody>
</table>

View file

@ -1,2 +1,29 @@
<h1>Issues#show</h1>
<p>Find me in app/views/issues/show.html.erb</p>
<% content_for :heading do %>
<h2> Issue #<%= @issue.id %> <br/> <span class="count-number">Status: <strong><%= @issue. status %></strong></span></h2>
<p>Issue against: <%= reportable_url(@issue.reportable) %></p>
<p>Issue type: <%= @issue.reportable_type %></p>
<p class="deemphasize">
<small>
<%= @issue.reports.count %> reports | First reported: <%= l @issue.created_at.to_date, :format => :long %> | <%= "Last resolved at #{l(@issue.resolved_at.to_datetime, :format =>:long)}" if @issue.resolved? %>
</small>
</p>
<p><%= link_to "Resolve", resolve_issue_url(@issue), :method => :post if @issue.may_resolve? %></p>
<p><%= link_to "Ignore", ignore_issue_url(@issue), :method => :post if @issue.may_ignore? %></p>
<p><%= link_to "Reopen", reopen_issue_url(@issue), :method => :post if @issue.may_reopen? %></p>
<% end %>
<h3>Reports under this issue:</h3>
<% if @read_reports.present? %>
<div class="read-reports">
<h4>Read Reports:</h4>
<%= render 'reports',reports: @read_reports %>
</div>
<% end %>
<% if @unread_reports.any? %>
<div class="unread-reports">
<h4>New Reports:</h4>
<%= render 'reports',reports: @unread_reports %>
</div>
<% end %>