rails_apps_pages 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe1a0e0cf098665565bb6948f66d3247d1aa86ad
4
- data.tar.gz: 3f9f3bf6330b284b2432efefe915a1ed948617f2
3
+ metadata.gz: 4812f3289928d88a1abc76bc4285d48e485799c9
4
+ data.tar.gz: e45a51f5260d346d39de47cba297934819f9982f
5
5
  SHA512:
6
- metadata.gz: 7979b130c26740a3789ce43bdc88bb201c7918bd13e70cc3c8ef9bb5c427a38a937dff138f218fe1a17c5838482787bc886d820bed67cbe8d1d4958f483b519c
7
- data.tar.gz: 5c31ff98db4995ed5c4fb04d65b1aed3827c296a1d03a1f2b362146ac8d412d96e5da98dcfcf77cd630fa54a42680dadcf80201a2f388a433e495c3c4b3ef912
6
+ metadata.gz: 65d1142719d88ec42322c0390a0951dcb581f8645fe833385495565cd23dd6fb24b6df14be1c73979d8aeda805e8a9e9007026a5385bd75bef2c4e6762303d2d
7
+ data.tar.gz: f1282e491104045fefadbbdb0dc6e969e13ea0a82be5b8738695d19ec9ef2ead0b222038a560e5dfe6f0b1f33863715db4607aa30214a2acb2cdedd43ccbd807
data/CHANGELOG.textile CHANGED
@@ -1,5 +1,9 @@
1
1
  h1. CHANGELOG
2
2
 
3
+ h3. 0.4.5 May 31, 2014
4
+
5
+ * user pages for OmniAuth
6
+
3
7
  h3. 0.4.4 May 13, 2014
4
8
 
5
9
  * RSpec tests that use Warden test helpers need a reset action
data/README.textile CHANGED
@@ -156,3 +156,20 @@ h2. MIT License
156
156
  "MIT License":http://www.opensource.org/licenses/mit-license
157
157
 
158
158
  Copyright © 2014 Daniel Kehoe
159
+
160
+ h2. Useful Links
161
+
162
+ |_. Getting Started |_. Articles |_. Tutorials |
163
+ | "Ruby on Rails":http://railsapps.github.io/ruby-and-rails.html | "Analytics for Rails":http://railsapps.github.io/rails-google-analytics.html | "Rails Bootstrap":http://railsapps.github.io/twitter-bootstrap-rails.html |
164
+ | "What is Ruby on Rails?":http://railsapps.github.io/what-is-ruby-rails.html | "Heroku and Rails":http://railsapps.github.io/rails-heroku-tutorial.html | "Rails Foundation":http://railsapps.github.io/rails-foundation.html |
165
+ | "Learn Ruby on Rails":http://learn-rails.com/learn-ruby-on-rails.html | "JavaScript and Rails":http://railsapps.github.io/rails-javascript-include-external.html | "RSpec Tutorial":http://railsapps.github.io/rspec.html |
166
+ | "Rails Tutorial":https://tutorials.railsapps.org/rails-tutorial | "Rails Environment Variables":http://railsapps.github.io/rails-environment-variables.html | "Rails Devise Tutorial":http://railsapps.github.io/tutorial-rails-devise.html |
167
+ | "Ruby on Rails Tutorial for Beginners":http://learn-rails.com/ruby-on-rails-tutorial-for-beginners | "Git and GitHub with Rails":http://railsapps.github.io/rails-git.html | "Devise RSpec":http://railsapps.github.io/tutorial-rails-devise-rspec-cucumber.html |
168
+ | "Install Ruby on Rails":http://railsapps.github.io/installing-rails.html | "Send Email with Rails":http://railsapps.github.io/rails-send-email.html | "Devise Bootstrap":http://railsapps.github.io/tutorial-rails-bootstrap-devise-cancan.html |
169
+ | "Install Ruby on Rails - Mac OS X":http://railsapps.github.io/installrubyonrails-mac.html | "Haml and Rails":http://railsapps.github.io/rails-haml.html | "Rails Membership Site with Stripe":https://tutorials.railsapps.org/rails-stripe-membership-saas |
170
+ | "Install Ruby on Rails - Ubuntu":http://railsapps.github.io/installrubyonrails-ubuntu.html | "Rails Application Layout":http://railsapps.github.io/rails-default-application-layout.html | "Rails Subscription Site with Recurly":https://tutorials.railsapps.org/rails-recurly-subscription-saas |
171
+ | "Ruby on Rails - Nitrous.io":http://railsapps.github.io/rubyonrails-nitrous-io.html | "HTML5 Boilerplate for Rails":http://railsapps.github.io/rails-html5-boilerplate.html | "Startup Prelaunch Signup Application":https://tutorials.railsapps.org/rails-prelaunch-signup |
172
+ | "Update Rails":http://railsapps.github.io/updating-rails.html | "Example Gemfiles for Rails":http://railsapps.github.io/rails-3-2-example-gemfile.html |
173
+ | "Rails Composer":http://railsapps.github.io/rails-composer/ | "Rails Application Templates":http://railsapps.github.io/rails-application-templates.html |
174
+ | "Rails Examples":http://railsapps.github.io/ | "Rails Product Planning":http://railsapps.github.io/rails-product-planning.html |
175
+ | "Rails Starter Apps":http://railsapps.github.io/rails-examples-tutorials.html | "Rails Project Management":http://railsapps.github.io/rails-project-management.html |
@@ -0,0 +1,32 @@
1
+ class UsersController < ApplicationController
2
+ before_filter :authenticate_user!
3
+ before_filter :correct_user?, :except => [:index]
4
+
5
+ def index
6
+ @users = User.all
7
+ end
8
+
9
+ def edit
10
+ @user = User.find(params[:id])
11
+ end
12
+
13
+ def update
14
+ @user = User.find(params[:id])
15
+ if @user.update_attributes(secure_params)
16
+ redirect_to @user
17
+ else
18
+ render :edit
19
+ end
20
+ end
21
+
22
+ def show
23
+ @user = User.find(params[:id])
24
+ end
25
+
26
+ private
27
+
28
+ def secure_params
29
+ params.require(:user).permit(:email)
30
+ end
31
+
32
+ end
@@ -0,0 +1,10 @@
1
+ <div class="authform">
2
+ <%= form_for(@user) do |f| %>
3
+ <div class="form-group">
4
+ <%= f.label :email %>
5
+ <%= f.email_field :email, class: 'form-control' %>
6
+ </div>
7
+ </fieldset>
8
+ <%= f.submit 'Sign in', :class => 'button right' %>
9
+ <% end %>
10
+ </div>
@@ -5,32 +5,47 @@ module Pages
5
5
  class UsersGenerator < ::Rails::Generators::Base
6
6
  source_root File.expand_path("../templates", __FILE__)
7
7
 
8
- desc "Create pages to accompany a User model when authentication is available."
8
+ desc "Create pages to accompany a User model."
9
9
 
10
- def create_page
11
- ### assumes we are using Devise for authentication
10
+ def create_pages
12
11
  copy_file 'users/_user.html.erb', 'app/views/users/_user.html.erb'
13
12
  copy_file 'users/index.html.erb', 'app/views/users/index.html.erb'
14
13
  copy_file 'users/show.html.erb', 'app/views/users/show.html.erb'
15
- copy_file 'users_controller.rb', 'app/controllers/users_controller.rb'
16
- route = ' resources :users'
17
- inject_into_file 'config/routes.rb', route + "\n", :after => "devise_for :users\n"
18
14
  generate 'pages:home -f'
19
15
  copy_file 'visitors/index.html.erb', 'app/views/visitors/index.html.erb'
20
16
  end
21
17
 
22
- def add_name_field
18
+ def create_devise_pages
19
+ return unless File.exists?('config/initializers/devise.rb')
20
+ copy_file 'devise/users_controller.rb', 'app/controllers/users_controller.rb'
21
+ route = ' resources :users'
22
+ inject_into_file 'config/routes.rb', route + "\n", :after => "devise_for :users\n"
23
+ end
24
+
25
+ def create_omniauth_pages
26
+ return unless File.exists?('config/initializers/omniauth.rb')
27
+ copy_file 'users/edit.html.erb', 'app/views/users/edit.html.erb'
28
+ copy_file 'omniauth/users_controller.rb', 'app/controllers/users_controller.rb'
29
+ route = ' resources :users, :only => [:index, :show, :edit, :update ]'
30
+ inject_into_file 'config/routes.rb', route + "\n", :after => "root :to => \"visitors#index\"\n"
31
+ prepend_file 'app/views/users/_user.html.erb', "<td><%= link_to user.name, user %></td>\n"
32
+ inject_into_file 'app/views/users/show.html.erb', "\n<p>Name: <%= @user.name if @user.name %></p>", :before => "\n<p>Email"
33
+ end
34
+
35
+ def add_devise_name_field
36
+ return unless File.exists?('config/initializers/devise.rb')
23
37
  if Object.const_defined?('User')
24
38
  if User.column_names.include? 'name'
25
- permitted = File.read(find_in_source_paths('permitted_parameters.rb'))
39
+ permitted = File.read(find_in_source_paths('devise/permitted_parameters.rb'))
26
40
  inject_into_file 'app/controllers/application_controller.rb', permitted + "\n", :after => "protect_from_forgery with: :exception\n"
27
- prepend_file 'app/views/users/_user.html.erb', "<td><%= user.name %></td>\n"
41
+ prepend_file 'app/views/users/_user.html.erb', "<td><%= link_to user.name, user %></td>\n"
28
42
  inject_into_file 'app/views/users/show.html.erb', "\n<p>Name: <%= @user.name if @user.name %></p>", :before => "\n<p>Email"
29
43
  end
30
44
  end
31
45
  end
32
46
 
33
- def add_tests
47
+ def add_devise_tests
48
+ return unless File.exists?('config/initializers/devise.rb')
34
49
  return unless File.exists?('spec/spec_helper.rb')
35
50
  copy_file 'spec/factories/users.rb', 'spec/factories/users.rb'
36
51
  copy_file 'spec/features/users/sign_in_spec.rb', 'spec/features/users/sign_in_spec.rb'
@@ -1,3 +1,3 @@
1
1
  module RailsAppsPages
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_apps_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kehoe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,9 @@ files:
67
67
  - lib/generators/pages/home/templates/home_page_spec.rb
68
68
  - lib/generators/pages/home/templates/index.html.erb
69
69
  - lib/generators/pages/home/templates/visitors_controller.rb
70
- - lib/generators/pages/users/templates/permitted_parameters.rb
70
+ - lib/generators/pages/users/templates/devise/permitted_parameters.rb
71
+ - lib/generators/pages/users/templates/devise/users_controller.rb
72
+ - lib/generators/pages/users/templates/omniauth/users_controller.rb
71
73
  - lib/generators/pages/users/templates/spec/factories/users.rb
72
74
  - lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb
73
75
  - lib/generators/pages/users/templates/spec/features/users/sign_out_spec.rb
@@ -80,9 +82,9 @@ files:
80
82
  - lib/generators/pages/users/templates/spec/support/helpers.rb
81
83
  - lib/generators/pages/users/templates/spec/support/helpers/session_helpers.rb
82
84
  - lib/generators/pages/users/templates/users/_user.html.erb
85
+ - lib/generators/pages/users/templates/users/edit.html.erb
83
86
  - lib/generators/pages/users/templates/users/index.html.erb
84
87
  - lib/generators/pages/users/templates/users/show.html.erb
85
- - lib/generators/pages/users/templates/users_controller.rb
86
88
  - lib/generators/pages/users/templates/visitors/index.html.erb
87
89
  - lib/generators/pages/users/users_generator.rb
88
90
  - lib/rails_apps_pages.rb