-
-
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
Generating views creates wrong file paths #202
Comments
The path is set from
def copy_resource_template(template_name)
template_file = "#{template_name}.html.erb"
copy_file(
template_file,
"app/views/admin/#{resource_path}/#{template_file}",
)
end But I wouldn't call it wrong, because all other generated files (controllers etc.) live under |
No no it should be _also_ It is creating the views under |
Plus keep in mind these are the base views... |
@leewaa Yes, I believe you are right. I created a Pull Request for @Graysonwright. The part with |
@leewaa and @5minpause - thanks for the contributions! It turns out both Administrate::ApplicationController
Admin::ApplicationController
Admin::CustomersController # base level so Rails will look for views in:
In the future, we'd like to support multiple admin dashboards in the same application, by nesting them under different namespaces (e.g. I'm not sure that affects us now, but it might be nice to keep the views under |
That makes sense. Thanks for clearing this up. What about the |
yeah, I think that should definitely be |
#221 will fix this. |
Closes #202 Problem: The documentation states that views will be generated in the `app/views/administrate/` directory, but they are actually generated in `app/views/admin/`. Solution: In fact, both paths work correctly for overriding views. Rails looks up views based on the inheritance tree of your controllers. In this case, our inheritance tree looks like: ``` Administrate::ApplicationController Admin::ApplicationController Admin::CustomersController # base level ``` ... so Rails will look for views in: `app/views/admin/customers`, THEN `app/views/admin/application`, THEN `app/views/administrate/application`. In the future, we'd like to support multiple admin dashboards in the same application, by nesting them under different namespaces (e.g. `app/views/admin` and `app/views/super_admin`). In that case, views under `app/views/administrate` would apply to *all* of the admin dashboards. Views under `app/views/admin` would only apply to the dashboard at the `/admin` route, and wouldn't affect the dashboard at `/super_admin`. Because of this, we'd prefer to keep the generated views in `/admin`. We'll keep the current implementation, and update the documentation.
Closes #202 Problem: The documentation states that views will be generated in the `app/views/administrate/` directory, but they are actually generated in `app/views/admin/`. Solution: In fact, both paths work correctly for overriding views. Rails looks up views based on the inheritance tree of your controllers. In this case, our inheritance tree looks like: ``` Administrate::ApplicationController Admin::ApplicationController Admin::CustomersController # base level ``` ... so Rails will look for views in: `app/views/admin/customers`, THEN `app/views/admin/application`, THEN `app/views/administrate/application`. In the future, we'd like to support multiple admin dashboards in the same application, by nesting them under different namespaces (e.g. `app/views/admin` and `app/views/super_admin`). In that case, views under `app/views/administrate` would apply to *all* of the admin dashboards. Views under `app/views/admin` would only apply to the dashboard at the `/admin` route, and wouldn't affect the dashboard at `/super_admin`. Because of this, we'd prefer to keep the generated views in `/admin`. We'll keep the current implementation, and update the documentation.
Closes #202 Problem: The documentation states that views will be generated in the `app/views/administrate/` directory, but they are actually generated in `app/views/admin/`. Solution: In fact, both paths work correctly for overriding views. Rails looks up views based on the inheritance tree of your controllers. In this case, our inheritance tree looks like: ``` Administrate::ApplicationController Admin::ApplicationController Admin::CustomersController # base level ``` ... so Rails will look for views in: `app/views/admin/customers`, THEN `app/views/admin/application`, THEN `app/views/administrate/application`. In the future, we'd like to support multiple admin dashboards in the same application, by nesting them under different namespaces (e.g. `app/views/admin` and `app/views/super_admin`). In that case, views under `app/views/administrate` would apply to *all* of the admin dashboards. Views under `app/views/admin` would only apply to the dashboard at the `/admin` route, and wouldn't affect the dashboard at `/super_admin`. Because of this, we'd prefer to keep the generated views in `/admin`. We'll keep the current implementation, and update the documentation.
I ran
rails g administrate:views
and I got:The paths are wrong. It should be:
app/views/administrate/application/index.html.erb
etc.The docs state the correct paths:
http://administrate-docs.herokuapp.com/customizing_page_views
The text was updated successfully, but these errors were encountered: