lolita 3.1.0 → 3.1.1
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/{GUIDELINE → GUIDELINES} +0 -0
- data/History.rdoc +70 -0
- data/LICENSE.txt +3 -1
- data/README.rdoc +5 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/app/controllers/lolita/rest_controller.rb +1 -1
- data/app/views/components/lolita/configuration/field/array/filter/_display.html.erb +1 -0
- data/app/views/components/lolita/configuration/field/boolean/filter/_display.html.erb +2 -0
- data/app/views/components/lolita/configuration/field/date_time/_display.html.erb +1 -0
- data/app/views/components/lolita/configuration/field/date_time/date/_display.html.erb +1 -0
- data/app/views/components/lolita/configuration/field/date_time/time/_display.html.erb +1 -0
- data/app/views/components/lolita/configuration/field/time/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/list/_filter.html.erb +2 -2
- data/config/locales/en.yml +4 -1
- data/lib/lolita.rb +18 -11
- data/lib/lolita/adapter/abstract_adapter.rb +1 -1
- data/lib/lolita/adapter/active_record.rb +28 -1
- data/lib/lolita/adapter/mongoid.rb +25 -2
- data/lib/lolita/configuration/field/array.rb +1 -0
- data/lib/lolita/configuration/field/date.rb +1 -1
- data/lib/lolita/configuration/field/date_time.rb +13 -0
- data/lib/lolita/configuration/filter.rb +24 -0
- data/lib/lolita/configuration/list.rb +4 -1
- data/lib/lolita/configuration/page.rb +18 -2
- data/lib/lolita/controllers/internal_helpers.rb +1 -0
- data/lib/lolita/hooks.rb +22 -22
- data/lib/lolita/hooks/named_hook.rb +7 -3
- data/lib/lolita/navigation/branch.rb +7 -0
- data/lib/lolita/navigation/tree.rb +7 -0
- data/lolita.gemspec +22 -12
- data/public/stylesheets/lolita/style.css +16 -0
- data/spec/adapter_helper.rb +1 -1
- data/spec/configuration/filter_spec.rb +63 -1
- data/spec/controllers/internal_helpers_spec.rb +7 -0
- data/spec/controllers/lolita_rest_spec.rb +1 -0
- data/spec/hooks_spec.rb +16 -15
- data/spec/navigation/tree_spec.rb +41 -18
- data/spec/orm/mongoid.rb +4 -7
- data/spec/rails_app/app/mongoid/address.rb +1 -1
- data/spec/rails_app/app/mongoid/category.rb +6 -0
- data/spec/rails_app/app/mongoid/comment.rb +2 -2
- data/spec/rails_app/app/mongoid/post.rb +10 -6
- data/spec/rails_app/app/mongoid/preference.rb +1 -1
- data/spec/rails_app/app/mongoid/profile.rb +3 -3
- data/spec/rails_app/app/mongoid/tag.rb +4 -0
- data/spec/support/factories/category.rb +3 -0
- data/spec/support/factories/post.rb +1 -0
- data/spec/support/factories/tag.rb +3 -0
- metadata +23 -14
- data/.project +0 -17
- data/lib/lolita/navigation.rb +0 -48
- data/log/development.log +0 -0
- data/test/cells/form_cell_test.rb +0 -15
- data/test/test_helper.rb +0 -2
@@ -2,6 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../simple_spec_helper')
|
|
2
2
|
|
3
3
|
describe Lolita::Navigation::Tree do
|
4
4
|
|
5
|
+
let(:tree){Lolita::Navigation::Tree.new("test")}
|
6
|
+
|
5
7
|
context "#new" do
|
6
8
|
it "should create new navigation tree with name" do
|
7
9
|
tree=Lolita::Navigation::Tree.new("Test tree")
|
@@ -16,7 +18,12 @@ describe Lolita::Navigation::Tree do
|
|
16
18
|
|
17
19
|
end
|
18
20
|
|
19
|
-
|
21
|
+
describe "work with nodes" do
|
22
|
+
it "should have root branch with level 0" do
|
23
|
+
tree.root.should_not be_nil
|
24
|
+
tree.root.level.should == 0
|
25
|
+
end
|
26
|
+
end
|
20
27
|
|
21
28
|
context "#add" do
|
22
29
|
it "should accept object, position and options" do
|
@@ -26,34 +33,50 @@ describe Lolita::Navigation::Tree do
|
|
26
33
|
end
|
27
34
|
|
28
35
|
context "#each" do
|
29
|
-
|
30
|
-
|
31
|
-
0.upto(3){|i|
|
32
|
-
p_tree.add(Object,:append,:url=>"/#{i}",:name=>"branch#{i}")
|
33
|
-
}
|
34
|
-
p_tree
|
35
|
-
}
|
36
|
+
|
37
|
+
let(:empty_branch){Lolita::Navigation::Branch.new(Object,:url=>"/")}
|
36
38
|
|
37
39
|
it "should iterate through all branches" do
|
38
|
-
|
40
|
+
0.upto(3){|i|
|
41
|
+
tree.add(Object,:append,:url=>"/#{i}",:name=>"branch#{i}")
|
42
|
+
}
|
43
|
+
tree.each_with_index do |branch,index|
|
39
44
|
branch.name.should == "branch#{index}"
|
40
45
|
end
|
41
46
|
end
|
42
|
-
end
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
48
|
+
it "should itereate in each level" do
|
49
|
+
parent_branch=tree.root
|
50
|
+
branch=empty_branch
|
51
|
+
0.upto(5){|i|
|
52
|
+
parent_branch.append(branch)
|
53
|
+
parent_branch=branch
|
54
|
+
branch=Lolita::Navigation::Branch.new(Object,:url=>"/")
|
55
|
+
}
|
56
|
+
level_counter=1
|
57
|
+
tree.each_level do |branches,level|
|
58
|
+
branches.should have(1).item
|
59
|
+
level.should == level_counter
|
60
|
+
level_counter+=1
|
61
|
+
end
|
47
62
|
end
|
48
63
|
end
|
49
64
|
|
50
|
-
it "should
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
65
|
+
it "should have callbacks" do
|
66
|
+
Lolita::Navigation::Tree.should respond_to(:hooks)
|
67
|
+
hook_names=[:before_load,:after_load,:before_branch_added,:after_branch_added]
|
68
|
+
(Lolita::Navigation::Tree.hooks - hook_names).should be_empty
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should have way to add branches based on earlier added branches" do
|
72
|
+
tree.after_branch_added do
|
73
|
+
self.each do |branch|
|
74
|
+
if branch.resources.is_a?(Object)
|
75
|
+
branch.append(Object,:url=>"/")
|
76
|
+
end
|
55
77
|
end
|
56
78
|
end
|
79
|
+
tree.add(Object,:append,:url=>"/mypath")
|
57
80
|
tree.should have(2).branches
|
58
81
|
end
|
59
82
|
end
|
data/spec/orm/mongoid.rb
CHANGED
@@ -4,12 +4,9 @@ Mongoid.configure do |config|
|
|
4
4
|
config.master = Mongo::Connection.new('127.0.0.1', 27017).db("lolita3-test")
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Address.delete_all
|
12
|
-
Preference.delete_all
|
13
|
-
Profile.delete_all
|
7
|
+
# truncate data
|
8
|
+
Mongoid.database.collections.each do |collection|
|
9
|
+
unless collection.name =~ /^system\./
|
10
|
+
collection.remove
|
14
11
|
end
|
15
12
|
end
|
@@ -1,12 +1,16 @@
|
|
1
1
|
class Post
|
2
2
|
include Mongoid::Document
|
3
3
|
include Lolita::Configuration
|
4
|
-
field :title, :
|
5
|
-
field :body, :
|
6
|
-
field :is_public, :
|
7
|
-
field :price, :
|
8
|
-
|
9
|
-
|
4
|
+
field :title, type: String
|
5
|
+
field :body, type: String
|
6
|
+
field :is_public, type: Boolean
|
7
|
+
field :price, type: BigDecimal
|
8
|
+
field :published_at, type: DateTime, default: -> { Time.now }
|
9
|
+
field :expire_date, type: Date
|
10
|
+
belongs_to :category
|
11
|
+
has_and_belongs_to_many :tags
|
12
|
+
has_many :comments
|
13
|
+
belongs_to :profile
|
10
14
|
validates_presence_of :title
|
11
15
|
lolita
|
12
16
|
end
|
@@ -4,9 +4,9 @@ class Profile
|
|
4
4
|
field :name, :type=>String
|
5
5
|
field :age
|
6
6
|
field :genere
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
has_many :posts
|
8
|
+
has_many :comments
|
9
|
+
has_and_belongs_to_many :preferences
|
10
10
|
embeds_one :address
|
11
11
|
lolita do
|
12
12
|
|
metadata
CHANGED
@@ -2,16 +2,15 @@
|
|
2
2
|
name: lolita
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.1.
|
5
|
+
version: 3.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- ITHouse
|
9
|
-
- Arturs Meisters
|
8
|
+
- ITHouse (Latvia) and Arturs Meisters
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
12
|
|
14
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-13 00:00:00 +03:00
|
15
14
|
default_executable:
|
16
15
|
dependencies:
|
17
16
|
- !ruby/object:Gem::Dependency
|
@@ -168,7 +167,7 @@ dependencies:
|
|
168
167
|
type: :development
|
169
168
|
prerelease: false
|
170
169
|
version_requirements: *id014
|
171
|
-
description: Great Rails CMS that
|
170
|
+
description: "Great Rails CMS, that turns your business logic into good-looking, fully functional workspace. "
|
172
171
|
email: support@ithouse.lv
|
173
172
|
executables: []
|
174
173
|
|
@@ -179,10 +178,10 @@ extra_rdoc_files:
|
|
179
178
|
- README.rdoc
|
180
179
|
files:
|
181
180
|
- .document
|
182
|
-
- .project
|
183
181
|
- .rspec
|
184
|
-
-
|
182
|
+
- GUIDELINES
|
185
183
|
- Gemfile
|
184
|
+
- History.rdoc
|
186
185
|
- IDEA
|
187
186
|
- LICENSE.txt
|
188
187
|
- README.rdoc
|
@@ -195,11 +194,16 @@ files:
|
|
195
194
|
- app/views/components/lolita/configuration/field/_label.html.erb
|
196
195
|
- app/views/components/lolita/configuration/field/_object.html.erb
|
197
196
|
- app/views/components/lolita/configuration/field/array/_display.html.erb
|
197
|
+
- app/views/components/lolita/configuration/field/array/filter/_display.html.erb
|
198
198
|
- app/views/components/lolita/configuration/field/array/habtm/_display.html.erb
|
199
199
|
- app/views/components/lolita/configuration/field/array/select/_display.html.erb
|
200
200
|
- app/views/components/lolita/configuration/field/big_decimal/_display.html.erb
|
201
201
|
- app/views/components/lolita/configuration/field/boolean/_display.html.erb
|
202
|
+
- app/views/components/lolita/configuration/field/boolean/filter/_display.html.erb
|
202
203
|
- app/views/components/lolita/configuration/field/date/_display.html.erb
|
204
|
+
- app/views/components/lolita/configuration/field/date_time/_display.html.erb
|
205
|
+
- app/views/components/lolita/configuration/field/date_time/date/_display.html.erb
|
206
|
+
- app/views/components/lolita/configuration/field/date_time/time/_display.html.erb
|
203
207
|
- app/views/components/lolita/configuration/field/float/_display.html.erb
|
204
208
|
- app/views/components/lolita/configuration/field/integer/_display.html.erb
|
205
209
|
- app/views/components/lolita/configuration/field/string/_display.html.erb
|
@@ -262,6 +266,7 @@ files:
|
|
262
266
|
- lib/lolita/configuration/field/big_decimal.rb
|
263
267
|
- lib/lolita/configuration/field/boolean.rb
|
264
268
|
- lib/lolita/configuration/field/date.rb
|
269
|
+
- lib/lolita/configuration/field/date_time.rb
|
265
270
|
- lib/lolita/configuration/field/integer.rb
|
266
271
|
- lib/lolita/configuration/field/string.rb
|
267
272
|
- lib/lolita/configuration/field/time.rb
|
@@ -287,14 +292,14 @@ files:
|
|
287
292
|
- lib/lolita/mapping.rb
|
288
293
|
- lib/lolita/modules.rb
|
289
294
|
- lib/lolita/modules/rest.rb
|
290
|
-
- lib/lolita/navigation.rb
|
295
|
+
- lib/lolita/navigation/branch.rb
|
296
|
+
- lib/lolita/navigation/tree.rb
|
291
297
|
- lib/lolita/observed_array.rb
|
292
298
|
- lib/lolita/rails.rb
|
293
299
|
- lib/lolita/rails/all.rb
|
294
300
|
- lib/lolita/rails/routes.rb
|
295
301
|
- lib/lolita/ruby_ext/accessors.rb
|
296
302
|
- lib/lolita/test/matchers.rb
|
297
|
-
- log/development.log
|
298
303
|
- lolita.gemspec
|
299
304
|
- public/images/lolita/plus.png
|
300
305
|
- public/javascripts/jquery-1.5.1.min.js
|
@@ -377,10 +382,12 @@ files:
|
|
377
382
|
- spec/rails_app/app/controllers/application_controller.rb
|
378
383
|
- spec/rails_app/app/helpers/application_helper.rb
|
379
384
|
- spec/rails_app/app/mongoid/address.rb
|
385
|
+
- spec/rails_app/app/mongoid/category.rb
|
380
386
|
- spec/rails_app/app/mongoid/comment.rb
|
381
387
|
- spec/rails_app/app/mongoid/post.rb
|
382
388
|
- spec/rails_app/app/mongoid/preference.rb
|
383
389
|
- spec/rails_app/app/mongoid/profile.rb
|
390
|
+
- spec/rails_app/app/mongoid/tag.rb
|
384
391
|
- spec/rails_app/app/views/components/lolita/configuration/list/_body_cell.html.erb
|
385
392
|
- spec/rails_app/config/application.rb
|
386
393
|
- spec/rails_app/config/boot.rb
|
@@ -456,9 +463,9 @@ files:
|
|
456
463
|
- spec/routing/routes_spec.rb
|
457
464
|
- spec/simple_spec_helper.rb
|
458
465
|
- spec/spec_helper.rb
|
466
|
+
- spec/support/factories/category.rb
|
459
467
|
- spec/support/factories/post.rb
|
460
|
-
-
|
461
|
-
- test/test_helper.rb
|
468
|
+
- spec/support/factories/tag.rb
|
462
469
|
has_rdoc: true
|
463
470
|
homepage: http://github.com/ithouse/lolita
|
464
471
|
licenses:
|
@@ -473,7 +480,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
473
480
|
requirements:
|
474
481
|
- - ">="
|
475
482
|
- !ruby/object:Gem::Version
|
476
|
-
hash: -
|
483
|
+
hash: -453610993
|
477
484
|
segments:
|
478
485
|
- 0
|
479
486
|
version: "0"
|
@@ -514,10 +521,12 @@ test_files:
|
|
514
521
|
- spec/rails_app/app/controllers/application_controller.rb
|
515
522
|
- spec/rails_app/app/helpers/application_helper.rb
|
516
523
|
- spec/rails_app/app/mongoid/address.rb
|
524
|
+
- spec/rails_app/app/mongoid/category.rb
|
517
525
|
- spec/rails_app/app/mongoid/comment.rb
|
518
526
|
- spec/rails_app/app/mongoid/post.rb
|
519
527
|
- spec/rails_app/app/mongoid/preference.rb
|
520
528
|
- spec/rails_app/app/mongoid/profile.rb
|
529
|
+
- spec/rails_app/app/mongoid/tag.rb
|
521
530
|
- spec/rails_app/config/application.rb
|
522
531
|
- spec/rails_app/config/boot.rb
|
523
532
|
- spec/rails_app/config/environment.rb
|
@@ -534,6 +543,6 @@ test_files:
|
|
534
543
|
- spec/routing/routes_spec.rb
|
535
544
|
- spec/simple_spec_helper.rb
|
536
545
|
- spec/spec_helper.rb
|
546
|
+
- spec/support/factories/category.rb
|
537
547
|
- spec/support/factories/post.rb
|
538
|
-
-
|
539
|
-
- test/test_helper.rb
|
548
|
+
- spec/support/factories/tag.rb
|
data/.project
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<projectDescription>
|
3
|
-
<name>lolita3</name>
|
4
|
-
<comment></comment>
|
5
|
-
<projects>
|
6
|
-
</projects>
|
7
|
-
<buildSpec>
|
8
|
-
<buildCommand>
|
9
|
-
<name>com.aptana.ide.core.unifiedBuilder</name>
|
10
|
-
<arguments>
|
11
|
-
</arguments>
|
12
|
-
</buildCommand>
|
13
|
-
</buildSpec>
|
14
|
-
<natures>
|
15
|
-
<nature>com.aptana.ruby.core.rubynature</nature>
|
16
|
-
</natures>
|
17
|
-
</projectDescription>
|
data/lib/lolita/navigation.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module Lolita
|
2
|
-
module Navigation
|
3
|
-
|
4
|
-
class Tree
|
5
|
-
include Lolita::ObservedArray
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@branches=[]
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def collection_variable
|
14
|
-
@branches
|
15
|
-
end
|
16
|
-
|
17
|
-
def build_element element,*args
|
18
|
-
if element.is_a?(Lolita::Navigation::Branch)
|
19
|
-
element
|
20
|
-
else
|
21
|
-
Lolita::Navigation::Branch.new(*args)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end #base class end
|
25
|
-
|
26
|
-
#
|
27
|
-
# c_branch=Branch.new(:category)
|
28
|
-
# c_branch.mapping == Lolita.mappings[:category] #=>true
|
29
|
-
# c.branch.resource == Lolita.mappings[:category].to #=>true
|
30
|
-
# Branch.new(:page, :path=>{:action=>:new},:after=>Navigation.by_name(:category,:level=>1))
|
31
|
-
# Branch.new(:user,:prepend=>Navigation.root || {:level=>0} || 0)
|
32
|
-
# Branch.new(
|
33
|
-
# Proc.new{|resource| resource.lolita.reports.by_name("statistic")},
|
34
|
-
# :append=>Navigation.by_name(:category,:level=>1),
|
35
|
-
# :path=>{:action=>:report,:plural=>true}
|
36
|
-
# )
|
37
|
-
class Branch
|
38
|
-
attr_reader :name
|
39
|
-
|
40
|
-
def initialize(*args)
|
41
|
-
options=args.extract_options!
|
42
|
-
@name=args.first
|
43
|
-
|
44
|
-
end
|
45
|
-
end #branch class end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
data/log/development.log
DELETED
File without changes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# To change this template, choose Tools | Templates
|
2
|
-
# and open the template in the editor.
|
3
|
-
|
4
|
-
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
|
5
|
-
|
6
|
-
require 'test/unit'
|
7
|
-
require 'form_cell'
|
8
|
-
|
9
|
-
class FormCellTest < Test::Unit::TestCase
|
10
|
-
def test_foo
|
11
|
-
#TODO: Write test
|
12
|
-
flunk "TODO: Write test"
|
13
|
-
# assert_equal("foo", bar)
|
14
|
-
end
|
15
|
-
end
|
data/test/test_helper.rb
DELETED