zadok 0.3.8 → 0.4.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 +4 -4
- data/app/controllers/zadok_controller.rb +27 -14
- data/app/helpers/zadok_helper.rb +1 -1
- data/app/views/zadok/edit.html.slim +5 -5
- data/app/views/zadok/index.html.slim +4 -4
- data/app/views/zadok/new.html.slim +4 -4
- data/lib/zadok/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b272d38a80b647ac6a7f50750c2f241e5b0d5b9f3769289b60b912fa148325f
|
4
|
+
data.tar.gz: 2cb52978224dc5b959d8a9793c5a225cd97bb24349a14835f50934a2fe597543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d063d73903c152a09f9b122dd9b1e6de9ccc8321763fcdee694fad5516fd0f2195c81fa3f14cffe96319aab873b4c2fac11d08b7e4d411e7f1c709ebc915f641
|
7
|
+
data.tar.gz: f3e6d0e42d380269896a6ddc848354770790e5cebdf0ece24d72fc51bdc71e65573ebe0913cd8986d2c64942425f2c972f14d54388455838791eef30b3f94bc2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zadok (0.
|
4
|
+
zadok (0.4.0)
|
5
5
|
bootstrap (~> 4.0)
|
6
6
|
bundler-audit (~> 0.6)
|
7
7
|
cancancan (~> 2.1)
|
@@ -98,7 +98,7 @@ GEM
|
|
98
98
|
dry-initializer (2.3.0)
|
99
99
|
erubi (1.7.0)
|
100
100
|
execjs (2.7.0)
|
101
|
-
ffi (1.9.
|
101
|
+
ffi (1.9.23)
|
102
102
|
font-awesome-rails (4.7.0.3)
|
103
103
|
railties (>= 3.2, < 5.2)
|
104
104
|
globalid (0.4.1)
|
@@ -133,7 +133,7 @@ GEM
|
|
133
133
|
mini_portile2 (~> 2.3.0)
|
134
134
|
orm_adapter (0.5.0)
|
135
135
|
parallel (1.12.1)
|
136
|
-
parser (2.5.0.
|
136
|
+
parser (2.5.0.2)
|
137
137
|
ast (~> 2.4.0)
|
138
138
|
pg (1.0.0)
|
139
139
|
polyamorous (1.3.3)
|
@@ -161,7 +161,7 @@ GEM
|
|
161
161
|
nokogiri (>= 1.6)
|
162
162
|
rails-html-sanitizer (1.0.3)
|
163
163
|
loofah (~> 2.0)
|
164
|
-
rails-i18n (5.1.
|
164
|
+
rails-i18n (5.1.1)
|
165
165
|
i18n (>= 0.7, < 2)
|
166
166
|
railties (>= 5.0, < 6)
|
167
167
|
railties (5.1.5)
|
@@ -4,7 +4,9 @@ class ZadokController < ApplicationController
|
|
4
4
|
helper_method :edit_attributes
|
5
5
|
helper_method :index_attributes
|
6
6
|
helper_method :new_attributes
|
7
|
+
helper_method :page_title
|
7
8
|
helper_method :resource
|
9
|
+
helper_method :resource_class
|
8
10
|
helper_method :resource_name
|
9
11
|
helper_method :resources
|
10
12
|
helper_method :show_attributes
|
@@ -15,7 +17,7 @@ class ZadokController < ApplicationController
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def show
|
18
|
-
render [
|
20
|
+
render [controller_name, "show"].join("/")
|
19
21
|
end
|
20
22
|
|
21
23
|
def new
|
@@ -24,9 +26,9 @@ class ZadokController < ApplicationController
|
|
24
26
|
|
25
27
|
def create
|
26
28
|
if resource.save
|
27
|
-
flash.now[:success] = t("#{
|
29
|
+
flash.now[:success] = t("#{controller_name}.create_success")
|
28
30
|
flash.keep(:success)
|
29
|
-
redirect_to url_for(controller:
|
31
|
+
redirect_to url_for(controller: controller_name, action: :index)
|
30
32
|
else
|
31
33
|
flash.now[:danger] = resource.errors.full_messages.join("<br />")
|
32
34
|
render "zadok/new"
|
@@ -39,7 +41,7 @@ class ZadokController < ApplicationController
|
|
39
41
|
|
40
42
|
def update
|
41
43
|
if resource.update(resource_params)
|
42
|
-
flash.now[:success] = t("#{
|
44
|
+
flash.now[:success] = t("#{controller_name}.update_success")
|
43
45
|
else
|
44
46
|
flash.now[:danger] = resource.errors.full_messages.join("<br />")
|
45
47
|
end
|
@@ -48,13 +50,13 @@ class ZadokController < ApplicationController
|
|
48
50
|
|
49
51
|
def destroy
|
50
52
|
if resource.destroy
|
51
|
-
flash.now[:success] = t("#{
|
53
|
+
flash.now[:success] = t("#{controller_name}.destroy_success")
|
52
54
|
flash.keep(:success)
|
53
55
|
else
|
54
56
|
flash.now[:danger] = resource.errors.full_messages.join("<br />")
|
55
57
|
flash.keep(:danger)
|
56
58
|
end
|
57
|
-
redirect_to url_for(controller:
|
59
|
+
redirect_to url_for(controller: controller_name, action: :index)
|
58
60
|
end
|
59
61
|
|
60
62
|
protected
|
@@ -64,7 +66,7 @@ class ZadokController < ApplicationController
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def filters_namespace
|
67
|
-
"filters/#{
|
69
|
+
"zadok/filters/#{controller_name}".classify.constantize
|
68
70
|
end
|
69
71
|
|
70
72
|
def filtered_resources
|
@@ -75,10 +77,6 @@ class ZadokController < ApplicationController
|
|
75
77
|
permitted_params.fetch(:q) { {} }
|
76
78
|
end
|
77
79
|
|
78
|
-
def search_model
|
79
|
-
raise "search_model method not implemented"
|
80
|
-
end
|
81
|
-
|
82
80
|
def current_search
|
83
81
|
search_model.ransack(search_params)
|
84
82
|
end
|
@@ -104,11 +102,26 @@ class ZadokController < ApplicationController
|
|
104
102
|
end
|
105
103
|
|
106
104
|
def resource_params
|
107
|
-
|
105
|
+
send("#{controller_name}_params")
|
106
|
+
end
|
107
|
+
|
108
|
+
def resource_class
|
109
|
+
controller_name.singularize.camelize.constantize
|
110
|
+
end
|
111
|
+
alias search_model resource_class
|
112
|
+
|
113
|
+
def resource_name(variant = :one)
|
114
|
+
if variant == :zero
|
115
|
+
resource_class.model_name.human(count: 0)
|
116
|
+
elsif variant == :one
|
117
|
+
resource_class.model_name.human(count: 1)
|
118
|
+
elsif variant == :other
|
119
|
+
resource_class.model_name.human(count: 9)
|
120
|
+
end
|
108
121
|
end
|
109
122
|
|
110
|
-
def
|
111
|
-
|
123
|
+
def page_title
|
124
|
+
t("#{controller_name}.#{action_name}")
|
112
125
|
end
|
113
126
|
|
114
127
|
def resources
|
data/app/helpers/zadok_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
.container.resource-edit[id="#{
|
1
|
+
.container.resource-edit[id="#{controller_name}-edit"]
|
2
2
|
.card
|
3
3
|
.card-body
|
4
4
|
h2.card-title
|
5
|
-
=
|
6
|
-
= link_to(
|
5
|
+
= page_title
|
6
|
+
= link_to(resource_name(:other),
|
7
7
|
resource_url_for(:index),
|
8
8
|
class: "btn btn-primary text-white float-right")
|
9
9
|
|
@@ -23,8 +23,8 @@
|
|
23
23
|
|
24
24
|
- if can?(:destroy, resource)
|
25
25
|
.card-footer
|
26
|
-
= link_to(t("#{
|
26
|
+
= link_to(t("#{controller_name}.destroy"),
|
27
27
|
resource_url_for(:destroy),
|
28
|
-
data: { confirm: t("#{
|
28
|
+
data: { confirm: t("#{controller_name}.destroy_confirm") },
|
29
29
|
method: :delete,
|
30
30
|
class: "btn btn-danger pull-right")
|
@@ -1,10 +1,10 @@
|
|
1
|
-
.container.resource-index[id="#{
|
1
|
+
.container.resource-index[id="#{controller_name}-index"]
|
2
2
|
.card
|
3
3
|
.card-body
|
4
4
|
h2.card-title
|
5
|
-
=
|
5
|
+
= resource_name(:other)
|
6
6
|
- if can?(:create, resources.klass)
|
7
|
-
= link_to(t("#{
|
7
|
+
= link_to(t("#{controller_name}.new"),
|
8
8
|
resource_url_for(:new),
|
9
9
|
class: "btn btn-primary text-white float-right")
|
10
10
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
td.text-right[colspan=index_attributes.count]
|
21
21
|
= page_entries_info(resources)
|
22
22
|
tbody
|
23
|
-
= render(partial: "#{
|
23
|
+
= render(partial: "#{controller_name}/index_row",
|
24
24
|
collection: resources,
|
25
25
|
as: :resource)
|
26
26
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
.container.resource-new[id="#{
|
1
|
+
.container.resource-new[id="#{controller_name}-new"]
|
2
2
|
.card
|
3
3
|
.card-body
|
4
4
|
h2.card-title
|
5
|
-
=
|
6
|
-
= link_to(
|
5
|
+
= page_title
|
6
|
+
= link_to(resource_name(:other),
|
7
7
|
resource_url_for(:index),
|
8
8
|
class: "btn btn-primary text-white float-right")
|
9
9
|
|
@@ -16,4 +16,4 @@
|
|
16
16
|
options: options)
|
17
17
|
|
18
18
|
.form-group
|
19
|
-
= form.submit(class: "btn btn-primary text-white")
|
19
|
+
= form.submit(class: "btn btn-primary text-white")
|
data/lib/zadok/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zadok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Hooijer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap
|
@@ -426,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
426
426
|
version: '0'
|
427
427
|
requirements: []
|
428
428
|
rubyforge_project:
|
429
|
-
rubygems_version: 2.7.
|
429
|
+
rubygems_version: 2.7.6
|
430
430
|
signing_key:
|
431
431
|
specification_version: 4
|
432
432
|
summary: A data management gem.
|