form_creation 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/app/assets/stylesheets/form_creation/posts.css +7 -0
- data/app/controllers/form_creation/posts_controller.rb +1 -1
- data/app/views/form_creation/posts/edit.html.erb +12 -14
- data/app/views/form_creation/posts/index.html.erb +7 -7
- data/app/views/form_creation/posts/new.html.erb +11 -13
- data/app/views/form_creation/posts/show.html.erb +18 -2
- data/app/views/layouts/form_creation/application.html.erb +1 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20191014040009_create_form_creation_posts.rb +2 -2
- data/lib/form_creation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eedf3c04235a05871edfbcbdd522538868f2886560ce7259e2d4973c8be231a
|
4
|
+
data.tar.gz: 75a913d71eb2067c9061f50acbb2fa2a13d7f16281b8723fa1f3150ca7bbe173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d308584985c7971cc1a9ed7418671ece753644eaa0edce23546cbc988f499f7a2a404cba9b857fe8824152344ed17bfb15fcea8adf2354e270514a1a582c2fcb
|
7
|
+
data.tar.gz: 424ced95e950bd9235bce626f3eab6c6c6a0a8c1d2ff0d19aa04f2805146db7e43bbc48ce7ed63a1e3e2568c9424366b00950b2c4cb04ed977357245ba7d1495
|
data/README.md
CHANGED
@@ -20,6 +20,17 @@ Or install it yourself as:
|
|
20
20
|
```bash
|
21
21
|
$ gem install form_creation
|
22
22
|
```
|
23
|
+
## Migration
|
24
|
+
$ rails form_creation:install:migrations
|
25
|
+
|
26
|
+
$ rails db:migrate
|
27
|
+
|
28
|
+
## Routes
|
29
|
+
mount FormCreation::Engine => "/form_creation"
|
30
|
+
|
31
|
+
root :to => "posts#new"
|
32
|
+
## Visit
|
33
|
+
http://localhost:3000/form_creation
|
23
34
|
|
24
35
|
## Contributing
|
25
36
|
Contribution directions go here.
|
@@ -2,3 +2,10 @@
|
|
2
2
|
Place all the styles related to the matching controller here.
|
3
3
|
They will automatically be included in application.css.
|
4
4
|
*/
|
5
|
+
.post {
|
6
|
+
width: 400px !important;
|
7
|
+
margin: 70px auto !important;
|
8
|
+
border: 1px solid #ccc;
|
9
|
+
padding: 32px;
|
10
|
+
border-radius: 3px;
|
11
|
+
}
|
@@ -1,30 +1,28 @@
|
|
1
|
-
<div class="container">
|
1
|
+
<div class="container post">
|
2
2
|
<%= form_for @post, url: {action: :update} do |f| %>
|
3
3
|
<div>
|
4
|
-
<h3>Update
|
4
|
+
<h3>Update Post</h3>
|
5
5
|
</div>
|
6
6
|
<div>
|
7
7
|
<p>
|
8
8
|
<%= "<div>#{@post.errors.full_messages.first}</div>".html_safe if @post.errors.any? %>
|
9
|
-
<div>
|
9
|
+
<div class="form-group">
|
10
10
|
<label>Title</label>
|
11
|
-
<%= f.text_field :title %>
|
11
|
+
<%= f.text_field :title, class: "form-control" %>
|
12
12
|
</div>
|
13
|
-
|
14
|
-
<div>
|
13
|
+
<div class="form-group">
|
15
14
|
<label>Description</label>
|
16
|
-
<%= f.
|
15
|
+
<%= f.text_area :description, class: "form-control", rows: "5", cols: "10", style: "resize:none;" %>
|
17
16
|
</div>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<%= f.text_field :created_by %>
|
17
|
+
<div class="form-group">
|
18
|
+
<label>Created_by</label>
|
19
|
+
<%= f.text_field :created_by, class: "form-control" %>
|
22
20
|
</div>
|
23
21
|
</p>
|
24
22
|
</div>
|
25
|
-
<div>
|
26
|
-
|
27
|
-
|
23
|
+
<div class="row">
|
24
|
+
<div class="col-md-8"><%= link_to 'Back', posts_path, class: "btn btn-info" %></div>
|
25
|
+
<div class="col-md-4"><%= f.submit 'Update Post', class: "btn btn-success" %></div>
|
28
26
|
</div>
|
29
27
|
<% end %>
|
30
28
|
</div>
|
@@ -1,5 +1,8 @@
|
|
1
1
|
<div class="container" style="margin-top: 70px;">
|
2
|
-
<h3>Posts</h3>
|
2
|
+
<h3>Posts</h3>
|
3
|
+
<div style="margin-bottom: 10px;">
|
4
|
+
<%= link_to 'Add User', new_post_path, class: "btn btn-success" %>
|
5
|
+
</div>
|
3
6
|
<table class="table table-striped">
|
4
7
|
<thead>
|
5
8
|
<tr>
|
@@ -16,15 +19,12 @@
|
|
16
19
|
<td><%= p.description %></td>
|
17
20
|
<td><%= p.created_by %></td>
|
18
21
|
<td>
|
19
|
-
<%= link_to 'Show', post_path(p) %>
|
20
|
-
<%= link_to 'Edit', edit_post_path(p) %>
|
21
|
-
<%= link_to 'Delete', post_path(p), method: :delete %>
|
22
|
+
<%= link_to 'Show', post_path(p), class: "btn btn-info" %>
|
23
|
+
<%= link_to 'Edit', edit_post_path(p), class: "btn btn-warning"%>
|
24
|
+
<%= link_to 'Delete', post_path(p), method: :delete, class: "btn btn-danger" %>
|
22
25
|
</td>
|
23
26
|
</tr>
|
24
27
|
<% end %>
|
25
28
|
</tbody>
|
26
29
|
</table>
|
27
30
|
</div>
|
28
|
-
<div>
|
29
|
-
<%= link_to 'Add User', new_post_path %>
|
30
|
-
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="container">
|
1
|
+
<div class="container post">
|
2
2
|
<%= form_for @post, url: {action: :create} do |f| %>
|
3
3
|
<div>
|
4
4
|
<h3>Add a Post</h3>
|
@@ -6,25 +6,23 @@
|
|
6
6
|
<div>
|
7
7
|
<p>
|
8
8
|
<%= "<div>#{@post.errors.full_messages.first}</div>".html_safe if @post.errors.any? %>
|
9
|
-
<div>
|
9
|
+
<div class="form-group">
|
10
10
|
<label>Title</label>
|
11
|
-
<%= f.text_field :title %>
|
11
|
+
<%= f.text_field :title, class: "form-control" %>
|
12
12
|
</div>
|
13
|
-
|
14
|
-
<div>
|
13
|
+
<div class="form-group">
|
15
14
|
<label>Description</label>
|
16
|
-
<%= f.
|
15
|
+
<%= f.text_area :description, class: "form-control", rows: "5", cols: "10", style: "resize:none;" %>
|
17
16
|
</div>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<%= f.text_field :created_by %>
|
17
|
+
<div class="form-group">
|
18
|
+
<label>Created_by</label>
|
19
|
+
<%= f.text_field :created_by, class: "form-control" %>
|
22
20
|
</div>
|
23
21
|
</p>
|
24
22
|
</div>
|
25
|
-
<div>
|
26
|
-
|
27
|
-
|
23
|
+
<div class="row">
|
24
|
+
<div class="col-md-8"><%= link_to 'Back', posts_path, class: "btn btn-info" %></div>
|
25
|
+
<div class="col-md-4"><%= f.submit 'Create Post', class: "btn btn-success" %></div>
|
28
26
|
</div>
|
29
27
|
<% end %>
|
30
28
|
</div>
|
@@ -1,2 +1,18 @@
|
|
1
|
-
<
|
2
|
-
<
|
1
|
+
<div class="container post">
|
2
|
+
<h3>Post Details</h3>
|
3
|
+
<div>
|
4
|
+
<label><b>Title:</b></label>
|
5
|
+
<%= @post.title %>
|
6
|
+
</div>
|
7
|
+
<div>
|
8
|
+
<label><b>Description:</b></label>
|
9
|
+
<%= @post.description %>
|
10
|
+
</div>
|
11
|
+
<div>
|
12
|
+
<label><b>Created_by:</b></label>
|
13
|
+
<%= @post.created_by %>
|
14
|
+
</div>
|
15
|
+
<div>
|
16
|
+
<%= link_to 'Back', posts_path, class: "btn btn-info" %>
|
17
|
+
</div>
|
18
|
+
</div>
|
data/config/routes.rb
CHANGED