Unirer (UNIfied Resource Representation) is a series of resource representation engines. The Bootstrap resource representation engine includes Bootstrap-based resource representation templates & snippets. Unirer (统一资源表现)是一系列的资源表现引擎。Bootstrap 资源表现引擎包括基于Bootstrap的资源表现模版和片段。
Unirer (UNIfied Resource Representation) is a series of resource representation engines. The Bootstrap resource representation engine includes Bootstrap-based resource representation templates & snippets.
Unirer (统一资源表现)是一系列的资源表现引擎。Bootstrap 资源表现引擎包括基于Bootstrap的资源表现模版和片段。
Check out the Road Map to find out what’s the next.
Check out the Change Log to find out what’s new.
This Ruby Gem is deprecated. Please use Repres HyperText & Repres Bootstrap instead.
gem 'unirer-bootstrap'
helper ::Unirer::Bootstrap::ApplicationHelper
<%= render partial: 'unirer/bootstrap/meta' %>
<%= render partial: 'unirer/bootstrap/script' %>
<%= render partial: 'unirer/bootstrap/style' %>
<%= render partial: 'unirer/bootstrap/form_field', locals: { options: { model: model, form: f, name: :phone_number, type: :telephone_field } } %>
The Meta partial includes the HTML meta tags for Bootstrap.
<%= render partial: 'unirer/bootstrap/meta' %>
The source codes of the Meta partial:
<meta charset="UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
The Icon partial includes the HTML link tags for Favorite Icons.
<%= render partial: 'unirer/bootstrap/icon',
locals: {
options: {
safari_mask_icon_color: '#5bbad5',
microsoft_application_title_color: '#da532c',
theme_color: '#ffffff'
}
}
%>
The Script partial includes the HTML script tags for jQuery, Bootstrap, and React. All the CDN servers of the JavaScript libraries are optimized for China only. The following code snippet does not load React JS.
<%= render partial: 'unirer/bootstrap/script' %>
The following code snippet loads the latest React JS.
<%= render partial: 'unirer/bootstrap/script', locals: { options: { react: true } } %>
The following code snippet loads the React JS with the given version.
<%= render partial: 'unirer/bootstrap/script',
locals: {
options: {
:jquery => { version: '2.2.0' },
:'moment-with-locales' => true,
:'bootstrap-datetimepicker' => true,
:react => { version: '0.14.6' }
}
}
%>
The following JavaScript libraries are always enabled, only the version can be configurable:
The Style partial includes the HTML style tags for Bootstrap and Font Awesome. All the CDN servers of the CSS libraries are optimized for China only.
<%= render partial: 'unirer/bootstrap/style', locals: { options: { :'font-awesome' => { version: '4.4.0' }, :'bootstrap-datetimepicker' => true } } %>
The following CSS libraries are always enabled, only the version can be configurable:
The Form Field partial includes the HTML form field tags for Rails Form Builder and Bootstrap.
<%= render partial: 'unirer/bootstrap/form_field',
locals: {
options: {
model: model,
form: f,
name: :phone_number,
type: :telephone_field
}
}
%>
<%= render partial: 'unirer/bootstrap/form_field',
locals: {
options: {
model: model,
form: f,
name: :photo,
type: :file_field,
input_accept: 'image/*'
}
}
%>
The Form Select Box partial includes the HTML select tags for Rails Form Builder and Bootstrap.
<%= render partial: 'unirer/bootstrap/form_field',
locals: {
options: {
model: model,
form: f,
name: :country_id,
choices: @countries.select('id, name').map { |country| [ country.name, country.id ] },
options: { prompt: '请选择国家' }
}
}
%>
The 4 options are required: model, form, name, and type.
Here are more options: