Class: Monolith::GemsController::Index

Inherits:
View
  • Object
show all
Defined in:
app/controllers/monolith/gems_controller.rb

Overview

Phlex views

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gems=(value) ⇒ Object (writeonly)

Sets the attribute gems

Parameters:

  • value

    the value to set the attribute gems to.



162
163
164
# File 'app/controllers/monolith/gems_controller.rb', line 162

def gems=(value)
  @gems = value
end

Instance Method Details

#view_templateObject



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'app/controllers/monolith/gems_controller.rb', line 164

def view_template
  div(class: "p-6 space-y-4") do
    h1(class: "text-2xl font-bold") { "Gems" }
    p(class: "text-sm") { "From your current Bundler context (Gemfile.lock)." }

    Table @gems do
      it.row("Gem") {
        nav_link it.name, controller: "/monolith/gems", action: :show, id: it.name
      }
      it.row("Version") {
        it.version
      }
      it.row("Licenses") {
        it.licenses.any? ? it.licenses.join(", ") : em { "" }
      }
      it.row("Origin") {
        gem_origin_link it
      }
      it.row("Description") {
        it.summary.to_s.strip.empty? ? em { "" } : it.summary
      }
    end
  end
end