hot-glue 0.3.9 → 0.4.0

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
2
  SHA256:
3
- metadata.gz: b43859a9d9550d50e2afb38b0a340bdbafd2c0cfc48864fca79134fa0ce96a73
4
- data.tar.gz: 566e3be087670f1bd4eb7a869a67934d576ed854f0c975437cd8fa04043f634d
3
+ metadata.gz: c3f0bea54517d12d4518615c1807c783ec6cdbf1ea5c40eb8860771262929d82
4
+ data.tar.gz: 3e7aa8a54329f8d7601b7597477ec5010f2e7af8dd034173ab8ac7adff5e8aa1
5
5
  SHA512:
6
- metadata.gz: 0d7fb818064534ad24e0b069c8355b7cb677a87ebc45e5f2c1da4cf148eb824200c82bf29ec1effb9dada56144279f858cc92fb85d36e6727e927fef84e9fc7e
7
- data.tar.gz: 60bf9b8a843018bbba2d9457b99f212445dc51ca288e97f04940e17e9c25af72c586aa4c4fbbecf3bac900b0df1e844b80e62f3d276bbd7aa733fe60fb74f607
6
+ metadata.gz: fb01610edb92fae69b0db9eab7e25eb4595abc6952789c1f816b6b9e8910f86a37bf713e394a73676e691f9c7fdfb5b3488ba05bdae21bb8cbe01e5008086a87
7
+ data.tar.gz: 2d932ad6bda29b971ab7252b6fecbf120f05089a65b5bbcdca588aa24fd459b2b727d310a81735008c26a17beedd449d7d58258701f43a3be305edd26373f577
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.3.5)
4
+ hot-glue (0.3.9)
5
5
  ffaker (~> 2.16)
6
6
  kaminari (~> 1.2)
7
7
  rails (> 5.1, <= 7.0.0)
@@ -42,6 +42,9 @@ module HotGlue
42
42
  exit
43
43
  end
44
44
 
45
+
46
+
47
+
45
48
  @markup = options['markup']
46
49
  if @markup == "haml"
47
50
  copy_file "haml/_flash_notices.haml", "#{'spec/dummy/' if Rails.env.test?}app/views/layouts/_flash_notices.haml"
@@ -21,7 +21,7 @@ module HotGlue
21
21
  magic_buttons.collect{ |button_name|
22
22
  "<%= form_with model: #{singular}, url: #{path_helper_singular}(#{path_helper_args}) do |f| %>
23
23
  <%= f.hidden_field :#{button_name}, value: \"#{button_name}\" %>
24
- <%= f.submit '#{button_name.titleize}'.html_safe, disabled: (schedule.respond_to?(:#{button_name}able?) && ! schedule.#{button_name}able? ), data: {confirm: 'Are you sure you want to #{button_name} this #{singular}?'}, class: '#{singular}-button btn btn-primary ' %>
24
+ <%= f.submit '#{button_name.titleize}'.html_safe, disabled: (#{singular}.respond_to?(:#{button_name}able?) && ! #{singular}.#{button_name}able? ), data: {confirm: 'Are you sure you want to #{button_name} this #{singular}?'}, class: '#{singular}-button btn btn-primary ' %>
25
25
  <% end %>"
26
26
  }.join("\n")
27
27
  end
@@ -52,6 +52,7 @@ module HotGlue
52
52
  class_option :no_delete, type: :boolean, default: false
53
53
  class_option :no_create, type: :boolean, default: false
54
54
  class_option :no_edit, type: :boolean, default: false
55
+ class_option :no_list, type: :boolean, default: false
55
56
  class_option :no_paginate, type: :boolean, default: false
56
57
  class_option :big_edit, type: :boolean, default: false
57
58
  class_option :show_only, type: :string, default: ""
@@ -164,6 +165,8 @@ module HotGlue
164
165
  @big_edit = options['big_edit']
165
166
 
166
167
  @no_edit = options['no_edit'] || false
168
+ @no_list = options['no_list'] || false
169
+
167
170
  @display_list_after_update = options['display_list_after_update'] || false
168
171
 
169
172
 
@@ -796,16 +799,18 @@ module HotGlue
796
799
 
797
800
  def controller_magic_button_update_actions
798
801
  @magic_buttons.collect{ |magic_button|
799
- " begin
800
- if #{singular}_params[:#{magic_button}]
802
+ " if #{singular}_params[:#{magic_button}]
803
+ begin
801
804
  res = @#{singular}.#{magic_button}!
802
805
  res = \"#{magic_button.titleize}ed.\" if res === true
803
806
  flash[:notice] = (flash[:notice] || \"\") << (res ? res + \" \" : \"\")
807
+ rescue ActiveRecord::RecordInvalid => e
808
+ @#{singular}.errors.add(:base, e.message)
809
+ flash[:alert] = (flash[:alert] || \"\") << 'There was ane error #{magic_button}ing your #{@singular}: '
804
810
  end
805
- rescue ActiveRecord::RecordInvalid => e
806
- @#{singular}.errors.add(:base, e.message)
807
- flash[:alert] = (flash[:alert] || \"\") << 'There was ane error #{magic_button}ing your #{@singular}: '
808
- end" }.join("\n") + "\n"
811
+ end"
812
+
813
+ }.join("\n") + "\n"
809
814
  end
810
815
 
811
816
  def controller_update_params_tap_away_magic_buttons
@@ -1,10 +1,10 @@
1
1
  <\%= turbo_frame_tag "<%= plural %>-list" <%= nested_for_turbo_id_list_constructor %> do %>
2
2
  <div class="<%= @container_name %> scaffold-list">
3
- <% unless @nested_args.any? %><h4><%= plural.gsub("_", " ").upcase %></h4><% end %>
3
+ <% unless @no_list || @nested_args.any? %><h4><%= plural.gsub("_", " ").upcase %></h4><% end %>
4
4
 
5
5
  <% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + plural + '/new_button", locals: {' + nested_assignments + '}' + '%\>'.gsub('\\',"") %><% end %>
6
6
 
7
-
7
+ <% unless @no_list %>
8
8
  <div class="row scaffold-row">
9
9
  <%= list_column_headings %>
10
10
  <% if @downnest_children.any? %>
@@ -35,8 +35,9 @@
35
35
  <\% <%= plural %>.each do |<%= singular %>| %>
36
36
  <\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %><%= nested_assignments_with_leading_comma if @nestable %><%= ", nested_for: nested_for" if @nestable %> } %>
37
37
  <\% end %>
38
-
39
38
  <%= @no_paginate ? "" : paginate %>
39
+
40
40
  </div>
41
+ <% end %>
41
42
  </div>
42
43
  <\% end %>
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.3.9'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot-glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Fleetwood-Boldt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-11 00:00:00.000000000 Z
11
+ date: 2021-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails