engine2 1.0.6 → 1.0.7
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/app/actions.coffee +4 -0
- data/conf/message.yaml +1 -0
- data/conf/message_pl.yaml +1 -0
- data/config.coffee +3 -1
- data/engine2.gemspec +3 -3
- data/lib/engine2/action.rb +22 -5
- data/lib/engine2/action/array.rb +15 -2
- data/lib/engine2/action/delete.rb +1 -1
- data/lib/engine2/action/infra.rb +1 -1
- data/lib/engine2/action/list.rb +6 -5
- data/lib/engine2/core.rb +8 -0
- data/lib/engine2/pre_bootstrap.rb +0 -7
- data/lib/engine2/scheme.rb +16 -20
- data/lib/engine2/version.rb +1 -1
- data/package.json +7 -7
- data/views/infra/inspect.slim +8 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f307b0744d535f88e5d14eb1dd02369f0e4968514f6588f2de2c36227ebade
|
4
|
+
data.tar.gz: 9591533bcbb1f6dd0725ea9a4b9a28962bdc592ddb2f39def774e68542267f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0084179549f50cea923512513d748a01bd68df8210b18d13ed941cc2742b8a35dc4bfeb0d39105008f3fb0cb8870354680e380e56131704ce9340f35ba7be1a
|
7
|
+
data.tar.gz: c75817e746bf7e47313bbd8b5e61e3b6e04e2ae79e5c3b40cea82947af0386b13346f3eda78b73f924412c26a76565449bbc59b6e4d6157303c7135660929895
|
data/app/actions.coffee
CHANGED
@@ -197,6 +197,9 @@ angular.module('Engine2')
|
|
197
197
|
panel_menu_cancel: ->
|
198
198
|
@panel_close()
|
199
199
|
|
200
|
+
panel_menu_close: ->
|
201
|
+
@panel_close()
|
202
|
+
|
200
203
|
websocket_connect: ->
|
201
204
|
l = $location
|
202
205
|
ws_meta = @meta.websocket
|
@@ -244,6 +247,7 @@ angular.module('Engine2')
|
|
244
247
|
@tree = actions: [name: 'api', number: 0, access: true]
|
245
248
|
@invoke_action('models')
|
246
249
|
@invoke_action('environment')
|
250
|
+
@local_storage = localStorageService
|
247
251
|
|
248
252
|
open: (stack, node, collapsed, expand) ->
|
249
253
|
tree = @tree
|
data/conf/message.yaml
CHANGED
data/conf/message_pl.yaml
CHANGED
data/config.coffee
CHANGED
@@ -10,10 +10,12 @@ exports.config =
|
|
10
10
|
"angular-motion": ["dist/angular-motion.css"]
|
11
11
|
"angular-ui-tree": ["dist/angular-ui-tree.css"]
|
12
12
|
"fork-awesome": ["css/fork-awesome.css"]
|
13
|
+
"ui-select": ["dist/select.css"]
|
13
14
|
|
14
15
|
modules:
|
15
16
|
definition: 'commonjs'
|
16
17
|
wrapper: false
|
18
|
+
nameCleaner: (path) -> path
|
17
19
|
|
18
20
|
paths:
|
19
21
|
public: 'public'
|
@@ -42,7 +44,7 @@ exports.config =
|
|
42
44
|
on: ["ng-annotate-brunch"]
|
43
45
|
|
44
46
|
uglify:
|
45
|
-
mangle:
|
47
|
+
mangle: false
|
46
48
|
compress:
|
47
49
|
global_defs:
|
48
50
|
DEBUG: false
|
data/engine2.gemspec
CHANGED
@@ -18,14 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.add_dependency "sequel", '~> 5'
|
20
20
|
if defined? JRUBY_VERSION
|
21
|
-
spec.add_dependency 'jdbc-sqlite3', '~> 3.
|
21
|
+
spec.add_dependency 'jdbc-sqlite3', '~> 3.0'
|
22
22
|
else
|
23
23
|
spec.add_dependency 'sqlite3', '~> 1.3'
|
24
24
|
end
|
25
25
|
spec.add_dependency "sinatra", '~> 2.0'
|
26
|
-
spec.add_dependency 'slim', '~>
|
26
|
+
spec.add_dependency 'slim', '~> 4.0'
|
27
27
|
spec.add_dependency 'faye-websocket', '~> 0.10'
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.11"
|
30
|
-
spec.add_development_dependency "rake", "~>
|
30
|
+
spec.add_development_dependency "rake", "~> 12"
|
31
31
|
end
|
data/lib/engine2/action.rb
CHANGED
@@ -18,10 +18,13 @@ module Engine2
|
|
18
18
|
cls.http_method http_method
|
19
19
|
end
|
20
20
|
|
21
|
-
def inherit
|
22
|
-
Class.new self do
|
21
|
+
def inherit &blk
|
22
|
+
cls = Class.new self do
|
23
23
|
action_type superclass.action_type
|
24
24
|
end
|
25
|
+
|
26
|
+
cls.instance_eval &blk if block_given?
|
27
|
+
cls
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
@@ -46,9 +49,19 @@ module Engine2
|
|
46
49
|
raise E2Error.new("Static action required") if dynamic?
|
47
50
|
end
|
48
51
|
|
52
|
+
def check_anonymous_action_class name
|
53
|
+
raise E2Error.new("Defining method '#{name}'' for named class '#{self.class}', consider using #inherit") if self.class.name
|
54
|
+
end
|
55
|
+
|
56
|
+
def define_method name, &blk
|
57
|
+
check_anonymous_action_class name
|
58
|
+
self.class.class_eval{define_method name, &blk}
|
59
|
+
end
|
60
|
+
|
49
61
|
def define_invoke &blk
|
50
62
|
check_static_action
|
51
|
-
|
63
|
+
define_method :invoke, &blk
|
64
|
+
# self.class.class_eval{define_method :invoke, &blk}
|
52
65
|
end
|
53
66
|
|
54
67
|
def invoke! handler
|
@@ -154,6 +167,10 @@ module Engine2
|
|
154
167
|
def split_keys id
|
155
168
|
Sequel::split_keys(id)
|
156
169
|
end
|
170
|
+
|
171
|
+
def join_keys id
|
172
|
+
Sequel::join_keys(id)
|
173
|
+
end
|
157
174
|
end
|
158
175
|
|
159
176
|
module ActionWebSocketSupport
|
@@ -901,7 +918,7 @@ module Engine2
|
|
901
918
|
records = hash[node_name].to_a
|
902
919
|
unless records.empty?
|
903
920
|
action = node.parent[:"#{assoc_name}!"][node_name].approve.*
|
904
|
-
parent_id =
|
921
|
+
parent_id = join_keys(record.primary_key_values)
|
905
922
|
records.each do |arec|
|
906
923
|
rec = action.allocate_record(handler, arec)
|
907
924
|
action.validate_and_approve(handler, rec, parent_id, false)
|
@@ -1099,7 +1116,7 @@ module Engine2
|
|
1099
1116
|
panel_title "#{LOCS[:view_title]} - #{LOCS[assets[:model].table_name]}"
|
1100
1117
|
panel[:backdrop] = true
|
1101
1118
|
|
1102
|
-
menu(:panel_menu).option :
|
1119
|
+
menu(:panel_menu).option :close, icon: "remove"
|
1103
1120
|
node.parent.*.menu(:item_menu).option node.name, icon: "file", button_loc: false
|
1104
1121
|
end
|
1105
1122
|
|
data/lib/engine2/action/array.rb
CHANGED
@@ -11,7 +11,16 @@ module Engine2
|
|
11
11
|
entries.select{|e|e[name] == value}
|
12
12
|
},
|
13
13
|
string: lambda{|entries, name, value, type_info, hash|
|
14
|
-
|
14
|
+
if type_info[:type] == :list_select
|
15
|
+
if type_info[:multiselect]
|
16
|
+
entries.select{|e|value.include?(e[name].to_s)}
|
17
|
+
else
|
18
|
+
entries.select{|e|e[name].to_s == value}
|
19
|
+
end
|
20
|
+
else
|
21
|
+
entries.select{|e|e[name].to_s[value]}
|
22
|
+
end
|
23
|
+
|
15
24
|
},
|
16
25
|
boolean: lambda{|*args| DefaultFilters[:exact].(*args)},
|
17
26
|
integer: lambda{|entries, name, value, type_info, hash|
|
@@ -34,6 +43,10 @@ module Engine2
|
|
34
43
|
[]
|
35
44
|
end
|
36
45
|
|
46
|
+
def page_frame handler, entries
|
47
|
+
entries
|
48
|
+
end
|
49
|
+
|
37
50
|
def invoke handler
|
38
51
|
params = handler.params
|
39
52
|
# if params[:initial] || params[:refresh]
|
@@ -54,7 +67,7 @@ module Engine2
|
|
54
67
|
entries = list_search(entries, handler, search)
|
55
68
|
end
|
56
69
|
|
57
|
-
{entries: entries
|
70
|
+
{entries: page_frame(handler, entries[page, per_page]), count: entries.size}
|
58
71
|
end
|
59
72
|
|
60
73
|
def list_search entries, handler, search
|
@@ -22,7 +22,7 @@ module Engine2
|
|
22
22
|
unsupported_association assoc[:type]
|
23
23
|
end
|
24
24
|
|
25
|
-
if assoc[:
|
25
|
+
if assoc[:delete] == :cascade || from_assoc == assoc.associated_class.table_name
|
26
26
|
ds.delete
|
27
27
|
else
|
28
28
|
raise Sequel::DestroyFailed.new("#{LOCS[:delete_restricted]}: #{name}") unless ds.empty?
|
data/lib/engine2/action/infra.rb
CHANGED
data/lib/engine2/action/list.rb
CHANGED
@@ -164,7 +164,7 @@ module Engine2
|
|
164
164
|
action_type :star_to_many_list
|
165
165
|
def pre_run
|
166
166
|
super
|
167
|
-
menu(:panel_menu).option_at 0, :
|
167
|
+
menu(:panel_menu).option_at 0, :close, icon: "remove"
|
168
168
|
panel_title "#{:list.icon} #{LOCS[assets[:assoc][:name]]}"
|
169
169
|
end
|
170
170
|
|
@@ -208,13 +208,14 @@ module Engine2
|
|
208
208
|
|
209
209
|
def post_run
|
210
210
|
super
|
211
|
+
nd = node.parent.nodes[:decode_entry]
|
211
212
|
request do |h|
|
212
|
-
if h.initial?
|
213
|
+
if h.initial?
|
213
214
|
action = nd.*
|
214
|
-
rec = action.invoke_decode(h, [
|
215
|
+
rec = action.invoke_decode(h, [split_keys(h.params[:parent_id])]).first
|
215
216
|
panel_title "#{static.panel[:title]} - #{action.meta[:decode_fields].map{|f|rec[f]}.join(action.meta[:separator])}"
|
216
217
|
end
|
217
|
-
end
|
218
|
+
end if nd
|
218
219
|
end
|
219
220
|
end
|
220
221
|
|
@@ -241,7 +242,7 @@ module Engine2
|
|
241
242
|
def list_context query, handler
|
242
243
|
changes = handler.param_to_json(:changes)
|
243
244
|
model = assets[:model]
|
244
|
-
unlinked = changes[:unlink].to_a + changes[:delete].to_a + changes[:modify].to_a.map{|m|
|
245
|
+
unlinked = changes[:unlink].to_a + changes[:delete].to_a + changes[:modify].to_a.map{|m|join_keys(model.primary_keys.map{|k|m[k]})}
|
245
246
|
linked = changes[:link]
|
246
247
|
query = super(query, handler)
|
247
248
|
|
data/lib/engine2/core.rb
CHANGED
@@ -141,6 +141,10 @@ class Symbol
|
|
141
141
|
def q col
|
142
142
|
col.qualify self
|
143
143
|
end
|
144
|
+
|
145
|
+
def loc
|
146
|
+
Engine2::LOCS[self]
|
147
|
+
end
|
144
148
|
end
|
145
149
|
|
146
150
|
module Faye
|
@@ -199,6 +203,10 @@ module E2Model
|
|
199
203
|
module InstanceMethods
|
200
204
|
attr_accessor :skip_save_refresh, :validate_fields
|
201
205
|
|
206
|
+
def key? key
|
207
|
+
@values.key? key
|
208
|
+
end
|
209
|
+
|
202
210
|
def has_primary_key?
|
203
211
|
pk = self.pk
|
204
212
|
pk.is_a?(Array) ? !pk.all?{|k|k.nil?} : !pk.nil?
|
data/lib/engine2/scheme.rb
CHANGED
@@ -33,6 +33,14 @@ module Engine2
|
|
33
33
|
SCHEMES.builtin.clear
|
34
34
|
SCHEMES.instance_eval do
|
35
35
|
|
36
|
+
define_scheme :confirm do |name, action, options|
|
37
|
+
define_node :"confirm_#{name}", ConfirmAction do
|
38
|
+
self.*.panel_title options[:title]
|
39
|
+
self.*.message options[:message]
|
40
|
+
define_node name, action
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
36
44
|
define_scheme :view do |name = :view|
|
37
45
|
define_node name, ViewAction
|
38
46
|
end
|
@@ -50,19 +58,13 @@ module Engine2
|
|
50
58
|
end
|
51
59
|
|
52
60
|
define_scheme :delete do
|
53
|
-
|
54
|
-
|
55
|
-
self.*.panel_title LOCS[:confirm_delete_title]
|
56
|
-
define_node :delete, DeleteAction
|
57
|
-
end
|
61
|
+
run_scheme :confirm, :delete, DeleteAction,
|
62
|
+
message: LOCS[:delete_question], title: LOCS[:confirm_delete_title]
|
58
63
|
end
|
59
64
|
|
60
65
|
define_scheme :bulk_delete do
|
61
|
-
|
62
|
-
|
63
|
-
self.*.panel_title LOCS[:confirm_bulk_delete_title]
|
64
|
-
define_node :bulk_delete, BulkDeleteAction
|
65
|
-
end
|
66
|
+
run_scheme :confirm, :bulk_delete, BulkDeleteAction,
|
67
|
+
message: LOCS[:delete_question], title: LOCS[:confirm_bulk_delete_title]
|
66
68
|
end
|
67
69
|
|
68
70
|
define_scheme :default do |name, model, options|
|
@@ -114,19 +116,13 @@ module Engine2
|
|
114
116
|
# * to Many
|
115
117
|
#
|
116
118
|
define_scheme :star_to_many_unlink do
|
117
|
-
|
118
|
-
|
119
|
-
self.*.panel_title LOCS[:confirm_unlink_title]
|
120
|
-
define_node :unlink, StarToManyUnlinkAction
|
121
|
-
end
|
119
|
+
run_scheme :confirm, :unlink, StarToManyUnlinkAction,
|
120
|
+
message: LOCS[:unlink_question], title: LOCS[:confirm_unlink_title]
|
122
121
|
end
|
123
122
|
|
124
123
|
define_scheme :star_to_many_bulk_unlink do
|
125
|
-
|
126
|
-
|
127
|
-
self.*.panel_title LOCS[:confirm_bulk_unlink_title]
|
128
|
-
define_node :bulk_unlink, StarToManyBulkUnlinkAction
|
129
|
-
end
|
124
|
+
run_scheme :confirm, :bulk_unlink, StarToManyBulkUnlinkAction,
|
125
|
+
message: LOCS[:unlink_question], title: LOCS[:confirm_bulk_unlink_title]
|
130
126
|
end
|
131
127
|
|
132
128
|
define_scheme :star_to_many_link do
|
data/lib/engine2/version.rb
CHANGED
data/package.json
CHANGED
@@ -10,21 +10,21 @@
|
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"@uirouter/angularjs": "^1.0.5",
|
13
|
-
"angular": "^1.
|
14
|
-
"angular-animate": "^1.
|
15
|
-
"angular-cookies": "^1.
|
13
|
+
"angular": "^1.7.5",
|
14
|
+
"angular-animate": "^1.7.5",
|
15
|
+
"angular-cookies": "^1.7.5",
|
16
16
|
"angular-drag-and-drop-lists": "^2.1.0",
|
17
17
|
"angular-load": "^0.5.0",
|
18
18
|
"angular-local-storage": "^0.7.0",
|
19
19
|
"angular-motion": "^0.4.0",
|
20
|
-
"angular-sanitize": "^1.
|
20
|
+
"angular-sanitize": "^1.7.5",
|
21
21
|
"angular-ui-tree": "^2.22.0",
|
22
22
|
"bootstrap": "^3.3.0",
|
23
23
|
"bootstrap-additions": "0.3.1",
|
24
|
-
"fork-awesome": "^1.
|
25
|
-
"lodash": "
|
24
|
+
"fork-awesome": "^1.1.5",
|
25
|
+
"lodash": "^4.17.11",
|
26
26
|
"ng-file-upload": "^12.2.0",
|
27
|
-
"push.js": "^1.0.
|
27
|
+
"push.js": "^1.0.8",
|
28
28
|
"ui-select": "^0.19.8"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
data/views/infra/inspect.slim
CHANGED
@@ -89,6 +89,14 @@ e2-action action="'inspect'"
|
|
89
89
|
.panel-body
|
90
90
|
pre ng-bind="action.environment | json"
|
91
91
|
|
92
|
+
div title="Local storage" bs-pane=""
|
93
|
+
.panel.panel-default
|
94
|
+
.panel-body
|
95
|
+
pre ng-bind="action.local_storage | json"
|
96
|
+
pre ng-bind="action.local_storage.keys() | json"
|
97
|
+
a.btn.btn-default ng-click="action.local_storage.clearAll()"
|
98
|
+
| Clear
|
99
|
+
|
92
100
|
div title="Diagnostics" bs-pane=""
|
93
101
|
.panel.panel-default
|
94
102
|
.panel-body
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engine2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lopex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '4.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '4.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faye-websocket
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '12'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '12'
|
111
111
|
description: Tree based routing framework with scaffolding support
|
112
112
|
email:
|
113
113
|
- lopx@gazeta.pl
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
250
|
rubyforge_project:
|
251
|
-
rubygems_version:
|
251
|
+
rubygems_version: 2.7.6
|
252
252
|
signing_key:
|
253
253
|
specification_version: 4
|
254
254
|
summary: Tree based routing framework with scaffolding support
|