VC/Vidyo: Unified button-rendering code

This commit is contained in:
Pedro Ferreira 2015-03-03 09:44:20 +01:00
parent eaf87e2dfe
commit c4fb1019a1
4 changed files with 33 additions and 28 deletions

View File

@ -1,2 +1,21 @@
<a class="i-button icon-play highlight" href="{{ vc_room.data.url }}"><strong>{% trans %}Join{% endtrans %}</strong></a>
{{ template_hook('vidyo-manage-event-buttons', event_vc_room=event_vc_room) }}
{% macro render_make_me_moderator(event, vc_room, event_vc_room) %}
{% if event.canUserModify(session.user) and session.user.id != vc_room.data['owner'][1] %}
<a class="i-button i-button-small highlight arrow" data-toggle="dropdown"></a>
<ul class="dropdown" data-level="level1">
<li>
<a href="#"
title="{% trans name=vc_room.data.owner_identity %}You will be the moderator of this Vidyo room, replacing {{name}}.{% endtrans %}"
class="action-make-moderator" data-href="{{ url_for('vc.vc_room_modify', event_vc_room) }}">
{% trans %}Make me moderator{% endtrans %}
</a>
</li>
</ul>
{% endif %}
{% endmacro %}
{% macro render_join_button(vc_room, extra_classes="") %}
<a class="i-button highlight {{ extra_classes }}"
href="{{ vc_room.data.url }}">
{% trans %}Join{% endtrans %}
</a>
{% endmacro %}

View File

@ -1,18 +1,9 @@
{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_moderator %}
<div class="event-service-toolbar vc-toolbar toolbar right">
<div class="group">
<a class="i-button i-button-small event-service-right-button highlight join-button" href="{{ vc_room.data.url }}"><strong>{% trans %}Join{% endtrans %}</strong></a>
{% if event.canUserModify(session.user) and session.user.id != vc_room.data['owner'][1] %}
<a class="i-button i-button-small highlight arrow" data-toggle="dropdown"></a>
<ul class="dropdown" data-level="level1">
<li>
<a href="#"
title="{% trans name=vc_room.data.owner_identity %}You will be the moderator of this Vidyo room, replacing {{name}}.{% endtrans %}"
class="action-make-moderator" data-href="{{ url_for('vc.vc_room_modify', event_vc_room) }}">
{% trans %}Make me moderator{% endtrans %}
</a>
</li>
</ul>
{% endif %}
{{ render_join_button(vc_room, "i-button-small event-service-right-button join-button") }}
{{ render_make_me_moderator(event, vc_room, event_vc_room) }}
</div>
{{ template_hook('vidyo-event-buttons', event_vc_room=event_vc_room) }}
</div>

View File

@ -0,0 +1,4 @@
{% from 'vc_vidyo:buttons.html' import render_join_button %}
{{ render_join_button(vc_room, extra_classes="icon-play") }}
{{ template_hook('vidyo-manage-event-buttons', event_vc_room=event_vc_room) }}

View File

@ -1,20 +1,11 @@
{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_moderator %}
{% set vc_room = event_vc_room.vc_room %}
<div class="toolbar right vc-toolbar">
<div class="group">
<span class="i-button i-button-small label vc-room-info" id="vc-room-{{ vc_room.id }}"><img src="{{ vc_room.plugin.icon_url }}" style="width: 18px;"></span>
<a class="i-button i-button-small event-service-right-button highlight join-button" href="{{ vc_room.data.url }}"><strong>{% trans %}Join{% endtrans %}</strong></a>
{% if event.canUserModify(session.user) and session.user.id != vc_room.data['owner'][1] %}
<a class="i-button i-button-small highlight arrow" data-toggle="dropdown"></a>
<ul class="dropdown" data-level="level1">
<li>
<a href="#"
title="{% trans name=vc_room.data.owner_identity %}You will be the moderator of this Vidyo room, replacing {{name}}.{% endtrans %}"
class="action-make-moderator" data-href="{{ url_for('vc.vc_room_modify', event_vc_room) }}">
{% trans %}Make me moderator{% endtrans %}
</a>
</li>
</ul>
{% endif %}
{{ render_join_button(vc_room, "i-button-small event-service-right-button join-button") }}
{{ render_make_me_moderator(event, vc_room, event_vc_room) }}
</div>
{{ template_hook('vidyo-event-timetable-buttons', event_vc_room=event_vc_room) }}
</div>