validation_sync 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/generate_validations.js.erb +138 -0
  3. data/app/assets/javascripts/validation_sync.js +2 -1
  4. data/app/helpers/validation_sync_form_helper.rb +12 -71
  5. data/lib/validation_sync/engine.rb +2 -0
  6. data/lib/validation_sync/validation_builder.rb +139 -0
  7. data/lib/validation_sync/version.rb +1 -1
  8. data/lib/validation_sync.rb +1 -0
  9. data/spec/dummy/app/controllers/posts_controller.rb +1 -1
  10. data/spec/dummy/app/controllers/users_controller.rb +58 -0
  11. data/spec/dummy/app/models/post.rb +15 -4
  12. data/spec/dummy/app/models/user.rb +11 -0
  13. data/spec/dummy/app/views/posts/_form.html.erb +8 -0
  14. data/spec/dummy/app/views/posts/show.html.erb +5 -0
  15. data/spec/dummy/app/views/users/_form.html.erb +33 -0
  16. data/spec/dummy/app/views/users/edit.html.erb +6 -0
  17. data/spec/dummy/app/views/users/index.html.erb +29 -0
  18. data/spec/dummy/app/views/users/new.html.erb +5 -0
  19. data/spec/dummy/app/views/users/show.html.erb +14 -0
  20. data/spec/dummy/config/application.rb +1 -0
  21. data/spec/dummy/config/routes.rb +3 -0
  22. data/spec/dummy/db/development.sqlite3 +0 -0
  23. data/spec/dummy/db/migrate/20140211200846_create_users.rb +10 -0
  24. data/spec/dummy/db/migrate/20140212170448_add_order_to_posts.rb +5 -0
  25. data/spec/dummy/db/migrate/20140212173012_add_user_id_to_posts.rb +5 -0
  26. data/spec/dummy/db/schema.rb +10 -1
  27. data/spec/dummy/db/test.sqlite3 +0 -0
  28. data/spec/dummy/log/development.log +7256 -0
  29. data/spec/dummy/log/test.log +6037 -0
  30. data/spec/dummy/spec/factories/posts.rb +26 -0
  31. data/spec/dummy/spec/factories/users.rb +14 -0
  32. data/spec/dummy/spec/models/post_spec.rb +98 -0
  33. data/spec/dummy/spec/models/user_spec.rb +27 -0
  34. data/spec/dummy/tmp/cache/assets/development/sprockets/10c6f05e183df4466be1e0171868fbd3 +0 -0
  35. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  36. data/spec/dummy/tmp/cache/assets/development/sprockets/254f7fcb30f60607963da8bbb320eb25 +0 -0
  37. data/spec/dummy/tmp/cache/assets/development/sprockets/256916ba749d0c14e36b55d4b382e9f5 +0 -0
  38. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  39. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  40. data/spec/dummy/tmp/cache/assets/development/sprockets/38ec44893aed52b20a20a929a47e0ad9 +0 -0
  41. data/spec/dummy/tmp/cache/assets/development/sprockets/4a4d6fda449d6b443e5b29ccb755c732 +0 -0
  42. data/spec/dummy/tmp/cache/assets/development/sprockets/513dd40b9b52367f54d64438a9d802b9 +0 -0
  43. data/spec/dummy/tmp/cache/assets/development/sprockets/56146675dbad13c72d3eb9ebd823dc11 +0 -0
  44. data/spec/dummy/tmp/cache/assets/development/sprockets/7aaf7da4e6ec4c84cc7948fb20c35064 +0 -0
  45. data/spec/dummy/tmp/cache/assets/development/sprockets/ba165ee56ce37f61865fe03d6503539b +0 -0
  46. data/spec/dummy/tmp/cache/assets/development/sprockets/bfaeb96080cc4d8ba400fbdcd1d4aab2 +0 -0
  47. data/spec/dummy/tmp/cache/assets/development/sprockets/c4f1b332263aa5004a8ac54ca9530510 +0 -0
  48. data/spec/dummy/tmp/cache/assets/development/sprockets/c63406c52c03bbb24922ded6ebb0e0a2 +0 -0
  49. data/spec/dummy/tmp/cache/assets/development/sprockets/cbc66bd36b3aa4411f9ce20da0fd37a0 +0 -0
  50. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  51. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  52. data/spec/dummy/tmp/cache/assets/development/sprockets/d7874cf8a5946ec3899e5bb627905ca5 +0 -0
  53. data/spec/dummy/tmp/cache/assets/development/sprockets/e1d4998592ddfea795aca82d742d9478 +0 -0
  54. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  55. data/spec/dummy/tmp/cache/assets/test/sprockets/0f11e0b3e0ece93d6c047318f2e5497d +0 -0
  56. data/spec/dummy/tmp/cache/assets/test/sprockets/10c6f05e183df4466be1e0171868fbd3 +0 -0
  57. data/spec/dummy/tmp/cache/assets/test/sprockets/122e92d06837af295d6c941999a8d48f +0 -0
  58. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  59. data/spec/dummy/tmp/cache/assets/test/sprockets/254f7fcb30f60607963da8bbb320eb25 +0 -0
  60. data/spec/dummy/tmp/cache/assets/test/sprockets/256916ba749d0c14e36b55d4b382e9f5 +0 -0
  61. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  62. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  63. data/spec/dummy/tmp/cache/assets/test/sprockets/4a4d6fda449d6b443e5b29ccb755c732 +0 -0
  64. data/spec/dummy/tmp/cache/assets/test/sprockets/56146675dbad13c72d3eb9ebd823dc11 +0 -0
  65. data/spec/dummy/tmp/cache/assets/test/sprockets/bfaeb96080cc4d8ba400fbdcd1d4aab2 +0 -0
  66. data/spec/dummy/tmp/cache/assets/test/sprockets/c4f1b332263aa5004a8ac54ca9530510 +0 -0
  67. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  68. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  69. data/spec/dummy/tmp/cache/assets/test/sprockets/d7874cf8a5946ec3899e5bb627905ca5 +0 -0
  70. data/spec/dummy/tmp/cache/assets/test/sprockets/e1d4998592ddfea795aca82d742d9478 +0 -0
  71. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  72. data/spec/dummy/tmp/capybara/capybara-201402111733312899331645.html +39 -0
  73. data/spec/dummy/tmp/capybara/capybara-201402111742049902988712.html +39 -0
  74. data/spec/dummy/tmp/capybara/capybara-201402111743461497527818.html +39 -0
  75. data/spec/dummy/tmp/capybara/capybara-201402121034216891460553.html +39 -0
  76. data/spec/dummy/tmp/capybara/capybara-201402121100145511229652.html +39 -0
  77. data/spec/dummy/tmp/capybara/capybara-20140212110749239625833.html +39 -0
  78. data/spec/dummy/tmp/capybara/capybara-201402121110009350488348.html +39 -0
  79. data/spec/dummy/tmp/capybara/capybara-201402121242315707153414.html +54 -0
  80. data/spec/dummy/tmp/capybara/capybara-2014021212463939561980.html +47 -0
  81. data/spec/dummy/tmp/capybara/capybara-201402121308362867044001.html +47 -0
  82. data/spec/dummy/tmp/capybara/capybara-201402121309286432044699.html +47 -0
  83. data/spec/dummy/tmp/capybara/capybara-201402121506235794052148.html +39 -0
  84. data/spec/dummy/tmp/capybara/capybara-201402121507316558835315.html +27 -0
  85. data/spec/dummy/tmp/capybara/capybara-201402121512202956445364.html +39 -0
  86. data/spec/dummy/tmp/capybara/capybara-201402121517176338336364.html +39 -0
  87. data/spec/dummy/tmp/capybara/capybara-201402121518121290133083.html +39 -0
  88. data/spec/dummy/tmp/pids/server.pid +1 -0
  89. data/spec/features/form_interactions_spec.rb +153 -0
  90. data/spec/features/generate_validations_spec.rb +26 -0
  91. data/spec/helpers/validation_sync_form_helper_spec.rb +24 -0
  92. data/spec/lib/validation_builder_spec.rb +173 -0
  93. data/spec/spec_helper.rb +7 -1
  94. metadata +120 -11
  95. data/app/assets/javascripts/validations.js.coffee.erb +0 -51
  96. data/spec/dummy/app/assets/javascripts/posts.js +0 -2
  97. data/spec/dummy/app/assets/stylesheets/posts.css +0 -4
  98. data/spec/features/form_validation_spec.rb +0 -53
  99. data/spec/helpers/form_helper_spec.rb +0 -4
@@ -0,0 +1,26 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :post do
4
+
5
+ sequence :title do
6
+ titles = [
7
+ "Take out the garbage",
8
+ "Do the dishes",
9
+ "Empty the Litter box",
10
+ "Clean the shower",
11
+ "Scrub the toilet",
12
+ "Dust the tv",
13
+ "Feed the dog"
14
+ ]
15
+ titles.sample
16
+ end
17
+
18
+ content "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
19
+ author_email "jason.bourne@example.com"
20
+ view_count 0
21
+ order 1
22
+ user_id 1
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,14 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+
5
+ sequence :email do |n|
6
+ "email#{n}@example.com"
7
+ end
8
+
9
+ factory :user do
10
+ email
11
+ password "password!"
12
+ end
13
+
14
+ end
@@ -0,0 +1,98 @@
1
+ require 'spec_helper'
2
+
3
+ describe Post do
4
+
5
+ it "creates a valid record" do
6
+ post = build(:post)
7
+ post.should be_valid
8
+ end
9
+
10
+ describe "validations" do
11
+
12
+ describe "title" do
13
+ it "requires a title" do
14
+ post = build(:post, title: "")
15
+ post.should_not be_valid
16
+ end
17
+
18
+ it "has a custom validation message for 'title'" do
19
+ post = build(:post, title: "")
20
+ post.valid?
21
+ expect(post.errors.messages[:title]).to include('You need a title, bro.')
22
+ end
23
+
24
+ it "has a min title length of 5" do
25
+ # 4 characters
26
+ post = build(:post, title: "1234")
27
+ post.should_not be_valid
28
+ end
29
+ end
30
+
31
+ describe "content" do
32
+ it "requires content" do
33
+ post = build(:post, content: "")
34
+ post.should_not be_valid
35
+ end
36
+
37
+ it "has a max content length of 140" do
38
+ # 141 characters
39
+ post = build(:post, content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc iaculis tincidunt condimentum. Suspendisse interdum posuere tortor vitae amete.")
40
+ post.should_not be_valid
41
+ end
42
+
43
+ it "create's a valid record, if the content is 140 characters or less" do
44
+ # 140 characters
45
+ post = build(:post, content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc iaculis tincidunt condimentum. Suspendisse interdum posuere tortor vitae amete")
46
+ post.should be_valid
47
+ end
48
+ end
49
+
50
+ describe "view_count" do
51
+ it "requires a view count" do
52
+ post = build(:post, view_count: nil)
53
+ post.should_not be_valid
54
+ end
55
+
56
+ it "can't have letters in its view_count" do
57
+ post = build(:post, view_count: "123a")
58
+ post.should_not be_valid
59
+ end
60
+
61
+ it "can't have punctuation in its view_count" do
62
+ post = build(:post, view_count: "123,")
63
+ post.should_not be_valid
64
+ end
65
+ end
66
+
67
+ describe "order" do
68
+ it "can't have letters in its order" do
69
+ post = build(:post, order: "123a")
70
+ post.should_not be_valid
71
+ end
72
+
73
+ it "can't have punctuation in its order" do
74
+ post = build(:post, order: "123,")
75
+ post.should_not be_valid
76
+ end
77
+ end
78
+
79
+ describe "user_id" do
80
+
81
+ it "requires a user_id" do
82
+ post = build(:post, user_id: "")
83
+ post.should_not be_valid
84
+ end
85
+
86
+ it "can't have letters in its user_id" do
87
+ post = build(:post, user_id: "123a")
88
+ post.should_not be_valid
89
+ end
90
+
91
+ it "can't have punctuation in its user_id" do
92
+ post = build(:post, user_id: "123,")
93
+ post.should_not be_valid
94
+ end
95
+ end
96
+
97
+ end
98
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe User do
4
+
5
+ it "creates a valid record" do
6
+ user = build(:user)
7
+ user.should be_valid
8
+ end
9
+
10
+
11
+ describe "validations" do
12
+
13
+ it "requires an email confirmation" do
14
+ user = build(:user)
15
+ user.email_confirmation = "different.email@example.com"
16
+ expect(user).not_to be_valid
17
+ end
18
+
19
+ it "requires a password confirmation" do
20
+ user = build(:user)
21
+ user.password_confirmation = "different_Password"
22
+ expect(user).not_to be_valid
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]"></textarea>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text">
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_author_email">Author email</label><br>
27
+ <input id="post_author_email" name="post[author_email]" type="text">
28
+ </div>
29
+ <div class="actions">
30
+ <input name="commit" type="submit" value="Create Post">
31
+ </div>
32
+ </form>
33
+
34
+ <a href="/posts">Back</a>
35
+
36
+
37
+
38
+
39
+ </body></html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]"></textarea>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text">
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_author_email">Author email</label><br>
27
+ <input id="post_author_email" name="post[author_email]" type="text">
28
+ </div>
29
+ <div class="actions">
30
+ <input name="commit" type="submit" value="Create Post">
31
+ </div>
32
+ </form>
33
+
34
+ <a href="/posts">Back</a>
35
+
36
+
37
+
38
+
39
+ </body></html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]"></textarea>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text">
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_author_email">Author email</label><br>
27
+ <input id="post_author_email" name="post[author_email]" type="text">
28
+ </div>
29
+ <div class="actions">
30
+ <input name="commit" type="submit" value="Create Post">
31
+ </div>
32
+ </form>
33
+
34
+ <a href="/posts">Back</a>
35
+
36
+
37
+
38
+
39
+ </body></html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]"></textarea>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text">
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_author_email">Author email</label><br>
27
+ <input id="post_author_email" name="post[author_email]" type="text">
28
+ </div>
29
+ <div class="actions">
30
+ <input name="commit" type="submit" value="Create Post">
31
+ </div>
32
+ </form>
33
+
34
+ <a href="/posts">Back</a>
35
+
36
+
37
+
38
+
39
+ </body></html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]"></textarea>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text">
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_author_email">Author email</label><br>
27
+ <input id="post_author_email" name="post[author_email]" type="text">
28
+ </div>
29
+ <div class="actions">
30
+ <input name="commit" type="submit" value="Create Post">
31
+ </div>
32
+ </form>
33
+
34
+ <a href="/posts">Back</a>
35
+
36
+
37
+
38
+
39
+ </body></html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text" class="valid">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]" class="error"></textarea><label for="post_content" class="error"></label>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text" class="error"><label for="post_view_count" class="error"></label>
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_author_email">Author email</label><br>
27
+ <input id="post_author_email" name="post[author_email]" type="text">
28
+ </div>
29
+ <div class="actions">
30
+ <input name="commit" type="submit" value="Create Post">
31
+ </div>
32
+ </form>
33
+
34
+ <a href="/posts">Back</a>
35
+
36
+
37
+
38
+
39
+ </body></html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text" class="valid">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]" class="error"></textarea><label for="post_content" class="error"></label>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text" class="error"><label for="post_view_count" class="error"></label>
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_author_email">Author email</label><br>
27
+ <input id="post_author_email" name="post[author_email]" type="text">
28
+ </div>
29
+ <div class="actions">
30
+ <input name="commit" type="submit" value="Create Post">
31
+ </div>
32
+ </form>
33
+
34
+ <a href="/posts">Back</a>
35
+
36
+
37
+
38
+
39
+ </body></html>
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+ <div id="error_explanation">
13
+ <h2>1 error prohibited this post from being saved:</h2>
14
+
15
+ <ul>
16
+ <li>User User ID Must be a number.</li>
17
+ </ul>
18
+ </div>
19
+
20
+ <div class="field">
21
+ <label for="post_title">Title</label><br>
22
+ <input id="post_title" name="post[title]" type="text" value="Scrub the toilet">
23
+ </div>
24
+ <div class="field">
25
+ <label for="post_content">Content</label><br>
26
+ <textarea id="post_content" name="post[content]">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</textarea>
27
+ </div>
28
+ <div class="field">
29
+ <label for="post_view_count">View count</label><br>
30
+ <input id="post_view_count" name="post[view_count]" type="text" value="0">
31
+ </div>
32
+ <div class="field">
33
+ <label for="post_order">Order</label><br>
34
+ <input id="post_order" name="post[order]" type="text" value="1">
35
+ </div>
36
+ <div class="field">
37
+ <label for="post_author_email">Author email</label><br>
38
+ <input id="post_author_email" name="post[author_email]" type="text" value="">
39
+ </div>
40
+ <div class="field">
41
+ <div class="field_with_errors"><label for="post_user_id">User</label></div><br>
42
+ <div class="field_with_errors"><input id="post_user_id" name="post[user_id]" type="text"></div>
43
+ </div>
44
+ <div class="actions">
45
+ <input name="commit" type="submit" value="Create Post">
46
+ </div>
47
+ </form>
48
+
49
+ <a href="/posts">Back</a>
50
+
51
+
52
+
53
+
54
+ </body></html>
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link data-turbolinks-track="true" href="/assets/application.css" media="all" rel="stylesheet">
4
+ <script data-turbolinks-track="true" src="/assets/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>New post</h1>
10
+
11
+ <form accept-charset="UTF-8" action="/posts" class="new_post" data-sync-validations="true" id="new_post" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
12
+
13
+ <div class="field">
14
+ <label for="post_title">Title</label><br>
15
+ <input id="post_title" name="post[title]" type="text" class="valid">
16
+ </div>
17
+ <div class="field">
18
+ <label for="post_content">Content</label><br>
19
+ <textarea id="post_content" name="post[content]" class="valid"></textarea>
20
+ </div>
21
+ <div class="field">
22
+ <label for="post_view_count">View count</label><br>
23
+ <input id="post_view_count" name="post[view_count]" type="text" class="valid">
24
+ </div>
25
+ <div class="field">
26
+ <label for="post_order">Order</label><br>
27
+ <input id="post_order" name="post[order]" type="text" class="valid">
28
+ </div>
29
+ <div class="field">
30
+ <label for="post_author_email">Author email</label><br>
31
+ <input id="post_author_email" name="post[author_email]" type="text" class="error"><label for="post_author_email" class="error"></label>
32
+ </div>
33
+ <div class="field">
34
+ <label for="post_user_id">User</label><br>
35
+ <input id="post_user_id" name="post[user_id]" type="text" class="error"><label for="post_user_id" class="error"></label>
36
+ </div>
37
+ <div class="actions">
38
+ <input name="commit" type="submit" value="Create Post">
39
+ </div>
40
+ </form>
41
+
42
+ <a href="/posts">Back</a>
43
+
44
+
45
+
46
+
47
+ </body></html>