You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-12Lines changed: 16 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -177,10 +177,16 @@ module_logger.debug(f"Creating user with username: {username} and email: {email}
177
177
```
178
178
In this example, module_logger logs a debug message when a new user is being created. This helps you track user creation activities.
179
179
180
-
# JavaScript Modules for Enhanced Interactivity
181
-
This project includes JavaScript modules to add interactive features to your Django templates.
180
+
# Modules for Enhanced Frontend Interactivity
182
181
183
-
Check the console for warnings and errors that should guide you through the process in case you are stuck.
182
+
This project provides a collection of JavaScript modules designed to supercharge your Django templates with interactive features,
183
+
**without the need for any custom JavaScript code**.
184
+
Simply load the corresponding template tags, add some data attributes to your HTML elements, and let the magic happen!
185
+
186
+
- Seamless Django Integration: The modules are built to work effortlessly with Django's templating system.
187
+
- Zero JavaScript Overhead: You don't need to write or manage any custom JavaScript code.
188
+
- Enhanced User Experience: Add rich interactivity to your web pages with minimal effort.
189
+
- Customizable: Tailor the modules to your specific design and functionality needs using intuitive data attributes.
184
190
185
191
## ToggledButtonGroup
186
192
Visit [BaseApp/button_examples.html](BaseApp/templates/BaseApp//ui_elements/sections/buttons_examples.html) for an example.
@@ -220,11 +226,11 @@ The `ToggledButtonGroup` class allows you to create interactive button groups wh
220
226
`data-active-class`: Specifies the CSS class(es) to apply to the active button. You can include multiple classes separated by spaces (e.g., bg-blue-500 text-white).
221
227
222
228
`data-initial-active`: Determines which button should be active when the page loads. It can be:
223
-
"none": No button is active initially. (DEFAULT)
224
-
"first": Activates the first button.
225
-
"last": Activates the last button.
226
-
"random": A random button is activated.
227
-
"0", "1", "2", etc.: Activates the button at the specified index.
229
+
-"none": No button is active initially. (DEFAULT)
230
+
-"first": Activates the first button.
231
+
-"last": Activates the last button.
232
+
-"random": A random button is activated.
233
+
-"0", "1", "2", etc.: Activates the button at the specified index.
228
234
229
235
3.**Initialize with the Django Template Tag**:
230
236
@@ -238,15 +244,13 @@ The `ToggledButtonGroup` class allows you to create interactive button groups wh
238
244
- You can initialize all button groups on the page with `{% init_button_groups %}` or you can initialize a specific button groups with `{% init_button_groups "name1" "name2" "name3" %}`.
239
245
240
246
### HTMX Integration (GET)
241
-
The `ToggledButtonGroup` class seamlessly integrates with HTMX, a powerful library for building modern, interactive user interfaces with less JavaScript. You can easily use HTMX to update portions of your page in response to button clicks within your toggled button group.
242
-
243
-
-**HTMX Library:** Ensure that you have included the HTMX library in your HTML.
247
+
The `ToggledButtonGroup` class seamlessly integrates with HTMX. If your buttons have the `hx-get` attribute, the `ToggledButtonGroup` class will automatically update the page based on the `data-initial-active` attribute.
244
248
245
249
-**HTMX Attributes:** Add HTMX attributes to the buttons within your button group container. The most common attributes you'll use are:
246
250
-`hx-get`: Specifies the URL to fetch when the button is clicked.
247
251
-`hx-target`: Specifies the element on the page to update with the content returned by the HTMX request.
248
252
-`hx-swap`: Specifies how the returned content should be swapped into the target element (e.g., "innerHTML", "outerHTML", "beforeend").
0 commit comments