- Summary:
-
implement adding widgets modal[WIP] Implement adding widgets modal (front end)
- Description:
-
~ implement adding widgets modal
~ Users can add widgets to their admin dashboard by clicking on "Add Widgets," which will open a modal displaying a list of widgets that they can choose from.
~ ~ This is still in its early stages, but I am reconsidering the design. I don't think checkboxes are the way to go because I doubt most people would be able to determine what widgets they want just based off the names. I think being able to select images would be better.
~ work on front end for adding widgets
~ However, my dashboard stats are fairly boring, so I don't have good images to use. Can I get some screenshots of admin widgets on an active user's dashboard?
- - - - adstart front end for adding widgets
- - - - apply code review changes and fix bugs
- - - - implement back end for drag and drop
- - - - implement front end drag and drop
- - - - fix overflowing email addresses on user info popup
- - - - code review
- - - - change post request
- - - - tiny change
- - - - apply code review changes and fix bugs
- - - - implement back end for drag and drop
- - - - change width to max-width
- - - - resolve conflict
Interface for adding/removing widgets
Review Request #5622 — Created March 14, 2014 and submitted
Users can add widgets to their admin dashboard by clicking on "Add Widgets," which will open a modal displaying a list of widgets that they can choose from.
They can remove widgets by clicking the X icon on the upper righthand corner of the widget in question.
Removed widgets and added them back to make sure that newly added widgets appeared below the old widgets.
Description | From | Last Updated |
---|---|---|
This could be a bit more efficient. You can either do a single for p in primary_widgets and then append … |
david | |
Same here about iterating over the list twice. |
david | |
If several widgets don't have given positions, won't this result in several of the values in positions being set to … |
david | |
Add a space between the # and the comment. |
david | |
Can you combine these two into one rule? #all-primary-widgets, #all-secondary-widgets { display: none; } |
david | |
How did you come up with this number? |
david | |
How did you come up with this number? |
david | |
I'm not pleased about all the magic numbers in here. Some of them (like the .btn) could probably use right-alignment … |
david | |
Can you combine these into one rule? |
david | |
Can you just use .rb-icon-delete for your elements? I don't like having duplicate names for icons. |
david | |
Could just use a // single-line comment. |
david | |
This should use === |
david | |
Instead of spelling out "index" and "element", it's just as clear and quicker to read to use "i" and "el" |
david | |
These two lines should be combined (} else {) |
david | |
It might be worth assigning the selector (or selector string) to a variable to reduce the length of this line. |
david | |
Can you combine these into a single var statement? var selectionData = ..., widgetCheckbox = ...; |
david | |
If you combine the first two lines into one, you'd save some indentation (and even if you don't, there's some … |
david | |
This line needs a semicolon. |
david | |
Please wrap this string in gettext(...) |
david | |
This will run the selector three times. You should chain this as such: $('#' + widgetID) .removeClass('widget-masonry-item') .parent() .masonry('reload') .end() … |
david | |
Add a space between the // and the comment. |
david | |
Add a space between the // and the comment. |
david | |
This should use === |
david | |
You call $(element) twice. It would be nice to assign that to a variable so you only have to run … |
david | |
It looks like you're calling append() and passing in a selector? I'm not sure what this does. |
david | |
This should use === |
david | |
No spaces inside of the parens. |
david | |
No spaces inside of the parens. |
david | |
"Save Widgets" should be localized. Probably you'll need to do that beforehand, like this: function createWidgetAdderModals() { var buttonText = … |
david | |
It looks like this code will result in four HTTP requests (and possibly two confirm() dialogs)? Can we maybe rewire … |
david | |
Careful about trailing whitespace. |
david | |
Can you wrap this comment to be as close to 80 columns on the first line as you can? |
david | |
Space between the // and the comment. |
david | |
All variables should be declared at the beginning of the function, even if you wait until here to assign them … |
david | |
Space between the // and the comment. |
david | |
Should use ===. |
david | |
It's old code, but this could be simplified to use {{widget.collapsed|yesno:"expand,collapse"}} instead of the if/else. |
david | |
This hsould be marked for translation. |
david | |
Mark for translation. |
david | |
Combine these together (} else {) |
david | |
Template tags like this should all be left-aligned, and should operate on a sort of separate indentation "namespace" than the … |
david |
- Diff:
-
Revision 2 (+316 -15)
- Description:
-
Users can add widgets to their admin dashboard by clicking on "Add Widgets," which will open a modal displaying a list of widgets that they can choose from.
~ This is still in its early stages, but I am reconsidering the design. I don't think checkboxes are the way to go because I doubt most people would be able to determine what widgets they want just based off the names. I think being able to select images would be better.
~ They can remove widgets my clicking the X icon on the upper righthand corner of the widget in question.
- - However, my dashboard stats are fairly boring, so I don't have good images to use. Can I get some screenshots of admin widgets on an active user's dashboard?
-
-
This could be a bit more efficient. You can either do a single
for p in primary_widgets
and then append to two lists, or you could use itertools like this:# This at the top: from itertools import groupby ... # and then here: grouped = groupby( primary_widgets, lambda p: primary_widget_selections[p.widget_id] == '1') selected_primary_widgets = grouped[True] unselected_primary_widgets = grouped[False]
-
-
If several widgets don't have given positions, won't this result in several of the values in
positions
being set to the same thing (len(widgets)
)? Is that a problem?If not, I'd like to see that reflected in your testing, and some comment about how it's handled added here.
-
-
It might be worth assigning the selector (or selector string) to a variable to reduce the length of this line.
-
-
This will run the selector three times. You should chain this as such:
$('#' + widgetID) .removeClass('widget-masonry-item') .parent() .masonry('reload') .end() .hide();
-
-
-
It looks like this code will result in four HTTP requests (and possibly two
confirm()
dialogs)? Can we maybe rewire things to get that down to one? -
-
It's old code, but this could be simplified to use
{{widget.collapsed|yesno:"expand,collapse"}}
instead of the if/else. -
-
- Diff:
-
Revision 3 (+423 -18)
-
-
-
Can you combine these two into one rule?
#all-primary-widgets, #all-secondary-widgets { display: none; }
-
-
-
-
Instead of spelling out "index" and "element", it's just as clear and quicker to read to use "i" and "el"
-
-
-
If you combine the first two lines into one, you'd save some indentation (and even if you don't, there's some misalignment in the indentation of the last few lines).
-
-
-
-
-
You call $(element) twice. It would be nice to assign that to a variable so you only have to run the jquery selector once.
-
-
-
"Save Widgets" should be localized. Probably you'll need to do that beforehand, like this:
function createWidgetAdderModals() { var buttonText = gettext("Save Widgets"), buttons = {}; buttons[buttonText] = function() { ... }; $('#large-widget-modal').dialog({ ... buttons: buttons, ... }); buttons[buttonText] = function() { ... }; ...
-
-
-
All variables should be declared at the beginning of the function, even if you wait until here to assign them (due to how javascript does hoisting). If you run jshint on your code it should tell you about that.
-
-
- Diff:
-
Revision 4 (+417 -22)
- Description:
-
Users can add widgets to their admin dashboard by clicking on "Add Widgets," which will open a modal displaying a list of widgets that they can choose from.
~ They can remove widgets my clicking the X icon on the upper righthand corner of the widget in question.
~ They can remove widgets by clicking the X icon on the upper righthand corner of the widget in question.
+ + Image files:
+ https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/activity-graph-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/database-stats-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/news-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/recent-actions-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/repositories-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/review-groups-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/review-request-statuses-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/server-cache-widget.png + https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/user-activity-widget.png - Removed Files:
- Added Files:
- Groups:
-
-
-
Template tags like this should all be left-aligned, and should operate on a sort of separate indentation "namespace" than the HTML. See reviewboard/templates/reviews/review_request_box.html for a good example. Please fix up all of this throughout this template (which wasn't completely correct to begin with).
- Diff:
-
Revision 5 (+417 -23)
- Description:
-
Users can add widgets to their admin dashboard by clicking on "Add Widgets," which will open a modal displaying a list of widgets that they can choose from.
They can remove widgets by clicking the X icon on the upper righthand corner of the widget in question.
- - Image files:
- https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/activity-graph-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/database-stats-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/news-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/recent-actions-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/repositories-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/review-groups-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/review-request-statuses-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/server-cache-widget.png - https://github.com/hellosjsu/reviewboard/blob/removeWidgets/reviewboard/static/rb/images/user-activity-widget.png