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 idea for a table stream field block using handsontable.js. #1705
Conversation
Hi @Proper-Job, thanks for this! It works very well in testing. As opposed to implementing this in core, we'd propose refactoring this as a pip installable module. See this markdown module as a good example. Could you implement in a similar way? Cheers, |
Hi @chrxr - I think the suggestion was for this to become a 'contrib' module within the Wagtail codebase (e.g. |
Hi @Proper-Job, we've discussed this in the team, and we'd like to go down the contrib route as suggested by @gasman above. Could you please update this PR. Thanks! |
Just came back from my holiday :) |
8a76566
to
b282dee
Compare
I'm having a bit of a problem to integrate the git wagtail installation with PyCharm. Hence this ridiculous commit about ununsed imports. |
462de94
to
8dc3602
Compare
I squashed all of my commits. Is that alright to have all the logic in init.py, or do you want it in modules? |
|
Hi @Proper-Job - this is looking good! Just a few small (I hope) issues:
Once these are sorted, and we have tests and docs, I think we'll be ready to merge this. Thanks! |
Great addition! One thing I noticed with this field is that it doesn't support tables with a vertical column too. This could be done really simply by adding a 'First column header' checkbox and tweaking the template so it outputs for the first item in each row. Let me know if you'd like me to make a pull request for this. |
Sorry guys, for some reason I wasn't notified of your comments, for some reason that keeps happening to me. Let me review your comments and get back to you. |
@gasman It is possible to change HTML renderer to a simple text renderer for the table. All you would need for that is to pass the renderer at construction time like so: table = TableBlock(table_options={'renderer':'text}) I could default it to text if you like. Should I do that? What kind of tests do you want to see for this? |
@seddonym Yes please do that. |
Hmm, I've tried to create a pull request, but I don't think Github supports multiple forking - I already have a fork of Wagtail in my account, so I can't fork from yours. I've manually forked it, but I'm not able to create a pull request back into your repo. Probably easiest is if you merge my commits yourself from here: If you can think of another way to do it, let me know! |
@seddonym Thank you for that! |
@Proper-Job and I have worked through the issues outlined by @gasman including unit tests. What's remaining is documentation. Can anyone tell me what's needed on the documentation front? Edit: I can see there's a /wagtail/docs/reference/contrib/ folder. I imagine we would need to create a table_block.rst there. We've talked about documenting the table_options with links to relevant handsontable pages. Are there any other files we need to create or anything specific we need to document beyond the basics? |
AppRegistryNotReady error in Django 1.9.
Fixed the AppRegistryNotReady error in Django 1.9.
This is what we have for documentation at the moment. It's written in a hybrid rst format to make it easier to read on the web. We thought it would be a good idea to take comments before rolling it into the code base. If this is acceptable, we'll create a new table_block.rst in /wagtail/docs/reference/contrib/ and link it in docs/reference/contrib/index.rst. Please let us know if we're missing anything or if we should provide additional documentation files. This is just a rough draft. We'll go over it a few times before we commit. |
Thanks, @bbusenius and @Proper-Job! I've made some minor tweaks in the Google doc but it's looking good so far. Perhaps you could add a screenshot demonstrating how table_block looks in the editor? |
Thanks @tomdyson. A screenshot showing table_block in the editor is a great idea! We'll add one. |
One thing that's missing that would be nice, is a sensible default icon. I don't see anything usable in the wagtail style guide but font awesome has this. What do you guys think? |
Added documentation for table_block.
# Conflicts: # docs/reference/contrib/index.rst # wagtail/tests/settings.py
@gasman @tomdyson: All the issues outlined above have been addressed by @bbusenius and the PR was updated. |
Thanks! Will review shortly. The suggested icon looks good to me... (It seems we don't have any documentation for adding new icons to our font, but I believe it's done through https://icomoon.io/.) |
@gasman Just to double check. Would you like a new icon to be part of this PR? Or is that something you would like to address internally as there are no icon contributing guidelines? |
I've been doing some preliminary research on the icons and my first impression is that this might best be handled by an internal wagtail design person. Using icomoon looks straightforward but how to integrate a new icon into a preexisting icon set is escaping me. From what I can tell, it looks like a set of icons would be generated locally and then uploaded to the project. I imagine the wagtail design team has a streamlined process for this. Please correct me if I am wrong. |
OK, no worries - we'll handle it internally. (We've got another icon coming imminently in #2417, so we'd probably end up having to resolve the merge conflict anyhow :-) ) |
Merged in 9338fc2 + parents (without the icon - will handle that separately). Thanks all! |
I needed to use this on Wagail 1.4, so I made a simple subtree split of the directory in master, restructured it, and released it as a pip installable package: https://github.com/alexgleason/wagtail_table_block It says clearly in the readme to NOT use it if you can help it. But the database representation should be the same regardless of where it's coming from, so upgrading to Wagtail 1.5 should allow you to just delete the plugin and import from wagtail.contrib. Just in case anyone else needs this. |
Question: this uses Do we need that Edit: In my own work, I'm using But it might be better design to import it into |
@alexgleason Looks like this was moved out of |
There's an an issue with some of the logic being in |
We chose to name the module fields.py because in the future the might be a TableField in addition to the TableBlock. In the absence of TableField it might be prudent to name the module blocks.py. I don't really mind either way. |
Hi,
This is an initial implementation of a StreamField table block using handsontable.js.
Let me know if there is anything else missing or gone totally astray.
Missing is documentation as to the available table configuration options.
If you like this initial approach I'll document it more clearly and completely.
No tests have been written yet.