dobro 0.1.0alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +3 -0
  3. data/HISTORY +2 -0
  4. data/LICENCE +20 -0
  5. data/README.textile +70 -0
  6. data/Rakefile +11 -0
  7. data/app/assets/images/icons/pencil.png +0 -0
  8. data/app/assets/images/icons/plus.png +0 -0
  9. data/app/assets/images/icons/x.png +0 -0
  10. data/app/assets/images/input-shade-focus.gif +0 -0
  11. data/app/assets/images/input-shade.gif +0 -0
  12. data/app/assets/images/ridge-border.gif +0 -0
  13. data/app/assets/stylesheets/dobro.css.scss.erb +421 -0
  14. data/app/assets/stylesheets/dobro/_colours.css.scss +3 -0
  15. data/app/assets/stylesheets/dobro/_fonts.css.scss +4 -0
  16. data/app/assets/stylesheets/dobro/_reset.css.scss +22 -0
  17. data/app/controllers/dobro/application_controller.rb +51 -0
  18. data/app/views/dobro/application/_form.html.erb +14 -0
  19. data/app/views/dobro/application/_show.html.erb +6 -0
  20. data/app/views/dobro/application/delete.html.erb +5 -0
  21. data/app/views/dobro/application/edit.html.erb +1 -0
  22. data/app/views/dobro/application/index.html.erb +0 -0
  23. data/app/views/dobro/application/new.html.erb +1 -0
  24. data/app/views/dobro/application/show.html.erb +16 -0
  25. data/app/views/layouts/dobro.html.erb +59 -0
  26. data/config.ru +7 -0
  27. data/dobro.gemspec +31 -0
  28. data/lib/dobro.rb +24 -0
  29. data/lib/dobro/engine.rb +7 -0
  30. data/lib/dobro/file_system_resolver.rb +14 -0
  31. data/lib/dobro/routes.rb +23 -0
  32. data/lib/dobro/version.rb +3 -0
  33. data/spec/acceptance/custom_actions_spec.rb +18 -0
  34. data/spec/acceptance/custom_views_spec.rb +33 -0
  35. data/spec/acceptance/standard_namespace_spec.rb +51 -0
  36. data/spec/internal/app/controllers/tasks_controller.rb +6 -0
  37. data/spec/internal/app/models/page.rb +5 -0
  38. data/spec/internal/app/models/task.rb +5 -0
  39. data/spec/internal/app/models/widget.rb +5 -0
  40. data/spec/internal/app/views/dobro/widgets/_form.html.erb +12 -0
  41. data/spec/internal/app/views/dobro/widgets/show.html.erb +16 -0
  42. data/spec/internal/app/views/tasks/_show.html.erb +8 -0
  43. data/spec/internal/app/views/tasks/approving.html.erb +5 -0
  44. data/spec/internal/config/database.yml +3 -0
  45. data/spec/internal/config/routes.rb +11 -0
  46. data/spec/internal/db/schema.rb +17 -0
  47. data/spec/internal/log/.gitignore +1 -0
  48. data/spec/internal/public/favicon.ico +0 -0
  49. data/spec/spec_helper.rb +20 -0
  50. metadata +194 -0
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ .sass-cache
4
+ Gemfile.lock
5
+ pkg/*
6
+ *.sqlite
7
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/HISTORY ADDED
@@ -0,0 +1,2 @@
1
+ 0.1.0 - ?
2
+ * Initial Release
data/LICENCE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Hyper Tiny
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,70 @@
1
+ h1. Dobro
2
+
3
+ h2. Installation
4
+
5
+ First things first, get the gem in your @Gemfile@:
6
+
7
+ <pre><code>gem 'dobro', '~> 0.1.0'</code></pre>
8
+
9
+ Then, decide where you want it amongst your routes:
10
+
11
+ <pre><code># in your config/routes.rb
12
+ dobro_for :articles, :pages, :users</code></pre>
13
+
14
+ If you want a central dobro page (which defaults to the index page for the first resource that you're using with Dobro), just point a path to @dobro/application#index@:
15
+
16
+ <pre><code># in your config/routes.rb
17
+ match '/dobro' => 'dobro/application#index'</code></pre>
18
+
19
+ And finally, make sure you add an @identifier@ method to the models you've marked as Dobro resources. This may be the name, email address, or title. Best to make it something unique.
20
+
21
+ <pre><code>def identifier
22
+ name
23
+ end</code></pre>
24
+
25
+ Bundle and restart your server, and you're good to go. If you've provided a dobro index page (as covered above), then you can head straight to "http://localhost:3000/dobro":http://localhost:3000/dobro.
26
+
27
+ Before you get too carried away though, you'll almost certainly want to edit the views so the forms have only the fields you'd like. Keep reading for details on that.
28
+
29
+ h2. Usage
30
+
31
+ If you'd like to customise the views, just put your versions in @app/views/dobro@, broken down by resources. For example, a custom edit view for users would end up in @app/views/dobro/users/edit.html.erb@.
32
+
33
+ The standard set of views for Dobro includes:
34
+
35
+ * index
36
+ * show
37
+ * new
38
+ * edit
39
+ * delete
40
+
41
+ Generally it's not recommended you edit those though - best to stick to the partials:
42
+
43
+ * _form (used by both new and edit views)
44
+ * _show (used by the show view)
45
+
46
+ And perhaps you want to add custom controllers into the mix? That's easy too. For the relevant resources, just give them their own @dobro_for@ call, and specify the custom controller:
47
+
48
+ <pre><code>dobro_for :pages, :controller => 'pages'</code></pre>
49
+
50
+ You can also add additional routes just like a standard @resources@ call:
51
+
52
+ <pre><code>dobro_for :pages, :controller => 'pages' do
53
+ member { put :approve }
54
+ end</code></pre>
55
+
56
+ h2. Compatibility
57
+
58
+ Developed for Rails 3.1 and Ruby 1.9. It will work on other Rubies, but not older versions of Rails.
59
+
60
+ h2. Developing
61
+
62
+ Contributions are very much welcome - but keep in mind the following:
63
+
64
+ * Keep patches in a separate branch
65
+ * Don't mess with the version or history file. We'll take care of that when the patch is merged in.
66
+ * Write tests - look at the existing tests (particularly in @spec/acceptance@) for examples and guidance.
67
+
68
+ h2. Credits
69
+
70
+ Copyright (c) 2011 "Hyper Tiny":http://hypertiny.ie. The bulk of the work has been done by "Brian Flanagan":http://www.brianflanagan.org/, "Paul Campbell":http://www.pabcas.com/ and "Pat Allan":http://freelancing-gods.com/, and the code is released under the open MIT Licence.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ Bundler.require :default, :development
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ require 'rspec/core/rake_task'
8
+ RSpec::Core::RakeTask.new
9
+
10
+ task :default => :test
11
+ task :test => :spec
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,421 @@
1
+ @import 'dobro/reset.css.scss';
2
+ @import 'dobro/fonts.css.scss';
3
+ @import 'dobro/colours.css.scss';
4
+
5
+ html, body {
6
+ height: 100%;
7
+ }
8
+
9
+ body {
10
+ background: #eee;
11
+ font-size: 13px;
12
+ @include text;
13
+ }
14
+
15
+ a, a:link, a:visited {
16
+ text-decoration: none;
17
+ }
18
+
19
+ header, footer, .body {
20
+ overflow: hidden;
21
+ clear: both;
22
+ margin: 0 auto 0 0;
23
+ }
24
+
25
+ // form elements
26
+
27
+ input, textarea, select, button {
28
+ @include text;
29
+ }
30
+
31
+ input[type='text'], input[type='password'], input[type='email'] {
32
+ border: 1px solid #ddd;
33
+ border-radius: 2px;
34
+ -webkit-border-radius: 2px;
35
+ -moz-border-radius: 2px;
36
+ font-size: 13px;
37
+ padding: 3px 6px;
38
+ background: #fff url("<%= asset_path 'input-shade.gif' %>") left top repeat-x;
39
+ &:focus {
40
+ border: 1px solid #bbb;
41
+ background-image: url("<%= asset_path 'input-shade-focus.gif' %>");
42
+ }
43
+ }
44
+
45
+ textarea {
46
+ width: 360px;
47
+ height: 10em;
48
+ border: 1px solid #ddd;
49
+ border-radius: 2px;
50
+ -webkit-border-radius: 2px;
51
+ -moz-border-radius: 2px;
52
+ font-size: 13px;
53
+ padding: 3px 6px;
54
+ background: #fff url("<%= asset_path 'input-shade.gif' %>") left top repeat-x;
55
+ &:focus {
56
+ border: 1px solid #bbb;
57
+ background-image: url("<%= asset_path 'input-shade-focus.gif' %>");
58
+ }
59
+ }
60
+
61
+ input[type="submit"], button {
62
+ color: #333;
63
+ text-shadow: 0 1px 0 #ddd;
64
+ border: 1px solid #b0b0b0;
65
+ border-radius: 3px;
66
+ -webkit-border-radius: 3px;
67
+ -moz-border-radius: 3px;
68
+ font-size: 13px;
69
+ padding: 3px 6px;
70
+ background: #cacaca;
71
+ background-image: -webkit-gradient(
72
+ linear,
73
+ left bottom,
74
+ left top,
75
+ color-stop(0.0, #bfbfbf),
76
+ color-stop(0.75, #ccc)
77
+ );
78
+ background-image: -moz-linear-gradient(
79
+ center bottom,
80
+ #bfbfbf 0%,
81
+ #ccc 75%
82
+ );
83
+ &:hover {
84
+ border: 1px solid #aaa;
85
+ cursor: pointer;
86
+ background: #cacaca;
87
+ background-image: -webkit-gradient(
88
+ linear,
89
+ left bottom,
90
+ left top,
91
+ color-stop(0.0, #afafaf),
92
+ color-stop(0.75, #bfbfbf)
93
+ );
94
+ background-image: -moz-linear-gradient(
95
+ center bottom,
96
+ #afafaf 0%,
97
+ #bfbfbf 75%
98
+ );
99
+ }
100
+ &:active {
101
+ color: #111;
102
+ text-shadow: 0 1px 0 #ccc;
103
+ border: 1px solid #888;
104
+ cursor: pointer;
105
+ background: #cacaca;
106
+ background-image: -webkit-gradient(
107
+ linear,
108
+ left bottom,
109
+ left top,
110
+ color-stop(0.0, #999),
111
+ color-stop(0.75, #aaa)
112
+ );
113
+ background-image: -moz-linear-gradient(
114
+ center bottom,
115
+ #999 0%,
116
+ #aaa 75%
117
+ );
118
+ }
119
+ }
120
+
121
+ // header
122
+
123
+ header#h1 {
124
+ background: #ddd;
125
+ border-bottom: 1px solid #ccc;
126
+ a, a:link, a:visited {
127
+ color: #666;
128
+ text-shadow: 0 1px 0 #f9f9f9;
129
+ &:hover {
130
+ color: #333;
131
+ }
132
+ }
133
+ h1 {
134
+ float: left;
135
+ clear: left;
136
+ a, a:link, a:visited {
137
+ display: block;
138
+ padding: 10px;
139
+ font-weight: bold;
140
+ color: #333;
141
+ text-shadow: 0 1px 0 #fff;
142
+ }
143
+ }
144
+ nav {
145
+ float: right;
146
+ clear: right;
147
+ ul {
148
+ list-style: none;
149
+ float: right;
150
+ li {
151
+ float: left;
152
+ a, a:link, a:visited {
153
+ display: block;
154
+ padding: 10px;
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ header.h2 {
162
+ overflow: hidden;
163
+ clear: both;
164
+ margin: -10px -10px 10px;
165
+ padding: 10px;
166
+ background: #fafafa;
167
+ border-bottom: 1px solid #eee;
168
+ h2 {
169
+ float: left;
170
+ color: #333;
171
+ text-shadow: 0 1px 0 #fff;
172
+ }
173
+ nav {
174
+ position: absolute;
175
+ right: 10px;
176
+ top: 10px;
177
+ ul {
178
+ list-style: none;
179
+ float: right;
180
+ li {
181
+ float: left;
182
+ padding: 0 0 0 5px;
183
+ a, a:link, a:visited {
184
+ display: block;
185
+ opacity: .125;
186
+ text-indent: -9999px;
187
+ overflow: hidden;
188
+ width: 16px;
189
+ height: 16px;
190
+ background-position: center center;
191
+ background-color: transparent;
192
+ background-repeat: no-repeat;
193
+ &.new {
194
+ background-image: url("<%= asset_path 'icons/plus.png' %>");
195
+ }
196
+ &.cancel {
197
+ background-image: url("<%= asset_path 'icons/x.png' %>");
198
+ }
199
+ &.edit {
200
+ background-image: url("<%= asset_path 'icons/pencil.png' %>");
201
+ }
202
+ &:hover {
203
+ opacity: .25;
204
+ }
205
+ &:active {
206
+ opacity: .35;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+ header.h3 {
215
+ position: relative;
216
+ padding: 10px;
217
+ background-image: -webkit-gradient(
218
+ linear,
219
+ left bottom,
220
+ left top,
221
+ color-stop(0.0, #f3f3f3),
222
+ color-stop(0.75, #fafafa)
223
+ );
224
+ background-image: -moz-linear-gradient(
225
+ center bottom,
226
+ #f3f3f3 0%,
227
+ #fafafa 75%
228
+ );
229
+ h3 {
230
+ color: #333;
231
+ text-shadow: 0 1px 0 #fff;
232
+ }
233
+ nav {
234
+ position: absolute;
235
+ right: 10px;
236
+ top: 10px;
237
+ ul {
238
+ list-style: none;
239
+ float: right;
240
+ li {
241
+ float: left;
242
+ a, a:link, a:visited {
243
+ opacity: .125;
244
+ display: block;
245
+ text-indent: -9999px;
246
+ overflow: hidden;
247
+ width: 16px;
248
+ height: 16px;
249
+ background-position: center center;
250
+ background-color: transparent;
251
+ background-repeat: no-repeat;
252
+ &.new {
253
+ background-image: url("<%= asset_path 'icons/plus.png' %>");
254
+ }
255
+ &.cancel {
256
+ background-image: url("<%= asset_path 'icons/x.png' %>");
257
+ }
258
+ &.edit {
259
+ background-image: url("<%= asset_path 'icons/pencil.png' %>");
260
+ }
261
+ &:hover {
262
+ opacity: .25;
263
+ }
264
+ &:active {
265
+ opacity: .35;
266
+ }
267
+ }
268
+ }
269
+ }
270
+ }
271
+ }
272
+
273
+ // footer
274
+
275
+ footer {
276
+ background: #eee;
277
+ border-top: 1px solid #ddd;
278
+ a, a:link, a:visited {
279
+ color: #666;
280
+ text-shadow: 0 1px 0 #f9f9f9;
281
+ &:hover {
282
+ color: #333;
283
+ }
284
+ }
285
+ p {
286
+ padding: 10px;
287
+ text-align: right;
288
+ }
289
+ }
290
+
291
+ // body
292
+
293
+ .body {
294
+ position: relative;
295
+ background: #fff;
296
+ height: 80%;
297
+ .selector {
298
+ float: left;
299
+ width: 18%;
300
+ height: 100%;
301
+ overflow: auto;
302
+ }
303
+ .view {
304
+ float: left;
305
+ width: 64%;
306
+ height: 100%;
307
+ overflow: auto;
308
+ }
309
+ }
310
+
311
+ // selector
312
+
313
+ .selector {
314
+ height: 100%;
315
+ background: #f9f9f9 url("<%= asset_path 'ridge-border.gif' %>") right top repeat-y;
316
+ header {
317
+ border-right: 1px solid #ddd;
318
+ }
319
+ ul.records {
320
+ border-right: 1px solid #ddd;
321
+ }
322
+ }
323
+
324
+ // action
325
+
326
+ .view {
327
+ .action {
328
+ overflow: auto;
329
+ clear: both;
330
+ padding: 10px;
331
+ dl {
332
+ padding: 10px;
333
+ max-width: 480px;
334
+ font-size: 12px;
335
+ line-height: 21px;
336
+ dt {
337
+ width: 20%;
338
+ float: left;
339
+ clear: left;
340
+ font-weight: bold;
341
+ color: #999;
342
+ }
343
+ dd {
344
+ width: 80%;
345
+ float: left;
346
+ clear: right;
347
+ }
348
+ }
349
+ }
350
+ form {
351
+ padding: 10px;
352
+ fieldset {
353
+ max-width: 480px;
354
+ font-size: 12px;
355
+ line-height: 21px;
356
+ label {
357
+ width: 20%;
358
+ float: left;
359
+ clear: left;
360
+ font-weight: bold;
361
+ color: #999;
362
+ margin: 0 0 15px;
363
+ }
364
+ input, select, textarea {
365
+ float: left;
366
+ clear: right;
367
+ margin: 0 0 15px;
368
+ }
369
+ }
370
+ .buttons {
371
+ overflow: hidden;
372
+ clear: both;
373
+ border-top: 1px solid #eee;
374
+ padding: 10px;
375
+ background: #fafafa;
376
+ border-bottom: 1px solid #eee;
377
+ input, button {
378
+ float: right;
379
+ margin: 0;
380
+ }
381
+ }
382
+ }
383
+ }
384
+
385
+ // records
386
+
387
+ ul.records {
388
+ list-style: none;
389
+ border-top: 1px solid #eee;
390
+ li.record {
391
+ border-bottom: 1px solid #eee;
392
+ a, a:link, a:visited {
393
+ display: block;
394
+ padding: 10px;
395
+ color: $red;
396
+ background-image: -webkit-gradient(
397
+ linear,
398
+ left bottom,
399
+ left top,
400
+ color-stop(0.0, #f9f9f9),
401
+ color-stop(0.75, #fefefe)
402
+ );
403
+ background-image: -moz-linear-gradient(
404
+ center bottom,
405
+ #f9f9f9 0%,
406
+ #fefefe 75%
407
+ );
408
+ &.selected {
409
+ background: $blue;
410
+ color: #fff;
411
+ &:hover {
412
+ background: darken($blue,5%);
413
+ color: #fff;
414
+ }
415
+ }
416
+ &:hover {
417
+ background: #f9f9f9;
418
+ }
419
+ }
420
+ }
421
+ }