Module: PublisherHelper

Defined in:
app/helpers/publisher_helper.rb

Overview

Copyright © 2010-2011, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Instance Method Summary collapse

Instance Method Details

#all_aspects_selected?(selected_aspects) ⇒ Boolean

Returns:

  • (Boolean)

28
29
30
# File 'app/helpers/publisher_helper.rb', line 28

def all_aspects_selected?(selected_aspects)
  !all_aspects.empty? && all_aspects.size == selected_aspects.size && !public_selected?(selected_aspects)
end

#aspect_selected?(aspect, selected_aspects) ⇒ Boolean

Returns:

  • (Boolean)

32
33
34
# File 'app/helpers/publisher_helper.rb', line 32

def aspect_selected?(aspect, selected_aspects)
  selected_aspects.include?(aspect) && !all_aspects_selected?(selected_aspects) && !public_selected?(selected_aspects)
end

#public_selected?(selected_aspects) ⇒ Boolean

Returns:

  • (Boolean)

24
25
26
# File 'app/helpers/publisher_helper.rb', line 24

def public_selected?(selected_aspects)
  "public" == selected_aspects.try(:first) || publisher_boolean?(:public)
end

#publisher_open?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'app/helpers/publisher_helper.rb', line 36

def publisher_open?
  publisher_boolean?(:open)
end

#service_button(service) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/publisher_helper.rb', line 8

def service_button(service)
  provider_title = I18n.t("services.index.share_to", provider: service.provider.titleize)
   :div,
              class:   "btn btn-link service_icon dim",
              title:   "#{provider_title} (#{service.nickname})",
              id:      service.provider,
              maxchar: service.class::MAX_CHARACTERS,
              data:    {toggle: "tooltip", placement: "bottom"} do
    if service.provider == "wordpress"
      (:span, "", class: "social-media-logos-wordpress-16x16")
    else
      (:i, "", class: "entypo-social-#{service.provider} small")
    end
  end
end