-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Consistent custom dashboards #2184
Conversation
end | ||
|
||
def resource(resource_name) | ||
define_singleton_method(:named_resource) { resource_name } | ||
@named_resource = resource_name |
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.
This change is not strictly necessary, but I felt that the current code was needlessly complicated and could be simplified like this.
<br> | ||
<p><b>Total Orders:</b> <%= @stats[:order_count] %></h1> | ||
<p><b>Total Customers:</b> <%= @stats[:customer_count] %></p> | ||
<p><b>Total Orders:</b> <%= @stats[:order_count] %></p> |
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.
Fixed markup.
|
||
<div style="padding: 20px"> | ||
<div> |
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.
The example is copied straight from spec/example_app/app/views/admin/stats/index.html.erb
. I have removed the padding because it's not relevant here.
Bringing this back to draft as I have to rethink it. |
Looks like I don't need any of this in the end. Closing. |
Working on #1941, I noticed that model-less dashboards (also known as "custom dashboards") do not behave very consistently. Eventually I found myself having to fix this before I could work on the former PR.
There are some twists and turns in the code that handles them:
HomesPolicy
) instead of singular like for any other resource.StatsDashboard
declaresresource "Stats"
, which is a weird mix of singular and plural (in the end it doesn't seem to matter which one you use here).This PR introduces consistency, not fixing point 1 but at least addressing the other points and allowing me to proceed with my work at #1941. Original I was going to bundle it as part of the larger PR, but I thought it deserved scrutiny enough to have its own one.
As for the issue with singular names, this looks like a larger problem that should be looked into with more time, and it's probably related to how we currently can't generate dashboards for singular resources.