Remove column sorting
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 29 Nov 2017 17:18:05 +0000 (17:18 +0000)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 29 Nov 2017 17:28:09 +0000 (17:28 +0000)
It's not tested, not working, and so it can come later in a separate PR.

app/controllers/issues_controller.rb
app/helpers/issues_helper.rb
app/views/issues/index.html.erb

index e156ea0..edf8f11 100644 (file)
@@ -8,8 +8,6 @@ class IssuesController < ApplicationController
   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
@@ -19,7 +17,7 @@ class IssuesController < ApplicationController
       @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?
index 7156964..27a51c0 100644 (file)
@@ -47,16 +47,6 @@ module IssuesHelper
     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"
index a490223..6c72dcc 100644 (file)
@@ -21,13 +21,13 @@ Search for a particular issue(s):  <br/>
 <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>