From 5b24bc99c5dab10bfd60b5227063b243473407d2 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Tue, 25 Apr 2023 20:49:30 +1000 Subject: [PATCH] Add tags index --- app/actions/tags/index.rb | 13 +++++++++++++ app/views/tags/index.rb | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 app/actions/tags/index.rb create mode 100644 app/views/tags/index.rb diff --git a/app/actions/tags/index.rb b/app/actions/tags/index.rb new file mode 100644 index 0000000..f321d11 --- /dev/null +++ b/app/actions/tags/index.rb @@ -0,0 +1,13 @@ +module Adamantium + module Actions + module Tags + class Index < Action + include Deps["views.tags.index"] + + def handle(req, res) + res.render index + end + end + end + end +end diff --git a/app/views/tags/index.rb b/app/views/tags/index.rb new file mode 100644 index 0000000..d5fa39e --- /dev/null +++ b/app/views/tags/index.rb @@ -0,0 +1,19 @@ +module Adamantium + module Views + module Tags + class Index < View + include Deps["repos.tag_repo"] + + expose :tag_groups do + tag_repo + .list + .group_by { |tag| + grouper = tag.label.strip[0].downcase + /[a-z]/.match?(grouper) ? grouper : "#" + } + .sort + end + end + end + end +end