bootstrap_plus 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +58 -0
- data/Rakefile +32 -0
- data/app/assets/config/bootstrap_plus_manifest.js +2 -0
- data/app/assets/javascripts/bootstrap.js +4521 -0
- data/app/assets/javascripts/bootstrap_plus/application.js +15 -0
- data/app/assets/javascripts/jquery3.js +10598 -0
- data/app/assets/javascripts/popper.js +2624 -0
- data/app/assets/stylesheets/bootstrap_plus/bootstrap.css.erb +7 -0
- data/app/helpers/badge_label_helper.rb +16 -0
- data/app/helpers/bootstrap_flash_helper.rb +30 -0
- data/app/helpers/flash_block_helper.rb +17 -0
- data/app/helpers/form_errors_helper.rb +22 -0
- data/app/helpers/glyph_helper.rb +23 -0
- data/app/helpers/modal_helper.rb +59 -0
- data/app/helpers/navbar_helper.rb +209 -0
- data/app/helpers/twitter_breadcrumbs_helper.rb +14 -0
- data/app/views/layouts/bootstrap_plus/application.html.erb +16 -0
- data/config/routes.rb +2 -0
- data/lib/bootstrap_plus.rb +5 -0
- data/lib/bootstrap_plus/engine.rb +32 -0
- data/lib/bootstrap_plus/version.rb +3 -0
- data/lib/generators/bootstrap_plus/install/install_generator.rb +86 -0
- data/lib/generators/bootstrap_plus/install/templates/application.css +7 -0
- data/lib/generators/bootstrap_plus/install/templates/application.js +11 -0
- data/lib/generators/bootstrap_plus/install/templates/bootstrap.coffee +3 -0
- data/lib/generators/bootstrap_plus/install/templates/bootstrap.js +4 -0
- data/lib/generators/bootstrap_plus/install/templates/bootstrap_and_overrides.css +3 -0
- data/lib/generators/bootstrap_plus/install/templates/en.bootstrap.yml +23 -0
- data/lib/generators/bootstrap_plus/layout/layout_generator.rb +20 -0
- data/lib/generators/bootstrap_plus/layout/templates/layout.html.erb +71 -0
- data/lib/generators/bootstrap_plus/resource_view/resource_view_generator.rb +148 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/_form.html.erb +34 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/_form.html.haml +12 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/_form.html.slim +13 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/edit.html.erb +9 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/edit.html.haml +4 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/edit.html.slim +4 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/index.html.erb +48 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/index.html.haml +26 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/index.html.slim +28 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/new.html.erb +9 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/new.html.haml +4 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/new.html.slim +4 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/show.html.erb +30 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/show.html.haml +15 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/show.html.slim +16 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/simple_form/_form.html.erb +14 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/simple_form/_form.html.haml +11 -0
- data/lib/generators/bootstrap_plus/resource_view/templates/simple_form/_form.html.slim +12 -0
- data/lib/tasks/bootstrap_plus_tasks.rake +4 -0
- metadata +124 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module BootstrapPlus
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
desc "This generator installs Bootstrap to Asset Pipeline of your Rails Application"
|
9
|
+
argument :stylesheets_type, type: :string, default: 'less', banner: '*less or static'
|
10
|
+
class_option :'no-coffeescript', type: :boolean, default: false, desc: 'Skips coffeescript replacement into app generators'
|
11
|
+
|
12
|
+
def add_assets
|
13
|
+
|
14
|
+
js_manifest = 'app/assets/javascripts/application.js'
|
15
|
+
|
16
|
+
if File.exist?(js_manifest)
|
17
|
+
insert_into_file js_manifest, "//= require jquery3\n", after: "rails-ujs\n"
|
18
|
+
insert_into_file js_manifest, "//= require popper\n", after: "jquery3\n"
|
19
|
+
insert_into_file js_manifest, "//= require bootstrap\n", after: "popper\n"
|
20
|
+
else
|
21
|
+
copy_file "application.js", js_manifest
|
22
|
+
end
|
23
|
+
|
24
|
+
css_manifest = 'app/assets/stylesheets/application.css'
|
25
|
+
|
26
|
+
if File.exist?(css_manifest)
|
27
|
+
# Add our own require:
|
28
|
+
content = File.read(css_manifest)
|
29
|
+
if content.match(/require_tree\s+\.\s*$/)
|
30
|
+
# Good enough - that'll include our bootstrap_and_overrides.css.less
|
31
|
+
else
|
32
|
+
style_require_block = " *= require bootstrap_and_overrides\n"
|
33
|
+
insert_into_file css_manifest, style_require_block, after: "require_self\n"
|
34
|
+
end
|
35
|
+
else
|
36
|
+
copy_file "application.css", "app/assets/stylesheets/application.css"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_bootstrap
|
42
|
+
# copy_file "bootstrap.js", "app/assets/javascripts/bootstrap.js"
|
43
|
+
copy_file "bootstrap_and_overrides.css", "app/assets/stylesheets/bootstrap_and_overrides.css"
|
44
|
+
# if use_coffeescript?
|
45
|
+
# copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
|
46
|
+
# else
|
47
|
+
# end
|
48
|
+
# if use_less?
|
49
|
+
# copy_file "bootstrap_and_overrides.less", "app/assets/stylesheets/bootstrap_and_overrides.css.less"
|
50
|
+
# else
|
51
|
+
# end
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_locale
|
55
|
+
if File.exist?("config/locales/en.bootstrap.yml")
|
56
|
+
localez = File.read("config/locales/en.bootstrap.yml")
|
57
|
+
insert_into_file "config/locales/en.bootstrap.yml", localez, :after => "en\n"
|
58
|
+
else
|
59
|
+
copy_file "en.bootstrap.yml", "config/locales/en.bootstrap.yml"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def cleanup_legacy
|
64
|
+
# Remove old requires (if any) that included twitter/bootstrap directly:
|
65
|
+
gsub_file("app/assets/stylesheets/application.css", %r|\s*\*=\s*twitter/bootstrap\s*\n|, "")
|
66
|
+
if File.exist?('app/assets/stylesheets/bootstrap_override.css.less')
|
67
|
+
puts <<-EOM
|
68
|
+
Warning:
|
69
|
+
app/assets/stylesheets/bootstrap_override.css.less exists
|
70
|
+
It should be removed, as it has been superceded by app/assets/stylesheets/bootstrap_and_overrides.css.less
|
71
|
+
EOM
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def use_less?
|
77
|
+
(defined?(Less) && (stylesheets_type!='static') ) || (stylesheets_type=='less')
|
78
|
+
end
|
79
|
+
|
80
|
+
def use_coffeescript?
|
81
|
+
return false if options[:'no-coffeescript']
|
82
|
+
::Rails.configuration.app_generators.rails[:javascript_engine] == :coffee
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require rails-ujs
|
8
|
+
//= require jquery3
|
9
|
+
//= require popper
|
10
|
+
//= require bootstrap
|
11
|
+
//= require_tree .
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
en:
|
5
|
+
breadcrumbs:
|
6
|
+
application:
|
7
|
+
root: "Index"
|
8
|
+
pages:
|
9
|
+
pages: "Pages"
|
10
|
+
helpers:
|
11
|
+
actions: "Actions"
|
12
|
+
links:
|
13
|
+
back: "Back"
|
14
|
+
cancel: "Cancel"
|
15
|
+
confirm: "Are you sure?"
|
16
|
+
destroy: "Delete"
|
17
|
+
new: "New"
|
18
|
+
edit: "Edit"
|
19
|
+
titles:
|
20
|
+
edit: "Edit %{model}"
|
21
|
+
save: "Save %{model}"
|
22
|
+
new: "New %{model}"
|
23
|
+
delete: "Delete %{model}"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module BootstrapPlus
|
4
|
+
module Generators
|
5
|
+
class LayoutGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
desc "This generator generates layout file with navigation."
|
8
|
+
argument :layout_name, type: :string, default: "application"
|
9
|
+
|
10
|
+
attr_reader :app_name
|
11
|
+
|
12
|
+
def generate_layout
|
13
|
+
app = ::Rails.application
|
14
|
+
@app_name = app.class.to_s.split("::").first
|
15
|
+
ext = app.config.generators.options[:rails][:template_engine] || :erb
|
16
|
+
template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name %>" %></title>
|
8
|
+
<%%= csrf_meta_tags %>
|
9
|
+
|
10
|
+
<%%= stylesheet_link_tag "application", :media => "all" %>
|
11
|
+
|
12
|
+
<%%= javascript_include_tag "application" %>
|
13
|
+
|
14
|
+
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
|
15
|
+
<!--[if lt IE 9]>
|
16
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js" type="text/javascript"></script>
|
17
|
+
<![endif]-->
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
|
21
|
+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
22
|
+
<a class="navbar-brand" href="/">Navbar</a>
|
23
|
+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
24
|
+
<span class="navbar-toggler-icon"></span>
|
25
|
+
</button>
|
26
|
+
|
27
|
+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
28
|
+
<ul class="navbar-nav mr-auto">
|
29
|
+
<li class="nav-item active">
|
30
|
+
<a class="nav-link" href="javascript:void(0)">Home <span class="sr-only">(current)</span></a>
|
31
|
+
</li>
|
32
|
+
<li class="nav-item">
|
33
|
+
<a class="nav-link" href="javascript:void(0)">Link</a>
|
34
|
+
</li>
|
35
|
+
<li class="nav-item dropdown">
|
36
|
+
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
37
|
+
Dropdown
|
38
|
+
</a>
|
39
|
+
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
40
|
+
<a class="dropdown-item" href="javascript:void(0)">Action</a>
|
41
|
+
<a class="dropdown-item" href="javascript:void(0)">Another action</a>
|
42
|
+
<div class="dropdown-divider"></div>
|
43
|
+
<a class="dropdown-item" href="javascript:void(0)">Something else here</a>
|
44
|
+
</div>
|
45
|
+
</li>
|
46
|
+
<li class="nav-item">
|
47
|
+
<a class="nav-link disabled" href="javascript:void(0)" tabindex="-1" aria-disabled="true">Disabled</a>
|
48
|
+
</li>
|
49
|
+
</ul>
|
50
|
+
<form class="form-inline my-2 my-lg-0">
|
51
|
+
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
|
52
|
+
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
</nav>
|
56
|
+
|
57
|
+
<div class="container mb-5">
|
58
|
+
<div class="row">
|
59
|
+
<div class="col-12">
|
60
|
+
<%%= bootstrap_flash %>
|
61
|
+
<%%= yield %>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<footer class="mt-5">
|
67
|
+
<p>© Company <%= Date.today.year %></p>
|
68
|
+
</footer>
|
69
|
+
|
70
|
+
</body>
|
71
|
+
</html>
|
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/generated_attribute'
|
3
|
+
|
4
|
+
module BootstrapPlus
|
5
|
+
module Generators
|
6
|
+
class ResourceViewGenerator < ::Rails::Generators::Base
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
argument :controller_path, type: :string
|
9
|
+
argument :model_name, type: :string, required: false
|
10
|
+
argument :layout, type: :string, default: "application",
|
11
|
+
banner: "Specify application layout"
|
12
|
+
|
13
|
+
class_option :excluded_columns, type: :array, required: false
|
14
|
+
|
15
|
+
def initialize(args, *options)
|
16
|
+
super(args, *options)
|
17
|
+
initialize_views_variables
|
18
|
+
end
|
19
|
+
|
20
|
+
def copy_views
|
21
|
+
generate_views
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def initialize_views_variables
|
27
|
+
@base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(controller_path)
|
28
|
+
@controller_routing_path = @controller_file_path.gsub(/\//, '_')
|
29
|
+
@model_name = @controller_class_nesting + "::#{@base_name.singularize.camelize}" unless @model_name
|
30
|
+
@model_name = @model_name.camelize
|
31
|
+
end
|
32
|
+
|
33
|
+
def controller_routing_path
|
34
|
+
ActiveModel::Naming.route_key(@model_name.constantize)
|
35
|
+
end
|
36
|
+
|
37
|
+
def singular_controller_routing_path
|
38
|
+
ActiveModel::Naming.singular_route_key(@model_name.constantize)
|
39
|
+
end
|
40
|
+
|
41
|
+
def model_name
|
42
|
+
@model_name
|
43
|
+
end
|
44
|
+
|
45
|
+
def plural_model_name
|
46
|
+
@model_name.pluralize
|
47
|
+
end
|
48
|
+
|
49
|
+
def resource_name
|
50
|
+
@model_name.demodulize.underscore
|
51
|
+
end
|
52
|
+
|
53
|
+
def plural_resource_name
|
54
|
+
resource_name.pluralize
|
55
|
+
end
|
56
|
+
|
57
|
+
def columns
|
58
|
+
retrieve_columns.reject {|c| excluded?(c.name) }.map do |c|
|
59
|
+
new_attribute(c.name, c.type.to_s)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def excluded_columns_names
|
64
|
+
%w[_id _type id created_at updated_at]
|
65
|
+
end
|
66
|
+
|
67
|
+
def excluded_columns_pattern
|
68
|
+
[
|
69
|
+
/.*_checksum/,
|
70
|
+
/.*_count/,
|
71
|
+
]
|
72
|
+
end
|
73
|
+
|
74
|
+
def excluded_columns
|
75
|
+
options['excluded_columns']||[]
|
76
|
+
end
|
77
|
+
|
78
|
+
def excluded?(name)
|
79
|
+
excluded_columns_names.include?(name) ||
|
80
|
+
excluded_columns_pattern.any? {|p| name =~ p } ||
|
81
|
+
excluded_columns.include?(name)
|
82
|
+
end
|
83
|
+
|
84
|
+
def retrieve_columns
|
85
|
+
if defined?(ActiveRecord) == "constant" && ActiveRecord.class == Module
|
86
|
+
rescue_block ActiveRecord::StatementInvalid do
|
87
|
+
@model_name.constantize.columns
|
88
|
+
end
|
89
|
+
else
|
90
|
+
rescue_block do
|
91
|
+
@model_name.constantize.fields.map {|c| c[1] }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def new_attribute(name, type)
|
97
|
+
::Rails::Generators::GeneratedAttribute.new(name, type)
|
98
|
+
end
|
99
|
+
|
100
|
+
def rescue_block(exception=Exception)
|
101
|
+
yield if block_given?
|
102
|
+
rescue exception => e
|
103
|
+
say e.message, :red
|
104
|
+
exit
|
105
|
+
end
|
106
|
+
|
107
|
+
def extract_modules(name)
|
108
|
+
modules = name.include?('/') ? name.split('/') : name.split('::')
|
109
|
+
name = modules.pop
|
110
|
+
path = modules.map { |m| m.underscore }
|
111
|
+
file_path = (path + [name.underscore]).join('/')
|
112
|
+
nesting = modules.map { |m| m.camelize }.join('::')
|
113
|
+
[name, path, file_path, nesting, modules.size]
|
114
|
+
end
|
115
|
+
|
116
|
+
def generate_views
|
117
|
+
options.engine == generate_erb(selected_views)
|
118
|
+
end
|
119
|
+
|
120
|
+
def selected_views
|
121
|
+
{
|
122
|
+
"index.html.#{ext}" => File.join('app/views', @controller_file_path, "index.html.#{ext}"),
|
123
|
+
"new.html.#{ext}" => File.join('app/views', @controller_file_path, "new.html.#{ext}"),
|
124
|
+
"edit.html.#{ext}" => File.join('app/views', @controller_file_path, "edit.html.#{ext}"),
|
125
|
+
"#{form_builder}_form.html.#{ext}" => File.join('app/views', @controller_file_path, "_form.html.#{ext}"),
|
126
|
+
"show.html.#{ext}" => File.join('app/views', @controller_file_path, "show.html.#{ext}")
|
127
|
+
}
|
128
|
+
end
|
129
|
+
|
130
|
+
def generate_erb(views)
|
131
|
+
views.each do |template_name, output_path|
|
132
|
+
template template_name, output_path
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def ext
|
137
|
+
::Rails.application.config.generators.options[:rails][:template_engine] || :erb
|
138
|
+
end
|
139
|
+
|
140
|
+
def form_builder
|
141
|
+
defined?(::SimpleForm) ? 'simple_form/' : ''
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%%= form_for @<%= resource_name %>, html: { class: "form-horizontal <%= resource_name %>" } do |f| %>
|
2
|
+
|
3
|
+
<%% if @<%= resource_name %>.errors.any? %>
|
4
|
+
<div id="error_expl" class="panel panel-danger">
|
5
|
+
<div class="panel-heading">
|
6
|
+
<h3 class="panel-title"><%%= pluralize(@<%= resource_name %>.errors.count, "error") %> prohibited this <%= resource_name %> from being saved:</h3>
|
7
|
+
</div>
|
8
|
+
<div class="panel-body">
|
9
|
+
<ul>
|
10
|
+
<%% @<%= resource_name %>.errors.full_messages.each do |msg| %>
|
11
|
+
<li><%%= msg %></li>
|
12
|
+
<%% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<%% end %>
|
17
|
+
|
18
|
+
<%- columns.each do |column| -%>
|
19
|
+
<div class="form-group">
|
20
|
+
<%%= f.label :<%= column.name %>, class: 'control-label' %>
|
21
|
+
<%%= f.<%= column.field_type %> :<%= column.name %>, class: 'form-control rounded-0' %><br>
|
22
|
+
<%%=f.error_span(:<%= column.name %>) %>
|
23
|
+
</div>
|
24
|
+
<%- end -%>
|
25
|
+
|
26
|
+
<div class="form-group">
|
27
|
+
<div class="col-lg-offset-2 col-lg-10">
|
28
|
+
<%%= f.submit nil, class: 'btn btn-primary' %>
|
29
|
+
<%%= link_to t('.cancel', default: t("helpers.links.cancel")),
|
30
|
+
<%= controller_routing_path %>_path, class: 'btn btn-outline-primary' %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<%% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= form_for @<%= resource_name %>, html: { class: "form form-horizontal <%= resource_name %>" } do |f|
|
2
|
+
<%- columns.each do |column| -%>
|
3
|
+
.form-group
|
4
|
+
= f.label :<%= column.name %>, class: 'control-label col-lg-2'
|
5
|
+
.col-lg-10
|
6
|
+
= f.<%= column.field_type %> :<%= column.name %>, class: 'form-control', required: true
|
7
|
+
= f.error_span(:<%= column.name %>)
|
8
|
+
<%- end -%>
|
9
|
+
.form-group
|
10
|
+
.col-lg-offset-2.col-lg-10
|
11
|
+
= f.submit nil,class: 'btn btn-primary'
|
12
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-default'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
= form_for @<%= resource_name %>, html: { class: "form form-horizontal <%= resource_name %>" } do |f|
|
2
|
+
<%- columns.each do |column| -%>
|
3
|
+
.form-group
|
4
|
+
= f.label :<%= column.name %>, :class => 'control-label col-lg-2'
|
5
|
+
.col-lg-10
|
6
|
+
= f.<%= column.field_type %> :<%= column.name %>, :class => 'form-control'
|
7
|
+
= f.error_span(:<%= column.name %>)
|
8
|
+
<%- end -%>
|
9
|
+
.form-group
|
10
|
+
.col-lg-offset-2.col-lg-10
|
11
|
+
= f.submit nil, :class => 'btn btn-primary'
|
12
|
+
'
|
13
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
|