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,122 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Metadata - jQuery plugin for parsing metadata from elements
|
3
|
-
*
|
4
|
-
* Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
|
5
|
-
*
|
6
|
-
* Dual licensed under the MIT and GPL licenses:
|
7
|
-
* http://www.opensource.org/licenses/mit-license.php
|
8
|
-
* http://www.gnu.org/licenses/gpl.html
|
9
|
-
*
|
10
|
-
* Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
|
11
|
-
*
|
12
|
-
*/
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
16
|
-
* in the JSON will become a property of the element itself.
|
17
|
-
*
|
18
|
-
* There are three supported types of metadata storage:
|
19
|
-
*
|
20
|
-
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
21
|
-
*
|
22
|
-
* class: Inside the class attribute, wrapped in curly braces: { }
|
23
|
-
*
|
24
|
-
* elem: Inside a child element (e.g. a script tag). The
|
25
|
-
* name parameter indicates *which* element.
|
26
|
-
*
|
27
|
-
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
28
|
-
*
|
29
|
-
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
30
|
-
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
31
|
-
*
|
32
|
-
* @name $.metadata.setType
|
33
|
-
*
|
34
|
-
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
35
|
-
* @before $.metadata.setType("class")
|
36
|
-
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
37
|
-
* @desc Reads metadata from the class attribute
|
38
|
-
*
|
39
|
-
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
40
|
-
* @before $.metadata.setType("attr", "data")
|
41
|
-
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
42
|
-
* @desc Reads metadata from a "data" attribute
|
43
|
-
*
|
44
|
-
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
45
|
-
* @before $.metadata.setType("elem", "script")
|
46
|
-
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
47
|
-
* @desc Reads metadata from a nested script element
|
48
|
-
*
|
49
|
-
* @param String type The encoding type
|
50
|
-
* @param String name The name of the attribute to be used to get metadata (optional)
|
51
|
-
* @cat Plugins/Metadata
|
52
|
-
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
53
|
-
* @type undefined
|
54
|
-
* @see metadata()
|
55
|
-
*/
|
56
|
-
|
57
|
-
(function($) {
|
58
|
-
|
59
|
-
$.extend({
|
60
|
-
metadata : {
|
61
|
-
defaults : {
|
62
|
-
type: 'class',
|
63
|
-
name: 'metadata',
|
64
|
-
cre: /({.*})/,
|
65
|
-
single: 'metadata'
|
66
|
-
},
|
67
|
-
setType: function( type, name ){
|
68
|
-
this.defaults.type = type;
|
69
|
-
this.defaults.name = name;
|
70
|
-
},
|
71
|
-
get: function( elem, opts ){
|
72
|
-
var settings = $.extend({},this.defaults,opts);
|
73
|
-
// check for empty string in single property
|
74
|
-
if ( !settings.single.length ) settings.single = 'metadata';
|
75
|
-
|
76
|
-
var data = $.data(elem, settings.single);
|
77
|
-
// returned cached data if it already exists
|
78
|
-
if ( data ) return data;
|
79
|
-
|
80
|
-
data = "{}";
|
81
|
-
|
82
|
-
if ( settings.type == "class" ) {
|
83
|
-
var m = settings.cre.exec( elem.className );
|
84
|
-
if ( m )
|
85
|
-
data = m[1];
|
86
|
-
} else if ( settings.type == "elem" ) {
|
87
|
-
if( !elem.getElementsByTagName )
|
88
|
-
return undefined;
|
89
|
-
var e = elem.getElementsByTagName(settings.name);
|
90
|
-
if ( e.length )
|
91
|
-
data = $.trim(e[0].innerHTML);
|
92
|
-
} else if ( elem.getAttribute != undefined ) {
|
93
|
-
var attr = elem.getAttribute( settings.name );
|
94
|
-
if ( attr )
|
95
|
-
data = attr;
|
96
|
-
}
|
97
|
-
|
98
|
-
if ( data.indexOf( '{' ) <0 )
|
99
|
-
data = "{" + data + "}";
|
100
|
-
|
101
|
-
data = eval("(" + data + ")");
|
102
|
-
|
103
|
-
$.data( elem, settings.single, data );
|
104
|
-
return data;
|
105
|
-
}
|
106
|
-
}
|
107
|
-
});
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Returns the metadata object for the first member of the jQuery object.
|
111
|
-
*
|
112
|
-
* @name metadata
|
113
|
-
* @descr Returns element's metadata object
|
114
|
-
* @param Object opts An object contianing settings to override the defaults
|
115
|
-
* @type jQuery
|
116
|
-
* @cat Plugins/Metadata
|
117
|
-
*/
|
118
|
-
$.fn.metadata = function( opts ){
|
119
|
-
return $.metadata.get( this[0], opts );
|
120
|
-
};
|
121
|
-
|
122
|
-
})(jQuery);
|
@@ -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 ContactForms < Base
|
6
|
-
views_dir File.join(File.dirname(__FILE__), 'views')
|
7
|
-
assets_dir File.join(File.dirname(__FILE__), 'assets')
|
8
|
-
resource Orange::ContactFormsResource.new
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
Orange.plugin(Orange::Plugins::ContactForms.new)
|
13
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'mail'
|
2
|
-
|
3
|
-
module Orange
|
4
|
-
class ContactFormsResource < Orange::ModelResource
|
5
|
-
use OrangeContactForms
|
6
|
-
call_me :contactforms
|
7
|
-
def stack_init
|
8
|
-
orange[:admin, true].add_link("Content", :resource => @my_orange_name, :text => 'Contact Forms')
|
9
|
-
orange[:radius].define_tag "contactform" do |tag|
|
10
|
-
if tag.attr["name"] && model_class.named(tag.attr["name"]).count >0
|
11
|
-
m = model_class.named(tag.attr["name"]).first #selects contactform based on title
|
12
|
-
elsif model_class.all.count > 0
|
13
|
-
if tag.attr["id"]
|
14
|
-
m = model_class.get(tag.attr["id"])
|
15
|
-
else
|
16
|
-
m = model_class.first
|
17
|
-
end
|
18
|
-
end
|
19
|
-
unless m.nil?
|
20
|
-
template = tag.attr["template"] || "contactform"
|
21
|
-
orange[:contactforms].contactform(tag.locals.packet, {:model => m, :template => template, :id => m.id})
|
22
|
-
else
|
23
|
-
""
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def contactform(packet, opts = {})
|
29
|
-
template = opts[:template].to_sym || :contactform
|
30
|
-
packet['route.return_path'] = packet.request.path.to_s
|
31
|
-
do_view(packet, template, opts)
|
32
|
-
end
|
33
|
-
|
34
|
-
def mailer(packet, opts = {})
|
35
|
-
params = packet.request.params
|
36
|
-
route = params['r']
|
37
|
-
if params['contact_phone'] != ''
|
38
|
-
packet.flash['error'] = "An error has occurred. Please try your submission again."
|
39
|
-
packet.reroute(route)
|
40
|
-
end
|
41
|
-
path = packet['route.path']
|
42
|
-
parts = path.split('/')
|
43
|
-
form = model_class.get(parts.last.to_i)
|
44
|
-
mail = Mail.new do
|
45
|
-
from "WNSF <info@wnsf.org>"
|
46
|
-
to form.to_address
|
47
|
-
subject 'E-mail contact from WNSF.org - '+form.title
|
48
|
-
body "From: "+params['contact_from']+" ("+params['contact_email_address']+")\n\nMessage:\n"+params['contact_message']
|
49
|
-
end
|
50
|
-
mail.delivery_method :sendmail
|
51
|
-
mail.deliver
|
52
|
-
packet.flash['error'] = "Thanks for your submission. We will contact you as soon as possible."
|
53
|
-
packet.reroute(route)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
:javascript
|
2
|
-
$(function(){
|
3
|
-
$('.contact_form').validate();
|
4
|
-
});
|
5
|
-
%p
|
6
|
-
%h3= model.title
|
7
|
-
- if(flash['error'])
|
8
|
-
.error= flash('error')
|
9
|
-
%form{ :class => 'contact_form', :id => 'contact_form_'+model.id.to_s, :action => route_to(:contactforms, :mailer, model.id), :method => 'POST' }
|
10
|
-
%label{ :for => 'contact_from'} Your Name
|
11
|
-
%input{ :type => 'text', :class => 'required', :minlength => '4', :maxlength => '80', :id => 'contact_from', :name => 'contact_from' }
|
12
|
-
%div.contact_phone
|
13
|
-
%label{ :for => 'contact_from'} Your Phone
|
14
|
-
%input{ :type => 'text', :class => '', :id => 'contact_phone', :name => 'contact_phone', :value => '' }
|
15
|
-
%label{ :for => 'contact_email_address'} Your E-mail
|
16
|
-
%input{ :type => 'text', :class => 'email required', :id => 'contact_email_address', :name => 'contact_email_address' }
|
17
|
-
%input{ :type => 'hidden', :id => 'r', :name => 'r', :value => packet['route.return_path'] }
|
18
|
-
%label{ :for => 'contact_message'} Message
|
19
|
-
%textarea{ :class =>'required', :id => 'contact_message', :name => 'contact_message', :minlength => '6', :maxlength => '300' }= " "
|
20
|
-
%input{ :type => 'submit', :value => 'Submit' }
|
data/lib/orange-more/debugger.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.join('orange-more', 'debugger', 'plugin')
|
@@ -1,46 +0,0 @@
|
|
1
|
-
/* @override http://localhost:4321/assets/_debugger_/css/debug_bar.css */
|
2
|
-
|
3
|
-
body{
|
4
|
-
margin: 0;
|
5
|
-
margin-bottom: 500px;
|
6
|
-
}
|
7
|
-
#debug_bar{
|
8
|
-
position: fixed;
|
9
|
-
bottom: 0;
|
10
|
-
background-color: #333;
|
11
|
-
width: 100%;
|
12
|
-
font: medium "Lucida Grande", Lucida, Verdana, sans-serif;
|
13
|
-
}
|
14
|
-
#debug_bar h1{
|
15
|
-
margin-left: 1em;
|
16
|
-
font-size: 1em;
|
17
|
-
display: inline-block;
|
18
|
-
color: #eb8336;
|
19
|
-
}
|
20
|
-
|
21
|
-
#debug_bar ul{
|
22
|
-
display: inline-block;
|
23
|
-
list-style: none;
|
24
|
-
margin: 0;
|
25
|
-
}
|
26
|
-
|
27
|
-
#debug_bar ul li{
|
28
|
-
display: inline-block;
|
29
|
-
margin: 1em;
|
30
|
-
}
|
31
|
-
|
32
|
-
#debug_bar ul li a{
|
33
|
-
color: white;
|
34
|
-
}
|
35
|
-
#debug_bar #requestinfo{
|
36
|
-
display: none;
|
37
|
-
height: 300px;
|
38
|
-
overflow: auto;
|
39
|
-
background: white;
|
40
|
-
margin: 2em 3em;
|
41
|
-
padding: 1em 3em;
|
42
|
-
}
|
43
|
-
|
44
|
-
#debug_bar #requestinfo.show{
|
45
|
-
display: block;
|
46
|
-
}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'orange-core/middleware/base'
|
2
|
-
|
3
|
-
module Orange::Middleware
|
4
|
-
class Debugger < Base
|
5
|
-
def init(opts = {})
|
6
|
-
orange.add_pulp Orange::Pulp::DebuggerHelpers if orange.options[:development_mode]
|
7
|
-
orange.mixin Orange::Mixins::DebuggerMixin if orange.options[:development_mode]
|
8
|
-
end
|
9
|
-
|
10
|
-
# Passes packet then parses the return
|
11
|
-
def packet_call(packet)
|
12
|
-
if orange.options[:development_mode]
|
13
|
-
packet.flash['redirect_to'] = packet.request.path
|
14
|
-
packet.add_css('debug_bar.css', :module => '_debugger_')
|
15
|
-
end
|
16
|
-
pass packet
|
17
|
-
if orange.options[:development_mode]
|
18
|
-
bar = orange[:parser].haml('debug_bar.haml', packet)
|
19
|
-
packet[:content] = packet[:content].gsub('</body>', bar + '</body>')
|
20
|
-
end
|
21
|
-
packet.finish
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
module Orange::Pulp::DebuggerHelpers
|
28
|
-
def h_debug(obj) # :nodoc:
|
29
|
-
case obj
|
30
|
-
when String
|
31
|
-
Rack::Utils.escape_html(obj)
|
32
|
-
else
|
33
|
-
Rack::Utils.escape_html(obj.inspect)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
module Orange::Mixins::DebuggerMixin
|
40
|
-
def resources
|
41
|
-
@resources
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
class Rack::Builder
|
46
|
-
def inspect
|
47
|
-
"#<Rack::Builder:#{self.object_id.to_s(16)} @ins=#{@ins.map{|x| x.instance_of?(Proc)? x.call(nil) : x }.inspect} >"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
|
2
|
-
|
3
|
-
module Orange::Plugins
|
4
|
-
class Debugger < Base
|
5
|
-
views_dir File.join(File.dirname(__FILE__), 'views')
|
6
|
-
assets_dir File.join(File.dirname(__FILE__), 'assets')
|
7
|
-
prerouter Orange::Middleware::Debugger
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
Orange.plugin(Orange::Plugins::Debugger.new)
|
12
|
-
|
@@ -1,87 +0,0 @@
|
|
1
|
-
#debug_bar
|
2
|
-
%h1 Debugger
|
3
|
-
%ul
|
4
|
-
%li
|
5
|
-
%a.requestinfo{:href => '#', :onclick => 'jQuery("#debug_bar #requestinfo").toggleClass("show"); return false'} Request Info
|
6
|
-
%li
|
7
|
-
%a{:href => '/__ORANGE_DB__/migrate'} Reinitialize Database
|
8
|
-
#requestinfo
|
9
|
-
%h2 Request information
|
10
|
-
- for var in [:GET, :POST, :cookies]
|
11
|
-
%h3{:id => "#{var.to_s.downcase}-info"}= "#{var.to_s}"
|
12
|
-
- unless packet.request.__send__(var).empty?
|
13
|
-
%table.req
|
14
|
-
%thead
|
15
|
-
%tr
|
16
|
-
%th Variable
|
17
|
-
%th Value
|
18
|
-
%tbody
|
19
|
-
- packet.request.__send__(var).sort_by { |k, v| k.to_s }.each do |key, val|
|
20
|
-
%tr
|
21
|
-
%td #{key}
|
22
|
-
%td.code
|
23
|
-
%div #{val.inspect}
|
24
|
-
- else
|
25
|
-
%p No #{var.to_s} data.
|
26
|
-
%h3#env-info Rack ENV
|
27
|
-
%table.req
|
28
|
-
%thead
|
29
|
-
%tr
|
30
|
-
%th Variable
|
31
|
-
%th Value
|
32
|
-
%tbody
|
33
|
-
- packet.env.sort_by { |k, v| k.to_s }.each do |key, val|
|
34
|
-
- unless key =~ /^orange\./
|
35
|
-
%tr
|
36
|
-
%td #{h_debug key}
|
37
|
-
%td.code
|
38
|
-
%div #{h_debug val}
|
39
|
-
%h3#orange-info Orange ENV
|
40
|
-
%table.req
|
41
|
-
%thead
|
42
|
-
%tr
|
43
|
-
%th Variable
|
44
|
-
%th Value
|
45
|
-
%tbody
|
46
|
-
- packet.env['orange.env'].sort_by { |k, v| k.to_s }.each do |key, val|
|
47
|
-
- if(![:request, :headers, :content].include?(key))
|
48
|
-
%tr
|
49
|
-
%td #{h_debug key}
|
50
|
-
%td.code
|
51
|
-
%div #{h_debug val}
|
52
|
-
%h3#orange-info= 'Orange<br /> Response'
|
53
|
-
%table.req
|
54
|
-
%thead
|
55
|
-
%tr
|
56
|
-
%th Variable
|
57
|
-
%th Value
|
58
|
-
%tbody
|
59
|
-
- packet.env['orange.env'].sort_by { |k, v| k.to_s }.each do |key, val|
|
60
|
-
- if([:headers, :content].include?(key))
|
61
|
-
%tr
|
62
|
-
%td #{h_debug key}
|
63
|
-
%td.code
|
64
|
-
%div #{h_debug val}
|
65
|
-
%h3#orange-info= 'Orange Core'
|
66
|
-
%table.req
|
67
|
-
%thead
|
68
|
-
%tr
|
69
|
-
%th Variable
|
70
|
-
%th Value
|
71
|
-
%tbody
|
72
|
-
%tr
|
73
|
-
%td Middleware
|
74
|
-
%td.code
|
75
|
-
%div #{h_debug packet.env['orange.core'].middleware}
|
76
|
-
%tr
|
77
|
-
%td Resources
|
78
|
-
%td.code
|
79
|
-
%div #{h_debug packet.env['orange.core'].resources}
|
80
|
-
%tr
|
81
|
-
%td Application
|
82
|
-
%td.code
|
83
|
-
%div #{h_debug packet.env['orange.core'].application}
|
84
|
-
%tr
|
85
|
-
%td Stack
|
86
|
-
%td.code
|
87
|
-
%div #{h_debug packet.env['orange.core'].stack}
|
data/lib/orange-more/disqus.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.join('orange-more', 'disqus', 'plugin')
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
|
2
|
-
|
3
|
-
module Orange::Plugins
|
4
|
-
class Disqus < Base
|
5
|
-
views_dir File.join(File.dirname(__FILE__), 'views')
|
6
|
-
resource Orange::DisqusResource.new
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
Orange.plugin(Orange::Plugins::Disqus.new)
|
11
|
-
|