scaffold_cn 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e29e198107492ca341f07f021226ef3dc1883aa3
4
- data.tar.gz: 6c4418203641c001060f8b6714e0a24be80e5d2b
3
+ metadata.gz: e2251202088ec724267c3cbc70057a3305173265
4
+ data.tar.gz: 832db0b08fabc33b74e480c4ffa861fba81953ac
5
5
  SHA512:
6
- metadata.gz: 15d1d06b498776b6955ae0b60ce0d1e562c69e6a1df491b6f77ee5e0b36bdd58e9bd859966c5360b215f912d85aa3ca925ec486aa85823efdad62e9cfaf7534f
7
- data.tar.gz: ff47b240f3e4d15c9fb8fbe78cc4c2a855e342d13219e68a3fbaa3a92513380c7c71fa9d7f91661ee65f17e1fd8e33811c6a98db0680f3cfe41a84192fbc5f68
6
+ metadata.gz: 7bb41ec0af55ce36f70bbdbf921597c33c0971a794d016ec979195d13f1e8ac9e4506c74d17cd422437b277874926eb07f64a7ce1cfce3693a11d13684e5f6c0
7
+ data.tar.gz: 0f2aa3f1a3fe70f5676808d01eca16ee6594a3eae794d905a8266f086b6977e8e93c93234f68dcb368c9971b6222bb6a2e366af021692ebec8e2550709c87f3d
@@ -2,7 +2,7 @@ Description:
2
2
  Translate the scaffold templates to zh_CN.
3
3
 
4
4
  Example:
5
- rails g scaffoldcn
5
+ rails g scaffold_cn
6
6
 
7
7
  This will create:
8
8
  lib/templates/erb/scaffold/_form.html.erb
@@ -1,18 +1,22 @@
1
1
  #class CnGenerator < Rails::Generators::NamedBase
2
- class ScaffoldcnGenerator < Rails::Generators::Base
2
+ class Scaffold_cnGenerator < Rails::Generators::Base
3
3
  source_root File.expand_path('../templates', __FILE__)
4
4
 
5
- def generate_scaffoldcn
5
+ def generate_scaffold_cn type
6
+ puts "type: #{type}"
6
7
  templates = [
7
8
  'lib/templates/erb/scaffold/_form.html.erb',
8
9
  'lib/templates/erb/scaffold/edit.html.erb',
9
10
  'lib/templates/erb/scaffold/index.html.erb',
10
11
  'lib/templates/erb/scaffold/new.html.erb',
11
12
  'lib/templates/erb/scaffold/show.html.erb',
12
- 'config/locales/model.yml',
13
- 'config/locales/zh-CN.yml']
13
+ 'config/locales/defaults/zh_CN.yml',
14
+ 'config/locales/models/zh_CN.yml',
15
+ 'config/locales/views/zh_CN.yml',
16
+ 'config/locales/devise/zh_CN.yml']
14
17
  templates.each do |path|
15
- copy_file path, path
18
+ template path, path
16
19
  end
17
20
  end
18
21
  end
22
+
@@ -1,6 +1,6 @@
1
1
  # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
2
 
3
- zh-CN:
3
+ zh_CN:
4
4
  devise:
5
5
  confirmations:
6
6
  confirmed: "你的帐户成功激活,现在是登录状态"
@@ -1,7 +1,7 @@
1
1
  # 请按照下面的范例建立model的中文翻译
2
2
  # 其中: models域下面映射了数据库表的中文名称
3
3
  # attribuites域映射了各个表字段的中文名称
4
- zh-CN:
4
+ zh_CN:
5
5
  activerecord:
6
6
  models:
7
7
  relation: '联系人'
@@ -0,0 +1,9 @@
1
+ zh_CN:
2
+ submit: '提交'
3
+ index: '列表'
4
+ show: '显示'
5
+ new: '新建'
6
+ edit: '编辑'
7
+ delete: '删除'
8
+ confirm_delete: '确定删除吗?'
9
+ back: '返回'
@@ -32,6 +32,6 @@
32
32
  </div>
33
33
  <% end -%>
34
34
  <div class="actions">
35
- <%%= f.submit '提交'%>
35
+ <%%= f.submit t(:submit)%>
36
36
  </div>
37
37
  <%% end %>
@@ -0,0 +1,6 @@
1
+ <h1><%=t(:edit)%> <%%= <%= human_name %>.model_name.human %></h1>
2
+
3
+ <%%= render 'form' %>
4
+
5
+ <%%= link_to t(:show), @<%= singular_table_name %> %> |
6
+ <%%= link_to t(:back), <%= index_helper %>_path %>
@@ -1,4 +1,4 @@
1
- <h1><%%= <%= human_name %>.model_name.human %>列表</h1>
1
+ <h1><%%= <%= human_name %>.model_name.human %><%=t(:index)%></h1>
2
2
 
3
3
  <table>
4
4
  <thead>
@@ -16,9 +16,9 @@
16
16
  <% attributes.reject(&:password_digest?).each do |attribute| -%>
17
17
  <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
18
18
  <% end -%>
19
- <td><%%= link_to '显示', <%= singular_table_name %> %></td>
20
- <td><%%= link_to '编辑', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
21
- <td><%%= link_to '删除', <%= singular_table_name %>, method: :delete, data: { confirm: '确定删除吗?' } %></td>
19
+ <td><%%= link_to t(:show), <%= singular_table_name %> %></td>
20
+ <td><%%= link_to t(:edit), edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
21
+ <td><%%= link_to t(:delete), <%= singular_table_name %>, method: :delete, data: { confirm: t(:confirm_delete) } %></td>
22
22
  </tr>
23
23
  <%% end %>
24
24
  </tbody>
@@ -0,0 +1,5 @@
1
+ <h1><%=t(:new)%><%%= <%= human_name %>.model_name.human %></h1>
2
+
3
+ <%%= render 'form' %>
4
+
5
+ <%%= link_to t(:back), <%= index_helper %>_path %>
@@ -7,5 +7,5 @@
7
7
  </p>
8
8
 
9
9
  <% end -%>
10
- <%%= link_to '编辑', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |
11
- <%%= link_to '返回', <%= index_helper %>_path %>
10
+ <%%= link_to t(:edit), edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |
11
+ <%%= link_to t(:back), <%= index_helper %>_path %>
@@ -1,3 +1,3 @@
1
1
  module ScaffoldCn
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffold_cn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - homeway
@@ -45,16 +45,17 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - lib/generators/scaffoldcn/scaffoldcn_generator.rb
49
- - lib/generators/scaffoldcn/templates/config/locales/devise.zh-CN.yml
50
- - lib/generators/scaffoldcn/templates/config/locales/model.yml
51
- - lib/generators/scaffoldcn/templates/config/locales/zh-CN.yml
52
- - lib/generators/scaffoldcn/templates/lib/templates/erb/scaffold/_form.html.erb
53
- - lib/generators/scaffoldcn/templates/lib/templates/erb/scaffold/edit.html.erb
54
- - lib/generators/scaffoldcn/templates/lib/templates/erb/scaffold/index.html.erb
55
- - lib/generators/scaffoldcn/templates/lib/templates/erb/scaffold/new.html.erb
56
- - lib/generators/scaffoldcn/templates/lib/templates/erb/scaffold/show.html.erb
57
- - lib/generators/scaffoldcn/USAGE
48
+ - lib/generators/scaffold_cn/scaffold_cn_generator.rb
49
+ - lib/generators/scaffold_cn/templates/config/locales/defaults/zh_CN.yml
50
+ - lib/generators/scaffold_cn/templates/config/locales/devise/zh_CN.yml
51
+ - lib/generators/scaffold_cn/templates/config/locales/models/zh_CN.yml
52
+ - lib/generators/scaffold_cn/templates/config/locales/views/zh_CN.yml
53
+ - lib/generators/scaffold_cn/templates/lib/templates/erb/scaffold/_form.html.erb
54
+ - lib/generators/scaffold_cn/templates/lib/templates/erb/scaffold/edit.html.erb
55
+ - lib/generators/scaffold_cn/templates/lib/templates/erb/scaffold/index.html.erb
56
+ - lib/generators/scaffold_cn/templates/lib/templates/erb/scaffold/new.html.erb
57
+ - lib/generators/scaffold_cn/templates/lib/templates/erb/scaffold/show.html.erb
58
+ - lib/generators/scaffold_cn/USAGE
58
59
  - lib/scaffold_cn/version.rb
59
60
  - lib/scaffold_cn.rb
60
61
  - MIT-LICENSE
@@ -93,7 +94,7 @@ files:
93
94
  - test/integration/navigation_test.rb
94
95
  - test/scaffold_cn_test.rb
95
96
  - test/test_helper.rb
96
- homepage: ''
97
+ homepage: https://github.com/homeway/scaffold_cn
97
98
  licenses: []
98
99
  metadata: {}
99
100
  post_install_message:
@@ -1,6 +0,0 @@
1
- <h1>编辑 <%%= <%= human_name %>.model_name.human %></h1>
2
-
3
- <%%= render 'form' %>
4
-
5
- <%%= link_to '显示', @<%= singular_table_name %> %> |
6
- <%%= link_to '返回', <%= index_helper %>_path %>
@@ -1,5 +0,0 @@
1
- <h1>新建<%%= <%= human_name %>.model_name.human %></h1>
2
-
3
- <%%= render 'form' %>
4
-
5
- <%%= link_to '返回', <%= index_helper %>_path %>