open_porch 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/Gemfile +41 -0
  2. data/Gemfile.lock +130 -0
  3. data/README.md +170 -0
  4. data/Rakefile +19 -0
  5. data/VERSION +1 -0
  6. data/app/controllers/admin/areas/base_controller.rb +11 -0
  7. data/app/controllers/admin/areas/issues_controller.rb +67 -0
  8. data/app/controllers/admin/areas/memberships_controller.rb +7 -0
  9. data/app/controllers/admin/areas/posts_controller.rb +44 -0
  10. data/app/controllers/admin/areas_controller.rb +89 -0
  11. data/app/controllers/admin/base_controller.rb +16 -0
  12. data/app/controllers/admin/user_activity_controller.rb +29 -0
  13. data/app/controllers/admin/users_controller.rb +57 -0
  14. data/app/controllers/application_controller.rb +15 -0
  15. data/app/controllers/areas/base_controller.rb +25 -0
  16. data/app/controllers/areas/issues_controller.rb +35 -0
  17. data/app/controllers/areas/posts_controller.rb +28 -0
  18. data/app/controllers/areas_controller.rb +30 -0
  19. data/app/controllers/passwords_controller.rb +42 -0
  20. data/app/controllers/registrations_controller.rb +42 -0
  21. data/app/controllers/sessions_controller.rb +33 -0
  22. data/app/controllers/users_controller.rb +77 -0
  23. data/app/helpers/open_porch_helper.rb +24 -0
  24. data/app/mailers/user_mailer.rb +35 -0
  25. data/app/models/address.rb +57 -0
  26. data/app/models/area.rb +171 -0
  27. data/app/models/area_activity.rb +24 -0
  28. data/app/models/email_message.rb +104 -0
  29. data/app/models/issue.rb +66 -0
  30. data/app/models/issue_number.rb +22 -0
  31. data/app/models/membership.rb +27 -0
  32. data/app/models/post.rb +64 -0
  33. data/app/models/session_user.rb +69 -0
  34. data/app/models/user.rb +140 -0
  35. data/app/models/user_activity.rb +31 -0
  36. data/app/models/user_authority_check.rb +14 -0
  37. data/app/views/admin/areas/_form.html.haml +8 -0
  38. data/app/views/admin/areas/_nav.html.haml +12 -0
  39. data/app/views/admin/areas/edit.html.haml +22 -0
  40. data/app/views/admin/areas/edit_borders.html.haml +44 -0
  41. data/app/views/admin/areas/index.html.haml +61 -0
  42. data/app/views/admin/areas/issues/_post.html.haml +15 -0
  43. data/app/views/admin/areas/issues/add_posts.js.rjs +3 -0
  44. data/app/views/admin/areas/issues/edit.html.haml +37 -0
  45. data/app/views/admin/areas/issues/index.html.haml +31 -0
  46. data/app/views/admin/areas/issues/remove_posts.js.rjs +3 -0
  47. data/app/views/admin/areas/issues/show.html.haml +13 -0
  48. data/app/views/admin/areas/memberships/index.html.haml +17 -0
  49. data/app/views/admin/areas/new.html.haml +6 -0
  50. data/app/views/admin/areas/new.js.haml +4 -0
  51. data/app/views/admin/areas/posts/_edit.html.haml +6 -0
  52. data/app/views/admin/areas/posts/_post_status.html.haml +1 -0
  53. data/app/views/admin/areas/posts/destroy.js.rjs +1 -0
  54. data/app/views/admin/areas/posts/edit.js.rjs +1 -0
  55. data/app/views/admin/areas/posts/show.js.rjs +1 -0
  56. data/app/views/admin/areas/posts/toggle_reviewed_by.js.rjs +1 -0
  57. data/app/views/admin/areas/posts/update.js.rjs +5 -0
  58. data/app/views/admin/areas/show.html.haml +5 -0
  59. data/app/views/admin/user_activity/show.html.haml +5 -0
  60. data/app/views/admin/users/_form.html.haml +21 -0
  61. data/app/views/admin/users/edit.html.haml +5 -0
  62. data/app/views/admin/users/index.html.haml +31 -0
  63. data/app/views/admin/users/new.html.haml +5 -0
  64. data/app/views/areas/issues/index.html.haml +31 -0
  65. data/app/views/areas/issues/show.html.haml +22 -0
  66. data/app/views/areas/posts/_post.html.haml +8 -0
  67. data/app/views/areas/posts/_posts_search_form.html.haml +8 -0
  68. data/app/views/areas/posts/index.html.haml +27 -0
  69. data/app/views/areas/posts/new.html.haml +10 -0
  70. data/app/views/areas/show.html.haml +47 -0
  71. data/app/views/layouts/_account_nav.html.haml +18 -0
  72. data/app/views/layouts/_flash_message.html.haml +4 -0
  73. data/app/views/layouts/_footer.html.haml +9 -0
  74. data/app/views/layouts/_head.html.haml +16 -0
  75. data/app/views/layouts/admin/_nav.html.haml +13 -0
  76. data/app/views/layouts/admin.html.haml +15 -0
  77. data/app/views/layouts/application.html.haml +14 -0
  78. data/app/views/layouts/area_editor.html.haml +11 -0
  79. data/app/views/passwords/edit.html.haml +9 -0
  80. data/app/views/passwords/new.html.haml +13 -0
  81. data/app/views/registrations/_address_form.html.haml +7 -0
  82. data/app/views/registrations/create.html.haml +49 -0
  83. data/app/views/registrations/index.html.haml +30 -0
  84. data/app/views/registrations/new.html.haml +17 -0
  85. data/app/views/sessions/new.html.haml +18 -0
  86. data/app/views/stylesheets/common.sass +239 -0
  87. data/app/views/stylesheets/content.sass +193 -0
  88. data/app/views/stylesheets/reset.sass +46 -0
  89. data/app/views/stylesheets/structure.sass +11 -0
  90. data/app/views/stylesheets/typography.sass +57 -0
  91. data/app/views/user_mailer/email_verification.html.erb +5 -0
  92. data/app/views/user_mailer/email_verification.text.erb +7 -0
  93. data/app/views/user_mailer/new_issue.html.erb +32 -0
  94. data/app/views/user_mailer/new_issue.text.erb +26 -0
  95. data/app/views/user_mailer/password_reset.html.erb +7 -0
  96. data/app/views/user_mailer/password_reset.text.erb +6 -0
  97. data/app/views/users/_form.html.haml +5 -0
  98. data/app/views/users/edit.html.haml +11 -0
  99. data/app/views/users/new.html.haml +41 -0
  100. data/app/views/users/show.html.haml +30 -0
  101. data/bin/open_porch_engine +135 -0
  102. data/config/application.rb +43 -0
  103. data/config/boot.rb +13 -0
  104. data/config/database_example.yml +59 -0
  105. data/config/environment.rb +5 -0
  106. data/config/environments/development.rb +26 -0
  107. data/config/environments/production.rb +49 -0
  108. data/config/environments/test.rb +35 -0
  109. data/config/initializers/backtrace_silencers.rb +7 -0
  110. data/config/initializers/email_regex.rb +38 -0
  111. data/config/initializers/geokit_config.rb +61 -0
  112. data/config/initializers/inflections.rb +20 -0
  113. data/config/initializers/meta_search.rb +7 -0
  114. data/config/initializers/mime_types.rb +5 -0
  115. data/config/initializers/open_porch.rb +41 -0
  116. data/config/initializers/sass.rb +1 -0
  117. data/config/initializers/secret_token.rb +7 -0
  118. data/config/initializers/session_store.rb +8 -0
  119. data/config/initializers/states_provinces.rb +2 -0
  120. data/config/initializers/will_paginate.rb +2 -0
  121. data/config/locales/en.yml +5 -0
  122. data/config/open_porch_example.yml +23 -0
  123. data/config/routes.rb +54 -0
  124. data/config/schedule.rb +9 -0
  125. data/config.ru +4 -0
  126. data/db/migrate/01_create_areas.rb +21 -0
  127. data/db/migrate/02_create_users.rb +28 -0
  128. data/db/migrate/03_create_memberships.rb +14 -0
  129. data/db/migrate/04_create_posts.rb +20 -0
  130. data/db/migrate/05_create_issue_numbers.rb +13 -0
  131. data/db/migrate/06_create_issues.rb +21 -0
  132. data/db/migrate/20110204173301_add_published_to_areas.rb +10 -0
  133. data/db/migrate/20110204194840_create_user_activities.rb +13 -0
  134. data/db/migrate/20110208163604_add_zip_to_areas.rb +11 -0
  135. data/db/migrate/20110209175723_add_counters_to_areas.rb +11 -0
  136. data/db/migrate/20110209182244_remove_subject_from_issues.rb +9 -0
  137. data/db/migrate/20110209190146_add_reviewer_info_to_posts.rb +9 -0
  138. data/db/migrate/20110215173144_add_email_validation_key_to_users.rb +13 -0
  139. data/db/migrate/20110215182716_remove_published_from_areas.rb +10 -0
  140. data/db/migrate/20110215211012_create_area_activities.rb +19 -0
  141. data/db/migrate/20110215213802_create_email_messages.rb +19 -0
  142. data/db/migrate/20110217165018_change_send_mode_to_string.rb +17 -0
  143. data/db/migrate/20110223160609_denormalize_user_info_in_posts.rb +19 -0
  144. data/db/seeds.rb +7 -0
  145. data/doc/README_FOR_APP +2 -0
  146. data/lib/generators/open_porch_generator.rb +37 -0
  147. data/lib/open_porch/engine.rb +20 -0
  148. data/lib/open_porch.rb +3 -0
  149. data/lib/tasks/.gitkeep +0 -0
  150. data/lib/tasks/open_porch.rake +10 -0
  151. data/lib/tasks/postageapp_tasks.rake +78 -0
  152. data/open_porch.gemspec +335 -0
  153. data/public/404.html +26 -0
  154. data/public/422.html +26 -0
  155. data/public/500.html +26 -0
  156. data/public/favicon.ico +0 -0
  157. data/public/images/icons/ajax-loader.gif +0 -0
  158. data/public/images/icons/calendar.png +0 -0
  159. data/public/images/icons/post_new.png +0 -0
  160. data/public/images/icons/post_reviewed.png +0 -0
  161. data/public/javascripts/application.js +3 -0
  162. data/public/javascripts/google_maps.js +153 -0
  163. data/public/javascripts/highcharts.js +162 -0
  164. data/public/javascripts/highcharts_init.js +30 -0
  165. data/public/javascripts/issue_edit.js +57 -0
  166. data/public/javascripts/jquery-ui.min.js +191 -0
  167. data/public/javascripts/jquery.js +154 -0
  168. data/public/javascripts/rails.js +137 -0
  169. data/public/javascripts/region_editor.js +616 -0
  170. data/public/javascripts/user_activity.js +29 -0
  171. data/public/robots.txt +5 -0
  172. data/public/stylesheets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  173. data/public/stylesheets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  174. data/public/stylesheets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  175. data/public/stylesheets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  176. data/public/stylesheets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  177. data/public/stylesheets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  178. data/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  179. data/public/stylesheets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  180. data/public/stylesheets/images/ui-icons_222222_256x240.png +0 -0
  181. data/public/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
  182. data/public/stylesheets/images/ui-icons_454545_256x240.png +0 -0
  183. data/public/stylesheets/images/ui-icons_888888_256x240.png +0 -0
  184. data/public/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
  185. data/public/stylesheets/jquery-ui.css +362 -0
  186. data/script/rails +6 -0
  187. data/test/dummy/area.rb +5 -0
  188. data/test/dummy/area_activity.rb +7 -0
  189. data/test/dummy/issue.rb +4 -0
  190. data/test/dummy/membership.rb +4 -0
  191. data/test/dummy/post.rb +12 -0
  192. data/test/dummy/user.rb +29 -0
  193. data/test/dummy/user_activity.rb +11 -0
  194. data/test/functional/admin/areas/issues_controller_test.rb +48 -0
  195. data/test/functional/admin/areas/memberships_controller_test.rb +45 -0
  196. data/test/functional/admin/areas/posts_controller_test.rb +54 -0
  197. data/test/functional/admin/areas_controller_test.rb +134 -0
  198. data/test/functional/admin/base_controller_test.rb +8 -0
  199. data/test/functional/admin/user_activity_controller_test.rb +28 -0
  200. data/test/functional/admin/users_controller_test.rb +144 -0
  201. data/test/functional/areas/issues_controller_test.rb +33 -0
  202. data/test/functional/areas/posts_controller_test.rb +50 -0
  203. data/test/functional/areas_controller_test.rb +12 -0
  204. data/test/functional/passwords_controller_test.rb +64 -0
  205. data/test/functional/registrations_controller_test.rb +64 -0
  206. data/test/functional/sessions_controller_test.rb +120 -0
  207. data/test/functional/users_controller_test.rb +144 -0
  208. data/test/performance/browsing_test.rb +9 -0
  209. data/test/test_helper.rb +92 -0
  210. data/test/unit/address_test.rb +25 -0
  211. data/test/unit/area_activity_test.rb +57 -0
  212. data/test/unit/area_test.rb +92 -0
  213. data/test/unit/email_message_test.rb +8 -0
  214. data/test/unit/issue_number_test.rb +25 -0
  215. data/test/unit/issue_test.rb +154 -0
  216. data/test/unit/membership_test.rb +20 -0
  217. data/test/unit/post_test.rb +69 -0
  218. data/test/unit/session_user_test.rb +65 -0
  219. data/test/unit/user_activity_test.rb +31 -0
  220. data/test/unit/user_mailer_test.rb +20 -0
  221. data/test/unit/user_test.rb +61 -0
  222. data/vendor/plugins/.gitkeep +0 -0
  223. metadata +456 -0
@@ -0,0 +1,15 @@
1
+ .post[post]
2
+ .select= check_box_tag 'posts[]', post.id, false, {:id => nil}
3
+ .content{:id => dom_id(post, :content)}
4
+ %h6= link_to post.title, ''
5
+ .meta
6
+ Posted by
7
+ = mail_to(post.user_email, post.user_full_name)
8
+ = time_ago_in_words(post.created_at)
9
+ ago.
10
+ .text{:style => 'display: none'}
11
+ = simple_format post.content
12
+ = link_to 'edit', edit_admin_area_post_path(@area, post), :class => 'ajax-button', :remote => true
13
+ .status
14
+ = link_to '', toggle_reviewed_by_admin_area_post_path(@area, post), :id => dom_id(post, :status), :remote => true, :method => :post, :class => (post.reviewed? ? 'reviewed ajax-button' : 'unreviewed ajax-button')
15
+ = link_to 'delete', admin_area_post_path(@area, post), :method => :delete, :confirm => 'Area you sure you want to delete this post?', :remote => true
@@ -0,0 +1,3 @@
1
+ if params[:posts].present?
2
+ page << "move_posts_to(#{params[:posts].to_json}, '#issue_posts')"
3
+ end
@@ -0,0 +1,37 @@
1
+ = content_for (:head) do
2
+ = javascript_include_tag 'user_activity'
3
+ = javascript_include_tag 'issue_edit'
4
+
5
+ = update_user_activity_for_url(request.url)
6
+
7
+ .columns.half
8
+ = render :partial => 'admin/areas/nav'
9
+ = show_user_activity_for_url(request.url)
10
+ %h2 Editing Issue ##{@issue.number}
11
+ .left_column
12
+ .posts#new_posts
13
+ .header
14
+ .select= check_box_tag "select_all", nil, false, { :id => nil }
15
+ .text New Messages
16
+ = render :partial => 'post', :collection => @new_posts
17
+ = submit_tag 'Add', :id => 'add_posts', :class => 'move_posts', :style => @new_posts.size.zero?? 'display:none' : nil
18
+
19
+ .right_column
20
+ .posts#issue_posts.sortable
21
+ .header
22
+ .select= check_box_tag 'select_all', nil, false, { :id => nil }
23
+ .text Prepared Messages
24
+ = render :partial => 'post', :collection => @issue_posts
25
+ = submit_tag 'Remove', :id => 'remove_posts', :class => 'move_posts', :style => @issue_posts.size.zero?? 'display:none' : nil
26
+
27
+ .columns.half
28
+ .left_column
29
+ .right_column
30
+ - if @issue.scheduled_at.present?
31
+ %label Currently Scheduled for: #{@issue.scheduled_at.to_s(:long)}
32
+
33
+
34
+ %h3 Publishing
35
+ = formatted_form_for @issue, :url => admin_area_issue_path(@area) do |f|
36
+ = f.datetime_select :scheduled_at, :label => 'Publish at'
37
+ = f.submit 'Publish'
@@ -0,0 +1,31 @@
1
+ .columns
2
+ = render :partial => 'admin/areas/nav'
3
+
4
+ %h2 Issues
5
+
6
+ = will_paginate @issues
7
+
8
+
9
+ - if @issues.empty?
10
+ %p This area has no issues yet.
11
+ - else
12
+ %table
13
+ %tr
14
+ %th Number
15
+ %th Scheduled At
16
+ %th Sent at
17
+ - @issues.each do |issue|
18
+ %tr
19
+ %td= link_to "Issue ##{issue.number}", edit_admin_area_issue_path(@area, issue)
20
+ %td
21
+ - if issue.scheduled_at.present?
22
+ = issue.scheduled_at.to_s(:long)
23
+ - else
24
+ N/A
25
+ %td
26
+ - if issue.sent_at.present?
27
+ = issue.sent_at.to_s(:long)
28
+ - else
29
+ N/A
30
+
31
+ = will_paginate @issues
@@ -0,0 +1,3 @@
1
+ if params[:posts].present?
2
+ page << "move_posts_to(#{params[:posts].to_json}, '#new_posts')"
3
+ end
@@ -0,0 +1,13 @@
1
+ .columns
2
+ = render :partial => 'admin/areas/nav'
3
+
4
+ %h2 Issue ##{@issue.number} - #{@issue.sent_at.to_date.to_s(:long)}
5
+ %ul.list
6
+ - @issue.posts.order(:position).each do |post|
7
+ %li
8
+ %h4= post.title
9
+ %p.meta
10
+ By <strong>#{post.user_full_name}</strong>, #{post.user_address}
11
+ %br/
12
+ #{post.created_at.to_date.to_s(:long)}
13
+ = simple_format post.content
@@ -0,0 +1,17 @@
1
+ .columns
2
+ = render :partial => 'admin/areas/nav'
3
+
4
+ %h2 Members
5
+
6
+ - if @memberships.empty?
7
+ %p This area has no members yet.
8
+ - else
9
+ %table
10
+ %tr
11
+ %th Name
12
+ %th Email
13
+
14
+ - @memberships.each do |membership|
15
+ %tr
16
+ %td=link_to membership.user.full_name, edit_admin_user_path(membership.user, :area_id => @area.id)
17
+ %td= membership.user.email
@@ -0,0 +1,6 @@
1
+ .columns
2
+ %h1 Create new area
3
+
4
+ = formatted_form_for @area, :url => [:admin, :areas] do |f|
5
+ = render :partial => 'form', :locals => {:f => f}
6
+
@@ -0,0 +1,4 @@
1
+ %h1 Create new region
2
+
3
+ = formatted_form_for @area, :url => [:admin, :areas] do |f|
4
+ = render :partial => 'form', :locals => {:f => f}
@@ -0,0 +1,6 @@
1
+ = form_for @post, :url => admin_area_post_path(@area, @post), :remote => true do |f|
2
+ = f.text_field :title
3
+ = f.text_area :content
4
+ = f.submit 'Save'
5
+ or
6
+ = link_to('cancel', admin_area_post_path(@area, @post), :remote => true, :class => 'ajax-button')
@@ -0,0 +1 @@
1
+ = link_to '', toggle_reviewed_by_admin_area_post_path(@area, @post), :id => dom_id(@post, :status), :remote => true, :method => :post, :class => (@post.reviewed? ? 'reviewed ajax-button' : 'unreviewed ajax-button')
@@ -0,0 +1 @@
1
+ page << "$('##{dom_id(@post)}').remove()"
@@ -0,0 +1 @@
1
+ page << "$('##{dom_id(@post, :content)}').html('#{escape_javascript(render(:partial => 'edit'))}')"
@@ -0,0 +1 @@
1
+ page << "$('##{dom_id(@post)}').replaceWith('#{escape_javascript(render(:partial => 'admin/areas/issues/post', :object => @post))}')"
@@ -0,0 +1 @@
1
+ page << "$('##{dom_id(@post, :status)}').replaceWith('#{escape_javascript(render(:partial => 'admin/areas/posts/post_status', :object => @post))}');"
@@ -0,0 +1,5 @@
1
+ if @post.valid?
2
+ page << "$('##{dom_id(@post)}').replaceWith('#{escape_javascript(render(:partial => 'admin/areas/issues/post', :object => @post))}')"
3
+ else
4
+ page << "$('##{dom_id(@post, :content)}').html('#{escape_javascript(render(:partial => 'edit'))}')"
5
+ end
@@ -0,0 +1,5 @@
1
+ .columns
2
+ %h2 #{@area.name} Neighbourhood Forum
3
+ %h5
4
+ = link_to 'Users', ''
5
+ = link_to 'Issues', admin_area_issues_path(@area)
@@ -0,0 +1,5 @@
1
+ - unless @user_activities.empty?
2
+ Also on this page:
3
+ - @user_activities.each do |user|
4
+ .user
5
+ = user.name
@@ -0,0 +1,21 @@
1
+ %h3 Contact Information
2
+ = f.text_field :first_name
3
+ = f.text_field :last_name
4
+ = f.text_field :email
5
+ %br
6
+ %h3 Address
7
+ = f.text_field :address
8
+ = f.text_field :city
9
+ = f.select :state, grouped_options_for_select([['Canada', CANADA_PROVINCES], ['United States', US_STATES]], @user.state), :label => 'State/Province', :include_blank => true
10
+ %br
11
+ %h3 Credentials
12
+ = f.password_field :password, :autocomplete => :off, :desc => 'Leave empty unless you want to change the password'
13
+ = f.password_field :password_confirmation
14
+ = f.select :role, User.roles_for_select
15
+ %br
16
+ %h3 Membership
17
+ = f.fields_for :memberships do |membership_form|
18
+ = membership_form.select :area_id, Area.for_select
19
+ %br
20
+
21
+ = f.submit 'Save', :cancel_url => link_to('cancel', @return_url)
@@ -0,0 +1,5 @@
1
+ .columns
2
+ %h1 Edit User
3
+ = formatted_form_for @user, :url => admin_user_path(@user, :area_id => params[:area_id]) do |f|
4
+ = render :partial => 'form', :locals => {:f => f}
5
+
@@ -0,0 +1,31 @@
1
+ .columns
2
+ .header
3
+ %h2 Users
4
+ = formatted_form_for @search, :url => [:admin, :users], :html => {:method => :get, :class => 'admin_search'} do |f|
5
+ = f.text_field :email_or_name_or_address_search, :label => 'Search'
6
+ = f.select :role_equals, User.roles_for_select, :include_blank => 'All Roles', :label => '&nbsp;'
7
+ = f.submit 'Find'
8
+
9
+ %h5= link_to 'Add new user', new_admin_user_path
10
+
11
+ = will_paginate @users
12
+
13
+ %table
14
+ %tr
15
+ %th= sort_link @search, :last_name_and_first_name, 'Name'
16
+ %th Email
17
+ %th= sort_link @search, :role
18
+ %th= sort_link @search, :created_at
19
+ %th
20
+
21
+ - @users.each do |user|
22
+ %tr
23
+ %td= link_to user.full_name, [:edit, :admin, user]
24
+ %td= user.email
25
+ %td= user.role.humanize
26
+ %td= user.created_at.to_date.to_s(:long)
27
+ %td.action_link
28
+ = link_to 'delete', admin_user_path(user), :method => :delete, :confirm => 'Are you sure you want to delete this user?'
29
+
30
+
31
+ = will_paginate @users
@@ -0,0 +1,5 @@
1
+ .columns
2
+ %h1 New User
3
+ = formatted_form_for @user, :url => admin_users_path do |f|
4
+ = render :partial => 'admin/users/form', :locals => {:f => f}
5
+
@@ -0,0 +1,31 @@
1
+ = render :partial => 'layouts/account_nav'
2
+
3
+ .columns
4
+
5
+ .left_column
6
+ %h2 #{@area.name} Forum Archive
7
+
8
+ - if @issues.blank?
9
+ No issues for this month.
10
+ - else
11
+ %ul.list
12
+ - @issues.each do |issue|
13
+ %li
14
+ %h3=link_to "No. #{issue.number} &ndash; #{issue.sent_at.to_date.to_s(:long)}".html_safe, area_issue_path(@area, issue.number)
15
+ - issue.posts.order(:position).each do |post|
16
+ .post
17
+ %h4= post.title
18
+ %p.meta By #{mail_to(post.user_email, post.user_full_name)}, #{post.user_address}
19
+
20
+ .right_column
21
+ .pagination
22
+ - prev_month = @current_month.prev_month
23
+ = link_to "&laquo; #{prev_month.strftime('%b %Y')}".html_safe, archive_area_issues_path(@area, prev_month.year, prev_month.month)
24
+ %span= @current_month.strftime('%b %Y')
25
+ - unless @current_month == Date.today.beginning_of_month
26
+ - next_month = @current_month.next_month
27
+ = link_to "#{next_month.strftime('%b %Y')} &raquo;".html_safe, archive_area_issues_path(@area, next_month.year, next_month.month)
28
+ = render :partial => 'areas/posts/posts_search_form', :locals => {:advanced => true}
29
+
30
+ = show_ad_for(:current_issue, @area)
31
+
@@ -0,0 +1,22 @@
1
+ = render :partial => 'layouts/account_nav'
2
+
3
+ .columns
4
+ .left_column
5
+ %h2
6
+ = @area.name
7
+ Forum Archive
8
+ %h3 No. #{@issue.number} &ndash; #{@issue.sent_at.to_date.to_s(:long)}
9
+
10
+ .pagination
11
+ - if @prev_issue.present?
12
+ = link_to "&laquo; Issue No. #{@prev_issue.number}".html_safe, area_issue_path(@area, @prev_issue)
13
+ - if @next_issue.present?
14
+ = link_to "Issue No. #{@next_issue.number} &raquo;".html_safe, area_issue_path(@area, @next_issue)
15
+
16
+ %ul.list
17
+ = render :partial => 'areas/posts/post', :collection => @issue.posts.order(:position)
18
+
19
+ .right_column
20
+ = render :partial => 'areas/posts/posts_search_form', :locals => {:advanced => true}
21
+
22
+ = show_ad_for(:current_issue, @area)
@@ -0,0 +1,8 @@
1
+ %li
2
+ %a{:name => dom_id(post, :anchor)}
3
+ %h4= post.title
4
+ %p.meta
5
+ By <strong>#{mail_to(post.user_email, post.user_full_name)}</strong>, #{post.user_address}
6
+ %br/
7
+ #{post.created_at.to_date.to_s(:long)}
8
+ = simple_format post.content
@@ -0,0 +1,8 @@
1
+ - advanced ||= false
2
+
3
+ = formatted_form_for @search, :url => [@area, :posts], :html => {:method => :get} do |f|
4
+ = f.text_field :title_or_content_contains, :label => "<h3>Search the archive</h3>"
5
+ - if advanced
6
+ = f.text_field :created_at_greater_than_or_equal_to, :label => 'Between', :type => :date
7
+ = f.text_field :created_at_less_than_or_equal_to, :label => 'And', :type => :date
8
+ = f.submit :search
@@ -0,0 +1,27 @@
1
+ = render :partial => 'layouts/account_nav'
2
+ .columns
3
+ .left_column
4
+ %h2 Search archives
5
+
6
+ - if @posts.size > 0
7
+ = will_paginate @posts
8
+ %ul.list
9
+ - @posts.each do |post|
10
+ %li
11
+ %h4= link_to post.title, area_issue_path(@area, post.issue.number, :anchor => dom_id(post, :anchor))
12
+ %p.meta
13
+ By <strong>#{mail_to(post.user_email, post.user_full_name)}</strong>, #{post.user_address}
14
+ %br/
15
+ #{post.created_at.to_date.to_s(:long)}
16
+ = simple_format(truncate(post.content, :length => 400))
17
+ = will_paginate @posts
18
+
19
+ - else
20
+ %p No posts found
21
+
22
+ .right_column
23
+ = render :partial => 'posts_search_form', :locals => {:advanced => true}
24
+ = show_ad_for(:current_issue, @area)
25
+
26
+
27
+
@@ -0,0 +1,10 @@
1
+ = render :partial => 'layouts/account_nav'
2
+
3
+ .columns
4
+ .left_column
5
+ %h2 Post a message
6
+ %h3 to the #{@area.name} Neighborhood Forum
7
+ = formatted_form_for @post, :url => area_posts_path(@area) do |f|
8
+ = f.text_field :title
9
+ = f.text_area :content
10
+ = f.submit 'Post Message'
@@ -0,0 +1,47 @@
1
+ = render :partial => 'layouts/account_nav'
2
+
3
+ .columns
4
+ .left_column
5
+ %h1= @area.name
6
+ .stats
7
+ %h3 #{@area.city}, #{@area.state} &bull; Forum started <strong>#{@area.created_at.to_date.to_s(:long)}</strong>
8
+ %h3 Neighborhood forum members: <strong>#{@area.memberships.count}</strong>
9
+ %h3 Approx. households within boundary: <strong>#{@area.households}</strong>
10
+ %h3 Messages posted since start-up: <strong>#{@area.issues_count}</strong>
11
+
12
+ - if logged_in?
13
+ %h3 Post Your Message
14
+ %p
15
+ = mail_to(@area.email, 'Using email')
16
+ %br/
17
+ = link_to('Using the web', new_area_post_path(@area))
18
+
19
+ - else
20
+ %h3
21
+ Only registered members can read and participate in
22
+ %br/
23
+ this neighbourhood forum. Are you a member?
24
+
25
+ = formatted_form_for @session_user, :url => login_path do |f|
26
+ = f.text_field :email, :label => 'Email address'
27
+ = f.password_field :password
28
+ = f.check_box :remember_me, :label => 'Remember me when I come back'
29
+ = f.submit 'Log In'
30
+
31
+ .right_column
32
+ = render :partial => 'areas/posts/posts_search_form'
33
+
34
+ - if @area.border.present?
35
+ = content_for :head do
36
+ = javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
37
+ = javascript_include_tag 'google_maps'
38
+
39
+ = content_for :doc_ready do
40
+ initialize_gmap(document.getElementById("map_canvas"), #{@area.center.x}, #{@area.center.y}, {}, #{@area.bounds.to_json});
41
+ add_region(#{@area.id}, [#{@area.border_coordinates}], 'selected')
42
+ #map_canvas{:style => 'width:280px; height:400px'}
43
+ %p
44
+ %em= @area.description
45
+
46
+ = show_ad_for(:current_issue, @area)
47
+
@@ -0,0 +1,18 @@
1
+ - if logged_in?
2
+ - area = @area || current_user.areas.first
3
+ %ul.tabs
4
+ - unless current_user.areas.empty?
5
+ %li{:class => active_class(area_path(area), :when => :self_only ) }
6
+ = link_to 'Your Neighborhood Forum', area_path(area)
7
+ %li{:class => active_class(area_current_issue_path(area), :when => :self_only ) }
8
+ = link_to 'Current Issue', area_current_issue_path(area)
9
+ %li{:class => active_class(area_issues_path(area), :when => /areas\/\d+\/issues|areas\/\d+\/posts\?/ ) }
10
+ = link_to 'Archive', area_issues_path(area)
11
+ %li{:class => active_class(new_area_post_path(area), :when => :self_only ) }
12
+ = link_to 'Post a Message', new_area_post_path(area)
13
+
14
+ %li{:class => active_class(user_path)}
15
+ = link_to 'Your Profile', user_path
16
+ %li.right= link_to 'logout', logout_path
17
+ - if current_user.is_admin?
18
+ %li.right= link_to 'admin', admin_path
@@ -0,0 +1,4 @@
1
+ .flash_wrapper
2
+ - flash.each do |type, message|
3
+ .flash_message{ :class => type.to_s }
4
+ = message
@@ -0,0 +1,9 @@
1
+ .footer
2
+ %p
3
+ Copyright &copy; 2011 Front Porch Forum
4
+ %br/
5
+ Open Porch is released under the
6
+ = link_to 'GNU General Public License, version 3 (GPLv3)', 'http://www.opensource.org/licenses/gpl-3.0', :target => '_blank'
7
+ %br/
8
+ Developed by
9
+ = link_to 'The Working Group','http://twg.ca', :target => '_blank'
@@ -0,0 +1,16 @@
1
+ %title Open Porch
2
+ = stylesheet_link_tag 'reset', 'structure', 'typography', 'common', 'content', 'jquery-ui'
3
+ = javascript_include_tag 'jquery', 'rails', 'jquery-ui.min', 'application'
4
+ = csrf_meta_tag
5
+
6
+ - if (content_for?(:doc_ready))
7
+ :javascript
8
+ $(document).ready(function() {
9
+ #{yield(:doc_ready)}
10
+ });
11
+
12
+ - if (content_for?(:js))
13
+ :javascript
14
+ #{yield(:js)}
15
+
16
+ = yield(:head)
@@ -0,0 +1,13 @@
1
+ %ul.tabs
2
+ - if current_user.has_authority_to?(:manage_users)
3
+ %li{:class => active_class(admin_users_path)}
4
+ = link_to 'Users', admin_users_path
5
+
6
+ - if current_user.has_authority_to?(:manage_areas)
7
+ %li{:class => active_class(admin_areas_path)}
8
+ = link_to 'Areas', admin_areas_path
9
+
10
+ %li.right= link_to 'logout', logout_path
11
+ %li.right= link_to 'Your Profile', user_path
12
+
13
+
@@ -0,0 +1,15 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %meta{"http-equiv" => "Content-Type", "content" => "text/html;charset=utf-8"}/
5
+ = render(:partial => 'layouts/head')
6
+ = javascript_include_tag 'highcharts', 'highcharts_init'
7
+
8
+ %body
9
+ .wrapper{:class => "#{params[:controller]}_#{params[:action]}".idify}
10
+ .main_content
11
+ = render :partial => 'layouts/flash_message'
12
+ = render :partial => 'layouts/admin/nav'
13
+ = yield
14
+
15
+ = render(:partial => 'layouts/footer')
@@ -0,0 +1,14 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %meta{"http-equiv" => "Content-Type", "content" => "text/html;charset=utf-8"}/
5
+ = render(:partial => 'layouts/head')
6
+
7
+ %body
8
+ .wrapper{:class => "#{params[:controller]}_#{params[:action]}".idify}
9
+ .main_content
10
+ - unless params[:controller] == 'registrations'
11
+ = render(:partial => 'layouts/flash_message')
12
+ = yield
13
+
14
+ = render(:partial => 'layouts/footer')
@@ -0,0 +1,11 @@
1
+ !!! 5
2
+ %html{:style => 'height: 100%'}
3
+ %head
4
+ %meta{"http-equiv" => "Content-Type", "content" => "text/html;charset=utf-8"}/
5
+ = render(:partial => 'layouts/head')
6
+
7
+ %body{:style => 'height: 100%'}
8
+ .wrapper{:class => "#{params[:controller]}_#{params[:action]}".idify}
9
+ = yield
10
+
11
+
@@ -0,0 +1,9 @@
1
+ .columns
2
+ .left_column
3
+ %h1 Enter a new Password
4
+
5
+ = formatted_form_for @user, :url => { :action => :update, :id => params[:id] } do |form|
6
+ = form.error_messages
7
+ = form.password_field :password, :autocomplete => :off
8
+ = form.password_field :password_confirmation, :label => 'Password Confim'
9
+ = form.submit 'Update'
@@ -0,0 +1,13 @@
1
+ .columns
2
+ .left_column
3
+ %h1 Reset your password
4
+
5
+ = form_tag passwords_path, :class => 'formatted' do
6
+ .form_element.text_field
7
+ .label
8
+ %label Email
9
+ .value= text_field_tag :email
10
+
11
+ .form_element.submit_element
12
+ = submit_tag 'Send Reset Password Email'
13
+ %p= link_to 'Already have an account?', login_path
@@ -0,0 +1,7 @@
1
+ = render(:partial => 'layouts/flash_message')
2
+
3
+ = formatted_form_for @address, :url => registrations_path do |f|
4
+ = f.text_field :address
5
+ = f.text_field :city
6
+ = f.select :state, grouped_options_for_select([['Canada', CANADA_PROVINCES], ['United States', US_STATES]], @address.state), :label => 'State/Province', :include_blank => true
7
+ = f.submit 'Sign Up'
@@ -0,0 +1,49 @@
1
+ = content_for :head do
2
+ = javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
3
+ = javascript_include_tag 'google_maps'
4
+
5
+
6
+ = content_for :doc_ready do
7
+ initialize_gmap(document.getElementById("map_canvas"), #{@address.lat}, #{@address.lng}, {}, #{@selected_area.bounds.to_json});
8
+ add_marker(#{@address.lat}, #{@address.lng}, '#{@address.full}');
9
+ add_region(#{@selected_area.id}, [#{@selected_area.border_coordinates}], 'selected')
10
+ - @areas.each do |area|
11
+ add_region(#{area.id}, [#{area.border_coordinates}])
12
+
13
+ %ul.tabs
14
+ %li.active 1. Confirm neighborhood
15
+ %li 2. Account details
16
+ %li 3. Sign up complete
17
+
18
+ .columns
19
+ .left_column
20
+ %h2 Confirm your neighborhood
21
+ %h3
22
+ = @address.full
23
+ %br/
24
+ is currently in
25
+ %strong= @selected_area.name
26
+ %ul.list.areas
27
+
28
+ - ([@selected_area]+@areas).each_with_index do |area, i|
29
+ %li{:id => dom_id(area), :class => (area == @selected_area ? 'selected' : '')}
30
+ .name #{i+1}) #{area.name}
31
+ .action
32
+ = link_to 'View info', '#'
33
+ |
34
+ = link_to_function 'Select this one', "select_region(#{area.id})"
35
+
36
+ = form_for @user, :url => new_user_path, :html => {:method => :get} do |f|
37
+ = f.hidden_field :address
38
+ = f.hidden_field :city
39
+ = f.hidden_field :state
40
+ = f.hidden_field :lat
41
+ = f.hidden_field :lng
42
+ = f.fields_for :memberships do |membership|
43
+ = membership.hidden_field :area_id, :id => 'user_area_id'
44
+ = f.submit 'Next step'
45
+ or
46
+ = link_to('Previous', :back)
47
+
48
+ .right_column
49
+ #map_canvas{:style => 'width:260px; height:400px'}
@@ -0,0 +1,30 @@
1
+ .intro
2
+ %h1 <em>Open</em>Porch #{OPEN_PORCH_VERSION}
3
+ %p Updated March 10, 2011
4
+ %h3 <em>Open Porch</em> is a <strong>community-building tool for neighborhoods.</strong> People who are well connected to their neighbors and plugged into local conversation are typically more interested in local news and more civically engaged.
5
+
6
+ %h5= link_to "Download OpenPorch #{OPEN_PORCH_VERSION}", 'https://github.com/FrontPorchForum/open_porch'
7
+ %h5= link_to 'View Documentation', 'https://github.com/FrontPorchForum/open_porch'
8
+
9
+ %p &nbsp;
10
+ %p
11
+ Open Porch was created by 2010
12
+ = link_to 'Knight News Challenge', 'http://www.newschallenge.org'
13
+ winner
14
+ = link_to 'Front Porch Forum', 'http://frontporchforum.com'
15
+ thanks to support from the
16
+ = link_to 'John S. and James L. Knight Foundation', 'http://www.knightfoundation.org'
17
+ \. The software was built by
18
+ = link_to 'The Working Group, Inc', 'http://www.theworkinggroup.ca'
19
+ \.
20
+ %p Open Porch design is based on experienced gained by operating the successful Front Porch Forum pilot project in Burlington, Vermont, USA.
21
+
22
+ .columns
23
+ %h3.join
24
+ %em Join your neighbourhood forum
25
+
26
+ %h2 Demo
27
+ = render :partial => 'address_form'
28
+ %p
29
+ Already have an account?
30
+ = link_to 'Login', login_path