Rails绘制进度条而不是整数值 [英] Rails draw progress bar instead of integer value

查看:73
本文介绍了Rails绘制进度条而不是整数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在使用ActiveAdmin作为Rails网站的管理面板。在团队的索引页上,它显示团队的得分为整数。

I'm now using ActiveAdmin as the admin panel for Rails website. On index page of Teams, it shows team's score as integer.

有什么方法可以显示静态进度条(小数位数为100),而不是显示整数?

Instead of showing the integer, is there any way to show the static progress bar, scale of 100?

对不起,我的英语不好。感谢您的帮助。

Sorry for my poor english. Thanks for your help.

推荐答案

我已经解决了。所以这就是我所做的:

I've solved it. So here is what I did :

在我的Gemfile中包含引导程序宝石

Include bootstrap gem in my Gemfile

gem 'bootstrap', '~> 4.0.0.alpha6'

重新启动服务器,然后将引导程序导入到/ app / assets / active_admin。 scss

Restart the server and then import bootstrap to /app/assets/active_admin.scss

@import "bootstrap";

现在,您可以将进度条或其他组件添加到ActiveAdmin的任何页面。例如,对于仪表板页面,将以下代码添加到/app/admin/dashboard.rb

Now you can add progress bar or other components to any page of ActiveAdmin. For example for dashboard page, add the following code to the /app/admin/dashboard.rb

render html: "<div class='progress'><div class='progress-bar' role='progressbar' style='width: 25%;' aria-valuenow='25' aria-valuemax='100' aria-valuemin='0'>25%</div></div>".html_safe

这篇关于Rails绘制进度条而不是整数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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