Unverified Commit d9a12972 authored by Benjamin Neff's avatar Benjamin Neff Committed by Steffen van Bergerem
Browse files

Refactor PublisherHelper and move publisher_open? method

closes #7311
parent 8ebf9c4a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
## Bug fixes
* Fix path to `bundle` in `script/server` [#7281](https://github.com/diaspora/diaspora/pull/7281)
* Update comment in database example config [#7282](https://github.com/diaspora/diaspora/pull/7282)
* Make the \#newhere post public again [#7311](https://github.com/diaspora/diaspora/pull/7311)

## Features
* Add support for [Liberapay](https://liberapay.com) donations [#7290](https://github.com/diaspora/diaspora/pull/7290)
+0 −8
Original line number Diff line number Diff line
@@ -38,12 +38,4 @@ module InterimStreamHackinessHelper
     []
    end
  end

  def publisher_method(method)
    @stream.try(:publisher).try(method) == true
  end

  def publisher_open
    publisher_method(:open)
  end
end
+8 −10
Original line number Diff line number Diff line
@@ -3,19 +3,13 @@
#   the COPYRIGHT file.

module PublisherHelper
  def remote?
    params[:controller] != "tags"
  end

  def service_button(service)
    provider_title = I18n.t(
      "services.index.share_to",
      provider: service.provider.titleize)
    provider_title = I18n.t("services.index.share_to", provider: service.provider.titleize)
    content_tag :div,
                class:   "btn btn-link service_icon dim",
                title:   "#{provider_title} (#{service.nickname})",
                id:      "#{service.provider}",
                maxchar: "#{service.class::MAX_CHARACTERS}",
                id:      service.provider,
                maxchar: service.class::MAX_CHARACTERS,
                data:    {toggle: "tooltip", placement: "bottom"} do
      if service.provider == "wordpress"
        content_tag(:span, "", class: "social-media-logos-wordpress-16x16")
@@ -37,6 +31,10 @@ module PublisherHelper
    selected_aspects.include?(aspect) && !all_aspects_selected?(selected_aspects) && !public_selected?(selected_aspects)
  end

  def publisher_open?
    publisher_boolean?(:open)
  end

  private

  def publisher_boolean?(option)
+1 −1
Original line number Diff line number Diff line
.row.publisher#publisher{class: ((aspect == :profile || publisher_open) ? "mention_popup" : "closed")}
.row.publisher#publisher{class: ((aspect == :profile || publisher_open?) ? "mention_popup" : "closed")}
  .content_creation
    = form_for(StatusMessage.new) do |status|
      = status.error_messages