maquina 0.2.5 → 0.3.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/concerns/maquina/authenticate.rb +4 -0
- data/app/controllers/concerns/maquina/resourceful.rb +4 -2
- data/app/helpers/maquina/navbar_menu_helper.rb +2 -2
- data/app/models/concerns/maquina/organization_scoped.rb +11 -0
- data/app/models/concerns/maquina/user_scoped.rb +11 -0
- data/app/policies/maquina/application_policy.rb +5 -0
- data/app/views/maquina/application/components/date_component.rb +23 -0
- data/app/views/maquina/application/components/text_area_component.rb +20 -0
- data/app/views/maquina/application/form.rb +6 -0
- data/app/views/maquina/application/index_table.rb +8 -2
- data/app/views/maquina/application_view.rb +1 -1
- data/config/locales/flash.es.yml +44 -0
- data/config/locales/forms.es.yml +58 -0
- data/config/locales/models.es.yml +38 -0
- data/config/locales/routes.es.yml +7 -0
- data/config/locales/views.es.yml +44 -0
- data/lib/maquina/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f491a32a98067b380165fc5998e1f62f9eb40e68a5fdd0afcdd71c2614e0ccf5
|
4
|
+
data.tar.gz: 1696eea4780235d2d8a4d5ec007761efe3cf2484b92f7a25d342755dac726ee1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d54612c668ff636cc13f5fc5bf614a05f94b9bfe99e77eac2957007cf3c9773adf5cc161215e2c0b11b6e0209866dd2a3a6b37f393af5be2d080ea7c40ce428
|
7
|
+
data.tar.gz: 74f3bea13f2dbb72ecdb92318276cfe24cb3b3cb6696710ed7a8569f37c2f51cea8cdf6b33e6795ada7a9f889f98a1938c69d956015f97696cfbe062027c1f77
|
data/Gemfile.lock
CHANGED
@@ -22,6 +22,7 @@ module Maquina
|
|
22
22
|
class_attribute :form_attributes, instance_writer: false
|
23
23
|
class_attribute :show_attributes, instance_writer: false
|
24
24
|
class_attribute :policy_class, instance_writer: false
|
25
|
+
class_attribute :show_link, instance_writer: false
|
25
26
|
|
26
27
|
attr_reader :resource, :collection
|
27
28
|
|
@@ -137,17 +138,18 @@ module Maquina
|
|
137
138
|
end
|
138
139
|
|
139
140
|
helper_method :resource_class, :policy_class, :resource, :list_attributes, :form_attributes, :collection,
|
140
|
-
:collection_path, :resource_path, :new_resource_path, :edit_resource_path, :submit_path
|
141
|
+
:collection_path, :resource_path, :new_resource_path, :edit_resource_path, :submit_path, :show_link
|
141
142
|
end
|
142
143
|
|
143
144
|
class_methods do
|
144
|
-
def resourceful(resource_class: nil, namespace: nil, find_by_param: :id, only: [], except: [], list_attributes: [], form_attributes: [], show_attributes: [], policy_class: nil)
|
145
|
+
def resourceful(resource_class: nil, namespace: nil, find_by_param: :id, only: [], except: [], list_attributes: [], form_attributes: [], show_attributes: [], policy_class: nil, show_link: nil)
|
145
146
|
self.resource_class = resource_class || controller_path.classify.safe_constantize
|
146
147
|
self.find_by_param = find_by_param || :id
|
147
148
|
self.list_attributes = Array(list_attributes).compact
|
148
149
|
self.form_attributes = Array(form_attributes).compact
|
149
150
|
self.show_attributes = Array(show_attributes).compact
|
150
151
|
self.policy_class = policy_class
|
152
|
+
self.show_link = show_link
|
151
153
|
self.namespace = namespace
|
152
154
|
|
153
155
|
valid_rest_actions = {
|
@@ -17,11 +17,11 @@ module Maquina
|
|
17
17
|
def profile_menu_options
|
18
18
|
if Maquina::Current.signed_in?
|
19
19
|
{
|
20
|
-
signout: {method: :delete, path: sessions_path}
|
20
|
+
signout: {method: :delete, path: maquina.sessions_path}
|
21
21
|
}
|
22
22
|
else
|
23
23
|
{
|
24
|
-
signin: new_sessions_path
|
24
|
+
signin: maquina.new_sessions_path
|
25
25
|
}
|
26
26
|
end
|
27
27
|
end
|
@@ -43,5 +43,10 @@ module Maquina
|
|
43
43
|
def admin?
|
44
44
|
(Maquina::Current.membership.present? && Maquina::Current.membership.admin?)
|
45
45
|
end
|
46
|
+
|
47
|
+
relation_scope do |scope|
|
48
|
+
Rails.logger.warn("This policy scope at #{self} is not scoping by User or Organization")
|
49
|
+
scope
|
50
|
+
end
|
46
51
|
end
|
47
52
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maquina
|
4
|
+
module Application
|
5
|
+
module Components
|
6
|
+
class DateComponent < ComponentBase
|
7
|
+
def template
|
8
|
+
div(**control_html) do
|
9
|
+
@form.label attribute_name, class: "label #{label_css_class}"
|
10
|
+
div(class: "mt-1") do
|
11
|
+
css_class = {
|
12
|
+
class: input_html.delete(:class) || ""
|
13
|
+
}
|
14
|
+
@form.date_select attribute_name, input_html, css_class
|
15
|
+
help_template
|
16
|
+
error_template
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maquina
|
4
|
+
module Application
|
5
|
+
module Components
|
6
|
+
class TextAreaComponent < ComponentBase
|
7
|
+
def template
|
8
|
+
div(**control_html) do
|
9
|
+
@form.label attribute_name, class: "label #{label_css_class}"
|
10
|
+
div(class: "mt-1") do
|
11
|
+
@form.text_area attribute_name, **input_html
|
12
|
+
help_template
|
13
|
+
error_template
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -69,6 +69,12 @@ module Maquina
|
|
69
69
|
render Maquina::Application::Components::ActionTextComponent.new(resource: @resource, form: form, options: attribute_values)
|
70
70
|
when :select
|
71
71
|
render Maquina::Application::Components::SelectComponent.new(resource: @resource, form: form, options: attribute_values)
|
72
|
+
when :date
|
73
|
+
render Maquina::Application::Components::DateComponent.new(resource: @resource, form: form, options: attribute_values)
|
74
|
+
when :text_area
|
75
|
+
render Maquina::Application::Components::TextAreaComponent.new(resource: @resource, form: form, options: attribute_values)
|
76
|
+
when :input
|
77
|
+
render Maquina::Application::Components::InputComponent.new(resource: @resource, form: form, options: attribute_values)
|
72
78
|
else
|
73
79
|
render Maquina::Application::Components::InputComponent.new(resource: @resource, form: form, options: attribute_values)
|
74
80
|
end
|
@@ -5,7 +5,7 @@ module Maquina
|
|
5
5
|
class IndexTable < Phlex::HTML
|
6
6
|
include ApplicationView
|
7
7
|
|
8
|
-
delegate :humanized_money_with_symbol, :edit_resource_path, to: :helpers
|
8
|
+
delegate :humanized_money_with_symbol, :edit_resource_path, :resource_path, to: :helpers
|
9
9
|
|
10
10
|
def initialize(collection: nil, pagination: nil, list_attributes: nil)
|
11
11
|
@collection = collection
|
@@ -69,7 +69,7 @@ module Maquina
|
|
69
69
|
|
70
70
|
tr do
|
71
71
|
@list_attributes.each_with_index do |attribute, index|
|
72
|
-
td(class: (index == 0) ? first_css : base_css, scope: "col") { attribute_value(item, attribute) }
|
72
|
+
td(class: (index == 0) ? first_css : base_css, scope: "col") { attribute_to_link(item, attribute, attribute_value(item, attribute)) }
|
73
73
|
end
|
74
74
|
td(class: "relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6", scope: "col") do
|
75
75
|
a(href: edit_resource_path(item), class: "text-skin-accented hover:text-skin-accented-hover") { t("index.edit") } if policy_class.blank? || allowed_to?(:edit?, item, with: policy_class)
|
@@ -116,6 +116,12 @@ module Maquina
|
|
116
116
|
value
|
117
117
|
end
|
118
118
|
end
|
119
|
+
|
120
|
+
def attribute_to_link(item, attribute, value)
|
121
|
+
return value if show_link.nil? || show_link != attribute
|
122
|
+
|
123
|
+
link_to(value, resource_path(item), class: "link", data: {"turbo-frame": "_top"})
|
124
|
+
end
|
119
125
|
end
|
120
126
|
end
|
121
127
|
end
|
@@ -5,7 +5,7 @@ module Maquina
|
|
5
5
|
include Maquina::Engine.routes.url_helpers
|
6
6
|
include Phlex::Rails::Helpers::T
|
7
7
|
|
8
|
-
delegate :resource_class, :l, :default_url_options, :policy_class, :allowed_to?, to: :helpers
|
8
|
+
delegate :resource_class, :l, :default_url_options, :policy_class, :show_link, :allowed_to?, to: :helpers
|
9
9
|
|
10
10
|
# TODO: Revisit this later
|
11
11
|
def image_tag(source, options = {})
|
@@ -0,0 +1,44 @@
|
|
1
|
+
es:
|
2
|
+
flash:
|
3
|
+
create:
|
4
|
+
notice:
|
5
|
+
title: Se creó con éxito
|
6
|
+
description: Tú registro fue creado
|
7
|
+
alert:
|
8
|
+
title: No se pudo crear
|
9
|
+
description: Revisa los mensajes del formulario para resolver el problema
|
10
|
+
|
11
|
+
update:
|
12
|
+
notice:
|
13
|
+
title: Se actualizó con éxito
|
14
|
+
description: Tú registros fue actualizado
|
15
|
+
alert:
|
16
|
+
title: No se pudo actualizar
|
17
|
+
description: Revisa los mensajes del formulario para resolver el problema
|
18
|
+
|
19
|
+
destroy:
|
20
|
+
notice:
|
21
|
+
title: Se eliminó con éxito
|
22
|
+
description: Tú registro fue eliminado
|
23
|
+
alert:
|
24
|
+
title: No se puedo eliminar
|
25
|
+
description: Revisa los mensajes del formulario para resolver el problema
|
26
|
+
|
27
|
+
maquina/invitation:
|
28
|
+
create:
|
29
|
+
notice:
|
30
|
+
title: Invitación enviada
|
31
|
+
description: La inivitación para %{email} expira en 3 días
|
32
|
+
|
33
|
+
sessions:
|
34
|
+
create:
|
35
|
+
notice:
|
36
|
+
title: Bievenido a la sesión
|
37
|
+
description: Tu sesión ha iniciado
|
38
|
+
alert:
|
39
|
+
title: No fue posible iniciar la sesión
|
40
|
+
description: El correo electrónico o la contraseña son inválidos
|
41
|
+
destroy:
|
42
|
+
notice:
|
43
|
+
title: Sesión terminada
|
44
|
+
description: Para continuar debes iniciar sesión
|
@@ -0,0 +1,58 @@
|
|
1
|
+
es:
|
2
|
+
new:
|
3
|
+
maquina/plan:
|
4
|
+
title: Configura el plan para los clientes
|
5
|
+
maquina/invitation:
|
6
|
+
title: Invitar a un usuario a colaborar
|
7
|
+
description: El usuario va a recibir la invitación para unirse a colaborar vía correo electrónico.
|
8
|
+
|
9
|
+
form:
|
10
|
+
sessions:
|
11
|
+
email: Correo electrónico
|
12
|
+
password: Contraseña
|
13
|
+
forgot_password: Olvidé mi contraseña
|
14
|
+
submit: Iniciar sesión
|
15
|
+
|
16
|
+
accept_invitations:
|
17
|
+
submit: Aceptar invitación
|
18
|
+
|
19
|
+
placeholder:
|
20
|
+
sessions:
|
21
|
+
email: user@mail.com
|
22
|
+
password: Contraseña actual
|
23
|
+
|
24
|
+
maquina/plan:
|
25
|
+
name: Plan básico
|
26
|
+
|
27
|
+
maquina/invitation:
|
28
|
+
email: Correo electrónico del usuario
|
29
|
+
|
30
|
+
help:
|
31
|
+
maquina/plan:
|
32
|
+
name: Nombre del plan
|
33
|
+
trial: Número de días de prueba
|
34
|
+
price: Precio del plan
|
35
|
+
free: Indica si el plan es gratuito
|
36
|
+
active: Activar plan para clientes
|
37
|
+
|
38
|
+
helpers:
|
39
|
+
cancel: Cancelar
|
40
|
+
submit:
|
41
|
+
maquina/plan:
|
42
|
+
create: Crear %{model}
|
43
|
+
update: Actualizar %{model}
|
44
|
+
|
45
|
+
maquina/invitation:
|
46
|
+
create: Enviar invitación
|
47
|
+
|
48
|
+
maxlength:
|
49
|
+
default: 30
|
50
|
+
|
51
|
+
maquina/plan:
|
52
|
+
name: 60
|
53
|
+
trial: 3
|
54
|
+
price: 9
|
55
|
+
|
56
|
+
sessions:
|
57
|
+
email: 60
|
58
|
+
password: 60
|
@@ -0,0 +1,38 @@
|
|
1
|
+
es:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
maquina/plan:
|
5
|
+
one: Plan
|
6
|
+
other: Planes
|
7
|
+
maquina/user:
|
8
|
+
one: Usuario
|
9
|
+
other: Usuarios
|
10
|
+
maquina/invitation:
|
11
|
+
one: Invitación
|
12
|
+
other: Invitaciones
|
13
|
+
|
14
|
+
attributes:
|
15
|
+
maquina/plan:
|
16
|
+
name: Nombre
|
17
|
+
trial: Prueba
|
18
|
+
price: Precio
|
19
|
+
free: Gratuito
|
20
|
+
active: Activo
|
21
|
+
maquina/user:
|
22
|
+
email: Correo electrónico
|
23
|
+
blocked_at: Bloqueado desde
|
24
|
+
created_at: Creado el
|
25
|
+
maquina/invitation:
|
26
|
+
email: Correo electrónico
|
27
|
+
|
28
|
+
errors:
|
29
|
+
models:
|
30
|
+
maquina/active_session:
|
31
|
+
attributes:
|
32
|
+
user:
|
33
|
+
blocked: cuenta bloqueada
|
34
|
+
maquina/invitation:
|
35
|
+
attributes:
|
36
|
+
email:
|
37
|
+
blank: se necesita el correo electrónico a enviar invitación
|
38
|
+
invalid: invitación ya aceptada
|
@@ -0,0 +1,44 @@
|
|
1
|
+
es:
|
2
|
+
application_name: maquina
|
3
|
+
yes_value: "Sí"
|
4
|
+
no_value: "No"
|
5
|
+
|
6
|
+
index:
|
7
|
+
add_new: Nuevo %{model}
|
8
|
+
no_items: No hay %{model} registrados
|
9
|
+
edit: Modificar
|
10
|
+
|
11
|
+
maquina/plan:
|
12
|
+
description: Listado de planes.
|
13
|
+
maquina/user:
|
14
|
+
add_new: Invitar %{model}
|
15
|
+
description: Listado de usuarios.
|
16
|
+
|
17
|
+
pagination:
|
18
|
+
next: Siguiente
|
19
|
+
previous: Previo
|
20
|
+
information: Mostrando %{count} registro(s). Desde %{from} hasta %{to}.
|
21
|
+
|
22
|
+
menu:
|
23
|
+
main:
|
24
|
+
plans: Planes
|
25
|
+
users: Usuarios
|
26
|
+
profile:
|
27
|
+
signout: Cerrar sesión
|
28
|
+
signin: Iniciar sesión
|
29
|
+
|
30
|
+
search:
|
31
|
+
search: Buscar
|
32
|
+
|
33
|
+
maquina:
|
34
|
+
sessions:
|
35
|
+
new:
|
36
|
+
title: Iniciar sesión a tu cuenta
|
37
|
+
or: O
|
38
|
+
trial: iniciar tu prueba
|
39
|
+
|
40
|
+
accept_invitations:
|
41
|
+
new:
|
42
|
+
title: Aceptar invitación
|
43
|
+
description: Aquí puedes aceptar la inivitación para colaborar con %{org}
|
44
|
+
expired: La invitación es inválida, expiró, o ya fue aceptada. Si crees que esto es incorrecto, por favor contacta a la persona que envió la invitación y solicita una nueva invitación.
|
data/lib/maquina/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maquina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Alberto Chávez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -345,8 +345,10 @@ files:
|
|
345
345
|
- app/models/concerns/maquina/authenticate_by.rb
|
346
346
|
- app/models/concerns/maquina/blockeable.rb
|
347
347
|
- app/models/concerns/maquina/multifactor.rb
|
348
|
+
- app/models/concerns/maquina/organization_scoped.rb
|
348
349
|
- app/models/concerns/maquina/retain_passwords.rb
|
349
350
|
- app/models/concerns/maquina/searchable.rb
|
351
|
+
- app/models/concerns/maquina/user_scoped.rb
|
350
352
|
- app/models/maquina/active_session.rb
|
351
353
|
- app/models/maquina/application_record.rb
|
352
354
|
- app/models/maquina/current.rb
|
@@ -372,9 +374,11 @@ files:
|
|
372
374
|
- app/views/maquina/application/components/action_text_component.rb
|
373
375
|
- app/views/maquina/application/components/checkbox_component.rb
|
374
376
|
- app/views/maquina/application/components/component_base.rb
|
377
|
+
- app/views/maquina/application/components/date_component.rb
|
375
378
|
- app/views/maquina/application/components/file_component.rb
|
376
379
|
- app/views/maquina/application/components/input_component.rb
|
377
380
|
- app/views/maquina/application/components/select_component.rb
|
381
|
+
- app/views/maquina/application/components/text_area_component.rb
|
378
382
|
- app/views/maquina/application/create.turbo_stream.erb
|
379
383
|
- app/views/maquina/application/edit.html.erb
|
380
384
|
- app/views/maquina/application/edit.rb
|
@@ -413,11 +417,16 @@ files:
|
|
413
417
|
- config/initializers/money.rb
|
414
418
|
- config/initializers/pagy.rb
|
415
419
|
- config/locales/flash.en.yml
|
420
|
+
- config/locales/flash.es.yml
|
416
421
|
- config/locales/forms.en.yml
|
422
|
+
- config/locales/forms.es.yml
|
417
423
|
- config/locales/mailers.en.yml
|
418
424
|
- config/locales/models.en.yml
|
425
|
+
- config/locales/models.es.yml
|
419
426
|
- config/locales/routes.en.yml
|
427
|
+
- config/locales/routes.es.yml
|
420
428
|
- config/locales/views.en.yml
|
429
|
+
- config/locales/views.es.yml
|
421
430
|
- config/routes.rb
|
422
431
|
- db/migrate/20221109010726_create_maquina_plans.rb
|
423
432
|
- db/migrate/20221113000409_create_maquina_users.rb
|