interpret 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/.gitignore +11 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +2 -0
  4. data/app/controllers/interpret/base_controller.rb +10 -0
  5. data/app/controllers/interpret/search_controller.rb +7 -0
  6. data/app/controllers/interpret/tools_controller.rb +39 -0
  7. data/app/controllers/interpret/translations_controller.rb +47 -0
  8. data/app/models/interpret/translation.rb +257 -0
  9. data/app/sweepers/interpret/base_sweeper.rb +14 -0
  10. data/app/sweepers/interpret/translation_sweeper.rb +14 -0
  11. data/app/views/interpret/search/index.html.erb +29 -0
  12. data/app/views/interpret/search/perform.html.erb +38 -0
  13. data/app/views/interpret/tools/index.html.erb +38 -0
  14. data/app/views/interpret/translations/_form.html.erb +5 -0
  15. data/app/views/interpret/translations/_listing.html.erb +22 -0
  16. data/app/views/interpret/translations/edit.html.erb +5 -0
  17. data/app/views/interpret/translations/index.html.erb +28 -0
  18. data/app/views/layouts/interpret.html.erb +41 -0
  19. data/config/routes.rb +20 -0
  20. data/interpret.gemspec +30 -0
  21. data/lib/generators/interpret/migration_generator.rb +25 -0
  22. data/lib/generators/interpret/setup_generator.rb +21 -0
  23. data/lib/generators/interpret/templates/migration.rb +16 -0
  24. data/lib/generators/interpret/views_generator.rb +16 -0
  25. data/lib/interpret/capistrano.rb +15 -0
  26. data/lib/interpret/engine.rb +23 -0
  27. data/lib/interpret/helpers.rb +45 -0
  28. data/lib/interpret/lazy_hash.rb +21 -0
  29. data/lib/interpret/logger.rb +7 -0
  30. data/lib/interpret/version.rb +3 -0
  31. data/lib/interpret.rb +30 -0
  32. data/lib/tasks/interpret.rake +11 -0
  33. data/public/javascripts/jquery.purr.js +180 -0
  34. data/public/stylesheets/folder.png +0 -0
  35. data/public/stylesheets/interpret_style.css +542 -0
  36. data/test_app/Gemfile +11 -0
  37. data/test_app/README +256 -0
  38. data/test_app/Rakefile +7 -0
  39. data/test_app/app/controllers/application_controller.rb +3 -0
  40. data/test_app/app/controllers/pages_controller.rb +3 -0
  41. data/test_app/app/helpers/application_helper.rb +2 -0
  42. data/test_app/app/sweepers/page_sweeper.rb +12 -0
  43. data/test_app/app/views/layouts/application.html.erb +15 -0
  44. data/test_app/app/views/pages/contact.html.haml +8 -0
  45. data/test_app/app/views/pages/index.html.haml +9 -0
  46. data/test_app/config/application.rb +42 -0
  47. data/test_app/config/boot.rb +13 -0
  48. data/test_app/config/database.yml +23 -0
  49. data/test_app/config/environment.rb +5 -0
  50. data/test_app/config/environments/development.rb +27 -0
  51. data/test_app/config/environments/production.rb +51 -0
  52. data/test_app/config/environments/test.rb +35 -0
  53. data/test_app/config/initializers/backtrace_silencers.rb +7 -0
  54. data/test_app/config/initializers/inflections.rb +10 -0
  55. data/test_app/config/initializers/interpret.rb +2 -0
  56. data/test_app/config/initializers/mime_types.rb +5 -0
  57. data/test_app/config/initializers/secret_token.rb +7 -0
  58. data/test_app/config/initializers/session_store.rb +8 -0
  59. data/test_app/config/locales/ca.yml +6 -0
  60. data/test_app/config/locales/es.yml +48 -0
  61. data/test_app/config/routes.rb +4 -0
  62. data/test_app/config.ru +4 -0
  63. data/test_app/db/migrate/20110209185258_interpret_create_translations.rb +16 -0
  64. data/test_app/db/schema.rb +23 -0
  65. data/test_app/db/seeds.rb +0 -0
  66. data/test_app/lib/lazy_hash.rb +22 -0
  67. data/test_app/lib/tasks/.gitkeep +0 -0
  68. data/test_app/lib/tasks/setup.rake +19 -0
  69. data/test_app/public/404.html +26 -0
  70. data/test_app/public/422.html +26 -0
  71. data/test_app/public/500.html +26 -0
  72. data/test_app/public/favicon.ico +0 -0
  73. data/test_app/public/index.html +29 -0
  74. data/test_app/public/javascripts/application.js +2 -0
  75. data/test_app/public/javascripts/best_in_place.js +456 -0
  76. data/test_app/public/javascripts/controls.js +965 -0
  77. data/test_app/public/javascripts/dragdrop.js +974 -0
  78. data/test_app/public/javascripts/effects.js +1123 -0
  79. data/test_app/public/javascripts/jquery.purr.js +180 -0
  80. data/test_app/public/javascripts/prototype.js +6001 -0
  81. data/test_app/public/javascripts/rails.js +134 -0
  82. data/test_app/public/robots.txt +5 -0
  83. data/test_app/public/stylesheets/.gitkeep +0 -0
  84. data/test_app/public/stylesheets/folder.png +0 -0
  85. data/test_app/public/stylesheets/interpret_style.css +530 -0
  86. data/test_app/script/rails +6 -0
  87. data/test_app/vendor/plugins/.gitkeep +0 -0
  88. metadata +262 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Unobtrusive scripting adapter for jQuery
3
+ *
4
+ * Requires jQuery 1.4.3 or later.
5
+ * https://github.com/rails/jquery-ujs
6
+ */
7
+
8
+ (function($) {
9
+ // Triggers an event on an element and returns the event result
10
+ function fire(obj, name, data) {
11
+ var event = new $.Event(name);
12
+ obj.trigger(event, data);
13
+ return event.result !== false;
14
+ }
15
+
16
+ // Submits "remote" forms and links with ajax
17
+ function handleRemote(element) {
18
+ var method, url, data,
19
+ dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
20
+
21
+ if (element.is('form')) {
22
+ method = element.attr('method') || 'POST';
23
+ url = element.attr('action');
24
+ data = element.serializeArray();
25
+ // memoized value from clicked submit button
26
+ var button = element.data('ujs:submit-button');
27
+ if (button) data.push(button);
28
+ } else {
29
+ method = element.attr('data-method') || 'GET';
30
+ url = element.attr('href');
31
+ data = null;
32
+ }
33
+
34
+ $.ajax({
35
+ url: url, type: method, data: data, dataType: dataType,
36
+ // stopping the "ajax:beforeSend" event will cancel the ajax request
37
+ beforeSend: function(xhr, settings) {
38
+ if (settings.dataType === undefined) {
39
+ xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
40
+ }
41
+ return fire(element, 'ajax:beforeSend', [xhr, settings]);
42
+ },
43
+ success: function(data, status, xhr) {
44
+ element.trigger('ajax:success', [data, status, xhr]);
45
+ },
46
+ complete: function(xhr, status) {
47
+ element.trigger('ajax:complete', [xhr, status]);
48
+ },
49
+ error: function(xhr, status, error) {
50
+ element.trigger('ajax:error', [xhr, status, error]);
51
+ }
52
+ });
53
+ }
54
+
55
+ // Handles "data-method" on links such as:
56
+ // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
57
+ function handleMethod(link) {
58
+ var href = link.attr('href'),
59
+ method = link.attr('data-method'),
60
+ csrf_token = $('meta[name=csrf-token]').attr('content'),
61
+ csrf_param = $('meta[name=csrf-param]').attr('content'),
62
+ form = $('<form method="post" action="' + href + '"></form>'),
63
+ metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
64
+
65
+ if (csrf_param !== undefined && csrf_token !== undefined) {
66
+ metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
67
+ }
68
+
69
+ form.hide().append(metadata_input).appendTo('body');
70
+ form.submit();
71
+ }
72
+
73
+ function allowAction(element) {
74
+ var message = element.attr('data-confirm');
75
+ return !message || (fire(element, 'confirm') && confirm(message));
76
+ }
77
+
78
+ $('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
79
+ var link = $(this);
80
+ if (!allowAction(link)) return false;
81
+
82
+ if (link.attr('data-remote')) {
83
+ handleRemote(link);
84
+ return false;
85
+ } else if (link.attr('data-method')) {
86
+ handleMethod(link);
87
+ return false;
88
+ }
89
+ });
90
+
91
+ $('form').live('submit.rails', function(e) {
92
+ var form = $(this);
93
+ if (!allowAction(form)) return false;
94
+
95
+ if (form.attr('data-remote')) {
96
+ handleRemote(form);
97
+ return false;
98
+ }
99
+ });
100
+
101
+ $('form input[type=submit], form button[type=submit], form button:not([type])').live('click', function() {
102
+ var button = $(this);
103
+ if (!allowAction(button)) return false;
104
+ // register the pressed submit button
105
+ var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
106
+ button.closest('form').data('ujs:submit-button', data);
107
+ });
108
+
109
+ /**
110
+ * disable-with handlers
111
+ */
112
+ var disable_with_input_selector = 'input[data-disable-with]',
113
+ disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')',
114
+ disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')';
115
+
116
+ var disable_with_input_function = function() {
117
+ $(this).find(disable_with_input_selector).each(function() {
118
+ var input = $(this);
119
+ input.data('enable-with', input.val())
120
+ .attr('value', input.attr('data-disable-with'))
121
+ .attr('disabled', 'disabled');
122
+ });
123
+ };
124
+
125
+ $(disable_with_form_remote_selector).live('ajax:before.rails', disable_with_input_function);
126
+ $(disable_with_form_not_remote_selector).live('submit.rails', disable_with_input_function);
127
+
128
+ $(disable_with_form_remote_selector).live('ajax:complete.rails', function() {
129
+ $(this).find(disable_with_input_selector).each(function() {
130
+ var input = $(this);
131
+ input.removeAttr('disabled').val(input.data('enable-with'));
132
+ });
133
+ });
134
+ })( jQuery );
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
File without changes
@@ -0,0 +1,530 @@
1
+ /*
2
+ 960 Grid System ~ Core CSS.
3
+ Learn more ~ http://960.gs/
4
+
5
+ Licensed under GPL and MIT.
6
+ */
7
+
8
+ /* =Containers
9
+ --------------------------------------------------------------------------------*/
10
+
11
+ #container
12
+ {
13
+ width: 92%;
14
+ margin-left: 4%;
15
+ margin-right: 4%;
16
+ }
17
+
18
+ /* =Grid >> Global
19
+ --------------------------------------------------------------------------------*/
20
+
21
+ .grid_1,
22
+ .grid_2,
23
+ .grid_3,
24
+ .grid_4,
25
+ .grid_5,
26
+ .grid_6,
27
+ .grid_7,
28
+ .grid_8,
29
+ .grid_9,
30
+ .grid_10,
31
+ .grid_11,
32
+ .grid_12,
33
+ .grid_13,
34
+ .grid_14,
35
+ .grid_15,
36
+ .grid_16
37
+ {
38
+ display: inline;
39
+ float: left;
40
+ margin-left: 1%;
41
+ margin-right: 1%;
42
+ }
43
+
44
+ #container .grid_4
45
+ {
46
+ width: 23%;
47
+ }
48
+
49
+ #container .grid_8
50
+ {
51
+ width: 48%;
52
+ }
53
+
54
+ #container .grid_12
55
+ {
56
+ width: 73%;
57
+ }
58
+
59
+ #container .grid_16
60
+ {
61
+ width: 98%;
62
+ }
63
+
64
+ /* =Grid >> Children (Alpha ~ First, Omega ~ Last)
65
+ --------------------------------------------------------------------------------*/
66
+
67
+ .alpha
68
+ {
69
+ margin-left: 0;
70
+ }
71
+
72
+ .omega
73
+ {
74
+ margin-right: 0;
75
+ }
76
+
77
+
78
+ /* =Grid >> 16 Columns
79
+ --------------------------------------------------------------------------------*/
80
+
81
+ #container .grid_1
82
+ {
83
+ width: 4.25%;
84
+ }
85
+
86
+ #container .grid_2
87
+ {
88
+ width: 10.5%;
89
+ }
90
+
91
+ #container .grid_3
92
+ {
93
+ width: 16.75%;
94
+ }
95
+
96
+ #container .grid_5
97
+ {
98
+ width: 29.25%;
99
+ }
100
+
101
+ #container .grid_6
102
+ {
103
+ width: 35.5%;
104
+ }
105
+
106
+ #container .grid_7
107
+ {
108
+ width: 41.75%;
109
+ }
110
+
111
+ #container .grid_9
112
+ {
113
+ width: 54.25%;
114
+ }
115
+
116
+ #container .grid_10
117
+ {
118
+ width: 60.5%;
119
+ }
120
+
121
+ #container .grid_11
122
+ {
123
+ width: 66.75%;
124
+ }
125
+
126
+ #container .grid_13
127
+ {
128
+ width: 79.25%;
129
+ }
130
+
131
+ #container .grid_14
132
+ {
133
+ width: 85.5%;
134
+ }
135
+
136
+ #container .grid_15
137
+ {
138
+ width: 91.75%;
139
+ }
140
+
141
+ /* =Prefix Extra Space >> Global
142
+ --------------------------------------------------------------------------------*/
143
+
144
+ #container .prefix_4
145
+ {
146
+ padding-left: 25%;
147
+ }
148
+
149
+ #container .prefix_8
150
+ {
151
+ padding-left: 50%;
152
+ }
153
+
154
+ #container .prefix_12
155
+ {
156
+ padding-left: 75%;
157
+ }
158
+
159
+ /* =Prefix Extra Space >> 16 Columns
160
+ --------------------------------------------------------------------------------*/
161
+
162
+ #container .prefix_1
163
+ {
164
+ padding-left: 6.25%;
165
+ }
166
+
167
+ #container .prefix_2
168
+ {
169
+ padding-left: 12.5%;
170
+ }
171
+
172
+ #container .prefix_3
173
+ {
174
+ padding-left: 18.75%;
175
+ }
176
+
177
+ #container .prefix_5
178
+ {
179
+ padding-left: 31.25%;
180
+ }
181
+
182
+ #container .prefix_6
183
+ {
184
+ padding-left: 37.5%;
185
+ }
186
+
187
+ #container .prefix_7
188
+ {
189
+ padding-left: 43.75%;
190
+ }
191
+
192
+ #container .prefix_9
193
+ {
194
+ padding-left: 56.25%;
195
+ }
196
+
197
+ #container .prefix_10
198
+ {
199
+ padding-left: 62.5%;
200
+ }
201
+
202
+ #container .prefix_11
203
+ {
204
+ padding-left: 68.75%;
205
+ }
206
+
207
+ #container .prefix_13
208
+ {
209
+ padding-left: 81.25%;
210
+ }
211
+
212
+ #container .prefix_14
213
+ {
214
+ padding-left: 87.5%;
215
+ }
216
+
217
+ #container .prefix_15
218
+ {
219
+ padding-left: 93.75%;
220
+ }
221
+
222
+ /* =Suffix Extra Space >> Global
223
+ --------------------------------------------------------------------------------*/
224
+
225
+ #container .suffix_4
226
+ {
227
+ padding-right: 25%;
228
+ }
229
+
230
+ #container .suffix_8
231
+ {
232
+ padding-right: 50%;
233
+ }
234
+
235
+ #container .suffix_12
236
+ {
237
+ padding-right: 75%;
238
+ }
239
+
240
+
241
+ /* =Suffix Extra Space >> 16 Columns
242
+ --------------------------------------------------------------------------------*/
243
+
244
+ #container .suffix_1
245
+ {
246
+ padding-right: 6.25%;
247
+ }
248
+
249
+ #container .suffix_2
250
+ {
251
+ padding-right: 16.5%;
252
+ }
253
+
254
+ #container .suffix_3
255
+ {
256
+ padding-right: 18.75%;
257
+ }
258
+
259
+ #container .suffix_5
260
+ {
261
+ padding-right: 31.25%;
262
+ }
263
+
264
+ #container .suffix_6
265
+ {
266
+ padding-right: 37.5%;
267
+ }
268
+
269
+ #container .suffix_7
270
+ {
271
+ padding-right: 43.75%;
272
+ }
273
+
274
+ #container .suffix_9
275
+ {
276
+ padding-right: 56.25%;
277
+ }
278
+
279
+ #container .suffix_10
280
+ {
281
+ padding-right: 62.5%;
282
+ }
283
+
284
+ #container .suffix_11
285
+ {
286
+ padding-right: 68.75%;
287
+ }
288
+
289
+ #container .suffix_13
290
+ {
291
+ padding-right: 81.25%;
292
+ }
293
+
294
+ #container .suffix_14
295
+ {
296
+ padding-right: 87.5%;
297
+ }
298
+
299
+ #container .suffix_15
300
+ {
301
+ padding-right: 93.75%;
302
+ }
303
+
304
+ /* =Clear Floated Elements
305
+ --------------------------------------------------------------------------------*/
306
+
307
+ /* http://sonspring.com/journal/clearing-floats */
308
+
309
+ html body * span.clear,
310
+ html body * div.clear,
311
+ html body * li.clear,
312
+ html body * dd.clear
313
+ {
314
+ background: none;
315
+ border: 0;
316
+ clear: both;
317
+ display: block;
318
+ float: none;
319
+ font-size: 0;
320
+ list-style: none;
321
+ margin: 0;
322
+ padding: 0;
323
+ overflow: hidden;
324
+ visibility: hidden;
325
+ width: 0;
326
+ height: 0;
327
+ }
328
+
329
+ /* http://www.positioniseverything.net/easyclearing.html */
330
+
331
+ .clearfix:after
332
+ {
333
+ clear: both;
334
+ content: '.';
335
+ display: block;
336
+ visibility: hidden;
337
+ height: 0;
338
+ }
339
+
340
+ .clearfix
341
+ {
342
+ display: inline-block;
343
+ }
344
+
345
+ * html .clearfix
346
+ {
347
+ height: 1%;
348
+ }
349
+
350
+ .clearfix
351
+ {
352
+ display: block;
353
+ }
354
+
355
+ body {
356
+ font-family: "Lucida Grande", Helvetica;
357
+ }
358
+
359
+ #container {
360
+ border: .3em solid #333;
361
+ }
362
+
363
+ #header, .header {
364
+ padding: 0 1em;
365
+ margin-top: 1em;
366
+ color: #FFF;
367
+ background-color: #666;
368
+ border-radius: 5px;
369
+ }
370
+
371
+ table {
372
+ border-collapse:collapse;
373
+ width: 100%;
374
+ border-right: 1px solid #CCC;
375
+ border-left: 1px solid #CCC;
376
+ }
377
+
378
+ td, th {
379
+ color: #363636;
380
+ padding: .4em;
381
+ }
382
+
383
+ td:first-child, td:first-child {
384
+ width: 50%;
385
+ }
386
+
387
+ td:last-child, td:last-child {
388
+ width: 50%;
389
+ }
390
+
391
+ tr {
392
+ border-bottom:1px solid #CCC;
393
+ cursor: hand;
394
+ cursor: pointer;
395
+ }
396
+
397
+
398
+ tr:hover {
399
+ background-color: #DDD;
400
+ -moz-transition: background .4s linear;
401
+ -o-transition: background .4s linear;
402
+ -webkit-transition: background .4s linear;
403
+ }
404
+
405
+ tr.header {
406
+ background-color: #555;
407
+ color: white;
408
+ height: 2em;
409
+ cursor: default;
410
+ }
411
+ tr.header:hover {
412
+ background: #555;
413
+ -moz-transition: none;
414
+ -o-transition: none;
415
+ -webkit-transition: none;
416
+ height: 2em;
417
+ }
418
+ tr.header th {;
419
+ color: #EEE;
420
+ }
421
+
422
+ tbody td a {
423
+ color:#363636;
424
+ text-decoration:none;
425
+ }
426
+
427
+ .menu {
428
+ margin-top: 10px;
429
+ }
430
+
431
+ .menu a.current {
432
+ font-weight: bold;
433
+ }
434
+
435
+ /* Search Page */
436
+
437
+ #search {
438
+ border: 1px solid #CCC;
439
+ padding-left: 3em;
440
+ }
441
+ #search label {
442
+ font-size: 1.4em;
443
+ }
444
+
445
+ #search input {
446
+ width: 40%;
447
+ font-size: 1.2em;
448
+ height: 2em;
449
+ margin: 1em 0;
450
+ border: .2em solid #CCC;
451
+ padding-left: .4em;
452
+ }
453
+
454
+ #search input:focus {
455
+ border: .2em solid #555;
456
+ }
457
+
458
+ #search input[type="submit"] {
459
+ width: 15em;
460
+ margin-top: 2em;
461
+ margin-left: 4%;
462
+ }
463
+
464
+ #search input[type="submit"]:hover {
465
+ background-color: #444;
466
+ color: #FFF;
467
+ cursor: hand;
468
+ cursor: pointer;
469
+ }
470
+
471
+ /* Sidebar for Search page */
472
+
473
+ #side_search {
474
+ border: 1px solid #CCC;
475
+ padding: .4em 0 .4em .8em;
476
+ }
477
+ #side_search label {
478
+ font-size: .8em;
479
+ }
480
+
481
+ #side_search input {
482
+ width: 90%;
483
+ font-size: .9em;
484
+ height: 1.5em;
485
+ margin: .5em 0;
486
+ border: .2em solid #CCC;
487
+ padding: .2em;
488
+ }
489
+
490
+ #side_search input:focus {
491
+ border: .2em solid #555;
492
+ }
493
+
494
+ #side_search input[type="submit"] {
495
+ width: 94%;
496
+ margin-top: 1.2em;
497
+ height: 2em;
498
+ }
499
+
500
+ #side_search input[type="submit"]:hover {
501
+ background-color: #444;
502
+ color: #FFF;
503
+ cursor: hand;
504
+ cursor: pointer;
505
+ }
506
+
507
+ .best_in_place textarea {
508
+ width: 100%;
509
+ border: transparent;
510
+ font-size: .9em;
511
+ }
512
+
513
+ #tree_sidebar ul{
514
+ margin: 0;
515
+ padding: .4em;
516
+ }
517
+ #tree_sidebar li {
518
+ list-style-image: url("/stylesheets/folder.png");
519
+ font-weight: normal;
520
+ padding-bottom: 5px;
521
+ letter-spacing: 1px;
522
+ }
523
+
524
+ #tree_sidebar a {
525
+ text-decoration: none;
526
+ color: #222;
527
+ }
528
+ #tree_sidebar a:hover {
529
+ text-decoration: underline;
530
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
File without changes