simple-bootstrap-forms 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: ffcc5003d54b531b2a2e6988fe50b51e03a93915c5f4305fcc79b077261920c3
4
- data.tar.gz: 82d8919d3682b04711f21ef102490debe15424ee03d47c5f5e1156debd9a76e4
3
+ metadata.gz: 6b8e6b3a99ed4c15242b54e68e961f98bc6a67ec43ff7829dd466ceb32483405
4
+ data.tar.gz: 7f49bcae514820784ebd72c5fd7e242fa833615a4fdb9559e39434fb3d66f7f0
5
5
  SHA512:
6
- metadata.gz: a862a1b3f9b43c15ea8d77e676ce75ef9ca24414708dd604688a6c6d953b8ed37b9b8229c1e4b74af36de409f3b1233166dc9174e9f4415d53dc050cda69aaae
7
- data.tar.gz: 3c3a445756c2c1758373a526da5c7ecc8d83fba58664f6558b2929197d9352fb5e0ac6dadf354fe0fa4b32a9863a1146455ae2d7f7fe6f6758533dbcb9af95d2
6
+ metadata.gz: 7c96c80f38fc880e7abd642a65778018bb704c13ede6569ce6b568a286aed8dc770bfb054f346d804999b64689d6e8e33c6aaeaadec357d2b7bb7b9b5a82617d
7
+ data.tar.gz: 8d6fe97fa680503a584b6f1f7689f2b4f6a0f60c52f35cfdd78f42cdead70f3b5fb41d9e4c685c781bd0670f57774b783ab89fae1454f4c678a646aa4c698fdb
data/README.md CHANGED
@@ -25,11 +25,12 @@ $ bundle install
25
25
  $ rails g simple_bootstrap_forms
26
26
  ```
27
27
 
28
- 4 files will be generated:
28
+ 5 files will be generated:
29
29
 
30
30
  - config/initializers/simple_boostrap_forms.rb (Config to suppress generating scaffold.scss)
31
31
  - lib/templates/erb/scaffold/_form.html.erb (Simple override to the standard generator)
32
32
  - lib/templates/erb/scaffold/index.html.erb (Simple override to the standard generator)
33
+ - lib/templates/erb/scaffold/show.html.erb (Simple override to the standard generator)
33
34
  - app/views/shared/_error.html.erb (Shared error partial to keep code DRY)
34
35
 
35
36
  ## Contributing
@@ -18,4 +18,8 @@ class SimpleBootstrapFormsGenerator < Rails::Generators::Base
18
18
  def copy_index_file
19
19
  copy_file 'index.html.erb', 'lib/templates/erb/scaffold/index.html.erb'
20
20
  end
21
+
22
+ def copy_show_file
23
+ copy_file 'show.html.erb', 'lib/templates/erb/scaffold/show.html.erb'
24
+ end
21
25
  end
@@ -18,9 +18,9 @@
18
18
  <% attributes.reject(&:password_digest?).each do |attribute| -%>
19
19
  <td><%%= <%= singular_table_name %>.<%= attribute.column_name %> %></td>
20
20
  <% end -%>
21
- <td><%%= link_to 'Show', <%= model_resource_name %> %></td>
22
- <td><%%= link_to 'Edit', edit_<%= singular_route_name %>_path(<%= singular_table_name %>) %></td>
23
- <td><%%= link_to 'Destroy', <%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' } %></td>
21
+ <td><%%= link_to 'Show', <%= model_resource_name %>, class: 'btn btn-primary' %></td>
22
+ <td><%%= link_to 'Edit', edit_<%= singular_route_name %>_path(<%= singular_table_name %>), class: 'btn btn-primary' %></td>
23
+ <td><%%= link_to 'Destroy', <%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %></td>
24
24
  </tr>
25
25
  <%% end %>
26
26
  </tbody>
@@ -28,4 +28,4 @@
28
28
 
29
29
  <br>
30
30
 
31
- <%%= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_route_name %>_path %>
31
+ <%%= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_route_name %>_path, class: 'btn btn-primary' %>
@@ -0,0 +1,24 @@
1
+ <p id="notice"><%%= notice %></p>
2
+
3
+ <div class='card'>
4
+ <h5 class='card-header'><%= singular_table_name.capitalize %></h5>
5
+ <div class='card-body'>
6
+ <% attributes.reject(&:password_digest?).each do |attribute| -%>
7
+ <p class='card-text'>
8
+ <strong><%= attribute.human_name %>:</strong>
9
+ <% if attribute.attachment? -%>
10
+ <%%= link_to @<%= singular_table_name %>.<%= attribute.column_name %>.filename, @<%= singular_table_name %>.<%= attribute.column_name %> if @<%= singular_table_name %>.<%= attribute.column_name %>.attached? %>
11
+ <% elsif attribute.attachments? -%>
12
+ <%% @<%= singular_table_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
13
+ <div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
14
+ <%% end %>
15
+ <% else -%>
16
+ <%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>
17
+ <% end -%>
18
+ </p>
19
+
20
+ <% end -%>
21
+ <%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'btn btn-primary' %>
22
+ <%%= link_to 'Back', <%= index_helper %>_path, class: 'btn btn-primary' %>
23
+ </div>
24
+ </div>
@@ -3,7 +3,7 @@
3
3
  module Simple
4
4
  module Bootstrap
5
5
  module Forms
6
- VERSION = '0.2.0'
6
+ VERSION = '0.3.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-bootstrap-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kress
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-05 00:00:00.000000000 Z
11
+ date: 2019-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,7 @@ files:
38
38
  - lib/generators/templates/_error.html.erb
39
39
  - lib/generators/templates/_form.html.erb
40
40
  - lib/generators/templates/index.html.erb
41
+ - lib/generators/templates/show.html.erb
41
42
  - lib/generators/templates/simple.rb
42
43
  - lib/simple/bootstrap/forms.rb
43
44
  - lib/simple/bootstrap/forms/railtie.rb