orange 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +7 -6
- data/lib/{orange → orange-core}/application.rb +0 -0
- data/lib/{orange → orange-core}/assets/css/exceptions.css +0 -0
- data/lib/{orange → orange-core}/assets/js/exceptions.js +0 -0
- data/lib/{orange → orange-core}/carton.rb +0 -0
- data/lib/{orange → orange-core}/core.rb +15 -1
- data/lib/{orange → orange-core}/magick.rb +75 -14
- data/lib/{orange → orange-core}/middleware/base.rb +1 -1
- data/lib/{orange → orange-core}/middleware/database.rb +1 -1
- data/lib/{orange → orange-core}/middleware/four_oh_four.rb +1 -1
- data/lib/{orange → orange-core}/middleware/globals.rb +1 -1
- data/lib/{orange → orange-core}/middleware/loader.rb +1 -1
- data/lib/orange-core/middleware/rerouter.rb +53 -0
- data/lib/{orange → orange-core}/middleware/restful_router.rb +1 -1
- data/lib/{orange → orange-core}/middleware/route_context.rb +1 -1
- data/lib/{orange → orange-core}/middleware/route_site.rb +1 -1
- data/lib/{orange → orange-core}/middleware/show_exceptions.rb +1 -1
- data/lib/{orange → orange-core}/middleware/static.rb +9 -21
- data/lib/{orange → orange-core}/middleware/static_file.rb +0 -0
- data/lib/{orange → orange-core}/middleware/template.rb +3 -10
- data/lib/{orange → orange-core}/packet.rb +0 -0
- data/lib/orange-core/plugin.rb +172 -0
- data/lib/{orange → orange-core}/resource.rb +2 -2
- data/lib/{orange → orange-core}/resources/mapper.rb +1 -26
- data/lib/{orange → orange-core}/resources/model_resource.rb +2 -2
- data/lib/{orange → orange-core}/resources/not_found.rb +1 -0
- data/lib/{orange → orange-core}/resources/page_parts.rb +1 -0
- data/lib/{orange → orange-core}/resources/parser.rb +16 -8
- data/lib/{orange → orange-core}/resources/routable_resource.rb +1 -1
- data/lib/{orange → orange-core}/stack.rb +30 -16
- data/lib/{orange → orange-core}/templates/exceptions.haml +0 -0
- data/lib/{orange → orange-core}/views/default_resource/create.haml +0 -0
- data/lib/{orange → orange-core}/views/default_resource/edit.haml +0 -0
- data/lib/{orange → orange-core}/views/default_resource/list.haml +0 -0
- data/lib/{orange → orange-core}/views/default_resource/show.haml +0 -0
- data/lib/{orange → orange-core}/views/default_resource/table_row.haml +0 -0
- data/lib/{orange → orange-core}/views/not_found/404.haml +0 -0
- data/lib/orange-core.rb +8 -0
- data/lib/{orange → orange-more/administration}/assets/css/admin.css +6 -6
- data/lib/{orange → orange-more/administration}/assets/css/blueprint-ie.css +0 -0
- data/lib/{orange → orange-more/administration}/assets/css/blueprint-print.css +0 -0
- data/lib/{orange → orange-more/administration}/assets/css/blueprint.css +0 -0
- data/lib/{orange → orange-more/administration}/assets/js/jquery.js +0 -0
- data/lib/orange-more/administration/cartons/site.rb +9 -0
- data/lib/{orange → orange-more/administration}/cartons/site_carton.rb +1 -1
- data/lib/{orange/cartons/user_carton.rb → orange-more/administration/cartons/user.rb} +2 -0
- data/lib/{orange → orange-more/administration}/middleware/access_control.rb +1 -1
- data/lib/{orange → orange-more/administration}/middleware/site_load.rb +2 -23
- data/lib/orange-more/administration/plugin.rb +22 -0
- data/lib/{orange → orange-more/administration}/resources/admin_resource.rb +0 -0
- data/lib/orange-more/administration/resources/site_resource.rb +10 -0
- data/lib/{orange → orange-more/administration}/resources/user_resource.rb +1 -1
- data/lib/{orange → orange-more/administration}/templates/admin.haml +0 -0
- data/lib/{orange → orange-more/administration}/views/openid_login.haml +0 -0
- data/lib/orange-more/administration.rb +1 -0
- data/lib/{orange → orange-more/assets}/cartons/asset_carton.rb +0 -0
- data/lib/orange-more/assets/plugin.rb +13 -0
- data/lib/{orange → orange-more/assets}/resources/asset_resource.rb +0 -0
- data/lib/{orange → orange-more/assets}/views/assets/create.haml +0 -0
- data/lib/orange-more/assets.rb +1 -0
- data/lib/{orange → orange-more/pages}/cartons/page_carton.rb +1 -1
- data/lib/{orange → orange-more/pages}/cartons/page_version_carton.rb +1 -1
- data/lib/orange-more/pages/plugin.rb +13 -0
- data/lib/{orange → orange-more/pages}/resources/page_resource.rb +0 -0
- data/lib/{orange → orange-more/pages}/views/pages/edit.haml +0 -0
- data/lib/orange-more/pages.rb +1 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_down.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_down_d.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_indent.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_indent_d.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_outdent.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_outdent_d.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_up.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/img/sitemap_up_d.png +0 -0
- data/lib/{orange → orange-more/sitemap}/assets/js/sitemap.js +0 -0
- data/lib/orange-more/sitemap/cartons/route.rb +43 -0
- data/lib/{orange → orange-more/sitemap}/middleware/flex_router.rb +2 -7
- data/lib/orange-more/sitemap/plugin.rb +17 -0
- data/lib/{orange → orange-more/sitemap}/resources/sitemap_resource.rb +3 -43
- data/lib/{orange → orange-more/sitemap}/views/sitemap/list.haml +0 -0
- data/lib/{orange → orange-more/sitemap}/views/sitemap/sitemap_links.haml +0 -0
- data/lib/{orange → orange-more/sitemap}/views/sitemap/table_row.haml +0 -0
- data/lib/{orange → orange-more/sitemap}/views/sitemap/two_level.haml +0 -0
- data/lib/orange-more/sitemap.rb +1 -0
- data/lib/{orange → orange-more/slices}/middleware/radius_parser.rb +1 -1
- data/lib/orange-more/slices/plugin.rb +15 -0
- data/lib/{orange → orange-more/slices}/resources/radius.rb +0 -0
- data/lib/{orange → orange-more/slices}/resources/slices.rb +0 -0
- data/lib/orange-more/slices.rb +1 -0
- data/lib/orange-more.rb +10 -0
- data/lib/orange.rb +2 -6
- data/spec/{orange → orange-core}/application_spec.rb +0 -0
- data/spec/{orange → orange-core}/carton_spec.rb +0 -0
- data/spec/{orange → orange-core}/core_spec.rb +2 -2
- data/spec/{orange → orange-core}/magick_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/base_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/globals_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/rerouter_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/restful_router_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/route_context_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/route_site_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/show_exceptions_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/static_file_spec.rb +0 -0
- data/spec/{orange → orange-core}/middleware/static_spec.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_app.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_carton.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_core.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_middleware.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_mixins.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_model_resource.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_pulp.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_resource.rb +0 -0
- data/spec/{orange → orange-core}/mock/mock_router.rb +0 -0
- data/spec/{orange → orange-core}/orange_spec.rb +0 -0
- data/spec/{orange → orange-core}/packet_spec.rb +0 -0
- data/spec/{orange → orange-core}/resource_spec.rb +0 -0
- data/spec/{orange → orange-core}/resources/mapper_spec.rb +0 -0
- data/spec/{orange → orange-core}/resources/model_resource_spec.rb +0 -0
- data/spec/{orange → orange-core}/resources/parser_spec.rb +0 -0
- data/spec/{orange → orange-core}/resources/routable_resource_spec.rb +0 -0
- data/spec/{orange → orange-core}/spec_helper.rb +1 -1
- data/spec/{orange → orange-core}/stack_spec.rb +20 -20
- metadata +122 -184
- data/lib/orange/middleware/rerouter.rb +0 -13
- data/lib/orange/resources/singleton_model_resource.rb +0 -7
- data/spec/orange/middleware/access_control_spec.rb +0 -3
- data/spec/orange/middleware/database_spec.rb +0 -3
- data/spec/orange/middleware/site_load_spec.rb +0 -26
- data/spec/orange/middleware/template_spec.rb +0 -3
- data/spec/orange/resources/admin_resource_spec.rb +0 -16
- data/spec/orange/resources/singleton_model_resource_spec.rb +0 -4
- data/spec/orange/resources/sitemap_resource_spec.rb +0 -5
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'orange/core'
|
1
|
+
require 'orange-core/core'
|
2
2
|
require 'rack/builder'
|
3
3
|
module Orange
|
4
4
|
# Builds an orange stack of middleware
|
@@ -92,6 +92,11 @@ module Orange
|
|
92
92
|
stack Orange::Middleware::ShowExceptions
|
93
93
|
end
|
94
94
|
|
95
|
+
# Alias for use_exceptions
|
96
|
+
def show_exceptions
|
97
|
+
use_exceptions
|
98
|
+
end
|
99
|
+
|
95
100
|
# Turn off recapture middleware, which is normally just on top of the exit
|
96
101
|
# point
|
97
102
|
# @see Orange::Middleware::Recapture
|
@@ -112,6 +117,8 @@ module Orange
|
|
112
117
|
#
|
113
118
|
def prerouting(*args)
|
114
119
|
opts = args.extract_options!
|
120
|
+
stack Orange::Middleware::Globals
|
121
|
+
stack Orange::Middleware::Loader
|
115
122
|
stack Orange::Middleware::Rerouter, opts.dup
|
116
123
|
stack Orange::Middleware::Static, opts.dup
|
117
124
|
use Rack::AbstractFormat unless opts[:no_abstract_format]
|
@@ -119,29 +126,36 @@ module Orange
|
|
119
126
|
# since all orange stuff is non-destructive
|
120
127
|
stack Orange::Middleware::RouteSite, opts.dup
|
121
128
|
stack Orange::Middleware::RouteContext, opts.dup
|
129
|
+
stack Orange::Middleware::Database
|
130
|
+
Orange.plugins.each{|p| p.middleware(:prerouting).each{|m| stack m, opts.dup} if p.has_middleware?}
|
122
131
|
end
|
123
132
|
|
124
|
-
# A shortcut for
|
133
|
+
# A shortcut for routing via Orange::Middleware::RestfulRouter and any plugins
|
125
134
|
#
|
126
135
|
# Any args are passed on to the middleware
|
127
|
-
def
|
128
|
-
|
129
|
-
stack
|
136
|
+
def routing(opts ={})
|
137
|
+
stack Orange::Middleware::RestfulRouter, opts.dup
|
138
|
+
Orange.plugins.each{|p| p.middleware(:routing).each{|m| stack m, opts.dup} if p.has_middleware?}
|
139
|
+
stack Orange::Middleware::FourOhFour, opts.dup
|
130
140
|
end
|
131
141
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
require 'openid_dm_store'
|
140
|
-
|
141
|
-
use Rack::OpenID, OpenIDDataMapper::DataMapperStore.new
|
142
|
-
stack Orange::Middleware::AccessControl, opts
|
142
|
+
def postrouting(opts ={})
|
143
|
+
Orange.plugins.each{|p| p.middleware(:postrouting).each{|m| stack m, opts.dup} if p.has_middleware?}
|
144
|
+
stack Orange::Middleware::Template
|
145
|
+
end
|
146
|
+
|
147
|
+
def responders(opts ={})
|
148
|
+
Orange.plugins.each{|p| p.middleware(:responders).each{|m| stack m, opts.dup} if p.has_middleware?}
|
143
149
|
end
|
144
150
|
|
151
|
+
# # A shortcut to enable Rack::OpenID and Orange::Middleware::AccessControl
|
152
|
+
# #
|
153
|
+
# # Args will be passed on to Orange::Middleware::AccessControl
|
154
|
+
# def openid_access_control(*args)
|
155
|
+
# opts = args.extract_options!
|
156
|
+
#
|
157
|
+
# end
|
158
|
+
|
145
159
|
# Adds pulp to the core via the Orange::Core#add_pulp method
|
146
160
|
# @param [Orange::Mixin] mod a mixin to be included in the packet
|
147
161
|
def add_pulp(mod)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/orange-core.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
libdir = File.dirname(__FILE__)
|
2
|
+
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
3
|
+
|
4
|
+
require File.join(libdir, 'orange-core', 'magick.rb')
|
5
|
+
Dir.glob(File.join(libdir, 'orange-core', '*.rb')).each {|f| require f }
|
6
|
+
Dir.glob(File.join(libdir, 'orange-core', 'cartons', '*.rb')).each {|f| require f }
|
7
|
+
Dir.glob(File.join(libdir, 'orange-core', 'resources', '*.rb')).each {|f| require f }
|
8
|
+
Dir.glob(File.join(libdir, 'orange-core', 'middleware', '*.rb')).each {|f| require f }
|
@@ -194,7 +194,7 @@ body{
|
|
194
194
|
|
195
195
|
|
196
196
|
.move_actions .up{
|
197
|
-
background: url(/assets/
|
197
|
+
background: url(/assets/_sitemap_/img/sitemap_up.png);
|
198
198
|
}
|
199
199
|
.move_actions .arrow{
|
200
200
|
display: block;
|
@@ -206,25 +206,25 @@ body{
|
|
206
206
|
}
|
207
207
|
.move_actions .indent{
|
208
208
|
margin-top: 15px;
|
209
|
-
background: url(/assets/
|
209
|
+
background: url(/assets/_sitemap_/img/sitemap_indent.png);
|
210
210
|
}
|
211
211
|
.move_actions .outdent{
|
212
212
|
margin-top: 15px;
|
213
|
-
background: url(/assets/
|
213
|
+
background: url(/assets/_sitemap_/img/sitemap_outdent.png);
|
214
214
|
}
|
215
215
|
|
216
216
|
.move_actions .down{
|
217
|
-
background: url(/assets/
|
217
|
+
background: url(/assets/_sitemap_/img/sitemap_down.png);
|
218
218
|
}
|
219
219
|
|
220
220
|
.move_actions .disabled_down{
|
221
|
-
background: url(/assets/
|
221
|
+
background: url(/assets/_sitemap_/img/sitemap_down_d.png);
|
222
222
|
}
|
223
223
|
|
224
224
|
|
225
225
|
|
226
226
|
.move_actions .disabled_up{
|
227
|
-
background: url(/assets/
|
227
|
+
background: url(/assets/_sitemap_/img/sitemap_up_d.png);
|
228
228
|
}
|
229
229
|
|
230
230
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,13 +1,9 @@
|
|
1
|
-
require 'orange/middleware/base'
|
1
|
+
require 'orange-core/middleware/base'
|
2
2
|
module Orange::Middleware
|
3
3
|
# This will load information about the site to into the orange env
|
4
4
|
# - packet['site'] will be an instance of the site object
|
5
5
|
#
|
6
|
-
class SiteLoad < Base
|
7
|
-
def init(*args)
|
8
|
-
orange.load Orange::SiteResource.new, :orange_sites
|
9
|
-
end
|
10
|
-
|
6
|
+
class SiteLoad < Base
|
11
7
|
def packet_call(packet)
|
12
8
|
url = packet['route.site_url']
|
13
9
|
site = Orange::Site.first(:url.like => url)
|
@@ -25,20 +21,3 @@ module Orange::Middleware
|
|
25
21
|
|
26
22
|
end
|
27
23
|
|
28
|
-
module Orange
|
29
|
-
class Site < Carton
|
30
|
-
id
|
31
|
-
admin do
|
32
|
-
title :name
|
33
|
-
text :url
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class SiteResource < ModelResource
|
38
|
-
use Orange::Site
|
39
|
-
def afterLoad
|
40
|
-
orange[:admin, true].add_link('Settings', :resource => @my_orange_name,
|
41
|
-
:text => 'Site')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'cartons', '*.rb')).each {|f| require f }
|
2
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
|
3
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
|
4
|
+
|
5
|
+
module Orange::Plugins
|
6
|
+
class Administration < Base
|
7
|
+
assets_dir File.join(File.dirname(__FILE__), 'assets')
|
8
|
+
views_dir File.join(File.dirname(__FILE__), 'views')
|
9
|
+
templates_dir File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
|
11
|
+
resource Orange::AdminResource.new, :admin
|
12
|
+
resource Orange::UserResource.new
|
13
|
+
resource Orange::SiteResource.new
|
14
|
+
|
15
|
+
prerouter Orange::Middleware::AccessControl
|
16
|
+
prerouter Orange::Middleware::SiteLoad
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Orange.plugin(Orange::Plugins::Administration.new)
|
22
|
+
|
File without changes
|
@@ -3,7 +3,7 @@ module Orange
|
|
3
3
|
use Orange::User
|
4
4
|
call_me :users
|
5
5
|
def afterLoad
|
6
|
-
orange[:admin
|
6
|
+
orange[:admin].add_link("Settings", :resource => @my_orange_name, :text => 'Users')
|
7
7
|
end
|
8
8
|
|
9
9
|
def access_allowed?(packet, user)
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('orange-more', 'administration', 'plugin')
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'cartons', '*.rb')).each {|f| require f }
|
2
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
|
3
|
+
|
4
|
+
module Orange::Plugins
|
5
|
+
class Assets < Base
|
6
|
+
views_dir File.join(File.dirname(__FILE__), 'views')
|
7
|
+
|
8
|
+
resource Orange::AssetResource.new
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Orange.plugin(Orange::Plugins::Assets.new)
|
13
|
+
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('orange-more', 'assets', 'plugin')
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'cartons', '*.rb')).each {|f| require f }
|
2
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
|
3
|
+
|
4
|
+
module Orange::Plugins
|
5
|
+
class Pages < Base
|
6
|
+
views_dir File.join(File.dirname(__FILE__), 'views')
|
7
|
+
|
8
|
+
resource Orange::PageResource.new
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Orange.plugin(Orange::Plugins::Pages.new)
|
13
|
+
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('orange-more', 'pages', 'plugin')
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'orange-more/administration/cartons/site_carton'
|
2
|
+
require 'dm-is-awesome_set'
|
3
|
+
|
4
|
+
module Orange
|
5
|
+
class Route < SiteCarton
|
6
|
+
id
|
7
|
+
admin do
|
8
|
+
text :slug
|
9
|
+
text :link_text
|
10
|
+
boolean :show_in_nav, :default => false, :display_name => 'Show in Navigation?'
|
11
|
+
end
|
12
|
+
orange do
|
13
|
+
string :resource
|
14
|
+
string :resource_id
|
15
|
+
string :resource_action
|
16
|
+
boolean :accept_args, :default => true
|
17
|
+
end
|
18
|
+
include DataMapper::Transaction::Resource # Make sure Transactions are included (for awesome_set)
|
19
|
+
is :awesome_set, :scope => [:orange_site_id]
|
20
|
+
|
21
|
+
def full_path
|
22
|
+
self_and_ancestors.inject('') do |path, part|
|
23
|
+
if part.parent # Check if this is a child
|
24
|
+
path = path + part.slug + '/'
|
25
|
+
else # The root slug is just the initial '/'
|
26
|
+
path = path + '/'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.home_for_site(site_id)
|
32
|
+
root(:orange_site_id => site_id)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def self.create_home_for_site(site_id)
|
37
|
+
home = self.new({:orange_site_id => site_id, :slug => '_index_', :accept_args => false, :link_text => 'Home'})
|
38
|
+
home.move(:root)
|
39
|
+
home.save
|
40
|
+
home
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'orange/middleware/base'
|
1
|
+
require 'orange-core/middleware/base'
|
2
2
|
|
3
3
|
module Orange::Middleware
|
4
4
|
# The FlexRouter middleware takes a resource that can route paths and
|
@@ -10,12 +10,7 @@ module Orange::Middleware
|
|
10
10
|
# and "route(packet)".
|
11
11
|
#
|
12
12
|
# Pass a different routing resource using the :resource arg
|
13
|
-
class FlexRouter < Base
|
14
|
-
def init(opts = {})
|
15
|
-
@resource = opts[:resource] || Orange::SitemapResource
|
16
|
-
orange.load @resource.new, :sitemap
|
17
|
-
end
|
18
|
-
|
13
|
+
class FlexRouter < Base
|
19
14
|
# Sets the sitemap resource as the router if the resource can accept
|
20
15
|
# the path.
|
21
16
|
def packet_call(packet)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'cartons', '*.rb')).each {|f| require f }
|
2
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
|
3
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
|
4
|
+
|
5
|
+
module Orange::Plugins
|
6
|
+
class Sitemap < Base
|
7
|
+
assets_dir File.join(File.dirname(__FILE__), 'assets')
|
8
|
+
views_dir File.join(File.dirname(__FILE__), 'views')
|
9
|
+
|
10
|
+
resource Orange::SitemapResource.new
|
11
|
+
router Orange::Middleware::FlexRouter
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Orange.plugin(Orange::Plugins::Sitemap.new)
|
17
|
+
|
@@ -1,50 +1,10 @@
|
|
1
|
-
require 'orange/core'
|
2
|
-
require 'orange/resources/model_resource'
|
3
|
-
require 'orange/cartons/site_carton'
|
4
|
-
require 'dm-is-awesome_set'
|
1
|
+
require 'orange-core/core'
|
2
|
+
require 'orange-core/resources/model_resource'
|
5
3
|
module Orange
|
6
|
-
class Route < SiteCarton
|
7
|
-
id
|
8
|
-
admin do
|
9
|
-
text :slug
|
10
|
-
text :link_text
|
11
|
-
boolean :show_in_nav, :default => false, :display_name => 'Show in Navigation?'
|
12
|
-
end
|
13
|
-
orange do
|
14
|
-
string :resource
|
15
|
-
string :resource_id
|
16
|
-
string :resource_action
|
17
|
-
boolean :accept_args, :default => true
|
18
|
-
end
|
19
|
-
include DataMapper::Transaction::Resource # Make sure Transactions are included (for awesome_set)
|
20
|
-
is :awesome_set, :scope => [:orange_site_id]
|
21
|
-
|
22
|
-
def full_path
|
23
|
-
self_and_ancestors.inject('') do |path, part|
|
24
|
-
if part.parent # Check if this is a child
|
25
|
-
path = path + part.slug + '/'
|
26
|
-
else # The root slug is just the initial '/'
|
27
|
-
path = path + '/'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.home_for_site(site_id)
|
33
|
-
root(:orange_site_id => site_id)
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
def self.create_home_for_site(site_id)
|
38
|
-
home = self.new({:orange_site_id => site_id, :slug => '_index_', :accept_args => false, :link_text => 'Home'})
|
39
|
-
home.move(:root)
|
40
|
-
home.save
|
41
|
-
home
|
42
|
-
end
|
43
|
-
end
|
44
4
|
|
45
5
|
class SitemapResource < ModelResource
|
46
6
|
use Orange::Route
|
47
|
-
|
7
|
+
call_me :sitemap
|
48
8
|
def afterLoad
|
49
9
|
orange[:admin, true].add_link('Content', :resource => @my_orange_name, :text => 'Sitemap')
|
50
10
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('orange-more', 'sitemap', 'plugin')
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
|
2
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
|
3
|
+
|
4
|
+
module Orange::Plugins
|
5
|
+
class Slices < Base
|
6
|
+
resource Orange::Radius.new
|
7
|
+
resource Orange::Slices.new
|
8
|
+
|
9
|
+
postrouter Orange::Middleware::RadiusParser
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Orange.plugin(Orange::Plugins::Slices.new)
|
15
|
+
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('orange-more', 'slices', 'plugin')
|
data/lib/orange-more.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
libdir = File.dirname(__FILE__)
|
2
|
+
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
3
|
+
|
4
|
+
require File.join(libdir, 'orange-core')
|
5
|
+
|
6
|
+
require File.join(libdir, 'orange-more', 'administration')
|
7
|
+
require File.join(libdir, 'orange-more', 'assets')
|
8
|
+
require File.join(libdir, 'orange-more', 'pages')
|
9
|
+
require File.join(libdir, 'orange-more', 'sitemap')
|
10
|
+
require File.join(libdir, 'orange-more', 'slices')
|
data/lib/orange.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
libdir = File.dirname(__FILE__)
|
2
2
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
3
3
|
|
4
|
-
require File.join(libdir, 'orange'
|
5
|
-
|
6
|
-
Dir.glob(File.join(libdir, 'orange', 'cartons', '*.rb')).each {|f| require f }
|
7
|
-
require File.join(libdir, 'orange', 'resources', 'model_resource.rb')
|
8
|
-
Dir.glob(File.join(libdir, 'orange', 'resources', '*.rb')).each {|f| require f }
|
9
|
-
Dir.glob(File.join(libdir, 'orange', 'middleware', '*.rb')).each {|f| require f }
|
4
|
+
require File.join(libdir, 'orange-core')
|
5
|
+
require File.join(libdir, 'orange-more')
|
File without changes
|
File without changes
|
@@ -67,7 +67,7 @@ describe Orange::Core do
|
|
67
67
|
|
68
68
|
it "should return a directory that contains core.rb when calling core_dir" do
|
69
69
|
c= Orange::Core.new
|
70
|
-
c.core_dir.should match(/orange$/)
|
70
|
+
c.core_dir.should match(/orange-core$/)
|
71
71
|
File.should exist(File.join(c.core_dir, 'core.rb'))
|
72
72
|
File.should exist(File.join(c.core_dir, 'stack.rb'))
|
73
73
|
File.should exist(File.join(c.core_dir, 'application.rb'))
|
@@ -79,7 +79,7 @@ describe Orange::Core do
|
|
79
79
|
|
80
80
|
it "should return the directory of the super class when calling core_dir on subclass" do
|
81
81
|
c= MockCoreSubclass.new
|
82
|
-
c.core_dir.should match(/orange$/)
|
82
|
+
c.core_dir.should match(/orange-core$/)
|
83
83
|
File.should exist(File.join(c.core_dir, 'core.rb'))
|
84
84
|
File.should exist(File.join(c.core_dir, 'stack.rb'))
|
85
85
|
File.should exist(File.join(c.core_dir, 'application.rb'))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|