hot-glue 0.0.2 → 0.0.3

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: 46cd5cd43915874022d96f3342d3cd9b28f7c926c94ea04c29eb8df63152623f
4
- data.tar.gz: 932672afaa6e13d9a0ebebf3014a3b67e9ec506b7531a23fa9cde4032652bbb8
3
+ metadata.gz: ea5d85ef61b4bdedf3b9b883596d6cb99ce8fe404dcf0d22d6fec74b9389f7fb
4
+ data.tar.gz: 4d94d90506fd14642672b32e5437ba789e94618d6b91459a7c41b9475df272d8
5
5
  SHA512:
6
- metadata.gz: 7dacdf0e6d3f91883084799025a5dd02a0d1016e55f455a9d9cbf177f1e723cadfc06bd2ddca7f1ad8ecf4e33dec8e3d851689578e123b78cf7a2d8bf2e4a349
7
- data.tar.gz: ddc83432caf2a0ab52a952fbda552ab11ab8696efcdf967debd05988a699a8b62ceab227c0d4d00df68c204578adb5ab604683fafa4735b44140a616f375a46a
6
+ metadata.gz: 7bb028acd27535bfaa5c53559418638eb7af6e45456d4e294e903ab1f3077ee14240056188b5f48677c491f9d4a265cc42add3e36d009552331ffa2cce42db43
7
+ data.tar.gz: 1ae9c5018d520969710f68b85af0522485b5011bdaf39ac0056889a5c341046dc8d744a761426d2dd8bd6ca7969fefdc8e1560a0d481e6e78a8f592ab874e236
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.0.1)
4
+ hot-glue (0.0.2)
5
5
  ffaker (~> 2.16)
6
6
  haml-rails (~> 2.0)
7
7
  kaminari (~> 1.2)
8
8
  rails (~> 6.0)
9
9
  sass-rails
10
+ turbo-rails (~> 0.5)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
@@ -179,6 +180,8 @@ GEM
179
180
  temple (0.8.2)
180
181
  thor (1.1.0)
181
182
  tilt (2.0.10)
183
+ turbo-rails (0.5.9)
184
+ rails (>= 6.0.0)
182
185
  tzinfo (2.0.4)
183
186
  concurrent-ruby (~> 1.0)
184
187
  websocket-driver (0.7.3)
data/README.md CHANGED
@@ -6,7 +6,7 @@ As well, its premise is a little different than the configuration-heavy admin in
6
6
 
7
7
  It gives users full control over objects they 'own' and by default it spits out functionality giving access to all fields.
8
8
 
9
- Hot Glue generates functionality that's quick and dirty. It let's you be crafty. Like a real glue gun with hot glue, take care not to burn yourself while using it.
9
+ Hot Glue generates functionality that's quick and dirty. It let's you be crafty. As with a real glue gun, take care not to burn yourself while using it.
10
10
 
11
11
  * Build plug-and-play scaffolding mixing HAML and turbo_stream responses
12
12
  * Automatically Reads Your Models (make them before building your scaffolding!)
@@ -221,6 +221,15 @@ Please note that this example would product non-functional code, so you would ne
221
221
  You don't need this if the pluralized version is just + "s" of the singular version. Only use for non-standard plurlizations, and be sure to pass it as TitleCase (as if you pluralized the model name)
222
222
 
223
223
 
224
+ ### `exclude=`
225
+ (separate field names by COMMA)
226
+
227
+ By default, all fields are included unless they are on the exclude list. (The default for the exclude list is `id`, `created_at`, and `updated_at` so you don't need to exclude those-- they are added.)
228
+
229
+ If you specify an exclude list, those fields + id, created_at, and updated_at will be excluded.
230
+
231
+
232
+
224
233
  ### `--god`
225
234
 
226
235
  Use this flag to create controllers with no root authentication. You can still use an auth_identifier, which can be useful for a meta-leval authentication to the controoler.
@@ -247,7 +256,18 @@ Produces ONLY the controller spec file, nothing else.
247
256
  Produces all the files except the spec file.
248
257
 
249
258
 
259
+ ### `--no-paginate`
260
+
261
+ Omits pagination. (All list views have pagination by default.)
262
+
263
+
264
+
265
+
250
266
  # VERSION HISTORY
267
+ #### 2021-02-27 - v0.0.3 - several fixes for namespaces; adds pagination; adds exclude list to fields
268
+
269
+ #### 2021-02-25 - v0.0.2 - bootstrapy
270
+
251
271
  #### 2021-02-24 - v0.0.1 - first proof of concept release -- basic CRUD works
252
272
 
253
273
  #### 2021-02-23 - v0.0.0 - Port of my prior work from github.com/jasonfb/common_core_js
@@ -62,6 +62,7 @@ module HotGlue
62
62
 
63
63
  @auth = "current_user"
64
64
  @auth_identifier = nil
65
+ @exclude_fields = []
65
66
 
66
67
  args[1..-1].each do |a|
67
68
  var_name, var_value = a.split("=")
@@ -77,6 +78,8 @@ module HotGlue
77
78
  @auth = var_value
78
79
  when "auth_identifier"
79
80
  @auth_identifier = var_value || ""
81
+ when "exclude"
82
+ @exclude_fields += var_value.split(",").collect(&:to_sym)
80
83
  end
81
84
  end
82
85
 
@@ -90,8 +93,6 @@ module HotGlue
90
93
  case (f)
91
94
  when "--god"
92
95
  @auth = nil
93
- # when "--with-index"
94
- # @with_index = true
95
96
  when "--specs-only"
96
97
  @specs_only = true
97
98
  when "--no-specs"
@@ -100,6 +101,8 @@ module HotGlue
100
101
  @no_delete = true
101
102
  when "--no-create"
102
103
  @no_create = true
104
+ when "--no-paginate"
105
+ @no_paginate = true
103
106
  end
104
107
  end
105
108
 
@@ -162,18 +165,19 @@ module HotGlue
162
165
  end
163
166
  end
164
167
 
165
- exclude_fields = [ :id, :created_at, :updated_at, :encrypted_password, :reset_password_token,
166
- :reset_password_sent_at, :remember_created_at, :confirmation_token, :confirmed_at,
167
- :confirmation_sent_at, :unconfirmed_email]
168
-
169
- exclude_fields << auth_assoc_field.to_sym if !auth_assoc_field.nil?
170
- exclude_fields << ownership_field.to_sym if !ownership_field.nil?
168
+ @exclude_fields.push :id, :created_at, :updated_at, :encrypted_password,
169
+ :reset_password_token,
170
+ :reset_password_sent_at, :remember_created_at,
171
+ :confirmation_token, :confirmed_at,
172
+ :confirmation_sent_at, :unconfirmed_email
171
173
 
174
+ @exclude_fields += auth_assoc_field.to_sym if !auth_assoc_field.nil?
175
+ @exclude_fields += ownership_field.to_sym if !ownership_field.nil?
172
176
 
173
177
  begin
174
- @columns = object.columns.map(&:name).map(&:to_sym).reject{|field| exclude_fields.include?(field) }
178
+ @columns = object.columns.map(&:name).map(&:to_sym).reject{|field| @exclude_fields.include?(field) }
175
179
  rescue StandardError => e
176
- puts "Ooops... it looks like is an object for #{class_name}. Please create the database table with fields first. "
180
+ puts "Ooops... #{e} it looks like is no object for #{class_name}. Please create the database table with fields first. "
177
181
  exit
178
182
  end
179
183
 
@@ -311,6 +315,18 @@ module HotGlue
311
315
  "#{@namespace+"/" if @namespace}#{plural}/line"
312
316
  end
313
317
 
318
+ def show_path_partial
319
+ "#{@namespace+"/" if @namespace}#{plural}/show"
320
+ end
321
+
322
+ def list_path_partial
323
+ "#{@namespace+"/" if @namespace}#{plural}/list"
324
+ end
325
+
326
+ def new_path_name
327
+ "new_#{@namespace+"_" if @namespace}#{singular}_path"
328
+ end
329
+
314
330
  def nested_assignments
315
331
  @nested_args.map{|a| "#{a}: @#{a}"}.join(", ") #metaprgramming into Ruby hash
316
332
  end
@@ -479,14 +495,14 @@ module HotGlue
479
495
 
480
496
  "#{col_identifier}{class: \"form-group \#{'alert-danger' if #{singular}.errors.details.keys.include?(:#{assoc_name.to_s})}\"}
481
497
  #{col_spaces_prepend}= f.collection_select(:#{col.to_s}, #{assoc_class}.all, :id, :#{display_column}, {prompt: true, selected: @#{singular}.#{col.to_s} }, class: 'form-control')
482
- #{col_spaces_prepend} %label.small.form-text.text-muted
483
- #{col_spaces_prepend} #{col.to_s.humanize}"
498
+ #{col_spaces_prepend}%label.small.form-text.text-muted
499
+ #{col_spaces_prepend} #{col.to_s.humanize}"
484
500
 
485
501
  else
486
502
  "#{col_identifier}{class: \"form-group \#{'alert-danger' if @#{singular}.errors.details.keys.include?(:#{col.to_s})}\"}
487
503
  #{col_spaces_prepend}= f.text_field :#{col.to_s}, value: #{singular}.#{col.to_s}, class: 'form-control', size: 4, type: 'number'
488
- #{col_spaces_prepend} %label.form-text
489
- #{col_spaces_prepend} #{col.to_s.humanize}\n"
504
+ #{col_spaces_prepend}%label.form-text
505
+ #{col_spaces_prepend} #{col.to_s.humanize}\n"
490
506
  end
491
507
  when :string
492
508
  limit ||= 256
@@ -660,7 +676,13 @@ module HotGlue
660
676
  end
661
677
  end
662
678
 
663
- private # thor does something fancy like sending the class all of its own methods during some strange run sequence
679
+
680
+
681
+ def paginate
682
+ "= paginate #{plural}"
683
+ end
684
+
685
+ private # thor does something fancy like sending the class all of its own methods during some strange run sequence
664
686
  # does not like public methods
665
687
 
666
688
  def cc_filename_with_extensions(name, file_format = format)
@@ -1,6 +1,6 @@
1
1
  = turbo_frame_tag "<%= singular %>__#{<%= singular %>.id}" do
2
2
  .row{'data-id': <%= singular %>.id, 'data-edit': 'false'}
3
- = render partial: "show", locals: {<%= singular %>: <%= singular %>}
3
+ = render partial: "<%= show_path_partial %>", locals: {<%= singular %>: <%= singular %>}
4
4
 
5
5
 
6
6
 
@@ -1,9 +1,11 @@
1
1
  = turbo_frame_tag "<%= plural %>-list" do
2
- .container.<%= singular %>-table
2
+ .container-fluid.<%= singular %>-table
3
3
  .row
4
4
  <%= list_column_headings %>
5
- %div.tbody
5
+ .col
6
+ %div
6
7
  - if <%= plural %>.empty?
7
8
  None
8
9
  - <%= plural %>.each do |<%= singular %>|
9
10
  = render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %> <%= nested_assignments_with_leading_comma %> }
11
+ <%= @no_paginate ? "" : paginate %>
@@ -1,2 +1,2 @@
1
1
  = turbo_frame_tag "<%= singular %>-new" do
2
- = link_to "New <%= singular.titleize %>", new_<%= singular %>_path(), disable_with: "Loading...", class: "new-<%= singular %>-button btn btn-primary pull-right"
2
+ = link_to "New <%= singular.titlecase %>", <%= new_path_name %>, disable_with: "Loading...", class: "new-<%= singular %>-button btn btn-primary pull-right"
@@ -3,7 +3,7 @@
3
3
  .col-md-12
4
4
  = render partial: "new_button"
5
5
  .clearfix
6
- = render partial: "<%= plural %>/list", locals: {<%= plural %>: @<%= plural %>}
6
+ = render partial: "<%= list_path_partial %>", locals: {<%= plural %>: @<%= plural %>}
7
7
 
8
8
 
9
9
 
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
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.0.2
4
+ version: 0.0.3
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-02-25 00:00:00.000000000 Z
11
+ date: 2021-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails