Implement boilerplate search widget/page view
parent
0488a3e0b2
commit
b3df0bf249
@ -0,0 +1,68 @@
|
|||||||
|
<form class="skipEmptyFields" method="POST" hx-post="#"
|
||||||
|
hx-trigger="change"
|
||||||
|
hx-target="#widgets-here"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-indicator="#spinner">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<div class="field has-addons">
|
||||||
|
<div id="query" class="control is-expanded has-icons-left">
|
||||||
|
<input
|
||||||
|
hx-post="#"
|
||||||
|
hx-trigger="keyup changed delay:200ms"
|
||||||
|
hx-target="#widgets-here"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
name="query"
|
||||||
|
value=""
|
||||||
|
class="input"
|
||||||
|
type="text"
|
||||||
|
placeholder="Search something">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fas fa-magnifying-glass"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<div class="field">
|
||||||
|
<button
|
||||||
|
id="search"
|
||||||
|
class="button is-fullwidth"
|
||||||
|
hx-post="#"
|
||||||
|
hx-trigger="click"
|
||||||
|
hx-target="#widgets-here"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
Search
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="column is-3">
|
||||||
|
<div class="nowrap-parent">
|
||||||
|
<div
|
||||||
|
data-script="on click toggle .is-hidden on #options"
|
||||||
|
class="button is-right nowrap-child">
|
||||||
|
Options
|
||||||
|
</div>
|
||||||
|
<div class="nowrap-child">
|
||||||
|
<span id="spinner" class="button is-light has-text-link is-loading htmx-indicator">Static</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<input
|
||||||
|
hx-trigger="change"
|
||||||
|
hx-post="#"
|
||||||
|
hx-target="#widgets-here"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
id="tags"
|
||||||
|
class="input"
|
||||||
|
type="tags"
|
||||||
|
name="tags"
|
||||||
|
placeholder="Tag search: nick: john"
|
||||||
|
value="##">
|
||||||
|
</div>
|
||||||
|
<div class="is-hidden"></div>
|
||||||
|
|
||||||
|
</form>
|
@ -0,0 +1,29 @@
|
|||||||
|
import uuid
|
||||||
|
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.shortcuts import render
|
||||||
|
from django.views import View
|
||||||
|
from mixins.views import (
|
||||||
|
ObjectCreate,
|
||||||
|
ObjectDelete,
|
||||||
|
ObjectList,
|
||||||
|
ObjectRead,
|
||||||
|
ObjectUpdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
from core.models import Drug
|
||||||
|
|
||||||
|
# class Search(View):
|
||||||
|
# template_name = "widgets/widget.html"
|
||||||
|
|
||||||
|
# def get(self, request):
|
||||||
|
# unique = str(uuid.uuid4())[:8]
|
||||||
|
# return render(request, self.template_name, {"unique": unique})
|
||||||
|
|
||||||
|
|
||||||
|
class Search(LoginRequiredMixin, ObjectRead):
|
||||||
|
model = Drug
|
||||||
|
detail_template = "window-content/drug_search.html"
|
||||||
|
|
||||||
|
def get_object(self, type):
|
||||||
|
return {}
|
Loading…
Reference in New Issue