orange-more 0.5.8 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/lib/orange-more.rb +1 -7
  2. data/lib/orange-more/administration/cartons/user.rb +4 -1
  3. data/lib/orange-more/administration/middleware/access_control.rb +25 -13
  4. data/lib/orange-more/administration/middleware/site_load.rb +1 -1
  5. data/lib/orange-more/administration/resources/user_resource.rb +15 -1
  6. data/lib/orange-more/analytics/resources/analytics_resource.rb +2 -1
  7. data/lib/orange-more/assets/cartons/asset_carton.rb +26 -2
  8. data/lib/orange-more/assets/resources/asset_resource.rb +81 -15
  9. data/lib/orange-more/blog/cartons/blog_post.rb +3 -3
  10. data/lib/orange-more/contactforms/cartons/{contactforms_carton.rb → contactform_carton.rb} +2 -1
  11. data/lib/orange-more/contactforms/resources/contactforms_resource.rb +15 -13
  12. data/lib/orange-more/contactforms/views/contactforms/contactform.haml +1 -0
  13. data/lib/orange-more/debugger/assets/css/debug_bar.css +1 -0
  14. data/lib/orange-more/pages/resources/page_resource.rb +7 -0
  15. data/lib/orange-more/sitemap/resources/sitemap_resource.rb +6 -1
  16. data/lib/orange-more/slices/resources/slices.rb +9 -5
  17. metadata +6 -53
  18. data/lib/orange-more/adverts.rb +0 -1
  19. data/lib/orange-more/adverts/cartons/adverts_carton.rb +0 -14
  20. data/lib/orange-more/adverts/plugin.rb +0 -13
  21. data/lib/orange-more/adverts/resources/adverts_resource.rb +0 -27
  22. data/lib/orange-more/adverts/views/adverts/adverts.haml +0 -2
  23. data/lib/orange-more/donations.rb +0 -1
  24. data/lib/orange-more/donations/cartons/donation_carton.rb +0 -9
  25. data/lib/orange-more/donations/plugin.rb +0 -12
  26. data/lib/orange-more/donations/resources/donations_resource.rb +0 -51
  27. data/lib/orange-more/donations/views/donations/donate_form.haml +0 -21
  28. data/lib/orange-more/donations/views/donations/donate_thanks.haml +0 -2
  29. data/lib/orange-more/donations/views/donations/paypal_form.haml +0 -13
  30. data/lib/orange-more/events.rb +0 -1
  31. data/lib/orange-more/events/assets/js/events.js +0 -55
  32. data/lib/orange-more/events/cartons/orange_calendar.rb +0 -8
  33. data/lib/orange-more/events/cartons/orange_event.rb +0 -60
  34. data/lib/orange-more/events/plugin.rb +0 -14
  35. data/lib/orange-more/events/resources/calendar_resource.rb +0 -33
  36. data/lib/orange-more/events/resources/event_resource.rb +0 -147
  37. data/lib/orange-more/events/views/calendar/calendar.haml +0 -8
  38. data/lib/orange-more/events/views/events/create.haml +0 -55
  39. data/lib/orange-more/events/views/events/edit.haml +0 -59
  40. data/lib/orange-more/events/views/events/list.haml +0 -13
  41. data/lib/orange-more/events/views/events/show.haml +0 -4
  42. data/lib/orange-more/events/views/events/table_row.haml +0 -17
  43. data/lib/orange-more/members.rb +0 -1
  44. data/lib/orange-more/members/cartons/member_carton.rb +0 -38
  45. data/lib/orange-more/members/plugin.rb +0 -13
  46. data/lib/orange-more/members/resources/members_resource.rb +0 -327
  47. data/lib/orange-more/members/views/members/create.haml +0 -12
  48. data/lib/orange-more/members/views/members/edit.haml +0 -15
  49. data/lib/orange-more/members/views/members/live.show.haml +0 -1
  50. data/lib/orange-more/members/views/members/login.haml +0 -17
  51. data/lib/orange-more/members/views/members/logout.haml +0 -1
  52. data/lib/orange-more/members/views/members/profile.haml +0 -50
  53. data/lib/orange-more/members/views/members/register.haml +0 -37
  54. data/lib/orange-more/subsites.rb +0 -1
  55. data/lib/orange-more/subsites/cartons/subsite.rb +0 -8
  56. data/lib/orange-more/subsites/middleware/subsite_load.rb +0 -29
  57. data/lib/orange-more/subsites/plugin.rb +0 -17
  58. data/lib/orange-more/subsites/resources/subsite_resource.rb +0 -54
  59. data/lib/orange-more/subsites/views/subsites/index.haml +0 -2
  60. data/lib/orange-more/testimonials.rb +0 -1
  61. data/lib/orange-more/testimonials/cartons/testimonials_carton.rb +0 -15
  62. data/lib/orange-more/testimonials/plugin.rb +0 -13
  63. data/lib/orange-more/testimonials/resources/testimonials_resource.rb +0 -42
  64. data/lib/orange-more/testimonials/views/testimonials/testimonials.haml +0 -4
@@ -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"}
@@ -1 +0,0 @@
1
- require File.join('orange-more', 'subsites', 'plugin')
@@ -1,8 +0,0 @@
1
- class OrangeSite < Orange::Carton
2
- property :type, Discriminator
3
- has n, :subsites, 'OrangeSubsite'
4
- end
5
-
6
- class OrangeSubsite < OrangeSite
7
- belongs_to :orange_site, :required => false
8
- end
@@ -1,29 +0,0 @@
1
- require 'orange-core/middleware/base'
2
- module Orange::Middleware
3
- # This will load information about the site to into the orange env
4
- # - packet['site'] will be an instance of the site object
5
- #
6
- class SubsiteLoad < Base
7
- def packet_call(packet)
8
- if packet['site']
9
- site = packet['site']
10
- path = packet['route.path'] || packet.request.path_info
11
-
12
- # Find the subsite in the sitemap table
13
- extras, matched = orange[:sitemap].find_route_info(packet, path)
14
-
15
- # If matched, update the loaded site and trim the path down a bit
16
- if !matched.resource.blank? && matched.resource.to_sym == :subsites
17
- if(m = site.subsites.first(:id => matched.resource_id))
18
- packet['route.main_site_route'] = matched
19
- packet['route.path'] = extras
20
- packet['subsite'] = m
21
- end
22
- end
23
- end
24
- pass packet
25
- end
26
- end
27
-
28
- end
29
-
@@ -1,17 +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
- Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
4
-
5
- module Orange::Plugins
6
- class Subsites < Base
7
- views_dir File.join(File.dirname(__FILE__), 'views')
8
-
9
- resource Orange::SubsiteResource.new
10
-
11
- prerouter Orange::Middleware::SubsiteLoad
12
-
13
- end
14
- end
15
-
16
- Orange.plugin(Orange::Plugins::Subsites.new)
17
-
@@ -1,54 +0,0 @@
1
- module Orange
2
- class SubsiteResource < Orange::ModelResource
3
- use OrangeSubsite
4
- call_me :subsites
5
- def stack_init
6
- orange[:admin, true].add_link("Settings", :resource => @my_orange_name, :text => 'Subsites')
7
- end
8
-
9
- # Creates a new model object and saves it (if a post), then reroutes to the main page
10
- # @param [Orange::Packet] packet the packet being routed
11
- def new(packet, *opts)
12
- if packet.request.post?
13
- m = packet['site'].subsites.new(packet.request.params[@my_orange_name.to_s])
14
- m.save
15
- orange[:sitemap].add_route_for(packet,
16
- :orange_site_id => packet['site'].id,
17
- :resource => :subsites,
18
- :resource_id => m.id,
19
- :slug => 'subsite',
20
- :link_text => 'Orange Subsite'
21
- )
22
- end
23
- packet.reroute(@my_orange_name, :orange)
24
- end
25
-
26
- def url_for(packet, opts = {})
27
- orange[:sitemap].url_for(packet, {:resource => 'subsites', :resource_id => (opts.is_a?(model_class) ? opts.id : packet['subsite'].id)})
28
- end
29
-
30
- def subsite_nav(packet, opts = {})
31
- orange[:sitemap].one_level(packet, :model => orange[:sitemap].home(packet, :subsite => true))
32
- end
33
-
34
- def sitemap_row(packet, opts = {})
35
- do_view(packet, :sitemap_row, opts)
36
- end
37
-
38
- end
39
-
40
- class Mapper < Resource
41
- def route_to(packet, resource, *args)
42
- opts = args.extract_options!
43
- packet = DefaultHash.new unless packet
44
- context = opts[:context]
45
- context = packet['route.context', nil] unless (context || (packet['route.context'] == :live))
46
- site = packet['route.faked_site'] ? packet['route.site_url', nil] : nil
47
- args.unshift(resource)
48
- args.unshift(orange[:subsites].url_for(packet).gsub(/^\//, '').gsub(/\/$/, '')) if(packet['subsite'])
49
- args.unshift(context)
50
- args.unshift(site)
51
- '/'+args.compact.join('/')
52
- end
53
- end
54
- end
@@ -1,2 +0,0 @@
1
- %p
2
- %a{:href => ''} Add new Subsite
@@ -1 +0,0 @@
1
- require File.join('orange-more', 'testimonials', 'plugin')
@@ -1,15 +0,0 @@
1
- class OrangeTestimonial < Orange::SiteCarton
2
- id
3
- admin do
4
- title :name
5
- text :position
6
- text :company
7
- text :tags
8
- fulltext :blurb
9
- end
10
-
11
- def self.with_tag(tag)
12
- all(:tags.like => "%#{tag}%")
13
- end
14
-
15
- 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 Testimonials < Base
6
- views_dir File.join(File.dirname(__FILE__), 'views')
7
-
8
- resource Orange::TestimonialsResource.new
9
- end
10
- end
11
-
12
- Orange.plugin(Orange::Plugins::Testimonials.new)
13
-
@@ -1,42 +0,0 @@
1
- module Orange
2
- class TestimonialsResource < Orange::ModelResource
3
- use OrangeTestimonial
4
- call_me :testimonials
5
- def stack_init
6
- orange[:admin, true].add_link("Content", :resource => @my_orange_name, :text => 'Testimonials')
7
- orange[:radius].define_tag "testimonials" do |tag|
8
- packet = tag.locals.packet
9
- if tag.attr["tag"] && for_site(packet).with_tag(tag.attr["tag"]).count >0
10
- m = for_site(packet).with_tag(tag.attr["tag"]).first(:offset => rand(for_site(packet).with_tag(tag.attr["tag"]).count)) #selects testimonial based on tag
11
- elsif for_site(packet).count > 0 && !tag.attr.include?("tag")
12
- m = for_site(packet).first(:offset => rand(for_site(packet).count)) #selects a random testimonial
13
- end
14
- unless m.nil?
15
- template = tag.attr["template"] || "testimonials"
16
- orange[:testimonials].testimonial(packet, {:model => m, :template => template})
17
- else
18
- ""
19
- end
20
- end
21
- end
22
-
23
- def afterNew(packet, obj, params = {})
24
- obj.orange_site = packet['subsite'].blank? ? packet['site'] : packet['subsite']
25
- end
26
-
27
- def for_site(packet, opts = {})
28
- site_filtered = model_class.all(:orange_site => packet['subsite'].blank? ? packet['site'] : packet['subsite'])
29
- if site_filtered.count > 0
30
- site_filtered
31
- else
32
- # Return unfiltered if no site-specific ones
33
- model_class.all
34
- end
35
- end
36
-
37
- def testimonial(packet, opts = {})
38
- template = opts[:template].to_sym || :testimonials
39
- do_view(packet, template, opts)
40
- end
41
- end
42
- end
@@ -1,4 +0,0 @@
1
- %h2 #{model.name} Said:
2
- %h4 Position: #{model.position}
3
- %h4 At: #{model.company}
4
- %p= model.blurb