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,7 +0,0 @@
|
|
1
|
-
.disqus_comments
|
2
|
-
- if packet['orange.globals'][:development_mode]
|
3
|
-
%script{:type => 'text/javascript'} var disqus_developer = 1;
|
4
|
-
#disqus_thread
|
5
|
-
%script{:type => 'text/javascript', :src => 'http://disqus.com/forums/orangesparkleball/embed.js'}
|
6
|
-
%noscript
|
7
|
-
%a{:href => 'http://disqus.com/forums/orangesparkleball/?url=ref'} View the discussion thread
|
@@ -1 +0,0 @@
|
|
1
|
-
require File.join('orange-more', 'donations', 'plugin')
|
@@ -1,12 +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 Donations < Base
|
6
|
-
views_dir File.join(File.dirname(__FILE__), 'views')
|
7
|
-
|
8
|
-
resource Orange::DonationsResource.new
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
Orange.plugin(Orange::Plugins::Donations.new)
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Orange
|
2
|
-
class DonationsResource < Orange::ModelResource
|
3
|
-
use OrangeDonation
|
4
|
-
call_me :donations
|
5
|
-
def stack_init
|
6
|
-
orange[:admin, true].add_link("Content", :resource => @my_orange_name, :text => 'Donations')
|
7
|
-
orange[:radius].define_tag "donations" do |tag|
|
8
|
-
template = tag.attr["template"] || "donate_form"
|
9
|
-
orange[:donations].form(tag.locals.packet, {:template => template})
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def form(packet, opts = {})
|
14
|
-
template = opts[:template].to_sym || :donate_form
|
15
|
-
packet['route.return_path'] = packet.request.path.to_s
|
16
|
-
do_view(packet, template, opts)
|
17
|
-
end
|
18
|
-
|
19
|
-
def donate_cancel(packet, opts = {})
|
20
|
-
id = packet.session['donation_id']
|
21
|
-
m = model_class.get(id)
|
22
|
-
m.destroy!
|
23
|
-
packet.flash['error'] = "There was an issue completing the process on Paypal."
|
24
|
-
packet.reroute((packet.flash('reroute.to') || '/'))
|
25
|
-
end
|
26
|
-
|
27
|
-
def process(packet, opts = {})
|
28
|
-
params = packet.request.params
|
29
|
-
route = params.delete('r')
|
30
|
-
params['donation_amount'] = params['donation_amount'].sub(/\$/, '')
|
31
|
-
if params['donor_phone'] == '' && packet.request.post? && params['donation_amount'] != '' && params['donation_amount'].to_f > 0
|
32
|
-
template = "paypal_form"
|
33
|
-
params.delete('donor_phone')
|
34
|
-
obj = self.new(packet, {:no_reroute => true, :params => params})
|
35
|
-
packet.session['donation_id'] = obj.id
|
36
|
-
packet.flash['reroute.to'] = route
|
37
|
-
opts[:donation_amount] = params['donation_amount']
|
38
|
-
opts[:paypal_id] = orange.options['paypal_id'] || ''
|
39
|
-
do_view(packet, template, opts)
|
40
|
-
else
|
41
|
-
packet.flash['error'] = "An error has occurred. Please try your submission again."
|
42
|
-
packet.reroute(route)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def donate_success(packet, opts = {})
|
47
|
-
template = "donate_thanks"
|
48
|
-
do_view(packet, template, opts)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
:javascript
|
2
|
-
$(function(){
|
3
|
-
$('#donate_form').validate();
|
4
|
-
});
|
5
|
-
%p
|
6
|
-
- if(flash['error'])
|
7
|
-
.error= flash('error')
|
8
|
-
%form{ :class => 'donate_form', :id => 'donate_form', :action => route_to(:donations, :process), :method => 'POST' }
|
9
|
-
%label{ :for => 'donor_name'} Your Name
|
10
|
-
%input{ :type => 'text', :minlength => '4', :maxlength => '80', :id => 'donor_name', :name => 'donor_name', :class => 'required' }
|
11
|
-
%div.donor_phone
|
12
|
-
%label{ :for => 'donor_phone'} Your Phone
|
13
|
-
%input{ :type => 'text', :minlength => '4', :maxlength => '80', :id => 'donor_phone', :name => 'donor_phone', :value => '' }
|
14
|
-
%label{ :for => 'donor_company'} Your Company
|
15
|
-
%input{ :type => 'text', :minlength => '4', :maxlength => '180', :id => 'donor_company', :name => 'donor_company', :value => '' }
|
16
|
-
%label{ :for => 'donor_email'} Your E-mail
|
17
|
-
%input{ :type => 'text', :class => 'email', :id => 'donor_email', :name => 'donor_email' }
|
18
|
-
%label{ :for => 'donation_amount'} Donation Amount: $
|
19
|
-
%input{ :type => 'text', :class => 'donation_amount', :id => 'donation_amount', :name => 'donation_amount' }
|
20
|
-
%input{ :type => 'submit', :value => 'Submit' }
|
21
|
-
%input{ :type => 'hidden', :id => 'r', :name => 'r', :value => packet['route.return_path'] }
|
@@ -1,13 +0,0 @@
|
|
1
|
-
%h3 Redirecting to PayPal...
|
2
|
-
%form{ :id => 'pform', :name => '_xclick', :action => 'https://www.paypal.com/cgi-bin/webscr', :method => "post" }
|
3
|
-
%input{ :type => 'hidden', :name => 'cmd', :value => "_donations" }
|
4
|
-
%input{ :type => 'hidden', :name => 'business', :value => paypal_id }
|
5
|
-
%input{ :type => 'hidden', :name => 'item_name', :value => "WNSF Donation" }
|
6
|
-
%input{ :type => 'hidden', :name => 'currency_code', :value => "USD" }
|
7
|
-
%input{ :type => 'hidden', :name => 'amount', :value => donation_amount }
|
8
|
-
%input{ :type => 'hidden', :name => 'return', :value => 'http://'+packet['route.site_url'] + route_to(:donations, :donate_success) }
|
9
|
-
%input{ :type => 'hidden', :name => 'cancel_return', :value => 'http://'+packet['route.site_url'] + route_to(:donations, :donate_cancel)}
|
10
|
-
:javascript
|
11
|
-
$(function(){
|
12
|
-
$('#pform').submit();
|
13
|
-
})
|
data/lib/orange-more/events.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.join('orange-more', 'events', 'plugin')
|
@@ -1,55 +0,0 @@
|
|
1
|
-
$(function(){
|
2
|
-
$('.new-venue').hide();
|
3
|
-
$('.show-venue-details').toggle(venue_details_show, venue_details_hide);
|
4
|
-
$("#events-venue").change(function(){
|
5
|
-
if($(this).val() == "new"){
|
6
|
-
venue_details_blank();
|
7
|
-
if($('.new-venue').css('display') == 'none') $('.show-venue-details').click();
|
8
|
-
}
|
9
|
-
else{
|
10
|
-
load_venue_details($(this).val());
|
11
|
-
}
|
12
|
-
});
|
13
|
-
$('input[name*=link_to_eventbrite]').change(function(){
|
14
|
-
if($(this).attr('checked')){
|
15
|
-
$('p.eventbrite-link').show();
|
16
|
-
}
|
17
|
-
else{
|
18
|
-
$('p.eventbrite-link').hide();
|
19
|
-
}
|
20
|
-
});
|
21
|
-
$('#events-eventbrite-id').change(function(){
|
22
|
-
load_event_details($(this).val());
|
23
|
-
});
|
24
|
-
$("input[name*='location']").change(function(){$("#events-venue").val("new")});
|
25
|
-
});
|
26
|
-
|
27
|
-
function venue_details_show(){
|
28
|
-
$('.show-venue-details').text('Hide');
|
29
|
-
$('.new-venue').show();
|
30
|
-
}
|
31
|
-
|
32
|
-
function venue_details_hide(){
|
33
|
-
$('.show-venue-details').text('(Details)');
|
34
|
-
$('.new-venue').hide();
|
35
|
-
}
|
36
|
-
|
37
|
-
function load_venue_details(id){
|
38
|
-
var obj = venues[id];
|
39
|
-
$("input[name*=location_name]").val(obj.name);
|
40
|
-
$("input[name*=location_address]").val(obj.address);
|
41
|
-
$("input[name*=location_address2]").val(obj.address_2);
|
42
|
-
$("input[name*=location_city]").val(obj.city);
|
43
|
-
$("input[name*=location_state]").val(obj.region);
|
44
|
-
$("input[name*=location_zip]").val(obj.postal_code);
|
45
|
-
}
|
46
|
-
|
47
|
-
function load_event_details(id){
|
48
|
-
var obj = events[id];
|
49
|
-
$("input[name*='events[name]']").val(obj.title);
|
50
|
-
$("textarea[name*=description]").val(obj.description);
|
51
|
-
}
|
52
|
-
|
53
|
-
function venue_details_blank(){
|
54
|
-
$("input[name*='location']").val('');
|
55
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
class OrangeEvent < Orange::Carton
|
2
|
-
id
|
3
|
-
admin do
|
4
|
-
title :name
|
5
|
-
text :location_name
|
6
|
-
text :location_address
|
7
|
-
text :location_address2
|
8
|
-
text :location_city
|
9
|
-
text :location_state
|
10
|
-
text :location_zip
|
11
|
-
boolean :link_to_eventbrite, :default => false
|
12
|
-
text :eventbrite_id
|
13
|
-
fulltext :blurb
|
14
|
-
fulltext :description
|
15
|
-
end
|
16
|
-
orange do
|
17
|
-
time :starts
|
18
|
-
time :ends
|
19
|
-
end
|
20
|
-
|
21
|
-
def starts_time
|
22
|
-
self.starts.strftime("%I:%M %p")
|
23
|
-
end
|
24
|
-
def starts_date
|
25
|
-
self.starts.strftime("%m/%d/%Y")
|
26
|
-
end
|
27
|
-
def ends_time
|
28
|
-
self.ends.strftime("%I:%M %p")
|
29
|
-
end
|
30
|
-
def ends_date
|
31
|
-
self.ends.strftime("%m/%d/%Y")
|
32
|
-
end
|
33
|
-
def date_attr(attribute, datestr = false)
|
34
|
-
time_attr(attribute, false, datestr)
|
35
|
-
end
|
36
|
-
|
37
|
-
def attribute_time_get(attribute)
|
38
|
-
attribute_get(attribute) || Time.now
|
39
|
-
end
|
40
|
-
def time_attr(attribute, timestr = false, datestr = false)
|
41
|
-
date = datestr || attribute_time_get(attribute).strftime("%m/%d/%Y")
|
42
|
-
time = timestr || attribute_time_get(attribute).strftime("%I:%M %p")
|
43
|
-
attribute_set(attribute, Time.parse(date + " " + time))
|
44
|
-
end
|
45
|
-
|
46
|
-
def starts_time=(time)
|
47
|
-
time_attr(:starts, time)
|
48
|
-
end
|
49
|
-
def starts_date=(date)
|
50
|
-
date_attr(:starts, date)
|
51
|
-
end
|
52
|
-
def ends_time=(time)
|
53
|
-
time_attr(:ends, time)
|
54
|
-
end
|
55
|
-
def ends_date=(date)
|
56
|
-
date_attr(:ends, date)
|
57
|
-
end
|
58
|
-
|
59
|
-
belongs_to :calendar, "OrangeCalendar", :child_key => [:orange_calendar_id]
|
60
|
-
end
|
@@ -1,14 +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 Events < Base
|
6
|
-
views_dir File.join(File.dirname(__FILE__), 'views')
|
7
|
-
assets_dir File.join(File.dirname(__FILE__), 'assets')
|
8
|
-
resource Orange::CalendarResource.new
|
9
|
-
resource Orange::EventResource.new
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
Orange.plugin(Orange::Plugins::Events.new)
|
14
|
-
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Orange
|
2
|
-
class CalendarResource < ModelResource
|
3
|
-
use OrangeCalendar
|
4
|
-
call_me :calendar
|
5
|
-
def stack_init
|
6
|
-
orange[:admin, true].add_link("Settings", :resource => @my_orange_name, :text => 'Calendars')
|
7
|
-
orange[:radius].define_tag "calendar" do |tag|
|
8
|
-
template = tag.attr["template"] || false
|
9
|
-
if tag.attr["name"]
|
10
|
-
calendars = tag.attr["name"].split.map{|x| model_class.first(:name => x)}
|
11
|
-
unless tag.attr["main"] && tag.attr["main"] == "false"
|
12
|
-
calendars << model_class.all(:main => true)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
calendars = model_class.all
|
16
|
-
end
|
17
|
-
events = OrangeEvent.all(:calendar => calendars, :starts.gt => Time.now, :order => [:starts.asc])
|
18
|
-
orange[:calendar].calendar(tag.locals.packet, {:list => events, :template => template})
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def calendar(packet, opts = {})
|
23
|
-
template = (opts[:template] || "calendar").to_sym
|
24
|
-
do_list_view(packet, template, opts)
|
25
|
-
end
|
26
|
-
|
27
|
-
def afterNew(packet, obj, opts = {})
|
28
|
-
obj.orange_site = packet['site'] unless obj.orange_site
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
@@ -1,147 +0,0 @@
|
|
1
|
-
require 'eventbright'
|
2
|
-
require 'json'
|
3
|
-
module Orange
|
4
|
-
class EventResource < ModelResource
|
5
|
-
# For integration with Eventbrite. Application key needs user
|
6
|
-
# key for full access.
|
7
|
-
ORANGE_EVENTBRITE_KEY = "ODQ5MDMzZWQwOWRl"
|
8
|
-
|
9
|
-
use OrangeEvent
|
10
|
-
call_me :events
|
11
|
-
|
12
|
-
def stack_init
|
13
|
-
orange[:admin, true].add_link("Content", :resource => @my_orange_name, :text => 'Events')
|
14
|
-
EventBright.setup(ORANGE_EVENTBRITE_KEY)
|
15
|
-
options[:eventbrite_key] = orange.options['eventbrite_key'] || false
|
16
|
-
end
|
17
|
-
|
18
|
-
def eventbrite_user
|
19
|
-
return false unless options[:eventbrite_key]
|
20
|
-
begin
|
21
|
-
@eventbrite_user = EventBright::User.new(options[:eventbrite_key])
|
22
|
-
rescue # If EventBright gem throws error, we're probably having issues connecting
|
23
|
-
false
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def find_extras(packet, mode, opts = {})
|
28
|
-
extras = {:calendars => OrangeCalendar.all}
|
29
|
-
case mode
|
30
|
-
when :create, :edit
|
31
|
-
ev = eventbrite_venues
|
32
|
-
ee = eventbrite_events
|
33
|
-
ev_json = {} if ev
|
34
|
-
ev.each{|v| ev_json[v.id] = v.attributes.merge(:id => v.id)} if ev
|
35
|
-
ee_json = {} if ee
|
36
|
-
ee.each{|v| ee_json[v.id] = v.attributes.merge(:id => v.id).reject{|k,v| [:venue, :organizer].include? k}} if ee
|
37
|
-
extras.merge!(:eventbrite_venues => ev, :venues_json => ev_json.to_json,
|
38
|
-
:eventbrite_events => ee, :events_json => ee_json.to_json
|
39
|
-
) if options[:eventbrite_key]
|
40
|
-
|
41
|
-
end
|
42
|
-
extras
|
43
|
-
end
|
44
|
-
|
45
|
-
def synchronize_attendees(packet, params = {})
|
46
|
-
no_reroute = params.delete(:no_reroute)
|
47
|
-
params = params.with_defaults(:resource_id => packet['route.resource_id'])
|
48
|
-
if packet.request.post? && orange.loaded?(:members) &&
|
49
|
-
event_orange = model_class.get(params[:resource_id])
|
50
|
-
event = eventbrite_user.events.select{|e| e.id.to_s == event_orange.eventbrite_id}.first
|
51
|
-
orange[:members, true].add_attendee_group(packet, "Eventbrite Attendee", "#{event.title} - #{event.id}")
|
52
|
-
emails = event.attendees.map{|a| a.email}
|
53
|
-
orange[:members, true].batch_update_interest_mailchimp(packet, emails, "Eventbrite Attendee", "#{event.title} - #{event.id}")
|
54
|
-
end
|
55
|
-
packet.reroute(@my_orange_name, :orange, packet['route.resource_id'], 'edit') unless no_reroute
|
56
|
-
end
|
57
|
-
|
58
|
-
# Todo - eventbrite crashes when date in past
|
59
|
-
def beforeNew(packet, params = {})
|
60
|
-
eventbrite_synchronize(packet, params)
|
61
|
-
true
|
62
|
-
end
|
63
|
-
|
64
|
-
# Todo - eventbrite crashes when date in past
|
65
|
-
def beforeSave(packet, model, params = {})
|
66
|
-
eventbrite_synchronize(packet, params)
|
67
|
-
true
|
68
|
-
end
|
69
|
-
|
70
|
-
def eventbrite_synchronize(packet, params = {})
|
71
|
-
venue_id = params.delete('orange_venue_id')
|
72
|
-
if params['link_to_eventbrite'] != "0"
|
73
|
-
if venue_id == "new"
|
74
|
-
v = EventBright::Venue.new(eventbrite_user)
|
75
|
-
v.organizer_id = eventbrite_user.organizers.first.id
|
76
|
-
else
|
77
|
-
v = eventbrite_user.venues.select{|v| v.id == venue_id.to_i }.first
|
78
|
-
end
|
79
|
-
update_venue(v, params)
|
80
|
-
if params['eventbrite_id'] == "new"
|
81
|
-
e = EventBright::Event.new(eventbrite_user)
|
82
|
-
e.organizer = eventbrite_user.organizers.first
|
83
|
-
else
|
84
|
-
e = eventbrite_user.events.select{|e| e.id == params['eventbrite_id'].to_i }.first
|
85
|
-
end
|
86
|
-
params['eventbrite_id'] = update_event(e, params, v)
|
87
|
-
else
|
88
|
-
params['eventbrite_id'] = nil
|
89
|
-
end
|
90
|
-
params
|
91
|
-
end
|
92
|
-
|
93
|
-
def update_event(event, params, venue)
|
94
|
-
event.venue = venue
|
95
|
-
event.title = params["name"]
|
96
|
-
event.description = params["description"]
|
97
|
-
event.start_date = params["starts_date"] + " " + params["starts_time"]
|
98
|
-
event.end_date = params["ends_date"] + " " + params["ends_time"]
|
99
|
-
if(event.start_date > event.end_date)
|
100
|
-
raise "An event can't end before it starts."
|
101
|
-
else
|
102
|
-
event.status = "live"
|
103
|
-
event.save
|
104
|
-
end
|
105
|
-
return event.id
|
106
|
-
end
|
107
|
-
|
108
|
-
def update_venue(venue, params)
|
109
|
-
venue.name = params["location_name"]
|
110
|
-
venue.address = params["location_address"]
|
111
|
-
venue.address_2 = params["location_address2"]
|
112
|
-
venue.city = params["location_city"]
|
113
|
-
venue.region = params["location_state"]
|
114
|
-
venue.postal_code = params["location_zip"]
|
115
|
-
venue.country_code = "US"
|
116
|
-
venue.save
|
117
|
-
end
|
118
|
-
|
119
|
-
def find_list(packet, mode, opts = {})
|
120
|
-
model_class.all(:order => [:starts.desc]) || []
|
121
|
-
end
|
122
|
-
|
123
|
-
def post_to_eventbrite
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
def eventbrite_venues
|
128
|
-
list = []
|
129
|
-
begin
|
130
|
-
list = eventbrite_user.venues
|
131
|
-
rescue
|
132
|
-
return false
|
133
|
-
end
|
134
|
-
list
|
135
|
-
end
|
136
|
-
|
137
|
-
def eventbrite_events
|
138
|
-
list = []
|
139
|
-
begin
|
140
|
-
list = eventbrite_user.events
|
141
|
-
rescue
|
142
|
-
return false
|
143
|
-
end
|
144
|
-
list
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|