Skip to content

Commit

Permalink
Visual feedback when swapping elements in the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepman4267 committed Feb 7, 2024
1 parent ae2ad1c commit 10d29f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions OpenShow/slides/editor/static/editor/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,14 @@ ul > a {
height: 3rem;
background-color: #3A7734;
transition: height, background-color 500ms;
}

.htmx-swapping:not(#dummy) {
background-color: #539c68;
opacity: 0;
transition: background-color 0.1s, opacity 0.1s;
}

:not(.htmx-swapping) {
transition: background-color 0.1s, opacity 0.1s;
}
2 changes: 1 addition & 1 deletion OpenShow/slides/editor/templates/editor/edit_slide.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{ form.order }}
</fieldset>
{# <input type="submit">#}
<button hx-select="#editor" hx-target="#editor" hx-swap="outerHTML" hx-post="{% url 'edit-slide' slide.pk %}">Submit</button>
<button hx-select="#editor" hx-target="#editor" hx-swap="outerHTML swap:0.1s" hx-post="{% url 'edit-slide' slide.pk %}">Submit</button>
</form>
<ul class="segment-list">
{% for element in slide.get_elements %}
Expand Down
6 changes: 3 additions & 3 deletions OpenShow/slides/editor/templates/editor/show_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ <h1>{{ show.name }}</h1>
{% for segment in show.segments.all %}
<li class="show-segment">
<span class="segment-title">{{ segment.name }}</span>
<button hx-get="{% url 'edit-segment' segment.pk %}" hx-select="#editor" hx-target="#editor" hx-swap="outerHTML">{% icon 'edit-3' %}</button>
<button hx-get="{% url 'edit-segment' segment.pk %}" hx-select="#editor" hx-target="#editor" hx-swap="outerHTML swap:0.1s">{% icon 'edit-3' %}</button>
{% if segment.included_deck %}
<h4>Deck: {{ segment.included_deck.name }}</h4>
{% endif %}
<ul>
{% for slide in segment.slides.all %}
<li class="slide-thumbnail"
hx-get="{% url 'edit-slide' pk=slide.pk %}"
hx-swap="outerHTML"
hx-swap="outerHTML swap:0.1s"
hx-select="#editor"
hx-target="#editor">
{% include "slides/slide.html" with slide=slide %}
Expand All @@ -51,7 +51,7 @@ <h4>Deck: {{ segment.included_deck.name }}</h4>
{% csrf_token %}
<input type="hidden" name="segment" value="{{ segment.pk }}">
{# <input type="submit" value="+">#}
<button hx-post="{% url 'new-slide' %}" hx-select="#slides-sidebar > *" hx-target="#slides-sidebar" hx-swap="innerHTML">+</button>
<button hx-post="{% url 'new-slide' %}" hx-select="#slides-sidebar > *" hx-target="#slides-sidebar" hx-swap="innerHTML swap:0.1s">+</button>
</form>
</li>
</ul>
Expand Down

0 comments on commit 10d29f9

Please sign in to comment.