dust-generators 0.0.1.pre2 → 0.0.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.
Files changed (49) hide show
  1. data/Rakefile +11 -10
  2. data/lib/generators/dust/authentication/USAGE +50 -0
  3. data/lib/generators/dust/authentication/authentication_generator.rb +154 -0
  4. data/lib/generators/dust/authentication/templates/authlogic_session.rb +2 -0
  5. data/lib/generators/dust/authentication/templates/controller_authentication.rb +61 -0
  6. data/lib/generators/dust/authentication/templates/fixtures.yml +24 -0
  7. data/lib/generators/dust/authentication/templates/migration.rb +20 -0
  8. data/lib/generators/dust/authentication/templates/sessions_controller.rb +45 -0
  9. data/lib/generators/dust/authentication/templates/sessions_helper.rb +2 -0
  10. data/lib/generators/dust/authentication/templates/tests/rspec/sessions_controller.rb +39 -0
  11. data/lib/generators/dust/authentication/templates/tests/rspec/user.rb +83 -0
  12. data/lib/generators/dust/authentication/templates/tests/rspec/users_controller.rb +56 -0
  13. data/lib/generators/dust/authentication/templates/tests/shoulda/sessions_controller.rb +40 -0
  14. data/lib/generators/dust/authentication/templates/tests/shoulda/user.rb +85 -0
  15. data/lib/generators/dust/authentication/templates/tests/shoulda/users_controller.rb +61 -0
  16. data/lib/generators/dust/authentication/templates/tests/testunit/sessions_controller.rb +36 -0
  17. data/lib/generators/dust/authentication/templates/tests/testunit/user.rb +88 -0
  18. data/lib/generators/dust/authentication/templates/tests/testunit/users_controller.rb +53 -0
  19. data/lib/generators/dust/authentication/templates/user.rb +42 -0
  20. data/lib/generators/dust/authentication/templates/users_controller.rb +34 -0
  21. data/lib/generators/dust/authentication/templates/users_helper.rb +2 -0
  22. data/lib/generators/dust/authentication/templates/views/erb/_form.html.erb +20 -0
  23. data/lib/generators/dust/authentication/templates/views/erb/edit.html.erb +3 -0
  24. data/lib/generators/dust/authentication/templates/views/erb/login.html.erb +30 -0
  25. data/lib/generators/dust/authentication/templates/views/erb/signup.html.erb +5 -0
  26. data/lib/generators/dust/authentication/templates/views/haml/_form.html.haml +20 -0
  27. data/lib/generators/dust/authentication/templates/views/haml/edit.html.haml +3 -0
  28. data/lib/generators/dust/authentication/templates/views/haml/login.html.haml +30 -0
  29. data/lib/generators/dust/authentication/templates/views/haml/signup.html.haml +5 -0
  30. data/lib/generators/dust/config/config_generator.rb +1 -1
  31. data/lib/generators/dust/layout/USAGE +25 -0
  32. data/lib/generators/dust/layout/layout_generator.rb +29 -0
  33. data/lib/generators/dust/layout/templates/error_messages_helper.rb +23 -0
  34. data/lib/generators/dust/layout/templates/layout.html.erb +19 -0
  35. data/lib/generators/dust/layout/templates/layout.html.haml +21 -0
  36. data/lib/generators/dust/layout/templates/layout_helper.rb +22 -0
  37. data/lib/generators/dust/layout/templates/stylesheet.css +75 -0
  38. data/lib/generators/dust/layout/templates/stylesheet.sass +66 -0
  39. data/lib/generators/dust/scaffold/scaffold_generator.rb +1 -3
  40. data/lib/generators/dust/scaffold/templates/actions/index.rb +1 -1
  41. data/lib/generators/dust/scaffold/templates/model.rb +0 -12
  42. data/lib/generators/dust/scaffold/templates/views/erb/_form.html.erb +4 -10
  43. data/lib/generators/dust/scaffold/templates/views/erb/edit.html.erb +12 -2
  44. data/lib/generators/dust/scaffold/templates/views/erb/index.html.erb +26 -21
  45. data/lib/generators/dust/scaffold/templates/views/erb/new.html.erb +3 -1
  46. data/lib/generators/dust/scaffold/templates/views/erb/show.html.erb +18 -20
  47. metadata +43 -12
  48. data/lib/dust/version.rb +0 -10
  49. data/lib/generators/dust/scaffold/templates/views/erb/_search.html.erb +0 -6
@@ -0,0 +1,22 @@
1
+ # These helper methods can be called in your template to set variables to be used in the layout
2
+ # This module should be included in all views globally,
3
+ # to do so you may need to add this line to your ApplicationController
4
+ # helper :layout
5
+ module LayoutHelper
6
+ def title(page_title, show_title = true)
7
+ content_for(:title) { h(page_title.to_s) }
8
+ @show_title = show_title
9
+ end
10
+
11
+ def show_title?
12
+ @show_title
13
+ end
14
+
15
+ def stylesheet(*args)
16
+ content_for(:head) { stylesheet_link_tag(*args) }
17
+ end
18
+
19
+ def javascript(*args)
20
+ content_for(:head) { javascript_include_tag(*args) }
21
+ end
22
+ end
@@ -0,0 +1,75 @@
1
+ body {
2
+ background-color: #4B7399;
3
+ font-family: Verdana, Helvetica, Arial;
4
+ font-size: 14px;
5
+ }
6
+
7
+ a img {
8
+ border: none;
9
+ }
10
+
11
+ a {
12
+ color: #0000FF;
13
+ }
14
+
15
+ .clear {
16
+ clear: both;
17
+ height: 0;
18
+ overflow: hidden;
19
+ }
20
+
21
+ #container {
22
+ width: 75%;
23
+ margin: 0 auto;
24
+ background-color: #FFF;
25
+ padding: 20px 40px;
26
+ border: solid 1px black;
27
+ margin-top: 20px;
28
+ }
29
+
30
+ #flash_notice, #flash_error, #flash_alert {
31
+ padding: 5px 8px;
32
+ margin: 10px 0;
33
+ }
34
+
35
+ #flash_notice {
36
+ background-color: #CFC;
37
+ border: solid 1px #6C6;
38
+ }
39
+
40
+ #flash_error, #flash_alert {
41
+ background-color: #FCC;
42
+ border: solid 1px #C66;
43
+ }
44
+
45
+ .fieldWithErrors {
46
+ display: inline;
47
+ }
48
+
49
+ .error_messages {
50
+ width: 400px;
51
+ border: 2px solid #CF0000;
52
+ padding: 0px;
53
+ padding-bottom: 12px;
54
+ margin-bottom: 20px;
55
+ background-color: #f0f0f0;
56
+ font-size: 12px;
57
+ }
58
+
59
+ .error_messages h2 {
60
+ text-align: left;
61
+ font-weight: bold;
62
+ padding: 5px 10px;
63
+ font-size: 12px;
64
+ margin: 0;
65
+ background-color: #c00;
66
+ color: #fff;
67
+ }
68
+
69
+ .error_messages p {
70
+ margin: 8px 10px;
71
+ }
72
+
73
+ .error_messages ul {
74
+ margin: 0;
75
+ }
@@ -0,0 +1,66 @@
1
+ $primary_color: #4b7399
2
+
3
+ body
4
+ background-color: $primary_color
5
+ font:
6
+ family: Verdana, Helvetica, Arial
7
+ size: 14px
8
+
9
+ a
10
+ color: blue
11
+ img
12
+ border: none
13
+
14
+ .clear
15
+ clear: both
16
+ height: 0
17
+ overflow: hidden
18
+
19
+ #container
20
+ width: 75%
21
+ margin: 0 auto
22
+ background: white
23
+ padding: 20px 40px
24
+ border: solid 1px black
25
+ margin-top: 20px
26
+
27
+ #flash_notice,
28
+ #flash_error,
29
+ #flash_alert
30
+ padding: 5px 8px
31
+ margin: 10px 0
32
+
33
+ #flash_notice
34
+ background-color: #ccffcc
35
+ border: solid 1px #66cc66
36
+
37
+ #flash_error,
38
+ #flash_alert
39
+ background-color: #ffcccc
40
+ border: solid 1px #cc6666
41
+
42
+ .fieldWithErrors
43
+ display: inline
44
+
45
+ .error_messages
46
+ width: 400px
47
+ border: 2px solid #cf0000
48
+ padding: 0
49
+ padding-bottom: 12px
50
+ margin-bottom: 20px
51
+ background-color: #f0f0f0
52
+ font:
53
+ size: 12px
54
+ h2
55
+ text-align: left
56
+ padding: 5px 5px 5px 15px
57
+ margin: 0
58
+ font:
59
+ weight: bold
60
+ size: 12px
61
+ background-color: #cc0000
62
+ color: white
63
+ p
64
+ margin: 8px 10px
65
+ ul
66
+ margin: 0
@@ -95,9 +95,7 @@ module Dust
95
95
  template "views/#{view_language}/#{action}.html.#{view_language}", "app/views/#{plural_name}/#{action}.html.#{view_language}"
96
96
  end
97
97
  end
98
-
99
- template "views/#{view_language}/_search.html.erb", "app/views/#{plural_name}/_search.html.erb"
100
-
98
+
101
99
  if form_partial?
102
100
  template "views/#{view_language}/_form.html.#{view_language}", "app/views/#{plural_name}/_form.html.#{view_language}"
103
101
  end
@@ -1,3 +1,3 @@
1
1
  def index
2
- @<%= plural_name %> = <%= class_name %>.page(params[:search], params[:page])
2
+ @<%= plural_name %> = <%= class_name %>.all
3
3
  end
@@ -1,15 +1,3 @@
1
1
  class <%= class_name %> < ActiveRecord::Base
2
2
  attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
3
-
4
- def self.page(search, page)
5
- with_permissions_to(:manage).search(search).order("<%= model_attributes.first %>").paginate(:per_page => 12, :page => page)
6
- end
7
-
8
- def self.search(search)
9
- if search
10
- where("<%= model_attributes.first %> LIKE ?", "%#{search}%")
11
- else
12
- scoped
13
- end
14
- end
15
3
  end
@@ -1,16 +1,10 @@
1
- <%= content_for :head do -%>
2
- <%= javascript_include_tag :ckeditor %>
3
- <% end -%>
4
-
5
- <%%= form_for @<%= singular_name %>, :validations => true do |f| %>
1
+ <%%= form_for @<%= singular_name %> do |f| %>
6
2
  <%%= f.error_messages %>
7
3
  <%- for attribute in model_attributes -%>
8
- <div class="item">
4
+ <p>
9
5
  <%%= f.label :<%= attribute.name %> %><br />
10
6
  <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
11
- </div>
7
+ </p>
12
8
  <%- end -%>
13
- <div class="item">
14
- <p><%%= f.submit %></p>
15
- </div>
9
+ <p><%%= f.submit %></p>
16
10
  <%% end %>
@@ -1,4 +1,14 @@
1
1
  <%% title "Edit <%= singular_name.titleize %>" %>
2
- <% heading "Edit <%= singular_name.titleize %>" %>
3
2
 
4
- <%= render_form %>
3
+ <%= render_form %>
4
+
5
+ <%- if actions? :show, :index -%>
6
+ <p>
7
+ <%- if action? :show -%>
8
+ <%%= link_to "Show", @<%= singular_name %> %> |
9
+ <%- end -%>
10
+ <%- if action? :index -%>
11
+ <%%= link_to "View All", <%= plural_name %>_path %>
12
+ <%- end -%>
13
+ </p>
14
+ <%- end -%>
@@ -1,24 +1,29 @@
1
1
  <%% title "<%= plural_name.titleize %>" %>
2
2
 
3
- <div class="button_bar">
4
- <%%= render :partial => 'search' %>
5
- <%%=link_to('new page', new_<%= singular_name %>_path, :class => 'newfile tip', :title => "New <%= singular_name.capitalize %>")%>
6
- </div>
3
+ <table>
4
+ <tr>
5
+ <%- for attribute in model_attributes -%>
6
+ <th><%= attribute.human_name.titleize %></th>
7
+ <%- end -%>
8
+ </tr>
9
+ <%% for <%= singular_name %> in @<%= plural_name %> %>
10
+ <tr>
11
+ <%- for attribute in model_attributes -%>
12
+ <td><%%= <%= singular_name %>.<%= attribute.name %> %></td>
13
+ <%- end -%>
14
+ <%- if action? :show -%>
15
+ <td><%%= link_to "Show", <%= singular_name %> %></td>
16
+ <%- end -%>
17
+ <%- if action? :edit -%>
18
+ <td><%%= link_to "Edit", edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
19
+ <%- end -%>
20
+ <%- if action? :destroy -%>
21
+ <td><%%= link_to "Destroy", <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
22
+ <%- end -%>
23
+ </tr>
24
+ <%% end %>
25
+ </table>
7
26
 
8
- <%%= will_paginate @<%= plural_name %> %>
9
-
10
- <%% @<%= plural_name %>.each do |<%= singular_name %>| %>
11
- <div class="item">
12
- <div style='float:right'>
13
- <%%=link_to('', edit_<%= singular_name %>_path(<%= singular_name %>), :class => 'edit tip', :title => "Edit This Item" )%>
14
- <%%=link_to "", <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy tip', :title => "Destroy This Item" %>
15
- </div>
16
-
17
- <h3><%%= link_to <%= singular_name %>.<%= model_attributes.first %>, <%= singular_name %> %></h3>
18
- <p>
19
- <%%= link_to "Preview <%= singular_name.capitalize %>", <%= singular_name %>, :class => 'remote_iframe' %>
20
- </p>
21
- </div>
22
- <%% end -%>
23
-
24
- <%%= will_paginate @<%= plural_name %> %>
27
+ <%- if action? :new -%>
28
+ <p><%%= link_to "New <%= singular_name.titleize %>", new_<%= singular_name %>_path %></p>
29
+ <%- end -%>
@@ -1,5 +1,7 @@
1
1
  <%% title "New <%= singular_name.titleize %>" %>
2
- <%% heading "New <%= singular_name.titleize %>" %>
3
2
 
4
3
  <%= render_form %>
5
4
 
5
+ <%- if action? :index -%>
6
+ <p><%%= link_to "Back to List", <%= plural_name %>_path %></p>
7
+ <%- end -%>
@@ -1,22 +1,20 @@
1
1
  <%% title "<%= singular_name.titleize %>" %>
2
2
 
3
- <div class="item">
4
- <div style='float:right'>
5
- <%- if action? :edit -%>
6
- <%%=link_to '', edit_<%= singular_name %>_path(<%= singular_name %>), :class => 'edit tip', :title => "Edit This Item" %>
7
- <%- end -%>
8
- <%- if action? :destroy -%>
9
- <%%=link_to "", <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy tip', :title => "Destroy This Item" %>
10
- <%- end -%>
11
- </div>
12
- <h3><%%= link_to <%= singular_name %>.<%= model_attributes.first %>, <%= singular_name %>.menu_item.url %></h3>
13
- <p>
14
- <%%= link_to "Preview <%= singular_name.titleize %>", <%= singular_name %>.filename, :class => 'remote_iframe' %>
15
- </p>
16
- <%- for attribute in model_attributes -%>
17
- <p>
18
- <strong><%= attribute.human_name.titleize %>:</strong>
19
- <%%= @<%= singular_name %>.<%= attribute.name %> %>
20
- </p>
21
- <%- end -%>
22
- </div>
3
+ <%- for attribute in model_attributes -%>
4
+ <p>
5
+ <strong><%= attribute.human_name.titleize %>:</strong>
6
+ <%%= @<%= singular_name %>.<%= attribute.name %> %>
7
+ </p>
8
+ <%- end -%>
9
+
10
+ <p>
11
+ <%- if action? :edit -%>
12
+ <%%= link_to "Edit", edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
13
+ <%- end -%>
14
+ <%- if action? :destroy -%>
15
+ <%%= link_to "Destroy", @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %> |
16
+ <%- end -%>
17
+ <%- if action? :index -%>
18
+ <%%= link_to "View All", <%= plural_name %>_path %>
19
+ <%- end -%>
20
+ </p>
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dust-generators
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
8
  - 1
9
- - pre2
10
- version: 0.0.1.pre2
9
+ version: 0.0.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - rossnelson
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-02-25 00:00:00 -06:00
17
+ date: 2011-02-22 00:00:00 -06:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -102,12 +101,47 @@ files:
102
101
  - LICENSE.txt
103
102
  - README.rdoc
104
103
  - Rakefile
105
- - lib/dust/version.rb
106
104
  - lib/generators/dust.rb
105
+ - lib/generators/dust/authentication/USAGE
106
+ - lib/generators/dust/authentication/authentication_generator.rb
107
+ - lib/generators/dust/authentication/templates/authlogic_session.rb
108
+ - lib/generators/dust/authentication/templates/controller_authentication.rb
109
+ - lib/generators/dust/authentication/templates/fixtures.yml
110
+ - lib/generators/dust/authentication/templates/migration.rb
111
+ - lib/generators/dust/authentication/templates/sessions_controller.rb
112
+ - lib/generators/dust/authentication/templates/sessions_helper.rb
113
+ - lib/generators/dust/authentication/templates/tests/rspec/sessions_controller.rb
114
+ - lib/generators/dust/authentication/templates/tests/rspec/user.rb
115
+ - lib/generators/dust/authentication/templates/tests/rspec/users_controller.rb
116
+ - lib/generators/dust/authentication/templates/tests/shoulda/sessions_controller.rb
117
+ - lib/generators/dust/authentication/templates/tests/shoulda/user.rb
118
+ - lib/generators/dust/authentication/templates/tests/shoulda/users_controller.rb
119
+ - lib/generators/dust/authentication/templates/tests/testunit/sessions_controller.rb
120
+ - lib/generators/dust/authentication/templates/tests/testunit/user.rb
121
+ - lib/generators/dust/authentication/templates/tests/testunit/users_controller.rb
122
+ - lib/generators/dust/authentication/templates/user.rb
123
+ - lib/generators/dust/authentication/templates/users_controller.rb
124
+ - lib/generators/dust/authentication/templates/users_helper.rb
125
+ - lib/generators/dust/authentication/templates/views/erb/_form.html.erb
126
+ - lib/generators/dust/authentication/templates/views/erb/edit.html.erb
127
+ - lib/generators/dust/authentication/templates/views/erb/login.html.erb
128
+ - lib/generators/dust/authentication/templates/views/erb/signup.html.erb
129
+ - lib/generators/dust/authentication/templates/views/haml/_form.html.haml
130
+ - lib/generators/dust/authentication/templates/views/haml/edit.html.haml
131
+ - lib/generators/dust/authentication/templates/views/haml/login.html.haml
132
+ - lib/generators/dust/authentication/templates/views/haml/signup.html.haml
107
133
  - lib/generators/dust/config/USAGE
108
134
  - lib/generators/dust/config/config_generator.rb
109
135
  - lib/generators/dust/config/templates/config.yml
110
136
  - lib/generators/dust/config/templates/load_config.rb
137
+ - lib/generators/dust/layout/USAGE
138
+ - lib/generators/dust/layout/layout_generator.rb
139
+ - lib/generators/dust/layout/templates/error_messages_helper.rb
140
+ - lib/generators/dust/layout/templates/layout.html.erb
141
+ - lib/generators/dust/layout/templates/layout.html.haml
142
+ - lib/generators/dust/layout/templates/layout_helper.rb
143
+ - lib/generators/dust/layout/templates/stylesheet.css
144
+ - lib/generators/dust/layout/templates/stylesheet.sass
111
145
  - lib/generators/dust/scaffold/USAGE
112
146
  - lib/generators/dust/scaffold/scaffold_generator.rb
113
147
  - lib/generators/dust/scaffold/templates/actions/create.rb
@@ -150,7 +184,6 @@ files:
150
184
  - lib/generators/dust/scaffold/templates/tests/testunit/controller.rb
151
185
  - lib/generators/dust/scaffold/templates/tests/testunit/model.rb
152
186
  - lib/generators/dust/scaffold/templates/views/erb/_form.html.erb
153
- - lib/generators/dust/scaffold/templates/views/erb/_search.html.erb
154
187
  - lib/generators/dust/scaffold/templates/views/erb/edit.html.erb
155
188
  - lib/generators/dust/scaffold/templates/views/erb/index.html.erb
156
189
  - lib/generators/dust/scaffold/templates/views/erb/new.html.erb
@@ -176,20 +209,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
209
  requirements:
177
210
  - - ">="
178
211
  - !ruby/object:Gem::Version
179
- hash: 3449952017661859374
212
+ hash: 3323453795700847522
180
213
  segments:
181
214
  - 0
182
215
  version: "0"
183
216
  required_rubygems_version: !ruby/object:Gem::Requirement
184
217
  none: false
185
218
  requirements:
186
- - - ">"
219
+ - - ">="
187
220
  - !ruby/object:Gem::Version
188
221
  segments:
189
- - 1
190
- - 3
191
- - 1
192
- version: 1.3.1
222
+ - 0
223
+ version: "0"
193
224
  requirements: []
194
225
 
195
226
  rubyforge_project:
data/lib/dust/version.rb DELETED
@@ -1,10 +0,0 @@
1
- class Dust
2
- module Version
3
- MAJOR = 0
4
- MINOR = 0
5
- PATCH = 1
6
- BUILD = 'pre2'
7
-
8
- STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
- end
10
- end
@@ -1,6 +0,0 @@
1
- <div id="searchbox">
2
- <%%= form_tag <%= plural_name %>_path, :method => 'get' do %>
3
- <%%= text_field_tag :search, params[:search], :class => "input-text", :placeholder => 'Search <%= singular_name.capitalize %>' %>
4
- <%%= image_submit_tag "admin/blank.png", :class => "image-submit"%>
5
- <%% end %>
6
- </div>