voluntary 0.1.0.rc4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. data/MIT-LICENSE +0 -0
  2. data/README.rdoc +0 -0
  3. data/Rakefile +0 -0
  4. data/app/assets/images/voluntary/spinner.gif +0 -0
  5. data/app/assets/javascripts/voluntary/application.js +0 -0
  6. data/app/assets/javascripts/voluntary/base.js.coffee +0 -0
  7. data/app/assets/javascripts/voluntary/functions.js +0 -0
  8. data/app/assets/javascripts/voluntary/users.js.coffee +0 -0
  9. data/app/assets/stylesheets/voluntary/application.css +0 -0
  10. data/app/assets/stylesheets/voluntary/base.css.sass +0 -0
  11. data/app/assets/stylesheets/voluntary/bootstrap_and_overrides.css.sass +0 -0
  12. data/app/controllers/areas_controller.rb +0 -0
  13. data/app/controllers/candidatures_controller.rb +0 -0
  14. data/app/controllers/comments_controller.rb +0 -0
  15. data/app/controllers/devise_extensions/registrations_controller.rb +0 -0
  16. data/app/controllers/home_controller.rb +0 -0
  17. data/app/controllers/pages_controller.rb +0 -0
  18. data/app/controllers/products_controller.rb +0 -0
  19. data/app/controllers/professions_controller.rb +0 -0
  20. data/app/controllers/results_controller.rb +0 -0
  21. data/app/controllers/stories_controller.rb +0 -1
  22. data/app/controllers/tasks_controller.rb +0 -0
  23. data/app/controllers/users_controller.rb +0 -0
  24. data/app/controllers/vacancies_controller.rb +0 -0
  25. data/app/controllers/workflow/candidatures_controller.rb +0 -0
  26. data/app/controllers/workflow/products_controller.rb +1 -1
  27. data/app/controllers/workflow/user/product/areas_controller.rb +0 -0
  28. data/app/controllers/workflow/user/projects_controller.rb +3 -1
  29. data/app/controllers/workflow/vacancies_controller.rb +0 -0
  30. data/app/controllers/workflow_controller.rb +0 -0
  31. data/app/helpers/application_helper.rb +0 -0
  32. data/app/helpers/collection_helper.rb +0 -0
  33. data/app/helpers/comments_helper.rb +0 -0
  34. data/app/helpers/form_helper.rb +0 -0
  35. data/app/helpers/language_helper.rb +0 -0
  36. data/app/helpers/layout_helper.rb +0 -0
  37. data/app/helpers/product_helper.rb +0 -0
  38. data/app/helpers/show_helper.rb +0 -0
  39. data/app/helpers/wizard_helper.rb +0 -0
  40. data/app/models/ability.rb +0 -0
  41. data/app/models/area.rb +2 -2
  42. data/app/models/area_user.rb +0 -0
  43. data/app/models/candidature.rb +0 -0
  44. data/app/models/column.rb +23 -0
  45. data/app/models/comment.rb +0 -0
  46. data/app/models/mongo_db_document.rb +0 -0
  47. data/app/models/page.rb +0 -0
  48. data/app/models/product.rb +6 -2
  49. data/app/models/product/new_product.rb +0 -0
  50. data/app/models/product/project_management.rb +2 -2
  51. data/app/models/profession.rb +0 -0
  52. data/app/models/project_user.rb +0 -0
  53. data/app/models/role.rb +0 -0
  54. data/app/models/role/admin.rb +0 -0
  55. data/app/models/role/master.rb +0 -0
  56. data/app/models/role/project_owner.rb +0 -0
  57. data/app/models/role/user.rb +0 -0
  58. data/app/models/state_machines/candidature.rb +0 -0
  59. data/app/models/state_machines/page.rb +0 -0
  60. data/app/models/state_machines/vacancy.rb +0 -0
  61. data/app/models/story.rb +2 -1
  62. data/app/models/task.rb +14 -1
  63. data/app/models/user_role.rb +0 -0
  64. data/app/models/vacancy.rb +0 -0
  65. data/app/observers/candidature_observer.rb +0 -0
  66. data/app/observers/story_observer.rb +0 -0
  67. data/app/presenters/resource_presenter.rb +0 -0
  68. data/app/presenters/resources/general/wizards/story/steps/activate_presenter.rb +0 -0
  69. data/app/presenters/resources/general/wizards/story/steps/setup_tasks_presenter.rb +0 -0
  70. data/app/presenters/resources/general/wizards/story_presenter.rb +0 -0
  71. data/app/presenters/resources/user/form_presenter.rb +0 -0
  72. data/app/views/areas/_form.html.erb +0 -0
  73. data/app/views/areas/edit.html.erb +0 -0
  74. data/app/views/areas/new.html.erb +0 -0
  75. data/app/views/areas/show.html.erb +0 -0
  76. data/app/views/candidatures/_form.html.erb +0 -0
  77. data/app/views/candidatures/edit.html.erb +0 -0
  78. data/app/views/candidatures/index.html.erb +0 -0
  79. data/app/views/candidatures/new.html.erb +0 -0
  80. data/app/views/candidatures/show.html.erb +0 -0
  81. data/app/views/columns/_collection.html.erb +12 -0
  82. data/app/views/comments/_form.html.erb +0 -0
  83. data/app/views/comments/_resource.html.erb +0 -0
  84. data/app/views/comments/edit.html.erb +0 -0
  85. data/app/views/comments/new.html.erb +0 -0
  86. data/app/views/devise/mailer/confirmation_instructions.html.erb +0 -0
  87. data/app/views/devise/registrations/new.html.erb +0 -0
  88. data/app/views/general/wizard.html.erb +0 -0
  89. data/app/views/kaminari/_first_page.html.erb +0 -0
  90. data/app/views/kaminari/_gap.html.erb +0 -0
  91. data/app/views/kaminari/_last_page.html.erb +0 -0
  92. data/app/views/kaminari/_next_page.html.erb +0 -0
  93. data/app/views/kaminari/_page.html.erb +0 -0
  94. data/app/views/kaminari/_paginator.html.erb +0 -0
  95. data/app/views/kaminari/_prev_page.html.erb +0 -0
  96. data/app/views/layouts/application.html.erb +0 -0
  97. data/app/views/layouts/shared/_flash_messages.html.erb +0 -0
  98. data/app/views/layouts/shared/_navigation.html.erb +0 -0
  99. data/app/views/pages/_form.html.erb +0 -0
  100. data/app/views/pages/edit.html.erb +0 -0
  101. data/app/views/pages/new.html.erb +0 -0
  102. data/app/views/pages/show.html.erb +0 -0
  103. data/app/views/products/_form.html.erb +0 -0
  104. data/app/views/products/edit.html.erb +0 -0
  105. data/app/views/products/index.html.erb +0 -0
  106. data/app/views/products/mixins/_keywords.html.erb +0 -0
  107. data/app/views/products/new.html.erb +0 -0
  108. data/app/views/products/show.html.erb +0 -0
  109. data/app/views/projects/_form.html.erb +0 -0
  110. data/app/views/projects/edit.html.erb +0 -0
  111. data/app/views/projects/index.html.erb +0 -0
  112. data/app/views/projects/new.html.erb +0 -0
  113. data/app/views/projects/show.html.erb +0 -0
  114. data/app/views/shared/_comments.html.erb +0 -0
  115. data/app/views/shared/collection/_list.html.erb +0 -0
  116. data/app/views/shared/collection/_table.html.erb +3 -1
  117. data/app/views/shared/form/_error_messages.html.erb +0 -0
  118. data/app/views/shared/resource/_actions.html.erb +7 -5
  119. data/app/views/shared/resource/_event_elements.html.erb +0 -0
  120. data/app/views/stories/_collection.html.erb +0 -0
  121. data/app/views/stories/_column_fields.html.erb +11 -0
  122. data/app/views/stories/_form.html.erb +0 -0
  123. data/app/views/stories/_task_fields.html.erb +0 -0
  124. data/app/views/stories/index.html.erb +0 -0
  125. data/app/views/stories/show.html.erb +0 -0
  126. data/app/views/stories/steps/_activate.html.erb +0 -0
  127. data/app/views/stories/steps/_setup_tasks.html.erb +0 -0
  128. data/app/views/stories/tasks.html.erb +0 -0
  129. data/app/views/tasks/_collection.html.erb +0 -0
  130. data/app/views/users/_form.html.erb +0 -0
  131. data/app/views/users/edit.html.erb +0 -0
  132. data/app/views/users/index.html.erb +0 -0
  133. data/app/views/users/new.html.erb +0 -0
  134. data/app/views/users/preferences.html.erb +0 -0
  135. data/app/views/users/show.html.erb +0 -0
  136. data/app/views/vacancies/_form.html.erb +0 -0
  137. data/app/views/vacancies/edit.html.erb +0 -0
  138. data/app/views/vacancies/index.html.erb +0 -0
  139. data/app/views/vacancies/new.html.erb +0 -0
  140. data/app/views/vacancies/show.html.erb +0 -0
  141. data/app/views/workflow/index.html.erb +0 -0
  142. data/app/views/workflow/project_owner/_candidatures.html.erb +0 -0
  143. data/app/views/workflow/project_owner/_vacancies.html.erb +0 -0
  144. data/app/views/workflow/tasks/steps/_work.html.erb +3 -1
  145. data/app/views/workflow/user/index.html.erb +0 -0
  146. data/app/views/workflow/user/product/areas/show.html.erb +0 -0
  147. data/app/views/workflow/user/projects/show.html.erb +0 -0
  148. data/config/initializers/1_initialize_app_config.rb +0 -0
  149. data/config/initializers/devise.rb +0 -0
  150. data/config/initializers/locale_settings.rb +0 -0
  151. data/config/initializers/simple_form.rb +0 -0
  152. data/config/initializers/simple_navigation.rb +0 -0
  153. data/config/initializers/vendor_extensions.rb +0 -0
  154. data/config/locales/resources/area/en.yml +0 -0
  155. data/config/locales/resources/candidature/en.yml +0 -0
  156. data/config/locales/resources/comment/en.yml +0 -0
  157. data/config/locales/resources/organization/en.yml +0 -0
  158. data/config/locales/resources/page/en.yml +0 -0
  159. data/config/locales/resources/product/en.yml +0 -0
  160. data/config/locales/resources/project/en.yml +0 -0
  161. data/config/locales/resources/result/en.yml +0 -0
  162. data/config/locales/resources/story/en.yml +0 -0
  163. data/config/locales/resources/task/en.yml +0 -0
  164. data/config/locales/resources/user/en.yml +0 -0
  165. data/config/locales/resources/vacancy/en.yml +0 -0
  166. data/config/routes.rb +0 -0
  167. data/config/routes/workflow.rb +0 -0
  168. data/db/migrate/20120907144853_create_schema.rb +1 -1
  169. data/db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb +0 -0
  170. data/db/migrate/20120919161831_add_unique_index_for_one_user_candidature_per_vacancy.rb +0 -0
  171. data/db/migrate/20120922201955_create_mongo_db_documents.rb +0 -0
  172. data/db/migrate/20120923140109_add_product_to_project.rb +0 -0
  173. data/db/migrate/20121004061413_add_extra_user_attributes.rb +0 -0
  174. data/db/migrate/20121004132105_create_professions.rb +0 -0
  175. data/db/migrate/20121006162913_add_public_attribute_to_roles.rb +0 -0
  176. data/db/migrate/20121006170407_add_type_attribute_to_roles.rb +0 -0
  177. data/db/migrate/20121007071543_add_foreign_languages_to_user.rb +0 -0
  178. data/db/migrate/20121028073712_create_organizations.rb +0 -0
  179. data/db/migrate/20121122185954_add_klass_name_to_products.rb +0 -0
  180. data/db/seeds.rb +0 -0
  181. data/lib/applicat/mvc/controller/error_handling.rb +0 -0
  182. data/lib/applicat/mvc/controller/resource.rb +0 -0
  183. data/lib/applicat/mvc/controller/transition_actions.rb +0 -0
  184. data/lib/applicat/mvc/model/resource/base.rb +0 -0
  185. data/lib/applicat/mvc/model/tree.rb +0 -0
  186. data/lib/db_seed.rb +0 -0
  187. data/lib/environment_configuration.rb +0 -0
  188. data/lib/generators/voluntary/install/install_generator.rb +0 -0
  189. data/lib/generators/voluntary/install/templates/app/controllers/application_controller.rb +0 -0
  190. data/lib/generators/voluntary/install/templates/app/models/app_config.rb +0 -0
  191. data/lib/generators/voluntary/install/templates/app/models/application/ability.rb +0 -0
  192. data/lib/generators/voluntary/install/templates/app/views/layouts/application.html.erb +0 -0
  193. data/lib/generators/voluntary/install/templates/config/application.yml +0 -0
  194. data/lib/generators/voluntary/install/templates/config/cucumber.yml +0 -0
  195. data/lib/generators/voluntary/install/templates/config/database.example.yml +0 -0
  196. data/lib/generators/voluntary/install/templates/config/deploy.rb +0 -0
  197. data/lib/generators/voluntary/install/templates/config/email.example.yml +0 -0
  198. data/lib/generators/voluntary/install/templates/config/initializers/recaptcha_example +0 -0
  199. data/lib/generators/voluntary/install/templates/config/locale_settings.yml +0 -0
  200. data/lib/generators/voluntary/install/templates/config/main_navigation.rb +0 -0
  201. data/lib/generators/voluntary/install/templates/config/mongoid.yml +0 -0
  202. data/lib/generators/voluntary/install/templates/config/nginx.conf +0 -0
  203. data/lib/generators/voluntary/install/templates/config/unicorn.rb +0 -0
  204. data/lib/generators/voluntary/install/templates/db/seeds.rb +0 -0
  205. data/lib/generators/voluntary/install/templates/features/step_definitions/email_steps.rb +0 -0
  206. data/lib/generators/voluntary/install/templates/features/step_definitions/factory_steps.rb +0 -0
  207. data/lib/generators/voluntary/install/templates/features/step_definitions/javascript_steps.rb +0 -0
  208. data/lib/generators/voluntary/install/templates/features/step_definitions/navigation_steps.rb +0 -0
  209. data/lib/generators/voluntary/install/templates/features/step_definitions/resources_steps.rb +0 -0
  210. data/lib/generators/voluntary/install/templates/features/step_definitions/session_steps.rb +0 -0
  211. data/lib/generators/voluntary/install/templates/features/step_definitions/user_steps.rb +0 -0
  212. data/lib/generators/voluntary/install/templates/features/step_definitions/web_steps.rb +0 -0
  213. data/lib/generators/voluntary/install/templates/features/support/database_cleaner_patches.rb +0 -0
  214. data/lib/generators/voluntary/install/templates/features/support/env.rb +0 -0
  215. data/lib/generators/voluntary/install/templates/features/support/integration_sessions_controller.rb +0 -0
  216. data/lib/generators/voluntary/install/templates/features/support/integration_sessions_form.html.erb +0 -0
  217. data/lib/generators/voluntary/install/templates/features/support/selectors.rb +0 -0
  218. data/lib/generators/voluntary/install/templates/features/support/spork_env +0 -0
  219. data/lib/generators/voluntary/install/templates/features/support/user_cuke_helpers.rb +0 -0
  220. data/lib/generators/voluntary/install/templates/lib/volontariat_seed.rb +0 -0
  221. data/lib/generators/voluntary/install/templates/spec/spec_helper.rb +0 -0
  222. data/lib/generators/voluntary/install/templates/spec/support/deferred_garbage_collector.rb +0 -0
  223. data/lib/generators/voluntary/install/templates/spec/support/devise.rb +0 -0
  224. data/lib/generators/voluntary/install/templates/spec/support/mongo_database_cleaner.rb +0 -0
  225. data/lib/generators/voluntary/install/templates/vendor/assets/javascripts/jquery.tokeninput.js +0 -0
  226. data/lib/generators/voluntary/product_dummy/product_dummy_generator.rb +0 -0
  227. data/lib/generators/voluntary/product_dummy/templates/app/controllers/application_controller.rb +0 -0
  228. data/lib/generators/voluntary/product_dummy/templates/app/controllers/home_controller.rb +0 -0
  229. data/lib/generators/voluntary/product_dummy/templates/app/models/app_config.rb +0 -0
  230. data/lib/generators/voluntary/product_dummy/templates/app/views/home/index.html.erb +0 -0
  231. data/lib/generators/voluntary/product_dummy/templates/app/views/layouts/application.html.erb +0 -0
  232. data/lib/generators/voluntary/product_dummy/templates/config/application.yml +0 -0
  233. data/lib/generators/voluntary/product_dummy/templates/config/cucumber.yml +0 -0
  234. data/lib/generators/voluntary/product_dummy/templates/config/database.example.yml +0 -0
  235. data/lib/generators/voluntary/product_dummy/templates/config/email.example.yml +0 -0
  236. data/lib/generators/voluntary/product_dummy/templates/config/locale_settings.yml +0 -0
  237. data/lib/generators/voluntary/product_dummy/templates/config/main_navigation.rb +0 -0
  238. data/lib/generators/voluntary/product_dummy/templates/config/mongoid.yml +0 -0
  239. data/lib/generators/voluntary/product_dummy/templates/config/routes.rb +0 -0
  240. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/area_behaviour_steps.rb +0 -0
  241. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/area_steps.rb +0 -0
  242. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/candidature_steps.rb +0 -0
  243. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/comment_behaviour_steps.rb +0 -0
  244. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/comment_steps.rb +0 -0
  245. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/email_steps.rb +0 -0
  246. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/factory_steps.rb +0 -0
  247. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/javascript_steps.rb +0 -0
  248. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/navigation_steps.rb +0 -0
  249. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/product_steps.rb +0 -0
  250. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/project_steps.rb +0 -0
  251. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/resources_steps.rb +0 -0
  252. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/session_steps.rb +0 -0
  253. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/state_machines/vacancy_steps.rb +0 -0
  254. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/user_steps.rb +0 -0
  255. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/vacancy_steps.rb +0 -0
  256. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/web_steps.rb +0 -0
  257. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/wizards/story_steps.rb +0 -0
  258. data/lib/generators/voluntary/product_dummy/templates/features/support/database_cleaner_patches.rb +0 -0
  259. data/lib/generators/voluntary/product_dummy/templates/features/support/env.rb +0 -0
  260. data/lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_controller.rb +0 -0
  261. data/lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_form.html.erb +0 -0
  262. data/lib/generators/voluntary/product_dummy/templates/features/support/selectors.rb +0 -0
  263. data/lib/generators/voluntary/product_dummy/templates/features/support/spork_env +0 -0
  264. data/lib/generators/voluntary/product_dummy/templates/features/support/user_cuke_helpers.rb +0 -0
  265. data/lib/generators/voluntary/product_dummy/templates/spec/support/deferred_garbage_collector.rb +0 -0
  266. data/lib/generators/voluntary/product_dummy/templates/spec/support/devise.rb +0 -0
  267. data/lib/generators/voluntary/product_dummy/templates/spec/support/mongo_database_cleaner.rb +0 -0
  268. data/lib/generators/voluntary/product_dummy/templates/vendor/assets/javascripts/jquery.tokeninput.js +0 -0
  269. data/lib/generators/voluntary/product_dummy/templates/vendor/assets/stylesheets/token-input-facebook.css +0 -0
  270. data/lib/generators/voluntary/product_dummy/templates/vendor/assets/stylesheets/token-input-mac.css +0 -0
  271. data/lib/generators/voluntary/product_dummy/templates/vendor/assets/stylesheets/token-input.css +0 -0
  272. data/lib/i18n_interpolation_fallbacks.rb +0 -0
  273. data/lib/model/mongo_db/commentable.rb +0 -0
  274. data/lib/model/mongo_db/core_extensions.rb +0 -0
  275. data/lib/model/mongo_db/customizable.rb +0 -0
  276. data/lib/model/mongo_db/product/keywords.rb +0 -0
  277. data/lib/model/mongo_db/state_version_attributes.rb +0 -0
  278. data/lib/tasks/cucumber.rake +0 -0
  279. data/lib/tasks/voluntary_tasks.rake +0 -0
  280. data/lib/vendors/simple_navigation/renderer/breadcrumbs_without_method_links.rb +0 -0
  281. data/lib/vendors/simple_navigation/renderer/twitter_sidenav.rb +0 -0
  282. data/lib/volontariat_seed.rb +0 -0
  283. data/lib/voluntary.rb +0 -0
  284. data/lib/voluntary/engine.rb +0 -0
  285. data/lib/voluntary/helpers/application.rb +0 -0
  286. data/lib/voluntary/helpers/comments.rb +0 -0
  287. data/lib/voluntary/helpers/form.rb +0 -0
  288. data/lib/voluntary/helpers/language.rb +0 -0
  289. data/lib/voluntary/helpers/layout.rb +0 -0
  290. data/lib/voluntary/helpers/show.rb +0 -0
  291. data/lib/voluntary/version.rb +1 -1
  292. data/vendor_extensions/active_model/naming.rb +0 -0
  293. metadata +211 -28
  294. checksums.yaml +0 -15
File without changes
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -43,7 +43,6 @@ class StoriesController < ApplicationController
43
43
 
44
44
  def update
45
45
  @story.attributes = params[:story]
46
-
47
46
  success = params[:next_step] == '1' ? @story.send(step) : @story.save
48
47
 
49
48
  if success
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  class Workflow::ProductsController < ApplicationController
2
2
  def show
3
- @stories = Product.stories(params[:id], current_user, params[:page])
3
+ @stories = Product.stories(params[:id], current_user)
4
4
  @areas = Area.find_by_product_id(params[:id])
5
5
  @product = Product.find(params[:id]) unless params[:id] == 'no-name'
6
6
  end
@@ -1,6 +1,8 @@
1
1
  class Workflow::User::ProjectsController < ApplicationController
2
2
  def show
3
3
  @project = Project.find(params[:id])
4
- @stories = @project.stories.active.paginate(page: params[:page])
4
+
5
+ @stories = @project.product.stories_for_user(current_user).
6
+ where(project_id: @project.try(:id)).paginate(page: params[:page])
5
7
  end
6
8
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -15,11 +15,11 @@ class Area < ActiveRecord::Base
15
15
  friendly_id :name, :use => :slugged
16
16
 
17
17
  def self.find_by_product_id(product_id)
18
- roots.joins(:projects).merge(Project.for_product_id(product_id)).group('areas.id')
18
+ roots.joins(:projects).merge(Project.for_product_id(product_id))
19
19
  end
20
20
 
21
21
  def children_for_product_id(product_id)
22
- children.joins(:projects).merge(Project.for_product_id(product_id)).group('areas.id')
22
+ children.joins(:projects).merge(Project.for_product_id(product_id))
23
23
  end
24
24
 
25
25
  def products
File without changes
File without changes
@@ -0,0 +1,23 @@
1
+ class Column
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+ include Mongoid::Slug
5
+
6
+ include Model::MongoDb::Customizable
7
+
8
+ belongs_to :story
9
+
10
+ has_many :tasks, dependent: :destroy
11
+
12
+ field :key, type: String
13
+ field :text, type: String
14
+ field :state, type: String
15
+
16
+ attr_accessible :story_id, :key, :text
17
+
18
+ private
19
+
20
+ def cache_product_association
21
+ self.product_id = story.project.product_id if story_id.present? && (story.project rescue nil)
22
+ end
23
+ end
File without changes
File without changes
File without changes
@@ -40,7 +40,7 @@ class Product
40
40
  struct
41
41
  end
42
42
 
43
- def self.stories(id, user, page)
43
+ def self.stories(id, user)
44
44
  collection = if id == 'no-name'
45
45
  Story.exists(_type: false)
46
46
  else
@@ -53,7 +53,11 @@ class Product
53
53
  end
54
54
  end
55
55
 
56
- collection.where(:users_without_tasks_ids.ne => user.id)#.page(page).per(1)
56
+ collection.where(:users_without_tasks_ids.ne => user.id)
57
+ end
58
+
59
+ def stories_for_user(user)
60
+ self.class.stories(id, user)
57
61
  end
58
62
 
59
63
  # belongs_to (SQL)
File without changes
@@ -6,7 +6,7 @@ module Product::ProjectManagement
6
6
  end
7
7
 
8
8
  module ClassMethods
9
- def stories(id, user, page)
9
+ def stories(id, user)
10
10
  collection = if id == 'no-name'
11
11
  Story.exists(_type: false)
12
12
  else
@@ -19,7 +19,7 @@ module Product::ProjectManagement
19
19
  end
20
20
  end
21
21
 
22
- collection.where(:users_without_tasks_ids.ne => user.id)#.page(page).per(1)
22
+ collection.where(:users_without_tasks_ids.ne => user.id)
23
23
  end
24
24
  end
25
25
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -51,7 +51,8 @@ class Story
51
51
  def next_task_for_user(user)
52
52
  return nil if (users_without_tasks_ids || []).include?(user.id)
53
53
 
54
- task = tasks.assigned.where(user_id: user.id).first
54
+ task = tasks.assigned.not.in(state: ['under_supervision', 'completed']).
55
+ where(user_id: user.id).first
55
56
 
56
57
  return task if task
57
58
 
@@ -33,8 +33,8 @@ class Task
33
33
 
34
34
  validates :story_id, presence: true
35
35
  validates :offeror_id, presence: true
36
- validates :name, presence: true, uniqueness: { scope: :story_id }
37
36
  validates :text, presence: true, if: ->(t) { t.class.name == 'Task' }
37
+ validate :name_valid?
38
38
 
39
39
  after_initialize :cache_associations
40
40
  before_validation :cache_associations
@@ -61,6 +61,19 @@ class Task
61
61
  end
62
62
  end
63
63
 
64
+ protected
65
+
66
+ # validates :name, presence: true, uniqueness: { scope: :story_id }
67
+ def name_valid?
68
+ if name.present?
69
+ if Task.where(name: name, story_id: story_id).any?
70
+ errors.add(:name, I18n.t('errors.messages.taken'))
71
+ end
72
+ else
73
+ errors.add(:name, I18n.t('errors.messages.blank'))
74
+ end
75
+ end
76
+
64
77
  private
65
78
 
66
79
  def cache_associations
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ <% options ||= {} %>
2
+ <% options = {
3
+ current_parent: parent, show_title: true, append_new_link: true,
4
+ columns: ['key', 'text']
5
+ }.merge(options) %>
6
+ <%= render partial: 'shared/collection/table', locals: {
7
+ type: 'columns', collection: collection, columns: options[:columns],
8
+ options: {
9
+ append_new_link: options[:append_new_link], show_title: options[:show_title],
10
+ current_parent: options[:current_parent]
11
+ }
12
+ } %>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -33,4 +33,6 @@
33
33
  </table>
34
34
  <% end %>
35
35
 
36
- <%= table_presenter.new_link(options) %>
36
+ <% unless options[:append_new_link] == false %>
37
+ <%= table_presenter.new_link(options) %>
38
+ <% end %>
@@ -1,5 +1,7 @@
1
- <% if can?(:destroy, resource) || can?(:edit, resource) || (
2
- resource.respond_to?(:state_events) && resource.state_events.select{|event| can? event, resource }.any?
1
+ <% if !resource.is_a?(Column) && (
2
+ can?(:destroy, resource) || can?(:edit, resource) || (
3
+ resource.respond_to?(:state_events) && resource.state_events.select{|event| can? event, resource }.any?
4
+ )
3
5
  ) %>
4
6
  <div class="dropdown">
5
7
  <a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= t('general.actions') %></a>
@@ -7,10 +9,10 @@
7
9
  <% if can? :destroy, resource %>
8
10
  <li>
9
11
  <%= link_to(
10
- t('general.destroy'), resource, id: "area_#{resource.id}", method: :delete,
12
+ t('general.destroy'), resource, id: "#{resource.class.name.tableize.singularize}_#{resource.id}", method: :delete,
11
13
  confirm: t('general.questions.are_you_sure'),
12
- onclick: "delete_link('#area_#{resource.id}'); return false;"
13
- )
14
+ onclick: "delete_link('#{resource.class.name.tableize.singularize}_#{resource.id}'); return false;"
15
+ )
14
16
  %>
15
17
  </li>
16
18
  <% end %>
File without changes
@@ -0,0 +1,11 @@
1
+ <fieldset>
2
+ <%= f.input :key %>
3
+ <%= f.input :text, as: :text, input_html: {style: 'width: 500px; height:50px;'} %>
4
+
5
+ <%= f.check_box :_destroy %>
6
+ <%= f.label :_destroy, t('general.destroy') %>
7
+
8
+ <%= link_to t('general.remove'), '#', class: 'remove_fields' %>
9
+ </fieldset>
10
+
11
+ <hr/>
File without changes
File without changes
File without changes