i18n_scaffold_controller_template 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/i18n_scaffold_controller_template.gemspec +4 -4
- data/lib/templates/rails/scaffold_controller/controller.rb +26 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 239b2a695c0d5f563b5cfafe90109af97eb75c5b
|
4
|
+
data.tar.gz: b892996335c741604d03c77ddef14094659329d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a98bc5c1457f70b182db9f11f2b18ae19f17ee88be8066bcbbc29611906484b812fd646d7f34d619df19bd880f566c6207a376ee640eb8dc2623cd035436411
|
7
|
+
data.tar.gz: bb47520feda9488fdf8466d342450649b9361df41052f30264091900406c78886487f2d173bcd1a7216e38fd3dc7301df04c5e97eb9956f7b0d2fd15314b0d54
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: i18n_scaffold_controller_template 1.0.
|
5
|
+
# stub: i18n_scaffold_controller_template 1.0.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "i18n_scaffold_controller_template"
|
9
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.5"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Dmitri Koulikoff"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2015-02-24"
|
15
15
|
s.description = "Scaffold controller template expoiting i18n and aware of cancan and WiceGrid"
|
16
16
|
s.email = "dima@koulikoff.ru"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
]
|
35
35
|
s.homepage = "http://github.com/dima4p/i18n_scaffold_controller_template"
|
36
36
|
s.licenses = ["MIT"]
|
37
|
-
s.rubygems_version = "2.
|
37
|
+
s.rubygems_version = "2.4.5"
|
38
38
|
s.summary = "Scaffold controller template expoiting i18n and aware of cancan and WiceGrid"
|
39
39
|
|
40
40
|
if s.respond_to? :specification_version then
|
@@ -13,6 +13,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
13
13
|
<% end -%>
|
14
14
|
|
15
15
|
# GET <%= route_url %>
|
16
|
+
# GET <%= route_url %>.json
|
16
17
|
def index
|
17
18
|
# @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
18
19
|
<% if defined? Wice::WiceGrid -%>
|
@@ -21,6 +22,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
21
22
|
end
|
22
23
|
|
23
24
|
# GET <%= route_url %>/1
|
25
|
+
# GET <%= route_url %>/1.json
|
24
26
|
def show
|
25
27
|
end
|
26
28
|
|
@@ -38,6 +40,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
38
40
|
end
|
39
41
|
|
40
42
|
# POST <%= route_url %>
|
43
|
+
# POST <%= route_url %>.json
|
41
44
|
def create
|
42
45
|
<% if Rails.application.config.generators.options[:rails][:cancan] -%>
|
43
46
|
# @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
@@ -45,26 +48,39 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
45
48
|
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
46
49
|
<% end -%>
|
47
50
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
respond_to do |format|
|
52
|
+
if @<%= orm_instance.save %>
|
53
|
+
format.html { redirect_to @<%= singular_table_name %>, notice: t('<%= table_name %>.was_created') }
|
54
|
+
format.json { render :show, status: :created, location: @<%= singular_table_name %> }
|
55
|
+
else
|
56
|
+
format.html { render :new }
|
57
|
+
format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }
|
58
|
+
end
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
55
62
|
# PATCH/PUT <%= route_url %>/1
|
63
|
+
# PATCH/PUT <%= route_url %>/1.json
|
56
64
|
def update
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
65
|
+
respond_to do |format|
|
66
|
+
if @<%= orm_instance.update("#{singular_table_name}_params") %>
|
67
|
+
format.html { redirect_to @<%= singular_table_name %>, notice: t('<%= table_name %>.was_updated') }
|
68
|
+
format.json { render :show, status: :ok, location: @<%= singular_table_name %> }
|
69
|
+
else
|
70
|
+
format.html { render :edit }
|
71
|
+
format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }
|
72
|
+
end
|
61
73
|
end
|
62
74
|
end
|
63
75
|
|
64
76
|
# DELETE <%= route_url %>/1
|
77
|
+
# DELETE <%= route_url %>/1.json
|
65
78
|
def destroy
|
66
79
|
@<%= orm_instance.destroy %>
|
67
|
-
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to <%= index_helper %>_url, notice: t('<%= table_name %>.was_deleted') }
|
82
|
+
format.json { head :no_content }
|
83
|
+
end
|
68
84
|
end
|
69
85
|
|
70
86
|
private
|
@@ -81,7 +97,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
81
97
|
end
|
82
98
|
<% end -%>
|
83
99
|
|
84
|
-
#
|
100
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
85
101
|
def <%= "#{singular_table_name}_params" %>
|
86
102
|
<%- if attributes_names.empty? -%>
|
87
103
|
params[<%= ":#{singular_table_name}" %>]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_scaffold_controller_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitri Koulikoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.4.5
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Scaffold controller template expoiting i18n and aware of cancan and WiceGrid
|