fat_free_crm 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (212) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +2 -2
  3. data/Gemfile +15 -2
  4. data/Gemfile.lock +34 -14
  5. data/README.md +37 -124
  6. data/app/assets/javascripts/application.js.erb +1 -1
  7. data/app/assets/javascripts/crm.js +22 -1
  8. data/app/assets/javascripts/crm_fields.js +2 -3
  9. data/app/assets/javascripts/jquery-noconflict.js +17 -0
  10. data/app/assets/stylesheets/application.css.erb +1 -0
  11. data/app/assets/stylesheets/common.scss +26 -0
  12. data/app/assets/stylesheets/ffcrm_chosen.scss +1 -1
  13. data/app/controllers/admin/application_controller.rb +1 -1
  14. data/app/controllers/application_controller.rb +0 -8
  15. data/app/controllers/{accounts_controller.rb → entities/accounts_controller.rb} +1 -13
  16. data/app/controllers/{campaigns_controller.rb → entities/campaigns_controller.rb} +1 -13
  17. data/app/controllers/{contacts_controller.rb → entities/contacts_controller.rb} +1 -7
  18. data/app/controllers/{leads_controller.rb → entities/leads_controller.rb} +1 -1
  19. data/app/controllers/{opportunities_controller.rb → entities/opportunities_controller.rb} +1 -7
  20. data/app/controllers/{tasks_controller.rb → entities/tasks_controller.rb} +1 -1
  21. data/app/controllers/{base_controller.rb → entities_controller.rb} +32 -1
  22. data/app/controllers/home_controller.rb +9 -9
  23. data/app/controllers/lists_controller.rb +17 -0
  24. data/app/helpers/admin/tags_helper.rb +1 -1
  25. data/app/helpers/application_helper.rb +14 -14
  26. data/app/helpers/crm_tags_helper.rb +1 -1
  27. data/app/helpers/home_helper.rb +13 -15
  28. data/app/helpers/lists_helper.rb +17 -0
  29. data/app/inputs/date_time_input.rb +17 -0
  30. data/app/inputs/text_input.rb +17 -1
  31. data/app/models/{base → entities}/account.rb +0 -1
  32. data/app/models/{base → entities}/account_contact.rb +0 -0
  33. data/app/models/{base → entities}/account_opportunity.rb +0 -0
  34. data/app/models/{base → entities}/campaign.rb +0 -1
  35. data/app/models/{base → entities}/contact.rb +0 -1
  36. data/app/models/{base → entities}/contact_opportunity.rb +0 -0
  37. data/app/models/{base → entities}/lead.rb +0 -1
  38. data/app/models/{base → entities}/opportunity.rb +0 -1
  39. data/app/models/{base → entities}/task.rb +5 -6
  40. data/app/models/list.rb +17 -0
  41. data/app/models/observers/lead_observer.rb +39 -0
  42. data/app/models/observers/opportunity_observer.rb +54 -0
  43. data/app/models/observers/task_observer.rb +41 -0
  44. data/app/models/polymorphic/address.rb +1 -3
  45. data/app/models/polymorphic/avatar.rb +0 -5
  46. data/app/models/polymorphic/comment.rb +2 -11
  47. data/app/models/polymorphic/email.rb +2 -9
  48. data/app/models/polymorphic/tag.rb +17 -0
  49. data/app/models/polymorphic/tagging.rb +17 -0
  50. data/app/models/users/ability.rb +13 -0
  51. data/app/models/users/user.rb +1 -4
  52. data/app/views/accounts/_account.html.haml +10 -6
  53. data/app/views/accounts/index.html.haml +1 -1
  54. data/app/views/accounts/show.html.haml +6 -24
  55. data/app/views/admin/fields/_field.html.haml +6 -6
  56. data/app/views/admin/tags/_tag.html.haml +2 -2
  57. data/app/views/admin/tags/index.html.haml +1 -1
  58. data/app/views/admin/users/_user.html.haml +3 -3
  59. data/app/views/admin/users/index.html.haml +1 -1
  60. data/app/views/campaigns/_campaign.html.haml +9 -5
  61. data/app/views/campaigns/index.html.haml +1 -1
  62. data/app/views/campaigns/show.html.haml +4 -24
  63. data/app/views/comments/_comment.html.haml +17 -14
  64. data/app/views/comments/_edit.html.haml +1 -1
  65. data/app/views/comments/_new.html.haml +3 -3
  66. data/app/views/contacts/_contact.html.haml +33 -15
  67. data/app/views/contacts/_contacts.html.haml +6 -0
  68. data/app/views/contacts/_sidebar_show.html.haml +1 -1
  69. data/app/views/contacts/index.html.haml +1 -1
  70. data/app/views/contacts/show.html.haml +3 -19
  71. data/app/views/emails/_email.html.haml +24 -21
  72. data/app/views/{base → entities}/_advanced_search.html.haml +0 -0
  73. data/app/views/{base → entities}/_condition_fields.html.haml +0 -0
  74. data/app/views/{base → entities}/_grouping_fields.html.haml +0 -0
  75. data/app/views/{base → entities}/_sort_fields.html.haml +0 -0
  76. data/app/views/{base → entities}/advanced_search.js.rjs +0 -0
  77. data/app/views/entities/contacts.js.rjs +3 -0
  78. data/app/views/entities/leads.js.rjs +3 -0
  79. data/app/views/entities/opportunities.js.rjs +3 -0
  80. data/app/views/entities/versions.js.rjs +3 -0
  81. data/app/views/home/_activity.html.haml +19 -18
  82. data/app/views/home/_events_menu.html.haml +8 -0
  83. data/app/views/home/_options.html.haml +2 -3
  84. data/app/views/home/index.html.haml +1 -1
  85. data/app/views/leads/_lead.html.haml +42 -23
  86. data/app/views/leads/_leads.html.haml +6 -0
  87. data/app/views/leads/_sidebar_show.html.haml +1 -1
  88. data/app/views/leads/index.html.haml +1 -1
  89. data/app/views/leads/show.html.haml +3 -13
  90. data/app/views/opportunities/_opportunities.html.haml +6 -0
  91. data/app/views/opportunities/_opportunity.html.haml +23 -11
  92. data/app/views/opportunities/index.html.haml +1 -1
  93. data/app/views/opportunities/show.html.haml +4 -18
  94. data/app/views/shared/_comment.html.haml +3 -3
  95. data/app/views/shared/_edit_comment.html.haml +1 -1
  96. data/app/views/shared/_recent.html.haml +4 -4
  97. data/app/views/shared/_recently.html.haml +3 -3
  98. data/app/views/shared/_timeline.html.haml +2 -3
  99. data/app/views/tasks/_assigned.html.haml +4 -4
  100. data/app/views/tasks/_completed.html.haml +2 -2
  101. data/app/views/tasks/_pending.html.haml +2 -2
  102. data/app/views/tasks/_related.html.haml +4 -5
  103. data/app/views/tasks/_tasks.html.haml +3 -0
  104. data/app/views/tasks/_title.html.haml +1 -1
  105. data/app/views/tasks/index.html.haml +1 -1
  106. data/app/views/users/_avatar.html.haml +2 -2
  107. data/app/views/versions/_version.html.haml +9 -12
  108. data/app/views/versions/_versions.html.haml +11 -0
  109. data/config/application.rb +3 -2
  110. data/config/environments/development.rb +2 -2
  111. data/config/environments/production.rb +0 -4
  112. data/config/environments/staging.rb +1 -1
  113. data/config/initializers/action_mailer.rb +9 -0
  114. data/config/initializers/paper_trail.rb +80 -0
  115. data/config/initializers/relative_url_root.rb +23 -0
  116. data/config/locales/cz_fat_free_crm.yml +1 -1
  117. data/config/locales/en-US_fat_free_crm.yml +22 -17
  118. data/config/locales/fr_fat_free_crm.yml +349 -134
  119. data/config/routes.rb +144 -140
  120. data/config/settings.default.yml +14 -2
  121. data/db/demo/addresses.yml +2 -2
  122. data/db/demo/emails.yml +2 -2
  123. data/db/migrate/20120216042541_is_paranoid_to_paper_trail.rb +1 -2
  124. data/db/migrate/20120309070209_add_versions_related.rb +6 -0
  125. data/db/migrate/20120316045804_activities_to_versions.rb +35 -0
  126. data/db/schema.rb +79 -53
  127. data/fat_free_crm.gemspec +8 -4
  128. data/lib/development_tasks/gem.rake +18 -1
  129. data/lib/development_tasks/license.rake +2 -4
  130. data/lib/development_tasks/rdoc.rake +17 -0
  131. data/lib/development_tasks/rspec.rake +17 -0
  132. data/lib/fat_free_crm.rb +20 -14
  133. data/lib/fat_free_crm/core_ext/array.rb +0 -27
  134. data/lib/fat_free_crm/dropbox.rb +11 -1
  135. data/lib/fat_free_crm/engine.rb +21 -3
  136. data/lib/fat_free_crm/gem_dependencies.rb +26 -0
  137. data/lib/fat_free_crm/gem_ext.rb +18 -1
  138. data/lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb +18 -1
  139. data/lib/fat_free_crm/gem_ext/authlogic/session/cookies.rb +17 -0
  140. data/lib/fat_free_crm/gem_ext/rails/engine.rb +17 -0
  141. data/lib/fat_free_crm/gem_ext/rails/text_helper.rb +17 -0
  142. data/lib/fat_free_crm/gem_ext/rake/task.rb +17 -0
  143. data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +18 -1
  144. data/lib/fat_free_crm/plugin_dependencies.rb +23 -5
  145. data/lib/fat_free_crm/renderers.rb +17 -0
  146. data/lib/fat_free_crm/syck_yaml.rb +17 -0
  147. data/lib/fat_free_crm/version.rb +1 -1
  148. data/lib/{country_select → plugins/country_select}/MIT-LICENSE +0 -0
  149. data/lib/{country_select → plugins/country_select}/README +0 -0
  150. data/lib/{country_select → plugins/country_select}/init.rb +0 -0
  151. data/lib/{country_select → plugins/country_select}/install.rb +0 -0
  152. data/lib/{country_select → plugins/country_select}/lib/country_select.rb +0 -0
  153. data/lib/{country_select → plugins/country_select}/uninstall.rb +0 -0
  154. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/Gemfile +0 -0
  155. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/README.textile +0 -0
  156. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/ROADMAP.textile +0 -0
  157. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/Rakefile +0 -0
  158. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/VERSION +0 -0
  159. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/gravatar_image_tag.gemspec +0 -0
  160. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/init.rb +0 -0
  161. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/lib/gravatar_image_tag.rb +0 -0
  162. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/spec/gravatar_image_tag_spec.rb +0 -0
  163. data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/spec/test_helper.rb +0 -0
  164. data/lib/tasks/demo.rake +32 -29
  165. data/lib/tasks/dropbox.rake +1 -1
  166. data/lib/tasks/fat_free_crm.rake +3 -2
  167. data/lib/tasks/plugins.rake +1 -0
  168. data/spec/controllers/accounts_controller_spec.rb +7 -5
  169. data/spec/controllers/campaigns_controller_spec.rb +11 -9
  170. data/spec/controllers/contacts_controller_spec.rb +7 -5
  171. data/spec/controllers/home_controller_spec.rb +2 -2
  172. data/spec/controllers/leads_controller_spec.rb +7 -5
  173. data/spec/controllers/opportunities_controller_spec.rb +7 -5
  174. data/spec/factories/shared_factories.rb +8 -11
  175. data/spec/lib/dropbox_spec.rb +1 -0
  176. data/spec/models/polymorphic/version_spec.rb +247 -0
  177. data/spec/models/users/user_spec.rb +0 -9
  178. data/spec/spec_helper.rb +4 -0
  179. data/spec/views/home/index.haml_spec.rb +1 -1
  180. data/spec/views/home/index.rjs_spec.rb +4 -4
  181. data/spec/views/tasks/new.rjs_spec.rb +2 -2
  182. data/vendor/assets/javascripts/calendar_date_select/format_french.js +24 -0
  183. metadata +167 -126
  184. data/app/models/observers/activity_observer.rb +0 -84
  185. data/app/models/polymorphic/activity.rb +0 -106
  186. data/app/views/accounts/contacts.js.rjs +0 -3
  187. data/app/views/accounts/opportunities.js.rjs +0 -3
  188. data/app/views/campaigns/leads.js.rjs +0 -3
  189. data/app/views/campaigns/opportunities.js.rjs +0 -3
  190. data/app/views/contacts/opportunities.js.rjs +0 -3
  191. data/app/views/home/_actions_menu.html.haml +0 -8
  192. data/lib/dynamic_form/MIT-LICENSE +0 -20
  193. data/lib/dynamic_form/README +0 -13
  194. data/lib/dynamic_form/Rakefile +0 -10
  195. data/lib/dynamic_form/dynamic_form.gemspec +0 -12
  196. data/lib/dynamic_form/init.rb +0 -2
  197. data/lib/dynamic_form/lib/action_view/helpers/dynamic_form.rb +0 -301
  198. data/lib/dynamic_form/lib/action_view/locale/en-US.yml +0 -8
  199. data/lib/dynamic_form/lib/dynamic_form.rb +0 -6
  200. data/lib/dynamic_form/test/dynamic_form_i18n_test.rb +0 -42
  201. data/lib/dynamic_form/test/dynamic_form_test.rb +0 -370
  202. data/lib/dynamic_form/test/test_helper.rb +0 -10
  203. data/lib/responds_to_parent/MIT-LICENSE +0 -20
  204. data/lib/responds_to_parent/README +0 -47
  205. data/lib/responds_to_parent/Rakefile +0 -22
  206. data/lib/responds_to_parent/init.rb +0 -2
  207. data/lib/responds_to_parent/install.rb +0 -2
  208. data/lib/responds_to_parent/lib/responds_to_parent.rb +0 -70
  209. data/lib/responds_to_parent/test/responds_to_parent_test.rb +0 -11
  210. data/lib/responds_to_parent/test/test_helper.rb +0 -7
  211. data/lib/responds_to_parent/uninstall.rb +0 -2
  212. data/spec/models/polymorphic/activity_spec.rb +0 -303
@@ -1,172 +1,176 @@
1
1
  Rails.application.routes.draw do
2
- scope Setting.base_url do
3
- resources :lists
4
-
5
- root :to => 'home#index'
6
-
7
- match 'activities' => 'home#index'
8
- match 'admin' => 'admin/users#index', :as => :admin
9
- match 'login' => 'authentications#new', :as => :login
10
- match 'logout' => 'authentications#destroy', :as => :logout
11
- match 'options' => 'home#options'
12
- match 'profile' => 'users#show', :as => :profile
13
- match 'signup' => 'users#new', :as => :signup
14
- match 'timeline' => 'home#timeline', :as => :timeline
15
- match 'timezone' => 'home#timezone', :as => :timezone
16
- match 'redraw' => 'home#redraw', :as => :redraw
17
- match 'toggle' => 'home#toggle'
18
-
19
- resource :authentication
20
- resources :comments
21
- resources :emails
22
- resources :passwords
23
-
24
- resources :accounts, :id => /\d+/ do
25
- collection do
26
- get :advanced_search
27
- post :filter
28
- get :options
29
- get :field_group
30
- match :auto_complete
31
- post :redraw
32
- end
33
- member do
34
- put :attach
35
- post :discard
36
- get :contacts
37
- get :opportunities
38
- end
2
+ resources :lists
3
+
4
+ root :to => 'home#index'
5
+
6
+ match 'activities' => 'home#index'
7
+ match 'admin' => 'admin/users#index', :as => :admin
8
+ match 'login' => 'authentications#new', :as => :login
9
+ match 'logout' => 'authentications#destroy', :as => :logout
10
+ match 'profile' => 'users#show', :as => :profile
11
+ match 'signup' => 'users#new', :as => :signup
12
+
13
+ match '/home/options', :as => :options
14
+ match '/home/toggle', :as => :toggle
15
+ match '/home/timeline', :as => :timeline
16
+ match '/home/timezone', :as => :timezone
17
+ match '/home/redraw', :as => :redraw
18
+
19
+ resource :authentication
20
+ resources :comments
21
+ resources :emails
22
+ resources :passwords
23
+
24
+ resources :accounts, :id => /\d+/ do
25
+ collection do
26
+ get :advanced_search
27
+ post :filter
28
+ get :options
29
+ get :field_group
30
+ match :auto_complete
31
+ post :redraw
32
+ get :versions
39
33
  end
34
+ member do
35
+ put :attach
36
+ post :discard
37
+ get :contacts
38
+ get :opportunities
39
+ end
40
+ end
40
41
 
41
- resources :campaigns, :id => /\d+/ do
42
- collection do
43
- get :advanced_search
44
- post :filter
45
- get :options
46
- get :field_group
47
- post :auto_complete
48
- post :redraw
49
- end
50
- member do
51
- put :attach
52
- post :discard
53
- get :leads
54
- get :opportunities
55
- end
42
+ resources :campaigns, :id => /\d+/ do
43
+ collection do
44
+ get :advanced_search
45
+ post :filter
46
+ get :options
47
+ get :field_group
48
+ post :auto_complete
49
+ post :redraw
50
+ get :versions
51
+ end
52
+ member do
53
+ put :attach
54
+ post :discard
55
+ get :leads
56
+ get :opportunities
56
57
  end
58
+ end
57
59
 
58
- resources :contacts, :id => /\d+/ do
59
- collection do
60
- get :advanced_search
61
- post :filter
62
- get :options
63
- get :field_group
64
- post :auto_complete
65
- post :redraw
66
- end
67
- member do
68
- put :attach
69
- post :discard
70
- get :opportunities
71
- end
60
+ resources :contacts, :id => /\d+/ do
61
+ collection do
62
+ get :advanced_search
63
+ post :filter
64
+ get :options
65
+ get :field_group
66
+ post :auto_complete
67
+ post :redraw
68
+ get :versions
69
+ end
70
+ member do
71
+ put :attach
72
+ post :discard
73
+ get :opportunities
74
+ end
75
+ end
76
+
77
+ resources :leads, :id => /\d+/ do
78
+ collection do
79
+ get :advanced_search
80
+ post :filter
81
+ get :options
82
+ get :field_group
83
+ post :auto_complete
84
+ post :redraw
85
+ get :versions
86
+ end
87
+ member do
88
+ get :convert
89
+ post :discard
90
+ put :attach
91
+ put :promote
92
+ put :reject
93
+ end
94
+ end
95
+
96
+ resources :opportunities, :id => /\d+/ do
97
+ collection do
98
+ get :advanced_search
99
+ post :filter
100
+ get :options
101
+ get :field_group
102
+ post :auto_complete
103
+ post :redraw
104
+ get :versions
105
+ end
106
+ member do
107
+ put :attach
108
+ post :discard
109
+ get :contacts
72
110
  end
111
+ end
73
112
 
74
- resources :leads, :id => /\d+/ do
113
+ resources :tasks, :id => /\d+/ do
114
+ collection do
115
+ post :filter
116
+ post :auto_complete
117
+ end
118
+ member do
119
+ put :complete
120
+ end
121
+ end
122
+
123
+ resources :users, :id => /\d+/ do
124
+ member do
125
+ get :avatar
126
+ get :password
127
+ put :upload_avatar
128
+ put :change_password
129
+ end
130
+ end
131
+
132
+ namespace :admin do
133
+ resources :users do
75
134
  collection do
76
- get :advanced_search
77
- post :filter
78
- get :options
79
- get :field_group
80
135
  post :auto_complete
81
- post :redraw
82
136
  end
83
137
  member do
84
- get :convert
85
- post :discard
86
- put :attach
87
- put :promote
88
- put :reject
138
+ get :confirm
139
+ put :suspend
140
+ put :reactivate
89
141
  end
90
142
  end
91
143
 
92
- resources :opportunities, :id => /\d+/ do
144
+ resources :field_groups, :except => :index do
93
145
  collection do
94
- get :advanced_search
95
- post :filter
96
- get :options
97
- get :field_group
98
- post :auto_complete
99
- post :redraw
146
+ post :sort
100
147
  end
101
148
  member do
102
- put :attach
103
- post :discard
104
- get :contacts
149
+ get :confirm
105
150
  end
106
151
  end
107
152
 
108
- resources :tasks, :id => /\d+/ do
153
+ resources :fields do
109
154
  collection do
110
- post :filter
111
155
  post :auto_complete
112
- end
113
- member do
114
- put :complete
156
+ get :options
157
+ post :redraw
158
+ post :sort
115
159
  end
116
160
  end
117
161
 
118
- resources :users, :id => /\d+/ do
162
+ resources :tags do
119
163
  member do
120
- get :avatar
121
- get :password
122
- put :upload_avatar
123
- put :change_password
164
+ get :confirm
124
165
  end
125
166
  end
126
167
 
127
- namespace :admin do
128
- resources :users do
129
- collection do
130
- post :auto_complete
131
- end
132
- member do
133
- get :confirm
134
- put :suspend
135
- put :reactivate
136
- end
137
- end
138
-
139
- resources :field_groups, :except => :index do
140
- collection do
141
- post :sort
142
- end
143
- member do
144
- get :confirm
145
- end
146
- end
147
-
148
- resources :fields do
149
- collection do
150
- post :auto_complete
151
- get :options
152
- post :redraw
153
- post :sort
154
- end
155
- end
156
-
157
- resources :tags do
158
- member do
159
- get :confirm
160
- end
161
- end
162
-
163
- resources :fields, :as => :custom_fields
164
- resources :fields, :as => :core_fields
168
+ resources :fields, :as => :custom_fields
169
+ resources :fields, :as => :core_fields
165
170
 
166
- resources :settings
167
- resources :plugins
168
- end
169
-
170
- get '/:controller/tagged/:id' => '#tagged'
171
+ resources :settings
172
+ resources :plugins
171
173
  end
174
+
175
+ get '/:controller/tagged/:id' => '#tagged'
172
176
  end
@@ -73,8 +73,20 @@
73
73
  :locale: "en-US"
74
74
 
75
75
 
76
- # Settings for the Email dropbox
77
- # - Connection settings for the imap account, server and folders.
76
+ # Settings for outgoing email (SMTP)
77
+ # - Default configuration is for GMail
78
+ #------------------------------------------------------------------------------
79
+ :smtp:
80
+ :address : "smtp.gmail.com"
81
+ :enable_starttls_auto : true
82
+ :port : 587
83
+ :authentication : :plain
84
+ :user_name : ""
85
+ :password : ""
86
+
87
+
88
+ # Settings for the Email dropbox (IMAP)
89
+ # - Connection settings for the IMAP account, server and folders.
78
90
  #------------------------------------------------------------------------------
79
91
  :email_dropbox:
80
92
  :server : "" # IMAP server name.
@@ -18,7 +18,7 @@
18
18
  # deleted_at :datetime
19
19
  #
20
20
 
21
- <%
21
+ <%
22
22
  require "ffaker"
23
23
  puts "Loading addresses..."
24
24
 
@@ -29,7 +29,7 @@
29
29
  %>
30
30
  address_<%= i %>:
31
31
  id : <%= i %>
32
- addressable_id : <%= i %>
32
+ addressable_id : <%= i/2 %>
33
33
  addressable_type : <%= asset = addressable.sample %>
34
34
  address_type : <%= asset == 'Account' ? type.sample : 'Business' %>
35
35
  street1 : <%= street1 = Faker::Address.street_address %>
@@ -48,6 +48,6 @@ email_<%= i %>:
48
48
  <%= "\n" %>
49
49
  <%= Faker::Lorem.paragraph(rand(10) + 5) %>
50
50
  header :
51
- sent_at :
52
- received_at :
51
+ sent_at : <%= Date.today - rand(15).days %>
52
+ received_at : <%= Date.today - rand(15).days %>
53
53
  <% end %>
@@ -2,8 +2,7 @@ class IsParanoidToPaperTrail < ActiveRecord::Migration
2
2
  def up
3
3
  [Account, Campaign, Contact, Lead, Opportunity, Task].each do |klass|
4
4
  klass.where('deleted_at IS NOT NULL').each do |object|
5
- object.destroy # Really destroy the object
6
- Activity.last.destroy # Remove the destroy activity because we should already have one indicating this object is destroyed
5
+ object.destroy
7
6
  end
8
7
  end
9
8
  end
@@ -0,0 +1,6 @@
1
+ class AddVersionsRelated < ActiveRecord::Migration
2
+ def change
3
+ add_column :versions, :related_id, :integer
4
+ add_column :versions, :related_type, :string
5
+ end
6
+ end
@@ -0,0 +1,35 @@
1
+ class ActivitiesToVersions < ActiveRecord::Migration
2
+ def up
3
+ events = {
4
+ 'created' => 'create',
5
+ 'viewed' => 'view',
6
+ 'updated' => 'update',
7
+ 'deleted' => 'destroy',
8
+ 'rejected' => 'reject',
9
+ 'won' => 'won',
10
+ 'completed' => 'complete',
11
+ 'reassigned' => 'reassign',
12
+ 'rescheduled' => 'reschedule'
13
+ }
14
+
15
+ activities = connection.select_all 'SELECT * FROM activities'
16
+ activities.each do |activity|
17
+ # commented and email activities don't translate well so ignore them
18
+ if event = events[activity['action']]
19
+ attributes = {
20
+ :item_id => activity['subject_id'],
21
+ :item_type => activity['subject_type'],
22
+ :whodunnit => activity['user_id'],
23
+ :event => event,
24
+ :created_at => activity['created_at']
25
+ }
26
+ version = Version.new
27
+ attributes.each {|k, v| version.send("#{k}=", v)}
28
+ version.save!
29
+ end
30
+ end
31
+ end
32
+
33
+ def down
34
+ end
35
+ end
@@ -11,39 +11,46 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20120224073107) do
14
+ ActiveRecord::Schema.define(:version => 20120316045804) do
15
+
16
+ create_table "account_aliases", :force => true do |t|
17
+ t.integer "account_id"
18
+ t.integer "destroyed_account_id"
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
+ end
15
22
 
16
23
  create_table "account_contacts", :force => true do |t|
17
24
  t.integer "account_id"
18
25
  t.integer "contact_id"
19
26
  t.datetime "deleted_at"
20
- t.datetime "created_at", :null => false
21
- t.datetime "updated_at", :null => false
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
22
29
  end
23
30
 
24
31
  create_table "account_opportunities", :force => true do |t|
25
32
  t.integer "account_id"
26
33
  t.integer "opportunity_id"
27
34
  t.datetime "deleted_at"
28
- t.datetime "created_at", :null => false
29
- t.datetime "updated_at", :null => false
35
+ t.datetime "created_at"
36
+ t.datetime "updated_at"
30
37
  end
31
38
 
32
39
  create_table "accounts", :force => true do |t|
33
40
  t.integer "user_id"
34
41
  t.integer "assigned_to"
35
- t.string "name", :limit => 64, :default => "", :null => false
36
- t.string "access", :limit => 8, :default => "Public"
42
+ t.string "name", :limit => 128, :default => "", :null => false
43
+ t.string "access", :limit => 8, :default => "Public"
37
44
  t.string "website", :limit => 64
38
45
  t.string "toll_free_phone", :limit => 32
39
46
  t.string "phone", :limit => 32
40
47
  t.string "fax", :limit => 32
41
48
  t.datetime "deleted_at"
42
- t.datetime "created_at", :null => false
43
- t.datetime "updated_at", :null => false
49
+ t.datetime "created_at"
50
+ t.datetime "updated_at"
44
51
  t.string "email", :limit => 64
45
52
  t.string "background_info"
46
- t.integer "rating", :default => 0, :null => false
53
+ t.integer "rating", :default => 0, :null => false
47
54
  t.string "category", :limit => 32
48
55
  end
49
56
 
@@ -57,8 +64,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
57
64
  t.string "action", :limit => 32, :default => "created"
58
65
  t.string "info", :default => ""
59
66
  t.boolean "private", :default => false
60
- t.datetime "created_at", :null => false
61
- t.datetime "updated_at", :null => false
67
+ t.datetime "created_at"
68
+ t.datetime "updated_at"
62
69
  end
63
70
 
64
71
  add_index "activities", ["created_at"], :name => "index_activities_on_created_at"
@@ -75,13 +82,20 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
75
82
  t.string "address_type", :limit => 16
76
83
  t.integer "addressable_id"
77
84
  t.string "addressable_type"
78
- t.datetime "created_at", :null => false
79
- t.datetime "updated_at", :null => false
85
+ t.datetime "created_at"
86
+ t.datetime "updated_at"
80
87
  t.datetime "deleted_at"
81
88
  end
82
89
 
83
90
  add_index "addresses", ["addressable_id", "addressable_type"], :name => "index_addresses_on_addressable_id_and_addressable_type"
84
91
 
92
+ create_table "application_accounts", :force => true do |t|
93
+ t.string "name"
94
+ t.string "single_access_token", :null => false
95
+ t.datetime "created_at"
96
+ t.datetime "updated_at"
97
+ end
98
+
85
99
  create_table "avatars", :force => true do |t|
86
100
  t.integer "user_id"
87
101
  t.integer "entity_id"
@@ -89,8 +103,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
89
103
  t.integer "image_file_size"
90
104
  t.string "image_file_name"
91
105
  t.string "image_content_type"
92
- t.datetime "created_at", :null => false
93
- t.datetime "updated_at", :null => false
106
+ t.datetime "created_at"
107
+ t.datetime "updated_at"
94
108
  end
95
109
 
96
110
  create_table "campaigns", :force => true do |t|
@@ -110,8 +124,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
110
124
  t.date "ends_on"
111
125
  t.text "objectives"
112
126
  t.datetime "deleted_at"
113
- t.datetime "created_at", :null => false
114
- t.datetime "updated_at", :null => false
127
+ t.datetime "created_at"
128
+ t.datetime "updated_at"
115
129
  t.string "background_info"
116
130
  end
117
131
 
@@ -125,18 +139,25 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
125
139
  t.boolean "private"
126
140
  t.string "title", :default => ""
127
141
  t.text "comment"
128
- t.datetime "created_at", :null => false
129
- t.datetime "updated_at", :null => false
142
+ t.datetime "created_at"
143
+ t.datetime "updated_at"
130
144
  t.string "state", :limit => 16, :default => "Expanded", :null => false
131
145
  end
132
146
 
147
+ create_table "contact_aliases", :force => true do |t|
148
+ t.integer "contact_id"
149
+ t.integer "destroyed_contact_id"
150
+ t.datetime "created_at"
151
+ t.datetime "updated_at"
152
+ end
153
+
133
154
  create_table "contact_opportunities", :force => true do |t|
134
155
  t.integer "contact_id"
135
156
  t.integer "opportunity_id"
136
157
  t.string "role", :limit => 32
137
158
  t.datetime "deleted_at"
138
- t.datetime "created_at", :null => false
139
- t.datetime "updated_at", :null => false
159
+ t.datetime "created_at"
160
+ t.datetime "updated_at"
140
161
  end
141
162
 
142
163
  create_table "contacts", :force => true do |t|
@@ -144,8 +165,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
144
165
  t.integer "lead_id"
145
166
  t.integer "assigned_to"
146
167
  t.integer "reports_to"
147
- t.string "first_name", :limit => 64, :default => "", :null => false
148
- t.string "last_name", :limit => 64, :default => "", :null => false
168
+ t.string "first_name", :default => ""
169
+ t.string "last_name", :default => ""
149
170
  t.string "access", :limit => 8, :default => "Public"
150
171
  t.string "title", :limit => 64
151
172
  t.string "department", :limit => 64
@@ -162,14 +183,14 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
162
183
  t.date "born_on"
163
184
  t.boolean "do_not_call", :default => false, :null => false
164
185
  t.datetime "deleted_at"
165
- t.datetime "created_at", :null => false
166
- t.datetime "updated_at", :null => false
186
+ t.datetime "created_at"
187
+ t.datetime "updated_at"
167
188
  t.string "background_info"
168
189
  t.string "skype", :limit => 128
169
190
  end
170
191
 
171
192
  add_index "contacts", ["assigned_to"], :name => "index_contacts_on_assigned_to"
172
- add_index "contacts", ["user_id", "last_name", "deleted_at"], :name => "id_last_name_deleted", :unique => true
193
+ add_index "contacts", ["user_id", "last_name", "deleted_at"], :name => "index_contacts_on_user_id_and_last_name_and_deleted_at", :unique => true
173
194
 
174
195
  create_table "emails", :force => true do |t|
175
196
  t.string "imap_message_id", :null => false
@@ -186,8 +207,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
186
207
  t.datetime "sent_at"
187
208
  t.datetime "received_at"
188
209
  t.datetime "deleted_at"
189
- t.datetime "created_at", :null => false
190
- t.datetime "updated_at", :null => false
210
+ t.datetime "created_at"
211
+ t.datetime "updated_at"
191
212
  t.string "state", :limit => 16, :default => "Expanded", :null => false
192
213
  end
193
214
 
@@ -198,8 +219,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
198
219
  t.string "label", :limit => 128
199
220
  t.integer "position"
200
221
  t.string "hint"
201
- t.datetime "created_at", :null => false
202
- t.datetime "updated_at", :null => false
222
+ t.datetime "created_at"
223
+ t.datetime "updated_at"
203
224
  t.integer "tag_id"
204
225
  t.string "klass_name", :limit => 32
205
226
  end
@@ -217,8 +238,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
217
238
  t.boolean "disabled"
218
239
  t.boolean "required"
219
240
  t.integer "maxlength"
220
- t.datetime "created_at", :null => false
221
- t.datetime "updated_at", :null => false
241
+ t.datetime "created_at"
242
+ t.datetime "updated_at"
222
243
  end
223
244
 
224
245
  add_index "fields", ["field_group_id"], :name => "index_fields_on_field_group_id"
@@ -247,8 +268,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
247
268
  t.integer "rating", :default => 0, :null => false
248
269
  t.boolean "do_not_call", :default => false, :null => false
249
270
  t.datetime "deleted_at"
250
- t.datetime "created_at", :null => false
251
- t.datetime "updated_at", :null => false
271
+ t.datetime "created_at"
272
+ t.datetime "updated_at"
252
273
  t.string "background_info"
253
274
  t.string "skype", :limit => 128
254
275
  end
@@ -259,8 +280,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
259
280
  create_table "lists", :force => true do |t|
260
281
  t.string "name"
261
282
  t.text "url"
262
- t.datetime "created_at", :null => false
263
- t.datetime "updated_at", :null => false
283
+ t.datetime "created_at"
284
+ t.datetime "updated_at"
264
285
  end
265
286
 
266
287
  create_table "opportunities", :force => true do |t|
@@ -276,20 +297,20 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
276
297
  t.decimal "discount", :precision => 12, :scale => 2
277
298
  t.date "closes_on"
278
299
  t.datetime "deleted_at"
279
- t.datetime "created_at", :null => false
280
- t.datetime "updated_at", :null => false
300
+ t.datetime "created_at"
301
+ t.datetime "updated_at"
281
302
  t.string "background_info"
282
303
  end
283
304
 
284
305
  add_index "opportunities", ["assigned_to"], :name => "index_opportunities_on_assigned_to"
285
- add_index "opportunities", ["user_id", "name", "deleted_at"], :name => "id_name_deleted", :unique => true
306
+ add_index "opportunities", ["user_id", "name", "deleted_at"], :name => "index_opportunities_on_user_id_and_name_and_deleted_at", :unique => true
286
307
 
287
308
  create_table "permissions", :force => true do |t|
288
309
  t.integer "user_id"
289
310
  t.integer "asset_id"
290
311
  t.string "asset_type"
291
- t.datetime "created_at", :null => false
292
- t.datetime "updated_at", :null => false
312
+ t.datetime "created_at"
313
+ t.datetime "updated_at"
293
314
  end
294
315
 
295
316
  add_index "permissions", ["asset_id", "asset_type"], :name => "index_permissions_on_asset_id_and_asset_type"
@@ -299,8 +320,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
299
320
  t.integer "user_id"
300
321
  t.string "name", :limit => 32, :default => "", :null => false
301
322
  t.text "value"
302
- t.datetime "created_at", :null => false
303
- t.datetime "updated_at", :null => false
323
+ t.datetime "created_at"
324
+ t.datetime "updated_at"
304
325
  end
305
326
 
306
327
  add_index "preferences", ["user_id", "name"], :name => "index_preferences_on_user_id_and_name"
@@ -308,8 +329,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
308
329
  create_table "sessions", :force => true do |t|
309
330
  t.string "session_id", :null => false
310
331
  t.text "data"
311
- t.datetime "created_at", :null => false
312
- t.datetime "updated_at", :null => false
332
+ t.datetime "created_at"
333
+ t.datetime "updated_at"
313
334
  end
314
335
 
315
336
  add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
@@ -318,8 +339,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
318
339
  create_table "settings", :force => true do |t|
319
340
  t.string "name", :limit => 32, :default => "", :null => false
320
341
  t.text "value"
321
- t.datetime "created_at", :null => false
322
- t.datetime "updated_at", :null => false
342
+ t.datetime "created_at"
343
+ t.datetime "updated_at"
323
344
  end
324
345
 
325
346
  add_index "settings", ["name"], :name => "index_settings_on_name"
@@ -338,7 +359,10 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
338
359
  add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
339
360
 
340
361
  create_table "tags", :force => true do |t|
341
- t.string "name"
362
+ t.string "name"
363
+ t.datetime "created_at"
364
+ t.datetime "updated_at"
365
+ t.string "taggable_type"
342
366
  end
343
367
 
344
368
  create_table "tasks", :force => true do |t|
@@ -354,8 +378,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
354
378
  t.datetime "due_at"
355
379
  t.datetime "completed_at"
356
380
  t.datetime "deleted_at"
357
- t.datetime "created_at", :null => false
358
- t.datetime "updated_at", :null => false
381
+ t.datetime "created_at"
382
+ t.datetime "updated_at"
359
383
  t.string "background_info"
360
384
  end
361
385
 
@@ -387,8 +411,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
387
411
  t.string "current_login_ip"
388
412
  t.integer "login_count", :default => 0, :null => false
389
413
  t.datetime "deleted_at"
390
- t.datetime "created_at", :null => false
391
- t.datetime "updated_at", :null => false
414
+ t.datetime "created_at"
415
+ t.datetime "updated_at"
392
416
  t.boolean "admin", :default => false, :null => false
393
417
  t.datetime "suspended_at"
394
418
  t.string "single_access_token"
@@ -408,6 +432,8 @@ ActiveRecord::Schema.define(:version => 20120224073107) do
408
432
  t.text "object"
409
433
  t.datetime "created_at"
410
434
  t.text "object_changes"
435
+ t.integer "related_id"
436
+ t.string "related_type"
411
437
  end
412
438
 
413
439
  add_index "versions", ["item_type", "item_id"], :name => "index_versions_on_item_type_and_item_id"