[UPDT] HORILLA WIDGETS: Trans tag updates
This commit is contained in:
@@ -144,6 +144,7 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<!-- custom scroll/ horizontal scroll section -->
|
||||
<div class="d-flex justify-content-between custom-scroll">
|
||||
<div class="avatars" id="avatarsContainer"></div>
|
||||
</div>
|
||||
@@ -167,7 +168,7 @@
|
||||
width: 50px;
|
||||
"
|
||||
>
|
||||
<ion-icon name="filter-circle"></ion-icon> Filter
|
||||
<ion-icon name="filter-circle"></ion-icon> {% trans "Filter" %}
|
||||
</span>
|
||||
</span>
|
||||
<div
|
||||
@@ -205,7 +206,7 @@
|
||||
class="oh-btn oh-btn--secondary oh-btn--shadow pr-3 pl-3"
|
||||
onclick="event.stopPropagation();event.preventDefault;$('#filterChoose').toggleClass('oh-modal--show');"
|
||||
>
|
||||
Add
|
||||
{% trans "Add" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<style>
|
||||
.oh-checkpoint-badge--success {
|
||||
color: yellowgreen;
|
||||
@@ -19,17 +20,17 @@
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#viewSelectedModal"
|
||||
>
|
||||
Selected <span class="selected-count">0</span>/<span class="total-count">{{queryset|length}}</span>
|
||||
{% trans "Selected" %} <span class="selected-count">0</span>/<span class="total-count">{{queryset|length}}</span>
|
||||
</div>
|
||||
<div class="oh-checkpoint-badge oh-checkpoint-badge--secondary" id="selectAllUsers">
|
||||
Select All <span class="total-count visible-count">{{queryset|length}}</span> user
|
||||
{% trans "Select All" %} <span class="total-count visible-count">{{queryset|length}}</span> {% trans "user" %}
|
||||
</div>
|
||||
<div class="oh-checkpoint-badge" id="unselectAllUsers">
|
||||
Unselect All
|
||||
{% trans "Unselect All" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oh-checkpoint-badge oh-checkpoint-badge--success m-zero" id="selectAllInstances">
|
||||
Select All {{queryset|length}} Item
|
||||
{% trans "Select All" %} {{queryset|length}} {% trans "Item" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<section
|
||||
class="oh-main__topbar p-3 mb-1 m-0"
|
||||
style="padding-left: 0 !important; padding-right: 0 !important"
|
||||
@@ -24,22 +25,27 @@
|
||||
</div>
|
||||
<div class="oh-main__titlebar-button-container">
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button class="oh-btn ml-2" @click="open = !open">
|
||||
<button
|
||||
hx-get="{% url 'get-filter-form' %}?template_path={{filter_template_path}}"
|
||||
hx-target="#wodgetFilterContainer"
|
||||
class="oh-btn ml-2" @click="open = !open">
|
||||
<ion-icon
|
||||
name="filter"
|
||||
class="mr-1 md hydrated"
|
||||
role="img"
|
||||
aria-label="filter"
|
||||
></ion-icon
|
||||
>Filter
|
||||
>{% trans "Filter" %}
|
||||
<div id="filterCount"></div>
|
||||
</button>
|
||||
<div
|
||||
class="oh-dropdown__menu oh-dropdown__menu--left oh-dropdown__filter p-4"
|
||||
x-show="open"
|
||||
@click.outside="open = false"
|
||||
>
|
||||
{% include filter_template_path %}
|
||||
>
|
||||
<div id="wodgetFilterContainer">
|
||||
{% comment %} {% include filter_template_path %} {% endcomment %}
|
||||
</div>
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button
|
||||
type="submit"
|
||||
@@ -47,7 +53,7 @@
|
||||
data-action="{% url filter_route_name %}"
|
||||
id="widgetFilterButton{{self.attrs.id}}"
|
||||
>
|
||||
Filter
|
||||
{% trans "Filter" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<section
|
||||
class="oh-main__topbar p-3 mb-1 m-0"
|
||||
style="padding-left: 0 !important; padding-right: 0 !important"
|
||||
@@ -21,12 +22,12 @@
|
||||
<div
|
||||
class="oh-checkpoint-badge oh-checkpoint-badge--secondary"
|
||||
>
|
||||
Selected <span class="selected-count">0</span>/<span class="total-count">138</span>
|
||||
{% trans "Selected" %} <span class="selected-count">0</span>/<span class="total-count">138</span>
|
||||
</div>
|
||||
<div class="oh-checkpoint-badge oh-checkpoint-badge--secondary" id="selectSelected">
|
||||
Select All
|
||||
{% trans "Select All" %}
|
||||
</div>
|
||||
<div class="oh-checkpoint-badge" id="unselectSelected">Unselect All</div>
|
||||
<div class="oh-checkpoint-badge" id="unselectSelected">{% trans "Unselect All" %}</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="oh-checkpoint-badge oh-checkpoint-badge--success m-zero">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<div class="oh-sticky-table" style="height: 50vh">
|
||||
<div
|
||||
class="oh-sticky-table__table oh-table--sortable"
|
||||
@@ -15,7 +16,7 @@
|
||||
id="choose-all-user"
|
||||
/>
|
||||
</div>
|
||||
Employee
|
||||
{% trans "Employee" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,7 +27,7 @@
|
||||
class="oh-sticky-table__tr oh-sticky-table__tr--custom"
|
||||
data-instance-id="{{instance.id}}"
|
||||
data-label="{{instance}}"
|
||||
data-avatar="{% if instance.get_image %}{{instance.get_image}}{% else %}https://ui-avatars.com/api/?name={{instance}}&background=random{% endif %}"
|
||||
data-avatar="{{instance.get_avatar}}"
|
||||
draggable="true"
|
||||
>
|
||||
<div
|
||||
@@ -44,7 +45,7 @@
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img
|
||||
src="{% if instance.get_image %}{{instance.get_image}}{% else %}https://ui-avatars.com/api/?name={{instance}}&background=random{% endif %}"
|
||||
src="{{instance.get_avatar}}"
|
||||
class="oh-profile__image"
|
||||
/>
|
||||
</div>
|
||||
|
||||
8
horilla_widgets/urls.py
Normal file
8
horilla_widgets/urls.py
Normal file
@@ -0,0 +1,8 @@
|
||||
"""
|
||||
horilla_widget/urls.py
|
||||
"""
|
||||
from django.urls import path
|
||||
from horilla_widgets import views
|
||||
|
||||
|
||||
urlpatterns = [path("get-filter-form", views.get_filter_form, name="get-filter-form"),]
|
||||
@@ -1,5 +1,7 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
from horilla.decorators import login_required
|
||||
from horilla_widgets.widgets.select_widgets import ALL_INSTANCES, HorillaMultiSelectWidget
|
||||
# Create your views here.
|
||||
|
||||
# urls.py
|
||||
@@ -12,4 +14,14 @@ from django.shortcuts import render
|
||||
# This method is used to return all the ids of the employees
|
||||
# """
|
||||
# ids = EmployeeFilter(request.GET).qs.values_list("id", flat=True)
|
||||
# return JsonResponse({'ids':list(ids)})
|
||||
# return JsonResponse({'ids':list(ids)})
|
||||
|
||||
|
||||
@login_required
|
||||
def get_filter_form(request):
|
||||
"""
|
||||
This method will return filtering from
|
||||
"""
|
||||
widget_instance = ALL_INSTANCES[str(request.user.id)]
|
||||
template_path = request.GET["template_path"]
|
||||
return render(request,template_path,{"f":widget_instance.filter_class()})
|
||||
|
||||
@@ -3,8 +3,11 @@ select_widgets.py
|
||||
|
||||
This module is used to write horilla form select widgets
|
||||
"""
|
||||
import datetime
|
||||
from django import forms
|
||||
|
||||
from base import thread_local_middleware
|
||||
ALL_INSTANCES = {}
|
||||
|
||||
class HorillaMultiSelectWidget(forms.Widget):
|
||||
"""
|
||||
@@ -45,6 +48,12 @@ class HorillaMultiSelectWidget(forms.Widget):
|
||||
context["filter_template_path"] = self.filter_template_path
|
||||
context["filter_route_name"] = self.filter_route_name
|
||||
context["required"] = self.required
|
||||
self.attrs["id"] = ("id_" + name ) if self.attrs.get('id') is None else self.attrs.get("id")
|
||||
self.attrs["id"] = (
|
||||
("id_" + name) if self.attrs.get("id") is None else self.attrs.get("id")
|
||||
)
|
||||
context[self.filter_instance_contex_name] = self.filter_class
|
||||
request = getattr(thread_local_middleware._thread_locals, "request", None)
|
||||
ALL_INSTANCES[str(request.user.id)] = self
|
||||
|
||||
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user