voluntary_text_creation 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
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.rdoc ADDED
@@ -0,0 +1,23 @@
1
+ = VoluntaryTextCreation
2
+
3
+ This is a product engine for a rails application about text creation workflow using the crowdsourcing platform gem voluntary.
4
+
5
+ == Installation
6
+
7
+ Preconditions: install the voluntary gem in your rails application https://github.com/Applicat/voluntary
8
+
9
+ Add this to your Gemfile:
10
+
11
+ gem 'voluntary_text_creation'
12
+
13
+ Run this in your console:
14
+
15
+ bundle install
16
+
17
+ Run this in your console:
18
+
19
+ rake voluntary_text_creation:install:migrations
20
+
21
+ = License
22
+
23
+ This project uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'VoluntaryTextCreation'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,3 @@
1
+ class Product::TextCreation < ::Product
2
+ include ::Product::ProjectManagement
3
+ end
@@ -0,0 +1,14 @@
1
+ class Product::TextCreation::Result < ::Result
2
+ validate :text_length_between_range
3
+
4
+ private
5
+
6
+ def text_length_between_range
7
+ unless text && (text.strip.length >= task.story.min_length && text.strip.length <= task.story.max_length)
8
+ errors[:text] << I18n.t(
9
+ 'activerecord.errors.models.result.attributes.text.text_length_not_between_range',
10
+ min_length: task.story.min_length, max_length: task.story.max_length
11
+ )
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ class Product::TextCreation::Story < Story
2
+ include Model::MongoDb::Product::Keywords
3
+
4
+ has_many :tasks, dependent: :destroy, class_name: 'Product::TextCreation::Task', inverse_of: :story
5
+
6
+ field :language, type: String
7
+ field :min_length, type: Integer
8
+ field :max_length, type: Integer
9
+ field :with_quality_assurance, type: Boolean
10
+
11
+ attr_accessible :language, :min_length, :max_length, :with_quality_assurance
12
+
13
+ accepts_nested_attributes_for :tasks, allow_destroy: true, reject_if: ->(t) { t['name'].blank? }
14
+
15
+ validates :language, presence: true
16
+ validates :min_length, presence: true
17
+ validates :max_length, presence: true
18
+
19
+ def self.for_user(user)
20
+ active.where(:language.in => user.languages)
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ class Product::TextCreation::Task < ::Task
2
+ belongs_to :result, dependent: :destroy, class_name: 'Product::TextCreation::Result', inverse_of: :task
3
+
4
+ field :keywords, type: Array
5
+
6
+ attr_accessible :keywords
7
+
8
+ validates :keywords, presence: true, unless: ->(t) { t.story.with_keywords.blank? }
9
+ #validate :between_keyword_range
10
+
11
+ #track_history on: [:user_id, :name, :text, :keywords, :state]
12
+ end
@@ -0,0 +1,3 @@
1
+ class Product::TextCreation::Resources::General::Wizards::Story::Steps::ActivatePresenter < Presenter
2
+ def task_columns; ['name', 'keywords']; end
3
+ end
@@ -0,0 +1,5 @@
1
+ class Product::TextCreation::Resources::General::Wizards::Story::Steps::SetupTasksPresenter < Presenter
2
+ def form_options
3
+ { html: {class: 'floating_form form-vertical'} }
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ <%= simple_form_for(@story, html: {class: 'form-vertical'}) do |f| %>
2
+ <%= render partial: 'shared/form/error_messages', locals: { resource: @story } %>
3
+
4
+ <div class="form-inputs">
5
+ <%= @story.project ? f.hidden_field(:project_id) : f.input(:project_id, collection: Project.all) %>
6
+ <%= f.input :name %>
7
+ <%= f.input :language, collection: all_language_options %>
8
+ <%= f.input :min_length %>
9
+ <%= f.input :max_length %>
10
+ <%#= render 'products/mixins/keywords', f: f %>
11
+ <%#= f.check_box :with_quality_assurance %>
12
+ <%#= f.label :with_quality_assurance, t('activerecord.attributes.story.with_quality_assurance') %>
13
+ <%= f.input :text, as: :text, input_html: {style: 'width:500px; height:100px;'} %>
14
+ </div>
15
+
16
+ <div class="form-actions">
17
+ <%= f.button :submit %>
18
+ </div>
19
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <fieldset>
2
+ <%= f.input :name %>
3
+ <%= f.input :keywords if f.object.story.with_keywords %>
4
+ <%= remove_fields(f) %>
5
+ </fieldset>
6
+
7
+ <hr/>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,14 @@
1
+ class AddTextCreationProduct < ActiveRecord::Migration
2
+ def up
3
+ area = Area.create(name: 'General')
4
+
5
+ product = Product.new(name: 'Text Creation', text: 'Dummy', area_ids: [area.id])
6
+ product.user_id = User.where(name: 'Master').first.id
7
+ product.save!
8
+ end
9
+
10
+ def down
11
+ Area.where(name: 'General').first.destroy
12
+ Product.where(name: 'Text Creation').first.destroy
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class Product::TextCreation::Result < ::Result
2
+ validate :text_length_between_range
3
+
4
+ private
5
+
6
+ def text_length_between_range
7
+ unless text && (text.strip.length >= task.story.min_length && text.strip.length <= task.story.max_length)
8
+ errors[:text] << I18n.t(
9
+ 'activerecord.errors.models.result.attributes.text.text_length_not_between_range',
10
+ min_length: task.story.min_length, max_length: task.story.max_length
11
+ )
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ class Product::TextCreation::Story < Story
2
+ include Model::MongoDb::Product::Keywords
3
+
4
+ has_many :tasks, dependent: :destroy, class_name: 'Product::TextCreation::Task', inverse_of: :story
5
+
6
+ field :language, type: String
7
+ field :min_length, type: Integer
8
+ field :max_length, type: Integer
9
+ field :with_quality_assurance, type: Boolean
10
+
11
+ attr_accessible :language, :min_length, :max_length, :with_quality_assurance
12
+
13
+ accepts_nested_attributes_for :tasks, allow_destroy: true, reject_if: ->(t) { t['name'].blank? }
14
+
15
+ validates :language, presence: true
16
+ validates :min_length, presence: true
17
+ validates :max_length, presence: true
18
+
19
+ def self.for_user(user)
20
+ active.where(:language.in => user.languages)
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ class Product::TextCreation::Task < ::Task
2
+ belongs_to :result, dependent: :destroy, class_name: 'Product::TextCreation::Result', inverse_of: :task
3
+
4
+ field :keywords, type: Array
5
+
6
+ attr_accessible :keywords
7
+
8
+ validates :keywords, presence: true, unless: ->(t) { t.story.with_keywords.blank? }
9
+ #validate :between_keyword_range
10
+
11
+ #track_history on: [:user_id, :name, :text, :keywords, :state]
12
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :voluntary_text_creation do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,6 @@
1
+ require 'voluntary'
2
+
3
+ require "voluntary_text_creation/engine"
4
+
5
+ module VoluntaryTextCreation
6
+ end
@@ -0,0 +1,4 @@
1
+ module VoluntaryTextCreation
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module VoluntaryTextCreation
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,282 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voluntary_text_creation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mathias Gawlista
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: voluntary
16
+ requirement: &70318631764000 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70318631764000
25
+ - !ruby/object:Gem::Dependency
26
+ name: letter_opener
27
+ requirement: &70318631762940 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70318631762940
36
+ - !ruby/object:Gem::Dependency
37
+ name: oink
38
+ requirement: &70318631684120 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70318631684120
47
+ - !ruby/object:Gem::Dependency
48
+ name: awesome_print
49
+ requirement: &70318631681560 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70318631681560
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec-rails
60
+ requirement: &70318631679320 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '2.10'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70318631679320
69
+ - !ruby/object:Gem::Dependency
70
+ name: capybara
71
+ requirement: &70318631640600 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.1.2
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70318631640600
80
+ - !ruby/object:Gem::Dependency
81
+ name: capybara-webkit
82
+ requirement: &70318631638560 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70318631638560
91
+ - !ruby/object:Gem::Dependency
92
+ name: cucumber-rails-training-wheels
93
+ requirement: &70318631635660 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70318631635660
102
+ - !ruby/object:Gem::Dependency
103
+ name: timecop
104
+ requirement: &70318631633720 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70318631633720
113
+ - !ruby/object:Gem::Dependency
114
+ name: factory_girl_rails
115
+ requirement: &70318631632580 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - =
119
+ - !ruby/object:Gem::Version
120
+ version: 1.7.0
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *70318631632580
124
+ - !ruby/object:Gem::Dependency
125
+ name: fixture_builder
126
+ requirement: &70318631631160 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - =
130
+ - !ruby/object:Gem::Version
131
+ version: 0.3.3
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: *70318631631160
135
+ - !ruby/object:Gem::Dependency
136
+ name: fuubar
137
+ requirement: &70318631630080 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '1.0'
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: *70318631630080
146
+ - !ruby/object:Gem::Dependency
147
+ name: selenium-webdriver
148
+ requirement: &70318631629180 !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ~>
152
+ - !ruby/object:Gem::Version
153
+ version: 2.22.1
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: *70318631629180
157
+ - !ruby/object:Gem::Dependency
158
+ name: spork
159
+ requirement: &70318631628320 !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ~>
163
+ - !ruby/object:Gem::Version
164
+ version: 1.0rc2
165
+ type: :development
166
+ prerelease: false
167
+ version_requirements: *70318631628320
168
+ - !ruby/object:Gem::Dependency
169
+ name: guard-rspec
170
+ requirement: &70318631627500 !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: *70318631627500
179
+ - !ruby/object:Gem::Dependency
180
+ name: guard-spork
181
+ requirement: &70318631626600 !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: *70318631626600
190
+ - !ruby/object:Gem::Dependency
191
+ name: guard-cucumber
192
+ requirement: &70318631625340 !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: *70318631625340
201
+ - !ruby/object:Gem::Dependency
202
+ name: launchy
203
+ requirement: &70318631623260 !ruby/object:Gem::Requirement
204
+ none: false
205
+ requirements:
206
+ - - ! '>='
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ type: :development
210
+ prerelease: false
211
+ version_requirements: *70318631623260
212
+ - !ruby/object:Gem::Dependency
213
+ name: database_cleaner
214
+ requirement: &70318631622160 !ruby/object:Gem::Requirement
215
+ none: false
216
+ requirements:
217
+ - - =
218
+ - !ruby/object:Gem::Version
219
+ version: 0.7.1
220
+ type: :development
221
+ prerelease: false
222
+ version_requirements: *70318631622160
223
+ description: Crowdsourcing product engine about text creation workflow based on crowdsourcing
224
+ engine voluntary
225
+ email:
226
+ - gawlista@gmail.com
227
+ executables: []
228
+ extensions: []
229
+ extra_rdoc_files: []
230
+ files:
231
+ - app/models/product/text_creation/result.rb
232
+ - app/models/product/text_creation/story.rb
233
+ - app/models/product/text_creation/task.rb
234
+ - app/models/product/text_creation.rb
235
+ - app/presenters/product/text_creation/resources/general/wizards/story/steps/activate_presenter.rb
236
+ - app/presenters/product/text_creation/resources/general/wizards/story/steps/setup_tasks_presenter.rb
237
+ - app/views/products/types/text_creation/stories/_form.html.erb
238
+ - app/views/products/types/text_creation/stories/_task_fields.html.erb
239
+ - config/routes.rb
240
+ - db/migrate/20121030100815_add_text_creation_product.rb
241
+ - db/text_creation/result.rb
242
+ - db/text_creation/story.rb
243
+ - db/text_creation/task.rb
244
+ - lib/tasks/voluntary_text_creation_tasks.rake
245
+ - lib/voluntary_text_creation/engine.rb
246
+ - lib/voluntary_text_creation/version.rb
247
+ - lib/voluntary_text_creation.rb
248
+ - MIT-LICENSE
249
+ - Rakefile
250
+ - README.rdoc
251
+ homepage: http://github.com/Applicat/voluntary_text_creation
252
+ licenses: []
253
+ post_install_message:
254
+ rdoc_options: []
255
+ require_paths:
256
+ - lib
257
+ required_ruby_version: !ruby/object:Gem::Requirement
258
+ none: false
259
+ requirements:
260
+ - - ! '>='
261
+ - !ruby/object:Gem::Version
262
+ version: '0'
263
+ segments:
264
+ - 0
265
+ hash: 166178097292113036
266
+ required_rubygems_version: !ruby/object:Gem::Requirement
267
+ none: false
268
+ requirements:
269
+ - - ! '>='
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ segments:
273
+ - 0
274
+ hash: 166178097292113036
275
+ requirements: []
276
+ rubyforge_project:
277
+ rubygems_version: 1.8.17
278
+ signing_key:
279
+ specification_version: 3
280
+ summary: Crowdsourcing product engine about text creation workflow based on crowdsourcing
281
+ engine voluntary
282
+ test_files: []