show archived shared templates

This commit is contained in:
Pete Matsyburka
2026-06-24 19:08:15 +03:00
parent 2840359396
commit b2790776ef
8 changed files with 38 additions and 13 deletions
@@ -4,10 +4,16 @@ class TemplatesSharedController < ApplicationController
def index
authorize!(:read, Template)
@is_archived = params[:archived] == 'true'
@templates = Templates.shared(current_user)
.active
.preload(:author, :template_accesses, :template_sharings)
.order(id: :desc)
@has_archived = !@is_archived && @templates.archived.exists?
@templates = @is_archived ? @templates.archived : @templates.active
@templates = @templates.preload(:author, :template_accesses, :template_sharings)
.order(id: :desc)
@templates = Templates.search(current_user, @templates, params[:q])