** \\ Main application CSS cannot be used /// **
This is when I used the gem ** Administrate to create an administration screen in the Rails app **. I tried to apply the CSS applied to the view of the main app to the views under admin, but I can't ...
I'm using the same class name as the main app ... what should I do? ?? ??
** Add the destination to load the Administrate stylesheet **
** 1. Generate
rails g administrate: views: layout **
$ rails haml: erb2hamletc.
** 2. Add the stylesheet loading destination to
- Administrate::Engine.stylesheets.each do |css_path| = stylesheet_link_tag css_path #Add this line ↓ = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' = yield :stylesheet
With this description, the file
/assets/stylesheets/application.scss will be read, and as a result, the existing stylesheet can be applied to the admin screen as well.
I don't think there is much demand, but ** it is possible to change (customize) the layout of the default administrate screen **.
This was also listed on GitHub Issues (How to add custom CSS? # 748).
#Run in the corresponding app directory $ rails g administrate:assets:stylesheets Running via Spring preloader in process 44122 create app/assets/stylesheets/administrate create app/assets/stylesheets/administrate/application.scss create app/assets/stylesheets/administrate/base/_forms.scss create app/assets/stylesheets/administrate/base/_layout.scss create app/assets/stylesheets/administrate/base/_lists.scss create app/assets/stylesheets/administrate/base/_tables.scss create app/assets/stylesheets/administrate/base/_typography.scss create app/assets/stylesheets/administrate/components/_app-container.scss create app/assets/stylesheets/administrate/components/_attributes.scss create app/assets/stylesheets/administrate/components/_buttons.scss create app/assets/stylesheets/administrate/components/_cells.scss create app/assets/stylesheets/administrate/components/_field-unit.scss create app/assets/stylesheets/administrate/components/_flashes.scss create app/assets/stylesheets/administrate/components/_form-actions.scss create app/assets/stylesheets/administrate/components/_main-content.scss create app/assets/stylesheets/administrate/components/_navigation.scss create app/assets/stylesheets/administrate/components/_pagination.scss create app/assets/stylesheets/administrate/components/_search.scss create app/assets/stylesheets/administrate/library/_clearfix.scss create app/assets/stylesheets/administrate/library/_data-label.scss create app/assets/stylesheets/administrate/library/_variables.scss create app/assets/stylesheets/administrate/reset/_normalize.scss create app/assets/stylesheets/administrate/utilities/_text-color.scss
In this way, the style sheet is generated in a hurry, so you can apply the changes by tweaking the part you want to customize.
Even so, Administrate has this kind of thing every time ... It seems that it can be made into a series once the implementation is completed lol