将AdminLTE集成到Ruby on Rails中 [英] Integrating AdminLTE into Ruby on Rails

查看:256
本文介绍了将AdminLTE集成到Ruby on Rails中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Ruby on Rails的新手,想安装一个名为AdminLTE的免费模板. 它使您可以轻松创建App(前端).

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).

我想将其集成到Rails中,但我不知道怎么做,也找不到任何解决方案.

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.

这是模板的网站: https://almsaeedstudio.com/AdminLTE

推荐答案

这是昨晚才实施的.这是我的方法.

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

将此粘贴​​到您的Gemfile :

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

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

将以下内容粘贴到app/assets/javascripts/application.js

//= require adminlte

将以下内容粘贴到app/assets/stylesheets/application.css

*= require adminlte
*= require skin-blue

创建一个新文件app/assets/stylesheets/custom.css.scss并粘贴以下内容:

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";

从单独下载的AdminLTE的源代码中(您可以从问题中提到的链接中获得),浏览至

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

并复制文件skin-blue.css并将其粘贴到Rails项目的vendor/assets/stylesheets/

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

然后在AdminLTE的源代码中打开starter.html,并将内容粘贴到<body> ......... </body>中,然后将其粘贴到app/views/layouts/application.html.erb中的<body> ................ </body>中.将body标签修改为<body class="skin-blue sidebar-mini">

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">

通过运行bundle install安装随附的gem,然后通过运行rails s重新启动Rails服务器,您应该会看到漂亮的模板AdminLTE

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

注1:也许还有其他更有效的方法.我不知道,但是如果有人知道,我将非常高兴学习它是如何完成的.在此之前,这对我来说非常有效,我希望它可以节省您一些宝贵的时间.

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.

注2:当然,您可以通过更改vendor/assets/stylesheets中包含的样式表文件并对app/assets/stylesheets/application.css文件进行必要的修改来根据自己的喜好更改外观.不要忘记在app/views/layouts/application.html.erb文件中更改<body > .......</body>的类

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

这篇关于将AdminLTE集成到Ruby on Rails中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆