Class: Components::ModelCard
- Inherits:
-
Base
- Object
- Base
- Components::ModelCard
- Includes:
- Phlex::Rails::Helpers::ImageTag, Phlex::Rails::Helpers::LinkTo, Phlex::Rails::Helpers::Sanitize
- Defined in:
- app/components/model_card.rb
Direct Known Subclasses
Instance Method Summary collapse
- #before_template ⇒ Object
-
#initialize(model:) ⇒ ModelCard
constructor
A new instance of ModelCard.
- #view_template ⇒ Object
Constructor Details
#initialize(model:) ⇒ ModelCard
Returns a new instance of ModelCard.
11 12 13 14 |
# File 'app/components/model_card.rb', line 11 def initialize(model:) @model = model @actor = @model.federails_actor end |
Instance Method Details
#before_template ⇒ Object
16 17 18 |
# File 'app/components/model_card.rb', line 16 def before_template @editable = policy(@model).edit? end |
#view_template ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/model_card.rb', line 20 def view_template div class: "col mb-3" do div class: "card preview-card" do div(class: "card-header position-absolute w-100 top-0 z-3 bg-body-secondary text-secondary-emphasis opacity-75") { server_indicator @model } if @model.remote? PreviewFrame(object: @model) div(class: "card-body") { info_row } actions end end end |