diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b8a0bf7a..363489ac 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -2,7 +2,10 @@ class ProjectsController < ApplicationController before_action :set_team, only: [:index, :new, :create] def index - @projects = @team.projects.select(:id, :name, :created_at, :updated_at) + @team_projects = @team.projects.select(:id, :source, :updated_at) + .order(Arel.sql("source->>'name'")) + .pluck(:id, Arel.sql("source->>'name'"), :updated_at) + .map { |id, name, updated_at| OpenStruct.new(id: id, name: name, updated_at: updated_at) } render layout: "team" end diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 9d7784e5..998efb9e 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -9,9 +9,9 @@
- <% @team.projects.sort_by { |project| project.name.downcase }.each do |project| %> + <% @team_projects.sort_by { |project| project.name.downcase }.each do |project| %>
- <%= link_to project_path(project), class: "list-group-item list-group-item-action border-0" do %> + <%= link_to project_path(project.id), class: "list-group-item list-group-item-action border-0" do %>
<%= project.name %> @@ -23,13 +23,13 @@
<% end %> - <%= link_to project_duplicates_path(project), method: :post, class: "px-3 py-2" do %> + <%= link_to project_duplicates_path(project.id), method: :post, class: "px-3 py-2" do %> <% end %> - <%= link_to edit_project_path(project), class: "px-3 py-2" do %> + <%= link_to edit_project_path(project.id), class: "px-3 py-2" do %> <% end %> - <%= link_to project_path(project), method: :delete, data: { confirm: "Are you sure you want to delete '#{project.name}'?" }, class: "px-3 py-2 text-danger" do %> + <%= link_to project_path(project.id), method: :delete, data: { confirm: "Are you sure you want to delete '#{project.name}'?" }, class: "px-3 py-2 text-danger" do %> <% end %>