jzajpt-blueberry_scaffold 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{blueberry_scaffold}
5
- s.version = "0.2.1"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ji\305\231\303\255 Zajpt"]
9
- s.date = %q{2009-05-29}
9
+ s.date = %q{2009-06-07}
10
10
  s.description = %q{Scaffold generator featuring i18n, shoulda & factory girl tests.}
11
11
  s.email = %q{jzajpt@blueberryapps.com}
12
12
  s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  "generators/blueberry_scaffold/templates/model.rb",
32
32
  "generators/blueberry_scaffold/templates/model_test.rb",
33
33
  "generators/blueberry_scaffold/templates/views/_form.html.erb",
34
+ "generators/blueberry_scaffold/templates/views/_table.html.erb",
34
35
  "generators/blueberry_scaffold/templates/views/edit.html.erb",
35
36
  "generators/blueberry_scaffold/templates/views/index.html.erb",
36
37
  "generators/blueberry_scaffold/templates/views/new.html.erb",
@@ -66,6 +66,8 @@ class BlueberryScaffoldGenerator < Rails::Generator::Base
66
66
  # Create views
67
67
  m.directory "#{view_path}/#{plural_name}"
68
68
  m.template "views/_form.html.erb", "#{view_path}/#{plural_name}/_form.html.erb"
69
+ m.template "views/_table.html.erb", "#{view_path}/#{plural_name}/_#{plural_name}.html.erb" if
70
+ action?(:index)
69
71
  @actions.each do |action|
70
72
  template = "views/#{action}.html.erb"
71
73
  next unless File.exists? source_path(template)
@@ -2,7 +2,10 @@ class <%= controller_class_name %> < ApplicationController
2
2
  <% if action? :index -%>
3
3
  # GET /<%= plural_name %>
4
4
  def index
5
- @<%= plural_name %> = <%= class_name %>.all
5
+ @<%= plural_name %> = <%= class_name %>.paginate(
6
+ :per_page => 25,
7
+ :page => params[:<%= plural_name %>_page]
8
+ )
6
9
  end
7
10
 
8
11
  <% end -%>
@@ -1,4 +1,10 @@
1
1
  module <%= helper_class_name %>
2
+ <%- if action? :index -%>
3
+ def render_<%= plural_name %>_table(<%= plural_name %>)
4
+ render :partial => '<%= plural_name %>/<%= plural_name %>', :object => @<%= plural_name %>
5
+ end
6
+
7
+ <% end -%>
2
8
  <%- if action? :edit -%>
3
9
  def link_to_edit_<%= singular_name %>(<%= singular_name %>, *args)
4
10
  link_to t('common.edit'), <%= edit_item_path %>(<%= singular_name %>, *args)
@@ -0,0 +1,27 @@
1
+ <table class="list" id="<%= plural_name %>">
2
+ <thead>
3
+ <tr>
4
+ <% for attribute in attributes -%>
5
+ <th><%%= <%= class_name %>.human_attribute_name '<%= attribute.column.name %>' %></th>
6
+ <% end -%>
7
+ </tr>
8
+ </thead>
9
+ <tbody>
10
+ <%% @<%= plural_name %>.each do |<%= singular_name %>| -%>
11
+ <%% content_tag_for :tr, <%= singular_name %> do %>
12
+ <% for attribute in attributes -%>
13
+ <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
14
+ <% end -%>
15
+ <td class="actions">
16
+ <% if action? :edit -%>
17
+ <%%= link_to_edit_<%= singular_name %> <%= singular_name %> %>
18
+ <% end -%>
19
+ <% if action? :edit -%>
20
+ <%%= link_to_destroy_<%= singular_name %> <%= singular_name %> %>
21
+ <% end -%>
22
+ </td>
23
+ <%% end %>
24
+ <%% end -%>
25
+ </tbody>
26
+ </table>
27
+ <%%= will_paginate @<%= plural_name %>, :param_name => '<%= plural_name %>_page' %>
@@ -1,7 +1,10 @@
1
1
  <p>
2
- <% if action? :index %><%%= link_to t('common.back'), <%= items_path %> %><% end -%>
3
- <% if action? :destroy %><%%= link_to_destroy_<%=singular_name %> @<%= singular_name %> %><% end -%>
4
-
2
+ <% if action? :index -%>
3
+ <%%= link_to t('common.back'), <%= items_path %> %>
4
+ <% end -%>
5
+ <% if action? :destroy -%>
6
+ <%%= link_to_destroy_<%=singular_name %> @<%= singular_name %> %>
7
+ <% end -%>
5
8
  </p>
6
9
 
7
10
  <%% form_for @<%= singular_name %> do |form| %>
@@ -1,29 +1,4 @@
1
1
  <%- if action? :new -%>
2
2
  <p><%%= link_to t('<%= i18n_prefix %>.new.link'), <%= new_item_path %> %></p>
3
3
  <%- end -%>
4
- <table class="list" id="<%= plural_name %>">
5
- <thead>
6
- <tr>
7
- <% for attribute in attributes -%>
8
- <th><%%= <%= class_name %>.human_attribute_name '<%= attribute.column.name %>' %></th>
9
- <% end -%>
10
- </tr>
11
- </thead>
12
- <tbody>
13
- <%% @<%= plural_name %>.each do |<%= singular_name %>| -%>
14
- <%% content_tag_for :tr, <%= singular_name %> do %>
15
- <% for attribute in attributes -%>
16
- <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
17
- <% end -%>
18
- <td class="actions">
19
- <% if action? :edit -%>
20
- <%%= link_to_edit_<%= singular_name %> <%= singular_name %> %>
21
- <% end -%>
22
- <% if action? :edit -%>
23
- <%%= link_to_destroy_<%= singular_name %> <%= singular_name %> %>
24
- <% end -%>
25
- </td>
26
- <%% end %>
27
- <%% end -%>
28
- </tbody>
29
- </table>
4
+ <div id="<%= plural_name %>-container"><%%= render_<%= plural_name %>_table @<%= plural_name %> %></div>
@@ -1,8 +1,13 @@
1
1
  <p>
2
- <% if action? :index %><%%= link_to t('common.back'), <%= items_path %> %><% end -%>
3
- <% if action? :edit %><%%= link_to_edit_<%=singular_name %> @<%= singular_name %> %><% end -%>
4
- <% if action? :destroy %><%%= link_to_destroy_<%=singular_name %> @<%= singular_name %> %><% end -%>
5
-
2
+ <% if action? :index -%>
3
+ <%%= link_to t('common.back'), <%= items_path %> %>
4
+ <% end -%>
5
+ <% if action? :edit -%>
6
+ <%%= link_to_edit_<%=singular_name %> @<%= singular_name %> %>
7
+ <% end -%>
8
+ <% if action? :destroy -%>
9
+ <%%= link_to_destroy_<%=singular_name %> @<%= singular_name %> %>
10
+ <% end -%>
6
11
  </p>
7
12
  <%% content_tag_for :div, @<%= singular_name %> do %>
8
13
  <ul>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jzajpt-blueberry_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Ji\xC5\x99\xC3\xAD Zajpt"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-29 00:00:00 -07:00
12
+ date: 2009-06-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -40,6 +40,7 @@ files:
40
40
  - generators/blueberry_scaffold/templates/model.rb
41
41
  - generators/blueberry_scaffold/templates/model_test.rb
42
42
  - generators/blueberry_scaffold/templates/views/_form.html.erb
43
+ - generators/blueberry_scaffold/templates/views/_table.html.erb
43
44
  - generators/blueberry_scaffold/templates/views/edit.html.erb
44
45
  - generators/blueberry_scaffold/templates/views/index.html.erb
45
46
  - generators/blueberry_scaffold/templates/views/new.html.erb