Commit e005266d authored by Oleksandr Horbatiuk's avatar Oleksandr Horbatiuk 🧩 Committed by Serhii Myronets
Browse files

Issue #3256324 by chmez: Make join methods for groups re-usable

parent d711c36d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -101,6 +101,11 @@
  margin-bottom: 0;
}

.teaser__content .field--name-field-profile-self-introduction + .teaser__content--badges,
.teaser__content .field--name-field-profile-summary + .teaser__content--badges {
  margin-top: -.75rem;
}

.teaser__content-line {
  display: -webkit-box;
  display: -ms-flexbox;
+4 −0
Original line number Diff line number Diff line
@@ -164,6 +164,10 @@
        margin-bottom: 0;
      }
    }

    + .teaser__content--badges {
      margin-top: -.75rem;
    }
  }
}

+27 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\socialbase\Plugin\Preprocess;

use Drupal\bootstrap\Plugin\Preprocess\PreprocessBase;
use Drupal\bootstrap\Plugin\Preprocess\PreprocessInterface;
use Drupal\bootstrap\Utility\Variables;

/**
 * Pre-processes variables for the "join" theme hook.
 *
 * @ingroup plugins_preprocess
 *
 * @BootstrapPreprocess("join")
 */
class Join extends PreprocessBase implements PreprocessInterface {

  /**
   * {@inheritdoc}
   */
  public function preprocessVariables(Variables $variables): void {
    // We probably don't need .btn-group here, but I can't figure out why it's
    // needed, so it's only removed for the new user_is_invited set-up.
    $variables->addClass('btn-group');
  }

}
+2 −40
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 * - attributes: HTML attributes for the wrapper.
 * - profile: The profile object.
 * - url: The profile URL.
 * - join: The join method actions.
 *
 * @ingroup themeable
 */
@@ -86,46 +87,7 @@
          {{ content.field_group_address }} </span>
      </div>

      {% if group_operations_url %}
        <div class="hero-footer__cta">
          <div class="btn-group">
            {% if user_is_invited %}
              <div class="dropdown">
                <a href="{{ group_invite_accept_operations_url }}" class="btn btn-accent btn-lg btn-raised" title="{% trans %}Join{% endtrans %}">{% trans %}Accept{% endtrans %}</a>
                <button type="button" autocomplete="off" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-accent btn-lg btn-raised waves-effect waves-btn waves-light margin-left-m dropdown-toggle"><span class="caret"></span></button>
                <ul class="dropdown-menu dropdown-menu-right">
                  <li><a href="{{ group_invite_decline_operations_url }}">{% trans %}Decline{% endtrans %}</a></li>
                </ul>
              </div>
            {% elseif joined %}
              <button type="button" autocomplete="off" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-accent btn-lg btn-raised dropdown-toggle">{% trans with {'context': 'Is a member'} %}Joined{% endtrans %}<span class="caret"></span></button>
              <ul class="dropdown-menu dropdown-menu-right">
                <li><a href="{{ group_operations_url }}">{% trans %}Leave group{% endtrans %}</a></li>
                {% if content.flag_mute_group_notifications|render is not empty and logged_in %}
                  <li>{{ content.flag_mute_group_notifications }}</li>
                {% endif %}
              </ul>
            {% elseif closed_group %}
              {% if allow_request %}
                {% if requested %}
                  <button type="button" autocomplete="off" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-accent btn-lg btn-raised dropdown-toggle">{% trans %}Request sent{% endtrans %}<span class="caret"></span></button>
                  <ul class="dropdown-menu dropdown-menu-right">
                    <li><a href="{{ group_operations_url }}">{% trans %}Cancel request{% endtrans %}</a></li>
                  </ul>
                {% else %}
                  <a href="{{ group_operations_url }}" class="btn btn-accent btn-lg btn-raised dropdown-toggle use-ajax" title="{% trans %}Request to join{% endtrans %}">{% trans %}Request to join{% endtrans %}</a>
                {% endif %}
              {% else %}
                <a href="{{ group_operations_url }}" class="btn btn-accent btn-lg btn-raised dropdown-toggle disabled" title="{{ cta }}">{{ cta }}</a>
              {% endif %}
            {% elseif anonymous_request %}
              <a href="{{ group_operations_url }}" class="btn btn-accent btn-lg btn-raised dropdown-toggle use-ajax" title="{% trans %}Request to join{% endtrans %}">{% trans %}Request to join{% endtrans %}</a>
            {% else %}
              <a href="{{ group_operations_url }}" class="btn btn-accent btn-lg btn-raised dropdown-toggle" title="{% trans %}Join{% endtrans %}">{% trans %}Join{% endtrans %}</a>
            {% endif %}
          </div>
        </div>
      {% endif %}
      {{ join }}
    </footer>
  </div> {# cover-wrap #}
</div> {# cover #}
+11 −10
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@
        {% endif %}

        {% if content.field_profile_profile_tag['#items'] or badges %}
          <div style="margin-left: 30px; margin-top: 5px;">
          <div class="teaser__content--badges" style="margin-bottom: 5px;">
            {% for badge in badges %}
              {% set badge_classes = badge.classes|merge(['badge']) %}
              <div{{ attributes.addClass(badge_classes) }}>{{ badge.label }}</div>
@@ -89,7 +89,6 @@
          </div>
        {% endif %}
      {% endblock %}

    </div>

    <div class="card__actionbar">
@@ -98,8 +97,9 @@
          {{ content.flag_follow_user }}
        {% endif %}

        {% set follow_user_attributes = create_attribute() %}
        {% set follow_user_classes = [ content.flag_follow_user ? 'btn btn-default' : 'card__link' ] %}
        <a href="{{ profile_contact_url }}" {{ attributes.addClass(follow_user_classes) }}>
        <a href="{{ profile_contact_url }}" {{ follow_user_attributes.addClass(follow_user_classes) }}>
          {% if profile_contact_label == 'private_message' %}
            {% if content.flag_follow_user %}
              {% trans %}Message{% endtrans %}
@@ -110,6 +110,7 @@
            {% trans %}View profile{% endtrans %}
          {% endif %}
        </a>

        {% if not content.flag_follow_user %}
          <a href="{{ profile_stream_url }}" class="card__link hidden-for-phone-only">
            {% trans %}View activities{% endtrans %}