pg_rails 7.1.1.pre.2 → 7.1.1.pre.4

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: f1a5b2d45d523d85b889cb132876fecfa47dcb5ec2215745a8a5f52f65cb64d1
4
- data.tar.gz: 2d3a6033834156a52fd1b2732fa5807da7c543a0ebac232ce1e588e2b8264595
3
+ metadata.gz: 34465452a5982269db6136a0000c16c78bb9576b57f7d4f3476940a76d28cae7
4
+ data.tar.gz: 77ecad87cb6e8ae5f99b5d73a40bbf60efb8f94a56782d253294904382b8ac3b
5
5
  SHA512:
6
- metadata.gz: e8307c9947ada0096c2c631c688fa6b5117c48473bd263786af090814aed41641535a5a205d9bfbfceef9ced876b8814b09e7dbcb6176730dc339f4499921e48
7
- data.tar.gz: 5dff3bd33e3eb3adfe4f1ce205c34f6099ae1446cf58288aa411c863511531bab2aa40d476c04c6e41a2d5b8df72ff53bc9857f3fc6f6b311b4d620e1de6df12
6
+ metadata.gz: 7b790cb222b1a4ed7acae49253e7a55700584e612750ad763449d68089dc294f66822a8eb9db4dc89303dcf3a3d20e2360944a222191fa53413ba3182806e8a8
7
+ data.tar.gz: cea1c5777acd0791fc8d32c3e28815881334e753f43e3608542e1d1181b03bfa980c154cfd2662d3c9927b30dab3a4acf0d3d2efeb3d2af0bb5b5a875d1d2bb3
@@ -64,7 +64,7 @@ input[type=datetime-local], input[type=datetime] {
64
64
  padding: 0.25rem 1rem;
65
65
  }
66
66
  }
67
- .listado td:has(.btn) {
67
+ .listado .actions-wrapper {
68
68
  display: flex;
69
69
  justify-content: flex-end;
70
70
  gap: 4px;
@@ -24,7 +24,7 @@ module PgEngine
24
24
  end
25
25
 
26
26
  def show
27
- add_breadcrumb instancia_modelo, instancia_modelo.target_object
27
+ add_breadcrumb instancia_modelo.to_s_short, instancia_modelo.target_object
28
28
 
29
29
  pg_respond_show
30
30
  end
@@ -34,7 +34,7 @@ module PgEngine
34
34
  end
35
35
 
36
36
  def edit
37
- add_breadcrumb instancia_modelo, instancia_modelo.target_object
37
+ add_breadcrumb instancia_modelo.to_s_short, instancia_modelo.target_object
38
38
  add_breadcrumb 'Editando'
39
39
  end
40
40
 
@@ -112,6 +112,7 @@ module PgEngine
112
112
 
113
113
  protected
114
114
 
115
+ # rubocop:disable Metrics/AbcSize
115
116
  def render_my_component(component, status)
116
117
  respond_to do |format|
117
118
  format.html do
@@ -128,11 +129,17 @@ module PgEngine
128
129
  status:
129
130
  end
130
131
 
132
+ format.json do
133
+ html = component.render_in(view_context)
134
+ render json: { html: }, status:
135
+ end
136
+
131
137
  format.any do
132
138
  head status
133
139
  end
134
140
  end
135
141
  end
142
+ # rubocop:enable Metrics/AbcSize
136
143
 
137
144
  def not_authorized(_arg_required_for_active_admin)
138
145
  respond_to do |format|
@@ -22,6 +22,10 @@ module PgEngine
22
22
  object.as_json(options).tap { |o| o[:to_s] = to_s }
23
23
  end
24
24
 
25
+ def to_s_short
26
+ truncate(object.to_s)
27
+ end
28
+
25
29
  # rubocop:disable Style/MissingRespondToMissing
26
30
  def method_missing(method_name, *args, &)
27
31
  valor = object.attributes[method_name.to_s]
@@ -2,12 +2,15 @@
2
2
 
3
3
  wb = xlsx_package.workbook
4
4
  wb.add_worksheet(name: @clase_modelo.nombre_plural) do |sheet|
5
- sheet.add_row(atributos_para_listar.map { |a| @clase_modelo.human_attribute_name(a) })
5
+ headers = atributos_para_listar.map { |a| @clase_modelo.human_attribute_name(a) }
6
+ headers.prepend 'ID interno'
7
+ sheet.add_row(headers)
6
8
 
7
9
  @collection.decorate.each do |object|
8
10
  array = atributos_para_listar.map do |att|
9
11
  object.send(att)
10
12
  end
13
+ array.prepend object.to_key
11
14
  sheet.add_row array
12
15
  end
13
16
  end
@@ -53,10 +53,11 @@ div
53
53
  - atributos_para_listar.each do |att|
54
54
  td.text-nowrap = object.send(att)
55
55
  td.text-nowrap.text-end.ps-5
56
- = object.extra_actions(size: :sm) if object.respond_to? :extra_actions
57
- = object.show_link
58
- = object.edit_link(text: '', klass: 'btn-light')
59
- = object.destroy_link
56
+ .actions-wrapper
57
+ = object.extra_actions(size: :sm) if object.respond_to? :extra_actions
58
+ = object.show_link
59
+ = object.edit_link(text: '', klass: 'btn-light')
60
+ = object.destroy_link
60
61
 
61
62
  .ps-3.justify-content-center
62
63
  = paginate(@collection)
@@ -1,5 +1,7 @@
1
+ // TODO: borrar deprecated file
1
2
  export default class {
2
3
  setCookie (cname, cvalue, exdays) {
4
+ console.log('DEPRECATED setCookie')
3
5
  const d = new Date()
4
6
  d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000))
5
7
  const expires = 'expires=' + d.toUTCString()
@@ -7,6 +9,7 @@ export default class {
7
9
  }
8
10
 
9
11
  getCookie (cname) {
12
+ console.log('DEPRECATED getCookie')
10
13
  const name = cname + '='
11
14
  const ca = document.cookie.split(';')
12
15
  for (let i = 0; i < ca.length; i++) {
@@ -1,3 +1,25 @@
1
+ export function setCookie (cname, cvalue, exdays) {
2
+ const d = new Date()
3
+ d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000))
4
+ const expires = 'expires=' + d.toUTCString()
5
+ document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'
6
+ }
7
+
8
+ export function getCookie (cname) {
9
+ const name = cname + '='
10
+ const ca = document.cookie.split(';')
11
+ for (let i = 0; i < ca.length; i++) {
12
+ let c = ca[i]
13
+ while (c.charAt(0) === ' ') {
14
+ c = c.substring(1)
15
+ }
16
+ if (c.indexOf(name) === 0) {
17
+ return c.substring(name.length, c.length)
18
+ }
19
+ }
20
+ return ''
21
+ }
22
+
1
23
  export function round (value) {
2
24
  return Math.round(value * 100) / 100
3
25
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.1.1-2'
4
+ VERSION = '7.1.1-4'
5
5
  end
@@ -41,9 +41,10 @@ div
41
41
  - atributos_para_listar.each do |att|
42
42
  th = object.send(att)
43
43
  td.text-nowrap.text-end.ps-5
44
- = object.show_link
45
- = object.edit_link(text: '', klass: 'btn-light')
46
- = object.destroy_link
44
+ .actions-wrapper
45
+ = object.show_link
46
+ = object.edit_link(text: '', klass: 'btn-light')
47
+ = object.destroy_link
47
48
 
48
49
  .ps-3.justify-content-center
49
50
  = paginate(@collection)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.1.pre.2
4
+ version: 7.1.1.pre.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-18 00:00:00.000000000 Z
11
+ date: 2024-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails