happy_seed 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1579e2f69715b0bd19065cf3edf4e9c0a5bf7cd
4
- data.tar.gz: 719b96e3c0503aedb854c2a1e13c7a2fafbe46bc
3
+ metadata.gz: 9c2387bf98dd8eba98bb76cdba96ddb9e9c4b885
4
+ data.tar.gz: a15292d591236f761dbb84b612307e170bd7e8ba
5
5
  SHA512:
6
- metadata.gz: 247c7d4f76ad06725ab4adc57d939fd85276acbdaa12aa65ef97ef4aceb2253aa7b363710cf0fd6ffbfb9f3638b976378b39868f0d1245b1745d44341f66bd78
7
- data.tar.gz: 749c20258801a4c31575db54a85b14bb38c012f27b684a6807cb6ea76b85a287aa79ecb62cc63649b655146affca7b54e9d47706165d65a06866ea66eea06cc2
6
+ metadata.gz: b3bbf3a5bc46701938ab6d74c79466ed398f09b2347cfd241aa4321b861c3dfff510f15b954c2166d02bbd1ba78c1bbfa8b533e47752ab9684947af17dac86b1
7
+ data.tar.gz: 90802c40fa1e1c135a7cd74355ac777b1b755ab3ef66a1568ba4f8aae842cdbc24a1bdb5e2cd0f004f8c3006b725835fb63cf941ed753f1e2fb8a74e62b07e59
@@ -16,4 +16,8 @@ module ApplicationHelper
16
16
  nil
17
17
  end
18
18
  end
19
+
20
+ def page_title
21
+ @title || controller_name.gsub( /Controller/, "" ).humanize
22
+ end
19
23
  end
@@ -1,8 +1,7 @@
1
1
  %footer#footer
2
- .container
3
- .row
4
- .col-xs-6
5
- %h3 AppName
6
- .col-xs-6.text-right
7
- %small.copyright
8
- T, Copyright © #{ Date.today.year }
2
+ .row
3
+ .col-xs-6
4
+ %h3 AppName
5
+ .col-xs-6.text-right
6
+ %small.copyright
7
+ T, Copyright © #{ Date.today.year }
@@ -2,7 +2,7 @@
2
2
  %meta{ :charset => 'utf-8' }/
3
3
  %meta{ 'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1' }/
4
4
 
5
- = display_meta_tags :site => 'New'
5
+ = display_meta_tags :site => 'Seed Site', :title => page_title, :reverse => true
6
6
 
7
7
  %meta{ :name => 'description', :content => '' }/
8
8
  %meta{ :name => 'viewport', :content => 'width=device-width' }/
@@ -1,16 +1,15 @@
1
- %header#top.navbar{:role=>:banner}
2
- .container
3
- .navbar-header
4
- %button.navbar-toggle{:type=>:button, 'data-toggle'=>:collapse, 'data-target'=>'.navbar-collapse'}
5
- %span.sr-only Toggle navigations
6
- %span.icon-bar
7
- %span.icon-bar
8
- %span.icon-bar
9
- = link_to root_path, :class=>'navbar-brand' do
10
- %span.glyphicon.glyphicon-cloud
11
- App name
12
- %nav.collapse.navbar-collapse{:role=>:navigation}
13
- %ul.nav.navbar-nav
14
- %li= link_to 'Contact', '#'
15
- %li= link_to 'Blog', '#'
16
- / USER NAV
1
+ %header#top.navbar.navbar-default{:role=>:banner}
2
+ .navbar-header
3
+ %button.navbar-toggle{:type=>:button, 'data-toggle'=>:collapse, 'data-target'=>'.navbar-collapse'}
4
+ %span.sr-only Toggle navigations
5
+ %span.icon-bar
6
+ %span.icon-bar
7
+ %span.icon-bar
8
+ = link_to root_path, :class=>'navbar-brand' do
9
+ %span.glyphicon.glyphicon-cloud
10
+ App name
11
+ %nav.collapse.navbar-collapse{:role=>:navigation}
12
+ %ul.nav.navbar-nav
13
+ %li= link_to 'Contact', '#'
14
+ %li= link_to 'Blog', '#'
15
+ / USER NAV
@@ -21,6 +21,7 @@ module HappySeed
21
21
 
22
22
  directory 'app'
23
23
  directory 'docs'
24
+ directory 'test'
24
25
 
25
26
  application(nil, env: "development") do
26
27
  "config.action_mailer.default_url_options = { host: 'localhost:3000' }"
@@ -28,12 +29,12 @@ module HappySeed
28
29
 
29
30
  gsub_file 'app/views/application/_header.html.haml', "/ USER NAV", <<-'RUBY'
30
31
  %ul.nav.navbar-nav.navbar-right
31
- - if user_signed_in?
32
- %li= link_to 'Sign Out', destroy_user_session_path, :method=>:delete
33
- - else
34
- / CONNECT
35
- %li= link_to 'Sign In', new_user_session_path
36
- %li= link_to 'Sign Up', new_user_registration_path
32
+ - if user_signed_in?
33
+ %li= link_to 'Sign Out', destroy_user_session_path, :method=>:delete
34
+ - else
35
+ / CONNECT
36
+ %li= link_to 'Sign In', new_user_session_path
37
+ %li= link_to 'Sign Up', new_user_registration_path
37
38
  RUBY
38
39
  end
39
40
  end
@@ -1,3 +1,4 @@
1
+ - @title = "Sign Up"
1
2
  .container
2
3
  .row
3
4
  .col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3.col-sm-8.col-sm-offset-2
@@ -1,3 +1,4 @@
1
+ - @title = "Sign In"
1
2
  .container
2
3
  .row
3
4
  .col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3.col-sm-8.col-sm-offset-2
@@ -27,10 +27,20 @@ module HappySeed
27
27
  end
28
28
  append_to_file ".env", "#{provider.upcase}_APP_ID=\n#{provider.upcase}_APP_SECRET=\n"
29
29
 
30
- inject_into_file 'app/views/application/_header.html.haml', " %li= link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n", after: "/ CONNECT\n"
30
+ inject_into_file 'app/views/application/_header.html.haml', " %li= link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n", after: "/ CONNECT\n"
31
31
  inject_into_file 'app/views/devise/sessions/new.html.haml', " = link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n %br\n", after: "/ CONNECT\n"
32
32
  inject_into_file 'app/views/devise/registrations/new.html.haml', " = link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n %br\n", after: "/ CONNECT\n"
33
33
  inject_into_file 'app/controllers/omniauth_callbacks_controller.rb', "\n def #{provider}\n generic_callback( '#{provider}' )\n end\n", before: /\s*def generic_callback/
34
+ inject_into_file 'app/models/user.rb', :before => "\nend" do <<-"RUBY"
35
+ def #{provider}
36
+ identities.where( :provider => "#{provider}" ).first
37
+ end
38
+
39
+ def #{provider}_client
40
+ @#{provider}_client ||= #{provider.to_s.humanize}.client( access_token: #{provider}.accesstoken )
41
+ end
42
+ RUBY
43
+ end
34
44
  end
35
45
 
36
46
  def gem_available?(name)
@@ -25,7 +25,7 @@ module HappySeed
25
25
  run "bundle install"
26
26
  end
27
27
 
28
- generate 'model identity user:references provider:string uid:string name:string email:string nickname:string image:string phone:string urls:string'
28
+ generate 'model identity user:references provider:string accesstoken:string uid:string name:string email:string nickname:string image:string phone:string urls:string'
29
29
  remove_file 'app/models/identity.rb'
30
30
  directory 'app'
31
31
  route "match '/profile/:id/finish_signup' => 'users#finish_signup', via: [:get, :patch], :as => :finish_signup"
@@ -35,6 +35,7 @@ module HappySeed
35
35
  insert_into_file "app/models/user.rb", File.read( find_in_source_paths( "user.rb" ) ), :before => "\nend\n"
36
36
  insert_into_file "app/views/application/_header.html.haml", " %li= link_to 'Account', user_path\n", after: " - if user_signed_in?\n"
37
37
  gsub_file 'config/routes.rb', "devise_for :users\n", "devise_for :users, :controllers => { omniauth_callbacks: 'omniauth_callbacks' }\n"
38
+
38
39
  directory "docs"
39
40
  end
40
41
 
@@ -13,7 +13,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
13
13
 
14
14
  def after_sign_in_path_for(resource)
15
15
  if resource.email_verified?
16
- super resource
16
+ root_url
17
+ # super resource
17
18
  else
18
19
  finish_signup_path(resource)
19
20
  end
@@ -6,12 +6,13 @@ class Identity < ActiveRecord::Base
6
6
  def self.find_for_oauth(auth)
7
7
  identity = find_by(provider: auth.provider, uid: auth.uid)
8
8
  identity = create(uid: auth.uid, provider: auth.provider) if identity.nil?
9
+ identity.accesstoken = auth.credentials.token
9
10
  identity.name = auth.info.name
10
11
  identity.email = auth.info.email
11
12
  identity.nickname = auth.info.nickname
12
13
  identity.image = auth.info.image
13
14
  identity.phone = auth.info.phone
14
- identity.urls = auth.info.urls
15
+ identity.urls = (auth.info.urls || "").to_json
15
16
  identity.save
16
17
  identity
17
18
  end
@@ -15,7 +15,7 @@
15
15
  %br
16
16
 
17
17
  .form-group
18
- = f.label :email
18
+ = f.label :email, :class=>'control-label col-sm-3'
19
19
  .col-sm-9= f.text_field :email, :autofocus => true, :value => '', class: 'form-control input-lg', placeholder: 'Example: email@me.com'
20
20
 
21
21
  %p.col-sm-9.help-block
@@ -1,3 +1,3 @@
1
1
  module HappySeed
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: happy_seed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Schenk