advanced_haml_scaffold_generator 1.0.3 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3cc8b85d517c680c4a0a2e776232fcab61cfc42a
4
- data.tar.gz: 75218a88d4a47cbe770f7aeaa0d4132401b2dc08
2
+ SHA256:
3
+ metadata.gz: fef652438f66d749087ba82ed59a7fbc08fc6ac733f7ab23b4e211bd50fa4da1
4
+ data.tar.gz: c8d01a88e1097e479311295cb7e056133e2b64ba83a36d4d0715183c947ae8ce
5
5
  SHA512:
6
- metadata.gz: 3ca4ff1766bfc79bba7820a67dbebe9d569c4cb4e3bd7715e018fe3752afa30c6cce4a4348bb235ec51ec79fa2141339dcf5198a9ddf7ade65e4164b32c66638
7
- data.tar.gz: 76aea0880a458cf16f93d42f7510ddf97205828b61db06f3acbae775850402000be376e1791fc63f2af05a5f7b47d7256a722da13fad45ef3f3eccaf894ed3af
6
+ metadata.gz: e9abf6cbba9b17d981b21c175c1f83b06ec6c06d803f2792b2205591d607836e2f7caf5c6853e10f14ae1e528922bb83ffb4d0b91b8e95d517fba90a04cfd64a
7
+ data.tar.gz: a646413cf08486fcc15f51f5586de56e868ed4a4f53b6af3cb03b1a702bfb68ff187e9bb1e928d9879abb20d44e0b6924947ff1b19a46c947a14e0dc8de23de1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 2.2.1
@@ -2,18 +2,18 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: advanced_haml_scaffold_generator 1.0.3 ruby lib
5
+ # stub: advanced_haml_scaffold_generator 2.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "advanced_haml_scaffold_generator"
9
- s.version = "1.0.3"
8
+ s.name = "advanced_haml_scaffold_generator".freeze
9
+ s.version = "2.2.1"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Dmitri Koulikoff"]
14
- s.date = "2015-07-01"
15
- s.description = "Extention of the haml generator that generates templates with the use of i18n, cancan and WiceGrid, adds classes to buttons and uses :title helper"
16
- s.email = "dima@koulikoff.ru"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Dmitri Koulikoff".freeze]
14
+ s.date = "2020-06-17"
15
+ s.description = "Extention of the haml generator that generates templates with the use of i18n, cancan and WiceGrid, adds classes to buttons and uses :title helper".freeze
16
+ s.email = "dima@koulikoff.ru".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
19
19
  "README.rdoc"
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "lib/rails/generators/haml/base.rb",
31
31
  "lib/rails/generators/haml/scaffold/scaffold_generator.rb",
32
32
  "lib/rails/generators/haml/scaffold/templates/_form.html.haml",
33
+ "lib/rails/generators/haml/scaffold/templates/destroy.js.coffee",
33
34
  "lib/rails/generators/haml/scaffold/templates/edit.html.haml",
34
35
  "lib/rails/generators/haml/scaffold/templates/index.html.haml",
35
36
  "lib/rails/generators/haml/scaffold/templates/layout.html.haml",
@@ -38,33 +39,27 @@ Gem::Specification.new do |s|
38
39
  "spec/advanced_haml_scaffold_generator_spec.rb",
39
40
  "spec/spec_helper.rb"
40
41
  ]
41
- s.homepage = "http://github.com/dima4p/advanced_haml_scaffold_generator"
42
- s.licenses = ["MIT"]
43
- s.rubygems_version = "2.2.2"
44
- s.summary = "Extention of the haml generator that is aware of i18n and so forth"
42
+ s.homepage = "http://github.com/dima4p/advanced_haml_scaffold_generator".freeze
43
+ s.licenses = ["MIT".freeze]
44
+ s.rubygems_version = "3.1.2".freeze
45
+ s.summary = "Extention of the haml generator that is aware of i18n and so forth".freeze
45
46
 
46
47
  if s.respond_to? :specification_version then
47
48
  s.specification_version = 4
49
+ end
48
50
 
49
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_development_dependency(%q<rspec>, ["~> 3.1"])
51
- s.add_development_dependency(%q<rdoc>, ["~> 4.1"])
52
- s.add_development_dependency(%q<bundler>, ["~> 1.6"])
53
- s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
54
- s.add_development_dependency(%q<simplecov>, ["~> 0.0"])
55
- else
56
- s.add_dependency(%q<rspec>, ["~> 3.1"])
57
- s.add_dependency(%q<rdoc>, ["~> 4.1"])
58
- s.add_dependency(%q<bundler>, ["~> 1.6"])
59
- s.add_dependency(%q<jeweler>, ["~> 2.0"])
60
- s.add_dependency(%q<simplecov>, ["~> 0.0"])
61
- end
51
+ if s.respond_to? :add_runtime_dependency then
52
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.1"])
53
+ s.add_development_dependency(%q<rdoc>.freeze, ["~> 4.1"])
54
+ s.add_development_dependency(%q<bundler>.freeze, ["~> 1.6"])
55
+ s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.0"])
56
+ s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.0"])
62
57
  else
63
- s.add_dependency(%q<rspec>, ["~> 3.1"])
64
- s.add_dependency(%q<rdoc>, ["~> 4.1"])
65
- s.add_dependency(%q<bundler>, ["~> 1.6"])
66
- s.add_dependency(%q<jeweler>, ["~> 2.0"])
67
- s.add_dependency(%q<simplecov>, ["~> 0.0"])
58
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.1"])
59
+ s.add_dependency(%q<rdoc>.freeze, ["~> 4.1"])
60
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.6"])
61
+ s.add_dependency(%q<jeweler>.freeze, ["~> 2.0"])
62
+ s.add_dependency(%q<simplecov>.freeze, ["~> 0.0"])
68
63
  end
69
64
  end
70
65
 
@@ -21,6 +21,10 @@ module Haml
21
21
  copy_view :index
22
22
  end
23
23
 
24
+ def copy_destroy_file
25
+ copy_coffee :destroy
26
+ end
27
+
24
28
  def copy_edit_file
25
29
  copy_view :edit
26
30
  end
@@ -43,9 +47,14 @@ module Haml
43
47
  end
44
48
 
45
49
  protected
46
- def copy_view(view)
50
+
51
+ def copy_coffee(view)
52
+ template "#{view}.js.coffee", File.join("app/views", controller_file_path, "#{view}.js.coffee")
53
+ end
54
+
55
+ def copy_view(view)
47
56
  template "#{view}.html.haml", File.join("app/views", controller_file_path, "#{view}.html.haml")
48
- end
57
+ end
49
58
  end
50
59
  end
51
60
  end
@@ -1,25 +1,31 @@
1
1
  <% if Gem::Specification.map(&:name).include?('simple_form') -%>
2
- = simple_form_for(@<%= singular_table_name %>) do |f|
2
+ = simple_form_for(<%= singular_table_name %>) do |f|
3
3
  = f.error_notification
4
4
 
5
5
  .form-inputs
6
6
  <%- attributes.each do |attribute| -%>
7
- = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.column_name %>
8
7
  <% if attribute.password_digest? -%>
8
+ = f.input :password
9
9
  = f.input :password_confirmation
10
+ <% else -%>
11
+ <% if attribute.reference? -%>
12
+ = f.association :<%= attribute.column_name.gsub(/_id$/, '') %>, prompt: t('.<%= attribute.column_name.gsub(/_id$/, '') %>', default: 'Choose')
13
+ <% else -%>
14
+ = f.input :<%= attribute.column_name %>
15
+ <% end -%>
10
16
  <% end -%>
11
17
  <%- end -%>
12
18
 
13
19
  .form-actions
14
20
  = f.button :submit
15
21
  <% else -%>
16
- = form_for(@<%= singular_table_name %>) do |f|
17
- - if @<%= singular_table_name %>.errors.any?
22
+ = form_for(<%= singular_table_name %>) do |f|
23
+ - if <%= singular_table_name %>.errors.any?
18
24
  #error_explanation
19
25
  %h2
20
- = t 'errors.template.header', model: t('.<%= singular_table_name %>'), count: @<%= singular_table_name %>.errors.count
26
+ = t 'errors.template.header', model: t('.<%= singular_name %>'), count: <%= singular_name %>.errors.count
21
27
  %ul
22
- - @<%= singular_table_name %>.errors.full_messages.each do |msg|
28
+ - <%= singular_table_name %>.errors.full_messages.each do |msg|
23
29
  %li= msg
24
30
 
25
31
  <% for attribute in attributes -%>
@@ -0,0 +1,4 @@
1
+ url = '<%%= <%= singular_name %>_path @<%= singular_name %> %>'
2
+ line = $("a[href='#{url}']").closest('tr')
3
+ line.fadeOut 1000, ->
4
+ line.remove()
@@ -10,4 +10,5 @@
10
10
  = link_to t('back'), <%= plural_name %>_path, class: 'index'
11
11
  = link_to t('show'), @<%= singular_name %>, class: 'show'
12
12
  <% end -%>
13
- = render 'form'
13
+
14
+ = render 'form', <%= singular_table_name %>: @<%= singular_table_name %>
@@ -14,11 +14,11 @@
14
14
  <% for attribute in attributes.reject(&:password_digest?) -%>
15
15
  <% if attribute.reference? -%>
16
16
  - g.column name: <%= class_name %>.human_attribute_name(:<%= attribute.name %>),
17
- :attribute => '<%= attribute.name %>_id' do |<%= singular_table_name %>|
17
+ class: '<%= attribute.name %>', attribute: '<%= attribute.name %>_id' do |<%= singular_table_name %>|
18
18
  - <%= singular_table_name %>.<%= attribute.name %>.try :name
19
19
  <% else -%>
20
20
  - g.column name: <%= class_name %>.human_attribute_name(:<%= attribute.name %>),
21
- :attribute => '<%= attribute.name %>' do |<%= singular_table_name %>|
21
+ class: '<%= attribute.name %>', attribute: '<%= attribute.name %>' do |<%= singular_table_name %>|
22
22
  - <%= singular_table_name %>.<%= attribute.name %>
23
23
  <% end -%>
24
24
  <% end -%>
@@ -51,16 +51,16 @@
51
51
  <% for attribute in attributes.reject(&:password_digest?) -%>
52
52
  %th= <%= class_name %>.human_attribute_name :<%= attribute.name %>
53
53
  <% end -%>
54
- %th{:colspan => 3}= t 'actions'
54
+ %th{colspan: 3}= t 'actions'
55
55
 
56
56
  %tbody
57
57
  - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
58
- %tr{ :class => cycle(:odd, :even) }
58
+ %tr{class: cycle(:odd, :even)}
59
59
  <% for attribute in attributes.reject(&:password_digest?) -%>
60
60
  <% if attribute.reference? -%>
61
- %td= <%= singular_table_name %>.<%= attribute.name %>.try :name
61
+ %td.<%= attribute.name %>= <%= singular_table_name %>.<%= attribute.name %>.try :name
62
62
  <% else -%>
63
- %td= <%= singular_table_name %>.<%= attribute.name %>
63
+ %td.<%= attribute.name %>= <%= singular_table_name %>.<%= attribute.name %>
64
64
  <% end -%>
65
65
  <% end -%>
66
66
  <% if options[:cancan] -%>
@@ -79,7 +79,7 @@
79
79
  %td.action= link_to t('show'), <%= singular_table_name %>, class: 'show'
80
80
  %td.action= link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit'
81
81
  %td.action= link_to t('destroy'), <%= singular_table_name %>,
82
- data: {confirm: t('.confirm', :default => 'Are you sure?')},
82
+ data: {confirm: t('.confirm', default: 'Are you sure?')},
83
83
  method: :delete, class: 'destroy'
84
84
  <% end -%>
85
85
  <% else -%>
@@ -89,11 +89,11 @@
89
89
  <% for attribute in attributes.reject(&:password_digest?) -%>
90
90
  %th= <%= class_name %>.human_attribute_name :<%= attribute.name %>
91
91
  <% end -%>
92
- %th{:colspan => 3}= t 'actions'
92
+ %th{colspan: 3}= t 'actions'
93
93
 
94
94
  %tbody
95
95
  - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
96
- %tr{ :class => cycle(:odd, :even) }
96
+ %tr{class: cycle(:odd, :even)}
97
97
  <% for attribute in attributes.reject(&:password_digest?) -%>
98
98
  <% if attribute.reference? -%>
99
99
  %td= <%= singular_table_name %>.<%= attribute.name %>.try :name
@@ -117,7 +117,7 @@
117
117
  %td.action= link_to t('show'), <%= singular_table_name %>, class: 'show'
118
118
  %td.action= link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit'
119
119
  %td.action= link_to t('destroy'), <%= singular_table_name %>,
120
- data: {confirm: t('.confirm', :default => 'Are you sure?')},
120
+ data: {confirm: t('.confirm', default: 'Are you sure?')},
121
121
  method: :delete, class: 'destroy'
122
122
  <% end -%>
123
123
  <% end -%>
@@ -5,7 +5,7 @@
5
5
  = yield(:title) || "Untitled"
6
6
  |
7
7
  = t :application_name
8
- %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
8
+ %meta{"http-equiv"=>"Content-Type", content: "text/html; charset=utf-8"}/
9
9
  = favicon_link_tag 'application.ico'
10
10
  = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
11
11
  = javascript_include_tag 'application', 'data-turbolinks-track' => true
@@ -14,15 +14,15 @@
14
14
  = csrf_meta_tag
15
15
  = yield(:head)
16
16
 
17
- %body{:lang => I18n.locale,
18
- :class => [controller.controller_name, controller.action_name, yield(:body_class)]}
17
+ %body{lang: I18n.locale,
18
+ class: [controller.controller_name, controller.action_name, yield(:body_class)]}
19
19
  -# @debug_ability.each do |ability|
20
20
  %p
21
21
  = ability.inspect
22
22
  #container
23
23
  #content
24
24
  - flash.each do |name, msg|
25
- = content_tag :div, msg.html_safe, :id => "flash_#{name}"
25
+ = content_tag :div, msg.html_safe, id: "flash_#{name}"
26
26
 
27
27
  - if respond_to?(:show_title?) and show_title?
28
28
  %h1
@@ -7,4 +7,4 @@
7
7
  %p= link_to t('back'), <%= index_helper %>_path, class: 'index'
8
8
  <% end -%>
9
9
 
10
- = render 'form'
10
+ = render 'form', <%= singular_table_name %>: @<%= singular_table_name %>
@@ -15,8 +15,8 @@
15
15
  <% for attribute in attributes.reject(&:password_digest?) -%>
16
16
  %dt= <%= class_name %>.human_attribute_name :<%= attribute.name %>
17
17
  <% if attribute.reference? -%>
18
- %dd= @<%= singular_table_name %>.<%= attribute.name %>.try :name
18
+ %dd.<%= attribute.name %>= @<%= singular_table_name %>.<%= attribute.name %>.try :name
19
19
  <% else -%>
20
- %dd= @<%= singular_table_name %>.<%= attribute.name %>
20
+ %dd.<%= attribute.name %>= @<%= singular_table_name %>.<%= attribute.name %>
21
21
  <% end -%>
22
22
  <% end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: advanced_haml_scaffold_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -100,6 +100,7 @@ files:
100
100
  - lib/rails/generators/haml/base.rb
101
101
  - lib/rails/generators/haml/scaffold/scaffold_generator.rb
102
102
  - lib/rails/generators/haml/scaffold/templates/_form.html.haml
103
+ - lib/rails/generators/haml/scaffold/templates/destroy.js.coffee
103
104
  - lib/rails/generators/haml/scaffold/templates/edit.html.haml
104
105
  - lib/rails/generators/haml/scaffold/templates/index.html.haml
105
106
  - lib/rails/generators/haml/scaffold/templates/layout.html.haml
@@ -126,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  - !ruby/object:Gem::Version
127
128
  version: '0'
128
129
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.2.2
130
+ rubygems_version: 3.1.2
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Extention of the haml generator that is aware of i18n and so forth