shakes 0.4.3 → 0.4.4

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,9 +1,9 @@
1
1
  <%- unless Shakes::Helpers::ViewsHelper::Configuration.use_formtastic -%>
2
2
  <% form_for(@resource, :url => shakes_path_for(((action.eql? :new) ? :create : :update ), @resource)) do |form| %>
3
- <fieldset class="inputs">
3
+ <fieldset class="fields">
4
4
  <ol>
5
5
  <%- shakes_fields_for(action).each do |field| -%>
6
- <% content_tag :li, :class => shakes_field_type_for(field).to_s do -%>
6
+ <% content_tag :li, :class => ['field', shakes_field_type_for(field).to_s].join(' ') do -%>
7
7
  <%= shakes_render_field field, action, @resource, form %>
8
8
  <%- end %>
9
9
  <%- end -%>
@@ -1,3 +1,16 @@
1
- <h1>Editing <%= shakes_human_name %></h1>
2
- <%= render :partial => 'shakes/form', :locals => { :action => :edit } %>
3
- <%= content_tag :p, shakes_link_to_for([:show, :index], @resource), :class => 'actions' %>
1
+ <div class="article">
2
+ <div class="section">
3
+ <%= title "Edit #{shakes_human_name}", :h1 %>
4
+ <%= render :partial => 'shakes/form', :locals => { :action => :edit } %>
5
+ </div>
6
+ </div>
7
+ <div class="aside">
8
+ <div class="section">
9
+ <h1>Related Links</h1>
10
+ <ul class="links">
11
+ <%- shakes_link_to_for([:show, :destroy, :index], @resource).each do |link| -%>
12
+ <%= content_tag :li, link%>
13
+ <%- end -%>
14
+ </ul>
15
+ </div>
16
+ </div>
@@ -1 +1,2 @@
1
- <%= form.label field, shakes_human_attribute_name_for(field).titleize %> <%= form.check_box field %>
1
+ <%= form.label field, shakes_human_attribute_name_for(field).titleize %>
2
+ <%= form.check_box field %>
@@ -1 +1,2 @@
1
- <%= form.label field, shakes_human_attribute_name_for(field).titleize %> <%= form.date_select field %>
1
+ <%= form.label field, shakes_human_attribute_name_for(field).titleize %>
2
+ <%= form.date_select field %>
@@ -1 +1,2 @@
1
- <%= form.label field, shakes_human_attribute_name_for(field).titleize %> <%= form.datetime_select field %>
1
+ <%= form.label field, shakes_human_attribute_name_for(field).titleize %>
2
+ <%= form.datetime_select field %>
@@ -1 +1,2 @@
1
- <%= form.label field, shakes_human_attribute_name_for(field).titleize %> <%= form.text_field field %>
1
+ <%= form.label field, shakes_human_attribute_name_for(field).titleize %>
2
+ <%= form.text_field field %>
@@ -1 +1,2 @@
1
- <%= form.label field, shakes_human_attribute_name_for(field).titleize %> <%= form.text_area field %>
1
+ <%= form.label field, shakes_human_attribute_name_for(field).titleize %>
2
+ <%= form.text_area field, :rows => 10 %>
@@ -1 +1,2 @@
1
- <%= form.label field, shakes_human_attribute_name_for(field).titleize %> <%= form.time_select field %>
1
+ <%= form.label field, shakes_human_attribute_name_for(field).titleize %>
2
+ <%= form.time_select field %>
@@ -1,18 +1,32 @@
1
- <h1>Listing <%= shakes_human_name.pluralize %></h1>
2
- <table>
3
- <tr>
4
- <%- shakes_fields_for(:index).each do |field| -%>
5
- <%= content_tag :th, shakes_human_attribute_name_for(field).titleize, :class => shakes_field_type_for(field).to_s %>
6
- <%- end -%>
7
- <%= content_tag :th, 'Actions', :class => 'actions' %>
8
- </tr>
9
- <%- @resources.each do |resource| -%>
10
- <tr>
11
- <%- shakes_fields_for(:index).each do |field| -%>
12
- <%= content_tag :td, shakes_render_field(field, :index, resource), :class => shakes_field_type_for(field).to_s %>
1
+ <div class="article">
2
+ <div class="section">
3
+ <%= title "List #{shakes_human_name.pluralize}", :h1 %>
4
+ <table class="collection">
5
+ <tr class="headers">
6
+ <%- shakes_fields_for(:index).each do |field| -%>
7
+ <%= content_tag :th, shakes_human_attribute_name_for(field).titleize %>
8
+ <%- end -%>
9
+ <%= content_tag :th, 'Actions', :class => 'actions' %>
10
+ </tr>
11
+ <%- @resources.each do |resource| -%>
12
+ <tr class="fields">
13
+ <%- shakes_fields_for(:index).each do |field| -%>
14
+ <%= content_tag :td, shakes_render_field(field, :index, resource),
15
+ :class => ['field', shakes_field_type_for(field).to_s].join(' ') %>
16
+ <%- end -%>
17
+ <%= content_tag :td, shakes_link_to_for([:show, :edit, :destroy], resource, :short_name => true).join(' | '), :class => 'actions' %>
18
+ </tr>
13
19
  <%- end -%>
14
- <%= content_tag :td, shakes_link_to_for([:show, :edit, :destroy], resource), :class => 'actions' %>
15
- </tr>
16
- <%- end -%>
17
- </table>
18
- <%= content_tag :p, shakes_link_to_for([:new]), :class => 'actions' %>
20
+ </table>
21
+ </div>
22
+ </div>
23
+ <div class="aside">
24
+ <div class="section">
25
+ <h1>Related Links</h1>
26
+ <ul class="links">
27
+ <%- shakes_link_to_for([:new], @resource).each do |link| -%>
28
+ <%= content_tag :li, link%>
29
+ <%- end -%>
30
+ </ul>
31
+ </div>
32
+ </div>
@@ -1 +1 @@
1
- <%= resource[field].length > 255 ? content_tag(:span, shakedown("#{resource[field][0,252]}..."), :title => h(resource[field])) : shakedown(resource[field]) %>
1
+ <%= resource[field].length > 255 ? shakedown("#{resource[field][0,252]}...") : shakedown(resource[field]) %>
@@ -1,3 +1,16 @@
1
- <h1>New <%= shakes_human_name %></h1>
2
- <%= render :partial => 'shakes/form', :locals => { :action => :new } %>
3
- <%= content_tag :p, shakes_link_to_for([:index], @resource), :class => 'actions' %>
1
+ <div class="article">
2
+ <div class="section">
3
+ <%= title "New #{shakes_human_name}", :h1 %>
4
+ <%= render :partial => 'shakes/form', :locals => { :action => :new } %>
5
+ </div>
6
+ </div>
7
+ <div class="aside">
8
+ <div class="section">
9
+ <h1>Related Links</h1>
10
+ <ul class="links">
11
+ <%- shakes_link_to_for([:index], @resource).each do |link| -%>
12
+ <%= content_tag :li, link%>
13
+ <%- end -%>
14
+ </ul>
15
+ </div>
16
+ </div>
@@ -1,9 +1,22 @@
1
- <h1>Showing <%= shakes_human_name %></h1>
2
- <ol class="fields">
3
- <%- shakes_fields_for(:show).each do |field| -%>
4
- <% content_tag :li, :class => shakes_field_type_for(field).to_s do -%>
5
- <%= shakes_render_field field, :show, @resource %>
6
- <%- end %>
7
- <%- end -%>
8
- </ol>
9
- <%= content_tag :p, shakes_link_to_for([:edit, :index], @resource), :class => 'actions' %>
1
+ <div class="article">
2
+ <div class="section">
3
+ <%= title "Show #{shakes_human_name}", :h1 %>
4
+ <ol class="fields">
5
+ <%- shakes_fields_for(:show).each do |field| -%>
6
+ <% content_tag :li, :class => ['field', shakes_field_type_for(field).to_s].join(' ') do -%>
7
+ <%= shakes_render_field field, :show, @resource %>
8
+ <%- end %>
9
+ <%- end -%>
10
+ </ol>
11
+ </div>
12
+ </div>
13
+ <div class="aside">
14
+ <div class="section">
15
+ <h1>Related Links</h1>
16
+ <ul class="links">
17
+ <%- shakes_link_to_for([:edit, :destroy, :index], @resource).each do |link| -%>
18
+ <%= content_tag :li, link%>
19
+ <%- end -%>
20
+ </ul>
21
+ </div>
22
+ </div>
@@ -1,2 +1,2 @@
1
1
  <%= content_tag :label, shakes_human_attribute_name_for(field).titleize %>
2
- <%= content_tag :span, h(resource[field]) %>
2
+ <%= content_tag :span, h(resource[field]) %>
@@ -1,2 +1,2 @@
1
1
  <%= content_tag :label, shakes_human_attribute_name_for(field).titleize %>
2
- <%= content_tag :div, shakedown(resource[field]) %>
2
+ <%= content_tag :div, shakedown(resource[field]) %>
@@ -1,17 +1,36 @@
1
1
  <!DOCTYPE html>
2
2
 
3
- <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
- <title><%%= "#{controller.controller_name}##{controller.action_name}" %> - <%= file_name.titleize %></title>
7
- <%%= shakes_stylesheet_link_tag %>
5
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
6
+ <title><%%= [title, '<%= file_name.titleize %>'].compact.join(' - ') %></title>
7
+ <%%= shakes_stylesheet_link_tags %>
8
8
  <%%= stylesheet_link_tag '<%= file_name %>' %>
9
9
  <%%= yield :head %>
10
10
  </head>
11
11
  <body>
12
+ <div class="header">
13
+ <%%= content_tag :h1, link_to('<%= file_name.titleize %>', root_path) %>
14
+ <%%= yield :header %>
15
+ </div>
16
+
17
+ <div class="nav">
18
+ <ul class="links">
19
+ <!-- Put your site navigation links here -->
20
+ <%%= yield :nav %>
21
+ </ul>
22
+ </div>
23
+
24
+ <%%- unless flash.empty? -%>
25
+ <div class="section">
12
26
  <%%- flash.each do |name, message| -%>
13
- <%%= content_tag :p, message, :id => "flash_#{name}" %>
27
+ <%%= content_tag :p, message, :id => "flash_#{name}", :class => 'flash' %>
28
+ <%%- end -%>
29
+ </div>
14
30
  <%%- end -%>
31
+
15
32
  <%%= yield %>
33
+
34
+ <div class="footer">&copy; <%= Date.today.year %></div>
16
35
  </body>
17
36
  </html>
@@ -0,0 +1,207 @@
1
+ /* RESET.CSS */
2
+ /* http://meyerweb.com/eric/tools/css/reset/ */
3
+ /* v1.0 | 20080212 */
4
+ html, body, div, span, applet, object, iframe,
5
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
6
+ a, abbr, acronym, address, big, cite, code,
7
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
8
+ small, strike, strong, sub, sup, tt, var,
9
+ b, u, i, center,
10
+ dl, dt, dd, ol, ul, li,
11
+ fieldset, form, label, legend,
12
+ table, caption, tbody, tfoot, thead, tr, th, td {
13
+ margin: 0;
14
+ padding: 0;
15
+ border: 0;
16
+ outline: 0;
17
+ font-size: 100%;
18
+ vertical-align: baseline;
19
+ background: transparent;
20
+ }
21
+ body {
22
+ line-height: 1;
23
+ }
24
+ ol, ul {
25
+ list-style: none;
26
+ }
27
+ blockquote, q {
28
+ quotes: none;
29
+ }
30
+ blockquote:before, blockquote:after,
31
+ q:before, q:after {
32
+ content: '';
33
+ content: none;
34
+ }
35
+ /* remember to define focus styles! */
36
+ :focus {
37
+ outline: 0;
38
+ }
39
+ /* remember to highlight inserts somehow! */
40
+ ins {
41
+ text-decoration: none;
42
+ }
43
+ del {
44
+ text-decoration: line-through;
45
+ }
46
+ /* tables still need 'cellspacing="0"' in the markup */
47
+ table {
48
+ border-collapse: collapse;
49
+ border-spacing: 0;
50
+ }
51
+
52
+ /* SHAKES.CSS */
53
+ /* General */
54
+ body {
55
+ background-color: #fff;
56
+ color: #666;
57
+ font-family: Tahoma,Arial,Helvetica,sans-serif;
58
+ font-size: 100%;
59
+ margin: 1em auto;
60
+ width: 960px;
61
+ }
62
+ a {
63
+ color: #000;
64
+ font-weight: bold;
65
+ }
66
+ h1,h2,h3,h4,h5,h6 {
67
+ margin: 1em 0em;
68
+ }
69
+ h1,h2,h3,h4,h5,h6,label,th {
70
+ color: #060;
71
+ font-family: Georgia,Utopia,Palatino,'Palatino Linotype',serif;
72
+ font-weight: bold;
73
+ margin: 0em 0em 1em 0em;
74
+ text-align: inherit;
75
+ }
76
+ td, th {
77
+ padding: 0.1em;
78
+ }
79
+
80
+ /* Layout */
81
+ body > div.header, body > div.nav, body > div.article, body > div.aside, body > div.footer {
82
+ padding: 0px 10px;
83
+ margin: 1em 0em;
84
+ }
85
+ body > div.article, body > div.aside {
86
+ float: left;
87
+ }
88
+ body > div.article {
89
+ width: 640px;
90
+ }
91
+ body > div.aside {
92
+ width: 280px;
93
+ }
94
+ body > div.footer {
95
+ clear: both;
96
+ }
97
+
98
+ /* Header */
99
+ body > div.header h1 {
100
+ font-size: 200%;
101
+ }
102
+ body > div.header h2 {
103
+ font-size: 180%;
104
+ }
105
+ body > div.header h3 {
106
+ font-size: 160%;
107
+ }
108
+ body > div.header h4 {
109
+ font-size: 140%;
110
+ }
111
+ body > div.header h5 {
112
+ font-size: 120%;
113
+ }
114
+ body > div.header h6 {
115
+ font-size: 100%;
116
+ }
117
+
118
+ /* Nav */
119
+ body > div.nav li {
120
+ display: inline;
121
+ margin-right: 2em;
122
+ }
123
+
124
+ /* Article */
125
+ body > div.article > div.section {
126
+ margin: 0em 0em 1em 0em;
127
+ }
128
+ body > div.article h1 {
129
+ font-size: 180%;
130
+ }
131
+ body > div.article h2 {
132
+ font-size: 164%;
133
+ }
134
+ body > div.article h3 {
135
+ font-size: 148%;
136
+ }
137
+ body > div.article h4 {
138
+ font-size: 132%;
139
+ }
140
+ body > div.article h5 {
141
+ font-size: 116%;
142
+ }
143
+ body > div.article h6 {
144
+ font-size: 100%;
145
+ }
146
+ body > div.article li {
147
+ margin: 0.5em 0em;
148
+ }
149
+ body > div.article tr.headers th {
150
+ border-bottom: solid #060 2px;
151
+ }
152
+ body > div.article fieldset.fields > ol li, body > div.article ol.fields li {
153
+ clear: both;
154
+ }
155
+ body > div.article fieldset.fields > ol label, body > div.article ol.fields label {
156
+ float: left;
157
+ width: 160px;
158
+ }
159
+ body > div.article fieldset.buttons > ol li, body > div.article ol.fields div {
160
+ padding-left: 160px;
161
+ }
162
+
163
+ /* Aside */
164
+ body > div.aside > div.section {
165
+ margin: 0em 0em 1em 0em;
166
+ }
167
+ body > div.aside h1 {
168
+ font-size: 160%;
169
+ }
170
+ body > div.aside h2 {
171
+ font-size: 148%;
172
+ }
173
+ body > div.aside h3 {
174
+ font-size: 136%;
175
+ }
176
+ body > div.aside h4 {
177
+ font-size: 124%;
178
+ }
179
+ body > div.aside h5 {
180
+ font-size: 112%;
181
+ }
182
+ body > div.aside h6 {
183
+ font-size: 100%;
184
+ }
185
+ body > div.aside li {
186
+ margin: 0.5em 0em;
187
+ }
188
+
189
+ /* Footer */
190
+ body > div.footer h1 {
191
+ font-size: 140%;
192
+ }
193
+ body > div.footer h2 {
194
+ font-size: 132%;
195
+ }
196
+ body > div.footer h3 {
197
+ font-size: 124%;
198
+ }
199
+ body > div.footer h4 {
200
+ font-size: 116%;
201
+ }
202
+ body > div.footer h5 {
203
+ font-size: 108%;
204
+ }
205
+ body > div.footer h6 {
206
+ font-size: 100%;
207
+ }
@@ -7,6 +7,11 @@ module Shakes
7
7
  self.use_markdown = false
8
8
  end
9
9
 
10
+ def title(*args)
11
+ @shakes_title = args.shift if args.first.is_a? String
12
+ (args.empty?) ? @shakes_title : content_tag(args.shift, @shakes_title, (args.shift || {}))
13
+ end
14
+
10
15
  def shakedown(content, options={})
11
16
  Configuration.use_markdown && options[:markdown] ? markdown(h(content)) : h(content)
12
17
  end
@@ -27,23 +32,26 @@ module Shakes
27
32
  controller.class.shakes_resource.human_name
28
33
  end
29
34
 
30
- def shakes_link_to_for(actions=[], resource=nil)
31
- links = []
35
+ def shakes_link_to_for(actions=[], *args)
36
+ resource = (args.empty? or args.first.is_a? Hash) ? nil : args.shift
37
+ options = (args.empty?) ? {} : args.shift
38
+ links = []
39
+ options[:short_name] ||= false
32
40
  (actions.map { |action| action.to_sym }).each do |action|
33
41
  case action
34
42
  when :index
35
- links << link_to("Back", shakes_path_for(:index)) if controller.respond_to? :index
43
+ links << link_to((options[:short_name] ? 'List' : "List all #{shakes_human_name.pluralize}"), shakes_path_for(:index)) if controller.respond_to? :index
36
44
  when :new
37
- links << link_to("New #{shakes_human_name}", shakes_path_for(:new)) if controller.respond_to? :new
45
+ links << link_to((options[:short_name] ? 'New' : "Create a new #{shakes_human_name}"), shakes_path_for(:new)) if controller.respond_to? :new
38
46
  when :show
39
- links << link_to('Show', shakes_path_for(:show, resource)) if controller.respond_to? :show
47
+ links << link_to((options[:short_name] ? 'Show' : "Show this #{shakes_human_name}"), shakes_path_for(:show, resource)) if controller.respond_to? :show
40
48
  when :edit
41
- links << link_to('Edit', shakes_path_for(:edit, resource)) if controller.respond_to? :edit
49
+ links << link_to((options[:short_name] ? 'Edit' : "Edit this #{shakes_human_name}"), shakes_path_for(:edit, resource)) if controller.respond_to? :edit
42
50
  when :destroy
43
- links << link_to('Destroy', shakes_path_for(:destroy, resource), :confirm => 'Are you sure?', :method => :delete) if controller.respond_to? :destroy
51
+ links << link_to((options[:short_name] ? 'Delete' : "Delete this #{shakes_human_name}"), shakes_path_for(:destroy, resource), :confirm => 'Are you sure?', :method => :delete) if controller.respond_to? :destroy
44
52
  end
45
53
  end
46
- links.join(' | ')
54
+ links
47
55
  end
48
56
 
49
57
  def shakes_render_field(field, action, resource=nil, form=nil)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shakes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 3
10
- version: 0.4.3
9
+ - 4
10
+ version: 0.4.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Stahl
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-26 00:00:00 -05:00
18
+ date: 2010-05-27 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -36,7 +36,6 @@ files:
36
36
  - app/views/shakes/form/_field.html.erb
37
37
  - app/views/shakes/form/_text.html.erb
38
38
  - app/views/shakes/form/_time.html.erb
39
- - app/views/shakes/form/_timestamp.html.erb
40
39
  - app/views/shakes/index/_field.html.erb
41
40
  - app/views/shakes/index/_text.html.erb
42
41
  - app/views/shakes/index.html.erb
@@ -1 +0,0 @@
1
- <%= form.label field, shakes_human_attribute_name_for(field).titleize %> <%= form.datetime_select field %>