hot-glue 0.6.5 → 0.6.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3eed7ea3e4a53cd699a7c6dcbc3b3ddc32daaaa2d4c2c1404b273a558c56164
4
- data.tar.gz: 1969aecb3e38316da444557cc636aeb4b199bcabf74230212abf4a0c0b50039f
3
+ metadata.gz: 8b1abbb288949d4eb6fda0866f18341f1df8e28726c96b60369e03f31219ad2a
4
+ data.tar.gz: 77cf3b279697a8221b4187505d6ea038ca90d6acb0a3246805bf687466f8d29d
5
5
  SHA512:
6
- metadata.gz: c68c27d95ed2359a8f8518aac33dbbf363cfd86b97252849445750680a4f04bf0caad6bf70639c35392baf9212e1f4224c1dec9a9658ab7a4e02b03ef2787bdf
7
- data.tar.gz: ba2e7f93b676bb2e50b2ebb96b4d88b1f8153c6fbd6aef119c17585ac6ad623030604927224e78da5df2510280ccb275250a9eab9e6d8304c3adef391141d1a5
6
+ metadata.gz: ddcfb7fefe2fb763a3a04c54a8fae32f53db9c95827dafcfef7eabecd2db7957980cf20ba8d67eec15f61e82908bc4fde45d637adee9567388b71c30cda60691
7
+ data.tar.gz: e51fdf70415ca9277d6952acf52225ff40889abd6ed905f5143be3faaa0234cfec405ad6629fec97f9fc5b3acdf26cd18a53f188f0b86ee2b27e5a181d3f5286
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.6.4)
4
+ hot-glue (0.6.5)
5
5
  ffaker (~> 2.16)
6
6
  kaminari (~> 1.2)
7
7
  rails (> 5.1)
data/README.md CHANGED
@@ -1615,6 +1615,31 @@ These automatic pickups for partials are detected at buildtime. This means that
1615
1615
 
1616
1616
  # VERSION HISTORY
1617
1617
 
1618
+ #### 2024-10-23 - v0.6.6
1619
+
1620
+ • Major refactor of contextual timezone support
1621
+
1622
+ NEW INSTALL:
1623
+ your current_user object should have
1624
+
1625
+ (1) a field on the database `time_zone` (notice underscore) this is a string field storing the name of the Rails timezone,
1626
+
1627
+ (2) a method like
1628
+
1629
+ def timezone
1630
+ ActiveSupport::TimeZone[time_zone]
1631
+ end
1632
+
1633
+ (notice no underscore in method name)
1634
+ This method returns a TimeZone object
1635
+
1636
+ UPGRADING: you will need to convert your existing `timezone` fields which were previously offset integers
1637
+ into strings using a new string field on your user object `time_zone` (notice underscores)
1638
+
1639
+
1640
+
1641
+
1642
+
1618
1643
  #### 2024-10-11 - v0.6.5
1619
1644
  • Adds timezone support as a modify option
1620
1645
 
@@ -69,7 +69,7 @@ module HotGlue
69
69
  end
70
70
 
71
71
  def modify_date_inputs_on_params(modified_params, current_user_object = nil, field_list = nil)
72
- use_offset = (current_user_object.try(:timezone)) || server_timezone_offset
72
+ use_timezone = (current_user.try(:timezone)) || Time.zone
73
73
  modified_params = modified_params.tap do |params|
74
74
  params.keys.each{|k|
75
75
 
@@ -78,16 +78,11 @@ module HotGlue
78
78
  else
79
79
  include_me = field_list.include?(k.to_sym)
80
80
  end
81
- if include_me
82
- if use_offset != 0
83
- zone = DateTime.now.in_time_zone(use_offset).zone
84
-
85
- if use_offset.is_a? String
86
- params[k] = DateTime.parse(params[k].gsub("T", " ") + " #{zone}")
87
- else
88
- parse_date = "#{params[k].gsub("T", " ")} #{zone}"
89
- params[k] = Time.strptime(parse_date, "%Y-%m-%d %H:%M:%S %Z")
90
- end
81
+ if include_me && params[k].present?
82
+ if use_timezone
83
+ zone = DateTime.now.in_time_zone(use_timezone).zone
84
+ parse_date = "#{params[k].gsub("T", " ")} #{zone}"
85
+ params[k] = Time.strptime(parse_date, "%Y-%m-%d %H:%M %Z")
91
86
  end
92
87
  end
93
88
  }
@@ -213,8 +208,8 @@ module HotGlue
213
208
 
214
209
  private
215
210
 
216
- def server_timezone_offset # returns integer of hours to add/subtract from UTC
217
- Time.now.in_time_zone(Rails.application.config.time_zone).strftime("%z").to_i/100
218
- end
211
+ # def server_timezone_offset # returns integer of hours to add/subtract from UTC
212
+ # Time.now.in_time_zone(Rails.application.config.time_zone).strftime("%z").to_i/100
213
+ # end
219
214
  end
220
215
  end
@@ -3,6 +3,12 @@ class DateTimeField < Field
3
3
  Time.now + rand(1..5).days
4
4
  end
5
5
 
6
+
7
+ def form_show_only_output
8
+ viewable_output
9
+ end
10
+
11
+
6
12
  def spec_setup_and_change_act(which_partial = nil)
7
13
  " " + "new_#{name} = DateTime.current + 1.year \n" +
8
14
  ' ' + "find(\"[name='#{testing_name}[#{ name.to_s }]']\").fill_in(with: new_#{name.to_s})"
@@ -49,6 +55,9 @@ class DateTimeField < Field
49
55
  end
50
56
  end
51
57
 
58
+
59
+
60
+
52
61
  def search_field_output
53
62
  if !modify_binary?
54
63
 
@@ -131,6 +131,7 @@ class Field
131
131
 
132
132
  def modified_display_output
133
133
  res = +''
134
+
134
135
  if modify_as[:cast] && modify_as[:cast] == "$"
135
136
  res += "<%= number_to_currency(#{singular}.#{name}) %>"
136
137
  elsif modify_as[:binary]
@@ -151,7 +152,9 @@ class Field
151
152
  end
152
153
  res = "<span class='badge <%= #{badge_code} %>'>" + res + "</span>"
153
154
  end
155
+ # byebug
154
156
 
157
+ res
155
158
  end
156
159
 
157
160
  def field_output(type = nil, width )
@@ -158,7 +158,6 @@ module HotGlue
158
158
  end
159
159
 
160
160
  @tinymce_stimulus_controller = (columns_map[col].modify_as == {tinymce: 1} ? "data-controller='tiny-mce' " : "")
161
-
162
161
  add_spaces_each_line( "\n <span #{@tinymce_stimulus_controller}class='<%= \"alert alert-danger\" if #{singular}.errors.details.keys.include?(:#{field_error_name}) %>' #{'style="display: inherit;"'} >\n" +
163
162
  add_spaces_each_line( (form_labels_position == 'before' ? the_label || "" : "") +
164
163
  + " <br />\n" + field_result +
@@ -756,7 +756,6 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
756
756
  @columns = @the_object.columns.map(&:name).map(&:to_sym).reject { |field| !@include_fields.include?(field) }
757
757
  end
758
758
 
759
-
760
759
  @columns = @columns -@nested_set.collect { |set| (set[:singular] + "_id").to_sym }
761
760
 
762
761
  if @attachments.any?
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.6.5'
3
+ CURRENT = '0.6.6'
4
4
  end
5
5
  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.6.5
4
+ version: 0.6.6
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: 2024-10-11 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails