twitter-bootstrap-rails 5.4.0 → 5.5.1
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 +4 -4
- data/CHANGELOG.md +68 -0
- data/README.md +104 -1
- data/app/helpers/badge_label_helper.rb +5 -6
- data/app/helpers/bootstrap_flash_helper.rb +10 -5
- data/app/helpers/flash_block_helper.rb +6 -4
- data/app/helpers/form_errors_helper.rb +3 -2
- data/app/helpers/modal_helper.rb +13 -13
- data/app/helpers/navbar_helper.rb +54 -47
- data/app/helpers/twitter_breadcrumbs_helper.rb +2 -2
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +11 -11
- data/lib/generators/bootstrap/agent/agent_generator.rb +86 -0
- data/lib/generators/bootstrap/agent/templates/guide.md.erb +73 -0
- data/lib/generators/bootstrap/doctor/doctor_generator.rb +49 -0
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +11 -15
- data/lib/generators/bootstrap/snippets/snippet_base.rb +23 -4
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +7 -9
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +8 -10
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.haml +4 -4
- data/lib/generators/bootstrap/themed/templates/index.html.slim +4 -4
- data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/new.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.haml +3 -3
- data/lib/generators/bootstrap/themed/templates/show.html.slim +3 -3
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +2 -2
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +2 -2
- data/lib/twitter/bootstrap/rails/doctor.rb +238 -0
- data/lib/twitter/bootstrap/rails/legacy_markup.rb +119 -0
- data/lib/twitter/bootstrap/rails/v6_migration.rb +156 -0
- data/lib/twitter/bootstrap/rails/version.rb +1 -1
- data/spec/lib/breadcrumbs_spec.rb +8 -2
- data/spec/lib/generators/agent_generator_spec.rb +120 -0
- data/spec/lib/generators/doctor_generator_spec.rb +272 -0
- data/spec/lib/generators/snippet_generators_spec.rb +23 -0
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +7 -3
- data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +23 -45
- data/spec/lib/twitter_bootstrap_rails/breadcrumbs_view_spec.rb +35 -0
- data/spec/lib/twitter_bootstrap_rails/flash_block_helper_spec.rb +26 -0
- data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +2 -2
- data/spec/lib/twitter_bootstrap_rails/legacy_markup_spec.rb +74 -0
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +21 -8
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +94 -92
- data/spec/lib/twitter_bootstrap_rails/v6_migration_spec.rb +98 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/support/generator_spec_helper.rb +2 -0
- metadata +24 -3
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require 'erb'
|
|
2
|
+
require 'rails/generators'
|
|
3
|
+
require 'twitter/bootstrap/rails/doctor'
|
|
4
|
+
require 'twitter/bootstrap/rails/v6_migration'
|
|
5
|
+
require 'generators/bootstrap/snippets/snippet_catalog'
|
|
6
|
+
|
|
7
|
+
module Bootstrap
|
|
8
|
+
module Generators
|
|
9
|
+
# Writes a guide for coding agents, tailored to this app and built from the
|
|
10
|
+
# same catalog and tables the other commands use, so it can't drift from them.
|
|
11
|
+
class AgentGenerator < ::Rails::Generators::Base
|
|
12
|
+
SKILL_PATH = ".claude/skills/bootstrap-rails/SKILL.md".freeze
|
|
13
|
+
AGENTS_PATH = "AGENTS.md".freeze
|
|
14
|
+
SECTION_START = "<!-- bootstrap-rails:start -->".freeze
|
|
15
|
+
SECTION_END = "<!-- bootstrap-rails:end -->".freeze
|
|
16
|
+
SKILL_DESCRIPTION = "Use when adding or changing Bootstrap UI, layouts or styles in this Rails app. " \
|
|
17
|
+
"Covers the twitter-bootstrap-rails generators, helpers and checks.".freeze
|
|
18
|
+
|
|
19
|
+
source_root File.expand_path("../templates", __FILE__)
|
|
20
|
+
desc "Writes a guide for coding agents: a Claude skill and a section in AGENTS.md"
|
|
21
|
+
|
|
22
|
+
class_option :claude, :type => :boolean, :default => true,
|
|
23
|
+
:desc => "Write #{SKILL_PATH}"
|
|
24
|
+
class_option :agents, :type => :boolean, :default => true,
|
|
25
|
+
:desc => "Write a section into #{AGENTS_PATH}, keeping the rest of the file"
|
|
26
|
+
|
|
27
|
+
def write_skill
|
|
28
|
+
return unless options[:claude]
|
|
29
|
+
|
|
30
|
+
frontmatter = "---\nname: bootstrap-rails\ndescription: #{SKILL_DESCRIPTION}\n---\n\n"
|
|
31
|
+
# :force because this file is entirely generated, and a conflict prompt
|
|
32
|
+
# would hang an agent running the command.
|
|
33
|
+
create_file SKILL_PATH, frontmatter + guide, :force => true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def write_agents_section
|
|
37
|
+
return unless options[:agents]
|
|
38
|
+
|
|
39
|
+
section = "#{SECTION_START}\n#{guide}#{SECTION_END}\n"
|
|
40
|
+
path = File.join(destination_root, AGENTS_PATH)
|
|
41
|
+
existing = File.exist?(path) ? File.read(path) : nil
|
|
42
|
+
|
|
43
|
+
if existing.nil?
|
|
44
|
+
create_file AGENTS_PATH, section
|
|
45
|
+
elsif existing.include?(SECTION_START)
|
|
46
|
+
gsub_file(AGENTS_PATH, /#{Regexp.escape(SECTION_START)}.*?#{Regexp.escape(SECTION_END)}\n?/m) { section }
|
|
47
|
+
else
|
|
48
|
+
append_to_file AGENTS_PATH, "\n#{section}"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def guide
|
|
55
|
+
@guide ||= ERB.new(File.read(File.join(self.class.source_root, "guide.md.erb")), :trim_mode => "-").result(binding)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def facts
|
|
59
|
+
@facts ||= Twitter::Bootstrap::Rails::Doctor.new(destination_root).facts
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def catalog
|
|
63
|
+
SnippetCatalog
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def legacy
|
|
67
|
+
Twitter::Bootstrap::Rails::LegacyMarkup
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def v6
|
|
71
|
+
Twitter::Bootstrap::Rails::V6Migration
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def pipeline_note
|
|
75
|
+
case facts[:asset_pipeline]
|
|
76
|
+
when "propshaft"
|
|
77
|
+
"Propshaft. It has no `require` directives, so the layout has to link Bootstrap's files by name."
|
|
78
|
+
when "sprockets"
|
|
79
|
+
"Sprockets. Bootstrap loads through Sprockets directives in the application manifests."
|
|
80
|
+
else
|
|
81
|
+
"Not detected. Run `rails g bootstrap:doctor` after installing an asset pipeline."
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Bootstrap in this app
|
|
2
|
+
|
|
3
|
+
This app uses Bootstrap <%= facts[:bootstrap_version] %> through the twitter-bootstrap-rails gem (<%= facts[:gem_version] %>). Prefer the gem's generators and helpers over writing Bootstrap markup from memory, which is often out of date.
|
|
4
|
+
|
|
5
|
+
This guide is generated. Run `rails g bootstrap:agent` again after upgrading the gem or changing the asset setup.
|
|
6
|
+
|
|
7
|
+
## This app
|
|
8
|
+
|
|
9
|
+
- Asset pipeline: <%= pipeline_note %>
|
|
10
|
+
- Bootstrap assets: <%= facts[:asset_mode] %>
|
|
11
|
+
- Template engine: <%= facts[:template_engine] %>
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. Run `rails g bootstrap:doctor --json` to see the app's current state. It writes nothing, and it exits 1 if a check reports an error.
|
|
16
|
+
2. Find a snippet with `rails g bootstrap:<name> --json`, which lists the variants and what each one needs.
|
|
17
|
+
3. Preview with `--pretend`, then run `rails g bootstrap:<name> <variant>`. Use `--as=NAME` and `--path=DIR` to choose where the partial goes.
|
|
18
|
+
4. Add the `render` call the generator prints. If it mentions the icon sprite, render that once, near the top of `<body>` in the layout.
|
|
19
|
+
5. If the generator warns about placeholder images, replace them with the app's own.
|
|
20
|
+
6. Run `rails g bootstrap:doctor --json` again and fix any errors.
|
|
21
|
+
|
|
22
|
+
Generators stop and ask before overwriting a file. Pass `--force` to overwrite or `--skip` to keep the existing file.
|
|
23
|
+
|
|
24
|
+
Snippets are always written as ERB partials. They render from any template engine.
|
|
25
|
+
|
|
26
|
+
## Snippets
|
|
27
|
+
|
|
28
|
+
| Generator | Variants (the first is the default) |
|
|
29
|
+
|---|---|
|
|
30
|
+
<% catalog::GENERATORS.each do |generator, category| -%>
|
|
31
|
+
| `bootstrap:<%= generator %>` | <%= catalog.variant_names(category).join(", ") %> |
|
|
32
|
+
<% end -%>
|
|
33
|
+
|
|
34
|
+
## Other generators
|
|
35
|
+
|
|
36
|
+
- `bootstrap:install static` or `bootstrap:install cdn`: sets up Bootstrap's assets.
|
|
37
|
+
- `bootstrap:layout [NAME]`: writes a layout that loads Bootstrap. Don't overwrite an existing layout without checking its contents first.
|
|
38
|
+
- `bootstrap:themed RESOURCE`: writes Bootstrap views for a scaffold.
|
|
39
|
+
- `bootstrap:cdn`: prints the CDN tags and writes nothing.
|
|
40
|
+
|
|
41
|
+
## View helpers
|
|
42
|
+
|
|
43
|
+
- Navigation: `nav_bar`, `menu_group`, `menu_item`, `menu_text`, `menu_divider`, `drop_down`, `drop_down_divider`, `drop_down_header`
|
|
44
|
+
- Messages: `bootstrap_flash`, `flash_block`
|
|
45
|
+
- Modals: `modal_dialog`, `modal_toggle`, `modal_cancel_button`
|
|
46
|
+
- Other: `badge`, `tag_label`, `render_breadcrumbs`, `add_breadcrumb`, and `error_span` on form builders
|
|
47
|
+
|
|
48
|
+
## Bootstrap 6
|
|
49
|
+
|
|
50
|
+
This app runs Bootstrap <%= facts[:bootstrap_version] %>. Don't write Bootstrap 6 markup (`dialog`, `drawer`, `menu`, `md:col-6`, `btn-solid theme-primary`) unless the app is being moved to Bootstrap 6: none of it works on <%= facts[:bootstrap_version] %>. The gem's generators and helpers produce Bootstrap 5 markup.
|
|
51
|
+
|
|
52
|
+
To move the app to Bootstrap 6:
|
|
53
|
+
|
|
54
|
+
1. Install the upstream migration skill: `<%= v6::SKILL_COMMAND %>`. Follow it alongside this guide.
|
|
55
|
+
2. Run `rails g bootstrap:doctor --v6 --json`. It lists every Bootstrap 5 class, data attribute, Sass import and JavaScript call that changes, with file, line and replacement, under `v6_migration`.
|
|
56
|
+
3. Switch the Bootstrap assets before changing markup, because the vendored files and `bootstrap:install` are Bootstrap 5. Re-running `bootstrap:layout`, `bootstrap:themed` or a snippet generator writes Bootstrap 5 markup again.
|
|
57
|
+
4. The helpers in "View helpers" render Bootstrap 5 markup at runtime, so the scan can't see their output. Replace them with Bootstrap 6 markup in the views that use them.
|
|
58
|
+
5. v6 changes the spacing scale (`p-3` is smaller), so check spacing utilities by eye; the scan doesn't flag them.
|
|
59
|
+
|
|
60
|
+
## Markup to avoid
|
|
61
|
+
|
|
62
|
+
These come from older Bootstrap versions and do nothing on this one. `bootstrap:doctor` reports them, with file and line, under `legacy_markup`. Plain names like `close` or `well` may be the app's own CSS classes, so check those before changing them.
|
|
63
|
+
|
|
64
|
+
Data attributes: <%= legacy::DATA_ATTRIBUTES.map { |name| "`data-#{name}`" }.join(", ") %> become `data-bs-*`.
|
|
65
|
+
|
|
66
|
+
| Old class | Use instead |
|
|
67
|
+
|---|---|
|
|
68
|
+
<% legacy::CLASSES.each do |old, replacement| -%>
|
|
69
|
+
| `<%= old %>` | <%= replacement %> |
|
|
70
|
+
<% end -%>
|
|
71
|
+
<% legacy::CLASS_PATTERNS.each do |_pattern, _replacement, example| -%>
|
|
72
|
+
| <%= example.split(" become").first %> | <%= example.split(/ becomes? /).last %> |
|
|
73
|
+
<% end -%>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'rails/generators'
|
|
3
|
+
require 'twitter/bootstrap/rails/doctor'
|
|
4
|
+
|
|
5
|
+
module Bootstrap
|
|
6
|
+
module Generators
|
|
7
|
+
# A generator rather than a rake task because rake rejects flags like --json.
|
|
8
|
+
# Writes nothing. Exits 1 if any check reports an error.
|
|
9
|
+
class DoctorGenerator < ::Rails::Generators::Base
|
|
10
|
+
desc "Checks how Bootstrap is set up in this app and finds markup from older Bootstrap versions"
|
|
11
|
+
|
|
12
|
+
class_option :json, :type => :boolean, :default => false,
|
|
13
|
+
:desc => 'Print the report as JSON'
|
|
14
|
+
class_option :v6, :type => :boolean, :default => false,
|
|
15
|
+
:desc => 'Also list Bootstrap 5 code that changes in Bootstrap 6'
|
|
16
|
+
|
|
17
|
+
def diagnose
|
|
18
|
+
report = Twitter::Bootstrap::Rails::Doctor.new(destination_root).report(:v6 => options[:v6])
|
|
19
|
+
|
|
20
|
+
options[:json] ? say(JSON.pretty_generate(report)) : print_report(report)
|
|
21
|
+
exit(1) if report[:status] == "error"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def print_report(report)
|
|
27
|
+
say "Bootstrap #{report[:bootstrap_version]} on Rails #{report[:rails_version]} " \
|
|
28
|
+
"(#{report[:asset_pipeline]}, #{report[:asset_mode]}, #{report[:template_engine]})\n"
|
|
29
|
+
|
|
30
|
+
report[:checks].each do |check|
|
|
31
|
+
say format("%-8s %-20s %s", "[#{check[:status]}]", check[:id], check[:message])
|
|
32
|
+
say " #{' ' * 20} Fix: #{check[:fix]}" if check[:fix]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
print_findings("Older Bootstrap markup", report[:legacy_markup])
|
|
36
|
+
print_findings("Changes in Bootstrap 6", report[:v6_migration])
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def print_findings(title, findings)
|
|
40
|
+
return if findings.nil? || findings.empty?
|
|
41
|
+
|
|
42
|
+
say "\n#{title}:"
|
|
43
|
+
findings.each do |finding|
|
|
44
|
+
say " #{finding[:file]}:#{finding[:line]} #{finding[:found]} -> #{finding[:replacement]}"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
<h2>Sign in</h2>
|
|
2
2
|
|
|
3
|
-
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)
|
|
4
|
-
<div class="
|
|
5
|
-
<%= f.label :email, :class => '
|
|
6
|
-
|
|
7
|
-
<%= f.email_field :email %>
|
|
8
|
-
</div>
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
|
4
|
+
<div class="mb-3">
|
|
5
|
+
<%= f.label :email, :class => 'form-label' %>
|
|
6
|
+
<%= f.email_field :email, :class => 'form-control' %>
|
|
9
7
|
</div>
|
|
10
|
-
<div class="
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<%= f.password_field :password %>
|
|
14
|
-
</div>
|
|
8
|
+
<div class="mb-3">
|
|
9
|
+
<%= f.label :password, :class => 'form-label' %>
|
|
10
|
+
<%= f.password_field :password, :class => 'form-control' %>
|
|
15
11
|
</div>
|
|
16
12
|
|
|
17
13
|
<% if devise_mapping.rememberable? -%>
|
|
18
|
-
<div class=
|
|
19
|
-
<%= f.
|
|
20
|
-
<%= f.
|
|
14
|
+
<div class="mb-3 form-check">
|
|
15
|
+
<%= f.check_box :remember_me, :class => 'form-check-input' %>
|
|
16
|
+
<%= f.label :remember_me, :class => 'form-check-label' %>
|
|
21
17
|
</div>
|
|
22
18
|
<% end -%>
|
|
23
19
|
|
|
24
|
-
<%= f.submit "Sign in", :class => 'btn btn-
|
|
20
|
+
<%= f.submit "Sign in", :class => 'btn btn-primary' %>
|
|
25
21
|
|
|
26
22
|
<% end %>
|
|
27
23
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'json'
|
|
1
2
|
require 'rails/generators'
|
|
2
3
|
require 'twitter/bootstrap/rails/version'
|
|
3
4
|
require 'generators/bootstrap/snippets/snippet_catalog'
|
|
@@ -19,6 +20,8 @@ module Bootstrap
|
|
|
19
20
|
:desc => 'Directory to write the partial into'
|
|
20
21
|
class_option :list, :type => :boolean, :default => false,
|
|
21
22
|
:desc => 'List the available variants and exit'
|
|
23
|
+
class_option :json, :type => :boolean, :default => false,
|
|
24
|
+
:desc => 'List the available variants as JSON and exit'
|
|
22
25
|
class_option :icons, :type => :boolean, :default => true,
|
|
23
26
|
:desc => 'Also install the shared Bootstrap Icons sprite when the snippet needs it'
|
|
24
27
|
|
|
@@ -37,7 +40,8 @@ module Bootstrap
|
|
|
37
40
|
end
|
|
38
41
|
|
|
39
42
|
def list_variants
|
|
40
|
-
return unless
|
|
43
|
+
return unless listing?
|
|
44
|
+
return say(JSON.pretty_generate(catalog_listing)) if options[:json]
|
|
41
45
|
|
|
42
46
|
say "#{category} variants:\n\n"
|
|
43
47
|
SnippetCatalog.variants(category).each do |v|
|
|
@@ -47,13 +51,13 @@ module Bootstrap
|
|
|
47
51
|
end
|
|
48
52
|
|
|
49
53
|
def copy_snippet
|
|
50
|
-
return if
|
|
54
|
+
return if listing?
|
|
51
55
|
|
|
52
56
|
copy_file "#{category}/#{variant_name}.html.erb", partial_path
|
|
53
57
|
end
|
|
54
58
|
|
|
55
59
|
def copy_icons
|
|
56
|
-
return if
|
|
60
|
+
return if listing?
|
|
57
61
|
return unless variant[:icons] && options[:icons]
|
|
58
62
|
|
|
59
63
|
copy_file "icons/_#{ICONS_PARTIAL}.html.erb",
|
|
@@ -61,7 +65,7 @@ module Bootstrap
|
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
def report
|
|
64
|
-
return if
|
|
68
|
+
return if listing?
|
|
65
69
|
|
|
66
70
|
say "\nRender it with: <%= render \"#{render_path}\" %>"
|
|
67
71
|
if variant[:icons] && options[:icons]
|
|
@@ -78,6 +82,21 @@ module Bootstrap
|
|
|
78
82
|
|
|
79
83
|
private
|
|
80
84
|
|
|
85
|
+
def listing?
|
|
86
|
+
options[:list] || options[:json]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def catalog_listing
|
|
90
|
+
{
|
|
91
|
+
:generator => self.class.namespace,
|
|
92
|
+
:category => category,
|
|
93
|
+
:default => SnippetCatalog.default_variant(category),
|
|
94
|
+
:variants => SnippetCatalog.variants(category).map do |v|
|
|
95
|
+
v.merge(:command => "rails g #{self.class.namespace} #{v[:name]}")
|
|
96
|
+
end
|
|
97
|
+
}
|
|
98
|
+
end
|
|
99
|
+
|
|
81
100
|
def category
|
|
82
101
|
self.class.snippet_category
|
|
83
102
|
end
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
= form_for @<%= resource_name %>, html: { class: "
|
|
1
|
+
= form_for @<%= resource_name %>, html: { class: "<%= resource_name %>" } do |f|
|
|
2
2
|
<%- columns.each do |column| -%>
|
|
3
|
-
.
|
|
4
|
-
= f.label :<%= column.name %>, class: '
|
|
5
|
-
.
|
|
6
|
-
= f.<%= column.field_type %> :<%= column.name %>, class: 'form-control', required: true
|
|
3
|
+
.mb-3
|
|
4
|
+
= f.label :<%= column.name %>, class: 'form-label'
|
|
5
|
+
= f.<%= column.field_type %> :<%= column.name %>, class: 'form-control', required: true
|
|
7
6
|
= f.error_span(:<%= column.name %>)
|
|
8
7
|
<%- end -%>
|
|
9
|
-
.
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-default'
|
|
8
|
+
.mb-3
|
|
9
|
+
= f.submit nil, class: 'btn btn-primary'
|
|
10
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-secondary'
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
= form_for @<%= resource_name %>, html: { class: "
|
|
1
|
+
= form_for @<%= resource_name %>, html: { class: "<%= resource_name %>" } do |f|
|
|
2
2
|
<%- columns.each do |column| -%>
|
|
3
|
-
.
|
|
4
|
-
= f.label :<%= column.name %>, :class => '
|
|
5
|
-
.
|
|
6
|
-
= f.<%= column.field_type %> :<%= column.name %>, :class => 'form-control'
|
|
3
|
+
.mb-3
|
|
4
|
+
= f.label :<%= column.name %>, :class => 'form-label'
|
|
5
|
+
= f.<%= column.field_type %> :<%= column.name %>, :class => 'form-control'
|
|
7
6
|
= f.error_span(:<%= column.name %>)
|
|
8
7
|
<%- end -%>
|
|
9
|
-
.
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
|
|
8
|
+
.mb-3
|
|
9
|
+
= f.submit nil, :class => 'btn btn-primary'
|
|
10
|
+
'
|
|
11
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-secondary'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%%- model_class = <%= resource_name.classify %> -%>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="border-bottom pb-2 mb-4">
|
|
3
3
|
<h1><%%=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize %></h1>
|
|
4
4
|
</div>
|
|
5
5
|
<%%= render :partial => 'form' %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
- model_class = <%= resource_name.classify %>
|
|
2
|
-
.
|
|
2
|
+
.border-bottom.pb-2.mb-4
|
|
3
3
|
%h1=t '.title', :default => model_class.model_name.human.pluralize.titleize
|
|
4
4
|
%table.table.table-striped
|
|
5
5
|
%thead
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
<%- end -%>
|
|
20
20
|
%td=l <%= resource_name %>.created_at
|
|
21
21
|
%td
|
|
22
|
-
= link_to t('.show', :default => t("helpers.links.show")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-
|
|
23
|
-
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-
|
|
24
|
-
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-
|
|
22
|
+
= link_to t('.show', :default => t("helpers.links.show")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-sm btn-secondary'
|
|
23
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-sm btn-secondary'
|
|
24
|
+
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-sm btn-danger'
|
|
25
25
|
|
|
26
26
|
= link_to t('.new', :default => t("helpers.links.new")), new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
- model_class = <%= resource_name.classify %>
|
|
2
|
-
.
|
|
2
|
+
.border-bottom.pb-2.mb-4
|
|
3
3
|
h1=t '.title', :default => model_class.model_name.human.pluralize.titleize
|
|
4
4
|
table.table.table-striped
|
|
5
5
|
thead
|
|
@@ -19,10 +19,10 @@ table.table.table-striped
|
|
|
19
19
|
<%- end -%>
|
|
20
20
|
td=l <%= resource_name %>.created_at
|
|
21
21
|
td
|
|
22
|
-
= link_to t('.show', :default => t("helpers.links.show")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-
|
|
22
|
+
= link_to t('.show', :default => t("helpers.links.show")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-sm btn-secondary'
|
|
23
23
|
'
|
|
24
|
-
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-
|
|
24
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-sm btn-secondary'
|
|
25
25
|
'
|
|
26
|
-
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-
|
|
26
|
+
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-sm btn-danger'
|
|
27
27
|
|
|
28
28
|
= link_to t('.new', :default => t("helpers.links.new")), new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%%- model_class = <%= resource_name.classify %> -%>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="border-bottom pb-2 mb-4">
|
|
3
3
|
<h1><%%=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize %></h1>
|
|
4
4
|
</div>
|
|
5
5
|
<%%= render :partial => 'form' %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
- model_class = <%= resource_name.classify %>
|
|
2
|
-
.
|
|
2
|
+
.border-bottom.pb-2.mb-4
|
|
3
3
|
%h1=t '.title', :default => model_class.model_name.human.titleize
|
|
4
4
|
|
|
5
5
|
<%- columns.each do |column| -%>
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
<%- end -%>
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
= link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn btn-
|
|
14
|
-
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn btn-
|
|
13
|
+
= link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn btn-secondary'
|
|
14
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn btn-secondary'
|
|
15
15
|
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
- model_class = <%= resource_name.classify %>
|
|
2
|
-
.
|
|
2
|
+
.border-bottom.pb-2.mb-4
|
|
3
3
|
h1=t '.title', :default => model_class.model_name.human.titleize
|
|
4
4
|
|
|
5
5
|
<%- columns.each do |column| -%>
|
|
@@ -9,8 +9,8 @@ p
|
|
|
9
9
|
= @<%= resource_name %>.<%= column.name %>
|
|
10
10
|
<%- end -%>
|
|
11
11
|
|
|
12
|
-
= link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn btn-
|
|
12
|
+
= link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn btn-secondary'
|
|
13
13
|
'
|
|
14
|
-
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn btn-
|
|
14
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn btn-secondary'
|
|
15
15
|
'
|
|
16
16
|
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%%= simple_form_for @<%= resource_name
|
|
1
|
+
<%%= simple_form_for @<%= resource_name %> do |f| %>
|
|
2
2
|
<%- columns.each do |column| -%>
|
|
3
3
|
<%%= f.input :<%= column.name %> %>
|
|
4
4
|
<%%= error_span(@<%= resource_name %>[:<%= column.name %>]) %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
= simple_form_for @<%= resource_name
|
|
1
|
+
= simple_form_for @<%= resource_name %> do |f|
|
|
2
2
|
<%- columns.each do |column| -%>
|
|
3
3
|
= f.input :<%= column.name %>
|
|
4
4
|
= f.error_span :<%= column.name %>
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
= f.button :wrapped, :cancel => <%= controller_routing_path %>_path
|
|
8
8
|
<%- else -%>
|
|
9
9
|
= f.button :submit, :class => 'btn-primary'
|
|
10
|
-
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-
|
|
10
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-secondary'
|
|
11
11
|
<%- end -%>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
= simple_form_for @<%= resource_name
|
|
1
|
+
= simple_form_for @<%= resource_name %> do |f|
|
|
2
2
|
<%- columns.each do |column| -%>
|
|
3
3
|
= f.input :<%= column.name %>
|
|
4
4
|
= error_span(@<%= resource_name %>[:<%= column.name %>])
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<%- else -%>
|
|
9
9
|
= f.button :submit, :class => 'btn-primary'
|
|
10
10
|
'
|
|
11
|
-
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-
|
|
11
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-secondary'
|
|
12
12
|
<%- end -%>
|