cehdeti / pyeti

A Python package of awesome stuff.
MIT License
0 stars 0 forks source link

First pass at `placeholder` functionality #1

Closed theunraveler closed 6 years ago

theunraveler commented 6 years ago

Hey @suchermon @cmlizama @ashleyelaine @DoomPatrol : what do you all think? Trying to replace the django-page-cms with something a little simpler that just does snippet replacement, more or less.

Note that you can define a widget to use in the admin for placeholder content, so that you can use CKEditor or whatever (see PlaceholderForm and the PYETI_PAGES_CONTENT_WIDGET setting). Every placeholder uses the same widget, which may not work well for short content like link text, etc. But then I wonder if we need to allow people to edit that to that level of granularity to begin with...

DoomPatrol commented 6 years ago

I think this looks really cool and easy to use and wayyy more clean that django-page-cms. Is there any chance you could post a screenshot of the form in the admin just for my own curiosity?

Also, when calling the key for the placeholder it requires the name of the placeholder + language code? Does this mean spaces, capitals, etc. have to match exactly for things to load correctly?

theunraveler commented 6 years ago

untitled

Also, when calling the key for the placeholder it requires the name of the placeholder + language code? Does this mean spaces, capitals, etc. have to match exactly for things to load correctly?

Yes, it needs to match exactly, but the Name and Language fields are select elements, so entering the correct data shouldn't be hard. get_placeholders() runs through all of the template files and collects all the {% placeholder %} tags in the app for the options in that select.

theunraveler commented 6 years ago

Oh, one other thing I though about is the naming of this package: pages. I think this could cause problems if this app is installed alongside django-page-cms. But seeing as how this is meant to replace that, I don't foresee that happening. Can anyone think of a case where it might? Is that possibility worth changing the name to something more distinct?

suchermon commented 6 years ago

That's really nice that you organized all of the placeholders into one place so there are no more confusions of that the user has to create a page then select a template in order to find the right placeholders. Awesome sauce!

theunraveler commented 6 years ago

That's really nice that you organized all of the placeholders into one place so there are no more confusions of that the user has to create a page then select a template in order to find the right placeholders.

Thanks. I thought an added benefit of not grouping placeholders by page could be the ability to use a single placeholder on multiple pages, if you have some text that appears more than once or whatever.

suchermon commented 6 years ago

Re: Package naming - probably just prefix with eti and call it a day? That way we know it's our thang

theunraveler commented 6 years ago

Re: Package naming - probably just prefix with eti and call it a day? That way we know it's our thang

Well, the app itself is called pyeti.eti_django.pages, so it's kind of namespaced already. The only thing that isn't is the database tables, which will be pages_{model name} or whatever. I think I'm OK with that.

Any other comments or suggestions? If not, I think I'm going to merge this.