maquina 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/maquina/controllers/modal_controller.js +1 -1
- data/app/assets/javascripts/maquina/controllers/modal_open_controller.js +3 -8
- data/app/controllers/concerns/maquina/authenticate.rb +3 -0
- data/app/models/concerns/maquina/searchable.rb +2 -2
- data/app/models/maquina/application_record.rb +3 -3
- data/app/models/maquina/plan.rb +0 -4
- data/app/models/maquina/user.rb +0 -3
- data/app/policies/maquina/invitation_policy.rb +2 -2
- data/app/views/maquina/application/_navbar.html.erb +1 -1
- data/app/views/maquina/application/index_header.rb +1 -1
- data/app/views/maquina/application/index_modal.rb +1 -3
- data/lib/generators/maquina/install_generator.rb +0 -4
- data/lib/generators/maquina/templates/config/initializers/maquina.rb.tt +6 -0
- data/lib/maquina/version.rb +1 -1
- data/lib/maquina.rb +4 -0
- metadata +3 -3
- data/lib/generators/maquina/templates/config/initializers/maquina.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 253e32217b0c2f5e0a8a352ff4ac26a1e0d904184293205135f1d60fd43392d2
|
4
|
+
data.tar.gz: a347016c5e76c08fc3165662b47684ff181667a4bea70c25e340bc71e760b1cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77c5d7eb9e6927194b0ea5635f8a535b898010b755e42e254258e2af675c6c4ba08c70372141056e2fd296008d7a120d938019f5fa55966d3d3314cc61744621
|
7
|
+
data.tar.gz: 1013008ff3b86923b4d055c894d62e01ba23e84c4cad7d029454d1d8f9e80865ac038be1f5693c39a9828cebec1fc57c0a6591d6b16c4c7d134a83d321ef4acd
|
data/Gemfile.lock
CHANGED
@@ -25,7 +25,7 @@ export default class extends Controller {
|
|
25
25
|
event.preventDefault()
|
26
26
|
|
27
27
|
if (this.hasFrameTarget && this.contentTarget.classList.contains("hidden")) {
|
28
|
-
let url = event
|
28
|
+
let url = event.target.getAttribute("href") || this.element.dataset["frameSrc"]
|
29
29
|
this.frameTarget.setAttribute("src", url)
|
30
30
|
} else if (!this.contentTarget.classList.contains("hidden")) {
|
31
31
|
this.frameTarget.setAttribute("src", "")
|
@@ -1,15 +1,10 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus";
|
2
|
-
import { useDispatch } from "stimulus-use";
|
3
2
|
|
4
3
|
export default class extends Controller {
|
5
|
-
static
|
6
|
-
|
7
|
-
connect() {
|
8
|
-
useDispatch(this)
|
9
|
-
}
|
4
|
+
static outlets = ["modal"];
|
10
5
|
|
11
6
|
open(event) {
|
12
|
-
event.preventDefault()
|
13
|
-
this.
|
7
|
+
event.preventDefault()
|
8
|
+
this.modalOutlets.forEach(modal => modal.toggleModal(event))
|
14
9
|
}
|
15
10
|
}
|
@@ -35,6 +35,9 @@ module Maquina
|
|
35
35
|
active_session = ActiveSession.eager_load(user: {memberships: :organization})
|
36
36
|
.where(maquina_memberships: {blocked_at: nil})
|
37
37
|
.where(maquina_organizations: {active: true})
|
38
|
+
.or(
|
39
|
+
ActiveSession.where(maquina_users: {management: true})
|
40
|
+
)
|
38
41
|
.find_by(id: active_session_id)
|
39
42
|
|
40
43
|
return if active_session.blank?
|
@@ -11,13 +11,13 @@ module Maquina
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class_methods do
|
14
|
-
def search_scope(fields: [], options: {})
|
14
|
+
def search_scope(fields: [], options: {}, associated_against: {})
|
15
15
|
return if fields.empty?
|
16
16
|
|
17
17
|
default_options = {tsearch: {prefix: true, any_word: true}}
|
18
18
|
search_options = options.deep_merge(default_options)
|
19
19
|
|
20
|
-
pg_search_scope :search_full, against: fields, using: search_options # , ignoring: :accents
|
20
|
+
pg_search_scope :search_full, against: fields, using: search_options, associated_against: associated_against # , ignoring: :accents
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/app/models/maquina/plan.rb
CHANGED
@@ -25,8 +25,6 @@ module Maquina
|
|
25
25
|
# attributes and use the provided methods and scopes for querying and manipulating plan data.
|
26
26
|
|
27
27
|
class Plan < ApplicationRecord
|
28
|
-
include Searchable
|
29
|
-
|
30
28
|
has_many :organizations, class_name: "Maquina::Organization", foreign_key: :maquina_plan_id, dependent: :nullify
|
31
29
|
|
32
30
|
monetize :price_cents
|
@@ -34,7 +32,5 @@ module Maquina
|
|
34
32
|
validates :price, numericality: {greater_than_or_equal_to: 0}, if: ->(plan) { plan.free? }
|
35
33
|
validates :price, numericality: {greater_than: 0}, if: ->(plan) { !plan.free? }
|
36
34
|
validates :name, presence: true, uniqueness: true
|
37
|
-
|
38
|
-
search_scope(fields: [:name])
|
39
35
|
end
|
40
36
|
end
|
data/app/models/maquina/user.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module Maquina
|
4
4
|
class User < ApplicationRecord
|
5
|
-
include Maquina::Searchable
|
6
5
|
include Maquina::RetainPasswords
|
7
6
|
include Maquina::AuthenticateBy
|
8
7
|
include Maquina::Blockeable
|
@@ -18,8 +17,6 @@ module Maquina
|
|
18
17
|
|
19
18
|
before_save :downcase_email
|
20
19
|
|
21
|
-
search_scope(fields: [:email])
|
22
|
-
|
23
20
|
def expired_password?
|
24
21
|
return false if password_expires_at.blank?
|
25
22
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= render Maquina::Navbar::Menu.new %>
|
7
7
|
</div>
|
8
8
|
|
9
|
-
<%= render Maquina::Navbar::Search.new(query: params[:q], url: collection_path) if action_name == "index" && respond_to?(:collection_path) && collection_path.present? %>
|
9
|
+
<%= render Maquina::Navbar::Search.new(query: params[:q], url: collection_path) if action_name == "index" && respond_to?(:collection_path) && collection_path.present? && respond_to?(:resource_class) && resource_class.searchable? %>
|
10
10
|
|
11
11
|
<%= render Maquina::Navbar::MobileButton.new %>
|
12
12
|
|
@@ -27,7 +27,7 @@ module Maquina
|
|
27
27
|
return if policy_class.blank? || !allowed_to?(:new?, with: policy_class)
|
28
28
|
|
29
29
|
options = {}
|
30
|
-
options[:data] = {controller: "modal-open", action: "modal-open#open"} if policy_class.present? && allowed_to?(:new_modal?, with: policy_class)
|
30
|
+
options[:data] = {controller: "modal-open", modal_open_modal_outlet: ".modal", action: "modal-open#open"} if policy_class.present? && allowed_to?(:new_modal?, with: policy_class)
|
31
31
|
|
32
32
|
div(class: "mt-4 sm:mt-0 sm:ml-16 sm:flex-none") do
|
33
33
|
a(href: new_resource_path, class: "inline-flex items-center justify-center button button-accented", **options) { add_new }
|
@@ -7,9 +7,7 @@ module Maquina
|
|
7
7
|
register_element :turbo_frame
|
8
8
|
|
9
9
|
def template
|
10
|
-
div(data_controller: "modal",
|
11
|
-
data_action: " modal-open:toggle@window->modal#toggleModal close-frame-modal:toggle@window->modal#toggleModal",
|
12
|
-
data_frame_src: "") do
|
10
|
+
div(data_controller: "modal", class: "modal", data_frame_src: "") do
|
13
11
|
div(class: "fixed inset-0 z-30 hidden overflow-y-auto", aria_labelledby: "modal-title", role: "dialog",
|
14
12
|
aria_modal: "true", data_modal_target: "container") do
|
15
13
|
div(class: "flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0") do
|
data/lib/maquina/version.rb
CHANGED
data/lib/maquina.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.2.
|
4
|
+
version: 0.2.1
|
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-
|
11
|
+
date: 2023-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -434,7 +434,7 @@ files:
|
|
434
434
|
- lib/generators/maquina/tailwind_config/templates/lib/generators/tailwind_config/tailwind_config_generator.rb.tt
|
435
435
|
- lib/generators/maquina/tailwind_config/templates/lib/generators/tailwind_config/templates/config/tailwind.config.js.tt
|
436
436
|
- lib/generators/maquina/tailwind_config/templates/lib/tasks/tailwind.rake.tt
|
437
|
-
- lib/generators/maquina/templates/config/initializers/maquina.rb
|
437
|
+
- lib/generators/maquina/templates/config/initializers/maquina.rb.tt
|
438
438
|
- lib/maquina.rb
|
439
439
|
- lib/maquina/engine.rb
|
440
440
|
- lib/maquina/version.rb
|