fat_free_crm 0.13.2 → 0.13.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fat_free_crm might be problematic. Click here for more details.

Files changed (407) hide show
  1. checksums.yaml +5 -13
  2. data/.travis.yml +3 -3
  3. data/Gemfile +5 -2
  4. data/Gemfile.lock +137 -119
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +5 -3
  7. data/app/assets/javascripts/admin/fields.js.coffee +31 -8
  8. data/app/assets/javascripts/application.js.erb +6 -10
  9. data/app/assets/javascripts/crm.js.coffee +426 -0
  10. data/app/assets/javascripts/crm_chosen.js.coffee +19 -38
  11. data/app/assets/javascripts/crm_classes.js.coffee +215 -0
  12. data/app/assets/javascripts/crm_comments.js.coffee +20 -58
  13. data/app/assets/javascripts/crm_loginout.js.coffee +27 -0
  14. data/app/assets/javascripts/crm_select2.js.coffee +29 -0
  15. data/app/assets/javascripts/crm_sortable.js.coffee +32 -0
  16. data/app/assets/javascripts/crm_tags.js.coffee +22 -0
  17. data/app/assets/javascripts/crm_textarea_autocomplete.js.coffee +33 -0
  18. data/app/assets/javascripts/datepicker.js.coffee +2 -2
  19. data/app/assets/javascripts/format_buttons.js.coffee +23 -24
  20. data/app/assets/javascripts/lists.js.coffee +45 -76
  21. data/app/assets/javascripts/pagination.js.coffee +16 -0
  22. data/app/assets/javascripts/search.js.coffee +6 -22
  23. data/app/assets/javascripts/timeago.js.coffee +21 -0
  24. data/app/assets/stylesheets/application.css.erb +0 -1
  25. data/app/assets/stylesheets/common.scss +36 -29
  26. data/app/assets/stylesheets/lists.css.scss +17 -3
  27. data/app/controllers/admin/groups_controller.rb +2 -1
  28. data/app/controllers/application_controller.rb +5 -5
  29. data/app/controllers/entities/accounts_controller.rb +1 -1
  30. data/app/controllers/entities/campaigns_controller.rb +1 -1
  31. data/app/controllers/entities/contacts_controller.rb +1 -1
  32. data/app/controllers/entities/leads_controller.rb +1 -1
  33. data/app/controllers/entities/opportunities_controller.rb +1 -1
  34. data/app/controllers/home_controller.rb +10 -7
  35. data/app/controllers/tasks_controller.rb +15 -0
  36. data/app/controllers/users_controller.rb +6 -4
  37. data/app/helpers/accounts_helper.rb +8 -5
  38. data/app/helpers/application_helper.rb +53 -39
  39. data/app/helpers/campaigns_helper.rb +1 -0
  40. data/app/helpers/leads_helper.rb +3 -3
  41. data/app/helpers/opportunities_helper.rb +15 -0
  42. data/app/helpers/remote_link_pagination_helper.rb +8 -0
  43. data/app/helpers/tags_helper.rb +2 -2
  44. data/app/helpers/tasks_helper.rb +22 -15
  45. data/app/helpers/users_helper.rb +3 -2
  46. data/app/mailers/user_mailer.rb +9 -3
  47. data/app/models/entities/account_contact.rb +1 -1
  48. data/app/models/fields/custom_field.rb +1 -1
  49. data/app/models/list.rb +1 -0
  50. data/app/models/observers/entity_observer.rb +10 -1
  51. data/app/models/observers/lead_observer.rb +2 -0
  52. data/app/models/observers/opportunity_observer.rb +2 -0
  53. data/app/models/observers/task_observer.rb +2 -0
  54. data/app/models/polymorphic/avatar.rb +2 -0
  55. data/app/models/polymorphic/comment.rb +0 -1
  56. data/app/models/polymorphic/task.rb +41 -9
  57. data/app/models/users/ability.rb +1 -0
  58. data/app/models/users/group.rb +0 -5
  59. data/app/models/users/user.rb +0 -7
  60. data/app/views/accounts/_edit.html.haml +1 -0
  61. data/app/views/accounts/_index_brief.html.haml +2 -2
  62. data/app/views/accounts/_index_long.html.haml +2 -2
  63. data/app/views/accounts/_new.html.haml +1 -0
  64. data/app/views/accounts/_sidebar_index.html.haml +1 -1
  65. data/app/views/accounts/_sidebar_show.html.haml +1 -1
  66. data/app/views/accounts/_top_section.html.haml +1 -1
  67. data/app/views/accounts/create.js.haml +9 -9
  68. data/app/views/accounts/destroy.js.haml +2 -2
  69. data/app/views/accounts/edit.js.haml +5 -5
  70. data/app/views/accounts/index.js.haml +5 -5
  71. data/app/views/accounts/new.js.haml +1 -1
  72. data/app/views/accounts/show.html.haml +1 -1
  73. data/app/views/accounts/show.js.haml +1 -1
  74. data/app/views/accounts/update.js.haml +7 -5
  75. data/app/views/admin/field_groups/_field_group.html.haml +4 -5
  76. data/app/views/admin/field_groups/confirm.js.haml +2 -2
  77. data/app/views/admin/field_groups/create.js.haml +6 -12
  78. data/app/views/admin/field_groups/destroy.js.haml +3 -3
  79. data/app/views/admin/field_groups/edit.js.haml +1 -1
  80. data/app/views/admin/field_groups/new.js.haml +1 -1
  81. data/app/views/admin/field_groups/update.js.haml +2 -2
  82. data/app/views/admin/fields/_field.html.haml +1 -1
  83. data/app/views/admin/fields/_sort_by.html.haml +3 -3
  84. data/app/views/admin/fields/create.js.haml +9 -9
  85. data/app/views/admin/fields/destroy.js.haml +4 -4
  86. data/app/views/admin/fields/edit.js.haml +2 -2
  87. data/app/views/admin/fields/index.html.haml +1 -8
  88. data/app/views/admin/fields/show.html.haml +1 -1
  89. data/app/views/admin/fields/update.js.haml +8 -8
  90. data/app/views/admin/groups/_form.html.haml +1 -3
  91. data/app/views/admin/groups/create.js.haml +8 -8
  92. data/app/views/admin/groups/destroy.js.haml +3 -3
  93. data/app/views/admin/groups/edit.js.haml +3 -3
  94. data/app/views/admin/groups/index.js.haml +2 -2
  95. data/app/views/admin/groups/new.js.haml +2 -2
  96. data/app/views/admin/groups/update.js.haml +5 -5
  97. data/app/views/admin/tags/confirm.js.haml +2 -2
  98. data/app/views/admin/tags/create.js.haml +8 -8
  99. data/app/views/admin/tags/destroy.js.haml +3 -3
  100. data/app/views/admin/tags/edit.js.haml +4 -4
  101. data/app/views/admin/tags/new.js.haml +1 -1
  102. data/app/views/admin/tags/update.js.haml +5 -5
  103. data/app/views/admin/users/_profile.html.haml +3 -4
  104. data/app/views/admin/users/confirm.js.haml +2 -2
  105. data/app/views/admin/users/create.js.haml +8 -8
  106. data/app/views/admin/users/destroy.js.haml +3 -3
  107. data/app/views/admin/users/edit.js.haml +4 -4
  108. data/app/views/admin/users/index.js.haml +2 -2
  109. data/app/views/admin/users/new.js.haml +2 -2
  110. data/app/views/admin/users/reactivate.js.haml +2 -2
  111. data/app/views/admin/users/suspend.js.haml +2 -2
  112. data/app/views/admin/users/update.js.haml +5 -5
  113. data/app/views/campaigns/_edit.html.haml +1 -0
  114. data/app/views/campaigns/_index_brief.html.haml +1 -1
  115. data/app/views/campaigns/_index_long.html.haml +1 -1
  116. data/app/views/campaigns/_new.html.haml +1 -0
  117. data/app/views/campaigns/_sidebar_index.html.haml +1 -1
  118. data/app/views/campaigns/_sidebar_show.html.haml +1 -1
  119. data/app/views/campaigns/_status.html.haml +1 -1
  120. data/app/views/campaigns/_top_section.html.haml +1 -1
  121. data/app/views/campaigns/create.js.haml +10 -10
  122. data/app/views/campaigns/destroy.js.haml +2 -2
  123. data/app/views/campaigns/edit.js.haml +6 -6
  124. data/app/views/campaigns/index.js.haml +5 -5
  125. data/app/views/campaigns/new.js.haml +1 -1
  126. data/app/views/campaigns/show.html.haml +1 -1
  127. data/app/views/campaigns/show.js.haml +1 -1
  128. data/app/views/campaigns/update.js.haml +8 -6
  129. data/app/views/comments/_edit.html.haml +1 -1
  130. data/app/views/comments/_new.html.haml +1 -1
  131. data/app/views/comments/create.js.haml +9 -9
  132. data/app/views/comments/destroy.js.haml +2 -2
  133. data/app/views/comments/edit.js.haml +3 -3
  134. data/app/views/comments/update.js.haml +5 -5
  135. data/app/views/contacts/_contacts.html.haml +1 -1
  136. data/app/views/contacts/_edit.html.haml +1 -0
  137. data/app/views/contacts/_index_brief.html.haml +2 -2
  138. data/app/views/contacts/_index_full.html.haml +2 -2
  139. data/app/views/contacts/_index_long.html.haml +2 -2
  140. data/app/views/contacts/_new.html.haml +1 -0
  141. data/app/views/contacts/_section_general.html.haml +4 -3
  142. data/app/views/contacts/_sidebar_show.html.haml +1 -1
  143. data/app/views/contacts/_top_section.html.haml +1 -1
  144. data/app/views/contacts/create.js.haml +10 -10
  145. data/app/views/contacts/destroy.js.haml +3 -3
  146. data/app/views/contacts/edit.js.haml +5 -5
  147. data/app/views/contacts/index.js.haml +5 -5
  148. data/app/views/contacts/new.js.haml +1 -1
  149. data/app/views/contacts/show.html.haml +1 -1
  150. data/app/views/contacts/show.js.haml +1 -1
  151. data/app/views/contacts/update.js.haml +8 -6
  152. data/app/views/emails/destroy.js.haml +2 -2
  153. data/app/views/entities/_basic_search.html.haml +15 -12
  154. data/app/views/entities/_permissions.html.haml +6 -11
  155. data/app/views/entities/attach.js.haml +3 -3
  156. data/app/views/entities/contacts.js.haml +2 -2
  157. data/app/views/entities/discard.js.haml +1 -1
  158. data/app/views/entities/leads.js.haml +2 -2
  159. data/app/views/entities/opportunities.js.haml +2 -2
  160. data/app/views/entities/subscription_update.js.haml +1 -1
  161. data/app/views/entities/versions.js.haml +2 -2
  162. data/app/views/fields/group.js.erb +1 -1
  163. data/app/views/home/_account.html.haml +2 -2
  164. data/app/views/home/_assets_menu.html.haml +3 -3
  165. data/app/views/home/_duration_menu.html.haml +3 -3
  166. data/app/views/home/_events_menu.html.haml +3 -3
  167. data/app/views/home/_opportunity.html.haml +2 -2
  168. data/app/views/home/_options.html.haml +0 -1
  169. data/app/views/home/_users_menu.html.haml +3 -3
  170. data/app/views/home/index.js.haml +4 -4
  171. data/app/views/home/options.js.haml +1 -1
  172. data/app/views/layouts/_about.html.haml +3 -3
  173. data/app/views/layouts/_footer.html.haml +1 -1
  174. data/app/views/layouts/_header.html.haml +1 -1
  175. data/app/views/layouts/_jumpbox.html.haml +23 -21
  176. data/app/views/layouts/_sidebar.html.haml +1 -2
  177. data/app/views/layouts/admin/application.html.haml +1 -1
  178. data/app/views/layouts/application.html.haml +3 -3
  179. data/app/views/leads/_convert.html.haml +1 -11
  180. data/app/views/leads/_convert_permissions.html.haml +4 -9
  181. data/app/views/leads/_edit.html.haml +1 -0
  182. data/app/views/leads/_index_brief.html.haml +1 -1
  183. data/app/views/leads/_index_long.html.haml +1 -1
  184. data/app/views/leads/_leads.html.haml +1 -1
  185. data/app/views/leads/_new.html.haml +1 -0
  186. data/app/views/leads/_sidebar_index.html.haml +1 -1
  187. data/app/views/leads/_sidebar_show.html.haml +1 -1
  188. data/app/views/leads/_top_section.html.haml +1 -1
  189. data/app/views/leads/convert.js.haml +5 -5
  190. data/app/views/leads/create.js.haml +9 -9
  191. data/app/views/leads/destroy.js.haml +2 -2
  192. data/app/views/leads/edit.js.haml +5 -5
  193. data/app/views/leads/index.js.haml +5 -5
  194. data/app/views/leads/new.js.haml +1 -1
  195. data/app/views/leads/promote.js.haml +7 -7
  196. data/app/views/leads/reject.js.haml +2 -2
  197. data/app/views/leads/show.html.haml +1 -1
  198. data/app/views/leads/show.js.haml +1 -1
  199. data/app/views/leads/update.js.haml +9 -7
  200. data/app/views/lists/_lists.html.haml +6 -0
  201. data/app/views/lists/_sidebar.html.haml +18 -17
  202. data/app/views/lists/create.js.haml +6 -7
  203. data/app/views/lists/destroy.js.haml +1 -1
  204. data/app/views/opportunities/_edit.html.haml +2 -1
  205. data/app/views/opportunities/_index_brief.html.haml +1 -1
  206. data/app/views/opportunities/_index_long.html.haml +1 -1
  207. data/app/views/opportunities/_new.html.haml +2 -1
  208. data/app/views/opportunities/_opportunities.html.haml +1 -1
  209. data/app/views/opportunities/_sidebar_index.html.haml +1 -1
  210. data/app/views/opportunities/_sidebar_show.html.haml +1 -1
  211. data/app/views/opportunities/_top_section.html.haml +2 -2
  212. data/app/views/opportunities/contacts.js.haml +2 -2
  213. data/app/views/opportunities/create.js.haml +10 -10
  214. data/app/views/opportunities/destroy.js.haml +3 -3
  215. data/app/views/opportunities/edit.js.haml +5 -5
  216. data/app/views/opportunities/index.html.haml +1 -1
  217. data/app/views/opportunities/index.js.haml +5 -5
  218. data/app/views/opportunities/new.js.haml +1 -1
  219. data/app/views/opportunities/show.html.haml +1 -1
  220. data/app/views/opportunities/show.js.haml +1 -1
  221. data/app/views/opportunities/update.js.haml +8 -6
  222. data/app/views/shared/_address.html.haml +1 -1
  223. data/app/views/shared/_inline_styles.html.haml +1 -1
  224. data/app/views/shared/_naming.html.haml +3 -3
  225. data/app/views/shared/_paginate.haml +2 -1
  226. data/app/views/shared/_paginate_with_per_page.html.haml +10 -12
  227. data/app/views/shared/_search.html.haml +7 -3
  228. data/app/views/shared/_select_popup.html.haml +9 -11
  229. data/app/views/shared/_tags.html.haml +5 -4
  230. data/app/views/tasks/_completed.html.haml +3 -1
  231. data/app/views/tasks/_selector.html.haml +1 -1
  232. data/app/views/tasks/_top_section.html.haml +1 -1
  233. data/app/views/tasks/complete.js.haml +7 -7
  234. data/app/views/tasks/create.js.haml +17 -17
  235. data/app/views/tasks/destroy.js.haml +2 -2
  236. data/app/views/tasks/discard.js.haml +1 -1
  237. data/app/views/tasks/edit.js.haml +4 -4
  238. data/app/views/tasks/filter.js.haml +2 -2
  239. data/app/views/tasks/new.js.haml +1 -1
  240. data/app/views/tasks/uncomplete.js.haml +12 -0
  241. data/app/views/tasks/update.js.haml +4 -4
  242. data/app/views/users/_avatar.html.haml +1 -1
  243. data/app/views/users/_languages.html.haml +3 -3
  244. data/app/views/users/_profile.html.haml +1 -1
  245. data/app/views/users/avatar.js.haml +1 -1
  246. data/app/views/users/change_password.js.haml +5 -5
  247. data/app/views/users/edit.js.haml +1 -1
  248. data/app/views/users/password.js.haml +2 -2
  249. data/app/views/users/show.html.haml +1 -1
  250. data/app/views/users/update.js.haml +5 -5
  251. data/app/views/users/upload_avatar.js.haml +3 -3
  252. data/app/views/versions/_versions.html.haml +1 -1
  253. data/config/application.rb +3 -0
  254. data/config/environments/production.rb +1 -1
  255. data/config/environments/staging.rb +58 -13
  256. data/config/initializers/locale.rb +2 -0
  257. data/config/locales/cz_fat_free_crm.yml +1 -0
  258. data/config/locales/de_fat_free_crm.yml +1 -0
  259. data/config/locales/en-GB_fat_free_crm.yml +1 -0
  260. data/config/locales/en-US_fat_free_crm.yml +2 -0
  261. data/config/locales/es_fat_free_crm.yml +1 -0
  262. data/config/locales/fr-CA_fat_free_crm.yml +1 -0
  263. data/config/locales/fr_fat_free_crm.yml +1 -0
  264. data/config/locales/it_fat_free_crm.yml +1 -0
  265. data/config/locales/ja_fat_free_crm.yml +1 -0
  266. data/config/locales/pl_fat_free_crm.yml +1 -0
  267. data/config/locales/pt-BR_fat_free_crm.yml +1 -0
  268. data/config/locales/ru_fat_free_crm.yml +444 -61
  269. data/config/locales/sv-SE_fat_free_crm.yml +1 -0
  270. data/config/locales/th_fat_free_crm.yml +1 -0
  271. data/config/locales/zh-CN_fat_free_crm.yml +1 -0
  272. data/config/routes.rb +20 -19
  273. data/config/settings.default.yml +11 -10
  274. data/fat_free_crm.gemspec +5 -4
  275. data/lib/{plugins/country_select/lib/country_select.rb → country_select.rb} +0 -0
  276. data/lib/fat_free_crm.rb +3 -1
  277. data/lib/fat_free_crm/engine.rb +2 -4
  278. data/lib/fat_free_crm/gem_dependencies.rb +1 -1
  279. data/lib/fat_free_crm/gem_ext.rb +0 -2
  280. data/lib/fat_free_crm/permissions.rb +2 -3
  281. data/lib/fat_free_crm/version.rb +1 -1
  282. data/lib/{plugins/gravatar_image_tag/lib/gravatar_image_tag.rb → gravatar_image_tag.rb} +0 -0
  283. data/lib/tasks/ffcrm/settings.rake +4 -16
  284. data/public/favicon.ico +0 -0
  285. data/spec/controllers/entities/accounts_controller_spec.rb +5 -5
  286. data/spec/controllers/entities/campaigns_controller_spec.rb +5 -5
  287. data/spec/controllers/entities/contacts_controller_spec.rb +42 -5
  288. data/spec/controllers/entities/leads_controller_spec.rb +7 -7
  289. data/spec/controllers/entities/opportunities_controller_spec.rb +5 -5
  290. data/spec/controllers/home_controller_spec.rb +3 -3
  291. data/spec/controllers/tasks_controller_spec.rb +29 -0
  292. data/spec/factories/shared_factories.rb +1 -3
  293. data/spec/features/support/selector_helpers.rb +4 -4
  294. data/spec/helpers/tasks_helper_spec.rb +10 -5
  295. data/spec/lib/permissions_spec.rb +10 -22
  296. data/spec/mailers/user_mailer_spec.rb +5 -4
  297. data/spec/models/observers/entity_observer_spec.rb +13 -8
  298. data/spec/models/polymorphic/task_spec.rb +111 -32
  299. data/spec/routing/accounts_routing_spec.rb +1 -1
  300. data/spec/routing/campaigns_routing_spec.rb +1 -1
  301. data/spec/routing/contacts_routing_spec.rb +1 -1
  302. data/spec/routing/leads_routing_spec.rb +1 -1
  303. data/spec/routing/opportunities_routing_spec.rb +1 -1
  304. data/spec/shared/controllers.rb +2 -2
  305. data/spec/spec_helper.rb +1 -0
  306. data/spec/views/accounts/create.js.haml_spec.rb +3 -3
  307. data/spec/views/accounts/index.js.haml_spec.rb +4 -4
  308. data/spec/views/accounts/update.js.haml_spec.rb +5 -5
  309. data/spec/views/admin/field_groups/create.js.haml_spec.rb +2 -2
  310. data/spec/views/admin/field_groups/edit.js.haml_spec.rb +1 -1
  311. data/spec/views/admin/field_groups/new.js.haml_spec.rb +1 -1
  312. data/spec/views/admin/field_groups/update.js.haml_spec.rb +1 -1
  313. data/spec/views/admin/users/create.js.haml_spec.rb +2 -2
  314. data/spec/views/admin/users/destroy.js.haml_spec.rb +1 -1
  315. data/spec/views/admin/users/edit.js.haml_spec.rb +1 -1
  316. data/spec/views/admin/users/index.js.haml_spec.rb +1 -1
  317. data/spec/views/admin/users/new.js.haml_spec.rb +1 -1
  318. data/spec/views/admin/users/reactivate.js.haml_spec.rb +1 -1
  319. data/spec/views/admin/users/suspend.js.haml_spec.rb +1 -1
  320. data/spec/views/admin/users/update.js.haml_spec.rb +3 -3
  321. data/spec/views/campaigns/create.js.haml_spec.rb +4 -4
  322. data/spec/views/campaigns/destroy.js.haml_spec.rb +1 -1
  323. data/spec/views/campaigns/edit.js.haml_spec.rb +4 -4
  324. data/spec/views/campaigns/index.js.haml_spec.rb +2 -2
  325. data/spec/views/campaigns/new.js.haml_spec.rb +1 -1
  326. data/spec/views/campaigns/update.js.haml_spec.rb +7 -7
  327. data/spec/views/contacts/create.js.haml_spec.rb +4 -4
  328. data/spec/views/contacts/edit.js.haml_spec.rb +4 -4
  329. data/spec/views/contacts/index.js.html_spec.rb +2 -2
  330. data/spec/views/contacts/new.js.haml_spec.rb +2 -2
  331. data/spec/views/contacts/update.js.haml_spec.rb +11 -11
  332. data/spec/views/home/index.js.haml_spec.rb +1 -1
  333. data/spec/views/home/options.js.haml_spec.rb +3 -3
  334. data/spec/views/leads/convert.js.haml_spec.rb +3 -3
  335. data/spec/views/leads/create.js.haml_spec.rb +5 -5
  336. data/spec/views/leads/destroy.js.haml_spec.rb +1 -1
  337. data/spec/views/leads/edit.js.haml_spec.rb +4 -4
  338. data/spec/views/leads/index.js.haml_spec.rb +2 -2
  339. data/spec/views/leads/new.js.haml_spec.rb +1 -1
  340. data/spec/views/leads/promote.js.haml_spec.rb +13 -13
  341. data/spec/views/leads/reject.js.haml_spec.rb +6 -6
  342. data/spec/views/leads/update.js.haml_spec.rb +11 -11
  343. data/spec/views/opportunities/create.js.haml_spec.rb +4 -4
  344. data/spec/views/opportunities/destroy.js.haml_spec.rb +1 -1
  345. data/spec/views/opportunities/edit.js.haml_spec.rb +4 -4
  346. data/spec/views/opportunities/index.js.haml_spec.rb +2 -2
  347. data/spec/views/opportunities/update.js.haml_spec.rb +11 -11
  348. data/spec/views/tasks/complete.js.haml_spec.rb +5 -5
  349. data/spec/views/tasks/create.js.haml_spec.rb +13 -13
  350. data/spec/views/tasks/destroy.js.haml_spec.rb +3 -3
  351. data/spec/views/tasks/edit.js.haml_spec.rb +4 -4
  352. data/spec/views/tasks/new.js.haml_spec.rb +2 -2
  353. data/spec/views/tasks/uncomplete.js.haml_spec.rb +44 -0
  354. data/spec/views/tasks/update.js.haml_spec.rb +17 -17
  355. data/spec/views/users/avatar.js.haml_spec.rb +1 -1
  356. data/spec/views/users/change_password.js.haml_spec.rb +4 -4
  357. data/spec/views/users/edit.js.haml_spec.rb +1 -1
  358. data/spec/views/users/password.js.haml_spec.rb +2 -2
  359. data/spec/views/users/update.js.haml_spec.rb +5 -5
  360. data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
  361. data/vendor/assets/javascripts/ajax-chosen.jquery.coffee +166 -76
  362. data/vendor/assets/javascripts/chosen.jquery.coffee +2 -2
  363. data/vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-pt-BR.js +22 -0
  364. data/vendor/assets/javascripts/jquery_ui_datepicker/{jquery-ui-timepicker-sv.js → jquery-ui-timepicker-sv-SE.js} +0 -0
  365. data/vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-th.js +19 -0
  366. data/vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-fr-CA.js +21 -0
  367. data/vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-pt.js +21 -0
  368. data/vendor/assets/javascripts/rating.js +2 -2
  369. metadata +101 -122
  370. data/app/assets/images/facebook-close.gif +0 -0
  371. data/app/assets/javascripts/crm.js +0 -495
  372. data/app/assets/javascripts/crm_classes.js +0 -218
  373. data/app/assets/javascripts/crm_fields.js +0 -34
  374. data/app/assets/javascripts/crm_loginout.js +0 -29
  375. data/app/assets/javascripts/crm_textarea_autocomplete.js +0 -32
  376. data/app/assets/javascripts/groups.js.coffee +0 -8
  377. data/app/assets/javascripts/jquery-noconflict.js +0 -6
  378. data/app/assets/javascripts/timeago.js +0 -17
  379. data/app/views/lists/_personal_sidebar.html.haml +0 -28
  380. data/lib/fat_free_crm/gem_ext/active_model/serializers/xml/serializer/attribute.rb +0 -17
  381. data/lib/fat_free_crm/gem_ext/authlogic/session/cookies.rb +0 -16
  382. data/lib/fat_free_crm/plugin_dependencies.rb +0 -12
  383. data/lib/plugins/country_select/MIT-LICENSE +0 -20
  384. data/lib/plugins/country_select/README +0 -14
  385. data/lib/plugins/country_select/init.rb +0 -1
  386. data/lib/plugins/country_select/install.rb +0 -2
  387. data/lib/plugins/country_select/uninstall.rb +0 -2
  388. data/lib/plugins/gravatar_image_tag/Gemfile +0 -8
  389. data/lib/plugins/gravatar_image_tag/README.textile +0 -108
  390. data/lib/plugins/gravatar_image_tag/ROADMAP.textile +0 -33
  391. data/lib/plugins/gravatar_image_tag/Rakefile +0 -50
  392. data/lib/plugins/gravatar_image_tag/VERSION +0 -1
  393. data/lib/plugins/gravatar_image_tag/gravatar_image_tag.gemspec +0 -45
  394. data/lib/plugins/gravatar_image_tag/init.rb +0 -2
  395. data/lib/plugins/gravatar_image_tag/spec/gravatar_image_tag_spec.rb +0 -83
  396. data/lib/plugins/gravatar_image_tag/spec/test_helper.rb +0 -12
  397. data/lib/tasks/db/migrate.rake +0 -66
  398. data/lib/tasks/db/schema.rake +0 -20
  399. data/vendor/assets/javascripts/ajax-chosen-prototype.js +0 -2
  400. data/vendor/assets/javascripts/ajax-chosen.proto.coffee +0 -98
  401. data/vendor/assets/javascripts/chosen-prototype.js +0 -3
  402. data/vendor/assets/javascripts/chosen.proto.coffee +0 -580
  403. data/vendor/assets/javascripts/event.simulate.js +0 -64
  404. data/vendor/assets/javascripts/facebooklist.js +0 -548
  405. data/vendor/assets/javascripts/facebooklist.simulate.js +0 -28
  406. data/vendor/assets/javascripts/modalbox.js +0 -506
  407. data/vendor/assets/stylesheets/facebooklist.css +0 -47
@@ -377,7 +377,7 @@ describe LeadsController do
377
377
  xhr :put, :create, :lead => { :first_name => "Billy", :last_name => "Bones"}, :campaign => @campaign.id
378
378
  assigns[:campaign].should == @campaign
379
379
  end
380
-
380
+
381
381
  it "should add a new comment to the newly created lead when specified" do
382
382
  @lead = FactoryGirl.create(:lead)
383
383
  Lead.stub(:new).and_return(@lead)
@@ -970,11 +970,11 @@ describe LeadsController do
970
970
  it_should_behave_like("auto complete")
971
971
  end
972
972
 
973
- # POST /leads/redraw AJAX
973
+ # GET /leads/redraw AJAX
974
974
  #----------------------------------------------------------------------------
975
- describe "responding to POST redraw" do
975
+ describe "responding to GET redraw" do
976
976
  it "should save user selected lead preference" do
977
- xhr :post, :redraw, :per_page => 42, :view => "long", :sort_by => "first_name", :naming => "after"
977
+ xhr :get, :redraw, :per_page => 42, :view => "long", :sort_by => "first_name", :naming => "after"
978
978
  current_user.preference[:leads_per_page].should == "42"
979
979
  current_user.preference[:leads_index_view].should == "long"
980
980
  current_user.preference[:leads_sort_by].should == "leads.first_name ASC"
@@ -982,13 +982,13 @@ describe LeadsController do
982
982
  end
983
983
 
984
984
  it "should set similar options for Contacts" do
985
- xhr :post, :redraw, :sort_by => "first_name", :naming => "after"
985
+ xhr :get, :redraw, :sort_by => "first_name", :naming => "after"
986
986
  current_user.pref[:contacts_sort_by].should == "contacts.first_name ASC"
987
987
  current_user.pref[:contacts_naming].should == "after"
988
988
  end
989
989
 
990
990
  it "should reset current page to 1" do
991
- xhr :post, :redraw, :per_page => 42, :view => "long", :sort_by => "first_name", :naming => "after"
991
+ xhr :get, :redraw, :per_page => 42, :view => "long", :sort_by => "first_name", :naming => "after"
992
992
  session[:leads_current_page].should == 1
993
993
  end
994
994
 
@@ -998,7 +998,7 @@ describe LeadsController do
998
998
  FactoryGirl.create(:lead, :first_name => "Bobby", :user => current_user)
999
999
  ]
1000
1000
 
1001
- xhr :post, :redraw, :per_page => 1, :sort_by => "first_name"
1001
+ xhr :get, :redraw, :per_page => 1, :sort_by => "first_name"
1002
1002
  assigns(:leads).should == [ @leads.first ]
1003
1003
  response.should render_template("leads/index")
1004
1004
  end
@@ -864,18 +864,18 @@ describe OpportunitiesController do
864
864
  it_should_behave_like("auto complete")
865
865
  end
866
866
 
867
- # POST /opportunities/redraw AJAX
867
+ # GET /opportunities/redraw AJAX
868
868
  #----------------------------------------------------------------------------
869
- describe "responding to POST redraw" do
869
+ describe "responding to GET redraw" do
870
870
  it "should save user selected opportunity preference" do
871
- xhr :post, :redraw, :per_page => 42, :view => "brief", :sort_by => "name"
871
+ xhr :get, :redraw, :per_page => 42, :view => "brief", :sort_by => "name"
872
872
  current_user.preference[:opportunities_per_page].should == "42"
873
873
  current_user.preference[:opportunities_index_view].should == "brief"
874
874
  current_user.preference[:opportunities_sort_by].should == "opportunities.name ASC"
875
875
  end
876
876
 
877
877
  it "should reset current page to 1" do
878
- xhr :post, :redraw, :per_page => 42, :view => "brief", :sort_by => "name"
878
+ xhr :get, :redraw, :per_page => 42, :view => "brief", :sort_by => "name"
879
879
  session[:opportunities_current_page].should == 1
880
880
  end
881
881
 
@@ -885,7 +885,7 @@ describe OpportunitiesController do
885
885
  FactoryGirl.create(:opportunity, :name => "B", :user => current_user)
886
886
  ]
887
887
 
888
- xhr :post, :redraw, :per_page => 1, :sort_by => "name"
888
+ xhr :get, :redraw, :per_page => 1, :sort_by => "name"
889
889
  assigns(:opportunities).should == [ @opportunities.first ]
890
890
  response.should render_template("opportunities/index")
891
891
  end
@@ -106,15 +106,15 @@ describe HomeController do
106
106
  end
107
107
  end
108
108
 
109
- # POST /home/redraw AJAX
109
+ # GET /home/redraw AJAX
110
110
  #----------------------------------------------------------------------------
111
- describe "responding to POST redraw" do
111
+ describe "responding to GET redraw" do
112
112
  before(:each) do
113
113
  require_user
114
114
  end
115
115
 
116
116
  it "should save user selected options" do
117
- xhr :post, :redraw, :asset => "tasks", :user => "Billy Bones", :duration => "two days"
117
+ xhr :get, :redraw, :asset => "tasks", :user => "Billy Bones", :duration => "two days"
118
118
  current_user.pref[:activity_asset].should == "tasks"
119
119
  current_user.pref[:activity_user].should == "Billy Bones"
120
120
  current_user.pref[:activity_duration].should == "two days"
@@ -469,6 +469,35 @@ describe TasksController do
469
469
  end
470
470
  end
471
471
 
472
+ # PUT /tasks/1/complete
473
+ # PUT /leads/1/complete.xml AJAX
474
+ #----------------------------------------------------------------------------
475
+ describe "responding to PUT uncomplete" do
476
+
477
+ it "should change task status, expose task as @task, and render template" do
478
+ @task = FactoryGirl.create(:task, :completed_at => Time.now, :user => current_user)
479
+
480
+ xhr :put, :uncomplete, :id => @task.id
481
+ @task.reload.completed_at.should == nil
482
+ assigns[:task].should == @task
483
+ assigns[:task_total].should_not == nil
484
+ response.should render_template("tasks/uncomplete")
485
+ end
486
+
487
+
488
+ describe "task got deleted" do
489
+ it "should reload current page with the flash message if the task got deleted" do
490
+ @task = FactoryGirl.create(:task, :user => FactoryGirl.create(:user), :assignee => current_user, :completed_at => Time.now)
491
+ @task.destroy
492
+
493
+ xhr :put, :uncomplete, :id => @task.id
494
+ flash[:warning].should_not == nil
495
+ response.body.should == "window.location.reload();"
496
+ end
497
+
498
+ end
499
+ end
500
+
472
501
  # Ajax request to filter out a list of tasks. AJAX
473
502
  #----------------------------------------------------------------------------
474
503
  describe "responding to GET filter" do
@@ -63,9 +63,7 @@ FactoryGirl.define do
63
63
  factory :avatar do
64
64
  user
65
65
  entity { raise "Please specify :entity for the avatar" }
66
- image_file_size nil
67
- image_file_name nil
68
- image_content_type nil
66
+ image { File.new(Rails.root.join('spec', 'fixtures', 'rails.png')) }
69
67
  updated_at { FactoryGirl.generate(:time) }
70
68
  created_at { FactoryGirl.generate(:time) }
71
69
  end
@@ -6,8 +6,8 @@
6
6
  module SelectorHelpers
7
7
  def chosen_select(item_text, options)
8
8
  field_id = find_field(options[:from], :visible => false)[:id]
9
- option_value = page.evaluate_script("jQuery(\"##{field_id} option:contains('#{item_text}')\").val()")#page.evaluate_script("$(\"##{field_id} option:contains('#{item_text}')\").val()")
10
- page.execute_script("jQuery('##{field_id}').val('#{option_value}')")
9
+ option_value = page.evaluate_script("$(\"##{field_id} option:contains('#{item_text}')\").val()")
10
+ page.execute_script("$('##{field_id}').val('#{option_value}')")
11
11
  end
12
12
 
13
13
  def click_filter_tab(filter_name)
@@ -17,13 +17,13 @@ module SelectorHelpers
17
17
 
18
18
  def click_edit_for_task_id(task_id)
19
19
  within("#task_#{task_id}") do
20
- page.execute_script "jQuery('#task_#{task_id} a')[0].click()"
20
+ page.execute_script "$('#task_#{task_id} a')[0].click()"
21
21
  end
22
22
  end
23
23
 
24
24
  def click_delete_for_task_id(task_id)
25
25
  within("#task_#{task_id}") do
26
- page.execute_script "jQuery('#task_#{task_id} a')[1].click()"
26
+ page.execute_script "$('#task_#{task_id} a')[1].click()"
27
27
  end
28
28
  end
29
29
  end
@@ -7,11 +7,16 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
7
7
 
8
8
  describe TasksHelper do
9
9
 
10
- #Delete this example and add some real ones or delete this file
11
- it "should be included in the object returned by #helper" do
12
- included_modules = (class << helper; self; end).send :included_modules
13
- included_modules.should include(TasksHelper)
14
- end
10
+ describe "responding with generated links" do
11
+
12
+ before do
13
+ @task = FactoryGirl.create(:task)
14
+ end
15
15
 
16
+ it "should render link to uncomplete of a task" do
17
+ link_to_task_uncomplete(@task, nil).should include(t(:task_uncomplete))
18
+ end
19
+
20
+ end
16
21
  end
17
22
 
@@ -13,7 +13,7 @@ describe FatFreeCRM::Permissions do
13
13
  string :access
14
14
  end
15
15
  end
16
-
16
+
17
17
  describe "initialization" do
18
18
  it "should add 'has_many permissions' to the model" do
19
19
  entity = UserWithPermission.new
@@ -28,24 +28,18 @@ describe FatFreeCRM::Permissions do
28
28
  before(:each) do
29
29
  @entity = UserWithPermission.create(:access => "Shared")
30
30
  end
31
-
31
+
32
32
  it "should assign permissions to the object" do
33
33
  @entity.permissions.size.should == 0
34
34
  @entity.update_attribute(:user_ids, ['1','2','3'])
35
35
  @entity.permissions.find_all_by_user_id([1,2,3]).size.should == 3
36
36
  end
37
-
38
- it "should assign permissions with the 'chosen' select box format" do
39
- @entity.permissions.size.should == 0
40
- @entity.update_attribute(:user_ids, ['', '1,2,3'])
41
- @entity.permissions.find_all_by_user_id([1,2,3]).size.should == 3
42
- end
43
-
37
+
44
38
  it "should handle [] permissions" do
45
39
  @entity.update_attribute(:user_ids, [])
46
40
  @entity.permissions.size.should == 0
47
41
  end
48
-
42
+
49
43
  it "should replace existing permissions" do
50
44
  @entity.permissions << FactoryGirl.create(:permission, :user_id => 1, :asset => @entity)
51
45
  @entity.permissions << FactoryGirl.create(:permission, :user_id => 2, :asset => @entity)
@@ -55,9 +49,9 @@ describe FatFreeCRM::Permissions do
55
49
  @entity.permissions.find_all_by_user_id([2]).size.should == 1
56
50
  @entity.permissions.find_all_by_user_id([3]).size.should == 1
57
51
  end
58
-
52
+
59
53
  end
60
-
54
+
61
55
  describe "group_ids" do
62
56
  before(:each) do
63
57
  @entity = UserWithPermission.create(:access => "Shared")
@@ -67,18 +61,12 @@ describe FatFreeCRM::Permissions do
67
61
  @entity.update_attribute(:group_ids, ['1','2','3'])
68
62
  @entity.permissions.find_all_by_group_id([1,2,3]).size.should == 3
69
63
  end
70
-
71
- it "should assign permissions with the 'chosen' select box format" do
72
- @entity.permissions.size.should == 0
73
- @entity.update_attribute(:group_ids, ['', '1,2,3'])
74
- @entity.permissions.find_all_by_group_id([1,2,3]).size.should == 3
75
- end
76
-
64
+
77
65
  it "should handle [] permissions" do
78
66
  @entity.update_attribute(:group_ids, [])
79
67
  @entity.permissions.size.should == 0
80
68
  end
81
-
69
+
82
70
  it "should replace existing permissions" do
83
71
  @entity.permissions << FactoryGirl.build(:permission, :group_id => 1, :user_id => nil, :asset => @entity)
84
72
  @entity.permissions << FactoryGirl.build(:permission, :group_id => 2, :user_id => nil, :asset => @entity)
@@ -124,7 +112,7 @@ describe FatFreeCRM::Permissions do
124
112
  entity.save_with_permissions
125
113
  end
126
114
  end
127
-
115
+
128
116
  describe "update_with_permissions" do
129
117
  it "should raise deprecation warning and call update_attributes" do
130
118
  entity = UserWithPermission.new
@@ -145,5 +133,5 @@ describe FatFreeCRM::Permissions do
145
133
  entity.save_with_model_permissions(model)
146
134
  end
147
135
  end
148
-
136
+
149
137
  end
@@ -6,6 +6,7 @@
6
6
  require 'spec_helper'
7
7
 
8
8
  describe UserMailer do
9
+
9
10
  describe "password_reset_instructions" do
10
11
  let(:user) { FactoryGirl.create(:user, :email => "forgot_my_password@example.com") }
11
12
  let(:mail) { UserMailer.password_reset_instructions(user) }
@@ -41,7 +42,7 @@ describe UserMailer do
41
42
  let(:mail) { UserMailer.assigned_entity_notification(account, assigner) }
42
43
 
43
44
  it "sets fatfree as the sender" do
44
- mail.from.should eql(["notifications@fatfreecrm.com"])
45
+ mail.from.should eql(["noreply@fatfreecrm.com"])
45
46
  end
46
47
 
47
48
  it "sets user 'assignee@example.com' as recipient" do
@@ -66,7 +67,7 @@ describe UserMailer do
66
67
  let(:mail) { UserMailer.assigned_entity_notification(contact, assigner) }
67
68
 
68
69
  it "sets fatfree as the sender" do
69
- mail.from.should eql(["notifications@fatfreecrm.com"])
70
+ mail.from.should eql(["noreply@fatfreecrm.com"])
70
71
  end
71
72
 
72
73
  it "sets user 'assignee@example.com' as recipient" do
@@ -91,7 +92,7 @@ describe UserMailer do
91
92
  let(:mail) { UserMailer.assigned_entity_notification(lead, assigner) }
92
93
 
93
94
  it "sets fatfree as the sender" do
94
- mail.from.should eql(["notifications@fatfreecrm.com"])
95
+ mail.from.should eql(["noreply@fatfreecrm.com"])
95
96
  end
96
97
 
97
98
  it "sets user 'assignee@example.com' as recipient" do
@@ -116,7 +117,7 @@ describe UserMailer do
116
117
  let(:mail) { UserMailer.assigned_entity_notification(opportunity, assigner) }
117
118
 
118
119
  it "sets fatfree as the sender" do
119
- mail.from.should eql(["notifications@fatfreecrm.com"])
120
+ mail.from.should eql(["noreply@fatfreecrm.com"])
120
121
  end
121
122
 
122
123
  it "sets user 'assignee@example.com' as recipient" do
@@ -6,6 +6,12 @@
6
6
  require 'spec_helper'
7
7
 
8
8
  describe EntityObserver do
9
+
10
+ before do
11
+ Setting.stub(:host).and_return('http://www.example.com')
12
+ PaperTrail.stub(:whodunnit).and_return(assigner)
13
+ end
14
+
9
15
  [:account, :contact, :lead, :opportunity].each do |entity_type|
10
16
  describe "on creation of #{entity_type}" do
11
17
  let(:assignee) { FactoryGirl.create(:user) }
@@ -13,10 +19,6 @@ describe EntityObserver do
13
19
  let!(:entity) { FactoryGirl.build(entity_type, :user => assigner, :assignee => assignee) }
14
20
  let(:mail) { double('mail', :deliver => true) }
15
21
 
16
- before :each do
17
- PaperTrail.stub(:whodunnit).and_return(assigner)
18
- end
19
-
20
22
  after :each do
21
23
  entity.save
22
24
  end
@@ -34,6 +36,12 @@ describe EntityObserver do
34
36
  entity.assignee = entity.user = assigner
35
37
  UserMailer.should_not_receive(:assigned_entity_notification)
36
38
  end
39
+
40
+ it "does not notify me if Setting.host has not been set" do
41
+ Setting.stub(:host).and_return('')
42
+ UserMailer.should_not_receive(:assigned_entity_notification)
43
+ end
44
+
37
45
  end
38
46
 
39
47
  describe "on update of #{entity_type}" do
@@ -42,10 +50,6 @@ describe EntityObserver do
42
50
  let!(:entity) { FactoryGirl.create(entity_type, :user => FactoryGirl.create(:user)) }
43
51
  let(:mail) { double('mail', :deliver => true) }
44
52
 
45
- before :each do
46
- PaperTrail.stub(:whodunnit).and_return(assigner)
47
- end
48
-
49
53
  it "notifies the new owner if the entity is re-assigned" do
50
54
  UserMailer.should_receive(:assigned_entity_notification).with(entity, assigner).and_return(mail)
51
55
  entity.update_attributes(:assignee => assignee)
@@ -66,5 +70,6 @@ describe EntityObserver do
66
70
  entity.update_attributes(:assignee => assigner)
67
71
  end
68
72
  end
73
+
69
74
  end
70
75
  end
@@ -26,7 +26,7 @@
26
26
  # background_info :string(255)
27
27
  #
28
28
 
29
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
29
+ require 'spec_helper'
30
30
 
31
31
  describe Task do
32
32
 
@@ -38,19 +38,19 @@ describe Task do
38
38
  task.should be_valid
39
39
  task.errors.should be_empty
40
40
  end
41
-
41
+
42
42
  [ nil, Time.now.utc_offset + 3600 ].each do |offset|
43
43
  before do
44
44
  adjust_timezone(offset)
45
45
  end
46
-
46
+
47
47
  it "should create a task with due date selected from dropdown within #{offset ? 'different' : 'current'} timezone" do
48
48
  task = FactoryGirl.create(:task, :due_at => Time.now.end_of_week, :bucket => "due_this_week")
49
49
  task.errors.should be_empty
50
50
  task.bucket.should == "due_this_week"
51
51
  task.due_at.should == Time.zone.now.end_of_week
52
52
  end
53
-
53
+
54
54
  it "should create a task with due date selected from the calendar within #{offset ? 'different' : 'current'} timezone" do
55
55
  task = FactoryGirl.create(:task, :bucket => "specific_time", :calendar => "2020-03-20")
56
56
  task.errors.should be_empty
@@ -59,7 +59,7 @@ describe Task do
59
59
  end
60
60
  end
61
61
  end
62
-
62
+
63
63
  describe "Task/Update" do
64
64
  it "should update task name" do
65
65
  task = FactoryGirl.create(:task, :name => "Hello")
@@ -67,14 +67,14 @@ describe Task do
67
67
  task.errors.should be_empty
68
68
  task.name.should == "World"
69
69
  end
70
-
70
+
71
71
  it "should update task category" do
72
72
  task = FactoryGirl.create(:task, :category => "call")
73
73
  task.update_attributes({ :category => "email" })
74
74
  task.errors.should be_empty
75
75
  task.category.should == "email"
76
76
  end
77
-
77
+
78
78
  it "should reassign the task to another person" do
79
79
  him = FactoryGirl.create(:user)
80
80
  her = FactoryGirl.create(:user)
@@ -84,7 +84,7 @@ describe Task do
84
84
  task.assigned_to.should == her.id
85
85
  task.assignee.should == her
86
86
  end
87
-
87
+
88
88
  it "should reassign the task from another person to myself" do
89
89
  him = FactoryGirl.create(:user)
90
90
  task = FactoryGirl.create(:task, :assigned_to => him.id)
@@ -93,12 +93,12 @@ describe Task do
93
93
  task.assigned_to.should == nil
94
94
  task.assignee.should == nil
95
95
  end
96
-
96
+
97
97
  [ nil, Time.now.utc_offset + 3600 ].each do |offset|
98
98
  before do
99
99
  adjust_timezone(offset)
100
100
  end
101
-
101
+
102
102
  it "should update due date based on selected bucket within #{offset ? 'different' : 'current'} timezone" do
103
103
  task = FactoryGirl.create(:task, :due_at => Time.now.midnight.tomorrow, :bucket => "due_tomorrow")
104
104
  task.update_attributes( { :bucket => "due_this_week" } )
@@ -106,7 +106,7 @@ describe Task do
106
106
  task.bucket.should == "due_this_week"
107
107
  task.due_at.should == Time.zone.now.end_of_week
108
108
  end
109
-
109
+
110
110
  it "should update due date if specific calendar date selected within #{offset ? 'different' : 'current'} timezone" do
111
111
  task = FactoryGirl.create(:task, :due_at => Time.now.midnight.tomorrow, :bucket => "due_tomorrow")
112
112
  task.update_attributes( { :bucket => "specific_time", :calendar => "2020-03-20" } )
@@ -115,9 +115,9 @@ describe Task do
115
115
  task.due_at.to_i.should == Time.parse("2020-03-20").to_i
116
116
  end
117
117
  end
118
-
118
+
119
119
  end
120
-
120
+
121
121
  describe "Task/Complete" do
122
122
  it "should comlete a task that is overdue" do
123
123
  task = FactoryGirl.create(:task, :due_at => 2.days.ago, :bucket => "overdue")
@@ -126,7 +126,7 @@ describe Task do
126
126
  task.completed_at.should_not == nil
127
127
  task.completor.should == current_user
128
128
  end
129
-
129
+
130
130
  it "should complete a task due sometime in the future" do
131
131
  task = FactoryGirl.create(:task, :due_at => Time.now.midnight.tomorrow, :bucket => "due_tomorrow")
132
132
  task.update_attributes(:completed_at => Time.now, :completed_by => current_user.id)
@@ -134,7 +134,7 @@ describe Task do
134
134
  task.completed_at.should_not == nil
135
135
  task.completor.should == current_user
136
136
  end
137
-
137
+
138
138
  it "should complete a task that is due on specific date in the future" do
139
139
  task = FactoryGirl.create(:task, :calendar => "10/10/2022 12:00 AM", :bucket => "specific_time")
140
140
  task.calendar = nil # Calendar is not saved in the database; we need it only to set the :due_at.
@@ -143,7 +143,7 @@ describe Task do
143
143
  task.completed_at.should_not == nil
144
144
  task.completor.should == current_user
145
145
  end
146
-
146
+
147
147
  it "should complete a task that is due on specific date in the past" do
148
148
  task = FactoryGirl.create(:task, :calendar => "10/10/1992 12:00 AM", :bucket => "specific_time")
149
149
  task.calendar = nil # Calendar is not saved in the database; we need it only to set the :due_at.
@@ -152,7 +152,7 @@ describe Task do
152
152
  task.completed_at.should_not == nil
153
153
  task.completor.should == current_user
154
154
  end
155
-
155
+
156
156
  it "completion should preserve original due date" do
157
157
  due_at = Time.now - 42.days
158
158
  task = FactoryGirl.create(:task, :due_at => due_at, :bucket => "specific_time",
@@ -162,71 +162,150 @@ describe Task do
162
162
  task.due_at.should == due_at.utc.strftime('%Y-%m-%d %H:%M')
163
163
  end
164
164
  end
165
-
165
+
166
166
  # named_scope :my, lambda { |user| { :conditions => [ "(user_id = ? AND assigned_to IS NULL) OR assigned_to = ?", user.id, user.id ], :include => :assignee } }
167
167
  describe "task.my?" do
168
168
  it "should match a task created by the user" do
169
169
  task = FactoryGirl.create(:task, :user => current_user, :assignee => nil)
170
170
  task.my?(current_user).should == true
171
171
  end
172
-
172
+
173
173
  it "should match a task assigned to the user" do
174
174
  task = FactoryGirl.create(:task, :user => FactoryGirl.create(:user), :assignee => current_user)
175
175
  task.my?(current_user).should == true
176
176
  end
177
-
177
+
178
178
  it "should Not match a task not created by the user" do
179
179
  task = FactoryGirl.create(:task, :user => FactoryGirl.create(:user))
180
180
  task.my?(current_user).should == false
181
181
  end
182
-
182
+
183
183
  it "should Not match a task created by the user but assigned to somebody else" do
184
184
  task = FactoryGirl.create(:task, :user => current_user, :assignee => FactoryGirl.create(:user))
185
185
  task.my?(current_user).should == false
186
186
  end
187
187
  end
188
-
188
+
189
189
  # named_scope :assigned_by, lambda { |user| { :conditions => [ "user_id = ? AND assigned_to IS NOT NULL AND assigned_to != ?", user.id, user.id ], :include => :assignee } }
190
190
  describe "task.assigned_by?" do
191
191
  it "should match a task assigned by the user to somebody else" do
192
192
  task = FactoryGirl.create(:task, :user => current_user, :assignee => FactoryGirl.create(:user))
193
193
  task.assigned_by?(current_user).should == true
194
194
  end
195
-
195
+
196
196
  it "should Not match a task not created by the user" do
197
197
  task = FactoryGirl.create(:task, :user => FactoryGirl.create(:user))
198
198
  task.assigned_by?(current_user).should == false
199
199
  end
200
-
200
+
201
201
  it "should Not match a task not assigned to anybody" do
202
202
  task = FactoryGirl.create(:task, :assignee => nil)
203
203
  task.assigned_by?(current_user).should == false
204
204
  end
205
-
205
+
206
206
  it "should Not match a task assigned to the user" do
207
207
  task = FactoryGirl.create(:task, :assignee => current_user)
208
208
  task.assigned_by?(current_user).should == false
209
209
  end
210
210
  end
211
-
211
+
212
212
  # named_scope :tracked_by, lambda { |user| { :conditions => [ "user_id = ? OR assigned_to = ?", user.id, user.id ], :include => :assignee } }
213
213
  describe "task.tracked_by?" do
214
214
  it "should match a task created by the user" do
215
215
  task = FactoryGirl.create(:task, :user => current_user)
216
216
  task.tracked_by?(current_user).should == true
217
217
  end
218
-
218
+
219
219
  it "should match a task assigned to the user" do
220
220
  task = FactoryGirl.create(:task, :assignee => current_user)
221
221
  task.tracked_by?(current_user).should == true
222
222
  end
223
-
223
+
224
224
  it "should Not match a task that is neither created nor assigned to the user" do
225
225
  task = FactoryGirl.create(:task, :user => FactoryGirl.create(:user), :assignee => FactoryGirl.create(:user))
226
226
  task.tracked_by?(current_user).should == false
227
227
  end
228
228
  end
229
-
229
+
230
+ describe "task.computed_bucket" do
231
+
232
+ context "when overdue" do
233
+ subject { described_class.new(:due_at => 1.days.ago, :bucket => "specific_time") }
234
+
235
+ it "returns a sensible value" do
236
+ subject.computed_bucket.should == "overdue"
237
+ end
238
+ end
239
+
240
+ context "when due today" do
241
+ subject { described_class.new(:due_at => Time.now, :bucket => "specific_time") }
242
+
243
+ it "returns a sensible value" do
244
+ subject.computed_bucket.should == "due_today"
245
+ end
246
+ end
247
+
248
+ context "when due tomorrow" do
249
+ subject { described_class.new(:due_at => 1.days.from_now.end_of_day, :bucket => "specific_time") }
250
+
251
+ it "returns a sensible value" do
252
+ subject.computed_bucket.should == "due_tomorrow"
253
+ end
254
+ end
255
+
256
+ context "when due this week" do
257
+ it "returns a sensible value" do
258
+ # Freeze time so tests will pass when run at the end of the week!!
259
+ Timecop.freeze(Time.local(2014, 1, 1, 16, 14)) do
260
+ task = described_class.new(:due_at => Time.zone.now.end_of_week, :bucket => "specific_time")
261
+ expect(task.computed_bucket).to eql("due_this_week")
262
+ end
263
+ end
264
+ end
265
+
266
+ context "when due next week" do
267
+ subject { described_class.new(:due_at => Time.zone.now.next_week, :bucket => "specific_time") }
268
+
269
+ it "returns a sensible value" do
270
+ subject.computed_bucket.should == "due_next_week"
271
+ end
272
+ end
273
+
274
+ context "when due later" do
275
+ subject { described_class.new(:due_at => 1.month.from_now, :bucket => "specific_time") }
276
+
277
+ it "returns a sensible value" do
278
+ subject.computed_bucket.should == "due_later"
279
+ end
280
+ end
281
+ end
282
+
283
+ describe "task.at_specific_time?" do
284
+ context "when the due date is at the beginning of the day" do
285
+ subject { described_class.new(due_at: Time.zone.now.beginning_of_day) }
286
+
287
+ it "returns false" do
288
+ subject.at_specific_time?.should == false
289
+ end
290
+ end
291
+
292
+ context "when the due date is at the end of the day" do
293
+ subject { described_class.new(due_at: Time.zone.now.end_of_day) }
294
+
295
+ it "returns false" do
296
+ subject.at_specific_time?.should == false
297
+ end
298
+ end
299
+
300
+ context "when the due date is any other time" do
301
+ subject { described_class.new(due_at: Time.zone.parse("2014-01-01 18:36:43")) }
302
+
303
+ it "returns true" do
304
+ subject.at_specific_time?.should == true
305
+ end
306
+ end
307
+ end
308
+
230
309
  describe "Exportable" do
231
310
  describe "unassigned tasks" do
232
311
  before do
@@ -238,7 +317,7 @@ describe Task do
238
317
  let(:exported) { Task.all }
239
318
  end
240
319
  end
241
-
320
+
242
321
  describe "assigned tasks" do
243
322
  before do
244
323
  Task.delete_all
@@ -249,7 +328,7 @@ describe Task do
249
328
  let(:exported) { Task.all }
250
329
  end
251
330
  end
252
-
331
+
253
332
  describe "completed tasks" do
254
333
  before do
255
334
  Task.delete_all
@@ -261,7 +340,7 @@ describe Task do
261
340
  end
262
341
  end
263
342
  end
264
-
343
+
265
344
  describe "#parse_calendar_date" do
266
345
 
267
346
  it "should parse the date" do