csmosx-haml_scaffold 1.1.0 → 1.1.1

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,3 +1,9 @@
1
+ === 1.1.1 / 2009-08-11
2
+
3
+ * Updated controller & views to use resource_controller gem
4
+ * Removed requirement of old version of will_paginate
5
+ * Deleted creation of stylesheets/sass folder and application.sass
6
+
1
7
  === 1.1.0 / 2009-07-30
2
8
 
3
9
  * 3 major enhancements
@@ -11,7 +11,6 @@ generators/haml_scaffold/templates/functional_test.rb.erb
11
11
  generators/haml_scaffold/templates/helper.rb.erb
12
12
  generators/haml_scaffold/templates/helper_test.rb.erb
13
13
  generators/haml_scaffold/templates/layout.html.haml.erb
14
- generators/haml_scaffold/templates/stylesheet.sass
15
14
  generators/haml_scaffold/templates/view_edit.html.haml.erb
16
15
  generators/haml_scaffold/templates/view_index.html.haml.erb
17
16
  generators/haml_scaffold/templates/view_new.html.haml.erb
@@ -1,3 +1,11 @@
1
+ = Haml Scaffold ( csmosx fork )
2
+
3
+ === Changes in this fork
4
+
5
+ * Updated controller & views to use {resource_controller}[http://github.com/csmosx/resource_controller/tree/master] gem
6
+ * removed requirement of old version of will_paginate
7
+ * deleted creation of stylesheets/sass folder and application.sass
8
+
1
9
  = Haml Scaffold
2
10
 
3
11
  A collection of hacks to the Rails scaffold generator, to make it output
@@ -79,4 +87,4 @@ Also, don't forget to Hamlize your Rails app:
79
87
  {Norman Clarke}[mailto:norman@njclarke.com]
80
88
 
81
89
  This work is derived from code in {Ruby on Rails}[http://rubyonrails.org/] and
82
- is released under its same license, the MIT License.
90
+ is released under its same license, the MIT License.
data/Rakefile CHANGED
@@ -9,7 +9,6 @@ $hoe = Hoe.new("haml_scaffold", HamlScaffold::Version::STRING) do |p|
9
9
  p.description = "Rails scaffolding with Haml rather than ERB, and various other improvements."
10
10
  p.url = 'http://haml-scaffold.rubyforge.org/'
11
11
  p.extra_deps << ['haml', '>= 2.0.6']
12
- #p.extra_deps << ['will_paginate', '>= 2.2.2']
13
12
  p.extra_deps << ['mocha', '>= 0.9.0']
14
13
  p.extra_dev_deps << ['newgem', ">= #{::Newgem::VERSION}"]
15
14
  p.remote_rdoc_dir = "/"
@@ -1,10 +1,9 @@
1
- - form_for(<%= singular_name %>) do |f|
2
- = f.error_messages
1
+ = f.error_messages
3
2
  <% for attribute in attributes -%>
4
- %p
5
- = f.label :<%= attribute.name %>
6
- %br
7
- = f.<%= attribute.field_type %> :<%= attribute.name %>
3
+ %p
4
+ = f.label :<%= attribute.name %>
5
+ %br
6
+ = f.<%= attribute.field_type %> :<%= attribute.name %>
8
7
  <% end -%>
9
- %p
10
- = f.submit "Submit"
8
+ %p
9
+ = f.submit "Submit"
@@ -5,6 +5,6 @@
5
5
  %strong <%= attribute.column.human_name %>:
6
6
  =h <%= singular_name %>.<%= attribute.name %>
7
7
  <% end -%>
8
- = link_to 'Show', <%= singular_name %>
9
- = link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
10
- = link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
8
+ = link_to 'Show', object_path(object)
9
+ = link_to 'Edit', edit_object_path(object)
10
+ = link_to 'Destroy', object_path(object), :confirm => 'Are you sure?', :method => :delete
@@ -1,80 +1,9 @@
1
- class <%= controller_class_name %>Controller < ApplicationController
2
-
3
- before_filter :find_<%= file_name %>
4
-
5
- <%= file_name.pluralize.upcase %>_PER_PAGE = 20
6
-
7
- def create
8
- @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
9
- respond_to do |format|
10
- if @<%= file_name %>.save
11
- flash[:notice] = '<%= class_name %> was successfully created.'
12
- format.html { redirect_to @<%= file_name %> }
13
- format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
14
- else
15
- format.html { render :action => "new" }
16
- format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
17
- end
18
- end
19
- end
20
-
21
- def destroy
22
- respond_to do |format|
23
- if @<%= file_name %>.destroy
24
- flash[:notice] = '<%= class_name %> was successfully destroyed.'
25
- format.html { redirect_to <%= file_name.pluralize %>_path }
26
- format.xml { head :ok }
27
- else
28
- flash[:error] = '<%= class_name %> could not be destroyed.'
29
- format.html { redirect_to @<%= file_name %> }
30
- format.xml { head :unprocessable_entity }
31
- end
32
- end
33
- end
34
-
35
- def index
36
- @<%= table_name %> = <%= class_name %>.paginate(:page => params[:page], :per_page => <%= file_name.pluralize.upcase %>_PER_PAGE)
37
- respond_to do |format|
38
- format.html
39
- format.xml { render :xml => @<%= table_name %> }
40
- end
41
- end
42
-
43
- def edit
44
- end
45
-
46
- def new
47
- @<%= file_name %> = <%= class_name %>.new
48
- respond_to do |format|
49
- format.html
50
- format.xml { render :xml => @<%= file_name %> }
51
- end
52
- end
53
-
54
- def show
55
- respond_to do |format|
56
- format.html
57
- format.xml { render :xml => @<%= file_name %> }
58
- end
59
- end
60
-
61
- def update
62
- respond_to do |format|
63
- if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
64
- flash[:notice] = '<%= class_name %> was successfully updated.'
65
- format.html { redirect_to @<%= file_name %> }
66
- format.xml { head :ok }
67
- else
68
- format.html { render :action => "edit" }
69
- format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
70
- end
71
- end
72
- end
1
+ class <%= controller_class_name %>Controller < ResourceController::Base
73
2
 
74
3
  private
75
4
 
76
- def find_<%= file_name %>
77
- @<%= file_name %> = <%= class_name %>.find(params[:id]) if params[:id]
5
+ def collection
6
+ @collection ||= end_of_association_chain.paginate(:page => params[:page])
78
7
  end
79
8
 
80
- end
9
+ end
@@ -1,6 +1,7 @@
1
- %h2 Editing <%= singular_name %>
2
- = render :partial => "form", :locals => {:<%= singular_name %> => @<%= singular_name %>}
1
+ %h2 Editing <%= singular_name.classify %>
2
+ - form_for(@object, :url => object_path) do |f|
3
+ = render :partial => 'form', :locals => {:f => f}
3
4
  %ul
4
- %li= link_to 'Show', @<%= singular_name %>
5
- %li= link_to 'Back', <%= plural_name %>_path
6
- %li= link_to 'Destroy', @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
5
+ %li= link_to 'Show', object_path(@object)
6
+ %li= link_to 'Back', object_path
7
+ %li= link_to 'Destroy', @object, :confirm => 'Are you sure?', :method => :delete
@@ -1,8 +1,8 @@
1
- %h2 Listing <%= plural_name %>
2
- - if !@<%= plural_name %>.empty?
1
+ %h2 Listing <%= controller_class_name %>
2
+ - unless @<%= plural_name %>.empty?
3
3
  .<%= plural_name %>
4
4
  = render :partial => "<%= singular_name %>", :collection => @<%= plural_name %>
5
5
  = will_paginate(@<%= plural_name %>)
6
6
  - else
7
- %p There are no <%= plural_name %> to show yet.
8
- = link_to 'New <%= singular_name %>', new_<%= singular_name %>_path
7
+ %p There are no <%= controller_class_name %> to show yet.
8
+ = link_to 'New <%= singular_name.classify %>', new_object_path
@@ -1,4 +1,5 @@
1
- %h2 New <%= singular_name %>
2
- = render :partial => "form", :locals => {:<%= singular_name %> => @<%= singular_name %>}
1
+ %h2 New <%= singular_name.classify %>
2
+ - form_for(@object, :url => collection_path) do |f|
3
+ = render :partial => 'form', :locals => {:f => f}
3
4
  %ul
4
- %li= link_to 'Back', <%= plural_name %>_path
5
+ %li= link_to 'Back', collection_path
@@ -7,5 +7,5 @@
7
7
  =h @<%= singular_name %>.<%= attribute.name %>
8
8
  <% end -%>
9
9
  %ul
10
- %li= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>)
11
- %li= link_to 'Back', <%= plural_name %>_path
10
+ %li= link_to 'Edit', edit_object_path
11
+ %li= link_to 'Back', collection_path
@@ -2,7 +2,7 @@ module HamlScaffold
2
2
  class Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
7
7
  end
8
- end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csmosx-haml_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
@@ -77,7 +77,6 @@ files:
77
77
  - generators/haml_scaffold/templates/helper.rb.erb
78
78
  - generators/haml_scaffold/templates/helper_test.rb.erb
79
79
  - generators/haml_scaffold/templates/layout.html.haml.erb
80
- - generators/haml_scaffold/templates/stylesheet.sass
81
80
  - generators/haml_scaffold/templates/view_edit.html.haml.erb
82
81
  - generators/haml_scaffold/templates/view_index.html.haml.erb
83
82
  - generators/haml_scaffold/templates/view_new.html.haml.erb
@@ -1,11 +0,0 @@
1
- body
2
- :text-align center
3
-
4
- h1
5
- :border-bottom 1px #000 solid
6
- :padding-bottom 5px
7
-
8
- #wrapper
9
- :width 800px
10
- :text-align left
11
- :margin auto