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
@@ -28,6 +28,7 @@
28
28
  *= require chosen
29
29
  *= require ffcrm_chosen
30
30
  *= require fields
31
+ *= require_self
31
32
  */
32
33
 
33
34
  <%
@@ -686,3 +686,29 @@ span.handle img {
686
686
 
687
687
  .remove_fields img {
688
688
  vertical-align: text-bottom; }
689
+
690
+ ul.tools {
691
+ display: inline;
692
+ li {
693
+ border-right: 1px black solid;
694
+ border-bottom: none;
695
+ padding: 0 4px;
696
+ font-size: 10px;
697
+ float: left;
698
+ clear: none; }
699
+ li:last-child {
700
+ border-right: none; } }
701
+
702
+ .highlight {
703
+ background-color: white;
704
+ .tools {
705
+ visibility: hidden; } }
706
+
707
+ .mail.highlight,
708
+ .comment.highlight {
709
+ background-color: #f2f2f2; }
710
+
711
+ .highlight:hover {
712
+ background-color: seashell;
713
+ .tools {
714
+ visibility: visible; } }
@@ -41,7 +41,7 @@ input {
41
41
  height: 17px;
42
42
  font-size: 13px; }
43
43
 
44
- input[type=submit] {
44
+ input[type=submit], input[type=file] {
45
45
  height: auto; }
46
46
 
47
47
  select {
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class Admin::ApplicationController < BaseController
18
+ class Admin::ApplicationController < EntitiesController
19
19
  layout "admin/application"
20
20
  before_filter :require_admin_user
21
21
 
@@ -129,14 +129,6 @@ private
129
129
  request.referer =~ %r(/#{controller}/\w+)
130
130
  end
131
131
 
132
- #----------------------------------------------------------------------------
133
- def update_recently_viewed
134
- subject = instance_variable_get("@#{controller_name.singularize}")
135
- if subject
136
- Activity.log(current_user, subject, :viewed)
137
- end
138
- end
139
-
140
132
  #----------------------------------------------------------------------------
141
133
  def respond_to_not_found(*types)
142
134
  asset = self.controller_name.singularize
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class AccountsController < BaseController
18
+ class AccountsController < EntitiesController
19
19
  before_filter :get_data_for_sidebar, :only => :index
20
20
 
21
21
  # GET /accounts
@@ -150,18 +150,6 @@ class AccountsController < BaseController
150
150
  render :index
151
151
  end
152
152
 
153
- # GET /accounts/contacts AJAX
154
- #----------------------------------------------------------------------------
155
- def contacts
156
- @account = Account.my.find(params[:id])
157
- end
158
-
159
- # GET /accounts/opportunities AJAX
160
- #----------------------------------------------------------------------------
161
- def opportunities
162
- @account = Account.my.find(params[:id])
163
- end
164
-
165
153
  # POST /accounts/filter AJAX
166
154
  #----------------------------------------------------------------------------
167
155
  def filter
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class CampaignsController < BaseController
18
+ class CampaignsController < EntitiesController
19
19
  before_filter :get_data_for_sidebar, :only => :index
20
20
 
21
21
  # GET /campaigns
@@ -140,18 +140,6 @@ class CampaignsController < BaseController
140
140
  end
141
141
  end
142
142
 
143
- # GET /accounts/leads AJAX
144
- #----------------------------------------------------------------------------
145
- def leads
146
- @campaign = Campaign.my.find(params[:id])
147
- end
148
-
149
- # GET /accounts/opportunities AJAX
150
- #----------------------------------------------------------------------------
151
- def opportunities
152
- @campaign = Campaign.my.find(params[:id])
153
- end
154
-
155
143
  # POST /campaigns/redraw AJAX
156
144
  #----------------------------------------------------------------------------
157
145
  def redraw
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class ContactsController < BaseController
18
+ class ContactsController < EntitiesController
19
19
  before_filter :get_users, :only => [ :new, :create, :edit, :update ]
20
20
  before_filter :get_accounts, :only => [ :new, :create, :edit, :update ]
21
21
 
@@ -154,12 +154,6 @@ class ContactsController < BaseController
154
154
  end
155
155
  end
156
156
 
157
- # GET /contacts/opportunities AJAX
158
- #----------------------------------------------------------------------------
159
- def opportunities
160
- @contact = Contact.my.find(params[:id])
161
- end
162
-
163
157
  # POST /contacts/redraw AJAX
164
158
  #----------------------------------------------------------------------------
165
159
  def redraw
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class LeadsController < BaseController
18
+ class LeadsController < EntitiesController
19
19
  before_filter :get_data_for_sidebar, :only => :index
20
20
 
21
21
  # GET /leads
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class OpportunitiesController < BaseController
18
+ class OpportunitiesController < EntitiesController
19
19
  before_filter :load_settings
20
20
  before_filter :get_data_for_sidebar, :only => :index
21
21
  before_filter :set_params, :only => [:index, :redraw, :filter]
@@ -181,12 +181,6 @@ class OpportunitiesController < BaseController
181
181
  end
182
182
  end
183
183
 
184
- # GET /opportunities/contacts AJAX
185
- #----------------------------------------------------------------------------
186
- def contacts
187
- @opportunity = Opportunity.my.find(params[:id])
188
- end
189
-
190
184
  # POST /opportunities/redraw AJAX
191
185
  #----------------------------------------------------------------------------
192
186
  def redraw
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class TasksController < BaseController
18
+ class TasksController < EntitiesController
19
19
  before_filter :auto_complete, :only => :auto_complete
20
20
  before_filter :update_sidebar, :only => :index
21
21
  skip_after_filter :update_recently_viewed
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  #------------------------------------------------------------------------------
17
17
 
18
- class BaseController < ApplicationController
18
+ class EntitiesController < ApplicationController
19
19
  before_filter :require_user
20
20
  before_filter :set_current_tab, :only => [ :index, :show ]
21
21
  after_filter :update_recently_viewed, :only => :show
@@ -82,6 +82,30 @@ class BaseController < ApplicationController
82
82
  respond_to_not_found(:html, :js, :json, :xml)
83
83
  end
84
84
 
85
+ # GET /entities/contacts AJAX
86
+ #----------------------------------------------------------------------------
87
+ def contacts
88
+ @entity = klass.my.find(params[:id])
89
+ end
90
+
91
+ # GET /entities/leads AJAX
92
+ #----------------------------------------------------------------------------
93
+ def leads
94
+ @entity = klass.my.find(params[:id])
95
+ end
96
+
97
+ # GET /entities/opportunities AJAX
98
+ #----------------------------------------------------------------------------
99
+ def opportunities
100
+ @entity = klass.my.find(params[:id])
101
+ end
102
+
103
+ # GET /entities/versions AJAX
104
+ #----------------------------------------------------------------------------
105
+ def versions
106
+ @entity = klass.my.find(params[:id])
107
+ end
108
+
85
109
  def timeline(asset)
86
110
  (asset.comments + asset.emails).sort { |x, y| y.created_at <=> x.created_at }
87
111
  end
@@ -152,4 +176,11 @@ class BaseController < ApplicationController
152
176
  scope = scope.paginate(pages) if wants.html? || wants.js? || wants.xml?
153
177
  scope
154
178
  end
179
+
180
+ #----------------------------------------------------------------------------
181
+ def update_recently_viewed
182
+ if item = instance_variable_get("@#{controller_name.singularize}")
183
+ item.send(item.class.versions_association_name).create(:event => :view, :whodunnit => PaperTrail.whodunnit)
184
+ end
185
+ end
155
186
  end
@@ -43,7 +43,7 @@ class HomeController < ApplicationController
43
43
  def options
44
44
  unless params[:cancel].true?
45
45
  @asset = @current_user.pref[:activity_asset] || "all"
46
- @action = @current_user.pref[:activity_action_type] || "all_actions"
46
+ @action = @current_user.pref[:activity_event] || "all_events"
47
47
  @user = @current_user.pref[:activity_user] || "all_users"
48
48
  @duration = @current_user.pref[:activity_duration] || "two_days"
49
49
  @all_users = User.order("first_name, last_name")
@@ -54,7 +54,7 @@ class HomeController < ApplicationController
54
54
  #----------------------------------------------------------------------------
55
55
  def redraw
56
56
  @current_user.pref[:activity_asset] = params[:asset] if params[:asset]
57
- @current_user.pref[:activity_action_type] = params[:action_type] if params[:action_type]
57
+ @current_user.pref[:activity_event] = params[:event] if params[:event]
58
58
  @current_user.pref[:activity_user] = params[:user] if params[:user]
59
59
  @current_user.pref[:activity_duration] = params[:duration] if params[:duration]
60
60
 
@@ -107,11 +107,11 @@ class HomeController < ApplicationController
107
107
  #----------------------------------------------------------------------------
108
108
  def get_activities(options = {})
109
109
  options[:asset] ||= activity_asset
110
- options[:action] ||= activity_action_type
110
+ options[:event] ||= activity_event
111
111
  options[:user] ||= activity_user
112
112
  options[:duration] ||= activity_duration
113
113
 
114
- Activity.latest(options).without_actions(:viewed).visible_to(@current_user)
114
+ Version.latest(options).visible_to(@current_user)
115
115
  end
116
116
 
117
117
  #----------------------------------------------------------------------------
@@ -125,12 +125,12 @@ class HomeController < ApplicationController
125
125
  end
126
126
 
127
127
  #----------------------------------------------------------------------------
128
- def activity_action_type
129
- action_type = @current_user.pref[:activity_action_type]
130
- if action_type.nil? || action_type == "all_actions"
131
- nil
128
+ def activity_event
129
+ event = @current_user.pref[:activity_event]
130
+ if event == "all_events"
131
+ %w(create update destroy)
132
132
  else
133
- action_type
133
+ event
134
134
  end
135
135
  end
136
136
 
@@ -1,3 +1,20 @@
1
+ # Fat Free CRM
2
+ # Copyright (C) 2008-2011 by Michael Dvorkin
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ #------------------------------------------------------------------------------
17
+
1
18
  class ListsController < ApplicationController
2
19
  respond_to :js
3
20
 
@@ -19,4 +19,4 @@ module Admin::TagsHelper
19
19
  def link_to_confirm(tag)
20
20
  link_to(t(:delete) + "?", confirm_admin_tag_path(tag), :method => :get, :remote => true)
21
21
  end
22
- end
22
+ end
@@ -208,16 +208,6 @@ module ApplicationHelper
208
208
  you_ask ? invisible : visible
209
209
  end
210
210
 
211
- #----------------------------------------------------------------------------
212
- def highlightable(id = nil, color = {})
213
- color = { :on => "seashell", :off => "white" }.merge(color)
214
- show = (id ? "$('#{id}').style.visibility='visible'" : "")
215
- hide = (id ? "$('#{id}').style.visibility='hidden'" : "")
216
- { :onmouseover => "this.style.background='#{color[:on]}'; #{show}",
217
- :onmouseout => "this.style.background='#{color[:off]}'; #{hide}"
218
- }
219
- end
220
-
221
211
  #----------------------------------------------------------------------------
222
212
  def confirm_delete(model, params = {})
223
213
  question = %(<span class="warn">#{t(:confirm_delete, model.class.to_s.downcase)}</span>).html_safe
@@ -313,11 +303,21 @@ module ApplicationHelper
313
303
  # gravatar. For leads and contacts we always use gravatars.
314
304
  #----------------------------------------------------------------------------
315
305
  def avatar_for(model, args = {})
316
- args = { :class => 'gravatar', :size => '75x75' }.merge(args)
306
+ args = { :class => 'gravatar', :size => :large }.merge(args)
317
307
  if model.avatar
318
- image_tag(model.avatar.image.url(Avatar.styles[args[:size]]), args)
308
+ Avatar
309
+ image_tag(model.avatar.image.url(args[:size]), args)
319
310
  elsif model.email
320
- gravatar_image_tag(model.email, { :gravatar => { :default => default_avatar_url } }.merge(args))
311
+ # Gravatar requires '75x75' format, so convert symbols keys (e.g. :large)
312
+ if style_size = Avatar::STYLES[args[:size]]
313
+ args[:size] = style_size.sub(/\#$/,'')
314
+ end
315
+ # If we are passing an explicit w*h override (for uploaded avatars),
316
+ # then use that as the size.
317
+ if args[:width] && args[:height]
318
+ args[:size] = [:width, :height].map{|d|args[d]}.join("x")
319
+ end
320
+ gravatar_for(model, args)
321
321
  else
322
322
  image_tag("avatar.jpg", args)
323
323
  end
@@ -332,7 +332,7 @@ module ApplicationHelper
332
332
 
333
333
  #----------------------------------------------------------------------------
334
334
  def default_avatar_url
335
- "#{request.protocol + request.host_with_port}" + Setting.base_url.to_s + "/assets/avatar.jpg"
335
+ request.protocol + request.host_with_port + image_path('avatar.jpg')
336
336
  end
337
337
 
338
338
  # Returns default permissions intro.
@@ -42,7 +42,7 @@ module CrmTagsHelper
42
42
 
43
43
  # Return asset tags to be built manually if the asset failed validation.
44
44
  def unsaved_param_tags(asset)
45
- params[asset][:tag_list].split(",").map {|x|
45
+ params[asset][:tag_list].join.split(",").map {|x|
46
46
  Tag.find_by_name(x.strip)
47
47
  }.compact.uniq
48
48
  end
@@ -17,21 +17,21 @@
17
17
 
18
18
  module HomeHelper
19
19
  def sort_by_assets
20
- Activity::ASSETS.map do |asset|
21
- %Q[{ name: "#{t(asset).singularize}", on_select: function() { #{redraw(:asset, [ asset, t(asset).singularize.downcase ], url_for(:action => :redraw))} } }]
20
+ Version::ASSETS.map do |asset|
21
+ %Q[{ name: "#{t(asset.singularize)}", on_select: function() { #{redraw(:asset, [ asset, t(asset.singularize).downcase ], url_for(:action => :redraw))} } }]
22
22
  end
23
23
  end
24
24
 
25
25
  #----------------------------------------------------------------------------
26
- def sort_by_actions
27
- Activity::ACTIONS.map do |action|
28
- %Q[{ name: "#{t(action + '_past_participle')}", on_select: function() { #{redraw(:action_type, [ action, t(action + '_past_participle').downcase ], url_for(:action => :redraw))} } }]
26
+ def sort_by_events
27
+ Version::EVENTS.map do |event|
28
+ %Q[{ name: "#{t(event + '_past_participle')}", on_select: function() { #{redraw(:event, [ event, t(event + '_past_participle').downcase ], url_for(:action => :redraw))} } }]
29
29
  end
30
30
  end
31
31
 
32
32
  #----------------------------------------------------------------------------
33
33
  def sort_by_duration
34
- Activity::DURATION.map do |duration|
34
+ Version::DURATION.map do |duration|
35
35
  %Q[{ name: "#{t(duration)}", on_select: function() { #{redraw(:duration, [ duration, t(duration).downcase ], url_for(:action => :redraw))} } }]
36
36
  end
37
37
  end
@@ -52,16 +52,14 @@ module HomeHelper
52
52
  #----------------------------------------------------------------------------
53
53
  def activity_title(activity)
54
54
  user = activity.user.full_name
55
- action = t('action_' + activity.action)
56
- type = t('subject_' + activity.subject_type.downcase)
57
- subject = if activity.subject
58
- if activity.subject.respond_to?(:full_name)
59
- activity.subject.full_name
60
- else
61
- activity.subject.name
55
+ action = t('action_' + activity.event)
56
+ type = t('subject_' + activity.item_type.downcase)
57
+ subject = if item = activity.item
58
+ if item.respond_to?(:full_name)
59
+ item.full_name
60
+ elsif item.respond_to?(:name)
61
+ item.name
62
62
  end
63
- else
64
- activity.info # Use info if the subject has been deleted.
65
63
  end
66
64
  t(:activity_text, :user => user, :action => action, :type => type, :subject => subject,
67
65
  :default => "#{user} #{action} #{type} #{subject}")
@@ -1,2 +1,19 @@
1
+ # Fat Free CRM
2
+ # Copyright (C) 2008-2011 by Michael Dvorkin
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ #------------------------------------------------------------------------------
17
+
1
18
  module ListsHelper
2
19
  end