active_mocker 1.2.pre → 1.2.pre.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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_mocker/version.rb +1 -1
  3. data/sample_app_rails_4/.idea/.generators +8 -0
  4. data/sample_app_rails_4/.idea/.name +1 -0
  5. data/sample_app_rails_4/.idea/.rakeTasks +7 -0
  6. data/sample_app_rails_4/.idea/dataSources.ids +141 -0
  7. data/sample_app_rails_4/.idea/dataSources.xml +36 -0
  8. data/sample_app_rails_4/.idea/dictionaries/zeisler.xml +3 -0
  9. data/sample_app_rails_4/.idea/encodings.xml +5 -0
  10. data/sample_app_rails_4/.idea/inspectionProfiles/Project_Default.xml +20 -0
  11. data/sample_app_rails_4/.idea/inspectionProfiles/profiles_settings.xml +7 -0
  12. data/sample_app_rails_4/.idea/misc.xml +5 -0
  13. data/sample_app_rails_4/.idea/modules.xml +10 -0
  14. data/sample_app_rails_4/.idea/runConfigurations/Development__sample_app_rails_4.xml +28 -0
  15. data/sample_app_rails_4/.idea/runConfigurations/Production__sample_app_rails_4.xml +28 -0
  16. data/sample_app_rails_4/.idea/runConfigurations/spec__sample_app_rails_4.xml +26 -0
  17. data/sample_app_rails_4/.idea/runConfigurations/test__sample_app_rails_4.xml +28 -0
  18. data/sample_app_rails_4/.idea/sample_app_rails_4.iml +262 -0
  19. data/sample_app_rails_4/.idea/scopes/scope_settings.xml +5 -0
  20. data/sample_app_rails_4/.idea/vcs.xml +7 -0
  21. data/sample_app_rails_4/.idea/workspace.xml +969 -0
  22. data/sample_app_rails_4/.rspec +1 -0
  23. data/sample_app_rails_4/.secret +1 -0
  24. data/sample_app_rails_4/Gemfile +53 -0
  25. data/sample_app_rails_4/Guardfile +53 -0
  26. data/sample_app_rails_4/LICENSE +21 -0
  27. data/sample_app_rails_4/README.md +25 -0
  28. data/sample_app_rails_4/README.nitrous.md +20 -0
  29. data/sample_app_rails_4/Rakefile +6 -0
  30. data/sample_app_rails_4/app/assets/images/rails.png +0 -0
  31. data/sample_app_rails_4/app/assets/javascripts/application.js +17 -0
  32. data/sample_app_rails_4/app/assets/javascripts/sessions.js.coffee +3 -0
  33. data/sample_app_rails_4/app/assets/javascripts/static_pages.js.coffee +3 -0
  34. data/sample_app_rails_4/app/assets/javascripts/users.js.coffee +3 -0
  35. data/sample_app_rails_4/app/assets/stylesheets/application.css +13 -0
  36. data/sample_app_rails_4/app/assets/stylesheets/custom.css.scss +246 -0
  37. data/sample_app_rails_4/app/assets/stylesheets/sessions.css.scss +3 -0
  38. data/sample_app_rails_4/app/assets/stylesheets/static_pages.css.scss +3 -0
  39. data/sample_app_rails_4/app/assets/stylesheets/users.css.scss +3 -0
  40. data/sample_app_rails_4/app/controllers/application_controller.rb +6 -0
  41. data/sample_app_rails_4/app/controllers/concerns/.keep +0 -0
  42. data/sample_app_rails_4/app/controllers/microposts_controller.rb +31 -0
  43. data/sample_app_rails_4/app/controllers/relationships_controller.rb +21 -0
  44. data/sample_app_rails_4/app/controllers/sessions_controller.rb +21 -0
  45. data/sample_app_rails_4/app/controllers/static_pages_controller.rb +18 -0
  46. data/sample_app_rails_4/app/controllers/users_controller.rb +80 -0
  47. data/sample_app_rails_4/app/helpers/application_helper.rb +12 -0
  48. data/sample_app_rails_4/app/helpers/sessions_helper.rb +49 -0
  49. data/sample_app_rails_4/app/helpers/static_pages_helper.rb +2 -0
  50. data/sample_app_rails_4/app/helpers/users_helper.rb +10 -0
  51. data/sample_app_rails_4/app/mailers/.keep +0 -0
  52. data/sample_app_rails_4/app/models/.keep +0 -0
  53. data/sample_app_rails_4/app/models/concerns/.keep +0 -0
  54. data/sample_app_rails_4/app/models/micropost.rb +14 -0
  55. data/sample_app_rails_4/app/models/relationship.rb +6 -0
  56. data/sample_app_rails_4/app/models/user.rb +47 -0
  57. data/sample_app_rails_4/app/views/layouts/_footer.html.erb +13 -0
  58. data/sample_app_rails_4/app/views/layouts/_header.html.erb +31 -0
  59. data/sample_app_rails_4/app/views/layouts/_shim.html.erb +3 -0
  60. data/sample_app_rails_4/app/views/layouts/application.html.erb +22 -0
  61. data/sample_app_rails_4/app/views/microposts/_micropost.html.erb +11 -0
  62. data/sample_app_rails_4/app/views/relationships/create.js.erb +2 -0
  63. data/sample_app_rails_4/app/views/relationships/destroy.js.erb +2 -0
  64. data/sample_app_rails_4/app/views/sessions/new.html.erb +19 -0
  65. data/sample_app_rails_4/app/views/shared/_error_messages.html.erb +12 -0
  66. data/sample_app_rails_4/app/views/shared/_feed.html.erb +6 -0
  67. data/sample_app_rails_4/app/views/shared/_feed_item.html.erb +15 -0
  68. data/sample_app_rails_4/app/views/shared/_micropost_form.html.erb +7 -0
  69. data/sample_app_rails_4/app/views/shared/_stats.html.erb +15 -0
  70. data/sample_app_rails_4/app/views/shared/_user_info.html.erb +12 -0
  71. data/sample_app_rails_4/app/views/static_pages/about.html.erb +8 -0
  72. data/sample_app_rails_4/app/views/static_pages/contact.html.erb +6 -0
  73. data/sample_app_rails_4/app/views/static_pages/help.html.erb +8 -0
  74. data/sample_app_rails_4/app/views/static_pages/home.html.erb +34 -0
  75. data/sample_app_rails_4/app/views/static_pages/show.html.erb +0 -0
  76. data/sample_app_rails_4/app/views/users/_follow.html.erb +5 -0
  77. data/sample_app_rails_4/app/views/users/_follow_form.html.erb +9 -0
  78. data/sample_app_rails_4/app/views/users/_unfollow.html.erb +5 -0
  79. data/sample_app_rails_4/app/views/users/_user.html.erb +8 -0
  80. data/sample_app_rails_4/app/views/users/edit.html.erb +27 -0
  81. data/sample_app_rails_4/app/views/users/index.html.erb +10 -0
  82. data/sample_app_rails_4/app/views/users/new.html.erb +24 -0
  83. data/sample_app_rails_4/app/views/users/show.html.erb +24 -0
  84. data/sample_app_rails_4/app/views/users/show_follow.html.erb +30 -0
  85. data/sample_app_rails_4/bin/bundle +3 -0
  86. data/sample_app_rails_4/bin/rails +4 -0
  87. data/sample_app_rails_4/bin/rake +4 -0
  88. data/sample_app_rails_4/config.ru +4 -0
  89. data/sample_app_rails_4/config/application.rb +31 -0
  90. data/sample_app_rails_4/config/boot.rb +4 -0
  91. data/sample_app_rails_4/config/cucumber.yml +8 -0
  92. data/sample_app_rails_4/config/database.yml +28 -0
  93. data/sample_app_rails_4/config/environment.rb +5 -0
  94. data/sample_app_rails_4/config/environments/development.rb +27 -0
  95. data/sample_app_rails_4/config/environments/production.rb +79 -0
  96. data/sample_app_rails_4/config/environments/test.rb +39 -0
  97. data/sample_app_rails_4/config/initializers/active_mocker.rb +10 -0
  98. data/sample_app_rails_4/config/initializers/backtrace_silencers.rb +7 -0
  99. data/sample_app_rails_4/config/initializers/filter_parameter_logging.rb +4 -0
  100. data/sample_app_rails_4/config/initializers/inflections.rb +16 -0
  101. data/sample_app_rails_4/config/initializers/mime_types.rb +5 -0
  102. data/sample_app_rails_4/config/initializers/secret_token.rb +22 -0
  103. data/sample_app_rails_4/config/initializers/session_store.rb +3 -0
  104. data/sample_app_rails_4/config/initializers/wrap_parameters.rb +14 -0
  105. data/sample_app_rails_4/config/locales/en.yml +23 -0
  106. data/sample_app_rails_4/config/routes.rb +17 -0
  107. data/sample_app_rails_4/db/development.sqlite3 +0 -0
  108. data/sample_app_rails_4/db/migrate/20130311191400_create_users.rb +10 -0
  109. data/sample_app_rails_4/db/migrate/20130311194153_add_index_to_users_email.rb +5 -0
  110. data/sample_app_rails_4/db/migrate/20130311201841_add_password_digest_to_users.rb +5 -0
  111. data/sample_app_rails_4/db/migrate/20130314184954_add_remember_token_to_users.rb +6 -0
  112. data/sample_app_rails_4/db/migrate/20130315015932_add_admin_to_users.rb +5 -0
  113. data/sample_app_rails_4/db/migrate/20130315175534_create_microposts.rb +11 -0
  114. data/sample_app_rails_4/db/migrate/20130315230445_create_relationships.rb +13 -0
  115. data/sample_app_rails_4/db/schema.rb +49 -0
  116. data/sample_app_rails_4/db/seeds.rb +7 -0
  117. data/sample_app_rails_4/db/test.sqlite3 +0 -0
  118. data/sample_app_rails_4/features/signing_in.feature +13 -0
  119. data/sample_app_rails_4/features/step_definitions/authentication_steps.rb +30 -0
  120. data/sample_app_rails_4/features/support/env.rb +59 -0
  121. data/sample_app_rails_4/lib/assets/.keep +0 -0
  122. data/sample_app_rails_4/lib/tasks/.keep +0 -0
  123. data/sample_app_rails_4/lib/tasks/cucumber.rake +65 -0
  124. data/sample_app_rails_4/lib/tasks/mocks.rake +10 -0
  125. data/sample_app_rails_4/lib/tasks/sample_data.rake +42 -0
  126. data/sample_app_rails_4/log/.keep +0 -0
  127. data/sample_app_rails_4/log/development.log +603 -0
  128. data/sample_app_rails_4/log/test.log +6727 -0
  129. data/sample_app_rails_4/public/404.html +27 -0
  130. data/sample_app_rails_4/public/422.html +26 -0
  131. data/sample_app_rails_4/public/500.html +26 -0
  132. data/sample_app_rails_4/public/assets/application-4962059d8f80f9bb096692bacc29c4e8.css +5091 -0
  133. data/sample_app_rails_4/public/assets/application-4962059d8f80f9bb096692bacc29c4e8.css.gz +0 -0
  134. data/sample_app_rails_4/public/assets/application-eeb856e3fe2c8f879c91d0e81d59cb40.js +12952 -0
  135. data/sample_app_rails_4/public/assets/application-eeb856e3fe2c8f879c91d0e81d59cb40.js.gz +0 -0
  136. data/sample_app_rails_4/public/assets/glyphicons-halflings-c806376f05e4ccabe2c5315a8e95667c.png +0 -0
  137. data/sample_app_rails_4/public/assets/glyphicons-halflings-white-62b67d9edee3db90d18833087f848d6e.png +0 -0
  138. data/sample_app_rails_4/public/assets/manifest-802de9eb1c853769101852422b620883.json +1 -0
  139. data/sample_app_rails_4/public/assets/rails-231a680f23887d9dd70710ea5efd3c62.png +0 -0
  140. data/sample_app_rails_4/public/favicon.ico +0 -0
  141. data/sample_app_rails_4/public/robots.txt +5 -0
  142. data/sample_app_rails_4/script/cucumber +10 -0
  143. data/sample_app_rails_4/spec/controllers/relationships_controller_spec.rb +42 -0
  144. data/sample_app_rails_4/spec/factories.rb +17 -0
  145. data/sample_app_rails_4/spec/helpers/application_helper_spec.rb +18 -0
  146. data/sample_app_rails_4/spec/models/micropost_spec.rb +30 -0
  147. data/sample_app_rails_4/spec/models/relationship_spec.rb +29 -0
  148. data/sample_app_rails_4/spec/models/user_spec.rb +194 -0
  149. data/sample_app_rails_4/spec/spec_helper.rb +49 -0
  150. data/sample_app_rails_4/spec/support/utilities.rb +21 -0
  151. data/sample_app_rails_4/vendor/assets/javascripts/.keep +0 -0
  152. data/sample_app_rails_4/vendor/assets/stylesheets/.keep +0 -0
  153. metadata +151 -1
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Sessions controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the StaticPages controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Users controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,6 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ include SessionsHelper
6
+ end
File without changes
@@ -0,0 +1,31 @@
1
+ class MicropostsController < ApplicationController
2
+ before_action :signed_in_user, only: [:create, :destroy]
3
+ before_action :correct_user, only: :destroy
4
+
5
+ def create
6
+ @micropost = current_user.microposts.build(micropost_params)
7
+ if @micropost.save
8
+ flash[:success] = "Micropost created!"
9
+ redirect_to root_url
10
+ else
11
+ @feed_items = []
12
+ render 'static_pages/home'
13
+ end
14
+ end
15
+
16
+ def destroy
17
+ @micropost.destroy
18
+ redirect_to root_url
19
+ end
20
+
21
+ private
22
+
23
+ def micropost_params
24
+ params.require(:micropost).permit(:content)
25
+ end
26
+
27
+ def correct_user
28
+ @micropost = current_user.microposts.find_by(id: params[:id])
29
+ redirect_to root_url if @micropost.nil?
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ class RelationshipsController < ApplicationController
2
+ before_action :signed_in_user
3
+
4
+ def create
5
+ @user = User.find(params[:relationship][:followed_id])
6
+ current_user.follow!(@user)
7
+ respond_to do |format|
8
+ format.html { redirect_to @user }
9
+ format.js
10
+ end
11
+ end
12
+
13
+ def destroy
14
+ @user = Relationship.find(params[:id]).followed
15
+ current_user.unfollow!(@user)
16
+ respond_to do |format|
17
+ format.html { redirect_to @user }
18
+ format.js
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ class SessionsController < ApplicationController
2
+
3
+ def new
4
+ end
5
+
6
+ def create
7
+ user = User.find_by(email: params[:session][:email].downcase)
8
+ if user && user.authenticate(params[:session][:password])
9
+ sign_in user
10
+ redirect_back_or user
11
+ else
12
+ flash.now[:error] = 'Invalid email/password combination'
13
+ render 'new'
14
+ end
15
+ end
16
+
17
+ def destroy
18
+ sign_out
19
+ redirect_to root_url
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ class StaticPagesController < ApplicationController
2
+
3
+ def home
4
+ if signed_in?
5
+ @micropost = current_user.microposts.build
6
+ @feed_items = current_user.feed.paginate(page: params[:page])
7
+ end
8
+ end
9
+
10
+ def help
11
+ end
12
+
13
+ def about
14
+ end
15
+
16
+ def contact
17
+ end
18
+ end
@@ -0,0 +1,80 @@
1
+ class UsersController < ApplicationController
2
+ before_action :signed_in_user,
3
+ only: [:index, :edit, :update, :destroy, :following, :followers]
4
+ before_action :correct_user, only: [:edit, :update]
5
+ before_action :admin_user, only: :destroy
6
+
7
+ def index
8
+ @users = User.paginate(page: params[:page])
9
+ end
10
+
11
+ def show
12
+ @user = User.find(params[:id])
13
+ @microposts = @user.microposts.paginate(page: params[:page])
14
+ end
15
+
16
+ def new
17
+ @user = User.new
18
+ end
19
+
20
+ def create
21
+ @user = User.new(user_params)
22
+ if @user.save
23
+ sign_in @user
24
+ flash[:success] = "Welcome to the Sample App!"
25
+ redirect_to @user
26
+ else
27
+ render 'new'
28
+ end
29
+ end
30
+
31
+ def edit
32
+ end
33
+
34
+ def update
35
+ if @user.update_attributes(user_params)
36
+ flash[:success] = "Profile updated"
37
+ redirect_to @user
38
+ else
39
+ render 'edit'
40
+ end
41
+ end
42
+
43
+ def destroy
44
+ User.find(params[:id]).destroy
45
+ flash[:success] = "User destroyed."
46
+ redirect_to users_url
47
+ end
48
+
49
+ def following
50
+ @title = "Following"
51
+ @user = User.find(params[:id])
52
+ @users = @user.followed_users.paginate(page: params[:page])
53
+ render 'show_follow'
54
+ end
55
+
56
+ def followers
57
+ @title = "Followers"
58
+ @user = User.find(params[:id])
59
+ @users = @user.followers.paginate(page: params[:page])
60
+ render 'show_follow'
61
+ end
62
+
63
+ private
64
+
65
+ def user_params
66
+ params.require(:user).permit(:name, :email, :password,
67
+ :password_confirmation)
68
+ end
69
+
70
+ # Before filters
71
+
72
+ def correct_user
73
+ @user = User.find(params[:id])
74
+ redirect_to(root_url) unless current_user?(@user)
75
+ end
76
+
77
+ def admin_user
78
+ redirect_to(root_url) unless current_user.admin?
79
+ end
80
+ end
@@ -0,0 +1,12 @@
1
+ module ApplicationHelper
2
+
3
+ # Returns the full title on a per-page basis.
4
+ def full_title(page_title)
5
+ base_title = "Ruby on Rails Tutorial Sample App"
6
+ if page_title.empty?
7
+ base_title
8
+ else
9
+ "#{base_title} | #{page_title}"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,49 @@
1
+ module SessionsHelper
2
+
3
+ def sign_in(user)
4
+ remember_token = User.new_remember_token
5
+ cookies.permanent[:remember_token] = remember_token
6
+ user.update_attribute(:remember_token, User.digest(remember_token))
7
+ self.current_user = user
8
+ end
9
+
10
+ def signed_in?
11
+ !current_user.nil?
12
+ end
13
+
14
+ def current_user=(user)
15
+ @current_user = user
16
+ end
17
+
18
+ def current_user
19
+ remember_token = User.digest(cookies[:remember_token])
20
+ @current_user ||= User.find_by(remember_token: remember_token)
21
+ end
22
+
23
+ def current_user?(user)
24
+ user == current_user
25
+ end
26
+
27
+ def signed_in_user
28
+ unless signed_in?
29
+ store_location
30
+ redirect_to signin_url, notice: "Please sign in."
31
+ end
32
+ end
33
+
34
+ def sign_out
35
+ current_user.update_attribute(:remember_token,
36
+ User.digest(User.new_remember_token))
37
+ cookies.delete(:remember_token)
38
+ self.current_user = nil
39
+ end
40
+
41
+ def redirect_back_or(default)
42
+ redirect_to(session[:return_to] || default)
43
+ session.delete(:return_to)
44
+ end
45
+
46
+ def store_location
47
+ session[:return_to] = request.url if request.get?
48
+ end
49
+ end
@@ -0,0 +1,2 @@
1
+ module StaticPagesHelper
2
+ end
@@ -0,0 +1,10 @@
1
+ module UsersHelper
2
+
3
+ # Returns the Gravatar (http://gravatar.com/) for the given user.
4
+ def gravatar_for(user, options = { size: 50 })
5
+ gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
6
+ size = options[:size]
7
+ gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
8
+ image_tag(gravatar_url, alt: user.name, class: "gravatar")
9
+ end
10
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ class Micropost < ActiveRecord::Base
2
+ belongs_to :user
3
+ default_scope -> { order('created_at DESC') }
4
+ validates :content, presence: true, length: { maximum: 140 }
5
+ validates :user_id, presence: true
6
+
7
+ # Returns microposts from the users being followed by the given user.
8
+ def self.from_users_followed_by(user)
9
+ followed_user_ids = "SELECT followed_id FROM relationships
10
+ WHERE follower_id = :user_id"
11
+ where("user_id IN (#{followed_user_ids}) OR user_id = :user_id",
12
+ user_id: user.id)
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ class Relationship < ActiveRecord::Base
2
+ belongs_to :follower, class_name: "User"
3
+ belongs_to :followed, class_name: "User"
4
+ validates :follower_id, presence: true
5
+ validates :followed_id, presence: true
6
+ end
@@ -0,0 +1,47 @@
1
+ class User < ActiveRecord::Base
2
+ has_many :microposts, dependent: :destroy
3
+ has_many :relationships, foreign_key: "follower_id", dependent: :destroy
4
+ has_many :followed_users, through: :relationships, source: :followed
5
+ has_many :reverse_relationships, foreign_key: "followed_id",
6
+ class_name: "Relationship",
7
+ dependent: :destroy
8
+ has_many :followers, through: :reverse_relationships, source: :follower
9
+ before_save { self.email = email.downcase }
10
+ before_create :create_remember_token
11
+ validates :name, presence: true, length: { maximum: 50 }
12
+ VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
13
+ validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
14
+ uniqueness: { case_sensitive: false }
15
+ has_secure_password
16
+ validates :password, length: { minimum: 6 }
17
+
18
+ def User.new_remember_token
19
+ SecureRandom.urlsafe_base64
20
+ end
21
+
22
+ def User.digest(token)
23
+ Digest::SHA1.hexdigest(token.to_s)
24
+ end
25
+
26
+ def feed
27
+ Micropost.from_users_followed_by(self)
28
+ end
29
+
30
+ def following?(other_user)
31
+ relationships.find_by(followed_id: other_user.id)
32
+ end
33
+
34
+ def follow!(other_user)
35
+ relationships.create!(followed_id: other_user.id)
36
+ end
37
+
38
+ def unfollow!(other_user)
39
+ relationships.find_by(followed_id: other_user.id).destroy
40
+ end
41
+
42
+ private
43
+
44
+ def create_remember_token
45
+ self.remember_token = User.digest(User.new_remember_token)
46
+ end
47
+ end
@@ -0,0 +1,13 @@
1
+ <footer class="footer">
2
+ <small>
3
+ <a href="http://railstutorial.org/">Rails Tutorial</a>
4
+ by Michael Hartl
5
+ </small>
6
+ <nav>
7
+ <ul>
8
+ <li><%= link_to "About", about_path %></li>
9
+ <li><%= link_to "Contact", contact_path %></li>
10
+ <li><a href="http://news.railstutorial.org/">News</a></li>
11
+ </ul>
12
+ </nav>
13
+ </footer>
@@ -0,0 +1,31 @@
1
+ <header class="navbar navbar-fixed-top navbar-inverse">
2
+ <div class="navbar-inner">
3
+ <div class="container">
4
+ <%= link_to "sample app", root_path, id: "logo" %>
5
+ <nav>
6
+ <ul class="nav pull-right">
7
+ <li><%= link_to "Home", root_path %></li>
8
+ <li><%= link_to "Help", help_path %></li>
9
+ <% if signed_in? %>
10
+ <li><%= link_to "Users", users_path %></li>
11
+ <li id="fat-menu" class="dropdown">
12
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
13
+ Account <b class="caret"></b>
14
+ </a>
15
+ <ul class="dropdown-menu">
16
+ <li><%= link_to "Profile", current_user %></li>
17
+ <li><%= link_to "Settings", edit_user_path(current_user) %></li>
18
+ <li class="divider"></li>
19
+ <li>
20
+ <%= link_to "Sign out", signout_path, method: "delete" %>
21
+ </li>
22
+ </ul>
23
+ </li>
24
+ <% else %>
25
+ <li><%= link_to "Sign in", signin_path %></li>
26
+ <% end %>
27
+ </ul>
28
+ </nav>
29
+ </div>
30
+ </div>
31
+ </header>
@@ -0,0 +1,3 @@
1
+ <!--[if lt IE 9]>
2
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
3
+ <![endif]-->
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= full_title(yield(:title)) %></title>
5
+ <%= stylesheet_link_tag "application", media: "all",
6
+ "data-turbolinks-track" => true %>
7
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
8
+ <%= csrf_meta_tags %>
9
+ <%= render 'layouts/shim' %>
10
+ </head>
11
+ <body>
12
+ <%= render 'layouts/header' %>
13
+ <div class="container">
14
+ <% flash.each do |key, value| %>
15
+ <div class="alert alert-<%= key %>"><%= value %></div>
16
+ <% end %>
17
+ <%= yield %>
18
+ <%= render 'layouts/footer' %>
19
+ <%= debug(params) if Rails.env.development? %>
20
+ </div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,11 @@
1
+ <li>
2
+ <span class="content"><%= micropost.content %></span>
3
+ <span class="timestamp">
4
+ Posted <%= time_ago_in_words(micropost.created_at) %> ago.
5
+ </span>
6
+ <% if current_user?(micropost.user) %>
7
+ <%= link_to "delete", micropost, method: :delete,
8
+ data: { confirm: "You sure?" },
9
+ title: micropost.content %>
10
+ <% end %>
11
+ </li>