Class: Components::ListsCard
- Inherits:
-
Base
- Object
- Base
- Components::ListsCard
- Includes:
- Phlex::Rails::Helpers::LinkTo
- Defined in:
- app/components/lists_card.rb
Instance Method Summary collapse
- #before_template ⇒ Object
-
#initialize(listable:) ⇒ ListsCard
constructor
A new instance of ListsCard.
- #render? ⇒ Boolean
- #view_template ⇒ Object
Constructor Details
#initialize(listable:) ⇒ ListsCard
Returns a new instance of ListsCard.
8 9 10 |
# File 'app/components/lists_card.rb', line 8 def initialize(listable:) @listable = listable end |
Instance Method Details
#before_template ⇒ Object
16 17 18 19 |
# File 'app/components/lists_card.rb', line 16 def before_template @all_lists = policy_scope(current_user.lists.without_special).all @on_lists, @off_lists = @all_lists.partition { @listable.in? it.models } end |
#render? ⇒ Boolean
12 13 14 |
# File 'app/components/lists_card.rb', line 12 def render? @listable.present? end |
#view_template ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/components/lists_card.rb', line 21 def view_template Card title: t("components.lists_card.title"), variant: :secondary do div class: "card-text" do on_lists if @on_lists.any? add_dropdown end end end |