orange-more 0.6.5 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,9 @@ module Orange
20
20
  packet.session['user.id'] = matches.first.open_id
21
21
  packet['user.id'] = matches.first.open_id
22
22
  return true
23
- else
23
+ else
24
+ packet['user.id'] = nil
25
+ packet.session['user.id'] = nil
24
26
  return false
25
27
  end
26
28
  end
@@ -22,7 +22,7 @@ class OrangeAsset < Orange::Carton
22
22
 
23
23
  def to_s
24
24
  <<-DOC
25
- {"id": #{self.id}, "html": "#{self.to_asset_tag}"}
25
+ {"id": #{self.id}, "name": "#{self.name}", "caption": "#{self.caption}", "html": "#{self.to_asset_tag}"}
26
26
  DOC
27
27
  end
28
28
 
@@ -4,7 +4,7 @@ module Orange
4
4
  # Define a helper for input type="text" type database stuff
5
5
  # Show in a context if wrapped in one of the helpers
6
6
  def self.asset(name, opts = {})
7
- add_scaffold(name, :asset, Integer, opts)
7
+ add_scaffold(name, :asset, Integer, opts.with_defaults(:lazy => true))
8
8
  end
9
9
  end
10
10
 
@@ -72,6 +72,26 @@ module Orange
72
72
  m
73
73
  end
74
74
 
75
+ def onSave(packet, obj, params = {})
76
+ if(params['file'] && file = params['file'][:tempfile])
77
+ file_path = handle_new_file(params['file'][:filename], file)
78
+ if(params['file2'] && secondary = params['file2'][:tempfile])
79
+ secondary_path = handle_new_file(params['file2'][:filename], secondary)
80
+ else
81
+ secondary_path = nil
82
+ end
83
+
84
+ params['path'] = file_path if file_path
85
+ params['secondary_path'] = secondary_path if secondary_path
86
+ params['mime_type'] = params['file'][:type] if file_path
87
+ params['secondary_mime_type'] = params['file2'][:type] if secondary_path
88
+ params['s3_bucket'] = options[:s3_bucket] if options[:s3_bucket]
89
+ end
90
+ params.delete('file')
91
+ params.delete('file2')
92
+ obj.update(params)
93
+ end
94
+
75
95
  def s3_connect!
76
96
  if(options[:s3_bucket])
77
97
  id = options[:s3_access_key_id] || ENV['S3_KEY']
@@ -30,7 +30,11 @@ module Orange::Pulp::DebuggerHelpers
30
30
  when String
31
31
  Rack::Utils.escape_html(obj)
32
32
  else
33
- Rack::Utils.escape_html(obj.inspect)
33
+ begin
34
+ Rack::Utils.escape_html(obj.inspect)
35
+ rescue Exception => e
36
+ "Object #{obj.class.to_s} could not be inspected"
37
+ end
34
38
  end
35
39
  end
36
40
  end
@@ -1,6 +1,8 @@
1
1
  .disqus_comments
2
2
  - if packet['orange.globals'][:development_mode]
3
3
  %script{:type => 'text/javascript'} var disqus_developer = 1;
4
+ -# Trim trailing slashes from path identifier
5
+ %script{:type => 'text/javascript'} var disqus_identifier = "#{packet['route.path','/comments'].gsub(/\/$/,'')}";
4
6
  #disqus_thread
5
7
  %script{:type => 'text/javascript', :src => 'http://disqus.com/forums/orangesparkleball/embed.js'}
6
8
  %noscript
@@ -1,2 +1,2 @@
1
1
  require 'orange-more/news/resources/news_resource'
2
- require 'orange-more/news/cartson/news'
2
+ require 'orange-more/news/cartons/news'
@@ -26,7 +26,11 @@ class OrangeRoute < Orange::SiteCarton
26
26
  end
27
27
  end
28
28
  end
29
-
29
+
30
+ def default_slug?
31
+ /^page-\d+/ =~ slug
32
+ end
33
+
30
34
  def self.home_for_site(site_id)
31
35
  site_id = OrangeSite.get(site_id) unless site_id.is_a? OrangeSite
32
36
  root(:orange_site => site_id)
@@ -228,9 +228,9 @@ module Orange
228
228
  include_subsite = opts.delete(:include_subsite) || false
229
229
  m = model_class.first(opts)
230
230
  if !packet['subsite'].blank? && include_subsite
231
- return orange[:subsites].url_for(packet).gsub(/\/$/, '') + (m ? m.full_path : '#not_found')
231
+ return orange[:subsites].url_for(packet).gsub(/\/$/, '') + (m ? packet.route_to(m) : '#not_found')
232
232
  else
233
- return (m ? m.full_path : '#not_found')
233
+ return (m ? packet.route_to(m) : '#not_found')
234
234
  end
235
235
  end
236
236
 
@@ -16,14 +16,15 @@
16
16
  .move_actions.dent_actions
17
17
  = form_link('Indent', route_to(:sitemap, route.id, 'indent'), false, {:method => 'post', :class => 'indent arrow'}) if route.previous_sibling && route.previous_sibling.level == route.level
18
18
  %p= '&nbsp;'
19
- %h4 #{route.link_text} <span>(#{route.full_path})</span>
19
+ %h4 #{route.link_text} <span>(#{route_to(route)})</span>
20
20
  .linked_to
21
21
  %p
22
22
  Linked to:
23
23
  %a{:href => route.resource.blank? ? '#' : route_to(route.resource, route.resource_id, 'edit')} [#{route.resource}] ##{route.resource_id}
24
24
  %p
25
25
  Views:
26
- = orange[:analytics].pageviews(route.full_path)
26
+ - if(orange.loaded?(:analytics))
27
+ = orange[:analytics].pageviews(route_to(route))
27
28
  .actions
28
29
  = form_link('Delete', route_to(:sitemap, route.id, 'delete'), 'Are you sure you want to delete this?', {:method => 'delete'})
29
30
  %a{:href => route_to(:sitemap, route.id, 'edit')} Edit
@@ -1,12 +1,12 @@
1
1
  - if model
2
2
  %p
3
3
  - for a in model.ancestors
4
- %a{:href => a.full_path}= a.link_text
4
+ %a{:href => route_to(a)}= a.link_text
5
5
  &gt;
6
6
  %span.here= model.link_text
7
7
  - else # Possibly a restful route
8
8
  %p
9
9
  - home = orange[:sitemap].home(packet)
10
- %a{:href => home.full_path}= home.link_text
10
+ %a{:href => route_to(home)}= home.link_text
11
11
  &gt;
12
12
  %span.here= packet['route.resource'].to_s.capitalize
@@ -1,7 +1,7 @@
1
1
  %ul.nav
2
2
  %li.first
3
- %a{:href => model.full_path} Home
3
+ %a{:href => route_to(model)} Home
4
4
  - for item in model.children
5
5
  - next unless item.show_in_nav
6
6
  %li
7
- %a{:href => item.full_path}= orange[:sitemap].link_text_for(item)
7
+ %a{:href => route_to(item)}= orange[:sitemap].link_text_for(item)
@@ -5,10 +5,10 @@
5
5
  %a{:href => add_route_link + '/' + slug_me} Add one?
6
6
  - else
7
7
  .sitemap_links_info.success
8
- %h4 Current Route: #{list.first.full_path} #{list.size > 1 ? '(and ' + (list.size - 1).to_s + ' others)' : ''}
8
+ %h4 Current Route: #{route_to(list.first)} #{list.size > 1 ? '(and ' + (list.size - 1).to_s + ' others)' : ''}
9
9
  %a.more_info{:href=>'#'} More Info
10
10
  .sitemap_links{:style => 'display:none'}
11
11
  - for obj in list
12
12
  .sitemap_link
13
- %span Path: #{obj.full_path}
13
+ %span Path: #{route_to(obj)}
14
14
  %a{:href => add_route_link + '/' + slug_me} Add another?
@@ -16,14 +16,15 @@
16
16
  .move_actions.dent_actions
17
17
  = form_link('Indent', route_to(model_name, model.id, 'indent'), false, {:method => 'post', :class => 'indent arrow'}) if model.previous_sibling && model.previous_sibling.level == model.level
18
18
  %p= '&nbsp;'
19
- %h4 #{orange[:sitemap].link_text_for(model)} <span>(#{model.full_path})</span>
19
+ %h4 #{orange[:sitemap].link_text_for(model)} <span>(#{route_to(model)})</span>
20
20
  .linked_to
21
21
  %p
22
22
  Linked to:
23
23
  %a{:href => model.resource.blank? ? '#' : route_to(model.resource, model.resource_id, 'edit')} [#{model.resource}] ##{model.resource_id}
24
24
  %p
25
25
  Views:
26
- = orange[:analytics].pageviews(route.full_path)
26
+ - if(orange.loaded?(:analytics))
27
+ = orange[:analytics].pageviews(route_to(route))
27
28
  .actions
28
29
  = form_link('Delete', route_to(model_name, model.id, 'delete'), 'Are you sure you want to delete this?', {:method => 'delete'})
29
30
  %a{:href => route_to(model_name, model.id, 'edit')} Edit
@@ -1,13 +1,13 @@
1
1
  %ul.nav
2
2
  %li.first
3
- %a{:href => model.full_path} Home
3
+ %a{:href => route_to(model)} Home
4
4
  - for item in model.children
5
5
  - next unless item.show_in_nav
6
6
  %li
7
- %a{:href => item.full_path}= orange[:sitemap].link_text_for(item)
7
+ %a{:href => route_to(item)}= orange[:sitemap].link_text_for(item)
8
8
  - unless item.descendants.empty?
9
9
  %ul.subnav
10
10
  - for x in item.children
11
11
  - next unless x.show_in_nav
12
12
  %li
13
- %a{:href => x.full_path}= orange[:sitemap].link_text_for(x)
13
+ %a{:href => route_to(x)}= orange[:sitemap].link_text_for(x)
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orange-more
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 6
9
- - 5
10
- version: 0.6.5
7
+ - 7
8
+ - 1
9
+ version: 0.7.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - David Haslem
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-08-24 00:00:00 -04:00
17
+ date: 2010-10-05 00:00:00 -04:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: orange-core
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 5
30
27
  segments:
31
28
  - 0
32
29
  - 5
@@ -38,11 +35,9 @@ dependencies:
38
35
  name: dm-is-awesome_set
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - ">="
44
40
  - !ruby/object:Gem::Version
45
- hash: 51
46
41
  segments:
47
42
  - 0
48
43
  - 11
@@ -54,11 +49,9 @@ dependencies:
54
49
  name: dm-timestamps
55
50
  prerelease: false
56
51
  requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
53
  - - ">="
60
54
  - !ruby/object:Gem::Version
61
- hash: 23
62
55
  segments:
63
56
  - 1
64
57
  - 0
@@ -70,11 +63,9 @@ dependencies:
70
63
  name: rack-openid
71
64
  prerelease: false
72
65
  requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
67
  - - ">="
76
68
  - !ruby/object:Gem::Version
77
- hash: 3
78
69
  segments:
79
70
  - 0
80
71
  version: "0"
@@ -84,11 +75,9 @@ dependencies:
84
75
  name: openid_dm_store
85
76
  prerelease: false
86
77
  requirement: &id005 !ruby/object:Gem::Requirement
87
- none: false
88
78
  requirements:
89
79
  - - ">="
90
80
  - !ruby/object:Gem::Version
91
- hash: 3
92
81
  segments:
93
82
  - 0
94
83
  version: "0"
@@ -98,11 +87,9 @@ dependencies:
98
87
  name: radius
99
88
  prerelease: false
100
89
  requirement: &id006 !ruby/object:Gem::Requirement
101
- none: false
102
90
  requirements:
103
91
  - - ">="
104
92
  - !ruby/object:Gem::Version
105
- hash: 3
106
93
  segments:
107
94
  - 0
108
95
  version: "0"
@@ -112,11 +99,9 @@ dependencies:
112
99
  name: rest-client
113
100
  prerelease: false
114
101
  requirement: &id007 !ruby/object:Gem::Requirement
115
- none: false
116
102
  requirements:
117
103
  - - ">="
118
104
  - !ruby/object:Gem::Version
119
- hash: 3
120
105
  segments:
121
106
  - 0
122
107
  version: "0"
@@ -126,11 +111,9 @@ dependencies:
126
111
  name: mail
127
112
  prerelease: false
128
113
  requirement: &id008 !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ">="
132
116
  - !ruby/object:Gem::Version
133
- hash: 3
134
117
  segments:
135
118
  - 0
136
119
  version: "0"
@@ -140,11 +123,9 @@ dependencies:
140
123
  name: gattica
141
124
  prerelease: false
142
125
  requirement: &id009 !ruby/object:Gem::Requirement
143
- none: false
144
126
  requirements:
145
127
  - - ">="
146
128
  - !ruby/object:Gem::Version
147
- hash: 3
148
129
  segments:
149
130
  - 0
150
131
  version: "0"
@@ -154,11 +135,9 @@ dependencies:
154
135
  name: rspec
155
136
  prerelease: false
156
137
  requirement: &id010 !ruby/object:Gem::Requirement
157
- none: false
158
138
  requirements:
159
139
  - - ">="
160
140
  - !ruby/object:Gem::Version
161
- hash: 3
162
141
  segments:
163
142
  - 0
164
143
  version: "0"
@@ -168,11 +147,9 @@ dependencies:
168
147
  name: rack-test
169
148
  prerelease: false
170
149
  requirement: &id011 !ruby/object:Gem::Requirement
171
- none: false
172
150
  requirements:
173
151
  - - ">="
174
152
  - !ruby/object:Gem::Version
175
- hash: 3
176
153
  segments:
177
154
  - 0
178
155
  version: "0"
@@ -308,38 +285,6 @@ files:
308
285
  - lib/orange-more/slices/resources/radius.rb
309
286
  - lib/orange-more/slices/resources/slices.rb
310
287
  - README.markdown
311
- - spec/orange-core/application_spec.rb
312
- - spec/orange-core/carton_spec.rb
313
- - spec/orange-core/core_spec.rb
314
- - spec/orange-core/magick_spec.rb
315
- - spec/orange-core/middleware/base_spec.rb
316
- - spec/orange-core/middleware/globals_spec.rb
317
- - spec/orange-core/middleware/rerouter_spec.rb
318
- - spec/orange-core/middleware/restful_router_spec.rb
319
- - spec/orange-core/middleware/route_context_spec.rb
320
- - spec/orange-core/middleware/route_site_spec.rb
321
- - spec/orange-core/middleware/show_exceptions_spec.rb
322
- - spec/orange-core/middleware/static_file_spec.rb
323
- - spec/orange-core/middleware/static_spec.rb
324
- - spec/orange-core/mock/mock_app.rb
325
- - spec/orange-core/mock/mock_carton.rb
326
- - spec/orange-core/mock/mock_core.rb
327
- - spec/orange-core/mock/mock_middleware.rb
328
- - spec/orange-core/mock/mock_mixins.rb
329
- - spec/orange-core/mock/mock_model_resource.rb
330
- - spec/orange-core/mock/mock_pulp.rb
331
- - spec/orange-core/mock/mock_resource.rb
332
- - spec/orange-core/mock/mock_router.rb
333
- - spec/orange-core/orange_spec.rb
334
- - spec/orange-core/packet_spec.rb
335
- - spec/orange-core/resource_spec.rb
336
- - spec/orange-core/resources/mapper_spec.rb
337
- - spec/orange-core/resources/model_resource_spec.rb
338
- - spec/orange-core/resources/parser_spec.rb
339
- - spec/orange-core/resources/routable_resource_spec.rb
340
- - spec/orange-core/spec_helper.rb
341
- - spec/orange-core/stack_spec.rb
342
- - spec/stats.rb
343
288
  has_rdoc: true
344
289
  homepage: http://github.com/therabidbanana/orange
345
290
  licenses: []
@@ -350,27 +295,23 @@ rdoc_options:
350
295
  require_paths:
351
296
  - lib
352
297
  required_ruby_version: !ruby/object:Gem::Requirement
353
- none: false
354
298
  requirements:
355
299
  - - ">="
356
300
  - !ruby/object:Gem::Version
357
- hash: 3
358
301
  segments:
359
302
  - 0
360
303
  version: "0"
361
304
  required_rubygems_version: !ruby/object:Gem::Requirement
362
- none: false
363
305
  requirements:
364
306
  - - ">="
365
307
  - !ruby/object:Gem::Version
366
- hash: 3
367
308
  segments:
368
309
  - 0
369
310
  version: "0"
370
311
  requirements: []
371
312
 
372
313
  rubyforge_project:
373
- rubygems_version: 1.3.7
314
+ rubygems_version: 1.3.6
374
315
  signing_key:
375
316
  specification_version: 3
376
317
  summary: Plugins for Orange