lotus_admin 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/lotus_admin/resource_controller.rb +37 -11
- data/app/controllers/lotus_admin/users_controller.rb +8 -29
- data/app/helpers/lotus_admin/link_helpers.rb +2 -2
- data/app/views/lotus_admin/resource/_form.html.haml +16 -14
- data/app/views/lotus_admin/resource/edit.html.haml +1 -6
- data/app/views/lotus_admin/resource/new.html.haml +1 -6
- data/config/initializers/devise.rb +1 -1
- data/lib/lotus_admin/form_builder.rb +3 -1
- data/lib/lotus_admin/version.rb +1 -1
- data/vendor/assets/stylesheets/lotus_admin/theme/inc/mixin.scss +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6f28169cb1da38743faa9e32ed4399425d5dc3ddc1b95831ca6cef5725351db
|
4
|
+
data.tar.gz: 518d70fd6adf87fc29a924fcd011f9f239b086695f4322fcea93a51f25e35e06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d246263ad9d3b2c37bfb3ff94e8af6c21b77339700bd6039e48ded5396ae6cd17f391a34c8fe0265cad35965468fea88961f56baa6c5f7846cc8c5b4f3dbe1
|
7
|
+
data.tar.gz: d3a4bcb8258f941942c5397a9b1f871f4a87b35fc5ea2da5228f539eb1ed69ca90b8c58d3794731aeee6a881f52e09d85cd69145be47b5640496a4120b87d2fe
|
@@ -15,31 +15,45 @@ class LotusAdmin::ResourceController < LotusAdmin::AuthenticatedController
|
|
15
15
|
let(:resource_class) { self.class._resource_class }
|
16
16
|
let(:collection_path) { url_for(resource_class) }
|
17
17
|
|
18
|
-
def new
|
18
|
+
def new(&block)
|
19
19
|
self.resource = build_resource
|
20
20
|
|
21
21
|
authorize(resource) if using_pundit?
|
22
|
+
|
23
|
+
block.call if block.present?
|
22
24
|
end
|
23
25
|
|
24
|
-
def create
|
26
|
+
def create(&block)
|
25
27
|
self.resource = build_resource(permitted_params)
|
26
28
|
|
27
29
|
authorize(resource) if using_pundit?
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
respond_to do |format|
|
32
|
+
format.html
|
33
|
+
|
34
|
+
if block.present?
|
35
|
+
block.call
|
36
|
+
else
|
37
|
+
if resource.save
|
38
|
+
redirect_to after_create_redirect, notice: "Created new #{ resource_class.model_name.human } successfully"
|
39
|
+
else
|
40
|
+
render :new
|
41
|
+
end
|
42
|
+
end
|
33
43
|
end
|
34
44
|
end
|
35
45
|
|
36
|
-
def update
|
46
|
+
def update(&block)
|
37
47
|
authorize(resource) if using_pundit?
|
38
48
|
|
39
|
-
if
|
40
|
-
|
49
|
+
if block.present?
|
50
|
+
block.call
|
41
51
|
else
|
42
|
-
|
52
|
+
if resource.update(permitted_params)
|
53
|
+
redirect_to after_update_redirect, notice: "Updated #{ resource_class.model_name.human } successfully"
|
54
|
+
else
|
55
|
+
render :edit
|
56
|
+
end
|
43
57
|
end
|
44
58
|
end
|
45
59
|
|
@@ -66,7 +80,7 @@ class LotusAdmin::ResourceController < LotusAdmin::AuthenticatedController
|
|
66
80
|
flash[:error] = "There was an error removing that #{ resource_class.model_name.human }"
|
67
81
|
end
|
68
82
|
|
69
|
-
redirect_to
|
83
|
+
redirect_to after_destroy_redirect
|
70
84
|
end
|
71
85
|
|
72
86
|
private
|
@@ -82,4 +96,16 @@ class LotusAdmin::ResourceController < LotusAdmin::AuthenticatedController
|
|
82
96
|
def set_view_paths
|
83
97
|
append_view_path("lotus_admin/resource/#{ action_name }")
|
84
98
|
end
|
99
|
+
|
100
|
+
def after_update_redirect
|
101
|
+
[lotus_admin, resource]
|
102
|
+
end
|
103
|
+
|
104
|
+
def after_create_redirect
|
105
|
+
after_update_redirect
|
106
|
+
end
|
107
|
+
|
108
|
+
def after_destroy_redirect
|
109
|
+
[lotus_admin, resource_class]
|
110
|
+
end
|
85
111
|
end
|
@@ -11,39 +11,18 @@ module LotusAdmin
|
|
11
11
|
filter :created_at
|
12
12
|
filter :last_sign_in_at
|
13
13
|
|
14
|
-
def new
|
15
|
-
self.resource = resource_class.new
|
16
|
-
end
|
17
|
-
|
18
14
|
def create
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
if resource.save
|
23
|
-
resource.send_invited_email_notification
|
15
|
+
super do
|
16
|
+
resource.password = Devise.friendly_token.first(8)
|
24
17
|
|
25
|
-
|
26
|
-
|
27
|
-
render :new
|
28
|
-
end
|
29
|
-
end
|
18
|
+
if resource.save
|
19
|
+
resource.send_invited_email_notification
|
30
20
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
render :edit
|
21
|
+
redirect_to after_create_redirect, notice: "Created new #{ resource_class.model_name.human }"
|
22
|
+
else
|
23
|
+
render :new
|
24
|
+
end
|
36
25
|
end
|
37
26
|
end
|
38
|
-
|
39
|
-
def destroy
|
40
|
-
if user.destroy
|
41
|
-
flash[:notice] = "#{ resource_class.model_name.human } has been removed"
|
42
|
-
else
|
43
|
-
flash[:error] = "There was an error removing that #{ resource_class.model_name.human }"
|
44
|
-
end
|
45
|
-
|
46
|
-
redirect_to [lotus_admin, resource_class]
|
47
|
-
end
|
48
27
|
end
|
49
28
|
end
|
@@ -6,8 +6,8 @@ module LotusAdmin
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
def new_link
|
10
|
-
link_to lotus_admin.new_polymorphic_path(resource_class) do
|
9
|
+
def new_link(parent = nil)
|
10
|
+
link_to lotus_admin.new_polymorphic_path([parent, resource_class].compact) do
|
11
11
|
content_tag(:i, nil, class: 'zmdi zmdi-plus-circle')
|
12
12
|
end
|
13
13
|
end
|
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
|
4
|
-
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
.card
|
2
|
+
.card-body.card-padding
|
3
|
+
= material_form_for [lotus_admin, resource] do |f|
|
4
|
+
.form-inputs
|
5
|
+
- f.object.class.columns.each do |column|
|
6
|
+
- case column.type
|
7
|
+
- when :text
|
8
|
+
= f.input column.name, as: :text, input_html: { rows: 5 }
|
9
|
+
- else
|
10
|
+
- case column.name
|
11
|
+
- when /_at$/
|
12
|
+
- else
|
13
|
+
= f.input column.name
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
.form-actions
|
16
|
+
= material_form_submit(resource)
|
17
|
+
= material_form_cancel(lotus_admin.polymorphic_path(resource_class))
|
@@ -205,7 +205,7 @@ Devise.setup do |config|
|
|
205
205
|
# Time interval you can reset your password with a reset password key.
|
206
206
|
# Don't put a too small interval or your users won't have the time to
|
207
207
|
# change their passwords.
|
208
|
-
config.reset_password_within =
|
208
|
+
config.reset_password_within = 2.days
|
209
209
|
|
210
210
|
# When set to false, does not sign a user in automatically after their password is
|
211
211
|
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
@@ -18,8 +18,10 @@ class LotusAdmin::FormBuilder < SimpleForm::FormBuilder
|
|
18
18
|
end
|
19
19
|
|
20
20
|
case type
|
21
|
-
when :
|
21
|
+
when :date
|
22
22
|
options[:label] = options[:placeholder]
|
23
|
+
when :grouped_select, :select
|
24
|
+
options[:include_blank] = "Choose #{ options[:placeholder] }..."
|
23
25
|
end
|
24
26
|
|
25
27
|
super
|
data/lib/lotus_admin/version.rb
CHANGED
@@ -141,7 +141,7 @@
|
|
141
141
|
background-color: #FFF;
|
142
142
|
background-position: right #{"calc(100% - 7px)"};
|
143
143
|
background-repeat: no-repeat;
|
144
|
-
@include img-retina('../img/select.png', '../img/select$2x.png', 12px, 12px);
|
144
|
+
// @include img-retina('../img/select.png', '../img/select$2x.png', 12px, 12px);
|
145
145
|
pointer-events: none;
|
146
146
|
z-index: 5;
|
147
147
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lotus_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Millsaps-Brewer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|