Class: Decidim::FollowButtonCell

Inherits:
ButtonCell
  • Object
show all
Defined in:
app/cells/decidim/follow_button_cell.rb

Overview

This cell renders the button to follow the given resource.

Instance Method Summary collapse

Instance Method Details

#followers_countObject



12
13
14
15
16
17
18
# File 'app/cells/decidim/follow_button_cell.rb', line 12

def followers_count
  if model.respond_to?(:followers_count)
    model.followers_count
  else
    model.followers.size
  end
end

#id_optionObject



20
21
22
# File 'app/cells/decidim/follow_button_cell.rb', line 20

def id_option
  @id_option ||= options[:mobile] ? "follow-mobile" : "follow"
end

#showObject



6
7
8
9
10
# File 'app/cells/decidim/follow_button_cell.rb', line 6

def show
  return if model == current_user

  render
end