Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial attempt for Tabler Template Mode #2444

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hasansezertasan
Copy link
Member

@hasansezertasan hasansezertasan commented Jul 10, 2024

Fixes #2443


Testing

I didn't include assets directly. You need NPM to install assets. To install the assets, run: npm run build.

Notes

X-Editable

X-Editable is not maintained anymore and it doesn't support BS5 and Tabler.

I have found a fork that works with BS5 and Tabler: https://github.com/skycyclone/x-editable

But I don't feel right about it and it's not packaged on NPM. Here are related resources:

wenzhixin/bootstrap-table#5345
vitalets/x-editable#1179

My ultimate solution for a proper X-Editable alternative would be using HTMX to accomplish inline-editable features. Check out #1615.

@hasansezertasan hasansezertasan marked this pull request as draft July 10, 2024 16:50
@hasansezertasan
Copy link
Member Author

hasansezertasan commented Jul 13, 2024

class Select2TagsWidget(widgets.TextInput):
"""`Select2 <http://ivaynberg.github.com/select2/#tags>`_ styled text widget.
You must include select2.js, form-x.x.x.js and select2 stylesheet for it to work.
"""
def __call__(self, field, **kwargs):
kwargs.setdefault('data-role', u'select2-tags')
kwargs.setdefault('data-allow-duplicate-tags', "true" if getattr(field, 'allow_duplicates', False) else "false")
return super(Select2TagsWidget, self).__call__(field, **kwargs)

This and other template-related codes in the Python code base might cause issues, what can we do about it?

@samuelhwilliams
Copy link
Contributor

Yeah, interesting - feels like we'll need to give a bit of thought about how we support more modern/alternative themes like BS5 and Tabler 🤔

@hasansezertasan
Copy link
Member Author

Yeah, interesting - feels like we'll need to give a bit of thought about how we support more modern/alternative themes like BS5 and Tabler 🤔

For sure! Some of the tools (advanced date picker, x-editable, Swatches, etc.) are based around bootstrap and they probably won't work with BS5, Tabler and Tailwind. I know X-Editable (#1615) doesn't work with bs5.

@hasansezertasan
Copy link
Member Author

We probably will also need to talk about the layout. The layout is not similar to any of the previous implementations. It is based on SQLAdmins interface - without losing any of the previous features.

@samuelhwilliams
Copy link
Contributor

Happy to review any proposed designs/layouts - screenshots/etc would be super helpful to easily visualise what you're thinking :)

@hasansezertasan
Copy link
Member Author

Happy to review any proposed designs/layouts - screenshots/etc would be super helpful to easily visualise what you're thinking :)

The layout I implemented in this PR looks like this: https://sqladmin-demo.aminalaee.dev/admin/

I hope I'll make it work tomorrow and you will be able to test it with Flask Admin.

@princerb
Copy link
Contributor

@samuelhwilliams @hasansezertasan
Do you think we need to set a default type of the theme to the dark mode? Like, if it is a Bootstrap theme, use dark mode by default, or use dark swatch theme tools?

@samuelhwilliams
Copy link
Contributor

I don't think we need to ... but we could, I guess.

@hasansezertasan
Copy link
Member Author

@samuelhwilliams @hasansezertasan
Do you think we need to set a default type of the theme to the dark mode? Like, if it is a Bootstrap theme, use dark mode by default, or use dark swatch theme tools?

I'm with @samuelhwilliams on this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Template Mode w/ Tabler
3 participants