Skip to content

Commit

Permalink
Move create poll button next to chat input
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksellen committed Mar 27, 2024
1 parent c3135ac commit 1614ba9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 32 deletions.
19 changes: 19 additions & 0 deletions templates/messaging/chatbox_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,28 @@
</svg>
</button>
</div>

{% if river.current_stage == stage and request.user.id in starters and poll_possible and members|length > 2 %}
{% if poll_ref == None and not poll_ref.passed %}
<button id="poll-create-button-{{ stage }}-{{ topic }}"
hx-get="{% url 'create_river_poll' river.slug stage topic %}"
hx-target="#poll-creation-{{ stage }}-{{ topic }}"
class="button button-on-white p-1 drop-shadow-lg w-[44px] h-[44px] flex items-center justify-center ml-2"
type="button">
{# Poll creation button #}
<svg width="18" height="18" viewBox="0 0 18 18" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0ZM16 16H2V2H16V16ZM4 7H6V14H4V7ZM8 4H10V14H8V4ZM12 10H14V14H12V10Z"
fill="#9759FF"/>
</svg>
</button>
{% endif %}
{% endif %}
</div>

</form>
{# where the modal goes - needs to be outside most of the divs to render properly #}
<div id="poll-creation-{{ stage }}-{{ topic }}"></div>
{% endif %}

{% block scripts %}
Expand Down
38 changes: 6 additions & 32 deletions templates/river/river_chat.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,12 @@
{% include "partials/call-to-action.html" with main="To participate in the project you need to be logged in." button="Log in" url=the_url bg="bg-sky" %}
{% endif %}

<div class="">

<div id="{{ stage }}-{{ topic }}-poll-wrapper">
{% if poll_ref != None %}
{% include "partials/vertical-spacer.html" with space="6" %}
<div hx-trigger="load" hx-target="#{{ stage }}-{{ topic }}-poll-wrapper" hx-swap="innerHTML"
hx-get="{% url 'poll_view' poll_ref.uuid %}">
</div>
{% endif %}
</div>

{% if river.current_stage == stage and request.user.id in starters and poll_possible and members|length > 2 %}
{% if poll_ref == None and not poll_ref.passed %}
{% include "partials/vertical-spacer.html" with space="6" %}
<div id="poll-creation-wrapper"
class="sm:flex sm:flex-col sm:w-[360px] sm:fixed sm:z-40 sm:bottom-0"
:class="selected == 1 ? 'block' : 'hidden'">
<button id="poll-create-button-{{ stage }}-{{ topic }}"
hx-get="{% url 'create_river_poll' river.slug stage topic %}"
hx-target="#poll-creation-{{ stage }}-{{ topic }}"
class="button button-on-white p-1 fixed sm:absolute bottom-[18px] right-[18px] drop-shadow-lg w-[44px] h-[44px] flex items-center justify-center"
type="button">
{# Poll creation button #}
<svg width="18" height="18" viewBox="0 0 18 18" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0ZM16 16H2V2H16V16ZM4 7H6V14H4V7ZM8 4H10V14H8V4ZM12 10H14V14H12V10Z"
fill="#9759FF"/>
</svg>
</button>
<div id="poll-creation-{{ stage }}-{{ topic }}"></div>
</div>
{% endif %}
<div id="{{ stage }}-{{ topic }}-poll-wrapper">
{% if poll_ref != None %}
{% include "partials/vertical-spacer.html" with space="6" %}
<div hx-trigger="load" hx-target="#{{ stage }}-{{ topic }}-poll-wrapper" hx-swap="innerHTML"
hx-get="{% url 'poll_view' poll_ref.uuid %}">
</div>
{% endif %}
</div>
</div>
Expand Down

0 comments on commit 1614ba9

Please sign in to comment.