-
Notifications
You must be signed in to change notification settings - Fork 19
Issue #265 - user panel control #288
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,22 @@ | |||
import random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why additional panel? You could just in original panel file extend another panel class and register it. To reduce duplication. So, use inheritance.
Changed the form to metaclass, changed the |
Based on the width of the window, number of columns for panels change. So we have double nested mapfiled because we are storing layout of panels for each number of columns there is. So once we map panel id to Panel. And then we map number of columns to PanelState, which tells where for this number of columns panel is. |
So you will have to fix this. :-) |
Added the second |
Not true. It can be. If you have very narrow window on your laptop, you might not want to display all panels. You do not want them to be removed, but just collapsed. On your big monitor on your PC, you have more columns and you want all of panels to be shown fully. |
Well, sure, it just wasn't connected currently the way the JavaScript part is set up (requests to |
OK. You decide. So I am explaining why model was proposed in the way it was. It is true that current code does not behave like that. But the end it should. So you can fix it yourself, or add TODO/ticket for this. |
Added the number to the requests for |
""" | ||
Form for selecting homepage panels. | ||
""" | ||
__metaclass__ = PanelFormMetaclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line after docstring.
I've replaced the Test cases also seem to pass now. |
""" | ||
This class holds panel instances for a user, their properties and layouts. | ||
|
||
:param dict layout: mapping of count of displayed columns (`string`) to `PanelState` objects for that count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I noticed. This is not really a param. You use this when commenting functions and which parameters they take. In this case this is a class. and even class constructor does not take this parameter.
You might simply move this line above layout
definition bellow and just leave it as a in-code-only comment.
Yes. This is good. So probably only frontend should decide how to order new panels. Not backend
I agree. But we had |
Feature-wise, things are good now. So just check all your code for possible tabs and fix indentations and this is ready to go in. There is one minor detail you can do, if you want, or open a ticket. You have to enable for elements before submit. But this is ugly as it changes user feedback and maybe confuses her. So some other solution should be used. What Internet recommends? Maybe a hidden input could be inserted which is kept in sync with checkbox? Maybe each checkbox could have its own hidden input all the time, kept in sync. JavaScript could rename all checkboxes and add hidden input box instead with that form name. |
I've added a second set of hidden inputs, so we don't have to un-disable the checkboxes. They're |
data_box = panel.get_name() | ||
display_box = data_box + "_display" | ||
|
||
attrs[data_box] = forms.IntegerField(required=False, initial=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not BooleanField
, too?
Fixed. |
attrs[display_box] = forms.BooleanField(label=data_box, required=False) | ||
|
||
# Connect display checkbox to data field | ||
attrs[display_box].widget = forms.CheckboxInput(attrs={'data-panel':data_box, 'data-display':'True'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces after :
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you settings widget
from outside and not through the constructor? Set it through the constructor, it is much cleaner (and it might be better handled, you never know if there is some special handling when passed through constructor which you are bypassing now).
You had some problems with link property? Or you just didn't upgrade from requirements.txt? |
I moved account Django app to separate Python package. You will have to update this pull request. |
OK, now everything should work with external authentication package. |
#265: Added basic support for users to select which panels they should show. Dependencies checked on form validation.
TODO: Required/recommended extension for inter-panel dependencies.