i18n_scaffold_controller_template 1.0.7 → 1.1.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
  SHA1:
3
- metadata.gz: fe8c303ef97d8e2d23c367bdfa4ce990fd8dc194
4
- data.tar.gz: 3fba8a83e037e3d4030156b58ffa4ccb4014d435
3
+ metadata.gz: 1020ef55cf2e9ad5ab3fbd5953d46172f2b8be90
4
+ data.tar.gz: a286745cf662822dd884c3fba93c988f39fb0f4b
5
5
  SHA512:
6
- metadata.gz: 387303d51d924600f30c7e5794e3715a418b7f2f72a1bb21ab964267ba140930d468da6b5f0d6b4a7b026b1f583f5c3030abc7f1b45ef6e5e6410fa2875194a6
7
- data.tar.gz: df80ea6c9efe80151b4d2a3bb92b243a0d58c07ecf5119d5a5354772e15bb027d7421d05c40a4b272115825794777c75f71926f7eec80d5c9d495750fb7c6dc6
6
+ metadata.gz: 625f55dd5beb3af5f8e3bb5b91bf99ca172fdecb212ea6181c499f5ee94b86132b023851a2dc7c5a8289ccda81748f4424237fe109ad80b4525413c6b7db44de
7
+ data.tar.gz: 4e5965a5ffddaabaa786b549a0fda4f45faf4ca1d12790d0bab325752c1251cd1dbdfd092de6c89b5d110399d8f59f3c9d91fbd82db4dd7464d3027310d4a8ce
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.7
1
+ 1.1.0
@@ -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.7 ruby lib
5
+ # stub: i18n_scaffold_controller_template 1.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "i18n_scaffold_controller_template"
9
- s.version = "1.0.7"
9
+ s.version = "1.1.0"
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 = "2015-02-25"
14
+ s.date = "2015-06-15"
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 = [
@@ -28,13 +28,15 @@ Gem::Specification.new do |s|
28
28
  "VERSION",
29
29
  "i18n_scaffold_controller_template.gemspec",
30
30
  "lib/i18n_scaffold_controller_template.rb",
31
- "lib/templates/rails/scaffold_controller/controller.rb",
31
+ "lib/i18n_scaffold_controller_template/generators/rails/scaffold_controller_generator.rb",
32
+ "lib/i18n_scaffold_controller_template/generators/rails/templates/controller.rb",
33
+ "lib/i18n_scaffold_controller_template/railtie.rb",
32
34
  "spec/i18n_scaffold_controller_template_spec.rb",
33
35
  "spec/spec_helper.rb"
34
36
  ]
35
37
  s.homepage = "http://github.com/dima4p/i18n_scaffold_controller_template"
36
38
  s.licenses = ["MIT"]
37
- s.rubygems_version = "2.4.5"
39
+ s.rubygems_version = "2.2.2"
38
40
  s.summary = "Scaffold controller template expoiting i18n and aware of cancan and WiceGrid"
39
41
 
40
42
  if s.respond_to? :specification_version then
@@ -1,7 +1 @@
1
- module I18nScaffoldControllerTemplate
2
- class Railtie < Rails::Railtie
3
- config.app_generators do |g|
4
- g.templates.unshift File::expand_path('../templates', __FILE__)
5
- end
6
- end
7
- end
1
+ require 'i18n_scaffold_controller_template/railtie' if defined?(Rails)
@@ -0,0 +1,10 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
3
+
4
+ module Rails
5
+ module Generators
6
+ class ScaffoldControllerGenerator
7
+ source_paths.unshift File.expand_path('../templates', __FILE__)
8
+ end
9
+ end
10
+ end
@@ -17,7 +17,12 @@ class <%= controller_class_name %>Controller < ApplicationController
17
17
  # GET <%= route_url %>
18
18
  # GET <%= route_url %>.json
19
19
  def index
20
+ <% if Rails.application.config.generators.options[:rails][:cancan] -%>
20
21
  # @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
22
+ <% else -%>
23
+ @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
24
+ <% end -%>
25
+ <% if defined?(Wice::WiceGrid) or defined?(Kaminari) -%>
21
26
  respond_to do |format|
22
27
  format.html do
23
28
  <% if defined? Wice::WiceGrid -%>
@@ -30,6 +35,7 @@ class <%= controller_class_name %>Controller < ApplicationController
30
35
  @<%= plural_table_name %> = @<%= plural_table_name %>.per(params[:per_page]) if params[:per_page].present?
31
36
  <% end -%>
32
37
  end
38
+ <% end -%>
33
39
  end
34
40
  end
35
41
 
@@ -66,7 +72,7 @@ class <%= controller_class_name %>Controller < ApplicationController
66
72
  format.json { render :show, status: :created, location: @<%= singular_table_name %> }
67
73
  else
68
74
  format.html { render :new }
69
- format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }
75
+ format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
70
76
  end
71
77
  end
72
78
  end
@@ -80,7 +86,7 @@ class <%= controller_class_name %>Controller < ApplicationController
80
86
  format.json { render :show, status: :ok, location: @<%= singular_table_name %> }
81
87
  else
82
88
  format.html { render :edit }
83
- format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }
89
+ format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
84
90
  end
85
91
  end
86
92
  end
@@ -0,0 +1,13 @@
1
+ require 'rails/railtie'
2
+
3
+ class I18nScaffoldControllerTemplate
4
+ class Railtie < ::Rails::Railtie
5
+ if Rails::VERSION::MAJOR >= 4
6
+ generators do |app|
7
+ Rails::Generators.configure! app.config.generators
8
+ Rails::Generators.hidden_namespaces.uniq!
9
+ require 'i18n_scaffold_controller_template/generators/rails/scaffold_controller_generator'
10
+ end
11
+ end
12
+ end
13
+ end
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.7
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -97,7 +97,9 @@ files:
97
97
  - VERSION
98
98
  - i18n_scaffold_controller_template.gemspec
99
99
  - lib/i18n_scaffold_controller_template.rb
100
- - lib/templates/rails/scaffold_controller/controller.rb
100
+ - lib/i18n_scaffold_controller_template/generators/rails/scaffold_controller_generator.rb
101
+ - lib/i18n_scaffold_controller_template/generators/rails/templates/controller.rb
102
+ - lib/i18n_scaffold_controller_template/railtie.rb
101
103
  - spec/i18n_scaffold_controller_template_spec.rb
102
104
  - spec/spec_helper.rb
103
105
  homepage: http://github.com/dima4p/i18n_scaffold_controller_template
@@ -120,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
122
  version: '0'
121
123
  requirements: []
122
124
  rubyforge_project:
123
- rubygems_version: 2.4.5
125
+ rubygems_version: 2.2.2
124
126
  signing_key:
125
127
  specification_version: 4
126
128
  summary: Scaffold controller template expoiting i18n and aware of cancan and WiceGrid