actionscaffold 0.2.0.pre → 0.2.1.pre

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
  SHA1:
3
- metadata.gz: 340a4627eede4f5a6360c3b105825a96067d0858
4
- data.tar.gz: af88e6f20bd55c7db7f809120a19eaebf6c6a0a4
3
+ metadata.gz: 2708a29df468bde1930532bac41b1fe4b7048655
4
+ data.tar.gz: 3737d6d720df57606f41150e810b676908f2eee5
5
5
  SHA512:
6
- metadata.gz: 6fa9ae9f04a9dcfe0666cd06a35d55e4a5fa8f9246c165f8fb309b0803ebdb2bdfb007d1c4b5a4f4b652ff7a1c44fef4890f043d631e43c7cce26e667f9c5f66
7
- data.tar.gz: 00f2b6297a8c15fec20a394a5c0d02f64b76e83aec40021121834bb5b463dc7b5b51b24b6dc1e4e4ef4dcfb88571530756b5b4a640d6a95e44af71555eb03175
6
+ metadata.gz: 07b547f81c1392cb5131457f8c7094b3cb0e3f77c38bca40731333b0b2710f6a338f831b982de8bcffb583fbcb759be12bc46d4cbdb44e86e9268c0386cdc409
7
+ data.tar.gz: 78f9fafa833b7cdec7fcd53c09f145a3c3b8e495f5e515ec856a93fd70b21ad74df1edcaf3c91798225cd5ee034974a4422d4e62d9d80740027783ef8a1abc26
data/README.md CHANGED
@@ -72,11 +72,11 @@ end
72
72
 
73
73
  View generator (Bootstrap by default):
74
74
  ```bash
75
- $ rails g scaffold_view:install --ui=bootstrap
75
+ $ rails g scaffold_view:install
76
76
  ```
77
77
  Or with custom theme:
78
78
  ```bash
79
- $ rails g view User name password
79
+ $ rails g scaffold_view:install --ui=bootstrap
80
80
  ```
81
81
 
82
82
  Result:
@@ -86,6 +86,8 @@ Result:
86
86
  <%= f.email_field :email, autofocus: true, class: "form-control" %>
87
87
  </div>
88
88
  ```
89
+ ![Errors](http://i63.tinypic.com/302b22f.png =600x "Errors")
90
+ ![Forms](http://i66.tinypic.com/349b0og.png =600x "Forms")
89
91
 
90
92
 
91
93
  ## Installation
@@ -1,3 +1,3 @@
1
1
  module ActionScaffold
2
- VERSION = '0.2.0.pre'
2
+ VERSION = '0.2.1.pre'
3
3
  end
@@ -1,13 +1,16 @@
1
1
  <%%= form_for(@<%= singular_table_name %>) do |f| %>
2
2
  <%% if @<%= singular_table_name %>.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
5
3
 
6
- <ul>
7
- <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
8
- <li><%%= msg %></li>
9
- <%% end %>
10
- </ul>
4
+ <aside class="panel panel-danger alert-devise">
5
+ <header class="panel-heading"><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</header>
6
+ <section class="panel-body">
7
+ <ul>
8
+ <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
9
+ <li><%%= msg %></li>
10
+ <%% end %>
11
+ </ul>
12
+ </section>
13
+ </aside>
11
14
  </div>
12
15
  <%% end %>
13
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionscaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre
4
+ version: 0.2.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marko Tunjic
@@ -64,8 +64,6 @@ files:
64
64
  - Rakefile
65
65
  - lib/actionscaffold.rb
66
66
  - lib/actionscaffold/version.rb
67
- - lib/generators/actionscaffold/install_generator.rb
68
- - lib/generators/actionscaffold/templates/controller.rb
69
67
  - lib/generators/scaffold_controller/install_generator.rb
70
68
  - lib/generators/scaffold_controller/templates/controller.rb
71
69
  - lib/generators/scaffold_view/install_generator.rb
@@ -1,19 +0,0 @@
1
- #
2
- # controller_generator.rb
3
- #
4
- # Created by Marko Tunjic on 15/07/16.
5
- # Copyright © 2016 Marko Tunjic. All rights reserved.
6
- #
7
- module ActionsSaffold
8
- module Generators
9
- class InstallGenerator < Rails::Generators::Base
10
- desc "This generator override default scaffold generator for controllers."
11
- source_root File.expand_path("../templates", __FILE__)
12
- def copy_template_file
13
- copy_file "controller.rb",
14
- "lib/templates/rails/scaffold_controller/controller.rb"
15
- end
16
- end
17
- end
18
- end
19
-
@@ -1,64 +0,0 @@
1
- <% module_namespacing do -%>
2
-
3
- class <%= controller_class_name %>Controller < ApplicationController
4
- before_action :set_<%= singular_table_name %>,
5
- only: [:show, :edit, :update, :destroy]
6
-
7
- # GET <%= route_url %>
8
- def index
9
- @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
10
- respond_with(@<%= plural_table_name %>)
11
- end
12
-
13
- # GET <%= route_url %>/1
14
- def show
15
- respond_with(@<%= singular_table_name %>)
16
- end
17
-
18
- # GET <%= route_url %>/new
19
- def new
20
- @<%= singular_table_name %> = <%= orm_class.build(class_name) %>
21
- respond_with(@<%= singular_table_name %>)
22
- end
23
-
24
- # GET <%= route_url %>/1/edit
25
- def edit
26
- end
27
-
28
- # POST <%= route_url %>
29
- def create
30
- @<%= singular_table_name %> = <%= orm_class.build(class_name,
31
- "#{singular_table_name}_params") %>
32
- @<%= orm_instance.save %>
33
- respond_with(@<%= singular_table_name %>)
34
- end
35
-
36
- # PATCH/PUT <%= route_url %>/1
37
- def update
38
- @<%= orm_instance.update("#{singular_table_name}_params") %>
39
- respond_with(@<%= singular_table_name %>)
40
- end
41
-
42
- # DELETE <%= route_url %>/1
43
- def destroy
44
- @<%= orm_instance.destroy %>
45
- respond_with(@<%= singular_table_name %>)
46
- end
47
-
48
- private
49
-
50
- def set_<%= singular_table_name %>
51
- @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
52
- end
53
-
54
- # Only allow a trusted parameter "white list" through.
55
- def <%= "#{singular_table_name}_params" %>
56
- <%- if attributes_names.empty? -%>
57
- params[<%= ":#{singular_table_name}" %>]
58
- <%- else -%>
59
- params.require(<%= ":#{singular_table_name}" %>).
60
- permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
61
- <%- end -%>
62
- end
63
- end
64
- <% end -%>