happy_seed 0.0.19 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -69
  3. data/bin/rails +12 -0
  4. data/bin/rspec +16 -0
  5. data/happy_seed.rb +5 -1
  6. data/happy_seed.txt +25 -18
  7. data/lib/generators/happy_seed/admin/admin_generator.rb +40 -5
  8. data/lib/generators/happy_seed/admin/templates/app/admin/campaigns.rb +10 -14
  9. data/lib/generators/happy_seed/admin/templates/app/admin/newsletter.rb +2 -2
  10. data/lib/generators/happy_seed/admin/templates/app/admin/user.rb +4 -1
  11. data/lib/generators/happy_seed/admin/templates/app/controllers/admin/stats_controller.rb +1 -1
  12. data/lib/generators/happy_seed/admin/templates/docs/README.07.admin.rdoc +33 -4
  13. data/lib/generators/happy_seed/angular_view/templates/docs/README.11.angular_view.rdoc +2 -4
  14. data/lib/generators/happy_seed/api/api_generator.rb +38 -39
  15. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/base_controller.rb +4 -5
  16. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/model_hash.rb +3 -20
  17. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/user_tokens_controller.rb +13 -36
  18. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/users_controller.rb +14 -40
  19. data/lib/generators/happy_seed/api/templates/config/initializers/apitome.rb +1 -1
  20. data/lib/generators/happy_seed/api/templates/docs/README.01.api.rdoc +4 -1
  21. data/lib/generators/happy_seed/api/templates/docs/api.md +2 -2
  22. data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/user_tokens_spec.rb +10 -53
  23. data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/users_spec.rb +17 -61
  24. data/lib/generators/happy_seed/base/base_generator.rb +47 -19
  25. data/lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb +1 -1
  26. data/lib/generators/happy_seed/base/templates/app/views/setup/index.html.haml +6 -3
  27. data/lib/generators/happy_seed/base/templates/application_controller.rb +1 -1
  28. data/lib/generators/happy_seed/base/templates/docs/README.00.base.rdoc +3 -3
  29. data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +5 -2
  30. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/application.scss +5 -1
  31. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_profile_panels.scss +62 -0
  32. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_slideup_header.scss +51 -0
  33. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/shared/_grid.scss +0 -12
  34. data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_javascripts.html.haml +7 -4
  35. data/lib/generators/happy_seed/bootstrap/templates/docs/README.01.bootstrap.rdoc +3 -0
  36. data/lib/generators/happy_seed/ckeditor/ckeditor_generator.rb +31 -0
  37. data/lib/generators/happy_seed/ckeditor/templates/docs/README.01.ckeditor.rdoc +35 -0
  38. data/lib/generators/happy_seed/devise/devise_generator.rb +12 -19
  39. data/lib/generators/happy_seed/devise/templates/app/views/devise/confirmations/new.html.haml +17 -0
  40. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.html.erb +14 -0
  41. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.text.rhtml +7 -0
  42. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/password_change.html.erb +3 -0
  43. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.html.erb +15 -0
  44. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.text.erb +11 -0
  45. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  46. data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/edit.html.haml +14 -13
  47. data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/new.html.haml +12 -16
  48. data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/edit.html.haml +28 -40
  49. data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/new.html.haml +16 -24
  50. data/lib/generators/happy_seed/devise/templates/app/views/devise/sessions/new.html.haml +13 -18
  51. data/lib/generators/happy_seed/devise/templates/app/views/devise/shared/_links.html.erb +25 -0
  52. data/lib/generators/happy_seed/devise/templates/app/views/devise/unlocks/new.html.erb +16 -0
  53. data/lib/generators/happy_seed/devise/templates/docs/README.03.devise.rdoc +2 -2
  54. data/lib/generators/happy_seed/devise/templates/spec/factories/users.rb +5 -4
  55. data/lib/generators/happy_seed/devise/templates/spec/features/registration_spec.rb +149 -0
  56. data/lib/generators/happy_seed/devise/templates/spec/mailers/previews/devise_preview.rb +28 -0
  57. data/lib/generators/happy_seed/devise_confirmable/devise_confirmable_generator.rb +45 -0
  58. data/lib/generators/happy_seed/devise_confirmable/templates/add_confirmable_to_devise.rb +24 -0
  59. data/lib/generators/happy_seed/devise_confirmable/templates/app/controllers/confirmations_controller.rb +10 -0
  60. data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/edit.html.haml +22 -0
  61. data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/new.html.haml +20 -0
  62. data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
  63. data/lib/generators/happy_seed/devise_confirmable/templates/docs/README.03.devise_confirmable.rdoc +23 -0
  64. data/lib/generators/happy_seed/devise_invitable/devise_invitable_generator.rb +3 -1
  65. data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/edit.html.haml +3 -2
  66. data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/new.html.haml +3 -2
  67. data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
  68. data/lib/generators/happy_seed/devise_invitable/templates/spec/features/invitations_spec.rb +61 -0
  69. data/lib/generators/happy_seed/facebook/facebook_generator.rb +2 -0
  70. data/lib/generators/happy_seed/facebook/templates/spec/features/facebook_registration_spec.rb +72 -0
  71. data/lib/generators/happy_seed/googleoauth/googleoauth_generator.rb +1 -1
  72. data/lib/generators/happy_seed/happy_seed_generator.rb +1 -3
  73. data/lib/generators/happy_seed/html_email/html_email_generator.rb +32 -0
  74. data/lib/generators/happy_seed/html_email/templates/app/views/layouts/mailer.html.erb +244 -0
  75. data/lib/generators/happy_seed/html_email/templates/docs/README.01.html_email.rdoc +25 -0
  76. data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +4 -2
  77. data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb +3 -13
  78. data/lib/generators/happy_seed/omniauth/templates/app/models/identity.rb +13 -9
  79. data/lib/generators/happy_seed/omniauth/templates/docs/README.04.omniauth.rdoc +5 -5
  80. data/lib/generators/happy_seed/omniauth/templates/spec/factories/oauth.rb +6 -1
  81. data/lib/generators/happy_seed/omniauth/templates/spec/features/oauth_registration_spec.rb +80 -0
  82. data/lib/generators/happy_seed/omniauth/templates/spec/models/identity_spec.rb +39 -12
  83. data/lib/generators/happy_seed/omniauth/templates/{app/models/form_user.rb → user.rb} +4 -5
  84. data/lib/generators/happy_seed/plugin/plugin_generator.rb +13 -11
  85. data/lib/generators/happy_seed/react/react_generator.rb +36 -0
  86. data/lib/generators/happy_seed/react/templates/docs/README.10.react.rdoc +20 -0
  87. data/lib/generators/happy_seed/roles/roles_generator.rb +38 -0
  88. data/lib/generators/happy_seed/roles/templates/ability.rb +9 -0
  89. data/lib/generators/happy_seed/roles/templates/docs/README.03.roles.rdoc +23 -0
  90. data/lib/generators/happy_seed/simple_cms/simple_cms_generator.rb +41 -0
  91. data/lib/generators/happy_seed/simple_cms/templates/app/admin/simple_content.rb +42 -0
  92. data/lib/generators/happy_seed/simple_cms/templates/app/controllers/simple_content_controller.rb +7 -0
  93. data/lib/generators/happy_seed/simple_cms/templates/app/models/simple_content.rb +5 -0
  94. data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/faq.html.haml +13 -0
  95. data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/index.html.haml +79 -0
  96. data/lib/generators/happy_seed/simple_cms/templates/application_helper.rb +18 -0
  97. data/lib/generators/happy_seed/simple_cms/templates/create_simple_contents.rb +14 -0
  98. data/lib/generators/happy_seed/simple_cms/templates/docs/README.04.simple_cms.rdoc +32 -0
  99. data/lib/generators/happy_seed/simple_cms/templates/spec/factories/oauth.rb +10 -0
  100. data/lib/generators/happy_seed/simple_cms/templates/spec/features/oauth_registration_spec.rb +80 -0
  101. data/lib/generators/happy_seed/simple_cms/templates/spec/models/identity_spec.rb +49 -0
  102. data/lib/generators/happy_seed/splash/templates/app/assets/stylesheets/splash.css.scss +119 -84
  103. data/lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb +1 -1
  104. data/lib/generators/happy_seed/splash/templates/app/views/layouts/splash.html.haml +15 -18
  105. data/lib/generators/happy_seed/splash/templates/app/views/splash/index.html.haml +54 -92
  106. data/lib/generators/happy_seed/splash/templates/docs/README.02.splash.rdoc +2 -2
  107. data/lib/generators/happy_seed/splash/templates/spec/controllers/splash_controller_spec.rb +11 -3
  108. data/lib/generators/happy_seed/static/templates/source/stylesheets/application.css.scss +1 -1
  109. data/lib/generators/happy_seed/static_blog/templates/Gemfile.lock +45 -49
  110. data/lib/generators/happy_seed/twitter/templates/spec/features/twitter_oauth_registration_spec.rb +57 -0
  111. data/lib/generators/happy_seed/twitter/twitter_generator.rb +2 -1
  112. data/lib/happy_seed/cli.rb +1 -1
  113. data/lib/happy_seed/engine.rb +12 -0
  114. data/lib/happy_seed/version.rb +1 -1
  115. data/lib/tasks/seed.rake +56 -0
  116. data/{test → spec}/dummy/Rakefile +0 -0
  117. data/spec/dummy/app/assets/config/manifest.js +5 -0
  118. data/{test → spec}/dummy/app/assets/javascripts/application.js +3 -3
  119. data/spec/dummy/app/assets/javascripts/cable.coffee +11 -0
  120. data/{test → spec}/dummy/app/assets/stylesheets/application.css +4 -4
  121. data/spec/dummy/app/channels/application_cable/channel.rb +5 -0
  122. data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
  123. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  124. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  125. data/spec/dummy/app/jobs/application_job.rb +2 -0
  126. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  127. data/spec/dummy/app/models/application_record.rb +3 -0
  128. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  129. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  130. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  131. data/{test → spec}/dummy/bin/bundle +0 -0
  132. data/{test → spec}/dummy/bin/rails +1 -1
  133. data/{test → spec}/dummy/bin/rake +0 -0
  134. data/spec/dummy/bin/setup +34 -0
  135. data/spec/dummy/bin/update +29 -0
  136. data/spec/dummy/config.ru +8 -0
  137. data/spec/dummy/config/application.rb +21 -0
  138. data/{test → spec}/dummy/config/boot.rb +0 -0
  139. data/spec/dummy/config/cable.yml +10 -0
  140. data/{test → spec}/dummy/config/database.yml +0 -0
  141. data/{test → spec}/dummy/config/environment.rb +0 -0
  142. data/{test → spec}/dummy/config/environments/development.rb +28 -3
  143. data/{test → spec}/dummy/config/environments/production.rb +29 -24
  144. data/{test → spec}/dummy/config/environments/test.rb +6 -3
  145. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
  146. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  147. data/{test → spec}/dummy/config/initializers/assets.rb +3 -0
  148. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  149. data/spec/dummy/config/initializers/callback_terminator.rb +6 -0
  150. data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +3 -1
  151. data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  152. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  153. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  154. data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
  155. data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
  156. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  157. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +2 -2
  158. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  159. data/spec/dummy/config/puma.rb +47 -0
  160. data/spec/dummy/config/routes.rb +3 -0
  161. data/{test → spec}/dummy/config/secrets.yml +3 -3
  162. data/spec/dummy/db/schema.rb +16 -0
  163. data/{test → spec}/dummy/public/404.html +0 -0
  164. data/{test → spec}/dummy/public/422.html +0 -0
  165. data/{test → spec}/dummy/public/500.html +0 -0
  166. data/{test/dummy/public/favicon.ico → spec/dummy/public/apple-touch-icon-precomposed.png} +0 -0
  167. data/spec/dummy/public/apple-touch-icon.png +0 -0
  168. data/spec/dummy/public/favicon.ico +0 -0
  169. data/spec/rails_helper.rb +58 -0
  170. data/spec/spec_helper.rb +91 -0
  171. metadata +195 -89
  172. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/configurations_controller.rb +0 -11
  173. data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/configurations_spec.rb +0 -21
  174. data/lib/generators/happy_seed/base/templates/config/puma.rb +0 -15
  175. data/lib/generators/happy_seed/base/templates/spec/support/controller_helpers.rb +0 -12
  176. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/sections/_profile_page.scss +0 -9
  177. data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/_form.html.haml +0 -5
  178. data/lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb +0 -54
  179. data/lib/generators/happy_seed/devise/templates/test/mailers/previews/devise_preview.rb +0 -13
  180. data/lib/generators/happy_seed/omniauth/templates/spec/features/registration_spec.rb +0 -81
  181. data/lib/generators/happy_seed/static/templates/Gemfile.lock +0 -158
  182. data/lib/tasks/seed_tasks.rake +0 -4
  183. data/test/dummy/README.rdoc +0 -28
  184. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  185. data/test/dummy/config.ru +0 -4
  186. data/test/dummy/config/application.rb +0 -23
  187. data/test/dummy/config/initializers/jazz_hands.rb +0 -5
  188. data/test/dummy/config/routes.rb +0 -56
  189. data/test/seed_test.rb +0 -7
  190. data/test/test_helper.rb +0 -15
@@ -0,0 +1,23 @@
1
+ HappySeed Roles Install
2
+ ===================
3
+
4
+ ### What does this do?
5
+
6
+ The `happy_seed:roles` generator
7
+
8
+ * Installs cancancan
9
+ * Created an enum on the User model ( :user and :admin )
10
+ * Creates a basic `abilities.rb` file
11
+ * Adds a generic `access_denied` method on `application_controller`
12
+
13
+ ### Why do you want this?
14
+
15
+ This is a basic framework for role-based permissions. The admin generator will optionally use this if you don't install a seperate AdminUser class.
16
+
17
+ ### Environment Variables
18
+
19
+ na
20
+
21
+ ### What needs to be done?
22
+
23
+ Define roles in the enum on the user model and abilities inside of the `abilities.rb` class per the directions in the cancan documentation [here.](https://github.com/ryanb/cancan/wiki/Defining-Abilities)
@@ -0,0 +1,41 @@
1
+ require 'generators/happy_seed/admin/admin_generator'
2
+ require 'generators/happy_seed/splash/splash_generator'
3
+
4
+ module HappySeed
5
+ module Generators
6
+ class SimpleCmsGenerator < HappySeedGenerator
7
+ include Rails::Generators::Migration
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ def self.fingerprint
11
+ File.exists? 'app/models/simple_content.rb'
12
+ end
13
+
14
+ def install_simple_cms
15
+ return if already_installed
16
+
17
+ require_generator AdminGenerator
18
+ require_generator SplashGenerator
19
+
20
+ migration_template("create_simple_contents.rb", "db/migrate/create_simple_contents.rb" )
21
+
22
+ begin
23
+ inject_into_file "app/helpers/application_helper.rb", File.read( find_in_source_paths( "application_helper.rb" ) ), before: /\nend/
24
+ rescue
25
+ say_status :application_helper, "Unable to add helper to app/helpers/application_helper.rb", :red
26
+ end
27
+
28
+ route "get '/faq' => 'simple_content#faq'"
29
+
30
+ remove_file 'app/views/splash/index.html.haml'
31
+ directory "app"
32
+ directory "docs"
33
+ end
34
+
35
+ private
36
+ def self.next_migration_number(dir)
37
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,42 @@
1
+ ActiveAdmin.register SimpleContent do
2
+ menu priority: 3, label: "Content"
3
+ permit_params :key, :title, :body, :priority
4
+
5
+ index do
6
+ selectable_column
7
+ column :key do |content|
8
+ link_to content.key, edit_admin_simple_content_path(content)
9
+ end
10
+ column :title do |content|
11
+ link_to content.title, edit_admin_simple_content_path(content)
12
+ end
13
+ column :body
14
+ column :priority
15
+ end
16
+
17
+ sidebar :faqs, priority: 0 do
18
+ ul do
19
+ SimpleContent.faqs.each do |content|
20
+ li( link_to( content.title, edit_admin_simple_content_path( content )))
21
+ end
22
+ end
23
+
24
+ p "Keys that start with 'faq.' are part of the faq, ordered by priority"
25
+ end
26
+
27
+ action_item :see_faq do
28
+ link_to "View Faq", faq_path
29
+ end
30
+
31
+ form do |f|
32
+ f.semantic_errors # shows errors on :base
33
+ f.inputs do
34
+ f.input :key
35
+ f.input :title
36
+ f.input :body, as: :ckeditor, input_html: { ckeditor: { height: 400 } } # builds an input field for every attribute
37
+ f.input :priority
38
+ end
39
+ f.actions # adds the 'Submit' and 'Cancel' buttons
40
+ end
41
+ end
42
+
@@ -0,0 +1,7 @@
1
+ class SimpleContentController < ApplicationController
2
+ def faq
3
+ @faqs = SimpleContent.faqs
4
+
5
+ render "splash/faq"
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class SimpleContent < ApplicationRecord
2
+ def self.faqs
3
+ where( "key like 'faq.%'").order( "priority asc")
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ .container
2
+ .row
3
+ .col-sm-10.col-sm-offset-1
4
+
5
+ %h1 FAQ
6
+
7
+ - @faqs.each do |faq|
8
+ .faq
9
+ .title
10
+ %a{ data: { toggle: "collapse" }, href: "##{faq.key.gsub( ".", "_")}" }
11
+ = faq.title
12
+ .icon
13
+ .content.collapse.in{ id: faq.key.gsub( ".", "_") }= faq.body.html_safe
@@ -0,0 +1,79 @@
1
+ %section.lightimage
2
+ .container
3
+ .row
4
+ .inner-column
5
+ %h1
6
+ - show_content :splash_title do
7
+ Big Fat Title
8
+
9
+ %p.info
10
+ - show_content :splash_description do
11
+ Great descriptive content
12
+
13
+ = link_to "Call to Action", root_url, class: "btn btn-primary btn-lg"
14
+
15
+ %section.colored.primary#about
16
+ .container
17
+ .row
18
+ .inner-column
19
+ %h2
20
+ - show_content :splash_question do
21
+ Question I'm about to answer?
22
+
23
+ - show_content :splash_answer do
24
+ %p Why yes, this is the answer. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit. And it goes on for a bit.
25
+
26
+ = link_to "Another call to action", root_url, class: "btn btn-primary-inverted btn-lg"
27
+
28
+ %section.features#features
29
+ .container
30
+ .row
31
+ .inner-block
32
+ = image_tag "https://s3.amazonaws.com/assets.happyfuncorp.com/splash-assets/pic1.jpg", class: "img-responsive"
33
+ - show_content :splash_feature_1 do
34
+ %h4 SPROUTS
35
+
36
+ %p It was a humorously perilous business for both of us. For, before we proceed further, it must be said that the monkey-rope was fast at both ends; fast to Queequeg's broad canvas belt, and fast to my narrow leather one.
37
+
38
+ .inner-block
39
+ = image_tag "https://s3.amazonaws.com/assets.happyfuncorp.com/splash-assets/pic2.jpg", class: "img-responsive"
40
+ - show_content :splash_feature_2 do
41
+ %h4 COUNTER CULTURE
42
+ %p It was a humorously perilous business for both of us. For, before we proceed further, it must be said that the monkey-rope was fast at both ends; fast to Queequeg's broad canvas belt, and fast to my narrow leather one.
43
+
44
+ .inner-block
45
+ = image_tag "https://s3.amazonaws.com/assets.happyfuncorp.com/splash-assets/pic3.jpg", class: "img-responsive"
46
+ - show_content :splash_feature_3 do
47
+ %h4 BIKE SANDWICH
48
+ %p It was a humorously perilous business for both of us. For, before we proceed further, it must be said that the monkey-rope was fast at both ends; fast to Queequeg's broad canvas belt, and fast to my narrow leather one.
49
+
50
+ .inner-block
51
+ = image_tag "https://s3.amazonaws.com/assets.happyfuncorp.com/splash-assets/pic2.jpg", class: "img-responsive"
52
+ - show_content :splash_feature_4 do
53
+ %h4 COUNTER CULTURE
54
+ %p It was a humorously perilous business for both of us. For, before we proceed further, it must be said that the monkey-rope was fast at both ends; fast to Queequeg's broad canvas belt, and fast to my narrow leather one.
55
+
56
+ %section.images
57
+ .quarter-block
58
+ = image_tag "https://scontent-lga3-1.cdninstagram.com/t51.2885-15/e35/12237401_1672681199644836_991083135_n.jpg"
59
+
60
+ .quarter-block
61
+ = image_tag "https://scontent-lga3-1.cdninstagram.com/t51.2885-15/e35/12716797_1679687052302598_977732638_n.jpg"
62
+ .quarter-block
63
+ = image_tag "https://scontent-lga3-1.cdninstagram.com/t51.2885-15/e35/12107643_1510048632656460_2102141939_n.jpg"
64
+ .quarter-block
65
+ = image_tag "https://scontent-lga3-1.cdninstagram.com/t51.2885-15/e35/12237446_1702630963356665_284108057_n.jpg"
66
+
67
+
68
+ %section.contact#contact
69
+ .container
70
+ .row
71
+ .inner-column
72
+ %h1 Stay connected for announcements and releases.
73
+ = form_tag splash_signup_path, role: :form, remote: true do
74
+ .form-group
75
+ .input-group
76
+ = text_field_tag :signup_email, "", class: "form-control", placeholder: 'E-Mail', type: "email"
77
+ %span.input-group-btn
78
+ = submit_tag 'Sign up', class: 'btn btn-primary'
79
+ %small#signup-message
@@ -0,0 +1,18 @@
1
+
2
+
3
+ def show_content( key, title = nil, &block )
4
+ content = SimpleContent.where( key: key ).first
5
+
6
+ if @debug_content
7
+ content = nil
8
+ end
9
+
10
+ if content.nil?
11
+ pos = output_buffer.length
12
+ yield
13
+ fragment = output_buffer.slice( pos..-1 )
14
+ content = SimpleContent.create( key: key, body: fragment, title: title )
15
+ else
16
+ safe_concat content.body
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ class CreateSimpleContents < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :simple_contents do |t|
4
+ t.string :key
5
+ t.string :title
6
+ t.text :body
7
+ t.integer :priority
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :simple_contents, :key
13
+ end
14
+ end
@@ -0,0 +1,32 @@
1
+ HappySeed SimpleCms Install
2
+ =====================
3
+
4
+ ### What does this do?
5
+
6
+ The `happy_seed:simple_cms` generator depends upon `happy_seed:splash` and `happy_seed:admin` and installs a basic cms by creating a SimpleContent model and a helper method called `show_content` you can use in your views.
7
+
8
+ ### Why do you want this?
9
+
10
+ It creates a very simple CMS that allows you to change content easily. It makes it especially easy for sites where content changes often. This allows you to easily put in the base content and allow users to update at their liesure so you can focus on building and not tweaking copy.
11
+
12
+ ### Environment Variables
13
+
14
+ None needed. However, see below on how to use the `@debug_content` instance variable with the `show_content` method.
15
+
16
+ ### What needs to be done?
17
+
18
+ In addition to creating the active admin interface for modifying content and the SimpleContent model, the main helper it creates is the `show_content` method that you can use in your haml views as follows:
19
+
20
+ ```
21
+ -show_content :my_content_title do
22
+ %p This is my example content...
23
+ ```
24
+
25
+ This allows you to create an editable block anywhere in your views that you can update via the cms.
26
+
27
+ What this does is check to see if `SimpleContent.where(key: :my_content_title).first` exists. If it does, it will load that content, if not it will create that content in the database under that key and insert it in your view.
28
+
29
+ This way you don't have to worry about adding things through active_admin to populate base content, you just define it in your view and when that view gets compiled the first time, it will be saved to the database for future editing.
30
+
31
+ You can set the `@debug_content` variable to true at the top of your view when you are testing locally so that you can make sure things are saving correctly and will continue to save more than just the first time.
32
+
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+ factory :oauth_user, :class => 'User' do
3
+ before(:create) do |user, evaluator|
4
+ user.oauth_callback = true
5
+ end
6
+ if User.devise_modules.include? :confirmable
7
+ confirmed_at Time.now
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,80 @@
1
+ require 'rails_helper'
2
+
3
+ feature "OAuthRegistrations", :type => :feature do
4
+ include Warden::Test::Helpers
5
+
6
+ after{ Warden.test_reset! }
7
+
8
+ it "should require you to be logged in" do
9
+ visit edit_user_registration_path
10
+
11
+ expect( page.body ).to include( "You need to sign in or sign up before continuing." )
12
+ end
13
+
14
+ describe "oauth users" do
15
+ it "should let you change add an email address without a password the don't have a password" do
16
+ login_as create( :oauth_user ), scope: :user
17
+
18
+ visit edit_user_registration_path
19
+
20
+ expect( page.body ).to_not include( "You need to sign in or sign up before continuing." )
21
+
22
+ within "#edit_user" do
23
+ fill_in "user[email]", with: "email@example.com"
24
+ end
25
+
26
+ click_button "Update"
27
+
28
+ expect( page.body ).to include( "Your account has been updated successfully")
29
+ end
30
+
31
+ it "should let you set your password initially" do
32
+ login_as create( :oauth_user ), scope: :user
33
+
34
+ visit edit_user_registration_path
35
+
36
+ within "#edit_user" do
37
+ fill_in "user[email]", with: "email@example.com"
38
+ fill_in "user[password]", with: "password"
39
+ fill_in "user[password_confirmation]", with: "password"
40
+ end
41
+
42
+ click_button "Update"
43
+
44
+ expect( page.body ).to include( "Your account has been updated successfully")
45
+
46
+ logout
47
+
48
+ visit edit_user_registration_path
49
+
50
+ expect( page.body ).to include( "You need to sign in or sign up before continuing." )
51
+
52
+ within "#new_user" do
53
+ fill_in "user[email]", with: "email@example.com"
54
+ fill_in "user[password]", with: "password"
55
+ end
56
+
57
+ click_button "Log in"
58
+
59
+ expect( page.body ).to include( "Signed in successfully." )
60
+ end
61
+ end
62
+
63
+ describe "users with passwords" do
64
+ it "should require your current password if you have one set" do
65
+ login_as create( :user ), scope: :user
66
+
67
+ visit edit_user_registration_path
68
+
69
+ expect( page.body ).to_not include( "You need to sign in or sign up before continuing." )
70
+
71
+ within "#edit_user" do
72
+ fill_in "user[email]", with: "email@example.com"
73
+ end
74
+
75
+ click_button "Update"
76
+
77
+ expect( page.body ).to_not include( "Your account has been updated successfully")
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,49 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Identity, :type => :model do
4
+ describe "validations" do
5
+ before( :each ) do
6
+ @user = build :user
7
+ end
8
+
9
+ it "should always have a provider and uid" do
10
+ i = Identity.create user: @user
11
+ expect( i ).to_not be_valid
12
+
13
+ i = Identity.create user: @user, provider: "test"
14
+ expect( i ).to_not be_valid
15
+
16
+ i = Identity.create user: @user, provider: "test", uid: "1"
17
+
18
+ expect( i ).to be_valid
19
+ end
20
+
21
+ it "should have a unique uid per provider" do
22
+ i = Identity.create user: @user, provider: "test", uid: "1"
23
+ expect( i ).to be_valid
24
+
25
+ i = Identity.create user: @user, provider: "other test", uid: "1"
26
+ expect( i ).to be_valid
27
+
28
+ i = Identity.create user: @user, provider: "test", uid: "1"
29
+ expect( i ).to_not be_valid
30
+ end
31
+ end
32
+
33
+ describe "construction" do
34
+ it "should create an identity from a hash" do
35
+ data = OmniAuth::AuthHash.new({
36
+ :provider => 'twitter',
37
+ :uid => '123545'
38
+ })
39
+
40
+ i = Identity.find_for_oauth data
41
+
42
+ expect( i ).to be_valid
43
+
44
+ i2 = Identity.find_for_oauth data
45
+
46
+ expect( i.id ).to eq(i2.id)
47
+ end
48
+ end
49
+ end
@@ -1,106 +1,141 @@
1
- //-----------------------------------------
2
- // Variables, customize bootstrap here
3
- //-----------------------------------------
4
- @import url(https://fonts.googleapis.com/css?family=Roboto:100,300);
5
-
6
- $red: #CD6363;
7
- $font-family-sans-serif: "Roboto";
8
- $headings-font-weight: 100;
9
- $font-size-base: 14px;
10
- $font-size-h2: floor(($font-size-base * 2.5));
11
-
12
- $navbar-height: 75px;
13
- $navbar-default-bg: rgba(255,255,255, 0.9);
14
- $navbar-default-link-active-bg: rgb(255,255,255);
15
- $navbar-default-toggle-border-color: rgb(255,255,255);
16
- $navbar-default-toggle-icon-bar-bg: #000;
17
- $navbar-default-toggle-hover-bg: rgb(255,255,255);
18
- $navbar-default-link-active-color: $red;
19
-
20
- $jumbotron-bg: rgb(255,255,255);
21
- $border-color: #CCC;
22
-
23
- $carousel-indicator-background: rgba(255, 0, 0, 0.2);
24
- $carousel-indicator-border: 1px solid black;
25
-
26
- $input-bg: rgba(255,0,0,0.1);
27
- $input-border: rgb(0,0,0);
28
- $form-submit-hover: rgba(0,0,0,0.1);
29
- $submit-button-color: rgb(0,0,0);
30
- $submit-border-color: rgb(0,0,0);
31
- $submit-button-background: transparent;
32
- // Color Palate
1
+ @import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);
2
+ // @import url(https://fonts.googleapis.com/css?family=Roboto:100,300);
3
+ $font-family-sans-serif: "Lato";
4
+ $headings-font-weight: 300;
5
+
6
+ $brand-primary: darken(#428bca, 6.5%);
7
+
8
+ $navbar-default-bg: white;
9
+ $navbar-default-border: white;
10
+ $navbar-default-link-color: black;
11
+
12
+ $navbar-default-link-hover-bg: lighten( $brand-primary, 50% );
13
+ $navbar-default-link-active-bg: lighten( $brand-primary, 30% );
14
+
15
+ $body-bg: white;
16
+
17
+ $slideup-navbar-height: 150px;
18
+
19
+ $border-radius-base: 2px;
20
+ $border-radius-large: 2px;
33
21
 
34
22
  @import 'bootstrap-sprockets';
35
23
  @import 'bootstrap';
36
24
 
37
- body {
38
- margin-top: $navbar-height;
39
- position: relative;
40
- }
25
+ @import 'components/slideup_header';
41
26
 
42
- .bottom-border {
43
- border-bottom: 1px solid $border-color;
44
- }
27
+ // $slideup-navbar-height: $navbar-height !default;
45
28
 
46
- .logo img{
47
- width: 44px;
48
- height: 54px;
49
- margin: 10px;
29
+ .btn-lg {
30
+ text-transform: uppercase;
31
+ letter-spacing: 1px;
32
+ font-size: 12px;
50
33
  }
51
34
 
52
- .hero {
53
- margin-top: 50px;
54
- }
35
+ $splash-section-padding: 4em;
55
36
 
56
- h4 {
57
- font-weight: 300;
58
- color: $red;
59
- }
37
+ body.splash {
38
+ text-align: center;
60
39
 
61
- h2 {
62
- margin-bottom: 80px;
63
- }
40
+ p.info {
41
+ font-size: 1.5em;
42
+ }
64
43
 
65
- #contact h1 {
66
- color: $red;
67
- margin-bottom: 40px;
68
- }
44
+ section {
45
+ padding-top: $splash-section-padding;
46
+ padding-bottom: $splash-section-padding;
47
+ @extend .clearfix;
48
+ }
69
49
 
70
- section {
71
- margin-top: 40px;
72
- margin-bottom: 40px;
73
- }
50
+ header {
51
+ height: 0;
52
+ }
53
+ .affix-top .navbar {
54
+ background: transparent;
55
+ }
74
56
 
75
- #about {
76
- img {
77
- margin: 0 auto;
57
+ .lightimage {
58
+ padding-top: 4 * $font-size-base + $slideup-navbar-height;
59
+ background-size: cover;
60
+ min-height: 600px;
61
+ p {padding: 2em 0;}
62
+ overflow: hidden;
63
+ position: relative;
64
+
65
+ .row {
66
+ position:relative;
67
+ z-index:2;
68
+ }
69
+ &:before {
70
+ content: ' ';
71
+ display: block;
72
+ position: absolute;
73
+ left: 0;
74
+ top: 0;
75
+ width: 100%;
76
+ height: 100%;
77
+ z-index: 1;
78
+ opacity: 0.6;
79
+ background-image: url('https://s3.amazonaws.com/assets.happyfuncorp.com/splash-assets/unsplash_Matthew_Wiebe.jpg');
80
+ background-repeat: no-repeat;
81
+ background-position: 50% 0;
82
+ -ms-background-size: cover;
83
+ -o-background-size: cover;
84
+ -moz-background-size: cover;
85
+ -webkit-background-size: cover;
86
+ background-size: cover;
87
+ }
78
88
  }
79
- }
80
89
 
81
- .avatar {
82
- width: 100px;
83
- height: 100px;
84
- padding: 10px;
85
- }
90
+ .colored.primary {
91
+ background: $brand-primary;
92
+ color: white;
86
93
 
87
- .carousel-indicators {
88
- bottom: 0;
89
- li {
90
- border: $carousel-indicator-border;
91
- background: $carousel-indicator-background;
94
+ p {
95
+ padding: 2em 0;
96
+ font-size: 1.3em;
97
+ }
98
+ }
99
+
100
+ .inner-column {
101
+ @extend .col-sm-8;
102
+ @extend .col-sm-offset-2;
92
103
  }
93
- }
94
104
 
95
- form .btn {
96
- background: $submit-button-background;
97
- color: $submit-button-color;
98
- input {
99
- border-color: $submit-border-color;
100
- &:hover {
101
- background: $form-submit-hover;
102
- color: black;
105
+ .inner-block {
106
+ @extend .col-md-3;
107
+ @extend .col-sm-6;
108
+
109
+ @media (max-width: $screen-xs-max) {
110
+ padding-left: 0;
111
+ padding-right: 0;
112
+ }
113
+ }
114
+
115
+ .quarter-block {
116
+ width: 25%;
117
+ float: left;
118
+
119
+ img {
120
+ @extend .img-responsive;
103
121
  }
104
122
  }
105
123
  }
106
124
 
125
+ .btn-primary {
126
+ &:hover {
127
+ border: 1px solid $brand-primary;
128
+ background: white;
129
+ color: $brand-primary;
130
+ }
131
+ }
132
+ .btn-primary-inverted {
133
+ background: white;
134
+ color: $brand-primary;
135
+
136
+ &:hover {
137
+ border: 1px solid white;
138
+ background: $brand-primary;
139
+ color: white;
140
+ }
141
+ }