Integrating AdminLTE into Ruby on Rails

纵然是瞬间 提交于 2019-12-03 14:07:09

问题


I'm new to Ruby on Rails and wanted to install a free template called AdminLTE. It allows you to easily create App (front-end).

I wanted to integrate it into Rails but I didn't know how and I couldn't find a solution anywhere.

If anyone can help me that would be awesome.

this is the template's website: https://almsaeedstudio.com/AdminLTE


回答1:


Got this implemented just last night. Here's how I did it.

Paste this into your Gemfile :

gem 'bootstrap-sass'
gem 'jquery-rails'
gem 'font-awesome-sass'

source 'https://rails-assets.org/' do 
  gem 'rails-assets-adminlte'
end

Paste the following to app/assets/javascripts/application.js

//= require adminlte

Paste the following to app/assets/stylesheets/application.css

*= require adminlte
*= require skin-blue

Create a new file app/assets/stylesheets/custom.css.scss and paste in the following:

@import "bootstrap-sprockets";
@import "bootstrap";
@import "font-awesome-sprockets";
@import "font-awesome";

From the source code of AdminLTE that is downloaded separately which you may get from the link you mentioned in your question, browse to

dist/css/skin

and copy the file skin-blue.css and paste it into vendor/assets/stylesheets/ in your rails project

Then open the starter.html in the source code of AdminLTE and paste the content within the <body> ......... </body> and paste it within the <body> ................ </body> in app/views/layouts/application.html.erb . Modify the body tag to to <body class="skin-blue sidebar-mini">

Install the included gems by running bundle install and then restart rails server by running rails s and you should see the the beautiful template that is AdminLTE

NOTE 1: Maybe there exist other, more efficient ways of doing it. I am not aware though and if anyone knows, I'd be more than glad to learn how it's done. Until then, this works perfectly for me and I hope it saves you some precious time.

NOTE 2: You may of course change the skin to your liking accordingly by changing the stylesheet file you include in the vendor/assets/stylesheets and making the necessary modifications to your app/assets/stylesheets/application.css file. Don't forget to change the class of the <body > .......</body> in your app/views/layouts/application.html.erb file




回答2:


Don't need to copy 'skin-blue.css' into

vendor/assets/stylesheets/

Paste the following to app/assets/stylesheets/application.css

//= require adminlte/skins/skin-blue


来源:https://stackoverflow.com/questions/31150408/integrating-adminlte-into-ruby-on-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!