It's not tested, not working, and so it can come later in a separate PR.
before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore]
before_action :setup_user_role, :only => [:show, :index]
- helper_method :sort_column, :sort_direction
-
def index
if current_user.moderator?
@issue_types = @moderator_issues
@users = User.joins(:roles).where(:user_roles => { :role => "administrator" })
end
- @issues = Issue.where(:issue_type => @user_role).order(sort_column + " " + sort_direction)
+ @issues = Issue.where(:issue_type => @user_role)
# If search
if params[:search_by_user] && params[:search_by_user].present?
end
end
- def sortable(column, title = nil)
- title ||= column.titleize
- direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
- if column == sort_column
- arrow = direction == "desc" ? ["25B2".hex].pack("U") : ["25BC".hex].pack("U")
- title += arrow
- end
- # FIXME: link_to title, params.merge(:sort => column, :direction => direction)
- end
-
def report_type(report_class)
case report_class
when "DiaryEntry"
<table>
<thead>
<tr>
- <td style="width:40px;"><b> <%= sortable("status") %></b></td>
- <td style="width:160px;"><b> <%= sortable("reports_count", "Number of Reports") %></b></td>
- <td style="width:141px;"><b> <%= sortable("updated_at","Last updated at") %></b></td>
- <td style="width:140px;"><b> <%= sortable("updated_by","Last updated by") %></b></td>
- <td style="width:203px;"><b> Link to reports </b></td>
- <td style="width:128px;"><b> <%= sortable("reported_user_id","Reported User") %> </b></td>
- <td style="width:67px;"><b> Link to reported instance</b></td>
+ <td style="width:40px;"><b>Status</b></td>
+ <td style="width:160px;"><b>Number of Reports</b></td>
+ <td style="width:141px;"><b>Last updated at</b></td>
+ <td style="width:140px;"><b>Last updated by</b></td>
+ <td style="width:203px;"><b>Link to reports</b></td>
+ <td style="width:128px;"><b>Reported User</b></td>
+ <td style="width:67px;"><b>Link to reported instance</b></td>
</tr>
</thead>
<tbody>