haml-rails 2.1.0 → 3.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 +4 -4
- data/.github/workflows/ruby.yml +55 -32
- data/CHANGELOG.md +25 -0
- data/Gemfile +21 -0
- data/README.md +8 -3
- data/haml-rails.gemspec +4 -3
- data/lib/generators/haml/authentication/authentication_generator.rb +17 -0
- data/lib/generators/haml/authentication/templates/app/views/passwords/edit.html.haml +10 -0
- data/lib/generators/haml/authentication/templates/app/views/passwords/new.html.haml +8 -0
- data/lib/generators/haml/authentication/templates/app/views/sessions/new.html.haml +12 -0
- data/lib/generators/haml/controller/controller_generator.rb +2 -0
- data/lib/generators/haml/mailer/mailer_generator.rb +2 -0
- data/lib/generators/haml/scaffold/scaffold_generator.rb +25 -10
- data/lib/generators/haml/scaffold/templates/5_1/_form.html.haml +26 -0
- data/lib/generators/haml/scaffold/templates/5_1/edit.html.haml +7 -0
- data/lib/generators/haml/scaffold/templates/5_1/index.html.haml +25 -0
- data/lib/generators/haml/scaffold/templates/5_1/new.html.haml +5 -0
- data/lib/generators/haml/scaffold/templates/5_1/show.html.haml +11 -0
- data/lib/generators/haml/scaffold/templates/5_2/_form.html.haml +26 -0
- data/lib/generators/haml/scaffold/templates/5_2/edit.html.haml +7 -0
- data/lib/generators/haml/scaffold/templates/5_2/index.html.haml +25 -0
- data/lib/generators/haml/scaffold/templates/5_2/new.html.haml +5 -0
- data/lib/generators/haml/scaffold/templates/5_2/show.html.haml +11 -0
- data/lib/generators/haml/scaffold/templates/6_0/_form.html.haml +29 -0
- data/lib/generators/haml/scaffold/templates/6_0/edit.html.haml +7 -0
- data/lib/generators/haml/scaffold/templates/6_0/index.html.haml +25 -0
- data/lib/generators/haml/scaffold/templates/6_0/new.html.haml +5 -0
- data/lib/generators/haml/scaffold/templates/6_0/show.html.haml +18 -0
- data/lib/generators/haml/scaffold/templates/6_1/_form.html.haml +29 -0
- data/lib/generators/haml/scaffold/templates/6_1/edit.html.haml +7 -0
- data/lib/generators/haml/scaffold/templates/6_1/index.html.haml +25 -0
- data/lib/generators/haml/scaffold/templates/6_1/new.html.haml +5 -0
- data/lib/generators/haml/scaffold/templates/6_1/show.html.haml +18 -0
- data/lib/generators/haml/scaffold/templates/7_0/_form.html.haml +29 -0
- data/lib/generators/haml/scaffold/templates/7_0/edit.html.haml +10 -0
- data/lib/generators/haml/scaffold/templates/7_0/index.html.haml +11 -0
- data/lib/generators/haml/scaffold/templates/7_0/new.html.haml +8 -0
- data/lib/generators/haml/scaffold/templates/7_0/partial.html.haml +14 -0
- data/lib/generators/haml/scaffold/templates/7_0/show.html.haml +10 -0
- data/lib/generators/haml/scaffold/templates/7_1 +1 -0
- data/lib/generators/haml/scaffold/templates/7_2/_form.html.haml +29 -0
- data/lib/generators/haml/scaffold/templates/7_2/edit.html.haml +12 -0
- data/lib/generators/haml/scaffold/templates/7_2/index.html.haml +13 -0
- data/lib/generators/haml/scaffold/templates/7_2/new.html.haml +10 -0
- data/lib/generators/haml/scaffold/templates/7_2/partial.html.haml +14 -0
- data/lib/generators/haml/scaffold/templates/7_2/show.html.haml +10 -0
- data/lib/generators/haml/scaffold/templates/8_0 +1 -0
- data/lib/generators/haml/scaffold/templates/8_1/_form.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/8_1/edit.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/8_1/index.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/8_1/new.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/8_1/partial.html.haml +14 -0
- data/lib/generators/haml/scaffold/templates/8_1/show.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/_form.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/edit.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/index.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/new.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/partial.html.haml +1 -0
- data/lib/generators/haml/scaffold/templates/show.html.haml +1 -0
- data/lib/haml-rails/version.rb +3 -1
- data/lib/haml-rails.rb +12 -1
- data/lib/rails/generators/haml/application_layout/application_layout_generator.rb +8 -3
- data/test/fixtures/routes.rb +2 -0
- data/test/lib/generators/haml/controller_generator_test.rb +2 -0
- data/test/lib/generators/haml/mailer_generator_test.rb +2 -0
- data/test/lib/generators/haml/scaffold_generator_test.rb +2 -0
- data/test/lib/generators/haml/scaffold_template_contents_test.rb +76 -0
- data/test/lib/haml-rails/dependency_tracker_test.rb +60 -0
- data/test/test_helper.rb +30 -7
- metadata +224 -183
- data/Appraisals +0 -19
- data/gemfiles/rails_5_1.gemfile +0 -8
- data/gemfiles/rails_5_2.gemfile +0 -8
- data/gemfiles/rails_6_0.gemfile +0 -8
- data/gemfiles/rails_6_1.gemfile +0 -8
- data/gemfiles/rails_7_0.gemfile +0 -8
- data/lib/generators/haml/scaffold/templates/_form.html.haml +0 -15
- data/lib/generators/haml/scaffold/templates/edit.html.haml +0 -7
- data/lib/generators/haml/scaffold/templates/index.html.haml +0 -25
- data/lib/generators/haml/scaffold/templates/new.html.haml +0 -5
- data/lib/generators/haml/scaffold/templates/show.html.haml +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be3a0bf741095a473f255170b23034ce05f30adc72901a005976184c94e88bd0
|
|
4
|
+
data.tar.gz: a63f77e4275deb71cb8a8cbdb9c98013f9b6487e2e9ced4bf1c44c8cdea9c2e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca52609d810eff129d39e7764c420e139467ba53f85d106f07830583e6bd3e76f672c050b30e43883f6b7443a698e2f6a6c0aa9c8ee8d46a2c7fdc05375ed75b
|
|
7
|
+
data.tar.gz: 17aba7d35c28b7b0f3bd0b22b0c7baeacba605d24ca29c7bca7558d0a2a6d9c34c831410cdc9d06ff44357fdb8dbb6339b9787ac07fe4688df2e4eb138419101
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
-
# They are provided by a third-party and are governed by
|
|
3
|
-
# separate terms of service, privacy policy, and support
|
|
4
|
-
# documentation.
|
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
-
|
|
8
1
|
name: Ruby
|
|
9
2
|
|
|
10
3
|
on:
|
|
@@ -20,38 +13,68 @@ jobs:
|
|
|
20
13
|
strategy:
|
|
21
14
|
matrix:
|
|
22
15
|
ruby-version:
|
|
23
|
-
-
|
|
24
|
-
- 3.
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
16
|
+
- '4.0'
|
|
17
|
+
- '3.4'
|
|
18
|
+
- '3.3'
|
|
19
|
+
- '3.2'
|
|
20
|
+
- '3.1'
|
|
21
|
+
rails-version:
|
|
22
|
+
- '8.1'
|
|
23
|
+
- '8.0'
|
|
24
|
+
- '7.2'
|
|
25
|
+
- '7.1'
|
|
26
|
+
- '7.0'
|
|
27
|
+
- '6.1'
|
|
31
28
|
|
|
32
29
|
include:
|
|
33
|
-
- ruby-version:
|
|
34
|
-
|
|
35
|
-
- ruby-version: 2.7
|
|
36
|
-
gemfile: rails_5_1
|
|
30
|
+
- ruby-version: '3.1'
|
|
31
|
+
rails-version: '6.0'
|
|
37
32
|
|
|
38
|
-
- ruby-version:
|
|
39
|
-
|
|
40
|
-
- ruby-version:
|
|
41
|
-
|
|
42
|
-
- ruby-version:
|
|
43
|
-
|
|
44
|
-
- ruby-version:
|
|
45
|
-
|
|
33
|
+
- ruby-version: '3.0'
|
|
34
|
+
rails-version: '7.1'
|
|
35
|
+
- ruby-version: '3.0'
|
|
36
|
+
rails-version: '7.0'
|
|
37
|
+
- ruby-version: '3.0'
|
|
38
|
+
rails-version: '6.1'
|
|
39
|
+
- ruby-version: '3.0'
|
|
40
|
+
rails-version: '6.0'
|
|
41
|
+
|
|
42
|
+
- ruby-version: '2.7'
|
|
43
|
+
rails-version: '7.1'
|
|
44
|
+
- ruby-version: '2.7'
|
|
45
|
+
rails-version: '7.0'
|
|
46
|
+
- ruby-version: '2.7'
|
|
47
|
+
rails-version: '6.1'
|
|
48
|
+
- ruby-version: '2.7'
|
|
49
|
+
rails-version: '6.0'
|
|
50
|
+
- ruby-version: '2.7'
|
|
51
|
+
rails-version: '5.2'
|
|
52
|
+
- ruby-version: '2.7'
|
|
53
|
+
rails-version: '5.1'
|
|
54
|
+
|
|
55
|
+
- ruby-version: '2.6'
|
|
56
|
+
rails-version: '6.1'
|
|
57
|
+
- ruby-version: '2.6'
|
|
58
|
+
rails-version: '6.0'
|
|
59
|
+
- ruby-version: '2.6'
|
|
60
|
+
rails-version: '5.2'
|
|
61
|
+
- ruby-version: '2.6'
|
|
62
|
+
rails-version: '5.1'
|
|
46
63
|
|
|
47
|
-
exclude:
|
|
48
64
|
- ruby-version: jruby
|
|
49
|
-
|
|
65
|
+
rails-version: '6.1'
|
|
66
|
+
|
|
67
|
+
exclude:
|
|
68
|
+
- ruby-version: '3.1'
|
|
69
|
+
rails-version: '8.1'
|
|
70
|
+
- ruby-version: '3.1'
|
|
71
|
+
rails-version: '8.0'
|
|
50
72
|
|
|
51
|
-
env:
|
|
52
|
-
|
|
73
|
+
env:
|
|
74
|
+
RUBY_VERSION: ${{ matrix.ruby-version }}
|
|
75
|
+
RAILS_VERSION: ${{ matrix.rails-version }}
|
|
53
76
|
steps:
|
|
54
|
-
- uses: actions/checkout@
|
|
77
|
+
- uses: actions/checkout@v7
|
|
55
78
|
- name: Set up Ruby
|
|
56
79
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
57
80
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Add Rails 8.1 and Ruby 4.0 support.
|
|
8
|
+
|
|
9
|
+
- Add an authentication generator that produces Haml views for
|
|
10
|
+
`rails generate authentication` (Rails 8+), generating `passwords/new`,
|
|
11
|
+
`passwords/edit`, and `sessions/new` templates.
|
|
12
|
+
[#198](https://github.com/haml/haml-rails/pull/198) (Evan Brooks)
|
|
13
|
+
|
|
14
|
+
### Bug fixes
|
|
15
|
+
|
|
16
|
+
- Fix Haml fragment cache dependency detection on Rails 8.1. Rails 8.1 tightened
|
|
17
|
+
its ERB dependency tracker to only match `render` calls inside `<% %>` tags,
|
|
18
|
+
which stopped changes to a Haml partial from busting the cache of templates
|
|
19
|
+
that render it. Haml templates now use the `:ruby` render tracker (available
|
|
20
|
+
since Rails 7.2), which compiles the template before scanning for `render`
|
|
21
|
+
calls. [#200](https://github.com/haml/haml-rails/pull/200),
|
|
22
|
+
fixes [#199](https://github.com/haml/haml-rails/issues/199) (Nick Schimek)
|
|
23
|
+
|
|
24
|
+
- Add Rails 8.1 scaffold templates. The generated scaffold partial now wraps
|
|
25
|
+
each attribute in a `<div>` (instead of `<p>`) to match Rails 8.1's output.
|
data/Gemfile
CHANGED
|
@@ -4,3 +4,24 @@ source 'https://rubygems.org'
|
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
6
|
gem 'html2haml'
|
|
7
|
+
|
|
8
|
+
if ENV['RAILS_VERSION']
|
|
9
|
+
gem 'rails', "~> #{ENV['RAILS_VERSION']}.0"
|
|
10
|
+
else
|
|
11
|
+
gem 'rails'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
if RUBY_ENGINE == 'ruby'
|
|
15
|
+
gem 'debug'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if (ENV['RUBY_VERSION'] || RUBY_VERSION) >= '3.3'
|
|
19
|
+
gem 'mutex_m'
|
|
20
|
+
gem 'base64'
|
|
21
|
+
gem 'bigdecimal'
|
|
22
|
+
gem 'drb'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if (ENV['RUBY_VERSION'] || RUBY_VERSION) >= '4.0'
|
|
26
|
+
gem 'benchmark'
|
|
27
|
+
end
|
data/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Haml-rails
|
|
2
|
-
[](https://rubygems.org/gems/haml-rails)
|
|
3
|
+
[](https://github.com/haml/haml-rails/actions/workflows/ruby.yml)
|
|
3
4
|
|
|
4
|
-
Haml-rails provides Haml generators for Rails 5. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah.
|
|
5
|
+
Haml-rails provides Haml generators for Rails 5, 6, 7, and 8. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah.
|
|
5
6
|
|
|
6
7
|
To use it, add this line to your Gemfile:
|
|
7
8
|
|
|
8
|
-
gem "haml-rails"
|
|
9
|
+
gem "haml-rails"
|
|
9
10
|
|
|
10
11
|
This ensures that:
|
|
11
12
|
|
|
@@ -23,6 +24,10 @@ to `app/views/layouts/application.html.haml` using this command:
|
|
|
23
24
|
|
|
24
25
|
$ rails generate haml:application_layout convert
|
|
25
26
|
|
|
27
|
+
This requires the html2haml gem and you can install it locally:
|
|
28
|
+
|
|
29
|
+
gem install html2haml
|
|
30
|
+
|
|
26
31
|
After the application layout file is converted successfully,
|
|
27
32
|
make sure to delete `app/views/layouts/application.html.erb`, so Rails can
|
|
28
33
|
start using `app/views/layouts/application.html.haml` instead.
|
data/haml-rails.gemspec
CHANGED
|
@@ -9,9 +9,11 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.email = ["andre@arko.net"]
|
|
10
10
|
s.homepage = "https://github.com/haml/haml-rails"
|
|
11
11
|
s.summary = "let your Gemfile do the configuring"
|
|
12
|
-
s.description = "Haml-rails provides Haml generators for Rails 5. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah."
|
|
12
|
+
s.description = "Haml-rails provides Haml generators for Rails 5.1 and above. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah."
|
|
13
13
|
s.licenses = ["MIT"]
|
|
14
14
|
|
|
15
|
+
s.metadata = { "rubygems_mfa_required" => "true" }
|
|
16
|
+
|
|
15
17
|
s.required_rubygems_version = ">= 2.0.0"
|
|
16
18
|
s.required_ruby_version = ">= 2.3.0"
|
|
17
19
|
|
|
@@ -19,12 +21,11 @@ Gem::Specification.new do |s|
|
|
|
19
21
|
s.add_dependency "activesupport", [">= 5.1"]
|
|
20
22
|
s.add_dependency "actionpack", [">= 5.1"]
|
|
21
23
|
s.add_dependency "railties", [">= 5.1"]
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
s.add_development_dependency "html2haml", [">= 1.0.1"]
|
|
24
26
|
s.add_development_dependency "rails", [">= 5.1"]
|
|
25
27
|
s.add_development_dependency "bundler"
|
|
26
28
|
s.add_development_dependency "rake"
|
|
27
|
-
s.add_development_dependency 'appraisal'
|
|
28
29
|
|
|
29
30
|
s.files = `git ls-files`.split("\n")
|
|
30
31
|
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators/erb/authentication/authentication_generator"
|
|
4
|
+
|
|
5
|
+
module Haml
|
|
6
|
+
module Generators
|
|
7
|
+
class AuthenticationGenerator < Erb::Generators::AuthenticationGenerator
|
|
8
|
+
source_root File.expand_path("../templates", __FILE__)
|
|
9
|
+
|
|
10
|
+
def create_files
|
|
11
|
+
template "app/views/passwords/new.html.haml"
|
|
12
|
+
template "app/views/passwords/edit.html.haml"
|
|
13
|
+
template "app/views/sessions/new.html.haml"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
%h1 Update your password
|
|
2
|
+
|
|
3
|
+
= tag.div(flash[:alert], style: "color:red") if flash[:alert]
|
|
4
|
+
|
|
5
|
+
= form_with url: password_path(params[:token]), method: :put do |form|
|
|
6
|
+
= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72
|
|
7
|
+
%br
|
|
8
|
+
= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72
|
|
9
|
+
%br
|
|
10
|
+
= form.submit "Save"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
%h1 Forgot your password?
|
|
2
|
+
|
|
3
|
+
= tag.div(flash[:alert], style: "color:red") if flash[:alert]
|
|
4
|
+
|
|
5
|
+
= form_with url: passwords_path do |form|
|
|
6
|
+
= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address]
|
|
7
|
+
%br
|
|
8
|
+
= form.submit "Email reset instructions"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
= tag.div(flash[:alert], style: "color:red") if flash[:alert]
|
|
2
|
+
= tag.div(flash[:notice], style: "color:green") if flash[:notice]
|
|
3
|
+
|
|
4
|
+
= form_with url: session_path do |form|
|
|
5
|
+
= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address]
|
|
6
|
+
%br
|
|
7
|
+
= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72
|
|
8
|
+
%br
|
|
9
|
+
= form.submit "Sign in"
|
|
10
|
+
%br
|
|
11
|
+
|
|
12
|
+
= link_to "Forgot password?", new_password_path
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rails/generators/erb/scaffold/scaffold_generator'
|
|
2
4
|
|
|
3
5
|
module Haml
|
|
@@ -5,31 +7,44 @@ module Haml
|
|
|
5
7
|
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
6
8
|
source_root File.expand_path("../templates", __FILE__)
|
|
7
9
|
|
|
10
|
+
argument :attributes, type: :array, default: [], banner: "field:type field:type"
|
|
11
|
+
|
|
12
|
+
hook_for :form_builder, :as => :scaffold
|
|
13
|
+
|
|
8
14
|
def copy_view_files
|
|
9
15
|
available_views.each do |view|
|
|
10
|
-
|
|
11
|
-
template "#{view}.html.haml", File.join("app/views", controller_file_path, filename)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
16
|
+
next if (view == '_form') && !options[:form_builder].nil?
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
template_filename = find_template_for_rails_version view
|
|
19
|
+
filename = filename_with_extensions view
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
template template_filename, File.join('app/views', controller_file_path, filename)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
if ::Rails::VERSION::MAJOR >= 7
|
|
25
|
+
template find_template_for_rails_version('partial'), File.join('app/views', controller_file_path, "_#{singular_name}.html.haml")
|
|
21
26
|
end
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
private
|
|
25
30
|
|
|
26
31
|
def available_views
|
|
27
|
-
%w(index edit show new)
|
|
32
|
+
%w(index edit show new _form)
|
|
28
33
|
end
|
|
29
34
|
|
|
30
35
|
def handler
|
|
31
36
|
:haml
|
|
32
37
|
end
|
|
38
|
+
|
|
39
|
+
def find_template_for_rails_version(view)
|
|
40
|
+
find_in_source_paths "#{rails_version}/#{view}.html.haml"
|
|
41
|
+
rescue Thor::Error
|
|
42
|
+
"#{view}.html.haml"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def rails_version
|
|
46
|
+
@rails_version ||= "#{::Rails::VERSION::MAJOR}_#{::Rails::VERSION::MINOR}"
|
|
47
|
+
end
|
|
33
48
|
end
|
|
34
49
|
end
|
|
35
50
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
= form_with(model: <%= singular_table_name %>, local: true) do |form|
|
|
2
|
+
- if <%= singular_table_name %>.errors.any?
|
|
3
|
+
%div{id: "error_explanation"}
|
|
4
|
+
%h2= "#{pluralize(<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
|
5
|
+
|
|
6
|
+
%ul
|
|
7
|
+
- <%= singular_table_name %>.errors.full_messages.each do |message|
|
|
8
|
+
%li= message
|
|
9
|
+
|
|
10
|
+
<% attributes.each do |attribute| -%>
|
|
11
|
+
%div{class: "field"}
|
|
12
|
+
<% if attribute.password_digest? -%>
|
|
13
|
+
= form.label :password
|
|
14
|
+
= form.password_field :password, id: :<%= field_id(:password) %>
|
|
15
|
+
|
|
16
|
+
%div{class: "field"}
|
|
17
|
+
= form.label :password_confirmation
|
|
18
|
+
= form.password_field :password_confirmation, id: :<%= field_id(:password_confirmation) %>
|
|
19
|
+
<% else -%>
|
|
20
|
+
= form.label :<%= attribute.column_name %>
|
|
21
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>, id: :<%= field_id(attribute.column_name) %>
|
|
22
|
+
<% end -%>
|
|
23
|
+
|
|
24
|
+
<% end -%>
|
|
25
|
+
%div{class: "actions"}
|
|
26
|
+
= form.submit
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
%p{id: "notice"}= notice
|
|
2
|
+
|
|
3
|
+
%h1 <%= plural_table_name.titleize %>
|
|
4
|
+
|
|
5
|
+
%table
|
|
6
|
+
%thead
|
|
7
|
+
%tr
|
|
8
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
9
|
+
%th <%= attribute.human_name %>
|
|
10
|
+
<% end -%>
|
|
11
|
+
%th{colspan: "3"}
|
|
12
|
+
|
|
13
|
+
%tbody
|
|
14
|
+
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
|
15
|
+
%tr
|
|
16
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
17
|
+
%td= <%= singular_table_name %>.<%= attribute.name %>
|
|
18
|
+
<% end -%>
|
|
19
|
+
%td= link_to 'Show', <%= singular_table_name %>
|
|
20
|
+
%td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
|
|
21
|
+
%td= link_to 'Destroy', <%= singular_table_name %>, method: :delete, data: { confirm: 'Are you sure?' }
|
|
22
|
+
|
|
23
|
+
%br
|
|
24
|
+
|
|
25
|
+
= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_table_name %>_path
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
%p{id: "notice"}= notice
|
|
2
|
+
|
|
3
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
4
|
+
%p
|
|
5
|
+
%strong <%= attribute.human_name %>:
|
|
6
|
+
= @<%= singular_table_name %>.<%= attribute.name %>
|
|
7
|
+
|
|
8
|
+
<% end -%>
|
|
9
|
+
= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
|
|
10
|
+
|
|
|
11
|
+
= link_to 'Back', <%= index_helper %>_path
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
= form_with(model: <%= model_resource_name %>, local: true) do |form|
|
|
2
|
+
- if <%= singular_table_name %>.errors.any?
|
|
3
|
+
%div{id: "error_explanation"}
|
|
4
|
+
%h2= "#{pluralize(<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
|
5
|
+
|
|
6
|
+
%ul
|
|
7
|
+
- <%= singular_table_name %>.errors.full_messages.each do |message|
|
|
8
|
+
%li= message
|
|
9
|
+
|
|
10
|
+
<% attributes.each do |attribute| -%>
|
|
11
|
+
%div{class: "field"}
|
|
12
|
+
<% if attribute.password_digest? -%>
|
|
13
|
+
= form.label :password
|
|
14
|
+
= form.password_field :password
|
|
15
|
+
|
|
16
|
+
%div{class: "field"}
|
|
17
|
+
= form.label :password_confirmation
|
|
18
|
+
= form.password_field :password_confirmation
|
|
19
|
+
<% else -%>
|
|
20
|
+
= form.label :<%= attribute.column_name %>
|
|
21
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>
|
|
22
|
+
<% end -%>
|
|
23
|
+
|
|
24
|
+
<% end -%>
|
|
25
|
+
%div{class: "actions"}
|
|
26
|
+
= form.submit
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
%p{id: "notice"}= notice
|
|
2
|
+
|
|
3
|
+
%h1 <%= plural_table_name.titleize %>
|
|
4
|
+
|
|
5
|
+
%table
|
|
6
|
+
%thead
|
|
7
|
+
%tr
|
|
8
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
9
|
+
%th <%= attribute.human_name %>
|
|
10
|
+
<% end -%>
|
|
11
|
+
%th{colspan: "3"}
|
|
12
|
+
|
|
13
|
+
%tbody
|
|
14
|
+
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
|
15
|
+
%tr
|
|
16
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
17
|
+
%td= <%= singular_table_name %>.<%= attribute.name %>
|
|
18
|
+
<% end -%>
|
|
19
|
+
%td= link_to 'Show', <%= model_resource_name %>
|
|
20
|
+
%td= link_to 'Edit', edit_<%= singular_route_name %>_path(<%= singular_table_name %>)
|
|
21
|
+
%td= link_to 'Destroy', <%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' }
|
|
22
|
+
|
|
23
|
+
%br
|
|
24
|
+
|
|
25
|
+
= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_route_name %>_path
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
%p{id: "notice"}= notice
|
|
2
|
+
|
|
3
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
4
|
+
%p
|
|
5
|
+
%strong <%= attribute.human_name %>:
|
|
6
|
+
= @<%= singular_table_name %>.<%= attribute.name %>
|
|
7
|
+
|
|
8
|
+
<% end -%>
|
|
9
|
+
= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
|
|
10
|
+
|
|
|
11
|
+
= link_to 'Back', <%= index_helper %>_path
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
= form_with(model: <%= model_resource_name %>, local: true) do |form|
|
|
2
|
+
- if <%= singular_table_name %>.errors.any?
|
|
3
|
+
%div{id: "error_explanation"}
|
|
4
|
+
%h2= "#{pluralize(<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
|
5
|
+
|
|
6
|
+
%ul
|
|
7
|
+
- <%= singular_table_name %>.errors.full_messages.each do |message|
|
|
8
|
+
%li= message
|
|
9
|
+
|
|
10
|
+
<% attributes.each do |attribute| -%>
|
|
11
|
+
%div{class: "field"}
|
|
12
|
+
<% if attribute.password_digest? -%>
|
|
13
|
+
= form.label :password
|
|
14
|
+
= form.password_field :password
|
|
15
|
+
|
|
16
|
+
%div{class: "field"}
|
|
17
|
+
= form.label :password_confirmation
|
|
18
|
+
= form.password_field :password_confirmation
|
|
19
|
+
<% elsif attribute.attachments? -%>
|
|
20
|
+
= form.label :<%= attribute.column_name %>
|
|
21
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true
|
|
22
|
+
<% else -%>
|
|
23
|
+
= form.label :<%= attribute.column_name %>
|
|
24
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>
|
|
25
|
+
<% end -%>
|
|
26
|
+
|
|
27
|
+
<% end -%>
|
|
28
|
+
%div{class: "actions"}
|
|
29
|
+
= form.submit
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
%p{id: "notice"}= notice
|
|
2
|
+
|
|
3
|
+
%h1 <%= plural_table_name.titleize %>
|
|
4
|
+
|
|
5
|
+
%table
|
|
6
|
+
%thead
|
|
7
|
+
%tr
|
|
8
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
9
|
+
%th <%= attribute.human_name %>
|
|
10
|
+
<% end -%>
|
|
11
|
+
%th{colspan: "3"}
|
|
12
|
+
|
|
13
|
+
%tbody
|
|
14
|
+
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
|
15
|
+
%tr
|
|
16
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
17
|
+
%td= <%= singular_table_name %>.<%= attribute.column_name %>
|
|
18
|
+
<% end -%>
|
|
19
|
+
%td= link_to 'Show', <%= model_resource_name %>
|
|
20
|
+
%td= link_to 'Edit', edit_<%= singular_route_name %>_path(<%= singular_table_name %>)
|
|
21
|
+
%td= link_to 'Destroy', <%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' }
|
|
22
|
+
|
|
23
|
+
%br
|
|
24
|
+
|
|
25
|
+
= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_route_name %>_path
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
%p{id: "notice"}= notice
|
|
2
|
+
|
|
3
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
4
|
+
%p
|
|
5
|
+
%strong <%= attribute.human_name %>:
|
|
6
|
+
<% if attribute.attachment? -%>
|
|
7
|
+
= link_to @<%= singular_table_name %>.<%= attribute.column_name %>.filename, @<%= singular_table_name %>.<%= attribute.column_name %> if @<%= singular_table_name %>.<%= attribute.column_name %>.attached?
|
|
8
|
+
<% elsif attribute.attachments? -%>
|
|
9
|
+
- @<%= singular_table_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>|
|
|
10
|
+
%div= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %>
|
|
11
|
+
<% else -%>
|
|
12
|
+
= @<%= singular_table_name %>.<%= attribute.column_name %>
|
|
13
|
+
<% end -%>
|
|
14
|
+
|
|
15
|
+
<% end -%>
|
|
16
|
+
= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
|
|
17
|
+
|
|
|
18
|
+
= link_to 'Back', <%= index_helper %>_path
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
= form_with(model: <%= model_resource_name %>) do |form|
|
|
2
|
+
- if <%= singular_table_name %>.errors.any?
|
|
3
|
+
%div{id: "error_explanation"}
|
|
4
|
+
%h2= "#{pluralize(<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
|
5
|
+
|
|
6
|
+
%ul
|
|
7
|
+
- <%= singular_table_name %>.errors.each do |error|
|
|
8
|
+
%li= error.full_message
|
|
9
|
+
|
|
10
|
+
<% attributes.each do |attribute| -%>
|
|
11
|
+
%div{class: "field"}
|
|
12
|
+
<% if attribute.password_digest? -%>
|
|
13
|
+
= form.label :password
|
|
14
|
+
= form.password_field :password
|
|
15
|
+
|
|
16
|
+
%div{class: "field"}
|
|
17
|
+
= form.label :password_confirmation
|
|
18
|
+
= form.password_field :password_confirmation
|
|
19
|
+
<% elsif attribute.attachments? -%>
|
|
20
|
+
= form.label :<%= attribute.column_name %>
|
|
21
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true
|
|
22
|
+
<% else -%>
|
|
23
|
+
= form.label :<%= attribute.column_name %>
|
|
24
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>
|
|
25
|
+
<% end -%>
|
|
26
|
+
|
|
27
|
+
<% end -%>
|
|
28
|
+
%div{class: "actions"}
|
|
29
|
+
= form.submit
|