custom-template 0.1.4 → 0.1.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.
@@ -1,7 +1,7 @@
1
1
 
2
2
  <h1>Editing <%= singular_table_name %></h1>
3
3
 
4
- <%%= form_for :<%= singular_table_name %>, url: { action: "update", id: @<%= singular_table_name %>.try(:id) } do |f| %>
4
+ <%%= form_for( :<%= singular_table_name %>, url: <%= singular_table_name %>_path( @<%= singular_table_name %> ), method: :put ) do |f| %>
5
5
  <%% if @<%= singular_table_name %>.errors.any? %>
6
6
  <div id="error_explanation">
7
7
  <h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
@@ -22,10 +22,10 @@
22
22
 
23
23
  <% end -%>
24
24
  <div class="actions">
25
- <%%= f.submit t( "menu.update" ), 'data-disable-with' => t( "menu.update" ) %>
25
+ <%%= f.submit t( "menu.update" ), data: { 'disable-with' => t( "menu.update" ) } %>
26
26
  </div>
27
27
  <%% end %>
28
28
 
29
29
 
30
- <%%= link_to t( "menu.show" ), action: "show", id: @<%= singular_table_name %>.id %>
31
- | <%%= link_to t( "menu.list" ), action: "index" %>
30
+ <%%= link_to t( "menu.show" ), <%= singular_table_name %>_path( @<%= singular_table_name %> ) %>
31
+ | <%%= link_to t( "menu.list" ), <%= plural_table_name %>_path %>
@@ -16,16 +16,16 @@
16
16
  <% attributes.each do |attribute| -%>
17
17
  <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
18
18
  <% end -%>
19
- <td><%%= link_to t( "menu.show" ), action: "show", id: <%= singular_table_name %>.id %></td>
20
- <td><%%= link_to t( "menu.edit" ), action: "edit", id: <%= singular_table_name %>.id %></td>
21
- <td><%%= link_to t( "menu.destroy" ), { action: "destroy", id: <%= singular_table_name %>.id }, onclick: "return confirm('本当に削除してよろしいですか?');" %></td>
19
+ <td><%%= link_to t( "menu.show" ), <%= singular_table_name %>_path( <%= singular_table_name %> ) %></td>
20
+ <td><%%= link_to t( "menu.edit" ), edit_<%= singular_table_name %>_path( <%= singular_table_name %> ) %></td>
21
+ <td><%%= link_to t( "menu.destroy" ), <%= singular_table_name %>_path( <%= singular_table_name %> ), method: :delete, data: { confirm: '本当に削除してよろしいですか?' } %></td>
22
22
  </tr>
23
23
  <%% } %>
24
24
  </table>
25
25
 
26
26
  <br />
27
27
 
28
- <%%= link_to t( "menu.new" ), action: "new" %>
28
+ <%%= link_to t( "menu.new" ), new_<%= singular_table_name %>_path %>
29
29
 
30
30
  <br />
31
31
  <br />
@@ -1,7 +1,7 @@
1
1
 
2
2
  <h1>New <%= singular_table_name %></h1>
3
3
 
4
- <%%= form_for :<%= singular_table_name %>, url: { action: "create", id: @<%= singular_table_name %>.try(:id) } do |f| %>
4
+ <%%= form_for( :<%= singular_table_name %>, url: <%= plural_table_name %>_path ) do |f| %>
5
5
  <%% if @<%= singular_table_name %>.errors.any? %>
6
6
  <div id="error_explanation">
7
7
  <h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
@@ -22,8 +22,8 @@
22
22
 
23
23
  <% end -%>
24
24
  <div class="actions">
25
- <%%= f.submit t( "menu.create" ), 'data-disable-with' => t( "menu.create" ) %>
25
+ <%%= f.submit t( "menu.create" ), data: { 'disable-with' => t( "menu.create" ) } %>
26
26
  </div>
27
27
  <%% end %>
28
28
 
29
- <%%= link_to t( "menu.list" ), action: "index" %>
29
+ <%%= link_to t( "menu.list" ), <%= plural_table_name %>_path %>
@@ -5,5 +5,5 @@
5
5
  </p>
6
6
 
7
7
  <% } -%>
8
- <%%= link_to t( "menu.edit" ), action: "edit", id: @<%= singular_table_name %>.id %>
9
- | <%%= link_to t( "menu.list" ), action: "index" %>
8
+ <%%= link_to t( "menu.edit" ), edit_<%= singular_table_name %>_path( @<%= singular_table_name %> ) %>
9
+ | <%%= link_to t( "menu.list" ), <%= plural_table_name %>_path %>
@@ -37,7 +37,7 @@ class <%= controller_class_name %>Controller < ApplicationController
37
37
  @<%= "#{singular_table_name}.user_id" %> = <%= "session[:user_id]" %>
38
38
 
39
39
  if @<%= orm_instance.save %>
40
- redirect_to( { action: "index" }, notice: <%= "\"#{human_name} was successfully created.\"" %> )
40
+ redirect_to( <%= plural_table_name %>_path, notice: <%= "\"#{human_name} was successfully created.\"" %> )
41
41
  else
42
42
  render action: "new"
43
43
  end
@@ -50,7 +50,7 @@ class <%= controller_class_name %>Controller < ApplicationController
50
50
  @<%= singular_table_name %> = <%= "#{class_name}.where( id: params[:id], user_id: session[:user_id] ).first" %>
51
51
 
52
52
  if @<%= orm_instance.update_attributes(" params[:#{singular_table_name}] ") %>
53
- redirect_to( { action: "show", id: <%= "params[:id]" %> }, notice: <%= "\"#{human_name} was successfully updated.\"" %> )
53
+ redirect_to( <%= singular_table_name %>_path( @<%= singular_table_name %> ), notice: <%= "\"#{human_name} was successfully updated.\"" %> )
54
54
  else
55
55
  render action: "edit", id: <%= "params[:id]" %>
56
56
  end
@@ -63,7 +63,7 @@ class <%= controller_class_name %>Controller < ApplicationController
63
63
  @<%= singular_table_name %> = <%= "#{class_name}.where( id: params[:id], user_id: session[:user_id] ).first" %>
64
64
  @<%= orm_instance.destroy %>
65
65
 
66
- redirect_to action: "index"
66
+ redirect_to <%= plural_table_name %>_path
67
67
  end
68
68
 
69
69
  end
@@ -1,5 +1,5 @@
1
1
  module Custom
2
2
  module Template
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
@@ -13,10 +13,9 @@ module Custom
13
13
  #-------------------#
14
14
  def generate_template
15
15
  directory "templates/erb", "lib/templates/erb", recursive: true
16
- directory "templates/haml", "lib/templates/haml", recursive: true
16
+ # directory "templates/haml", "lib/templates/haml", recursive: true
17
17
  directory "templates/rails", "lib/templates/rails", recursive: true
18
18
  end
19
-
20
19
  end
21
20
  end
22
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-10 00:00:00.000000000 Z
12
+ date: 2012-10-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Custom Template for Scaffold.
15
15
  email:
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  requirements: []
68
68
  rubyforge_project:
69
- rubygems_version: 1.8.23
69
+ rubygems_version: 1.8.24
70
70
  signing_key:
71
71
  specification_version: 3
72
72
  summary: Custom Template