Class: Monolith::ApplicationController::View

Inherits:
Views::Layouts::Base
  • Object
show all
Defined in:
app/controllers/monolith/application_controller.rb

Overview

View with Navigation

Instance Method Summary collapse

Instance Method Details

#around_templateObject



24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/monolith/application_controller.rb', line 24

def around_template
  super do
    div(class: "flex min-h-screen") do
      render_sidebar
      div(class: "flex-1 p-6 overflow-hidden") do
        yield self if block_given?
      end
    end
  end
end


65
66
67
68
# File 'app/controllers/monolith/application_controller.rb', line 65

def ext_link(href, text = nil)
  return em { "" } if href.nil?
  a(href:, target: "_blank", rel: "noopener", class: "link") { text || href }
end


61
62
63
# File 'app/controllers/monolith/application_controller.rb', line 61

def nav_link(text, **to)
  a(href: url_for(to)) { text }
end

#render_sidebarObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/monolith/application_controller.rb', line 35

def render_sidebar
  aside(class: "w-64 shrink-0 bg-base-200 p-4") do
    div(class: "mb-6") do
      a(href: url_for(controller: "/monolith/home", action: :show)) do
        img(src: asset_path("monolith/logo.svg"), alt: "Monolith", class: "dark:invert h-24 w-auto")
      end
    end

    ul(class: "menu bg-base-200 rounded-box w-full") do
      # li { nav_link "Emails", controller: "/monolith/emails", action: :index }
      li { nav_link "Gems", controller: "/monolith/gems", action: :index }
      li { nav_link "Routes", controller: "/monolith/routes", action: :index }
      li { nav_link "Generators", controller: "/monolith/generators", action: :index }
      li do
        details(open: true) do
          summary { "Data" }
          ul do
            li { nav_link "Models", controller: "/monolith/models", action: :index }
            li { nav_link "Tables", controller: "/monolith/tables", action: :index }
          end
        end
      end
    end
  end
end