classiccms 0.3.4 → 0.3.5
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.
- data/.gitignore +1 -0
- data/lib/classiccms/controllers/cms.rb +14 -5
- data/lib/classiccms/version.rb +1 -1
- data/lib/classiccms/views/cms/add_window.haml +2 -1
- data/spec/controllers/cms_spec.rb +20 -1
- metadata +2 -2
data/.gitignore
CHANGED
|
@@ -15,11 +15,20 @@ module Classiccms
|
|
|
15
15
|
if params['cms'] != nil and params['cms'].length > 2
|
|
16
16
|
begin
|
|
17
17
|
params['cms'] = Base64.decode64(params['cms']).decrypt
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
new_params= eval(params['cms'])
|
|
19
|
+
records = []
|
|
20
|
+
new_params.each do |new|
|
|
21
|
+
record = new[0].new
|
|
22
|
+
records.each do |i|
|
|
23
|
+
if i.kind_of? new[0]
|
|
24
|
+
record = i
|
|
25
|
+
records.delete(i)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
record.connections << Connection.new(:parent_id => new[1], :section => new[2], :files => new[2..new.length])
|
|
29
|
+
records << record
|
|
30
|
+
end
|
|
31
|
+
show :add_window, {}, {:records => records}
|
|
23
32
|
rescue TypeError, ArgumentError
|
|
24
33
|
''
|
|
25
34
|
end
|
data/lib/classiccms/version.rb
CHANGED
|
@@ -71,6 +71,25 @@ describe Classiccms do
|
|
|
71
71
|
post '/add', {:cms => string}
|
|
72
72
|
last_response.body.should match("action='/cms/create'")
|
|
73
73
|
end
|
|
74
|
+
it 'should render multiple connections' do
|
|
75
|
+
login
|
|
76
|
+
m = Menu.new
|
|
77
|
+
string = Base64.encode64([[Menu, 0, 'first'], [Menu, 0, 'second']].to_s.encrypt)
|
|
78
|
+
post '/add', {:cms => string}
|
|
79
|
+
last_response.body.should match("value='first'")
|
|
80
|
+
last_response.body.should match("value='second'")
|
|
81
|
+
end
|
|
82
|
+
it 'should render only the first model' do
|
|
83
|
+
#create model
|
|
84
|
+
set_file "models/article.rb", "class Article < Base; field :name, input: 'input'; validates_length_of :name, maximum: 10; end"
|
|
85
|
+
require_models
|
|
86
|
+
|
|
87
|
+
login
|
|
88
|
+
string = Base64.encode64([[Menu, 0, 'first'], [Article, 0, 'second']].to_s.encrypt)
|
|
89
|
+
post '/add', {:cms => string}
|
|
90
|
+
last_response.body.should match("value='first'")
|
|
91
|
+
last_response.body.should_not match("value='second'")
|
|
92
|
+
end
|
|
74
93
|
end
|
|
75
94
|
|
|
76
95
|
describe 'edit' do
|
|
@@ -215,6 +234,6 @@ describe Classiccms do
|
|
|
215
234
|
end
|
|
216
235
|
|
|
217
236
|
after :all do
|
|
218
|
-
|
|
237
|
+
clear_tmp
|
|
219
238
|
end
|
|
220
239
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: classiccms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-06-
|
|
12
|
+
date: 2012-06-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|