All Projects → javiertoledo → Bootstrap Rating Input

javiertoledo / Bootstrap Rating Input

Licence: mit
Another plugin that eases the generation of rating stars for jQuery and Bootstrap

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Bootstrap Rating Input

Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (-45.28%)
Mutual labels:  bootstrap, jquery
Bootstrap Checkbox
A checkbox component based on Bootstrap framework.
Stars: ✭ 214 (-32.7%)
Mutual labels:  bootstrap, jquery
Bootstrap Input Spinner
A Bootstrap 4 / jQuery plugin to create input spinner elements for number input
Stars: ✭ 176 (-44.65%)
Mutual labels:  bootstrap, jquery
Ax5ui Kernel
Javascript UI Framework - AX5UI - Kernel Module
Stars: ✭ 164 (-48.43%)
Mutual labels:  bootstrap, jquery
E107
e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
Stars: ✭ 272 (-14.47%)
Mutual labels:  bootstrap, jquery
Jeecg
JEECG是一款基于代码生成器的J2EE快速开发平台,开源界“小普元”超越传统商业企业级开发平台。引领新的开发模式(Online Coding模式(自定义表单) - > 代码生成器模式 - > 手工MERGE智能开发), 可以帮助解决Java项目90%的重复工作,让开发更多关注业务逻辑。既能快速提高开发效率,帮助公司节省人力成本,同时又不失灵活性。具备:表单配置能力(无需编码)、移动配置能力、工作流配置能力、报表配置能力(支持移动端)、插件开发能力(可插拔)
Stars: ✭ 2,027 (+537.42%)
Mutual labels:  bootstrap, jquery
100 Days Of Code Frontend
Curriculum for learning front-end development during #100DaysOfCode.
Stars: ✭ 2,419 (+660.69%)
Mutual labels:  bootstrap, jquery
Ruoyi Oracle
(RuoYi)官方仓库 基于SpringBoot的权限管理系统 易读易懂、界面简洁美观。 核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。直接运行即可用
Stars: ✭ 134 (-57.86%)
Mutual labels:  bootstrap, jquery
Keditor
KEditor is a jQuery plugin which provides a content editor with drag n drop, configurable contents
Stars: ✭ 261 (-17.92%)
Mutual labels:  bootstrap, jquery
Warehouse Inventory System
Open source inventory management system with php and mysql
Stars: ✭ 235 (-26.1%)
Mutual labels:  bootstrap, jquery
Cms
Modular CMS powered by CakePHP
Stars: ✭ 163 (-48.74%)
Mutual labels:  bootstrap, jquery
Yan
使用Maven构建,整合Dubbo+Zookeeper+SpringMVC+Spring+MyBatis+Redis支持分布式的高效率便捷开发框架
Stars: ✭ 293 (-7.86%)
Mutual labels:  bootstrap, jquery
Crown
Based on SpringBoot2, Crown builds a rapidly developed web application scaffolding.
Stars: ✭ 161 (-49.37%)
Mutual labels:  bootstrap, jquery
Fe
前端热门文章阅读
Stars: ✭ 174 (-45.28%)
Mutual labels:  bootstrap, jquery
Makesen
响应式企业门户网站 jQuery/Bootstrap开发
Stars: ✭ 134 (-57.86%)
Mutual labels:  bootstrap, jquery
Bs grid
Bootstrap Datagrid
Stars: ✭ 184 (-42.14%)
Mutual labels:  bootstrap, jquery
Bootstrap4 Website
Website built with bootstrap 4 Framework
Stars: ✭ 124 (-61.01%)
Mutual labels:  bootstrap, jquery
Roothub
使用 SSM 和 MySQL 开发的论坛系统
Stars: ✭ 131 (-58.81%)
Mutual labels:  bootstrap, jquery
Bbs Ssm
南生论坛基于SSM框架,自适应手机端和电脑端,界面简洁美观,功能完善。演示地址:http://www.nanshengbbs.top
Stars: ✭ 221 (-30.5%)
Mutual labels:  bootstrap, jquery
Yclas
Yclas Self Hosted is a powerful script that can transform any domain into a fully customizable classifieds site within a few seconds.
Stars: ✭ 276 (-13.21%)
Mutual labels:  bootstrap, jquery

Bootstrap Rating Input

CDNJS version

This is another plugin that eases the generation of rating stars for jQuery and Bootstrap.

It generates widgets like this:

Rating example

But, why another damn rating plugin???

Because it made sense back in 2013 when most rating plugins depended on PNG images. As noted by dandv, in 2016 there are quite a few modern libraries that don't depend on them anymore.

And also... why not!!?

Ok, enough talking, tell me how this thing works!

If you're using bower to manage your frontend dependencies you can install this plugin by just issuing this command:

bower install bootstrap-rating-input --save

Otherwise you can just download build/bootstrap-rating-input.min.js, put it wherever you usually put JavaScripts in your project and include it on pages where you want to have forms with ratings:

<script src="path/to/javascripts/bootstrap-rating-input.min.js" type="text/javascript"></script>

Now add a input of type number to your forms and add the class rating to it:

<input type="number" name="your_awesome_parameter" id="some_id" class="rating" />

That's all! When page loads, you'll find a few stars where you'd expect to find the input. It works just like most of rating plugins, but for the basic usage you don't need to learn anything else about options or initializations, it just works out of the box.

Wait, where is my input?

The plugin transforms your number input into a hidden field and wraps it inside a div (Or a span with the inline option) along with the star icons that will catch your clicks and save the selected values into the hidden field. By doing this, the field still exist in your form and can be submitted or its current value read by jQuery normally. Any CSS class in addition to rating will be copied to the wrapper for further styling options.

Nice, but I want to use a different number of stars

Sure! You can set min and max values adding data-min and data-max:

<input class="rating" data-max="5" data-min="1" id="some_id" name="your_awesome_parameter" type="number" />

Can I set a default value?

Definitely, just set an integer value in your input that's within your min-max range':

<input type="number" name="your_awesome_parameter" id="some_id" class="rating" data-clearable="remove" value="3"/>

Can I set a special value for empty ratings?

You can add the attribute data-empty-value to indicate which value should send the form when it have an empty rating. This can be used, for example, to have an special value indicating the user didn't perform a selection:

<input class="rating" data-max="5" data-min="1" id="some_id" name="your_awesome_parameter" type="number" data-empty-value="0"/>

By default empty ratings will behave like a regular empty field.

And what about clearing the stars?

By default once you set a value it remains set and you can only change it by another, but you can add a clear link by just defining the data-clearable attribute:

<input class="rating" data-clearable="remove" id="some_id" name="your_awesome_parameter" type="number" />

The content of data-clearable will appear as label for the link. If no value is provided the plugin will display just the clear icon.

You can also add a data-clearable-remain attribute to true if you'd like the clear link to remain up even when there are no stars selected:

<input class="rating" data-clearable="remove" data-clearable-remain="true" id="some_id" name="your_awesome_parameter" type="number" />

By default the clear link will be hidden whenever no stars are selected.

Can I use custom icon classes?

Now you can use custom icons thanks to the awesome contribution by johncadigan. You can set different icon classes from gliphicons or even load icons from other libraries you're using. For instance here is how you generate a heart rating input with font awesome (You can see it working in the demo.html file):

<input type="number" name="your_awesome_parameter" id="some_id" class="rating" data-clearable="remove" data-icon-lib="fa" data-active-icon="fa-heart" data-inactive-icon="fa-heart-o" data-clearable-icon="fa-trash-o"/>

If you want to use FontAwesome, remember to include the library in your header:

<header>
  ...
  <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
  ...
</header>

Inline render

If you need to render the rating input inline with your text, use the data-inline option:

<input type="number" name="your_awesome_parameter" id="some_id" class="rating" data-inline />

This will wrap the input in a span element instead of the default div.

Readonly mode

Thanks to the contribution by iyedb this plugin now features a read-only mode. Just add the attribute data-readonly to do the trick:

<input type="number" name="your_awesome_parameter" id="some_id" class="rating" value="2" data-readonly />

I don't want to be forced to add the rating class to the inputs

The rating class is used in combination with input[type=number] to let you autoload the rating plugin without coding anything, but you can apply this plugin to a input of any type by executing the method rating on a jQuery selection and pass the options in an object:

$('input.my_class').rating({
  clearable: true
});

Requirements

You know... Twitter Bootstrap and jQuery!

It looks nice, but I want to complain because it doesn't fit my favorite use case

I have implemented this for my project in my environment and sharing it for free. Leave me an issue with your suggestions and I'll eventually push a fix, but this is MIT licensed, so you're welcome to fork this project, do pull requests with fixes and improvements, reimplement better versions of it for your own or do whatever you want, I'll be happy if it becomes useful or inspires at least one more person.

Ok, I want to contribute

Nice! You're awesome, fork the project, and do whatever changes you want into src/bootstrap-rating-input.js. If you're kind enough I'll appreciate that you maintain the minified version updated and to ease this step I've automated minification with grunt, so if you have npm installed you can issue following command to update the minified version:

$ npm install && grunt

Thanks!!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].