instedd-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/.gitignore +4 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +4 -0
  4. data/Rakefile +3 -0
  5. data/app/controllers/errors_controller.rb +16 -0
  6. data/app/controllers/instedd_rails/tour_controller.rb +15 -0
  7. data/app/helpers/instedd_rails/application_helper.rb +47 -0
  8. data/app/helpers/instedd_rails/devise_helper.rb +13 -0
  9. data/app/helpers/instedd_rails/instedd_app_helper.rb +42 -0
  10. data/app/helpers/instedd_rails/mailer_helper.rb +177 -0
  11. data/app/views/devise/confirmations/new.html.erb +22 -0
  12. data/app/views/devise/passwords/edit.html.erb +28 -0
  13. data/app/views/devise/passwords/new.html.erb +21 -0
  14. data/app/views/devise/sessions/new.html.erb +33 -0
  15. data/app/views/devise/shared/_links.erb +33 -0
  16. data/app/views/devise/unlocks/new.html.erb +23 -0
  17. data/app/views/errors/internal_server_error.html.erb +9 -0
  18. data/app/views/errors/not_found.html.erb +9 -0
  19. data/app/views/errors/unprocessable_entity.html.erb +9 -0
  20. data/app/views/kaminari/_first_page.html.erb +11 -0
  21. data/app/views/kaminari/_gap.html.erb +8 -0
  22. data/app/views/kaminari/_last_page.html.erb +11 -0
  23. data/app/views/kaminari/_next_page.html.erb +13 -0
  24. data/app/views/kaminari/_page.html.erb +12 -0
  25. data/app/views/kaminari/_paginator.html.erb +23 -0
  26. data/app/views/kaminari/_prev_page.html.erb +13 -0
  27. data/app/views/layouts/application.html.erb +114 -0
  28. data/app/views/layouts/mail.html.erb +18 -0
  29. data/app/views/layouts/mail.text.erb +9 -0
  30. data/app/views/layouts/tour.html.erb +8 -0
  31. data/app/views/shared/_analytics.html.erb +13 -0
  32. data/app/views/tour/_tour_navigation.html.erb +10 -0
  33. data/app/views/user_mailer/confirmation_instructions.html.erb +8 -0
  34. data/app/views/user_mailer/confirmation_instructions.text.erb +5 -0
  35. data/app/views/user_mailer/reset_password_instructions.html.erb +12 -0
  36. data/app/views/user_mailer/reset_password_instructions.text.erb +7 -0
  37. data/config/routes.rb +3 -0
  38. data/instedd-rails.gemspec +22 -0
  39. data/lib/generators/instedd_rails/config_generator.rb +13 -0
  40. data/lib/generators/instedd_rails/templates/instedd_rails_config.rb +5 -0
  41. data/lib/instedd-rails.rb +11 -0
  42. data/lib/instedd_rails/config.rb +27 -0
  43. data/lib/instedd_rails/engine.rb +27 -0
  44. data/lib/instedd_rails/routes.rb +8 -0
  45. data/lib/instedd_rails/show_exceptions.rb +16 -0
  46. data/lib/instedd_rails/version.rb +3 -0
  47. metadata +110 -0
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@instedd-rails --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in instedd-rails.gemspec
4
+ gemspec
@@ -0,0 +1,3 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,16 @@
1
+ class ErrorsController < ApplicationController
2
+ ERRORS = [
3
+ :internal_server_error,
4
+ :not_found,
5
+ :unprocessable_entity
6
+ ].freeze
7
+
8
+ ERRORS.each do |e|
9
+ define_method e do
10
+ respond_to do |format|
11
+ format.html { render e, :status => e }
12
+ format.any { head e }
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ module InsteddRails
2
+ class TourController < ApplicationController
3
+ layout 'tour'
4
+ helper_method :steps
5
+
6
+ def show
7
+ render (params[:page] ||= 'start')
8
+ end
9
+
10
+ def steps
11
+ {}
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,47 @@
1
+ module InsteddRails
2
+ module ApplicationHelper
3
+ def link_button_to(body, url, html_options = {})
4
+ default_options = { :type => 'button', :class => 'white' }
5
+ onclick = "window.location='#{url}';return false;"
6
+
7
+ content_tag(:button, body, default_options.merge(html_options.merge(:onclick => onclick)))
8
+ end
9
+
10
+ def section title, url, name, active_controllers = [name]
11
+ active = active_controllers.any?{|controller| controller_name == controller.to_s }
12
+ raw "<li class=\"#{active ? "active" : ""}\">#{link_to title, url}</li>"
13
+ end
14
+
15
+ def breadcrumb
16
+ raw render_breadcrumbs :builder => BreadcrumbBuilder
17
+ end
18
+
19
+ def sortable(column, title = nil)
20
+ title ||= column.titleize
21
+ page_number = params[:page]
22
+ direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
23
+ (link_to title, :sort => column, :direction => direction, :page => params[:page]) + '<span></span>'.html_safe
24
+ end
25
+
26
+ def css_sort_class_for column
27
+ column == sort_column ? "sort #{css_sort_direction}" : "sort"
28
+ end
29
+
30
+ def css_sort_direction
31
+ sort_direction == "asc" ? "up" : "down"
32
+ end
33
+
34
+ def application_name
35
+ InsteddRails.config.application_name
36
+ end
37
+
38
+ def google_analytics
39
+ InsteddRails.config.google_analytics
40
+ end
41
+
42
+ def version_name
43
+ InsteddRails.config.version_name
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,13 @@
1
+ module DeviseHelper
2
+ def devise_error_messages!(html_options = {})
3
+ return if resource.errors.full_messages.empty?
4
+
5
+ (content_tag :div, :class => "box error_description #{html_options[:class] || 'w60'}" do
6
+ (content_tag :h2, 'The following errors occurred') \
7
+ + \
8
+ (content_tag :ul do
9
+ raw resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
10
+ end)
11
+ end)
12
+ end
13
+ end
@@ -0,0 +1,42 @@
1
+ module InsteddRails
2
+ module InsteddAppHelper
3
+ def flash_message
4
+ res = nil
5
+
6
+ keys = { :notice => 'flash_notice', :error => 'flash_error', :alert => 'flash_error' }
7
+
8
+ keys.each do |key, value|
9
+ if flash[key]
10
+ html_option = { :class => "flash #{value}" }
11
+ html_option[:'data-hide-timeout'] = 3000 if key == :notice
12
+ res = content_tag :div, html_option do
13
+ content_tag :div do
14
+ flash[key]
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ res
21
+ end
22
+
23
+ def errors_for(object, options = {})
24
+ unless object.nil?
25
+ if object.errors.any?
26
+ # TODO change on rails 3.1 to ActiveModel::Naming.param_key(object)
27
+ object_name = options[:as].try(:to_s) || ActiveModel::Naming.singular(object)
28
+
29
+ content_tag :div, :class => "box error_description #{options[:class] || 'w60'}" do
30
+ (content_tag :h2 do
31
+ "#{pluralize(object.errors.count, 'error')} prohibited this #{object_name.humanize} from being saved:"
32
+ end) \
33
+ + \
34
+ (content_tag :ul do
35
+ raw object.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
36
+ end)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,177 @@
1
+ module InsteddRails
2
+ module MailerHelper
3
+
4
+ def application_name
5
+ InsteddRails.config.application_name
6
+ end
7
+
8
+ def advertised_link name, url
9
+ (link url do
10
+ orange_button do
11
+ name
12
+ end
13
+ end) +
14
+ (tag :br) +
15
+ (small_orange_link url do
16
+ url
17
+ end)
18
+ end
19
+
20
+ def body
21
+ content_tag :div, :style => style_for(body_style) do
22
+ yield
23
+ end
24
+ end
25
+
26
+ def content
27
+ content_tag :div, :style => style_for(content_style) do
28
+ yield
29
+ end
30
+ end
31
+
32
+ def header
33
+ content_tag :div, :style => style_for(header_style) do
34
+ yield
35
+ end
36
+ end
37
+
38
+ def footer
39
+ content_tag :div, :style => style_for(footer_style) do
40
+ yield
41
+ end
42
+ end
43
+
44
+ def h1
45
+ content_tag :h1, :style => style_for(h1_style) do
46
+ yield
47
+ end
48
+ end
49
+
50
+ def h2
51
+ content_tag :h2, :style => style_for(h2_style) do
52
+ yield
53
+ end
54
+ end
55
+
56
+ def hr
57
+ tag :hr, :style => style_for(hr_style)
58
+ end
59
+
60
+ def link url
61
+ content_tag :a, :href => url, :style => style_for(a_style) do
62
+ yield
63
+ end
64
+ end
65
+
66
+ def small_orange_link url
67
+ content_tag :a, :href => url, :style => style_for(a_orange_style.merge(small_style)) do
68
+ yield
69
+ end
70
+ end
71
+
72
+ def orange_button
73
+ content_tag :button, :style => style_for(orange_button_style) do
74
+ yield
75
+ end
76
+ end
77
+
78
+ private
79
+
80
+ def style_for styles
81
+ styles.inject(""){|r, (k,v)| r + "#{k}:#{v};"}
82
+ end
83
+
84
+ def body_style
85
+ {
86
+ 'background' => "#ffffff",
87
+ 'font-family' => "Arial, Helvetica, sans-serif",
88
+ 'font-size' => "14px",
89
+ 'color' => "black",
90
+ 'width' => "500px"
91
+ }
92
+ end
93
+
94
+ def header_style
95
+ {
96
+ 'height' => "80px",
97
+ 'margin-bottom' => "20px",
98
+ 'margin-top' => "5px"
99
+ }
100
+ end
101
+
102
+ def content_style
103
+ {
104
+ 'padding-left' => "10px",
105
+ 'padding-bottom' => "15px"
106
+ }
107
+ end
108
+
109
+ def footer_style
110
+ {
111
+ 'color' => "#666666"
112
+ }
113
+ end
114
+
115
+ def h1_style
116
+ {
117
+ 'font-size' => "20px",
118
+ 'font-weight' => "normal"
119
+ }
120
+ end
121
+
122
+ def h2_style
123
+ {
124
+ 'font-size' => "14px",
125
+ 'font-weight' => "normal"
126
+ }
127
+ end
128
+
129
+ def a_style
130
+ {
131
+ 'color' => "black",
132
+ 'text-decoration' => "none"
133
+ }
134
+ end
135
+
136
+ def a_orange_style
137
+ {
138
+ 'color' => "#FF6600",
139
+ 'text-decoration' => "none"
140
+ }
141
+ end
142
+
143
+ def small_style
144
+ {
145
+ 'font-size' => "11px"
146
+ }
147
+ end
148
+
149
+ def hr_style
150
+ {
151
+ 'border' => "0",
152
+ 'height' => "1px",
153
+ 'color' => "#dddddd",
154
+ 'background' => "#dddddd",
155
+ 'position' => "relative",
156
+ 'margin' => "3px 0px"
157
+ }
158
+ end
159
+
160
+ def orange_button_style
161
+ {
162
+ 'text-shadow' => "0px -1px 0px #fe3700",
163
+ 'padding' => "5px 8px",
164
+ 'border' => "1px solid #fe3700",
165
+ 'box-shadow' => "0 1px 2px 1px rgba(0, 0, 0, 0.2)",
166
+ 'border-radius' => "4px",
167
+ 'background-color' => "#FE7F1D",
168
+ 'color' => "white",
169
+ 'cursor' => "pointer",
170
+ 'height' => "30px",
171
+ 'margin' => "4px 2px",
172
+ 'display' => "inline-block",
173
+ 'position' => "relative"
174
+ }
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,22 @@
1
+ <%= devise_error_messages! :class => 'centered w30' %>
2
+
3
+ <div class="box centered w30">
4
+
5
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
6
+ <h2>Resend confirmation instructions</h2>
7
+
8
+ <div class="field w30">
9
+ <%= f.label :email %>
10
+ <%= f.email_field :email %>
11
+ </div>
12
+
13
+ <div class="actions">
14
+ <button type="submit" class="white">Resend confirmation instructions</button>
15
+ </div>
16
+
17
+ <% end %>
18
+
19
+ <%= render :partial => "devise/shared/links" %>
20
+
21
+ </div>
22
+
@@ -0,0 +1,28 @@
1
+ <%= devise_error_messages! :class => 'centered w30' %>
2
+
3
+ <div class="box centered w30">
4
+
5
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
6
+ <h2>Change your password</h2>
7
+
8
+ <hr class="shadow"/>
9
+
10
+ <%= f.hidden_field :reset_password_token %>
11
+
12
+ <div class="field w30">
13
+ <%= f.label :password, "New password" %>
14
+ <%= f.password_field :password %>
15
+ </div>
16
+
17
+ <div class="field w30">
18
+ <%= f.label :password_confirmation, "Confirm new password" %>
19
+ <%= f.password_field :password_confirmation %>
20
+ </div>
21
+
22
+ <div class="actions">
23
+ <button type="submit" class="white">Change my password</button>
24
+ </div>
25
+
26
+ <% end %>
27
+
28
+ </div>
@@ -0,0 +1,21 @@
1
+ <%= devise_error_messages! :class => 'centered w30' %>
2
+
3
+ <div class="box centered w30">
4
+
5
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
6
+ <h2>Forgot your password?</h2>
7
+
8
+ <hr class="shadow"/>
9
+
10
+ <div class="field w30">
11
+ <%= f.label :email %>
12
+ <%= f.email_field :email %>
13
+ </div>
14
+
15
+ <div class="actions">
16
+ <button type="submit" class="white">Send me reset password instructions</button>
17
+ </div>
18
+
19
+ <% end %>
20
+
21
+ </div>
@@ -0,0 +1,33 @@
1
+ <%= devise_error_messages! :class => 'centered w30' %>
2
+
3
+ <div class="box centered w30">
4
+
5
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
6
+ <h2>Log In</h2>
7
+
8
+ <hr class="shadow" />
9
+
10
+ <div class="field w30">
11
+ <%= f.label :email %>
12
+ <%= f.email_field :email %>
13
+ </div>
14
+
15
+ <div class="field w30">
16
+ <%= f.label :password %>
17
+ <%= f.password_field :password %>
18
+ </div>
19
+
20
+ <% if devise_mapping.rememberable? -%>
21
+ <div class="field">
22
+ <%= f.check_box :remember_me %> <%= f.label :remember_me, :class=>'checkbox' %>
23
+ </div>
24
+ <% end -%>
25
+
26
+ <div class="actions">
27
+ <button type="submit" class="white">Log In</button>
28
+ </div>
29
+
30
+ <%= render :partial => "devise/shared/links" %>
31
+ <% end %>
32
+
33
+ </div>
@@ -0,0 +1,33 @@
1
+ <hr/>
2
+
3
+ <!-- <%- if controller_name != 'sessions' %>
4
+ <p>
5
+ Already have an account? <%= link_to "Log In", new_session_path(resource_name) %>
6
+ </p>
7
+ <% end -%> -->
8
+
9
+ <!-- <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
10
+ <p>
11
+ Don't have an account? <%= link_to "Create it", new_registration_path(resource_name) %>
12
+ </p>
13
+ <% end -%> -->
14
+
15
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
16
+ <p>
17
+ Forgot your password? <%= link_to "Reset it", new_password_path(resource_name) %>
18
+ </p>
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
22
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
23
+ <% end -%>
24
+
25
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
26
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
27
+ <% end -%>
28
+
29
+ <%- if devise_mapping.omniauthable? %>
30
+ <%- resource_class.omniauth_providers.each do |provider| %>
31
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
32
+ <% end -%>
33
+ <% end -%>
@@ -0,0 +1,23 @@
1
+ <%= devise_error_messages! :class => 'centered w30' %>
2
+
3
+ <div class="box centered w30">
4
+ <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
5
+
6
+ <h2>Resend unlock instructions</h2>
7
+
8
+ <hr class="shadow" />
9
+
10
+ <div class="field w30">
11
+ <%= f.label :email %>
12
+ <%= f.email_field :email %>
13
+ </div>
14
+
15
+ <div class="actions">
16
+ <button type="submit" class="white">Resend unlock instructions</button>
17
+ </div>
18
+
19
+ <% end %>
20
+
21
+ <%= render :partial => "devise/shared/links" %>
22
+
23
+ </div>
@@ -0,0 +1,9 @@
1
+ <div class ="box centered w50">
2
+ <h1>
3
+ <div class="i48grad-error"></div>
4
+ We're sorry, but something went wrong
5
+ </h1>
6
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
7
+ <hr/>
8
+ <%= link_to 'Back', :back, :class =>"button white" %>
9
+ </div>
@@ -0,0 +1,9 @@
1
+ <div class ="box centered w50">
2
+ <h1>
3
+ <div class="i48grad-error"></div>
4
+ The page you were looking for doesn't exist
5
+ </h1>
6
+ <p>You may have mistyped the address or the page may have moved.</p>
7
+ <hr/>
8
+ <%= link_to 'Back', :back, :class =>"button white" %>
9
+ </div>
@@ -0,0 +1,9 @@
1
+ <div class ="box centered w50">
2
+ <h1>
3
+ <div class="i48grad-error"></div>
4
+ The change you wanted was rejected
5
+ </h1>
6
+ <p>Maybe you tried to change something you didn't have access to.</p>
7
+ <hr/>
8
+ <%= link_to 'Back', :back, :class =>"button white" %>
9
+ </div>
@@ -0,0 +1,11 @@
1
+ <%# Link to the "First" page
2
+ - available local variables
3
+ url: url to the first page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <span class="first">
10
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
11
+ </span>
@@ -0,0 +1,8 @@
1
+ <%# Non-link tag that stands for skipped pages...
2
+ - available local variables
3
+ current_page: a page object for the currently displayed page
4
+ num_pages: total number of pages
5
+ per_page: number of items to fetch per page
6
+ remote: data-remote
7
+ -%>
8
+ <span class="page gap"><%= raw('...') %></span>
@@ -0,0 +1,11 @@
1
+ <%# Link to the "Last" page
2
+ - available local variables
3
+ url: url to the last page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <span class="last">
10
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
11
+ </span>
@@ -0,0 +1,13 @@
1
+ <%# Link to the "Next" page
2
+ - available local variables
3
+ url: url to the next page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <span class="button next <%= 'disabled' if current_page.last? %>">
10
+ <%= link_to_unless(current_page.last?, raw('<span></span>'), url, :rel => 'next', :remote => remote) do %>
11
+ <%= link_to raw(tag(:span)), '#' %>
12
+ <% end %>
13
+ </span>
@@ -0,0 +1,12 @@
1
+ <%# Link showing page number
2
+ - available local variables
3
+ page: a page object for "this" page
4
+ url: url to this page
5
+ current_page: a page object for the currently displayed page
6
+ num_pages: total number of pages
7
+ per_page: number of items to fetch per page
8
+ remote: data-remote
9
+ -%>
10
+ <span class="page<%= ' current' if page.current? %>">
11
+ <%= link_to_unless page.current?, page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
12
+ </span>
@@ -0,0 +1,23 @@
1
+ <%# The container tag
2
+ - available local variables
3
+ current_page: a page object for the currently displayed page
4
+ num_pages: total number of pages
5
+ per_page: number of items to fetch per page
6
+ remote: data-remote
7
+ paginator: the paginator that renders the pagination tags inside
8
+ -%>
9
+ <%= paginator.render do -%>
10
+ <div class="pagination-container">
11
+ <div class="pagination">
12
+ <%= prev_page_tag %>
13
+ <% each_page do |page| -%>
14
+ <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
15
+ <%= page_tag page %>
16
+ <% elsif !page.was_truncated? -%>
17
+ <%= gap_tag %>
18
+ <% end -%>
19
+ <% end -%>
20
+ <%= next_page_tag %>
21
+ </div>
22
+ </div>
23
+ <% end -%>
@@ -0,0 +1,13 @@
1
+ <%# Link to the "Previous" page
2
+ - available local variables
3
+ url: url to the previous page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <span class="button prev <%= 'disabled' if current_page.first? %>">
10
+ <%= link_to_unless(current_page.first?, raw('<span></span>'), url, :rel => 'prev', :remote => remote) do %>
11
+ <%= link_to raw(tag(:span)), '#' %>
12
+ <% end %>
13
+ </span>
@@ -0,0 +1,114 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= application_name.titleize %></title>
5
+ <%= stylesheet_link_tag 'http://theme.instedd.org/theme/stylesheets/theme.css' %>
6
+ <%= stylesheet_link_tag "/stylesheets/#{application_name.underscore}.css" %>
7
+
8
+ <%= javascript_include_tag :defaults, "rails.validations" %>
9
+ <%= javascript_include_tag 'http://theme.instedd.org/theme/javascripts/theme.js' %>
10
+ <%= csrf_meta_tag %>
11
+ <%= yield(:head) %>
12
+ <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
13
+ <%= render :partial =>"shared/analytics" %>
14
+ </head>
15
+ <body class="<%=(@body_class || []).join(' ')%>">
16
+ <%= flash_message %>
17
+ <div id="wrapper">
18
+ <div id="toolbar">
19
+ <ul id="instedd-pulldown"></ul>
20
+ <div id="NavMenu">
21
+ <ul>
22
+ <%= section 'Home', root_path, :home %>
23
+ <%= section 'Reminders', schedules_path, :schedules, [:schedules, :subscribers, :logs] unless current_user.nil? %>
24
+ <%= section 'Tour', tour_path(:start), :tour %>
25
+ <%= section 'Community', community_path, :community %>
26
+ <%= section 'Help', help_path , :help %>
27
+ </ul>
28
+ </div>
29
+
30
+ <ul class="RightMenu">
31
+ <%- if !current_user.nil? %>
32
+ <li>
33
+ <div id="User">
34
+ <%=current_user.email%><br><br>
35
+ <div class="container">
36
+ <ul>
37
+ <li><%= link_to 'Reminders', schedules_path %></li>
38
+ <li><%= link_to 'Settings', edit_user_registration_path %></li>
39
+ </ul>
40
+ <hr/>
41
+ <ul>
42
+ <li><a href="mailto:support@instedd.org?subject=[<%= application_name.underscore %>-bug]">Report a bug</a></li>
43
+ <li><%= link_to "Sign Out", destroy_user_session_path %></li>
44
+ </ul>
45
+ </div>
46
+ </div>
47
+ </li>
48
+ <li>
49
+ <%= link_to '', edit_user_registration_path, :class => 'fsettings' %>
50
+ </li>
51
+ <% else %>
52
+ <li>
53
+ <%= link_to "Create account", new_user_registration_path, :class => 'fedit' %>
54
+ </li>
55
+ <li>
56
+ <%= link_to "Log in", new_user_session_path, :class => 'fuser' %>
57
+ </li>
58
+ <% end %>
59
+ </ul>
60
+ </div>
61
+
62
+ <div id="header">
63
+ <div class="left">
64
+ <a href="/"><%= image_tag "http://theme.instedd.org/theme/images/header/logos/#{application_name.underscore}.png" %></a>
65
+ </div>
66
+ <% if @show_breadcrum %>
67
+ <div class="BreadCrumb">
68
+ <%= breadcrumb %>
69
+ </div>
70
+ <% end %>
71
+ <div class="clear"></div>
72
+ </div>
73
+
74
+ <div id="container">
75
+
76
+ <%= yield(:content).presence or yield %>
77
+
78
+ </div>
79
+
80
+ <div id="footer-span">
81
+ <div id="footer">
82
+ <div id="footer-container">
83
+ <div>
84
+ <div class="left platform">
85
+ InSTEDD has created an evolving platform of free and open source technologies to support humanitarian causes. These tools can be used individually or as building blocks for larger solutions. <a href="http://instedd.org/technologies/">Click here</a> to learn more
86
+ </div>
87
+ <div class="right">
88
+ <a href="http://instedd.org/technologies/" class="more">Learn more</a>
89
+ <div id="instedd-footer" data-app-name="remindem"></div>
90
+ </div>
91
+ <div class="clear"></div>
92
+ </div>
93
+ <div>
94
+ <div class="left">
95
+ <a href="http://instedd.org">&copy; 2011 InSTEDD</a>
96
+ <a href="#TODO">Terms and conditions</a>
97
+ <a href="mailto:support@instedd.org?subject=[<%= application_name.titleize %>]">Contact us</a>
98
+ </div>
99
+ <div class="right">
100
+ <a href="<%= root_path %>">Home</a>
101
+ <a href="<%= tour_path(:start) %>">Tour</a>
102
+ <a href="<%= community_path %>">Community</a>
103
+ <a href="<%= help_path %>">Help</a>
104
+ <span class="VersionNumber">Version <%= version_name %></span>
105
+ </div>
106
+ <div class="clear">
107
+ </div>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </body>
114
+ </html>
@@ -0,0 +1,18 @@
1
+ <%= body do %>
2
+ <%= header do %>
3
+ <img src="http://theme.instedd.org/theme/images/header/logos/<%= application_name.underscore %>.png"/>
4
+ <img src="http://theme.instedd.org/theme/images/header/shadow_small.png"/>
5
+ <% end %>
6
+ <%= content do %>
7
+ <%= yield %>
8
+ <% end %>
9
+ <%= footer do %>
10
+ <hr/>
11
+ <p>
12
+ Do you have questions or need help? Contact us at
13
+ <%= link "mailto:support@instedd.org?subject=#{application_name.titleize}" do %>
14
+ support@instedd.org
15
+ <% end %>
16
+ </p>
17
+ <% end %>
18
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= application_name.titleize %>
2
+ --------
3
+
4
+
5
+ <%= yield %>
6
+
7
+
8
+ ---------
9
+ Do you have questions or need help? Contact us at support@instedd.org
@@ -0,0 +1,8 @@
1
+ <% content_for :content do %>
2
+ <%= render :partial => 'tour/tour_navigation', :selected => params[:page] %>
3
+ <div class="TourContent left">
4
+ <%= yield %>
5
+ </div>
6
+ <div class="clear"></div>
7
+ <% end %>
8
+ <%= render :file => 'layouts/application' %>
@@ -0,0 +1,13 @@
1
+ <script type="text/javascript">
2
+
3
+ var _gaq = _gaq || [];
4
+ _gaq.push(['_setAccount', '<%= google_analytics %>']);
5
+ _gaq.push(['_trackPageview']);
6
+
7
+ (function() {
8
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
9
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
10
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
11
+ })();
12
+
13
+ </script>
@@ -0,0 +1,10 @@
1
+ <ul class="TourNavigation left">
2
+ <% steps.each do |name, description| %>
3
+ <li class="<%= name %> <%= 'selected' if params[:page] == name.to_s %>">
4
+ <a href="<%= tour_path(name) %>">
5
+ <h2><%= name.to_s.titleize %></h2>
6
+ <p><%= description %></p>
7
+ </a>
8
+ </li>
9
+ <% end %>
10
+ </ul>
@@ -0,0 +1,8 @@
1
+ <%= h1 do %>
2
+ You are almost done!
3
+ <% end %>
4
+ <%= h2 do %>
5
+ To verify your account and complete the registration process please click in the link below or copy paste the URL into your browser
6
+ <% end %>
7
+ <br/>
8
+ <%= advertised_link 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
@@ -0,0 +1,5 @@
1
+ You are almost done!
2
+
3
+ To verify your account and complete the registration process please click in the link below or copy paste the URL into your browser
4
+
5
+ <%= confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
@@ -0,0 +1,12 @@
1
+ <%= h1 do %>
2
+ Hello <%= @resource.email %>!
3
+ <% end %>
4
+ <%= h2 do %>
5
+ Someone has requested a link to change your password, and you can do this through the link below.
6
+ <% end %>
7
+ <br/>
8
+ <%= advertised_link 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
9
+ <br/>
10
+ <%= h2 do %>
11
+ If you didn't request this, please ignore this email. Your password won't change until you access the link above and create a new one.
12
+ <% end %>
@@ -0,0 +1,7 @@
1
+ Hello <%= @resource.email %>!
2
+
3
+ Someone has requested a link to change your password, and you can do this through the link below.
4
+
5
+ <%= edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
6
+
7
+ If you didn't request this, please ignore this email. Your password won't change until you access the link above and create a new one.
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ # get 'tour(/:page)', :action => :show, :controller => :tour, :as => 'tour'
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "instedd_rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "instedd-rails"
7
+ s.version = InsteddRails::VERSION
8
+ s.authors = ["Instedd"]
9
+ s.email = ["support@instedd.org"]
10
+ s.homepage = "http://bitbucket.org/instedd/platform-common-rails"
11
+ s.summary = %q{Instedd Platform Common helpers for Rails}
12
+ s.description = %q{This gem unifies all the helpers and common views used by all Instedd applications}
13
+
14
+ s.rubyforge_project = "instedd-rails"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency("rails", ">= 3.0")
22
+ end
@@ -0,0 +1,13 @@
1
+ module InsteddRails
2
+ module Generators
3
+ class ConfigGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
5
+
6
+ desc "Copy configuration files to your application."
7
+
8
+ def copy_initializer
9
+ template "instedd_rails_config.rb", "config/initializers/instedd_rails_config.rb"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ InsteddRails.configure do |config|
2
+ # config.application_name = ::Rails.application.class.parent_name
3
+ # google_analytics = ::Rails.application.class.config.google_analytics
4
+ # self.version_name = ::Rails.application.class.config.version_name
5
+ end
@@ -0,0 +1,11 @@
1
+ require "instedd_rails/version"
2
+ require "instedd_rails/engine"
3
+ require "instedd_rails/config"
4
+ require "instedd_rails/show_exceptions"
5
+ require "instedd_rails/routes"
6
+ # require "devise_helper"
7
+ # require "mailer_helper"
8
+
9
+ module InsteddRails
10
+
11
+ end
@@ -0,0 +1,27 @@
1
+ require 'active_support/configurable'
2
+
3
+ module InsteddRails
4
+ def self.configure(&block)
5
+ yield self.config
6
+ end
7
+
8
+ # Global settings for Instedd Rails
9
+ def self.config
10
+ @config ||= InsteddRails::Configuration.new
11
+ end
12
+
13
+ # need a Class for 3.0
14
+ class Configuration
15
+ include ActiveSupport::Configurable
16
+ config_accessor :application_name
17
+ config_accessor :google_analytics
18
+ config_accessor :version_name
19
+
20
+ def initialize
21
+ self.application_name = ::Rails.application.class.parent_name
22
+ self.google_analytics = ::Rails.application.class.config.google_analytics
23
+ self.version_name = ::Rails.application.class.config.version_name
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path("../../../app/helpers/instedd_rails/application_helper", __FILE__)
2
+ require File.expand_path("../../../app/helpers/instedd_rails/instedd_app_helper", __FILE__)
3
+ require File.expand_path("../../../app/helpers/instedd_rails/mailer_helper", __FILE__)
4
+ require File.expand_path("../../../app/helpers/instedd_rails/devise_helper", __FILE__)
5
+
6
+ module InsteddRails
7
+ class Engine < ::Rails::Engine
8
+
9
+ initializer "change view paths order to prepend devise views" do |app|
10
+
11
+ application_view_path = ActionController::Base.view_paths.to_a.first
12
+ instedd_rails_view_path = ActionController::Base.view_paths.detect do |path|
13
+ path.to_s.include? "instedd-rails"
14
+ end
15
+
16
+ ActionController::Base.prepend_view_path instedd_rails_view_path
17
+ ActionController::Base.prepend_view_path application_view_path
18
+ ActionController::Base.view_paths= ActionController::Base.view_paths.uniq.freeze
19
+ end
20
+
21
+ config.to_prepare do
22
+ ApplicationController.helper(InsteddRails::ApplicationHelper)
23
+ ApplicationController.helper(InsteddRails::InsteddAppHelper)
24
+ ApplicationController.helper(InsteddRails::MailerHelper)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ module ActionDispatch::Routing
2
+ class Mapper
3
+
4
+ def with_tour
5
+ get 'tour(/:page)', :action => :show, :controller => :tour, :as => 'tour'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ require 'action_dispatch/middleware/show_exceptions'
2
+
3
+ module ActionDispatch
4
+ class ShowExceptions
5
+ private
6
+ def render_exception_with_template(env, exception)
7
+ body = ErrorsController.action(rescue_responses[exception.class.name]).call(env)
8
+ log_error(exception)
9
+ body
10
+ rescue
11
+ render_exception_without_template(env, exception)
12
+ end
13
+
14
+ alias_method_chain :render_exception, :template
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module InsteddRails
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: instedd-rails
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Instedd
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-11-15 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "3.0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: This gem unifies all the helpers and common views used by all Instedd applications
27
+ email:
28
+ - support@instedd.org
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - .gitignore
37
+ - .rvmrc
38
+ - Gemfile
39
+ - Rakefile
40
+ - app/controllers/errors_controller.rb
41
+ - app/controllers/instedd_rails/tour_controller.rb
42
+ - app/helpers/instedd_rails/application_helper.rb
43
+ - app/helpers/instedd_rails/devise_helper.rb
44
+ - app/helpers/instedd_rails/instedd_app_helper.rb
45
+ - app/helpers/instedd_rails/mailer_helper.rb
46
+ - app/views/devise/confirmations/new.html.erb
47
+ - app/views/devise/passwords/edit.html.erb
48
+ - app/views/devise/passwords/new.html.erb
49
+ - app/views/devise/sessions/new.html.erb
50
+ - app/views/devise/shared/_links.erb
51
+ - app/views/devise/unlocks/new.html.erb
52
+ - app/views/errors/internal_server_error.html.erb
53
+ - app/views/errors/not_found.html.erb
54
+ - app/views/errors/unprocessable_entity.html.erb
55
+ - app/views/kaminari/_first_page.html.erb
56
+ - app/views/kaminari/_gap.html.erb
57
+ - app/views/kaminari/_last_page.html.erb
58
+ - app/views/kaminari/_next_page.html.erb
59
+ - app/views/kaminari/_page.html.erb
60
+ - app/views/kaminari/_paginator.html.erb
61
+ - app/views/kaminari/_prev_page.html.erb
62
+ - app/views/layouts/application.html.erb
63
+ - app/views/layouts/mail.html.erb
64
+ - app/views/layouts/mail.text.erb
65
+ - app/views/layouts/tour.html.erb
66
+ - app/views/shared/_analytics.html.erb
67
+ - app/views/tour/_tour_navigation.html.erb
68
+ - app/views/user_mailer/confirmation_instructions.html.erb
69
+ - app/views/user_mailer/confirmation_instructions.text.erb
70
+ - app/views/user_mailer/reset_password_instructions.html.erb
71
+ - app/views/user_mailer/reset_password_instructions.text.erb
72
+ - config/routes.rb
73
+ - instedd-rails.gemspec
74
+ - lib/generators/instedd_rails/config_generator.rb
75
+ - lib/generators/instedd_rails/templates/instedd_rails_config.rb
76
+ - lib/instedd-rails.rb
77
+ - lib/instedd_rails/config.rb
78
+ - lib/instedd_rails/engine.rb
79
+ - lib/instedd_rails/routes.rb
80
+ - lib/instedd_rails/show_exceptions.rb
81
+ - lib/instedd_rails/version.rb
82
+ homepage: http://bitbucket.org/instedd/platform-common-rails
83
+ licenses: []
84
+
85
+ post_install_message:
86
+ rdoc_options: []
87
+
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ requirements: []
103
+
104
+ rubyforge_project: instedd-rails
105
+ rubygems_version: 1.8.10
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: Instedd Platform Common helpers for Rails
109
+ test_files: []
110
+