lolita 3.1.6 → 3.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/Gemfile +1 -1
  2. data/History.rdoc +8 -1
  3. data/README.rdoc +1 -1
  4. data/VERSION +1 -1
  5. data/app/controllers/lolita/info_controller.rb +38 -0
  6. data/app/controllers/lolita/rest_controller.rb +4 -4
  7. data/app/views/components/lolita/configuration/column/_display.html.erb +1 -1
  8. data/app/views/components/lolita/configuration/column/_header.html.erb +1 -1
  9. data/app/views/components/lolita/configuration/column/_sort.html.erb +1 -1
  10. data/app/views/components/lolita/configuration/columns/_last.html.erb +2 -2
  11. data/app/views/components/lolita/configuration/field/_display.html.erb +1 -1
  12. data/app/views/components/lolita/configuration/field/_label.html.erb +1 -1
  13. data/app/views/components/lolita/configuration/list/_filter.html.erb +1 -1
  14. data/app/views/components/lolita/configuration/list/_new_resource.html.erb +1 -1
  15. data/app/views/components/lolita/configuration/list/_title.html.erb +1 -1
  16. data/app/views/components/lolita/shared/_header.html.erb +1 -1
  17. data/app/views/components/lolita/shared/_right_sidebar.html.erb +1 -1
  18. data/app/views/layouts/lolita/application.html.erb +2 -2
  19. data/app/views/lolita/info/index.html.erb +232 -0
  20. data/lib/lolita.rb +3 -0
  21. data/lib/lolita/builder.rb +218 -55
  22. data/lib/lolita/configuration/filter.rb +1 -1
  23. data/lib/lolita/configuration/tab.rb +2 -2
  24. data/lib/lolita/controllers/component_helpers.rb +4 -5
  25. data/lib/lolita/controllers/internal_helpers.rb +3 -4
  26. data/lib/lolita/rails/routes.rb +12 -4
  27. data/lolita.gemspec +9 -6
  28. data/public/javascripts/lolita/application.js +1 -0
  29. data/public/javascripts/lolita/main.js +5 -0
  30. data/spec/builder_spec.rb +97 -18
  31. data/spec/controllers/lolita_rest_spec.rb +1 -1
  32. data/spec/navigation/branch_spec.rb +0 -1
  33. metadata +117 -118
@@ -0,0 +1 @@
1
+ /* Use this file for you application specific javascript */
@@ -12,11 +12,16 @@ $(function(){
12
12
  $("#flash").ajaxComplete(function(e,request){
13
13
  var notice=request.getResponseHeader("Lolita-Notice");
14
14
  var error=request.getResponseHeader("Lolita-Error");
15
+ var alert_msg=request.getResponseHeader("Lolita-Alert");
15
16
  if(notice){
16
17
  show_flash("<span style='color:green'>"+notice+"</span>");
17
18
  }else{
18
19
  if(error){
19
20
  show_flash("<span style='color:red'>"+error+"</span>");
21
+ }else{
22
+ if(alert_msg){
23
+ show_flash("<span style='color:yellow'>"+alert_msg+"</span>");
24
+ }
20
25
  }
21
26
  }
22
27
  })
data/spec/builder_spec.rb CHANGED
@@ -4,38 +4,117 @@ class SimpleObject
4
4
  include Lolita::Builder
5
5
  end
6
6
 
7
+ describe Lolita::Builder::Custom do
8
+ let(:object){SimpleObject.new}
9
+ let(:builder){Lolita::Builder::Custom.new(object,{})}
10
+ let(:klass){Lolita::Builder::Custom}
11
+
12
+ it "should create new Custom builder" do
13
+ builder = Lolita::Builder::Custom.new(object,{})
14
+ end
15
+
16
+ it "should set name and state" do
17
+ builder = Lolita::Builder::Custom.new(object,{:name => "name", :state=>"state"})
18
+ builder.instance_variable_get(:"@name").should == "name"
19
+ builder.instance_variable_get(:"@state").should == "state"
20
+ end
21
+
22
+ it "should set default attributes" do
23
+ builder = Lolita::Builder::Custom.new(object,{:name => "name"})
24
+ builder.instance_variable_get(:"@state").should == :display
25
+ end
26
+
27
+ describe "build attributes" do
28
+ it "should set through #with" do
29
+ builder.with("name","state").build_attributes.should == {:name => "name", :state => "state"}
30
+ builder.with({:name=>"name",:state=>"state"}).build_attributes.should == {:name => "name", :state=>"state"}
31
+ builder.with("name",:state=>"state").build_attributes.should == {:name=>"name",:state=>"state"}
32
+ end
33
+ end
34
+
35
+ it "should return default state when no build attributes given" do
36
+ builder.state.should == :display
37
+ end
38
+
39
+ it "should return build attributes state when given" do
40
+ builder.with(:state=>"state").state.should == :"state"
41
+ end
42
+
43
+ it "should return default name when no build name given" do
44
+ builder.name.should == :"/simple_object"
45
+ end
46
+
47
+ it "should return build name when given" do
48
+ builder.with(:name => "name").name.should == :"/simple_object/name"
49
+ builder.with(:name => "/name").name.should == :"/name"
50
+ end
51
+
52
+ describe "#build" do
53
+ it "should return array with name,state and options" do
54
+ builder.build.should == [:"/simple_object",:"display",{}]
55
+ builder.with({:display_value => 1}).build.should == [:"/simple_object",:display,{:display_value=>1}]
56
+ end
57
+ end
58
+
59
+ describe "conditions" do
60
+ it "should use given over default when there's no conditions" do
61
+ builder = klass.new(object,:name => "/custom", :state => "special")
62
+ builder.build.should == [:"/custom",:"special",{}]
63
+ end
64
+
65
+ it "should use given over default when conditions met" do
66
+ builder = klass.new(object, :name => "/custom", :state=>"special", :unless=>{:state=>"display"})
67
+ builder.build.should == [:"/simple_object",:"display",{}]
68
+ builder.class_eval do
69
+ def default_state
70
+ :other
71
+ end
72
+ end
73
+ builder.build.should == [:"/custom",:special,{}]
74
+ end
75
+
76
+ it "should use given over build given when conditions met" do
77
+ builder = klass.new(object,:name => "/custom", :"state" => "special", :if=>{:state=>"default"})
78
+ builder.with(:state => "other").build.should == [:"/simple_object",:other,{}]
79
+ builder.with(:state => :default).build.should == [:"/custom",:special,{}]
80
+ end
81
+ end
82
+ end
83
+
7
84
  describe Lolita::Builder do
8
85
 
9
86
  let(:object){SimpleObject.new}
10
87
 
11
88
  describe "#build" do
12
- it "should return default component information when no params passed" do
13
- info=object.build
14
- info.first.should == :"/simple_object"
15
- info[1].should == :display
16
- info.last.should have_key(:simple_object)
17
- end
18
89
 
19
- context "with instance builder" do
20
- it "should use given one" do
21
- object.builder="custom"
90
+ describe "default path" do
91
+
92
+ it "should be /:class_name/display" do
22
93
  info=object.build
23
- info.first.should==:"/simple_object/custom"
94
+ info.first.should == :"/simple_object"
95
+ info[1].should == :display
96
+ end
97
+
98
+ it "should use given name when it starts with /" do
99
+ object.builder = {:name =>"/custom"}
100
+ info = object.build
101
+ info.first.should == :"/custom"
24
102
  info[1].should == :display
25
103
  end
26
104
 
27
- it "should use that what #build receive" do
28
- object.builder="custom"
29
- info=object.build("other")
30
- info.first.should == :"/simple_object/other"
105
+ it "should make name /:class_name/:custom_name when it doesn't start with /" do
106
+ object.builder = {:name => "custom"}
107
+ info = object.build
108
+ info.first.should == :"/simple_object/custom"
31
109
  info[1].should == :display
32
110
  end
111
+
33
112
  end
34
113
 
35
- it "should accept empty name" do
36
- info=object.build("",:list)
37
- info.first.should == :"/simple_object"
38
- info[1].should == :list
114
+ it "should use received name" do
115
+ object.builder = {:name=>"/custom"}
116
+ info = object.build("/other_custom")
117
+ info.first.should == :"/other_custom"
39
118
  end
40
119
 
41
120
  end
@@ -40,7 +40,7 @@ describe Lolita::RestController do
40
40
  tab.type.should == :content
41
41
  tab.fields.by_name(:title).title = "foobar"
42
42
  get :new
43
- response.body.should =~/foobar/
43
+ response.body.should match(/foobar/i)
44
44
  end
45
45
 
46
46
  it "should display inline error messages if validations fail"
@@ -51,7 +51,6 @@ describe Lolita::Navigation::Branch do
51
51
  it "should add before and after branch" do
52
52
  branch=tree.append(Object)
53
53
  first_branch=Lolita::Navigation::Branch.new
54
- debugger
55
54
  first_branch.before(branch)
56
55
  last_branch=Lolita::Navigation::Branch.new
57
56
  last_branch.after(branch)
metadata CHANGED
@@ -1,182 +1,180 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lolita
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.1.7
4
5
  prerelease:
5
- version: 3.1.6
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - ITHouse (Latvia) and Arturs Meisters
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-05-19 00:00:00 +03:00
12
+ date: 2011-06-10 00:00:00.000000000 +03:00
14
13
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: rails
18
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &76216020 !ruby/object:Gem::Requirement
19
18
  none: false
20
- requirements:
19
+ requirements:
21
20
  - - ~>
22
- - !ruby/object:Gem::Version
23
- version: "3.0"
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
24
23
  type: :runtime
25
24
  prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *76216020
26
+ - !ruby/object:Gem::Dependency
28
27
  name: kaminari
29
- requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirement: &76215300 !ruby/object:Gem::Requirement
30
29
  none: false
31
- requirements:
30
+ requirements:
32
31
  - - ~>
33
- - !ruby/object:Gem::Version
34
- version: 0.11.0
32
+ - !ruby/object:Gem::Version
33
+ version: 0.12.4
35
34
  type: :runtime
36
35
  prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *76215300
37
+ - !ruby/object:Gem::Dependency
39
38
  name: abstract
40
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ requirement: &76214830 !ruby/object:Gem::Requirement
41
40
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
46
45
  type: :runtime
47
46
  prerelease: false
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *76214830
48
+ - !ruby/object:Gem::Dependency
50
49
  name: builder
51
- requirement: &id004 !ruby/object:Gem::Requirement
50
+ requirement: &76214280 !ruby/object:Gem::Requirement
52
51
  none: false
53
- requirements:
52
+ requirements:
54
53
  - - ~>
55
- - !ruby/object:Gem::Version
54
+ - !ruby/object:Gem::Version
56
55
  version: 2.1.2
57
56
  type: :runtime
58
57
  prerelease: false
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
58
+ version_requirements: *76214280
59
+ - !ruby/object:Gem::Dependency
61
60
  name: jeweler
62
- requirement: &id005 !ruby/object:Gem::Requirement
61
+ requirement: &76213800 !ruby/object:Gem::Requirement
63
62
  none: false
64
- requirements:
63
+ requirements:
65
64
  - - ~>
66
- - !ruby/object:Gem::Version
65
+ - !ruby/object:Gem::Version
67
66
  version: 1.5.2
68
67
  type: :development
69
68
  prerelease: false
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
69
+ version_requirements: *76213800
70
+ - !ruby/object:Gem::Dependency
72
71
  name: rspec
73
- requirement: &id006 !ruby/object:Gem::Requirement
72
+ requirement: &76213500 !ruby/object:Gem::Requirement
74
73
  none: false
75
- requirements:
74
+ requirements:
76
75
  - - ~>
77
- - !ruby/object:Gem::Version
76
+ - !ruby/object:Gem::Version
78
77
  version: 2.6.0
79
78
  type: :development
80
79
  prerelease: false
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
80
+ version_requirements: *76213500
81
+ - !ruby/object:Gem::Dependency
83
82
  name: rspec-rails
84
- requirement: &id007 !ruby/object:Gem::Requirement
83
+ requirement: &76213200 !ruby/object:Gem::Requirement
85
84
  none: false
86
- requirements:
85
+ requirements:
87
86
  - - ~>
88
- - !ruby/object:Gem::Version
87
+ - !ruby/object:Gem::Version
89
88
  version: 2.6.0
90
89
  type: :development
91
90
  prerelease: false
92
- version_requirements: *id007
93
- - !ruby/object:Gem::Dependency
91
+ version_requirements: *76213200
92
+ - !ruby/object:Gem::Dependency
94
93
  name: factory_girl
95
- requirement: &id008 !ruby/object:Gem::Requirement
94
+ requirement: &76212630 !ruby/object:Gem::Requirement
96
95
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- version: "0"
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
101
100
  type: :development
102
101
  prerelease: false
103
- version_requirements: *id008
104
- - !ruby/object:Gem::Dependency
102
+ version_requirements: *76212630
103
+ - !ruby/object:Gem::Dependency
105
104
  name: ffaker
106
- requirement: &id009 !ruby/object:Gem::Requirement
105
+ requirement: &76211740 !ruby/object:Gem::Requirement
107
106
  none: false
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: "0"
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
112
111
  type: :development
113
112
  prerelease: false
114
- version_requirements: *id009
115
- - !ruby/object:Gem::Dependency
113
+ version_requirements: *76211740
114
+ - !ruby/object:Gem::Dependency
116
115
  name: ruby-debug19
117
- requirement: &id010 !ruby/object:Gem::Requirement
116
+ requirement: &76211450 !ruby/object:Gem::Requirement
118
117
  none: false
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: "0"
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
123
122
  type: :development
124
123
  prerelease: false
125
- version_requirements: *id010
126
- - !ruby/object:Gem::Dependency
124
+ version_requirements: *76211450
125
+ - !ruby/object:Gem::Dependency
127
126
  name: cucumber-rails
128
- requirement: &id011 !ruby/object:Gem::Requirement
127
+ requirement: &76211100 !ruby/object:Gem::Requirement
129
128
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- version: "0"
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
134
133
  type: :development
135
134
  prerelease: false
136
- version_requirements: *id011
137
- - !ruby/object:Gem::Dependency
135
+ version_requirements: *76211100
136
+ - !ruby/object:Gem::Dependency
138
137
  name: capybara
139
- requirement: &id012 !ruby/object:Gem::Requirement
138
+ requirement: &76210810 !ruby/object:Gem::Requirement
140
139
  none: false
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: "0"
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
145
144
  type: :development
146
145
  prerelease: false
147
- version_requirements: *id012
148
- - !ruby/object:Gem::Dependency
146
+ version_requirements: *76210810
147
+ - !ruby/object:Gem::Dependency
149
148
  name: database_cleaner
150
- requirement: &id013 !ruby/object:Gem::Requirement
149
+ requirement: &76210510 !ruby/object:Gem::Requirement
151
150
  none: false
152
- requirements:
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- version: "0"
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
156
155
  type: :development
157
156
  prerelease: false
158
- version_requirements: *id013
159
- - !ruby/object:Gem::Dependency
157
+ version_requirements: *76210510
158
+ - !ruby/object:Gem::Dependency
160
159
  name: akephalos
161
- requirement: &id014 !ruby/object:Gem::Requirement
160
+ requirement: &76210170 !ruby/object:Gem::Requirement
162
161
  none: false
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: "0"
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
167
166
  type: :development
168
167
  prerelease: false
169
- version_requirements: *id014
170
- description: "Great Rails CMS, that turns your business logic into good-looking, fully functional workspace. "
168
+ version_requirements: *76210170
169
+ description: ! 'Great Rails CMS, that turns your business logic into good-looking,
170
+ fully functional workspace. '
171
171
  email: support@ithouse.lv
172
172
  executables: []
173
-
174
173
  extensions: []
175
-
176
- extra_rdoc_files:
174
+ extra_rdoc_files:
177
175
  - LICENSE.txt
178
176
  - README.rdoc
179
- files:
177
+ files:
180
178
  - .document
181
179
  - .rspec
182
180
  - GUIDELINES.rdoc
@@ -186,6 +184,7 @@ files:
186
184
  - README.rdoc
187
185
  - Rakefile
188
186
  - VERSION
187
+ - app/controllers/lolita/info_controller.rb
189
188
  - app/controllers/lolita/rest_controller.rb
190
189
  - app/helpers/components/lolita/configuration/list_component.rb
191
190
  - app/helpers/lolita_helper.rb
@@ -238,6 +237,7 @@ files:
238
237
  - app/views/components/lolita/shared/_header.html.erb
239
238
  - app/views/components/lolita/shared/_right_sidebar.html.erb
240
239
  - app/views/layouts/lolita/application.html.erb
240
+ - app/views/lolita/info/index.html.erb
241
241
  - app/views/lolita/rest/form.html.erb
242
242
  - app/views/lolita/rest/index.html.erb
243
243
  - author
@@ -309,6 +309,7 @@ files:
309
309
  - public/images/lolita/plus.png
310
310
  - public/javascripts/jquery-1.6.min.js
311
311
  - public/javascripts/jquery-ui-1.8.13.min.js
312
+ - public/javascripts/lolita/application.js
312
313
  - public/javascripts/lolita/main.js
313
314
  - public/javascripts/lolita/tab.js
314
315
  - public/javascripts/modernizr-1.7.min.js
@@ -482,36 +483,34 @@ files:
482
483
  - spec/support/formatter_spec.rb
483
484
  has_rdoc: true
484
485
  homepage: http://github.com/ithouse/lolita
485
- licenses:
486
+ licenses:
486
487
  - MIT
487
488
  post_install_message:
488
489
  rdoc_options: []
489
-
490
- require_paths:
490
+ require_paths:
491
491
  - lib
492
- required_ruby_version: !ruby/object:Gem::Requirement
492
+ required_ruby_version: !ruby/object:Gem::Requirement
493
493
  none: false
494
- requirements:
495
- - - ">="
496
- - !ruby/object:Gem::Version
497
- hash: 354459983
498
- segments:
494
+ requirements:
495
+ - - ! '>='
496
+ - !ruby/object:Gem::Version
497
+ version: '0'
498
+ segments:
499
499
  - 0
500
- version: "0"
501
- required_rubygems_version: !ruby/object:Gem::Requirement
500
+ hash: 23472445
501
+ required_rubygems_version: !ruby/object:Gem::Requirement
502
502
  none: false
503
- requirements:
504
- - - ">="
505
- - !ruby/object:Gem::Version
506
- version: "0"
503
+ requirements:
504
+ - - ! '>='
505
+ - !ruby/object:Gem::Version
506
+ version: '0'
507
507
  requirements: []
508
-
509
508
  rubyforge_project:
510
- rubygems_version: 1.6.1
509
+ rubygems_version: 1.6.2
511
510
  signing_key:
512
511
  specification_version: 3
513
512
  summary: Great Rails CMS.
514
- test_files:
513
+ test_files:
515
514
  - spec/adapter_helper.rb
516
515
  - spec/builder_spec.rb
517
516
  - spec/configuration/base_spec.rb