From a44891b2d70e9deca48dcfe4e6ae7dee88cd29d7 Mon Sep 17 00:00:00 2001 From: Eric Amorde Date: Sun, 15 Oct 2023 20:05:44 -0700 Subject: [PATCH] Improve navigation linking in manage views --- app/controllers/manage_controller.rb | 37 ++++++++++++++++++++++++++++ app/views/manage/commits/show.erb | 4 +-- app/views/manage/pods/detail.erb | 27 +++++++++++++++----- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/app/controllers/manage_controller.rb b/app/controllers/manage_controller.rb index 0e7d32b1..9fbc55ce 100644 --- a/app/controllers/manage_controller.rb +++ b/app/controllers/manage_controller.rb @@ -27,6 +27,43 @@ def self.hash_password(password) end helpers ManageHelper + helpers do + # @return [String] + # + def pod_url(pod_id) + "/manage/pods/#{pod_id}" + end + + # @return [String] + # + def pod_link(pod) + "#{pod.name}" + end + + # @return [String] + # + def commit_url(commit_id) + "/manage/commits/#{commit_id}" + end + + # @return [String] + # + def commit_link(commit) + "#{commit.id}" + end + + # @return [String] + # + def owner_url(owner_id) + "/manage/owners/#{owner_id}" + end + + # @return [String] + # + def owner_link(owner) + "#{owner.id}" + end + end register Sinatra::Twitter::Bootstrap::Assets diff --git a/app/views/manage/commits/show.erb b/app/views/manage/commits/show.erb index 098e4d98..9de96805 100644 --- a/app/views/manage/commits/show.erb +++ b/app/views/manage/commits/show.erb @@ -1,14 +1,14 @@ <% @title = @commit.pod_version.pod.name %>
ID
<%= @commit.id %>
SHA
-
<%= @commit.sha %>
+
<%= @commit.sha %>
Committer
<%= @commit.committer.public_attributes %>
diff --git a/app/views/manage/pods/detail.erb b/app/views/manage/pods/detail.erb index a7d0e4f9..08abcd3d 100644 --- a/app/views/manage/pods/detail.erb +++ b/app/views/manage/pods/detail.erb @@ -9,18 +9,31 @@ Version Commit + SHA + Published At <% @pod.versions.each do |version| %> - <%= version.name %> - <% if version.published? %> + <%= version.name %> + + <% if version.published? %> + + <%= commit_link(version.last_published_by) %> + + <%= version.commit_sha %> - <% else %> - Unpublished - <% end %> + + + <%= version.last_published_by.created_at.to_formatted_s(:rfc822) %> + + <% else %> + Unpublished + + + <% end %> <% end %> @@ -41,7 +54,9 @@ <% @pod.owners.each do |owner| %> - <%= owner.id %> + + <%= owner_link(owner) %> + <%= owner.name %> <%= owner.email %>