blogit 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +3 -0
  3. data/Rakefile +39 -0
  4. data/app/assets/javascripts/blogit/index.js +1 -0
  5. data/app/assets/stylesheets/blogit/comments.css +16 -0
  6. data/app/assets/stylesheets/blogit/index.css +3 -0
  7. data/app/assets/stylesheets/blogit/posts.css +59 -0
  8. data/app/controllers/blogit/application_controller.rb +41 -0
  9. data/app/controllers/blogit/comments_controller.rb +44 -0
  10. data/app/controllers/blogit/posts_controller.rb +55 -0
  11. data/app/helpers/blogit/application_helper.rb +64 -0
  12. data/app/helpers/blogit/comments_helper.rb +19 -0
  13. data/app/helpers/blogit/posts_helper.rb +26 -0
  14. data/app/models/blogit/comment.rb +59 -0
  15. data/app/models/blogit/post.rb +57 -0
  16. data/app/views/blogit/comments/_comment.html.erb +16 -0
  17. data/app/views/blogit/comments/_form.html.erb +42 -0
  18. data/app/views/blogit/comments/create.js.erb +7 -0
  19. data/app/views/blogit/comments/destroy.js.erb +1 -0
  20. data/app/views/blogit/posts/_blog_post_spacer.html.erb +1 -0
  21. data/app/views/blogit/posts/_blogger_information.html.erb +4 -0
  22. data/app/views/blogit/posts/_comments_count.html.erb +5 -0
  23. data/app/views/blogit/posts/_form.html.erb +43 -0
  24. data/app/views/blogit/posts/_pagination.html.erb +1 -0
  25. data/app/views/blogit/posts/_post.html.erb +19 -0
  26. data/app/views/blogit/posts/_post_body.html.erb +1 -0
  27. data/app/views/blogit/posts/_post_head.html.erb +3 -0
  28. data/app/views/blogit/posts/_post_links.html.erb +5 -0
  29. data/app/views/blogit/posts/edit.html.erb +3 -0
  30. data/app/views/blogit/posts/index.html.erb +10 -0
  31. data/app/views/blogit/posts/new.html.erb +3 -0
  32. data/app/views/blogit/posts/show.html.erb +7 -0
  33. data/config/routes.rb +9 -0
  34. data/db/migrate/20110814091434_create_blog_posts.rb +12 -0
  35. data/db/migrate/20110814093229_create_blog_comments.rb +15 -0
  36. data/db/migrate/20110814103306_acts_as_taggable_on_migration.rb +28 -0
  37. data/lib/blogit.rb +24 -0
  38. data/lib/blogit/blogs.rb +19 -0
  39. data/lib/blogit/configuration.rb +74 -0
  40. data/lib/blogit/engine.rb +14 -0
  41. data/lib/blogit/parsers.rb +5 -0
  42. data/lib/blogit/parsers/html_parser.rb +9 -0
  43. data/lib/blogit/parsers/markdown_parser.rb +21 -0
  44. data/lib/blogit/parsers/textile_parser.rb +13 -0
  45. data/lib/blogit/version.rb +3 -0
  46. data/lib/generators/blogit/USAGE +8 -0
  47. data/lib/generators/blogit/install_generator.rb +15 -0
  48. data/lib/generators/templates/blogit.rb +42 -0
  49. data/lib/tasks/blog_tasks.rake +4 -0
  50. data/lib/validators.rb +3 -0
  51. data/lib/validators/absence_validator.rb +13 -0
  52. data/spec/blogit_spec.rb +20 -0
  53. data/spec/controllers/blogit/comments_controller_spec.rb +111 -0
  54. data/spec/controllers/blogit/posts_controller_spec.rb +261 -0
  55. data/spec/dummy/Rakefile +7 -0
  56. data/spec/dummy/app/assets/javascripts/application.js +3 -0
  57. data/spec/dummy/app/assets/stylesheets/application.css +18 -0
  58. data/spec/dummy/app/controllers/application_controller.rb +19 -0
  59. data/spec/dummy/app/controllers/people_controller.rb +83 -0
  60. data/spec/dummy/app/controllers/sessions_controller.rb +23 -0
  61. data/spec/dummy/app/controllers/users_controller.rb +83 -0
  62. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  63. data/spec/dummy/app/helpers/people_helper.rb +2 -0
  64. data/spec/dummy/app/helpers/sessions_helper.rb +2 -0
  65. data/spec/dummy/app/helpers/users_helper.rb +2 -0
  66. data/spec/dummy/app/models/person.rb +2 -0
  67. data/spec/dummy/app/models/user.rb +11 -0
  68. data/spec/dummy/app/views/layouts/application.html.erb +28 -0
  69. data/spec/dummy/app/views/people/_form.html.erb +21 -0
  70. data/spec/dummy/app/views/people/edit.html.erb +6 -0
  71. data/spec/dummy/app/views/people/index.html.erb +23 -0
  72. data/spec/dummy/app/views/people/new.html.erb +5 -0
  73. data/spec/dummy/app/views/people/show.html.erb +10 -0
  74. data/spec/dummy/app/views/sessions/new.html.erb +17 -0
  75. data/spec/dummy/app/views/users/_form.html.erb +25 -0
  76. data/spec/dummy/app/views/users/edit.html.erb +6 -0
  77. data/spec/dummy/app/views/users/index.html.erb +25 -0
  78. data/spec/dummy/app/views/users/new.html.erb +5 -0
  79. data/spec/dummy/app/views/users/show.html.erb +15 -0
  80. data/spec/dummy/config.ru +4 -0
  81. data/spec/dummy/config/application.rb +25 -0
  82. data/spec/dummy/config/boot.rb +10 -0
  83. data/spec/dummy/config/database.yml +25 -0
  84. data/spec/dummy/config/environment.rb +5 -0
  85. data/spec/dummy/config/environments/development.rb +30 -0
  86. data/spec/dummy/config/environments/production.rb +51 -0
  87. data/spec/dummy/config/environments/test.rb +39 -0
  88. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  89. data/spec/dummy/config/initializers/blogit.rb +40 -0
  90. data/spec/dummy/config/initializers/inflections.rb +10 -0
  91. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  92. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  93. data/spec/dummy/config/initializers/session_store.rb +8 -0
  94. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  95. data/spec/dummy/config/locales/en.yml +5 -0
  96. data/spec/dummy/config/routes.rb +11 -0
  97. data/spec/dummy/db/development.sqlite3 +0 -0
  98. data/spec/dummy/db/migrate/20110814091304_create_users.rb +10 -0
  99. data/spec/dummy/db/migrate/20110819103335_create_people.rb +9 -0
  100. data/spec/dummy/db/schema.rb +71 -0
  101. data/spec/dummy/db/test.sqlite3 +0 -0
  102. data/spec/dummy/log/development.log +21145 -0
  103. data/spec/dummy/log/test.log +32053 -0
  104. data/spec/dummy/public/404.html +26 -0
  105. data/spec/dummy/public/422.html +26 -0
  106. data/spec/dummy/public/500.html +26 -0
  107. data/spec/dummy/public/favicon.ico +0 -0
  108. data/spec/dummy/script/rails +6 -0
  109. data/spec/dummy/test/fixtures/people.yml +7 -0
  110. data/spec/dummy/test/fixtures/users.yml +9 -0
  111. data/spec/dummy/test/functional/people_controller_test.rb +49 -0
  112. data/spec/dummy/test/functional/sessions_controller_test.rb +9 -0
  113. data/spec/dummy/test/functional/users_controller_test.rb +49 -0
  114. data/spec/dummy/test/unit/helpers/people_helper_test.rb +4 -0
  115. data/spec/dummy/test/unit/helpers/sessions_helper_test.rb +4 -0
  116. data/spec/dummy/test/unit/helpers/users_helper_test.rb +4 -0
  117. data/spec/dummy/test/unit/person_test.rb +7 -0
  118. data/spec/dummy/test/unit/user_test.rb +7 -0
  119. data/spec/dummy/tmp/cache/assets/BC4/870/sprockets%2F64a399278031122c8576726e146081d5 +0 -0
  120. data/spec/dummy/tmp/cache/assets/C49/710/sprockets%2F8a389a2323475a7053fc419c4103814f +0 -0
  121. data/spec/dummy/tmp/cache/assets/C9E/F00/sprockets%2Fdbb1755717649d42fe9df99326657618 +0 -0
  122. data/spec/dummy/tmp/cache/assets/CAA/0C0/sprockets%2Feec4505e23136c45e543a609b0c69554 +0 -0
  123. data/spec/dummy/tmp/cache/assets/CDE/240/sprockets%2Fcf7da81f64139020d3a4a78f904609c4 +0 -0
  124. data/spec/dummy/tmp/cache/assets/CEF/560/sprockets%2Fa1bf08ab120c72351b460a65e4800af6 +0 -0
  125. data/spec/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
  126. data/spec/dummy/tmp/cache/assets/D08/D50/sprockets%2F36daa544802ddf93249b8d07dab81125 +0 -0
  127. data/spec/dummy/tmp/cache/assets/D0A/410/sprockets%2F7e74a40717d2324f9a30ddff29ea5124 +0 -0
  128. data/spec/dummy/tmp/cache/assets/D0E/C00/sprockets%2F3091a34f307d562f44ee24f4c776baa9 +0 -0
  129. data/spec/dummy/tmp/cache/assets/D0F/180/sprockets%2F1ea0059d1fca1d25898ff37c7c150944 +0 -0
  130. data/spec/dummy/tmp/cache/assets/D10/610/sprockets%2F5883b6e94dcea7e32d57de13201563c3 +0 -0
  131. data/spec/dummy/tmp/cache/assets/D11/D20/sprockets%2Fcac21eac42152981882bf9e489316af4 +0 -0
  132. data/spec/dummy/tmp/cache/assets/D1F/730/sprockets%2F2f81ed50f6f293b326c576a8528ce9f3 +0 -0
  133. data/spec/dummy/tmp/cache/assets/D22/380/sprockets%2Fda1670e413fe4633d84eb9394fd7797c +0 -0
  134. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  135. data/spec/dummy/tmp/cache/assets/D33/240/sprockets%2Ffd4446a4ab97006a073ba30d57fdd617 +0 -0
  136. data/spec/dummy/tmp/cache/assets/D34/140/sprockets%2F0d8b2740eca50a83fc91e51292f9f00c +0 -0
  137. data/spec/dummy/tmp/cache/assets/D34/680/sprockets%2Fb2cb3891a4cb197ecb1a37299d14c531 +0 -0
  138. data/spec/dummy/tmp/cache/assets/D3C/3A0/sprockets%2F40c65286b76c2cbc9d2bd92a60e7f126 +0 -0
  139. data/spec/dummy/tmp/cache/assets/D3D/C40/sprockets%2F4654852579bc0bea406bcd54d38a7dc3 +0 -0
  140. data/spec/dummy/tmp/cache/assets/D46/650/sprockets%2Ff56253b5f374fff1a33fbbc9881c9124 +0 -0
  141. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  142. data/spec/dummy/tmp/cache/assets/D58/1E0/sprockets%2Fdd863e40bd669f77bb549b257d88d6b5 +0 -0
  143. data/spec/dummy/tmp/cache/assets/D61/6F0/sprockets%2F02da53eeca228bcef0c49278517111fe +0 -0
  144. data/spec/dummy/tmp/cache/assets/D63/720/sprockets%2Fe625e6b0d13c0bd8ca548a48e1d4508b +0 -0
  145. data/spec/dummy/tmp/cache/assets/D70/D70/sprockets%2Fc9ac544160bbcc29d775b54ca8f0269f +0 -0
  146. data/spec/dummy/tmp/cache/assets/D73/220/sprockets%2F3dbc0a37f98fb43ec819b85a64d32c55 +0 -0
  147. data/spec/dummy/tmp/cache/assets/D7A/BD0/sprockets%2Ff645c87585af5bf4be27a271f20b39ff +0 -0
  148. data/spec/dummy/tmp/cache/assets/D80/960/sprockets%2F269feebf3271f38b09bd01e9b748f77d +0 -0
  149. data/spec/dummy/tmp/cache/assets/D82/800/sprockets%2F72f633d76779cbfb7d9a57b5623c3faf +0 -0
  150. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  151. data/spec/dummy/tmp/cache/assets/D8D/EA0/sprockets%2Fe64949cb167a0aa27a33a1adf1d544be +0 -0
  152. data/spec/dummy/tmp/cache/assets/DCA/9B0/sprockets%2Fdf0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
  153. data/spec/dummy/tmp/cache/assets/DF3/BA0/sprockets%2Ffddeae525be5a563ca0d194b614bf64b +0 -0
  154. data/spec/dummy/tmp/cache/assets/DFF/B40/sprockets%2Fe0d60af9df95b2a58c278acd3f2beb55 +0 -0
  155. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  156. data/spec/dummy/tmp/cache/assets/E0A/870/sprockets%2Fbba31cc2875be0fddf5901fef9b99e48 +0 -0
  157. data/spec/dummy/tmp/cache/assets/E27/590/sprockets%2F097d2347f3f9d2ec19abefaaa5dd0ec1 +0 -0
  158. data/spec/dummy/tmp/cache/assets/E30/DC0/sprockets%2F9ddd7093ee1d47cbacd526f4bdd36e3c +0 -0
  159. data/spec/dummy/tmp/cache/assets/E49/530/sprockets%2F10dadda372ee79deb251d7bbbb025cec +0 -0
  160. data/spec/dummy/tmp/cache/assets/E82/4C0/sprockets%2F0d49c3fa07b559dbecbaabf2a4bad9c8 +0 -0
  161. data/spec/dummy/tmp/pids/server.pid +1 -0
  162. data/spec/factories.rb +28 -0
  163. data/spec/helpers/blogit/application_helper_spec.rb +14 -0
  164. data/spec/helpers/blogit/posts_helper_spec.rb +34 -0
  165. data/spec/lib/blogs_spec.rb +23 -0
  166. data/spec/lib/configuration_spec.rb +57 -0
  167. data/spec/lib/parsers/html_parser_spec.rb +12 -0
  168. data/spec/lib/parsers/markdown_parser_spec.rb +12 -0
  169. data/spec/lib/parsers/textile_parser_spec.rb +12 -0
  170. data/spec/models/blogit/comment_spec.rb +64 -0
  171. data/spec/models/blogit/post_spec.rb +153 -0
  172. data/spec/spec_helper.rb +16 -0
  173. data/spec/support/authentication.rb +9 -0
  174. data/spec/support/configuration.rb +5 -0
  175. metadata +415 -0
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require_tree .
@@ -0,0 +1,18 @@
1
+ /* =================================== */
2
+ /* = Some CSS for the dummy app only = */
3
+ /* =================================== */
4
+
5
+ /* *= require_tree . */
6
+ body{
7
+ font-size: 15px;
8
+ line-height: 1.5em;
9
+ font-family: verdana, sans-serif;
10
+ }
11
+ #content, footer{
12
+ width: 800px;
13
+ margin: 0 auto;
14
+ }
15
+ footer#application_footer{
16
+ text-align:center;
17
+ }
18
+
@@ -0,0 +1,19 @@
1
+ class ApplicationController < ActionController::Base
2
+
3
+ protect_from_forgery
4
+
5
+ helper_method :current_user
6
+
7
+ def current_user
8
+ # session[:user_id] = User.first.id
9
+ @current_user ||= User.find_by_id(session[:user_id])
10
+ end
11
+
12
+ def login_required
13
+ unless current_user
14
+ flash[:warn] = "You must be logged in to view that page!"
15
+ redirect_to root_url
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,83 @@
1
+ class PeopleController < ApplicationController
2
+ # GET /people
3
+ # GET /people.json
4
+ def index
5
+ @people = Person.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @people }
10
+ end
11
+ end
12
+
13
+ # GET /people/1
14
+ # GET /people/1.json
15
+ def show
16
+ @person = Person.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @person }
21
+ end
22
+ end
23
+
24
+ # GET /people/new
25
+ # GET /people/new.json
26
+ def new
27
+ @person = Person.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @person }
32
+ end
33
+ end
34
+
35
+ # GET /people/1/edit
36
+ def edit
37
+ @person = Person.find(params[:id])
38
+ end
39
+
40
+ # POST /people
41
+ # POST /people.json
42
+ def create
43
+ @person = Person.new(params[:person])
44
+
45
+ respond_to do |format|
46
+ if @person.save
47
+ format.html { redirect_to @person, notice: 'Person was successfully created.' }
48
+ format.json { render json: @person, status: :created, location: @person }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @person.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /people/1
57
+ # PUT /people/1.json
58
+ def update
59
+ @person = Person.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @person.update_attributes(params[:person])
63
+ format.html { redirect_to @person, notice: 'Person was successfully updated.' }
64
+ format.json { head :ok }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @person.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /people/1
73
+ # DELETE /people/1.json
74
+ def destroy
75
+ @person = Person.find(params[:id])
76
+ @person.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to people_url }
80
+ format.json { head :ok }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,23 @@
1
+ class SessionsController < ApplicationController
2
+
3
+ expose(:user) { User.authenticate(params[:session]) }
4
+
5
+ def new
6
+ end
7
+
8
+ def create
9
+ if user
10
+ @current_user = user
11
+ session[:user_id] = user.id
12
+ redirect_to(root_url, notice: "Successfully logged in!")
13
+ else
14
+ render :new
15
+ end
16
+ end
17
+
18
+ def destroy
19
+ @current_user = session[:user_id] = nil
20
+ redirect_to(root_url, notice: "Successfully logged out!")
21
+ end
22
+
23
+ end
@@ -0,0 +1,83 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.json
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.json
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.json
26
+ def new
27
+ @user = User.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @user }
32
+ end
33
+ end
34
+
35
+ # GET /users/1/edit
36
+ def edit
37
+ @user = User.find(params[:id])
38
+ end
39
+
40
+ # POST /users
41
+ # POST /users.json
42
+ def create
43
+ @user = User.new(params[:user])
44
+
45
+ respond_to do |format|
46
+ if @user.save
47
+ format.html { redirect_to @user, notice: 'User was successfully created.' }
48
+ format.json { render json: @user, status: :created, location: @user }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @user.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /users/1
57
+ # PUT /users/1.json
58
+ def update
59
+ @user = User.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @user.update_attributes(params[:user])
63
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
64
+ format.json { head :ok }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @user.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /users/1
73
+ # DELETE /users/1.json
74
+ def destroy
75
+ @user = User.find(params[:id])
76
+ @user.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to users_url }
80
+ format.json { head :ok }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PeopleHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module SessionsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class Person < ActiveRecord::Base
2
+ end
@@ -0,0 +1,11 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ # this is where the magic happens
4
+ blogs
5
+
6
+ # Find the User by username and password
7
+ def self.authenticate(attribute_hash)
8
+ find_by_username_and_password(attribute_hash[:username], attribute_hash[:password])
9
+ end
10
+
11
+ end
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "blogit", "application" %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+
10
+ <div id="content">
11
+
12
+ <% if current_user %>
13
+ <%= link_to("log out", main_app.session_path, method: :delete) %>
14
+ <% else %>
15
+ <%= link_to("log in", main_app.new_session_path) %>
16
+ <% end %>
17
+
18
+ <h1><%= link_to("My Awesome Blog", root_path) %></h1>
19
+
20
+ <%= yield %>
21
+ </div>
22
+
23
+ <footer id="application_footer">
24
+ By <%= link_to("Gavin Morrice", "http://gavinmorrice.com") %>
25
+ </footer>
26
+ <%= javascript_include_tag "blogit", "application" %>
27
+ </body>
28
+ </html>
@@ -0,0 +1,21 @@
1
+ <%= form_for(@person) do |f| %>
2
+ <% if @person.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @person.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="actions">
19
+ <%= f.submit %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing person</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @person %> |
6
+ <%= link_to 'Back', people_path %>
@@ -0,0 +1,23 @@
1
+ <h1>Listing people</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th></th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+
11
+ <% @people.each do |person| %>
12
+ <tr>
13
+ <td><%= person.name %></td>
14
+ <td><%= link_to 'Show', person %></td>
15
+ <td><%= link_to 'Edit', edit_person_path(person) %></td>
16
+ <td><%= link_to 'Destroy', person, confirm: 'Are you sure?', method: :delete %></td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'New Person', new_person_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New person</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', people_path %>
@@ -0,0 +1,10 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Name:</b>
5
+ <%= @person.name %>
6
+ </p>
7
+
8
+
9
+ <%= link_to 'Edit', edit_person_path(@person) %> |
10
+ <%= link_to 'Back', people_path %>
@@ -0,0 +1,17 @@
1
+ <%= form_tag(session_path) do %>
2
+
3
+ <div class="field">
4
+ <%= label(:session, :username) %><br>
5
+ <%= text_field(:session, :username) %>
6
+ </div>
7
+
8
+ <div class="field">
9
+ <%= label(:session, :password) %><br>
10
+ <%= password_field(:session, :password) %>
11
+ </field>
12
+
13
+ <div class="actions">
14
+ <%= submit_tag("Log in") %>
15
+ </div>
16
+
17
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :username %><br />
16
+ <%= f.text_field :username %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :password %><br />
20
+ <%= f.text_field :password %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,25 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Username</th>
6
+ <th>Password</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+
12
+ <% @users.each do |user| %>
13
+ <tr>
14
+ <td><%= user.username %></td>
15
+ <td><%= user.password %></td>
16
+ <td><%= link_to 'Show', user %></td>
17
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
18
+ <td><%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+
23
+ <br />
24
+
25
+ <%= link_to 'New User', new_user_path %>