headmin 0.2.2 → 0.2.6
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/.nvmrc +1 -1
- data/Gemfile.lock +3 -3
- data/README.md +17 -7
- data/app/helpers/headmin/admin_helper.rb +3 -59
- data/app/helpers/headmin/bootstrap_helper.rb +9 -0
- data/app/helpers/headmin/filter_helper.rb +7 -3
- data/app/helpers/headmin/form_helper.rb +36 -0
- data/app/helpers/headmin/request_helper.rb +39 -0
- data/app/models/concerns/headmin/fieldable.rb +53 -23
- data/app/services/block_service.rb +8 -4
- data/app/views/headmin/_blocks.html.erb +1 -1
- data/app/views/headmin/_filters.html.erb +1 -1
- data/app/views/headmin/_pagination.html.erb +4 -1
- data/app/views/headmin/dropdown/_devise.html.erb +20 -10
- data/app/views/headmin/dropdown/_list.html.erb +17 -7
- data/app/views/headmin/filters/_select.html.erb +3 -2
- data/app/views/headmin/filters/filter/_button.html.erb +0 -1
- data/app/views/headmin/forms/_blocks.html.erb +11 -4
- data/app/views/headmin/forms/_date.html.erb +1 -1
- data/app/views/headmin/forms/_label.html.erb +2 -2
- data/app/views/headmin/forms/_repeater.html.erb +6 -10
- data/app/views/headmin/table/_actions.html.erb +37 -11
- data/app/views/headmin/views/devise/confirmations/_new.html.erb +1 -1
- data/app/views/headmin/views/devise/passwords/_edit.html.erb +2 -2
- data/app/views/headmin/views/devise/passwords/_new.html.erb +1 -1
- data/app/views/headmin/views/devise/registrations/_edit.html.erb +4 -4
- data/app/views/headmin/views/devise/registrations/_new.html.erb +3 -3
- data/app/views/headmin/views/devise/shared/_links.html.erb +7 -7
- data/app/views/headmin/views/devise/unlocks/_new.html.erb +1 -1
- data/config/locales/activerecord/en.yml +9 -0
- data/config/locales/activerecord/nl.yml +9 -0
- data/config/locales/headmin/table/en.yml +5 -1
- data/config/locales/headmin/table/nl.yml +5 -1
- data/config/locales/headmin/views/en.yml +1 -1
- data/config/locales/headmin/views/nl.yml +14 -14
- data/dist/css/headmin.css +54 -13
- data/dist/js/headmin.js +45 -513
- data/docs/blocks-and-fields.md +54 -0
- data/docs/blocks.md +1 -54
- data/docs/devise.md +40 -2
- data/docs/fields.md +31 -9
- data/headmin.gemspec +1 -1
- data/lib/generators/headmin/blocks_generator.rb +4 -1
- data/lib/generators/headmin/devise_generator.rb +16 -0
- data/lib/generators/headmin/fields_generator.rb +5 -1
- data/lib/generators/templates/controllers/auth/confirmations_controller.rb +31 -0
- data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +31 -0
- data/lib/generators/templates/controllers/auth/passwords_controller.rb +35 -0
- data/lib/generators/templates/controllers/auth/registrations_controller.rb +63 -0
- data/lib/generators/templates/controllers/auth/sessions_controller.rb +28 -0
- data/lib/generators/templates/controllers/auth/unlocks_controller.rb +31 -0
- data/lib/generators/templates/migrations/create_field_hierarchies.rb +16 -0
- data/lib/generators/templates/views/auth/confirmations/new.html.erb +1 -0
- data/lib/generators/templates/views/auth/mailer/confirmation_instructions.html.erb +1 -0
- data/lib/generators/templates/views/auth/mailer/email_changed.html.erb +1 -0
- data/lib/generators/templates/views/auth/mailer/password_change.html.erb +1 -0
- data/lib/generators/templates/views/auth/mailer/reset_password_instructions.html.erb +1 -0
- data/lib/generators/templates/views/auth/mailer/unlock_instructions.html.erb +1 -0
- data/lib/generators/templates/views/auth/passwords/edit.html.erb +1 -0
- data/lib/generators/templates/views/auth/passwords/new.html.erb +1 -0
- data/lib/generators/templates/views/auth/registrations/edit.html.erb +1 -0
- data/lib/generators/templates/views/auth/registrations/new.html.erb +1 -0
- data/lib/generators/templates/views/auth/sessions/new.html.erb +1 -0
- data/lib/generators/templates/views/auth/unlocks/new.html.erb +1 -0
- data/lib/generators/templates/views/layouts/auth.html.erb +20 -0
- data/lib/headmin/engine.rb +2 -0
- data/lib/headmin/version.rb +1 -1
- data/package.json +4 -3
- data/src/js/headmin/controllers/blocks_controller.js +1 -1
- data/src/js/headmin/controllers/filter_controller.js +1 -1
- data/src/js/headmin/controllers/filters_controller.js +1 -1
- data/src/js/headmin/controllers/popup_controller.js +1 -1
- data/src/js/headmin/controllers/repeater_controller.js +9 -10
- data/src/js/headmin/controllers/table_actions_controller.js +104 -9
- data/src/js/headmin/controllers/table_controller.js +28 -57
- data/src/js/headmin/headmin.js +2 -2
- data/src/scss/headmin/table.scss +1 -0
- data/yarn.lock +1159 -1237
- metadata +33 -7
- data/docs/README.md +0 -5
@@ -0,0 +1,54 @@
|
|
1
|
+
# Blocks + fields = Magic
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
Run the following generators to generate the migration files.
|
5
|
+
```
|
6
|
+
rails generate headmin:blocks
|
7
|
+
rails generate headmin:fields
|
8
|
+
rails db:migrate
|
9
|
+
```
|
10
|
+
|
11
|
+
## Getting Started
|
12
|
+
### Setup model
|
13
|
+
|
14
|
+
Setup a block model by including `Headmin::Fieldable`
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
class Block < ApplicationRecord
|
18
|
+
include Headmin::Block
|
19
|
+
include Headmin::Fieldable
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
### Setup forms
|
24
|
+
|
25
|
+
```erb
|
26
|
+
# app/views/admin/blocks/_contact.html.erb
|
27
|
+
<%= form.hidden_field :name, value: :contact %>
|
28
|
+
|
29
|
+
<!-- Title -->
|
30
|
+
<%= render 'headmin/forms/fields/text', form: form, name: :title do |field, attribute, label| %>
|
31
|
+
<%= render 'headmin/forms/text', form: field, attribute: attribute, label: label %>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<!-- People list -->
|
35
|
+
<%= render 'headmin/forms/fields/list', form: form, name: :people do |item| %>
|
36
|
+
<%= render 'headmin/forms/fields/text', form: item, name: :name do |field, attribute, label| %>
|
37
|
+
<%= render 'headmin/forms/text', form: field, attribute: attribute, label: label %>
|
38
|
+
<% end %>
|
39
|
+
<% end %>
|
40
|
+
```
|
41
|
+
|
42
|
+
### Usage in website
|
43
|
+
|
44
|
+
```erb
|
45
|
+
# app/views/website/blocks/_contact.html.erb
|
46
|
+
<% fields = block.fields_hash %>
|
47
|
+
|
48
|
+
<h1><%= fields["title"] %></h1>
|
49
|
+
<ul>
|
50
|
+
<% fields["people"].each do |person| %>
|
51
|
+
<li><%= person["name"] %></h2></li>
|
52
|
+
<% end %>
|
53
|
+
</ul>
|
54
|
+
```
|
data/docs/blocks.md
CHANGED
@@ -30,15 +30,8 @@ A hidden template form will be rendered for all types defined in `allow:`
|
|
30
30
|
```
|
31
31
|
|
32
32
|
For each type of block you want to include, create a template in `views/admin/blocks`.
|
33
|
-
Make sure to include a hidden field to store the name of the block.
|
34
33
|
|
35
|
-
|
36
|
-
# app/views/admin/blocks/_contact.html.erb
|
37
|
-
<%= form.hidden_field :name, value: :contact %>
|
38
|
-
...
|
39
|
-
```
|
40
|
-
|
41
|
-
### Render blocks in frontend
|
34
|
+
### Usage in frontend
|
42
35
|
|
43
36
|
```erb
|
44
37
|
# app/views/website/pages/show.html.erb
|
@@ -53,49 +46,3 @@ For each block in the admin, you'll need to create a corresponding template in y
|
|
53
46
|
# app/views/website/blocks/_contact.html.erb
|
54
47
|
<%= block.name %>
|
55
48
|
```
|
56
|
-
|
57
|
-
## Blocks + fields = Magic
|
58
|
-
|
59
|
-
### Add fields to blocks
|
60
|
-
|
61
|
-
Setup a block model by including `Headmin::Fieldable`
|
62
|
-
|
63
|
-
```ruby
|
64
|
-
class Block < ApplicationRecord
|
65
|
-
include Headmin::Block
|
66
|
-
include Headmin::Fieldable
|
67
|
-
end
|
68
|
-
```
|
69
|
-
|
70
|
-
### Use fields in admin blocks
|
71
|
-
|
72
|
-
```erb
|
73
|
-
# app/views/admin/blocks/_contact.html.erb
|
74
|
-
<%= form.hidden_field :name, value: :contact %>
|
75
|
-
|
76
|
-
<!-- Title -->
|
77
|
-
<%= render 'headmin/forms/fields/text', form: form, name: :title do |field, attribute, label| %>
|
78
|
-
<%= render 'headmin/forms/text', form: field, attribute: attribute, label: label %>
|
79
|
-
<% end %>
|
80
|
-
|
81
|
-
<!-- People list -->
|
82
|
-
<%= render 'headmin/forms/fields/list', form: form, name: :people do |item| %>
|
83
|
-
<%= render 'headmin/forms/fields/text', form: item, name: :name do |field, attribute, label| %>
|
84
|
-
<%= render 'headmin/forms/text', form: field, attribute: attribute, label: label %>
|
85
|
-
<% end %>
|
86
|
-
<% end %>
|
87
|
-
```
|
88
|
-
|
89
|
-
### Render blocks in your frontend
|
90
|
-
|
91
|
-
```erb
|
92
|
-
# app/views/website/blocks/_contact.html.erb
|
93
|
-
<% fields = block.fields_hash %>
|
94
|
-
|
95
|
-
<h1><%= fields["title"] %></h1>
|
96
|
-
<ul>
|
97
|
-
<% fields["people"].each do |person| %>
|
98
|
-
<li><%= person["name"] %></h2></li>
|
99
|
-
<% end %>
|
100
|
-
</ul>
|
101
|
-
```
|
data/docs/devise.md
CHANGED
@@ -1,3 +1,41 @@
|
|
1
|
-
#
|
1
|
+
# Devise
|
2
|
+
Headmin comes with some default views for all devise related pages.
|
3
|
+
To make use of them, follow the guidelines below.
|
2
4
|
|
3
|
-
|
5
|
+
## Installation
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'devise'
|
10
|
+
```
|
11
|
+
|
12
|
+
Run the install generator
|
13
|
+
```sh
|
14
|
+
$ rails generate devise:install
|
15
|
+
```
|
16
|
+
|
17
|
+
Create a devise model
|
18
|
+
```sh
|
19
|
+
$ rails generate devise User
|
20
|
+
$ rails db:migrate
|
21
|
+
```
|
22
|
+
|
23
|
+
Generate the default auth views
|
24
|
+
```sh
|
25
|
+
$ rails generate headmin:devise
|
26
|
+
```
|
27
|
+
|
28
|
+
## Getting Started
|
29
|
+
|
30
|
+
### Change routes
|
31
|
+
Change the default `devise_for` routes with the code below
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
devise_for :users, controllers: {
|
35
|
+
sessions: 'auth/sessions',
|
36
|
+
registrations: 'auth/registrations',
|
37
|
+
passwords: 'auth/passwords',
|
38
|
+
unlocks: 'auth/unlocks',
|
39
|
+
confirmations: 'auth/confirmations'
|
40
|
+
}
|
41
|
+
```
|
data/docs/fields.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
# Fields
|
1
|
+
# Fields
|
2
2
|
|
3
3
|
## Installation
|
4
|
+
|
4
5
|
Run the following generators to generate the migration files.
|
5
|
-
|
6
|
-
|
7
|
-
rails
|
6
|
+
|
7
|
+
```sh
|
8
|
+
$ rails generate headmin:fields
|
9
|
+
$ rails db:migrate
|
8
10
|
```
|
9
11
|
|
10
12
|
## Getting Started
|
@@ -12,6 +14,7 @@ rails db:migrate
|
|
12
14
|
### Setup model
|
13
15
|
|
14
16
|
```ruby
|
17
|
+
|
15
18
|
class Settings < ApplicationRecord
|
16
19
|
include Headmin::Fieldable
|
17
20
|
end
|
@@ -19,7 +22,7 @@ end
|
|
19
22
|
|
20
23
|
### Setup forms
|
21
24
|
|
22
|
-
```
|
25
|
+
```html
|
23
26
|
# app/views/admin/settings/_form.html.erb
|
24
27
|
|
25
28
|
<!-- Company name -->
|
@@ -36,22 +39,41 @@ end
|
|
36
39
|
```
|
37
40
|
|
38
41
|
#### Type of fields
|
42
|
+
|
39
43
|
- Text: `headmin/forms/fields/text`
|
40
44
|
- File: `headmin/forms/fields/file`
|
41
45
|
- Image: `headmin/forms/fields/image`
|
42
46
|
- List: `headmin/forms/fields/list`
|
43
47
|
- Group: `headmin/forms/fields/group`
|
44
48
|
|
45
|
-
###
|
49
|
+
### Seed database
|
50
|
+
|
51
|
+
Use the `fields_hash` setter method to set the data, the way you want to retrieve it.
|
46
52
|
|
47
|
-
```
|
53
|
+
```ruby
|
54
|
+
# In db/seeds.rb
|
55
|
+
Setting.create!(
|
56
|
+
name: 'Website settings',
|
57
|
+
fields_hash: {
|
58
|
+
company_name: 'Insiting BV',
|
59
|
+
people: [
|
60
|
+
{ name: 'Jef Vlamings' },
|
61
|
+
{ name: 'Gert-Jan Peeters' }
|
62
|
+
]
|
63
|
+
}
|
64
|
+
)
|
65
|
+
```
|
66
|
+
|
67
|
+
### Usage in frontend
|
68
|
+
|
69
|
+
```html
|
48
70
|
# app/views/website/settings/show.html.erb
|
49
71
|
<% fields = @setting.fields_hash %>
|
50
72
|
|
51
73
|
<h1><%= fields["company_name"] %></h1>
|
52
74
|
<ul>
|
53
|
-
|
75
|
+
<% fields["people"].each do |person| %>
|
54
76
|
<li><%= person["name"] %></h2></li>
|
55
|
-
|
77
|
+
<% end %>
|
56
78
|
</ul>
|
57
79
|
```
|
data/headmin.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
# Uncomment to register a new dependency of your gem
|
31
31
|
# spec.add_dependency "example-gem", "~> 1.0"
|
32
|
-
spec.add_runtime_dependency 'closure_tree'
|
32
|
+
spec.add_runtime_dependency 'closure_tree'
|
33
33
|
|
34
34
|
# For more information and examples about making a new gem, checkout our
|
35
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
@@ -4,8 +4,11 @@ module Headmin
|
|
4
4
|
|
5
5
|
source_root File.expand_path('../../templates', __FILE__)
|
6
6
|
|
7
|
-
def
|
7
|
+
def copy_models
|
8
8
|
template 'models/block.rb', 'app/models/block.rb'
|
9
|
+
end
|
10
|
+
|
11
|
+
def copy_migrations
|
9
12
|
migration_template 'migrations/create_blocks.rb', 'db/migrate/create_blocks.rb'
|
10
13
|
end
|
11
14
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Headmin
|
2
|
+
class DeviseGenerator < Rails::Generators::Base
|
3
|
+
include Rails::Generators::Migration
|
4
|
+
|
5
|
+
source_root File.expand_path('../../templates', __FILE__)
|
6
|
+
|
7
|
+
def copy_controllers
|
8
|
+
directory 'controllers/auth', 'app/controllers/auth'
|
9
|
+
end
|
10
|
+
|
11
|
+
def copy_views
|
12
|
+
directory 'views/auth', 'app/views/auth'
|
13
|
+
copy_file 'views/layouts/auth.html.erb', 'app/views/layouts/auth.html.erb'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -4,9 +4,13 @@ module Headmin
|
|
4
4
|
|
5
5
|
source_root File.expand_path('../../templates', __FILE__)
|
6
6
|
|
7
|
-
def
|
7
|
+
def copy_models
|
8
8
|
template 'models/field.rb', 'app/models/field.rb'
|
9
|
+
end
|
10
|
+
|
11
|
+
def copy_migrations
|
9
12
|
migration_template 'migrations/create_fields.rb', 'db/migrate/create_fields.rb'
|
13
|
+
migration_template 'migrations/create_field_hierarchies.rb', 'db/migrate/create_field_hierarchies.rb'
|
10
14
|
end
|
11
15
|
|
12
16
|
private
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Auth::ConfirmationsController < Devise::ConfirmationsController
|
4
|
+
layout 'auth'
|
5
|
+
# GET /resource/confirmation/new
|
6
|
+
# def new
|
7
|
+
# super
|
8
|
+
# end
|
9
|
+
|
10
|
+
# POST /resource/confirmation
|
11
|
+
# def create
|
12
|
+
# super
|
13
|
+
# end
|
14
|
+
|
15
|
+
# GET /resource/confirmation?confirmation_token=abcdef
|
16
|
+
# def show
|
17
|
+
# super
|
18
|
+
# end
|
19
|
+
|
20
|
+
# protected
|
21
|
+
|
22
|
+
# The path used after resending confirmation instructions.
|
23
|
+
# def after_resending_confirmation_instructions_path_for(resource_name)
|
24
|
+
# super(resource_name)
|
25
|
+
# end
|
26
|
+
|
27
|
+
# The path used after confirmation.
|
28
|
+
# def after_confirmation_path_for(resource_name, resource)
|
29
|
+
# super(resource_name, resource)
|
30
|
+
# end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Auth::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
4
|
+
layout 'auth'
|
5
|
+
# You should configure your model like this:
|
6
|
+
# devise :omniauthable, omniauth_providers: [:twitter]
|
7
|
+
|
8
|
+
# You should also create an action method in this controller like this:
|
9
|
+
# def twitter
|
10
|
+
# end
|
11
|
+
|
12
|
+
# More info at:
|
13
|
+
# https://github.com/heartcombo/devise#omniauth
|
14
|
+
|
15
|
+
# GET|POST /resource/auth/twitter
|
16
|
+
# def passthru
|
17
|
+
# super
|
18
|
+
# end
|
19
|
+
|
20
|
+
# GET|POST /users/auth/twitter/callback
|
21
|
+
# def failure
|
22
|
+
# super
|
23
|
+
# end
|
24
|
+
|
25
|
+
# protected
|
26
|
+
|
27
|
+
# The path used when OmniAuth fails
|
28
|
+
# def after_omniauth_failure_path_for(scope)
|
29
|
+
# super(scope)
|
30
|
+
# end
|
31
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Auth::PasswordsController < Devise::PasswordsController
|
4
|
+
layout 'auth'
|
5
|
+
# GET /resource/password/new
|
6
|
+
# def new
|
7
|
+
# super
|
8
|
+
# end
|
9
|
+
|
10
|
+
# POST /resource/password
|
11
|
+
# def create
|
12
|
+
# super
|
13
|
+
# end
|
14
|
+
|
15
|
+
# GET /resource/password/edit?reset_password_token=abcdef
|
16
|
+
# def edit
|
17
|
+
# super
|
18
|
+
# end
|
19
|
+
|
20
|
+
# PUT /resource/password
|
21
|
+
# def update
|
22
|
+
# super
|
23
|
+
# end
|
24
|
+
|
25
|
+
# protected
|
26
|
+
|
27
|
+
# def after_resetting_password_path_for(resource)
|
28
|
+
# super(resource)
|
29
|
+
# end
|
30
|
+
|
31
|
+
# The path used after sending reset password instructions
|
32
|
+
# def after_sending_reset_password_instructions_path_for(resource_name)
|
33
|
+
# super(resource_name)
|
34
|
+
# end
|
35
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Auth::RegistrationsController < Devise::RegistrationsController
|
4
|
+
layout 'auth'
|
5
|
+
# before_action :configure_sign_up_params, only: [:create]
|
6
|
+
# before_action :configure_account_update_params, only: [:update]
|
7
|
+
|
8
|
+
# GET /resource/sign_up
|
9
|
+
# def new
|
10
|
+
# super
|
11
|
+
# end
|
12
|
+
|
13
|
+
# POST /resource
|
14
|
+
# def create
|
15
|
+
# super
|
16
|
+
# end
|
17
|
+
|
18
|
+
# GET /resource/edit
|
19
|
+
# def edit
|
20
|
+
# super
|
21
|
+
# end
|
22
|
+
|
23
|
+
# PUT /resource
|
24
|
+
# def update
|
25
|
+
# super
|
26
|
+
# end
|
27
|
+
|
28
|
+
# DELETE /resource
|
29
|
+
# def destroy
|
30
|
+
# super
|
31
|
+
# end
|
32
|
+
|
33
|
+
# GET /resource/cancel
|
34
|
+
# Forces the session data which is usually expired after sign
|
35
|
+
# in to be expired now. This is useful if the user wants to
|
36
|
+
# cancel oauth signing in/up in the middle of the process,
|
37
|
+
# removing all OAuth session data.
|
38
|
+
# def cancel
|
39
|
+
# super
|
40
|
+
# end
|
41
|
+
|
42
|
+
# protected
|
43
|
+
|
44
|
+
# If you have extra params to permit, append them to the sanitizer.
|
45
|
+
# def configure_sign_up_params
|
46
|
+
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
|
47
|
+
# end
|
48
|
+
|
49
|
+
# If you have extra params to permit, append them to the sanitizer.
|
50
|
+
# def configure_account_update_params
|
51
|
+
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
|
52
|
+
# end
|
53
|
+
|
54
|
+
# The path used after sign up.
|
55
|
+
# def after_sign_up_path_for(resource)
|
56
|
+
# super(resource)
|
57
|
+
# end
|
58
|
+
|
59
|
+
# The path used after sign up for inactive accounts.
|
60
|
+
# def after_inactive_sign_up_path_for(resource)
|
61
|
+
# super(resource)
|
62
|
+
# end
|
63
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Auth::SessionsController < Devise::SessionsController
|
4
|
+
layout 'auth'
|
5
|
+
# before_action :configure_sign_in_params, only: [:create]
|
6
|
+
|
7
|
+
# GET /resource/sign_in
|
8
|
+
# def new
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# POST /resource/sign_in
|
13
|
+
# def create
|
14
|
+
# super
|
15
|
+
# end
|
16
|
+
|
17
|
+
# DELETE /resource/sign_out
|
18
|
+
# def destroy
|
19
|
+
# super
|
20
|
+
# end
|
21
|
+
|
22
|
+
# protected
|
23
|
+
|
24
|
+
# If you have extra params to permit, append them to the sanitizer.
|
25
|
+
# def configure_sign_in_params
|
26
|
+
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
|
27
|
+
# end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Auth::UnlocksController < Devise::UnlocksController
|
4
|
+
layout 'auth'
|
5
|
+
# GET /resource/unlock/new
|
6
|
+
# def new
|
7
|
+
# super
|
8
|
+
# end
|
9
|
+
|
10
|
+
# POST /resource/unlock
|
11
|
+
# def create
|
12
|
+
# super
|
13
|
+
# end
|
14
|
+
|
15
|
+
# GET /resource/unlock?unlock_token=abcdef
|
16
|
+
# def show
|
17
|
+
# super
|
18
|
+
# end
|
19
|
+
|
20
|
+
# protected
|
21
|
+
|
22
|
+
# The path used after sending unlock password instructions
|
23
|
+
# def after_sending_unlock_instructions_path_for(resource)
|
24
|
+
# super(resource)
|
25
|
+
# end
|
26
|
+
|
27
|
+
# The path used after unlocking the resource
|
28
|
+
# def after_unlock_path_for(resource)
|
29
|
+
# super(resource)
|
30
|
+
# end
|
31
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateFieldHierarchies < ActiveRecord::Migration[6.1]
|
2
|
+
def change
|
3
|
+
create_table :field_hierarchies, id: false do |t|
|
4
|
+
t.integer :ancestor_id, null: false
|
5
|
+
t.integer :descendant_id, null: false
|
6
|
+
t.integer :generations, null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :field_hierarchies, [:ancestor_id, :descendant_id, :generations],
|
10
|
+
unique: true,
|
11
|
+
name: "field_anc_desc_idx"
|
12
|
+
|
13
|
+
add_index :field_hierarchies, [:descendant_id],
|
14
|
+
name: "field_desc_idx"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/confirmations/new" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/mailer/confirmation_instructions" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/mailer/email_changed" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/mailer/password_change" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/mailer/reset_password_instructions" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/mailer/unlock_instructions" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/passwords/edit" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/passwords/new" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/registrations/edit" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/registrations/new" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/sessions/new" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "headmin/views/devise/unlocks/new" %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Authentication</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
<%= stylesheet_pack_tag 'admin', media: 'all', 'data-turbolinks-track': 'reload' %>
|
9
|
+
<%= javascript_pack_tag 'admin', 'data-turbolinks-track': 'reload' %>
|
10
|
+
</head>
|
11
|
+
<body class="bg-light w-100 vh-100">
|
12
|
+
|
13
|
+
<%= render 'headmin/notifications' %>
|
14
|
+
|
15
|
+
<main class="d-flex justify-content-center align-items-center w-100 vh-100 p-3">
|
16
|
+
<%= yield %>
|
17
|
+
</main>
|
18
|
+
|
19
|
+
</body>
|
20
|
+
</html>
|
data/lib/headmin/engine.rb
CHANGED
data/lib/headmin/version.rb
CHANGED
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "headmin",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.4",
|
4
4
|
"description": "Admin component library",
|
5
5
|
"main": "src/js/headmin.js",
|
6
6
|
"sass": "src/scss/headmin.scss",
|
@@ -20,13 +20,14 @@
|
|
20
20
|
},
|
21
21
|
"homepage": "https://github.com/insiting/headmin#readme",
|
22
22
|
"dependencies": {
|
23
|
+
"@hotwired/stimulus": "^3.0",
|
24
|
+
"@hotwired/stimulus-webpack-helpers": "^1.0",
|
23
25
|
"@popperjs/core": "^2.9.3",
|
24
26
|
"@rails/ujs": "^6.0.0",
|
25
27
|
"bootstrap": "^5.1.1",
|
26
28
|
"ckeditor5-build-classic-simple-upload-adapter-image-resize": "^1.0.4",
|
27
29
|
"flatpickr": "^4.6.9",
|
28
30
|
"sortablejs": "^1.13.0",
|
29
|
-
"stimulus": "^2.0.0",
|
30
31
|
"tom-select": "^2.0.0-rc.4"
|
31
32
|
},
|
32
33
|
"devDependencies": {
|
@@ -34,7 +35,7 @@
|
|
34
35
|
"@babel/preset-env": "^7.12.11",
|
35
36
|
"autoprefixer": "^10.2.3",
|
36
37
|
"babel-loader": "^8.2.2",
|
37
|
-
"node-sass": "^
|
38
|
+
"node-sass": "^6.0.1",
|
38
39
|
"node-sass-tilde-importer": "^1.0.2",
|
39
40
|
"onchange": "^7.1.0",
|
40
41
|
"path": "^0.12.7",
|