glib-web 4.27.1 → 4.27.3

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: f3e7abede9039f19d74269881b0f647d50d174d30553b3fba56ab895001268c4
4
- data.tar.gz: b3690df737464c48ef7b795017c70a2a94335f5a2e49c5b0746089864bf84f2e
3
+ metadata.gz: 487e158495266c1b750d920c00fb564c5769a0b639a1e0d0d5c24e6bebacf2e4
4
+ data.tar.gz: 2aa552aab47063a06e104e919db4810070222c115313b5a41435684a3a078388
5
5
  SHA512:
6
- metadata.gz: a3f586cbf9ba4bef991295413e402225cf20b8e3896743774e1e8da574fc96cff23ef56408784223f9e6a6771a83f86b9a834de5811bfe8560b76ddddd54aa7e
7
- data.tar.gz: e133698077a84e5b959f48b0d56e50d4fa3e6e14db9586eede2930db54c50afbae5f976e9e67889a71478cd035765985840d24a1c41c908c7161cb18ecc5a524
6
+ metadata.gz: 14effb4ee6956ed11a6a43cf38d6df7d8ff04026e42f97147b0fd5869469a7fd618cb65b4f6262f4709ae0cd7cbdd329339a6d34a7b0c9f23044ec71758acef2
7
+ data.tar.gz: 9fe27e7f70c616537b6aaf940bfc55e915755124cac8a141e9450a5c7e679d38e848399b72437119c50b333c3269635f3a39dc4a7220d007597fc7101184448b
@@ -19,20 +19,32 @@ class Glib::JsonUi::ActionBuilder
19
19
  # string :url
20
20
 
21
21
  def url(value, options = {})
22
+ other_host = !!options[:other_host]
22
23
  regex = /\/.+\.json|format=json/
23
24
 
24
- if Rails.env.development? || Rails.env.test?
25
+ if Rails.env.development? || Rails.env.test? && !other_host
25
26
  raise "JSON url detected #{value}" if value.to_s.match?(regex)
26
27
  end
27
28
 
28
- if value.to_s.match?(regex) && Rails.env.production?
29
- # Rollbar.error("JSON url detected #{value}")
30
- value = value.gsub('.json', '')
29
+ if value.to_s.match?(regex) && Rails.env.production? && !other_host
30
+ Rollbar.error("JSON url detected #{value}")
31
+ # value = value.gsub('.json', '')
31
32
  end
32
33
 
33
34
  instance_variable_set('@url', value) if options[:cache]
34
35
  json.set! 'url', value
35
36
  end
37
+
38
+ # private
39
+
40
+ # def same_host?(url)
41
+ # host = URI(url.to_s).host
42
+
43
+ # return true if host == request.host
44
+ # return false unless host.nil?
45
+ # return false unless url.to_s.start_with?("/")
46
+ # !url.to_s.start_with?("//")
47
+ # end
36
48
  end
37
49
 
38
50
  class Reload < Action
@@ -41,6 +41,7 @@ class Glib::JsonUi::ViewBuilder
41
41
  array :colors
42
42
  string :prefix
43
43
  string :suffix
44
+ bool :formatYAxis
44
45
  int :min
45
46
  int :max
46
47
  # https://www.chartjs.org/docs/latest/configuration/legend.html
@@ -1,6 +1,11 @@
1
1
  # To use this, simply:
2
2
  # - Include the module
3
- # - Add this migration: `add_column :model, :deleted_at, :datetime, null: true`
3
+ # - Call `auto_hide_soft_deleted_records` below the `include` statement
4
+ # - Add this migration:
5
+ # ```
6
+ # add_column :model, :deleted_at, :datetime, null: true
7
+ # add_index :model, :deleted_at
8
+ # ```
4
9
  module Glib
5
10
  module SoftDeletable
6
11
  extend ActiveSupport::Concern
@@ -29,6 +34,7 @@ module Glib
29
34
  extend ClassMethods
30
35
 
31
36
  scope :with_deleted, -> { unscope(where: :deleted_at) }
37
+ scope :deleted, -> { with_deleted.where.not(deleted_at: nil) }
32
38
 
33
39
  # Override
34
40
  def destroy
@@ -80,14 +86,14 @@ module Glib
80
86
  # Besides, it's probably not a good idea to prevent soft-deletion of objects that are already not valid.
81
87
  def _soft_destroy
82
88
  before_soft_destroy
83
- update_columns(deleted_at: DateTime.current)
89
+ update_columns(deleted_at: DateTime.current) # rubocop:disable Rails/SkipsModelValidations
84
90
  after_soft_destroy
85
91
  soft_destroy_associated_records
86
92
  end
87
93
 
88
94
  def _undo_soft_destroy
89
95
  undo_soft_destroy_associated_records
90
- update_columns(deleted_at: nil)
96
+ update_columns(deleted_at: nil) # rubocop:disable Rails/SkipsModelValidations
91
97
  end
92
98
 
93
99
  private
@@ -35,6 +35,12 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
35
35
  action.forms_submit overrideUrl: json_ui_garage_url(path: 'forms/rich_text_preview')
36
36
  end
37
37
 
38
+ avatar = 'https://png.pngtree.com/png-vector/20190710/ourmid/pngtree-user-vector-avatar-png-image_1541962.jpg'
39
+ mention_list = [
40
+ { id: 'johndoe', value: 'johndoe', text: 'John Doe', avatar: avatar, group: 'Programmer' },
41
+ { id: 'budi', value: 'budi', text: 'Budi', avatar: avatar, group: 'Programmer' },
42
+ { id: 'Setiawan', value: 'setiawan', text: 'Setiawan', avatar: avatar, group: 'Desainer' }
43
+ ]
38
44
  column.fields_richText \
39
45
  width: 'matchParent',
40
46
  produce: :markdown,
@@ -43,7 +49,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
43
49
  # value: "<p>Test <img src='{{image1}}'</p>",
44
50
  # value: glib_format_markdown(initial_message),
45
51
  value: initial_message,
46
- mentionList: ['ikhwanh', 'hgani', 'fahmiaga', 'dwirendra', 'nazlifs'],
52
+ mentionList: mention_list,
47
53
  imageUploader: {
48
54
  name: 'user[images_attributes][]',
49
55
  accepts: { fileType: ['image', 'csv', 'xlsx', 'pptx', 'docx'], maxFileSize: 5000 },
@@ -29,13 +29,13 @@ else
29
29
  json.title 'Line 1'
30
30
 
31
31
  points = {
32
- 'Sat, 10 Nov 2018' => 1,
33
- 'Sun, 11 Nov 2018' => 7,
34
- 'Mon, 12 Nov 2018' => 2,
32
+ 'Sat, 10 Nov 2018' => 1000000,
33
+ 'Sun, 11 Nov 2018' => 700000,
34
+ 'Mon, 12 Nov 2018' => 20000,
35
35
  'Tue, 13 Nov 2018' => 0,
36
- 'Wed, 14 Nov 2018' => 1,
37
- 'Thu, 15 Nov 2018' => 1,
38
- 'Fri, 16 Nov 2018' => 5,
36
+ 'Wed, 14 Nov 2018' => 1000,
37
+ 'Thu, 15 Nov 2018' => 100000,
38
+ 'Fri, 16 Nov 2018' => 50000,
39
39
  }
40
40
  json.points points.map { |k, v| { x: k, y: v, label: v > 5 ? 'Greater than five' : v } }
41
41
  end,
@@ -55,7 +55,7 @@ else
55
55
  end
56
56
  ],
57
57
  plugins: default_plugins,
58
- colors: ['#79AC78', '#3085C3'], legend: { display: false }
58
+ colors: ['#79AC78', '#3085C3'], legend: { display: false }, formatYAxis: true
59
59
 
60
60
  # scroll.spacer height: 20
61
61
  # scroll.h1 text: 'Line chart using remote data'
@@ -173,7 +173,6 @@ else
173
173
  plugins[:datalabels][:formatType] = 'label'
174
174
  scroll.h2 text: 'Pie chart'
175
175
  scroll.charts_pie \
176
- legend: { display: false },
177
176
  colors: ['#fc5a8d', '#F5E216'],
178
177
  plugins: plugins,
179
178
  dataPoints: [{ title: 'Strawberry', value: 25, label: '❤ Strawberry' }, { title: 'Banana', value: 75, label: '❤ Banana' }], legend: { display: false }
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.27.1
4
+ version: 4.27.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-10-04 00:00:00.000000000 Z
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description:
97
+ description:
98
98
  email: ''
99
99
  executables: []
100
100
  extensions: []
@@ -394,10 +394,10 @@ files:
394
394
  - lib/glib/value.rb
395
395
  - lib/glib/version.rb
396
396
  - lib/tasks/db.rake
397
- homepage:
397
+ homepage:
398
398
  licenses: []
399
399
  metadata: {}
400
- post_install_message:
400
+ post_install_message:
401
401
  rdoc_options: []
402
402
  require_paths:
403
403
  - lib
@@ -413,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
413
  version: '0'
414
414
  requirements: []
415
415
  rubygems_version: 3.4.6
416
- signing_key:
416
+ signing_key:
417
417
  specification_version: 4
418
418
  summary: ''
419
419
  test_files: []