orange 0.5.5 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/orange.rb +2 -5
- data/spec/orange_spec.rb +5 -0
- data/spec/{orange-core/spec_helper.rb → spec_helper.rb} +0 -0
- metadata +28 -235
- data/lib/orange-core.rb +0 -8
- data/lib/orange-core/application.rb +0 -132
- data/lib/orange-core/assets/css/exceptions.css +0 -50
- data/lib/orange-core/assets/js/exceptions.js +0 -44
- data/lib/orange-core/carton.rb +0 -178
- data/lib/orange-core/core.rb +0 -266
- data/lib/orange-core/magick.rb +0 -270
- data/lib/orange-core/middleware/base.rb +0 -96
- data/lib/orange-core/middleware/database.rb +0 -45
- data/lib/orange-core/middleware/four_oh_four.rb +0 -45
- data/lib/orange-core/middleware/globals.rb +0 -17
- data/lib/orange-core/middleware/loader.rb +0 -13
- data/lib/orange-core/middleware/rerouter.rb +0 -53
- data/lib/orange-core/middleware/restful_router.rb +0 -99
- data/lib/orange-core/middleware/route_context.rb +0 -39
- data/lib/orange-core/middleware/route_site.rb +0 -51
- data/lib/orange-core/middleware/show_exceptions.rb +0 -80
- data/lib/orange-core/middleware/static.rb +0 -67
- data/lib/orange-core/middleware/static_file.rb +0 -32
- data/lib/orange-core/middleware/template.rb +0 -60
- data/lib/orange-core/packet.rb +0 -232
- data/lib/orange-core/plugin.rb +0 -172
- data/lib/orange-core/resource.rb +0 -96
- data/lib/orange-core/resources/mapper.rb +0 -36
- data/lib/orange-core/resources/model_resource.rb +0 -228
- data/lib/orange-core/resources/not_found.rb +0 -10
- data/lib/orange-core/resources/page_parts.rb +0 -68
- data/lib/orange-core/resources/parser.rb +0 -113
- data/lib/orange-core/resources/routable_resource.rb +0 -16
- data/lib/orange-core/resources/scaffold.rb +0 -106
- data/lib/orange-core/stack.rb +0 -226
- data/lib/orange-core/templates/exceptions.haml +0 -111
- data/lib/orange-core/views/default_resource/create.haml +0 -4
- data/lib/orange-core/views/default_resource/edit.haml +0 -9
- data/lib/orange-core/views/default_resource/list.haml +0 -10
- data/lib/orange-core/views/default_resource/show.haml +0 -4
- data/lib/orange-core/views/default_resource/table_row.haml +0 -7
- data/lib/orange-core/views/not_found/404.haml +0 -2
- data/lib/orange-more.rb +0 -23
- data/lib/orange-more/administration.rb +0 -1
- data/lib/orange-more/administration/assets/css/admin.css +0 -286
- data/lib/orange-more/administration/assets/css/blueprint-ie.css +0 -35
- data/lib/orange-more/administration/assets/css/blueprint-print.css +0 -29
- data/lib/orange-more/administration/assets/css/blueprint.css +0 -257
- data/lib/orange-more/administration/assets/js/jquery.js +0 -152
- data/lib/orange-more/administration/cartons/site.rb +0 -7
- data/lib/orange-more/administration/cartons/site_carton.rb +0 -12
- data/lib/orange-more/administration/cartons/user.rb +0 -27
- data/lib/orange-more/administration/middleware/access_control.rb +0 -156
- data/lib/orange-more/administration/middleware/site_load.rb +0 -25
- data/lib/orange-more/administration/plugin.rb +0 -23
- data/lib/orange-more/administration/resources/admin_resource.rb +0 -27
- data/lib/orange-more/administration/resources/site_resource.rb +0 -10
- data/lib/orange-more/administration/resources/user_resource.rb +0 -40
- data/lib/orange-more/administration/templates/admin.haml +0 -25
- data/lib/orange-more/administration/views/openid_login.haml +0 -14
- data/lib/orange-more/administration/views/users/create.haml +0 -10
- data/lib/orange-more/administration/views/users/edit.haml +0 -15
- data/lib/orange-more/adverts.rb +0 -1
- data/lib/orange-more/adverts/cartons/adverts_carton.rb +0 -14
- data/lib/orange-more/adverts/plugin.rb +0 -13
- data/lib/orange-more/adverts/resources/adverts_resource.rb +0 -27
- data/lib/orange-more/adverts/views/adverts/adverts.haml +0 -2
- data/lib/orange-more/analytics.rb +0 -1
- data/lib/orange-more/analytics/middleware/analytics.rb +0 -30
- data/lib/orange-more/analytics/plugin.rb +0 -11
- data/lib/orange-more/analytics/resources/analytics_resource.rb +0 -42
- data/lib/orange-more/assets.rb +0 -1
- data/lib/orange-more/assets/cartons/asset_carton.rb +0 -27
- data/lib/orange-more/assets/plugin.rb +0 -13
- data/lib/orange-more/assets/resources/asset_resource.rb +0 -115
- data/lib/orange-more/assets/views/assets/change.haml +0 -1
- data/lib/orange-more/assets/views/assets/create.haml +0 -13
- data/lib/orange-more/assets/views/assets/insert.haml +0 -1
- data/lib/orange-more/blog.rb +0 -1
- data/lib/orange-more/blog/cartons/blog.rb +0 -8
- data/lib/orange-more/blog/cartons/blog_post.rb +0 -60
- data/lib/orange-more/blog/plugin.rb +0 -14
- data/lib/orange-more/blog/resources/blog_post_resource.rb +0 -53
- data/lib/orange-more/blog/resources/blog_resource.rb +0 -104
- data/lib/orange-more/blog/views/blog/blog_archive_view.haml +0 -6
- data/lib/orange-more/blog/views/blog/blog_offset_list_view.haml +0 -12
- data/lib/orange-more/blog/views/blog/blog_post_view.haml +0 -4
- data/lib/orange-more/blog/views/blog/sitemap_row.haml +0 -14
- data/lib/orange-more/blog/views/blog_posts/edit.haml +0 -8
- data/lib/orange-more/blog/views/blog_posts/show.haml +0 -4
- data/lib/orange-more/cloud.rb +0 -1
- data/lib/orange-more/cloud/plugin.rb +0 -10
- data/lib/orange-more/cloud/resources/cloud_resource.rb +0 -21
- data/lib/orange-more/contactforms.rb +0 -1
- data/lib/orange-more/contactforms/assets/js/jquery.validate.pack.js +0 -15
- data/lib/orange-more/contactforms/assets/js/lib/jquery-1.4.2.js +0 -6240
- data/lib/orange-more/contactforms/assets/js/lib/jquery.form.js +0 -660
- data/lib/orange-more/contactforms/assets/js/lib/jquery.js +0 -4376
- data/lib/orange-more/contactforms/assets/js/lib/jquery.metadata.js +0 -122
- data/lib/orange-more/contactforms/cartons/contactforms_carton.rb +0 -12
- data/lib/orange-more/contactforms/plugin.rb +0 -13
- data/lib/orange-more/contactforms/resources/contactforms_resource.rb +0 -56
- data/lib/orange-more/contactforms/views/contactforms/contactform.haml +0 -20
- data/lib/orange-more/debugger.rb +0 -1
- data/lib/orange-more/debugger/assets/css/debug_bar.css +0 -46
- data/lib/orange-more/debugger/middleware/debugger.rb +0 -50
- data/lib/orange-more/debugger/plugin.rb +0 -12
- data/lib/orange-more/debugger/views/debug_bar.haml +0 -87
- data/lib/orange-more/disqus.rb +0 -1
- data/lib/orange-more/disqus/plugin.rb +0 -11
- data/lib/orange-more/disqus/resources/disqus_resource.rb +0 -9
- data/lib/orange-more/disqus/views/disqus/comment_thread.haml +0 -7
- data/lib/orange-more/donations.rb +0 -1
- data/lib/orange-more/donations/cartons/donation_carton.rb +0 -9
- data/lib/orange-more/donations/plugin.rb +0 -12
- data/lib/orange-more/donations/resources/donations_resource.rb +0 -51
- data/lib/orange-more/donations/views/donations/donate_form.haml +0 -21
- data/lib/orange-more/donations/views/donations/donate_thanks.haml +0 -2
- data/lib/orange-more/donations/views/donations/paypal_form.haml +0 -13
- data/lib/orange-more/events.rb +0 -1
- data/lib/orange-more/events/assets/js/events.js +0 -55
- data/lib/orange-more/events/cartons/orange_calendar.rb +0 -8
- data/lib/orange-more/events/cartons/orange_event.rb +0 -60
- data/lib/orange-more/events/plugin.rb +0 -14
- data/lib/orange-more/events/resources/calendar_resource.rb +0 -33
- data/lib/orange-more/events/resources/event_resource.rb +0 -147
- data/lib/orange-more/events/views/calendar/calendar.haml +0 -8
- data/lib/orange-more/events/views/events/create.haml +0 -55
- data/lib/orange-more/events/views/events/edit.haml +0 -59
- data/lib/orange-more/events/views/events/list.haml +0 -13
- data/lib/orange-more/events/views/events/show.haml +0 -4
- data/lib/orange-more/events/views/events/table_row.haml +0 -17
- data/lib/orange-more/members.rb +0 -1
- data/lib/orange-more/members/cartons/member_carton.rb +0 -38
- data/lib/orange-more/members/plugin.rb +0 -13
- data/lib/orange-more/members/resources/members_resource.rb +0 -327
- data/lib/orange-more/members/views/members/create.haml +0 -12
- data/lib/orange-more/members/views/members/edit.haml +0 -15
- data/lib/orange-more/members/views/members/live.show.haml +0 -1
- data/lib/orange-more/members/views/members/login.haml +0 -17
- data/lib/orange-more/members/views/members/logout.haml +0 -1
- data/lib/orange-more/members/views/members/profile.haml +0 -50
- data/lib/orange-more/members/views/members/register.haml +0 -37
- data/lib/orange-more/news.rb +0 -1
- data/lib/orange-more/news/cartons/news.rb +0 -12
- data/lib/orange-more/news/plugin.rb +0 -13
- data/lib/orange-more/news/resources/news_resource.rb +0 -82
- data/lib/orange-more/news/views/news/archive.haml +0 -14
- data/lib/orange-more/news/views/news/edit.haml +0 -7
- data/lib/orange-more/news/views/news/latest.haml +0 -8
- data/lib/orange-more/news/views/news/sitemap_row.haml +0 -14
- data/lib/orange-more/pages.rb +0 -1
- data/lib/orange-more/pages/cartons/page_carton.rb +0 -14
- data/lib/orange-more/pages/cartons/page_version_carton.rb +0 -12
- data/lib/orange-more/pages/plugin.rb +0 -13
- data/lib/orange-more/pages/resources/page_resource.rb +0 -179
- data/lib/orange-more/pages/views/pages/edit.haml +0 -34
- data/lib/orange-more/pages/views/pages/show.haml +0 -6
- data/lib/orange-more/sitemap.rb +0 -1
- data/lib/orange-more/sitemap/assets/img/sitemap_down.png +0 -0
- data/lib/orange-more/sitemap/assets/img/sitemap_down_d.png +0 -0
- data/lib/orange-more/sitemap/assets/img/sitemap_indent.png +0 -0
- data/lib/orange-more/sitemap/assets/img/sitemap_indent_d.png +0 -0
- data/lib/orange-more/sitemap/assets/img/sitemap_outdent.png +0 -0
- data/lib/orange-more/sitemap/assets/img/sitemap_outdent_d.png +0 -0
- data/lib/orange-more/sitemap/assets/img/sitemap_up.png +0 -0
- data/lib/orange-more/sitemap/assets/img/sitemap_up_d.png +0 -0
- data/lib/orange-more/sitemap/assets/js/sitemap.js +0 -11
- data/lib/orange-more/sitemap/cartons/route.rb +0 -43
- data/lib/orange-more/sitemap/middleware/flex_router.rb +0 -25
- data/lib/orange-more/sitemap/plugin.rb +0 -17
- data/lib/orange-more/sitemap/resources/sitemap_resource.rb +0 -295
- data/lib/orange-more/sitemap/views/default_resource/sitemap_row.haml +0 -30
- data/lib/orange-more/sitemap/views/sitemap/breadcrumb.haml +0 -12
- data/lib/orange-more/sitemap/views/sitemap/list.haml +0 -4
- data/lib/orange-more/sitemap/views/sitemap/one_level.haml +0 -7
- data/lib/orange-more/sitemap/views/sitemap/route_actions.haml +0 -15
- data/lib/orange-more/sitemap/views/sitemap/sitemap_links.haml +0 -14
- data/lib/orange-more/sitemap/views/sitemap/table_row.haml +0 -30
- data/lib/orange-more/sitemap/views/sitemap/two_level.haml +0 -13
- data/lib/orange-more/slices.rb +0 -1
- data/lib/orange-more/slices/middleware/radius_parser.rb +0 -24
- data/lib/orange-more/slices/plugin.rb +0 -15
- data/lib/orange-more/slices/resources/radius.rb +0 -117
- data/lib/orange-more/slices/resources/slices.rb +0 -35
- data/lib/orange-more/subsites.rb +0 -1
- data/lib/orange-more/subsites/cartons/subsite.rb +0 -8
- data/lib/orange-more/subsites/middleware/subsite_load.rb +0 -29
- data/lib/orange-more/subsites/plugin.rb +0 -17
- data/lib/orange-more/subsites/resources/subsite_resource.rb +0 -54
- data/lib/orange-more/subsites/views/subsites/index.haml +0 -2
- data/lib/orange-more/testimonials.rb +0 -1
- data/lib/orange-more/testimonials/cartons/testimonials_carton.rb +0 -15
- data/lib/orange-more/testimonials/plugin.rb +0 -13
- data/lib/orange-more/testimonials/resources/testimonials_resource.rb +0 -42
- data/lib/orange-more/testimonials/views/testimonials/testimonials.haml +0 -4
- data/spec/orange-core/application_spec.rb +0 -183
- data/spec/orange-core/carton_spec.rb +0 -136
- data/spec/orange-core/core_spec.rb +0 -248
- data/spec/orange-core/magick_spec.rb +0 -96
- data/spec/orange-core/middleware/base_spec.rb +0 -38
- data/spec/orange-core/middleware/globals_spec.rb +0 -3
- data/spec/orange-core/middleware/rerouter_spec.rb +0 -3
- data/spec/orange-core/middleware/restful_router_spec.rb +0 -3
- data/spec/orange-core/middleware/route_context_spec.rb +0 -3
- data/spec/orange-core/middleware/route_site_spec.rb +0 -3
- data/spec/orange-core/middleware/show_exceptions_spec.rb +0 -3
- data/spec/orange-core/middleware/static_file_spec.rb +0 -3
- data/spec/orange-core/middleware/static_spec.rb +0 -3
- data/spec/orange-core/mock/mock_app.rb +0 -16
- data/spec/orange-core/mock/mock_carton.rb +0 -43
- data/spec/orange-core/mock/mock_core.rb +0 -2
- data/spec/orange-core/mock/mock_middleware.rb +0 -25
- data/spec/orange-core/mock/mock_mixins.rb +0 -19
- data/spec/orange-core/mock/mock_model_resource.rb +0 -47
- data/spec/orange-core/mock/mock_pulp.rb +0 -24
- data/spec/orange-core/mock/mock_resource.rb +0 -26
- data/spec/orange-core/mock/mock_router.rb +0 -10
- data/spec/orange-core/orange_spec.rb +0 -19
- data/spec/orange-core/packet_spec.rb +0 -203
- data/spec/orange-core/resource_spec.rb +0 -96
- data/spec/orange-core/resources/mapper_spec.rb +0 -5
- data/spec/orange-core/resources/model_resource_spec.rb +0 -246
- data/spec/orange-core/resources/parser_spec.rb +0 -5
- data/spec/orange-core/resources/routable_resource_spec.rb +0 -5
- data/spec/orange-core/stack_spec.rb +0 -232
@@ -1,12 +0,0 @@
|
|
1
|
-
%form{:action => "#{packet.route_to(model_name, 'new')}", :method => 'post'}
|
2
|
-
- for prop in props
|
3
|
-
%p!= view_attribute(prop, model_name, :label => true)
|
4
|
-
%p
|
5
|
-
%label{:for => "my_password"} Password
|
6
|
-
%br
|
7
|
-
%input{:id => "my_password", :type => "password", :name => "#{model_name}[password]"}
|
8
|
-
%p
|
9
|
-
%label{:for => "my_repeat_password"} Repeat Password
|
10
|
-
%br
|
11
|
-
%input{:id => "my_repeat_password", :type => "password", :name => "#{model_name}[repeat_password]"}
|
12
|
-
%input{:type => 'submit', :value => 'Save New Item'}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
- if model
|
2
|
-
%form{:action => packet.route_to(model_name, model[:id], 'save'), :method => 'post'}
|
3
|
-
- for prop in props
|
4
|
-
%p!= view_attribute(prop, model_name, :label => true, :value => model.attribute_get(prop[:name]))
|
5
|
-
%p
|
6
|
-
%label{:for => "my_password"} Password
|
7
|
-
%br
|
8
|
-
%input{:id => "my_password", :type => "password", :name => "#{model_name}[password]"}
|
9
|
-
%p
|
10
|
-
%label{:for => "my_repeat_password"} Repeat Password
|
11
|
-
%br
|
12
|
-
%input{:id => "my_repeat_password", :type => "password", :name => "#{model_name}[repeat_password]"}
|
13
|
-
%input{:type => 'submit', :value => 'Save Changes'}
|
14
|
-
- else
|
15
|
-
%p Couldn't find the item you're looking for.
|
@@ -1 +0,0 @@
|
|
1
|
-
%p You don't have permission to view this.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
%form{:action => packet.route_to(model_name, 'login'), :method => 'post'}
|
2
|
-
- if(packet.flash['error'])
|
3
|
-
.error
|
4
|
-
%p= packet.flash('error')
|
5
|
-
%p
|
6
|
-
%label Email
|
7
|
-
%br
|
8
|
-
%input{:type => "text", :name => "members[login_email]"}
|
9
|
-
%p
|
10
|
-
%label Password
|
11
|
-
%br
|
12
|
-
%input{:type => "password", :name => "members[login_password]"}
|
13
|
-
%input{:type => "submit", :value => "Log in"}
|
14
|
-
%hr
|
15
|
-
%p
|
16
|
-
Not a member? You can
|
17
|
-
%a{:href => route_to(model_name, 'register')} register here
|
@@ -1 +0,0 @@
|
|
1
|
-
%p You have been logged out.
|
@@ -1,50 +0,0 @@
|
|
1
|
-
- if model
|
2
|
-
%form{:action => packet.route_to(model_name, 'profile'), :method => 'post'}
|
3
|
-
- if(packet.flash['error'])
|
4
|
-
.error
|
5
|
-
%p= packet.flash('error')
|
6
|
-
- if(packet.flash['info'])
|
7
|
-
.info
|
8
|
-
%p= packet.flash('info')
|
9
|
-
- for prop in props
|
10
|
-
%p!= view_attribute(prop, model_name, :label => true, :value => model.attribute_get(prop[:name]))
|
11
|
-
%fieldset
|
12
|
-
%legend Change Password
|
13
|
-
%p You only need to fill out the following information if you want to change your password
|
14
|
-
%p
|
15
|
-
%label{:for => "my_currrent_password"} Current Password
|
16
|
-
%br
|
17
|
-
%input{:id => "my_currrent_password", :type => "password", :name => "#{model_name}[current_password]"}
|
18
|
-
%p
|
19
|
-
%label{:for => "my_password"} Password
|
20
|
-
%br
|
21
|
-
%input{:id => "my_password", :type => "password", :name => "#{model_name}[password]"}
|
22
|
-
%p
|
23
|
-
%label{:for => "my_repeat_password"} Repeat Password
|
24
|
-
%br
|
25
|
-
%input{:id => "my_repeat_password", :type => "password", :name => "#{model_name}[repeat_password]"}
|
26
|
-
%fieldset
|
27
|
-
%legend Mailing Lists
|
28
|
-
%p
|
29
|
-
%input{:type => "hidden", :name => "members[email_subscribe]", :value => "0"}
|
30
|
-
%input{:type => "checkbox", :name => "members[email_subscribe]", :value => "1"}
|
31
|
-
Sign up for the mailing list?
|
32
|
-
%p We separate our mailing list into multiple topics to avoid spamming our users with unwanted emails. Choose the information you would like to receive email about.
|
33
|
-
- for group in list_groups
|
34
|
-
%h2= group["name"].capitalize
|
35
|
-
%input{:type => "hidden", :name => "members[groups][#{group['name']}][]", :value => ""}
|
36
|
-
- for opt in group["groups"]
|
37
|
-
%p
|
38
|
-
%input{:type => "checkbox", :name => "members[groups][#{group['name']}][]", :value => opt["name"]}
|
39
|
-
= opt["name"]
|
40
|
-
%fieldset
|
41
|
-
%legend Payment
|
42
|
-
- if(orange[:members].paid?(packet, model))
|
43
|
-
%p Thanks for supporting the WNSF. You can keep your subscription up to date below:
|
44
|
-
%a{:href => orange[:members].subscription_url(packet, model)} Make a payment
|
45
|
-
- else
|
46
|
-
%p To access parts of this site, you'll need to be a supporting member.
|
47
|
-
%a{:href => orange[:members].subscription_url(packet, model)} You can become a supporting member here.
|
48
|
-
%input{:type => 'submit', :value => 'Save Changes'}
|
49
|
-
- else
|
50
|
-
%p Couldn't find the item you're looking for.
|
@@ -1,37 +0,0 @@
|
|
1
|
-
%form{:action => packet.route_to(model_name, 'register'), :method => 'post'}
|
2
|
-
- if(packet.flash['error'])
|
3
|
-
.error
|
4
|
-
%p= packet.flash('error')
|
5
|
-
%p Fill out the following details to register for an account.
|
6
|
-
%p
|
7
|
-
%label Email
|
8
|
-
%br
|
9
|
-
%input{:type => "text", :name => "members[email]"}
|
10
|
-
%p.registration-name
|
11
|
-
%label Name*
|
12
|
-
%br
|
13
|
-
*Ignore this field unless you are a spam robot.
|
14
|
-
%br
|
15
|
-
%input{:type => "text", :name => "members[name]"}
|
16
|
-
%p
|
17
|
-
%label Password
|
18
|
-
%br
|
19
|
-
%input{:type => "password", :name => "members[password]"}
|
20
|
-
%p
|
21
|
-
%label Repeat Password
|
22
|
-
%br
|
23
|
-
%input{:type => "password", :name => "members[repeat_password]"}
|
24
|
-
%fieldset
|
25
|
-
%legend Mailing Lists
|
26
|
-
%p
|
27
|
-
%input{:type => "checkbox", :name => "members[email_subscribe]", :value => "1"}
|
28
|
-
Sign up for the mailing list?
|
29
|
-
%p We separate our mailing list into multiple topics to avoid spamming our users with unwanted emails. Choose the information you would like to receive email about.
|
30
|
-
- for group in list_groups
|
31
|
-
%h2= group["name"].capitalize
|
32
|
-
%input{:type => "hidden", :name => "members[groups][#{group['name']}][]", :value => ""}
|
33
|
-
- for opt in group["groups"]
|
34
|
-
%p
|
35
|
-
%input{:type => "checkbox", :name => "members[groups][#{group['name']}][]", :value => opt["name"]}
|
36
|
-
= opt["name"]
|
37
|
-
%input{:type => "submit", :value => "Register"}
|
data/lib/orange-more/news.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.join('orange-more', 'news', 'plugin')
|
@@ -1,13 +0,0 @@
|
|
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 News < Base
|
6
|
-
views_dir File.join(File.dirname(__FILE__), 'views')
|
7
|
-
|
8
|
-
resource Orange::NewsResource.new
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
Orange.plugin(Orange::Plugins::News.new)
|
13
|
-
|
@@ -1,82 +0,0 @@
|
|
1
|
-
module Orange
|
2
|
-
class NewsResource < Orange::ModelResource
|
3
|
-
use OrangeNews
|
4
|
-
call_me :news
|
5
|
-
def stack_init
|
6
|
-
orange[:admin, true].add_link("Content", :resource => @my_orange_name, :text => 'News')
|
7
|
-
orange[:radius, true].define_tag "latest_news" do |tag|
|
8
|
-
orange[:news].latest(tag.locals.packet)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def beforeNew(packet, opts = {})
|
13
|
-
unless OrangeRoute.first(:resource => 'news', :orange_site_id => packet['site'].id)
|
14
|
-
orange[:sitemap, true].add_route_for(packet,
|
15
|
-
:orange_site_id => packet['site'].id,
|
16
|
-
:resource => :news,
|
17
|
-
:resource_action => :archive,
|
18
|
-
:slug => 'news-archive',
|
19
|
-
:link_text => 'Orange News Archive'
|
20
|
-
)
|
21
|
-
end
|
22
|
-
true
|
23
|
-
end
|
24
|
-
|
25
|
-
def link_for(packet, news)
|
26
|
-
match = news.link.match(/\[(\d+)\]/)
|
27
|
-
if match
|
28
|
-
orange[:sitemap, true].to_href(packet, match[1].to_i)
|
29
|
-
else
|
30
|
-
news.link
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def sitemap_row(packet, opts = {})
|
35
|
-
do_view(packet, :sitemap_row, opts)
|
36
|
-
end
|
37
|
-
|
38
|
-
def news_view(packet, opts = {})
|
39
|
-
resource_path = packet['route.resource_path']
|
40
|
-
if resource_path.blank?
|
41
|
-
archive_view(packet, opts)
|
42
|
-
elsif resource_path =~ /^\/page/
|
43
|
-
archive(packet, opts)
|
44
|
-
else
|
45
|
-
archive_view(packet, opts)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def latest(packet, opts = {})
|
50
|
-
limit = packet['news.latest_news_limit', 3]
|
51
|
-
do_list_view(packet, :latest, {
|
52
|
-
:list => model_class.all(:order => :updated_at.desc, :limit => limit)
|
53
|
-
})
|
54
|
-
end
|
55
|
-
|
56
|
-
def archive(packet, opts = {})
|
57
|
-
opts.merge!(packet.extract_opts)
|
58
|
-
opts.merge!( :archive_url => archive_url(packet))
|
59
|
-
opts[:page] = opts[:page].blank? ? 1 : opts[:page].to_i
|
60
|
-
page = opts[:page].blank? ? 0 : opts[:page] - 1
|
61
|
-
opts[:list] = model_class.all(:order => [:updated_at.desc],
|
62
|
-
:limit => 5,
|
63
|
-
:offset => (5*page)
|
64
|
-
)
|
65
|
-
opts[:pages] = (model_class.count / 5) + 1
|
66
|
-
do_list_view(packet, :archive, opts)
|
67
|
-
end
|
68
|
-
|
69
|
-
def archive_view(packet, opts = {})
|
70
|
-
archive(packet, opts.merge!({:page => 1}))
|
71
|
-
end
|
72
|
-
|
73
|
-
def archive_url(packet)
|
74
|
-
url = orange[:sitemap, true].url_for(packet, :resource => :news, :resource_action => :archive)
|
75
|
-
url.gsub!(/\/$/, '')
|
76
|
-
end
|
77
|
-
|
78
|
-
def find_list(packet, mode, opts = {})
|
79
|
-
model_class.all(:order => [:updated_at.desc]) || []
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
.news_items
|
2
|
-
- for news in list
|
3
|
-
.news_item
|
4
|
-
%h2.news_title
|
5
|
-
%a{:href => (resource.link_for(packet, news))} #{news.title}
|
6
|
-
.news_description
|
7
|
-
= news.description
|
8
|
-
%p
|
9
|
-
%a{:href => (resource.link_for(packet, news)), :class => 'view_story'} View Story »
|
10
|
-
.news_nav
|
11
|
-
- if page > 1
|
12
|
-
%a.newer{:href => "#{archive_url}/page/#{page-1}"} Newer Posts
|
13
|
-
- if page < pages
|
14
|
-
%a.older{:href => "#{archive_url}/page/#{page+1}"} Older Posts
|
@@ -1,7 +0,0 @@
|
|
1
|
-
- if model
|
2
|
-
%form{:action => route_to(model_name, model[:id], 'save'), :method => 'post'}
|
3
|
-
- for prop in props
|
4
|
-
%p~ view_attribute(prop, model_name, :label => true, :value => model.attribute_get(prop[:name]))
|
5
|
-
%input{:type => 'submit', :value => 'Save Changes'}
|
6
|
-
- else
|
7
|
-
%p Couldn't find the item you're looking for.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
- if route
|
2
|
-
.sitemap_item{:class => "sitemap_level_#{route.level}"}
|
3
|
-
- if route.level > 0
|
4
|
-
= orange[:sitemap].route_actions(packet, :model => route)
|
5
|
-
%h4 #{route.link_text} <span>(#{route.full_path})</span>
|
6
|
-
.linked_to
|
7
|
-
%p
|
8
|
-
News Archive
|
9
|
-
%br
|
10
|
-
%a{:href => route_to(:news, 'create')} Add New News Post
|
11
|
-
.actions
|
12
|
-
= form_link('Delete', route_to(:sitemap, route.id, 'delete'), 'Are you sure you want to delete this?', {:method => 'delete'})
|
13
|
-
%a{:href => route_to(:sitemap, route.id, 'edit')} Edit
|
14
|
-
%br.clear
|
data/lib/orange-more/pages.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.join('orange-more', 'pages', 'plugin')
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'dm-timestamps'
|
2
|
-
require 'orange-more/administration/cartons/site_carton'
|
3
|
-
|
4
|
-
class OrangePage < Orange::SiteCarton
|
5
|
-
id
|
6
|
-
front do
|
7
|
-
title :title, :length => 255
|
8
|
-
fulltext :body
|
9
|
-
end
|
10
|
-
boolean :published, :default => false
|
11
|
-
|
12
|
-
property :updated_at, DateTime
|
13
|
-
has n, :versions, "OrangePageVersion"
|
14
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'dm-timestamps'
|
2
|
-
require 'orange-more/administration/cartons/site_carton'
|
3
|
-
|
4
|
-
class OrangePageVersion < Orange::SiteCarton
|
5
|
-
id
|
6
|
-
title :title, :length => 255
|
7
|
-
fulltext :body
|
8
|
-
property :updated_at, DateTime
|
9
|
-
boolean :published
|
10
|
-
property :version, Integer, :default => 0
|
11
|
-
belongs_to :orange_page, "OrangePage"
|
12
|
-
end
|
@@ -1,13 +0,0 @@
|
|
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
|
-
|
@@ -1,179 +0,0 @@
|
|
1
|
-
module Orange
|
2
|
-
module Pulp::PageHelpers
|
3
|
-
def fuzzy_time(from_time)
|
4
|
-
to_time = Time.new
|
5
|
-
from_time = from_time.to_time if from_time.respond_to?(:to_time)
|
6
|
-
to_time = to_time.to_time if to_time.respond_to?(:to_time)
|
7
|
-
distance_in_minutes = (((to_time - from_time).abs)/60).round
|
8
|
-
distance_in_seconds = ((to_time - from_time).abs).round
|
9
|
-
case distance_in_minutes
|
10
|
-
when 0..1
|
11
|
-
return distance_in_minutes == 0 ? "Less than 1 minute ago" : "About 1 minute ago"
|
12
|
-
when 2..44 then "#{distance_in_minutes} minutes ago"
|
13
|
-
when 45..89 then "An hour ago"
|
14
|
-
when 90..1439 then "#{(distance_in_minutes.to_f / 60.0).round} hours ago"
|
15
|
-
when 1440..2879 then "Yesterday"
|
16
|
-
when 2880..43199 then "#{(distance_in_minutes / 1440).round} days ago"
|
17
|
-
when 43200..86399 then "1 Month ago"
|
18
|
-
when 86400..525599 then "#{(distance_in_minutes / 43200).round} months ago"
|
19
|
-
when 525600..1051199 then "1 year ago"
|
20
|
-
else "Over #{(distance_in_minutes / 525600).round} years ago"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
class PageResource < Orange::ModelResource
|
25
|
-
use OrangePage
|
26
|
-
call_me :pages
|
27
|
-
def init
|
28
|
-
options[:sitemappable] = true
|
29
|
-
orange.add_pulp(Orange::Pulp::PageHelpers)
|
30
|
-
end
|
31
|
-
|
32
|
-
def stack_init
|
33
|
-
orange[:admin, true].add_link("Content", :resource => @my_orange_name, :text => 'Pages')
|
34
|
-
end
|
35
|
-
|
36
|
-
def publish(packet, opts = {})
|
37
|
-
no_reroute = opts[:no_reroute]
|
38
|
-
if packet.request.post? || !opts.blank?
|
39
|
-
my_id = opts[:resource_id] || packet['route.resource_id']
|
40
|
-
m = opts[:model] || model_class.get(my_id)
|
41
|
-
if m
|
42
|
-
params = {}
|
43
|
-
params[:published] = true
|
44
|
-
m.update(params)
|
45
|
-
|
46
|
-
params = m.attributes.merge(params)
|
47
|
-
params.delete(:id)
|
48
|
-
max = m.versions.max(:version) || 0
|
49
|
-
m.versions.new(params.merge(:version => max + 1))
|
50
|
-
m.save
|
51
|
-
|
52
|
-
r = orange[:sitemap, true].routes_for(packet, :resource_id => m.id, :resource => @my_orange_name, :orange_site_id => m.orange_site.id)
|
53
|
-
# Add route if none.
|
54
|
-
if (r.blank? && orange.loaded?(:sitemap))
|
55
|
-
|
56
|
-
route_hash = {
|
57
|
-
:orange_site_id => m.orange_site.id,
|
58
|
-
:resource => @my_orange_name,
|
59
|
-
:resource_id => m.id,
|
60
|
-
:slug => orange[:sitemap].slug_for(m, params),
|
61
|
-
:show_in_nav => false,
|
62
|
-
:link_text => "{title}"
|
63
|
-
}
|
64
|
-
parents = orange[:sitemap].routes_for(packet, :resource => '', :resource_id => '', :slug => "pages", :orange_site_id => m.orange_site.id)
|
65
|
-
route_hash[:parent] = parents.first unless parents.blank?
|
66
|
-
orange[:sitemap].add_route_for(packet, route_hash)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
packet.reroute(@my_orange_name, :orange) unless (packet.request.xhr? || no_reroute)
|
71
|
-
end
|
72
|
-
|
73
|
-
# Creates a new model object and saves it (if a post), then reroutes to the main page
|
74
|
-
# @param [Orange::Packet] packet the packet being routed
|
75
|
-
def onNew(packet, params = {})
|
76
|
-
params[:published] = false
|
77
|
-
m = model_class.new(params)
|
78
|
-
m.orange_site = (packet['subsite', false] ? packet['subsite'] : packet['site']) unless m.orange_site
|
79
|
-
# m.versions.new(params.merge(:version => 1))
|
80
|
-
m
|
81
|
-
end
|
82
|
-
|
83
|
-
# Saves updates to an object specified by packet['route.resource_id'], then reroutes to main
|
84
|
-
# @param [Orange::Packet] packet the packet being routed
|
85
|
-
def onSave(packet, m, params = {})
|
86
|
-
r = orange[:sitemap, true].routes_for(packet, :resource_id => m.id, :resource => @my_orange_name, :orange_site_id => m.orange_site.id)
|
87
|
-
# Add route if none.
|
88
|
-
if (r.blank? && orange.loaded?(:sitemap))
|
89
|
-
route_hash = {
|
90
|
-
:orange_site_id => m.orange_site.id,
|
91
|
-
:resource => @my_orange_name,
|
92
|
-
:resource_id => m.id,
|
93
|
-
:slug => orange[:sitemap].slug_for(m, params),
|
94
|
-
:show_in_nav => false,
|
95
|
-
:link_text => "{title}"
|
96
|
-
}
|
97
|
-
parents = orange[:sitemap].routes_for(packet, :resource => '', :resource_id => '', :slug => "pages", :orange_site_id => m.orange_site.id)
|
98
|
-
route_hash[:parent] = parents.first unless parents.blank?
|
99
|
-
orange[:sitemap].add_route_for(packet, route_hash)
|
100
|
-
end
|
101
|
-
if (params["published"] == "1")
|
102
|
-
params["published"] = true
|
103
|
-
m.orange_site = (packet['subsite', false] ? packet['subsite'] : packet['site']) unless m.orange_site
|
104
|
-
|
105
|
-
m.update(params)
|
106
|
-
orange[:pages].publish(packet, :no_reroute => true, :model => m)
|
107
|
-
else
|
108
|
-
params["published"] = false
|
109
|
-
m.orange_site = (packet['subsite', false] ? packet['subsite'] : packet['site']) unless m.orange_site
|
110
|
-
m.update(params)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def find_list(packet, mode)
|
115
|
-
model_class.all(:orange_site => packet['site']) || []
|
116
|
-
end
|
117
|
-
|
118
|
-
# Returns a single object found by the model class, given an id.
|
119
|
-
# If id isn't given, we return false.
|
120
|
-
# @param [Orange::Packet] packet the packet we are returning a view for
|
121
|
-
# @param [Symbol] mode the mode we are trying to view (used to find template name)
|
122
|
-
# @param [Numeric] id the id to lookup on the model class
|
123
|
-
# @return [Object] returns an object of type set by #use, if one found with same id
|
124
|
-
def find_one(packet, mode, id = false)
|
125
|
-
return false unless id
|
126
|
-
m = model_class.get(id)
|
127
|
-
if packet['route.resource_path',''] =~ /version\//
|
128
|
-
parts = packet['route.resource_path'].split('/')
|
129
|
-
version = parts[2]
|
130
|
-
v = m.versions.first(:version => version)
|
131
|
-
if v
|
132
|
-
attrs = v.attributes
|
133
|
-
[:version, :orange_page_id, :page_id, :id].each { |i| attrs.delete(i) }
|
134
|
-
m.attributes = attrs
|
135
|
-
end
|
136
|
-
end # end if version
|
137
|
-
if mode == :show
|
138
|
-
case packet['route.context']
|
139
|
-
when :live
|
140
|
-
# Automatically set title, if possible
|
141
|
-
unless orange[:page_parts].part(packet)[:title] != ''
|
142
|
-
orange[:page_parts].part(packet)[:title] = m.title + " - " + packet['site'].name
|
143
|
-
end
|
144
|
-
m = m.versions.last(:published => '1')
|
145
|
-
raise Orange::NotFoundException unless m
|
146
|
-
when :preview
|
147
|
-
# Automatically set title, if possible
|
148
|
-
unless orange[:page_parts].part(packet)[:title] != ''
|
149
|
-
orange[:page_parts].part(packet)[:title] = m.title + " - " + packet['site'].name
|
150
|
-
end
|
151
|
-
m
|
152
|
-
end
|
153
|
-
end # end if show
|
154
|
-
m
|
155
|
-
end
|
156
|
-
|
157
|
-
def find_extras(packet, mode, opts = {})
|
158
|
-
case mode
|
159
|
-
when :edit
|
160
|
-
return {:routes => orange[:sitemap, true].routes_for(packet)}
|
161
|
-
else {}
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def routes(packet, opts = {})
|
166
|
-
model = opts if opts.is_a? model_class
|
167
|
-
model ||= opts[:model] || model_class.get(opts[:resource_id])
|
168
|
-
orange[:sitemap].routes_for(packet, {:resource => :pages, :resource_id => model.id})
|
169
|
-
end
|
170
|
-
|
171
|
-
def sitemap_row(packet, opts = {})
|
172
|
-
do_view(packet, :sitemap_row, opts)
|
173
|
-
end
|
174
|
-
|
175
|
-
def route_for(packet, id, opts = {})
|
176
|
-
return orange[:sitemap].url_for(packet, {:resource => 'pages', :resource_id => id})
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|