-
-
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
Add generators for asset files #326
Conversation
describe "administrate:assets" do | ||
it "runs all sub-generators" do | ||
allow(Rails::Generators).to receive(:invoke) | ||
resource = "users" |
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.
Useless assignment to variable - resource
.
One drawback of this implementation is that the When I run I tried specifying I expect this to be an incredibly uncommon use case, so I'm OK pushing this forward. Thoughts? |
module Administrate | ||
module Generators | ||
class AssetsGenerator < Administrate::ViewGenerator | ||
def copy_templates |
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.
rename to copy_assets
Problem: Many people want to customize the stylesheets and javascripts that get applied to Administrate dashboards. To do that, they must copy over the default assets from Adminsitrate's source into their own host application, and edit those files to add custom behavior or styles. This approach is error-prone and not approachable. Solution: Add a generator for copying over default styles and javascripts into the user's host application. Usage: ``` # Copy image assets into `app/assets/images/administrate` rails generate administrate:assets:images # Copy javascript assets into `app/assets/javascripts/administrate` rails generate administrate:assets:javascripts # Copy stylesheet assets into `app/assets/stylesheets/administrate` rails generate administrate:assets:stylesheets # Runs all of the above generators rails generate administrate:assets ```
228af91
to
c132777
Compare
Cheers @Graysonwright, I'll check this out soon. Does it help the production of custom plugins like we were talking about before too? |
@rikkipitt sorry for the late response. This is a step in that direction. We're also working on #476, which will really help out with custom plugins. |
Closes #187
Problem:
Many people want to customize the stylesheets and javascripts
that get applied to Administrate dashboards.
To do that, they must copy over the default assets
from Adminsitrate's source into their own host application,
and edit those files to add custom behavior or styles.
This approach is error-prone and not approachable.
Solution:
Add a generator for copying over default styles and javascripts
into the user's host application.
Usage:
ToDo: