abizvn-clients 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ef742b6a267f3681db526125dcd92b3debea320184a198fb6f8a6c8814e039f8
4
+ data.tar.gz: ea321c3605284a566af605fa9f63db5949339507216131727c80097117630b0d
5
+ SHA512:
6
+ metadata.gz: ab72146c6ef395db0bfd93d9388cd49733aee584aabe084e4ae9470ac271ecc693177a80ad60d699d7084bf6f2994fa5e400b5a10f70df9ba6c83280dbecf740
7
+ data.tar.gz: b218fedc33357fe0fa882460a8a4c2443ff5d15267267b6fa996a1915f577d7e9c57c7d6f679a1ae3cf59c42928c56df3299160223deafa640b4c743acbb4181
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright Juan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Abizvn::Clients
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem "abizvn-clients"
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install abizvn-clients
22
+ ```
23
+
24
+ Now generating migrations files, then migrate them
25
+ ```bash
26
+ $ rails abizvn_clients:install:migrations
27
+ ```
28
+
29
+ ## Contributing
30
+ Contribution directions go here.
31
+
32
+ ## License
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,68 @@
1
+ ActiveAdmin.register Abizvn::Clients::Client, as: 'client' do
2
+ permit_params :name, :contact_email, :contact_phone_number, :details, :is_active, :admin_user_id,
3
+ :domains_attributes => [:id, :name, :is_active, :_destroy]
4
+
5
+ index do
6
+ selectable_column
7
+ id_column
8
+ column :name
9
+ column :contact_email
10
+ column :contact_phone_number
11
+ column :admin_user
12
+ column :created_at
13
+ column :updated_at
14
+ actions
15
+ end
16
+
17
+ show do
18
+ attributes_table do
19
+ row :name
20
+ row :contact_email
21
+ row :contact_phone_number
22
+ row :details
23
+ row :admin_user
24
+ row :is_active
25
+ row :created_at
26
+ row :updated_at
27
+ end
28
+
29
+ panel "Domain" do
30
+ table_for resource.domains do |t|
31
+ t.column :id
32
+ t.column :name
33
+ t.column :is_active
34
+ t.column :created_at
35
+ t.column :updated_at
36
+ end
37
+ end
38
+
39
+ active_admin_comments
40
+ end
41
+
42
+ action_item :create_another, only: :show do
43
+ link_to "Create Another", new_admin_client_path
44
+ end
45
+
46
+ form do |f|
47
+ f.semantic_errors *f.object.errors.attribute_names
48
+
49
+ f.inputs do
50
+ f.input :name
51
+ f.input :contact_email
52
+ f.input :contact_phone_number
53
+ f.input :details
54
+ # f.input :admin_user, as: :select, collection: AdminUser.all.map { |admin_user| [admin_user.email, admin_user.id] }
55
+ f.input :is_active
56
+ end
57
+
58
+ f.inputs "Domains" do
59
+ f.has_many :domains, heading: false, allow_destroy: true, new_record: true do |u|
60
+ u.input :name
61
+ u.input :is_active
62
+ end
63
+ end
64
+
65
+ f.actions
66
+ end
67
+
68
+ end
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/abizvn/clients .css
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ module Abizvn
2
+ module Clients
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Abizvn
2
+ module Clients
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Abizvn
2
+ module Clients
3
+ class ApplicationJob < ActiveJob::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ module Abizvn
2
+ module Clients
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: "from@example.com"
5
+ layout "mailer"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Abizvn
2
+ module Clients
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ module Abizvn
2
+ module Clients
3
+ class Client < ApplicationRecord
4
+ include RansackSearchable
5
+
6
+ self.table_name = 'clients_management_clients'
7
+
8
+ has_many :domains, class_name: 'Abizvn::Clients::Domain', foreign_key: :client_id
9
+ accepts_nested_attributes_for :domains, allow_destroy: true
10
+
11
+ validates :admin_user_email, presence: true, uniqueness: { case_sensitive: false }, 'valid_email_2/email': true
12
+
13
+ validates :name, presence: true, uniqueness: { case_sensitive: false }, length: { maximum: 128 }
14
+ validates :contact_email, 'valid_email_2/email': true
15
+ validates :contact_phone_number, phone: { possible: true, allow_blank: true }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Abizvn
2
+ module Clients
3
+ class Domain < ApplicationRecord
4
+ include RansackSearchable
5
+
6
+ self.table_name = 'clients_management_domains'
7
+
8
+ belongs_to :client, class_name: 'Abizvn::Clients::Client', foreign_key: 'client_id'
9
+
10
+ validates :name, presence: true, uniqueness: { case_sensitive: false }, length: { maximum: 255 }
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module Abizvn
2
+ module Clients
3
+ module RansackSearchable
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ def self.ransackable_attributes(auth_object = nil)
8
+ authorizable_ransackable_attributes
9
+ end
10
+
11
+ def self.ransackable_associations(auth_object = nil)
12
+ authorizable_ransackable_associations
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Abizvn clients</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= yield :head %>
9
+
10
+ <%= stylesheet_link_tag "abizvn/clients/application", media: "all" %>
11
+ </head>
12
+ <body>
13
+
14
+ <%= yield %>
15
+
16
+ </body>
17
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Abizvn::Clients::Engine.routes.draw do
2
+ end
@@ -0,0 +1,19 @@
1
+ class AddingClientsTable < ActiveRecord::Migration[7.2]
2
+ def change
3
+ create_table :clients_management_clients do |t|
4
+ t.string :name, null: false, limit: 128
5
+ t.index :name, unique: true
6
+
7
+ t.string :admin_user_email, null: false
8
+ t.index :admin_user_email, unique: true
9
+
10
+ t.string :contact_email
11
+ t.string :contact_phone_number
12
+ t.text :details
13
+
14
+ t.boolean :is_active, null: false, default: false
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ class AddingClientDomainsTable < ActiveRecord::Migration[7.2]
2
+ def change
3
+ create_table :clients_management_domains do |t|
4
+ t.string :name, null: false, limit: 255
5
+ t.index :name, unique: true
6
+
7
+ t.boolean :is_active, null: false, default: false
8
+
9
+ t.references :client, null: false, foreign_key: { to_table: :clients_management_clients }
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ module Abizvn
2
+ module Clients
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Abizvn::Clients
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Abizvn
2
+ module Clients
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require "abizvn/clients/version"
2
+ require "abizvn/clients/engine"
3
+
4
+ require 'phonelib'
5
+ require 'valid_email2'
6
+
7
+ module Abizvn
8
+ module Clients
9
+ # Your code goes here...
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :abizvn_clients do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: abizvn-clients
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Juan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '7.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '7.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: valid_email2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '7.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '7.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: phonelib
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.10'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '7.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '7.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: shoulda-matchers
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '6.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '6.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: factory_bot_rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: byebug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Management of clients entity and its domains
112
+ email:
113
+ - juanonsoftware@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - MIT-LICENSE
119
+ - README.md
120
+ - Rakefile
121
+ - app/admin/module_clients_clients.rb
122
+ - app/assets/config/abizvn_clients_manifest.js
123
+ - app/assets/stylesheets/abizvn/clients/application.css
124
+ - app/controllers/abizvn/clients/application_controller.rb
125
+ - app/helpers/abizvn/clients/application_helper.rb
126
+ - app/jobs/abizvn/clients/application_job.rb
127
+ - app/mailers/abizvn/clients/application_mailer.rb
128
+ - app/models/abizvn/clients/application_record.rb
129
+ - app/models/abizvn/clients/client.rb
130
+ - app/models/abizvn/clients/domain.rb
131
+ - app/models/concerns/abizvn/clients/ransack_searchable.rb
132
+ - app/views/layouts/abizvn/clients/application.html.erb
133
+ - config/routes.rb
134
+ - db/migrate/20250208042258_adding_clients_table.rb
135
+ - db/migrate/20250208072035_adding_client_domains_table.rb
136
+ - lib/abizvn/clients.rb
137
+ - lib/abizvn/clients/engine.rb
138
+ - lib/abizvn/clients/version.rb
139
+ - lib/tasks/abizvn/clients_tasks.rake
140
+ homepage: http://dev.abizvn.com
141
+ licenses:
142
+ - MIT
143
+ metadata:
144
+ homepage_uri: http://dev.abizvn.com
145
+ source_code_uri: https://github.com/abizvncom/abizvn-clients
146
+ changelog_uri: https://github.com/abizvncom/abizvn-clients
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubygems_version: 3.4.19
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: Management of clients
166
+ test_files: []