transcribable 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/Rakefile +32 -0
- data/lib/generators/templates/assets/stylesheets/simple_frame.css +284 -0
- data/lib/generators/templates/config/documentcloud.yml +3 -0
- data/lib/generators/templates/controller.rb +48 -0
- data/lib/generators/templates/migration.rb +15 -0
- data/lib/generators/templates/migration_add_columns.rb +13 -0
- data/lib/generators/templates/model.rb +10 -0
- data/lib/generators/templates/views/_form.html.erb +32 -0
- data/lib/generators/templates/views/layouts/simple_frame.html.erb +50 -0
- data/lib/generators/templates/views/new.html.erb +28 -0
- data/lib/generators/transcribable_generator.rb +59 -0
- data/lib/tasks/harvester.rake +23 -0
- data/lib/transcribable.rb +156 -0
- data/lib/transcribable/railtie.rb +11 -0
- data/lib/transcribable/version.rb +3 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/filing.rb +6 -0
- data/test/dummy/app/models/transcription.rb +10 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/db/schema.rb +19 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +979 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/test_helper.rb +15 -0
- data/test/transcribable_test.rb +72 -0
- metadata +202 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 ProPublica
|
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/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Transcribable'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
Rake::TestTask.new(:test) do |t|
|
25
|
+
t.libs << 'lib'
|
26
|
+
t.libs << 'test'
|
27
|
+
t.pattern = 'test/**/*_test.rb'
|
28
|
+
t.verbose = false
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,284 @@
|
|
1
|
+
/* reset */
|
2
|
+
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
|
3
|
+
|
4
|
+
html {
|
5
|
+
background: #ebecec;
|
6
|
+
}
|
7
|
+
|
8
|
+
body {
|
9
|
+
font: 13px/1.23 "Helvetica Neue", Helvetica,Arial,sans-serif;
|
10
|
+
letter-spacing: 0.05em;
|
11
|
+
}
|
12
|
+
|
13
|
+
#simple_wrapper #banner {
|
14
|
+
background: #f9f9f9;
|
15
|
+
height: 60px;
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
#simple_wrapper #footer {
|
20
|
+
background: #EBECEC url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAMAAACDMFxkAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBQTFRF5OTk6enq6Ojo5eXl29ra4uLi0c/P39/f5ufn6urr6+vs3d3d4eDh09LS19fX6+zsM2wh7AAAADRJREFUeNqUxrcRwCAAALE3wQQT9t+W7s8tqsQrplgiiU8UMUQWP1FUEcQjmuhi66ZHgAEAr54HCboan7oAAAAASUVORK5CYII=") 0 0 repeat-x;
|
21
|
+
}
|
22
|
+
|
23
|
+
#footer .wrapper {
|
24
|
+
padding: 50px 0;
|
25
|
+
position: relative;
|
26
|
+
}
|
27
|
+
|
28
|
+
#footer-logo {
|
29
|
+
color: #8e8e8e;
|
30
|
+
float: left;
|
31
|
+
padding: 15px 10px 0;
|
32
|
+
width: 140px;
|
33
|
+
min-height: 100px;
|
34
|
+
}
|
35
|
+
|
36
|
+
#banner .wrapper {
|
37
|
+
height: 1%;
|
38
|
+
overflow: hidden;
|
39
|
+
min-height: 107px;
|
40
|
+
position: relative;
|
41
|
+
}
|
42
|
+
|
43
|
+
.wrapper {
|
44
|
+
margin: 0 auto;
|
45
|
+
width: 960px;
|
46
|
+
}
|
47
|
+
|
48
|
+
#simple_wrapper #banner-identity {
|
49
|
+
float: left;
|
50
|
+
width: 515px;
|
51
|
+
margin-top: 2px;
|
52
|
+
}
|
53
|
+
|
54
|
+
#banner-identity h1, #banner-identity p {
|
55
|
+
text-indent: -9999px;
|
56
|
+
float: left;
|
57
|
+
}
|
58
|
+
|
59
|
+
#simple_wrapper #banner-logo a {
|
60
|
+
background: url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAIYAAABLCAYAAA…D5XgZY8AYbqTzNoCIw1TeBg5+FGwxnHDVxwHx+Zb/FmAA7xgER2eeqMQAAAAASUVORK5CYII=") no-repeat scroll 0 0 transparent;
|
61
|
+
}
|
62
|
+
|
63
|
+
#simple_wrapper #banner-tagline {
|
64
|
+
display: none;
|
65
|
+
}
|
66
|
+
|
67
|
+
#banner-tagline {
|
68
|
+
height: 49px;
|
69
|
+
padding-top: 36px;
|
70
|
+
width: 281px;
|
71
|
+
}
|
72
|
+
|
73
|
+
#banner-identity #app-tagline {
|
74
|
+
font-size: 13px;
|
75
|
+
text-indent: 0;
|
76
|
+
position: absolute;
|
77
|
+
top: 37px;
|
78
|
+
font-weight: bold;
|
79
|
+
background: #fff;
|
80
|
+
padding: 15px;
|
81
|
+
margin-top: -20px;
|
82
|
+
border-top: 1px solid #cecece;
|
83
|
+
border-left: 1px solid #cecece;
|
84
|
+
border-right: 1px solid #cecece;
|
85
|
+
}
|
86
|
+
|
87
|
+
#banner-nav {
|
88
|
+
background: #fff url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAgCAMAAAAc2xnfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADxQTFRF7+/v8fHx6+vr7Ozs7u7u8vLy+vr69/f38/Pz+Pj4/Pz8+fn59PT06Ojo9vb2w8PD+/v7/f39/v7+////5+kaogAAAFFJREFUeNrUxtsRgCAMBdEbICrxFaH/XoUoGVvwfOwsqsMvtnS1lrHmu5d7VqSviopRqMO0DshzfuFwWLYBRMxMDSMBKbU0IYQYLdgdTncLMABOGxN48Fa78gAAAABJRU5ErkJggg==") 0 100% repeat-x;
|
89
|
+
clear: both;
|
90
|
+
font-family: "Helvetica Neue",Arial,sans-serif;
|
91
|
+
padding-top: 3px;
|
92
|
+
}
|
93
|
+
|
94
|
+
#banner-nav .wrapper {
|
95
|
+
position: relative;
|
96
|
+
background: url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAS0AAAAeCAIAAAD2GN8OAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABMtJREFUeNrsWlly2zAMJTu+/yU7bTPtFWKxUmjTEJYHUE7iuAU+PFog8OEB3GDWny9/SkpKykPlW1KQkpL9MCUlJfthSkr2w5SUlOyHKSnZD1NSUrIfpqRkP0xJScl+mJKS/TAlJSX7YUpK9sOUlJTshykp2Q9LexN68cVlgHwitO0qXx/tAPxcmfCOgE/dVq11GF2vaZPjVqJRX6mgu+Z6OxrqF6wtKvQTqUDtDAsWnlm0zD6DrYKhGNS3Ei3m1gUs0TKSI9yy0ANu78wEkAxuoFl8meMqY3cmw+FMOJwM9cev3wCQ1Zil+dhR7bnQHgD8cG4jGJLbI/NhfIp4L81PWDM8BdrnApzcfkY//AgoclL+D+UhY+1h5p8L7T9Vp2lErA0oeyLfqrfLsqimglte3KisRqjWZA0AbK9VO7KepH5uMbb+Uh5k7UQ2Kr1TOQExwtEEZhldbm7Ir6yQgaSK5B4wdYw9NxuxLzgTrCwCztbvP152VkqrRduOl7edJXnFnrAP+1v2iZ79e00LANUc+gBtf0s1JX7rFmBgjkvN8USidQ3Ki8gnEbooJBewGzJJAssE1QhmVQJ2XaMhAIxJBUyvS/5sMqhhZcqnpS18Y13NEhNl6lIOok9KkyUplo5ggb4hsz+R1bYVZ//FQR2aDO3QuRXiNF90HrYrE+0wu1t01VBEHcusUldLhGFqMwS4RFeJPXlUB5lNwKrkdmCw9GmLmLEdUftssZQvHtXiQlWSTeOW8aMqn+gkDsrcYw6lWwi8rJd1W1AiB/Vi5vO6zOtP+oVblB+fALS4aM4cH8rdrOoIVaZo3d0RpdrvBoZNQEJwW2gBkP8T0OWltdOLFy0pSNaKMyxCwKtZFhEZAhZflS6KBP97Iemycuw6H7L2tpFArCiGzoqjX9dtiqENqhY25XoZi7af/hUdSCSmq0Jkc3jBsAesfzgumHdXC6pBd4fAP7e2i5I02sTg5C1WOx3pYNcxImWiPawsCSFPOHibXiUEdibs6PWqOJcc0zJhN7vQPN/noZxUmF/F/icG5KFeOhmae/dPbdF6gh0xXQfcymtlQNo/nq2eTemrytid9wJg0WIR67Ktdf66iYboHpZai/oyRW8E0pTOVCBc5WNmC+/vEQAnsFxRTx6w6dU9wWAdmKje8OyeeLCAFXFwR1/Ta4te66wPcwEjUcE4Oz3NX7mSUaHK5oLtBomNvIrAxgkQPx11OFVAiuJtQgRJrJ/qIdv64Xk5q9WkG5QmHrYCrmmhkutoyuZ2vBVW8+TbYmXIDzXKinKmncbBjKoAapfwdiuUNX0fv+NWHzi9hoSbu6pvUwjsLktub9garyvSV4qnIOIwFrLOOehdnyxtseq9foraLClotajJTFDQar3GKj7fngy0TewP8dAr5wq2E41oqvpg7MRNWDrgvCKeGMFxQTCXYu8ireMdhXpwFJQu4uGYOmAZRGvNz1NoQbVsijdr0eRy5R4cdUtQUyeZu/5pOS/uwdlg+Q4o4zMTahXObShei5t1Ta7xtgJaW+5Zk7hMRrwOYojk/TCF086FhA+Uz/qoVzvb4qKyhm+LsSky4z0CH5pnGU5NnV7Pr3P5VCb+X/ogQavZRwvjJw41iT2G9okAA/krwAAyOHcBaxYX4QAAAABJRU5ErkJggg==") right no-repeat;
|
97
|
+
}
|
98
|
+
|
99
|
+
#content {
|
100
|
+
background: #fff;
|
101
|
+
clear: both;
|
102
|
+
padding: 0 5px 130px;
|
103
|
+
}
|
104
|
+
|
105
|
+
#simple_wrapper #content {
|
106
|
+
padding: 25px 5px 0;
|
107
|
+
}
|
108
|
+
|
109
|
+
#content .wrapper {
|
110
|
+
height: auto;
|
111
|
+
width: 960px;
|
112
|
+
overflow:auto;
|
113
|
+
}
|
114
|
+
|
115
|
+
#simple_frame {
|
116
|
+
position: relative;
|
117
|
+
padding: 20px 0 20px 0;
|
118
|
+
}
|
119
|
+
|
120
|
+
#content h1 {
|
121
|
+
font-size: 34px;
|
122
|
+
margin-bottom: 10px;
|
123
|
+
text-rendering: optimizeLegibility;
|
124
|
+
}
|
125
|
+
|
126
|
+
#left-dc-embed, .left-dc-embed {
|
127
|
+
float: left;
|
128
|
+
width: 658px;
|
129
|
+
margin-right: 10px;
|
130
|
+
position: relative;
|
131
|
+
height: 920px;
|
132
|
+
}
|
133
|
+
.document_pkg {
|
134
|
+
float: left;
|
135
|
+
margin-bottom: 5px;
|
136
|
+
}
|
137
|
+
|
138
|
+
#right-column, .right-column {
|
139
|
+
width: 290px;
|
140
|
+
min-height: 300px;
|
141
|
+
float: left;
|
142
|
+
}
|
143
|
+
|
144
|
+
#new_transcription, .edit_filing {
|
145
|
+
margin-left: 5px;
|
146
|
+
}
|
147
|
+
|
148
|
+
#right-column .do_something {
|
149
|
+
font-family: "Helvetica Neue",Arial,sans-serif;
|
150
|
+
overflow: auto;
|
151
|
+
border-top: 2px solid #CECECE;
|
152
|
+
border-left: 2px solid #F0F0F0;
|
153
|
+
border-bottom: 2px solid #F0F0F0;
|
154
|
+
border-right: 2px solid #F0F0F0;
|
155
|
+
padding: 15px;
|
156
|
+
margin-bottom: 15px;
|
157
|
+
background: #E9F0F8;
|
158
|
+
-moz-box-shadow: 0 0 5px #f0f0f0;
|
159
|
+
-webkit-box-shadow: 0 0 5px #F0F0F0;
|
160
|
+
-webkit-border-bottom-right-radius: 4px;
|
161
|
+
-webkit-border-bottom-left-radius: 4px;
|
162
|
+
-moz-border-radius-bottomright: 4px;
|
163
|
+
-moz-border-radius-bottomleft: 4px;
|
164
|
+
border-bottom-right-radius: 4px;
|
165
|
+
border-bottom-left-radius: 4px;
|
166
|
+
}
|
167
|
+
|
168
|
+
#right-column form h2 {
|
169
|
+
font-size: 20px;
|
170
|
+
margin-bottom: 3px;
|
171
|
+
}
|
172
|
+
|
173
|
+
#new_transcription input.wwwinput, .edit_filing input {
|
174
|
+
height: 30px;
|
175
|
+
font-family: Helvetica,arial,sans-serif;
|
176
|
+
font-size: 24px;
|
177
|
+
width: 90%;
|
178
|
+
margin-top: 3px;
|
179
|
+
}
|
180
|
+
|
181
|
+
/* pretty */
|
182
|
+
.fancy_btn{
|
183
|
+
padding:5px;
|
184
|
+
background:#fff;
|
185
|
+
-webkit-border-radius:04px;
|
186
|
+
-moz-border-radius:04px;
|
187
|
+
border-radius:04px;
|
188
|
+
font-weight:bold;
|
189
|
+
border:1px solid #999;
|
190
|
+
cursor:pointer;
|
191
|
+
user-select:none;
|
192
|
+
-moz-user-select:none;
|
193
|
+
-khtml-user-select:none;
|
194
|
+
-webkit-box-shadow:#cecece 0 0 2px;
|
195
|
+
-moz-box-shadow:#cecece 0 0 2px;
|
196
|
+
color:black;
|
197
|
+
-webkit-user-select:none;
|
198
|
+
text-shadow:1px 1px 0 white;
|
199
|
+
background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f0f0f0));
|
200
|
+
background:-moz-linear-gradient(top,#fff,#f0f0f0);
|
201
|
+
font-family:Helvetica,arial,sans-serif;
|
202
|
+
font-weight:bold;
|
203
|
+
text-transform:none;
|
204
|
+
text-decoration:none;
|
205
|
+
font-size:14px;
|
206
|
+
}
|
207
|
+
.fancy_btn:hover{
|
208
|
+
color:black;
|
209
|
+
cursor:pointer;
|
210
|
+
text-decoration:none;
|
211
|
+
background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#dedede));
|
212
|
+
background:-moz-linear-gradient(top,#fff,#dedede);
|
213
|
+
-webkit-box-shadow:#999 0 0 2px;
|
214
|
+
-moz-box-shadow:#999 0 0 2px;
|
215
|
+
}
|
216
|
+
.fancy_btn:active{
|
217
|
+
position:relative;
|
218
|
+
top:1px;
|
219
|
+
}
|
220
|
+
|
221
|
+
.full_width_btn{
|
222
|
+
width: 100%;
|
223
|
+
padding-top: 8px;
|
224
|
+
padding-bottom: 8px;
|
225
|
+
display: block;
|
226
|
+
text-align: center;
|
227
|
+
}
|
228
|
+
.toplines-btn.be-first-btn {
|
229
|
+
width:290px !important;
|
230
|
+
}
|
231
|
+
.red-btn, .red-btn:hover {
|
232
|
+
color: white;
|
233
|
+
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
234
|
+
background-color: #DA4F49;
|
235
|
+
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#EE5F5B), to(#BD362F));
|
236
|
+
background-image: -webkit-linear-gradient(top, #EE5F5B, #BD362F);
|
237
|
+
background-image: -o-linear-gradient(top, #EE5F5B, #BD362F);
|
238
|
+
background-image: linear-gradient(to bottom, #EE5F5B, #BD362F);
|
239
|
+
background-image: -moz-linear-gradient(top, #EE5F5B, #BD362F);
|
240
|
+
background-repeat: repeat-x;
|
241
|
+
border-color: #BD362F #BD362F #802420;
|
242
|
+
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
|
243
|
+
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
|
244
|
+
}
|
245
|
+
.green-btn, .green-btn:hover {
|
246
|
+
color: white;
|
247
|
+
font-weight: normal; /* on green bg, bold white text looks awful. */
|
248
|
+
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
249
|
+
background-color: #5BB75B;
|
250
|
+
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62C462), to(#51A351));
|
251
|
+
background-image: -webkit-linear-gradient(top, #62C462, #51A351);
|
252
|
+
background-image: -o-linear-gradient(top, #62C462, #51A351);
|
253
|
+
background-image: linear-gradient(to bottom, #62C462, #51A351);
|
254
|
+
background-image: -moz-linear-gradient(top, #62C462, #51A351);
|
255
|
+
background-repeat: repeat-x;
|
256
|
+
border-color: #51A351 #51A351 #387038;
|
257
|
+
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0);
|
258
|
+
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
/* Flash notices/alert */
|
263
|
+
.notice {
|
264
|
+
color: #000;
|
265
|
+
background: #CCFFCC;
|
266
|
+
border-radius:3px;
|
267
|
+
margin-top:10px;
|
268
|
+
box-shadow: 0 0 3px #cecece;
|
269
|
+
}
|
270
|
+
.error, .warn, .notice, #simple_frame #error_explanation {
|
271
|
+
padding: 10px;
|
272
|
+
margin-bottom: 5px;
|
273
|
+
font-weight:bold;
|
274
|
+
font-family:Helvetica,arial,sans-serif;
|
275
|
+
}
|
276
|
+
.error{
|
277
|
+
color: #660000;
|
278
|
+
background: #FFEEEE;
|
279
|
+
}
|
280
|
+
.warn{
|
281
|
+
color:#000;
|
282
|
+
background:#FBFFCE;
|
283
|
+
}
|
284
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class TranscriptionsController < ActionController::Base
|
2
|
+
layout "simple_frame"
|
3
|
+
|
4
|
+
def new
|
5
|
+
@<%= @table.singularize %> = <%= @table.classify %>.assign!(current_user)
|
6
|
+
# if we're able to assign a filing
|
7
|
+
# that the user hasn't done and hasn't been verified
|
8
|
+
if @<%= @table.singularize %>.nil?
|
9
|
+
redirect_to(root_path, :alert => "You've transcribed all of the filings. Thank you.")
|
10
|
+
return
|
11
|
+
end
|
12
|
+
@transcription = Transcription.new
|
13
|
+
@transcription.<%= @table.singularize %> = @<%= @table.singularize %>
|
14
|
+
end
|
15
|
+
|
16
|
+
def create
|
17
|
+
@<%= @table.singularize %> = <%= @table.classify %>.find(params[:<%= @table.singularize %>_id])
|
18
|
+
@transcription = Transcription.new(transcription_params)
|
19
|
+
@transcription.<%= @table.singularize %> = @<%= @table.singularize %>
|
20
|
+
@transcription.user_id = current_user
|
21
|
+
|
22
|
+
if @transcription.save
|
23
|
+
@<%= @table.singularize %>.verify!
|
24
|
+
redirect_to(new_transcription_path, :notice => "Thank you for transcribing. Here's another filing.")
|
25
|
+
else
|
26
|
+
render :action => "new", :alert => "Something went wrong. Please try again."
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# By default, the current user is stored in a cookie.
|
33
|
+
# For rigorous purposes, please consider implementing a
|
34
|
+
# real login system.
|
35
|
+
def current_user
|
36
|
+
cookie_name = "#{Rails.application.engine_name}_transcriable_user_id".to_sym
|
37
|
+
return cookies[cookie_name] if cookies[cookie_name]
|
38
|
+
cookies[cookie_name] = {
|
39
|
+
:value => UUID.new.generate(:compact),
|
40
|
+
:expires => 5.years.from_now
|
41
|
+
}
|
42
|
+
cookies[cookie_name]
|
43
|
+
end
|
44
|
+
|
45
|
+
def transcription_params
|
46
|
+
params.require(:transcription).permit(<%= transcribable_attrs.keys.map{|q| ":#{q}" }.join(",") %>)
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateTranscriptionsTable < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :transcriptions do |t|
|
4
|
+
<% transcribable_attrs.each do |name, type| %>
|
5
|
+
t.<%= type.to_s %> :<%= name %>
|
6
|
+
<% end %>
|
7
|
+
t.integer :<%= @table.singularize %>_id
|
8
|
+
t.string :user_id # by default, this will be a UUID stored by cookie
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :transcriptions
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class <%= @migration_name.camelize %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
<% new_columns.each do |name, type| %>
|
4
|
+
add_column :transcriptions, :<%= name %>, :<%= type.to_s %>
|
5
|
+
<% end %>
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
<% new_columns.each do |name, type| %>
|
10
|
+
remove_column :transcriptions, :<%= name %>, :<%= type.to_s %>
|
11
|
+
<% end %>
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Transcription < ActiveRecord::Base
|
2
|
+
belongs_to :user
|
3
|
+
belongs_to :<%= @table.singularize %>
|
4
|
+
|
5
|
+
Transcribable.transcribable_attrs.select {|k,v| [:integer, :float, :decimal].include?(v) }.keys.each do |k|
|
6
|
+
define_method("#{k}=") do |val|
|
7
|
+
write_attribute k.to_sym, val.to_s.gsub(/[^0-9\.]/,"").to_f
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%%= form_for(@transcription) do |f| %>
|
2
|
+
<%% if @transcription.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%%= pluralize(@transcription.errors.count, "error") %> prohibited this transcription from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<%% @transcription.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%%= msg %></li>
|
9
|
+
<%% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<%% end %>
|
13
|
+
|
14
|
+
<% transcribable_attrs.each do |col, type| %>
|
15
|
+
<div class="do_something">
|
16
|
+
<% if [:string, :integer].include?(type) %>
|
17
|
+
<h2><%= col.titleize %></h2>
|
18
|
+
<%%= label_tag :<%= col %>, "Your attribute description here" %><br />
|
19
|
+
<%%= f.text_field :<%= col %>, {:class => "wwwinput", :tabindex => 3} %>
|
20
|
+
<% end %>
|
21
|
+
<% if [:text].include?(type) %>
|
22
|
+
<h2><%= col.titleize %></h2>
|
23
|
+
<div class="field" id="notes">
|
24
|
+
<%%= f.label :<%= col %>, "Your attribute description here" %><br />
|
25
|
+
<%%= f.text_area :<%= col %>, :size => "26x8", :class => "wwwinput", :style => "padding:5px;width:98%", :tabindex => 6 %>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
<%%= hidden_field_tag "filing_id", @<%= @table.singularize %>.id %>
|
31
|
+
<%%= submit_tag "Submit", :class => "fancy_btn full_width_btn green-btn", :id => "transcriptionsubmit" %>
|
32
|
+
<%% end %>
|