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
@@ -0,0 +1,3 @@
1
+ contacts = @entity.contacts.paginate(:page => params[:page], :per_page => 20)
2
+ page['contacts'].replace_html :partial => 'contacts/contact', :collection => contacts
3
+ page['contacts_pagination'].replace_html will_paginate(contacts, :container => false, :params => {:action => :contacts})
@@ -0,0 +1,3 @@
1
+ leads = @entity.leads.paginate(:page => params[:page], :per_page => 20)
2
+ page['leads'].replace_html :partial => 'leads/lead', :collection => leads
3
+ page['leads_pagination'].replace_html will_paginate(leads, :container => false, :params => {:action => :leads})
@@ -0,0 +1,3 @@
1
+ opportunities = @entity.opportunities.paginate(:page => params[:page], :per_page => 20)
2
+ page['opportunities'].replace_html :partial => 'opportunities/opportunity', :collection => @opportunities
3
+ page['opportunities_pagination'].replace_html will_paginate(opportunities, :container => false, :params => {:action => :opportunities})
@@ -0,0 +1,3 @@
1
+ versions = Version.history(@entity).paginate(:page => params[:page], :per_page => 10)
2
+ page['versions'].replace_html :partial => 'versions/version', :collection => versions
3
+ page['versions_pagination'].replace_html will_paginate(versions, :container => false, :params => {:action => :versions})
@@ -1,22 +1,23 @@
1
- %li[activity]
2
- .tools
3
- %small= l(activity.created_at, :format => :short)
4
- %tt
5
- = link_to avatar_for(activity.user, :size => "16x16"), user_path(activity.user)
1
+ - user = link_to(h(activity.user.full_name), user_path(activity.user)) if activity.user
6
2
 
7
- - user = link_to(h(activity.user.full_name), user_path(activity.user))
8
- - action = t('action_' + activity.action)
9
- - type = t('subject_' + activity.subject_type.downcase)
10
- - subject = if activity.subject
11
- - if activity.subject.respond_to?(:full_name)
12
- - link_to(h(activity.subject.full_name), polymorphic_url(activity.subject))
13
- - elsif activity.subject_type != "Task"
14
- - link_to(h(activity.subject.name), polymorphic_url(activity.subject))
15
- - else
16
- - %Q{<span style="color:black;">#{h(activity.subject.name)}</span>} # Individual tasks have no landing pages where we could link to.
17
- - else
18
- - activity.info # Use info if the subject has been deleted.
3
+ - subject = if (item = activity.related || activity.item)
4
+ - if item.respond_to?(:full_name)
5
+ - link_to item.full_name, polymorphic_url(item)
19
6
 
20
- = t("activity_text", :user => user, :action => action, :type => type, :subject => subject, :default => "#{user} #{action} #{type} #{subject}").html_safe # locales optionally can change the word order for activities using 'activity_text'
7
+ - elsif [Account, Campaign, Contact, Lead, Opportunity].include?(item.class)
8
+ - link_to item.name, polymorphic_url(item)
21
9
 
10
+ - elsif item.respond_to?(:name)
11
+ - content_tag :span, item.name, :style => "color:black;" # Individual tasks have no landing pages where we could link to.
22
12
 
13
+ - if user.present? and subject.present?
14
+ %li[activity]
15
+ .tools
16
+ %small
17
+ = l(activity.created_at, :format => :short)
18
+ %tt
19
+ = link_to avatar_for(activity.user, :size => :thumb), user_path(activity.user)
20
+
21
+ - action = t('action_' + activity.event)
22
+ - type = t('subject_' + activity.item_type.downcase)
23
+ = t("activity_text", :user => user, :action => action, :type => type, :subject => subject, :default => "#{user} #{action} #{type} #{subject}").html_safe # locales optionally can change the word order for activities using 'activity_text'
@@ -0,0 +1,8 @@
1
+ :plain
2
+ new crm.Menu({
3
+ trigger : "event",
4
+ fade : 0.5,
5
+ appear : 0.5,
6
+ menu_items: [ #{sort_by_events.join(",")} ]
7
+ });
8
+
@@ -3,12 +3,11 @@
3
3
  = hidden_field_tag "account[user_id]", @current_user.id
4
4
 
5
5
  -# activity_options: Show %{models} %{action_type} performed by %{user} in the past %{period}
6
- = t(:activity_options, :models => link_to(t(@asset).singularize.downcase, "#", :id => :asset), :action_type => link_to(t(@action + "_past_participle").downcase, "#", :id => :action_type), :user => link_to(t(@user), "#", :id => :user), :period => link_to(t(@duration).downcase, "#", :id => :duration)).html_safe
6
+ = t(:activity_options, :models => link_to(t(@asset).singularize.downcase, "#", :id => :asset), :action_type => link_to(t(@action + "_past_participle").downcase, "#", :id => :event), :user => link_to(t(@user), "#", :id => :user), :period => link_to(t(@duration).downcase, "#", :id => :duration)).html_safe
7
7
  %p
8
8
 
9
9
  %script
10
10
  = render "assets_menu"
11
- = render "actions_menu"
11
+ = render "events_menu"
12
12
  = render "users_menu"
13
13
  = render "duration_menu"
14
-
@@ -3,7 +3,7 @@
3
3
 
4
4
  .title
5
5
  %span#title #{t :recent_activity}
6
- = image_tag("loading.gif", :size => "16x16", :id => "loading", :style => "display: none;")
6
+ = image_tag("loading.gif", :size => :thumb, :id => "loading", :style => "display: none;")
7
7
  .remote#options{ hidden }
8
8
 
9
9
  .list#activities
@@ -1,40 +1,59 @@
1
- %li[lead]{ highlightable(dom_id(lead, :tools)) }
1
+ %li.highlight[lead]
2
2
  - if lead.status
3
- .strip{:class => lead.status} #{t(lead.status)}
3
+ .strip{:class => lead.status}= t lead.status
4
4
  - else
5
- .strip{:style => "color: gray;"} #{t :other}
6
-
7
- .tools{ invisible, :id => dom_id(lead, :tools) }
8
- = link_to_edit(lead) + " | "
9
- - unless %w(converted rejected).include?(lead.status)
10
- = link_to_convert(lead) + " | "
11
- - else
12
- = "<font color='silver'>#{t :convert}</font> | ".html_safe
13
- - if lead.status != "rejected"
14
- = link_to_reject(lead) + " | "
15
- - else
16
- = "<font color='silver'>#{t :reject}</font> | ".html_safe
17
- = link_to_discard(lead) + " | " if shown_on_landing_page?
18
- = link_to_delete(lead)
5
+ .strip{:style => "color: gray;"}= t :other
6
+
7
+ %ul.tools
8
+ - if can?(:update, lead)
9
+ %li= link_to_edit(lead)
10
+
11
+ - if %w(converted rejected).include?(lead.status)
12
+ %li
13
+ %font{ :color => 'silver' }= t :convert
14
+ - elsif can?(:update, lead)
15
+ %li= link_to_convert(lead)
16
+
17
+ - if lead.status == "rejected"
18
+ %li
19
+ %font{ :color => 'silver' }= t :reject
20
+ - elsif can?(:update, lead)
21
+ %li= link_to_reject(lead)
22
+
23
+ - if shown_on_landing_page?
24
+ %li= link_to_discard(lead)
25
+
26
+ - if can?(:destroy, lead)
27
+ %li= link_to_delete(lead)
19
28
 
20
29
  .indent
21
- = link_to(h(lead.full_name(@current_user.preference[:leads_naming])), lead)
30
+ = link_to_if can?(:read, lead), lead.full_name(@current_user.preference[:leads_naming]), lead
22
31
  %tt
23
32
  - if lead.company? && lead.title?
24
33
  = t(:works_at, :job_title => lead.title, :company => lead.company)
25
34
  - else
26
35
  = lead.company if lead.company?
27
36
  = lead.title if lead.title?
28
- -#= link_to(h(lead.campaign.name), lead.campaign) if lead.campaign_id
29
37
  - if lead.referred_by?
30
38
  &ndash;
31
- = "#{t :referred_by_small} #{lead.referred_by}"
39
+ == #{t :referred_by_small} #{lead.referred_by}
40
+
32
41
  - unless @current_user.preference[:leads_outline] == "brief"
33
42
  %dt
34
- = stars_for(lead) + " | "
35
- = link_to_email(lead.email) << " | " if lead.email.present?
36
- = "#{t :phone_small}: " + lead.phone << " | " if lead.phone.present?
37
- = "#{t :mobile_small}: " + lead.mobile << " | " if lead.mobile.present?
43
+ = stars_for(lead)
44
+ |
45
+ - if can?(:read, lead)
46
+ - if lead.email.present?
47
+ = link_to_email(lead.email)
48
+ |
49
+ - if lead.phone.present?
50
+ == #{t :phone_small}:
51
+ %b= lead.phone
52
+ |
53
+ - if lead.mobile.present?
54
+ == #{t :mobile_small}:
55
+ %b= lead.mobile
56
+ |
38
57
  = t(:added_ago, time_ago_in_words(lead.created_at))
39
58
  - if lead.tag_list.present?
40
59
  %dt
@@ -0,0 +1,6 @@
1
+ = section(object, :leads)
2
+ .list#leads
3
+ - leads = object.leads.paginate(:page => 1, :per_page => 20)
4
+ = render :partial => "leads/lead", :collection => object.leads.paginate(:page => 1, :per_page => 20)
5
+
6
+ = will_paginate leads, :id => 'leads_pagination', :params => {:action => :leads}
@@ -50,7 +50,7 @@
50
50
  = auto_link(simple_format @lead.background_info).html_safe
51
51
 
52
52
  = render "fields/sidebar_show", :asset => @lead
53
-
53
+
54
54
  - if @lead.tag_list.present?
55
55
  %dt
56
56
  .tags= tags_for_index(@lead)
@@ -8,7 +8,7 @@
8
8
 
9
9
  .title
10
10
  %span#create_lead_title #{t :leads}
11
- = image_tag("loading.gif", :size => "16x16", :id => "loading", :style => "display: none;")
11
+ = image_tag("loading.gif", :size => :thumb, :id => "loading", :style => "display: none;")
12
12
  .remote#options{ hidden }
13
13
  .remote#advanced_search{ hidden_if(!params[:q]) }
14
14
  - if @search
@@ -18,18 +18,8 @@
18
18
 
19
19
  = hook(:show_lead_bottom, self) do
20
20
 
21
- = section(@lead, :tasks)
22
- .log#tasks
23
- = render "shared/tasks"
21
+ = render :partial => "tasks/tasks", :locals => {:object => @lead}
24
22
 
25
- = load_select_popups_for(@lead, :tasks)
26
-
27
- %br( style="clear:both" )
23
+ = render :partial => "versions/versions", :locals => {:object => @lead}
28
24
 
29
- - if Setting.paper_trail_ui_enabled
30
- %br
31
- = content_tag(:div, t(:versions), :class => :subtitle)
32
- .list#versions
33
- - @versions = @lead.versions.except(:order).order('created_at DESC').paginate(:page => 1, :per_page => 20)
34
- = render :partial => "versions/version", :collection => @versions
35
- = will_paginate @versions, :id => true, :params => {:action => :versions}
25
+ = load_select_popups_for(@lead, :tasks)
@@ -0,0 +1,6 @@
1
+ = section(object, :opportunities)
2
+ .list#opportunities
3
+ - opportunities = object.opportunities.paginate(:page => 1, :per_page => 20)
4
+ = render :partial => "opportunities/opportunity", :collection => opportunities
5
+
6
+ = will_paginate opportunities, :id => 'opportunities_pagination', :params => {:action => :opportunities}
@@ -1,29 +1,40 @@
1
- %li[opportunity]{ highlightable(dom_id(opportunity, :tools)) }
1
+ %li.highlight[opportunity]
2
2
  - if opportunity.stage
3
3
  .strip{:class => opportunity.stage}= t(opportunity.stage)
4
4
  - else
5
5
  .strip.white #{t :other}
6
6
 
7
- .tools{ invisible, :id => dom_id(opportunity, :tools) }
8
- = link_to_edit(opportunity) + " | "
9
- = link_to_discard(opportunity) + " | " if shown_on_landing_page?
10
- = link_to_delete(opportunity)
7
+ %ul.tools
8
+ - if can?(:update, opportunity)
9
+ %li= link_to_edit(opportunity)
10
+
11
+ - if shown_on_landing_page?
12
+ %li= link_to_discard(opportunity)
13
+
14
+ - if can?(:destroy, opportunity)
15
+ %li= link_to_delete(opportunity)
11
16
 
12
17
  .indent
13
- = link_to(h(opportunity.name), opportunity)
14
- - if opportunity.account && opportunity.account.id
15
- == #{t :from} #{link_to(h(opportunity.account.name), account_path(opportunity.account))}
18
+ = link_to_if can?(:read, opportunity), opportunity.name, opportunity
19
+ - if (account = opportunity.account) && account.id
20
+ == #{t :from} #{link_to_if can?(:read, account), account.name, account_path(account)}
16
21
  %tt
17
22
  &ndash;
18
- = t(:added_by, :time_ago => time_ago_in_words(opportunity.created_at), :user => (opportunity.user.id == @current_user.id ? t(:me) : h(opportunity.user.full_name)))
23
+ - user_name = opportunity.user_id == @current_user.id ? t(:me) : opportunity.user.full_name
24
+ = t(:added_by, :time_ago => time_ago_in_words(opportunity.created_at), :user => user_name)
25
+
19
26
  - unless @current_user.preference[:opportunities_outline] == "brief"
20
27
  %dt
21
28
  %b= number_to_currency(opportunity.weighted_amount, :precision => 0) + " | "
22
29
  - won_or_lost = %w(won lost).include?(opportunity.stage)
23
30
  - unless won_or_lost
24
- == #{number_to_currency(opportunity.amount || 0, :precision => 0)}
25
- == #{opportunity.discount ? t(:discount_number, number_to_currency(opportunity.discount, :precision => 0)) : t(:no_discount)}
31
+ = number_to_currency(opportunity.amount || 0, :precision => 0)
32
+ - if opportunity.discount
33
+ = t(:discount_number, number_to_currency(opportunity.discount, :precision => 0))
34
+ - else
35
+ = t(:no_discount)
26
36
  = t(:probability_number, (opportunity.probability || 0).to_s + '%') + " | "
37
+
27
38
  - if opportunity.closes_on
28
39
  - if won_or_lost
29
40
  - if opportunity.closes_on >= Date.today
@@ -38,6 +49,7 @@
38
49
  %span.warn= t(:past_due, distance_of_time_in_words(opportunity.closes_on, Date.today))
39
50
  - else
40
51
  = t(:no_closing_date)
52
+
41
53
  - if opportunity.tag_list.present?
42
54
  %dt
43
55
  .tags= tags_for_index(opportunity)
@@ -8,7 +8,7 @@
8
8
 
9
9
  .title
10
10
  %span#create_opportunity_title #{t :opportunities}
11
- = image_tag("loading.gif", :size => "16x16", :id => "loading", :style => "display: none;")
11
+ = image_tag("loading.gif", :size => :thumb, :id => "loading", :style => "display: none;")
12
12
  .remote#options{ hidden }
13
13
  .remote#advanced_search{ hidden_if(!params[:q]) }
14
14
  - if @search
@@ -13,24 +13,10 @@
13
13
 
14
14
  = hook(:show_opportunity_bottom, self) do
15
15
 
16
- = section(@opportunity, :tasks)
17
- .log#tasks
18
- = render "shared/tasks"
16
+ = render :partial => "tasks/tasks", :locals => {:object => @opportunity}
19
17
 
20
- = section(@opportunity, :contacts)
21
- .list#contacts
22
- - @contacts = @opportunity.contacts.paginate(:page => 1, :per_page => 20)
23
- = render :partial => "contacts/contact", :collection => @opportunity.contacts.paginate(:page => 1, :per_page => 20)
24
- = will_paginate @contacts, :id => true, :params => {:action => :contacts}
18
+ = render :partial => "contacts/contacts", :locals => {:object => @opportunity}
25
19
 
26
- = load_select_popups_for(@opportunity, :tasks, :contacts)
27
-
28
- %br( style="clear:both" )
20
+ = render :partial => "versions/versions", :locals => {:object => @opportunity}
29
21
 
30
- - if Setting.paper_trail_ui_enabled
31
- %br
32
- = content_tag(:div, t(:versions), :class => :subtitle)
33
- .list#versions
34
- - @versions = @opportunity.versions.except(:order).order('created_at DESC').paginate(:page => 1, :per_page => 20)
35
- = render :partial => "versions/version", :collection => @versions
36
- = will_paginate @versions, :id => true, :params => {:action => :versions}
22
+ = load_select_popups_for(@opportunity, :tasks, :contacts)
@@ -1,7 +1,7 @@
1
- %li[comment]{ highlightable(dom_id(comment, :tools)) }
2
- = link_to avatar_for(comment.user, :size => "25x25"), user_path(comment.user)
1
+ %li.highlight[comment]
2
+ = link_to avatar_for(comment.user, :size => :small), user_path(comment.user)
3
3
 
4
- .tools{ invisible, :id => dom_id(comment, :tools) }
4
+ .tools
5
5
  = link_to_edit(comment) + " | "
6
6
  = link_to_delete(comment)
7
7
 
@@ -1,6 +1,6 @@
1
1
  - class_name = commentable.class.name.downcase
2
2
  .comment#comment_edit{:style => "margin: 5px 0px 0px 0px"}
3
- = link_to avatar_for(@current_user, :size => "25x25"), user_path(@current_user)
3
+ = link_to avatar_for(@current_user, :size => :small), user_path(@current_user)
4
4
  #post
5
5
  = form_for(@comment, :remote => true) do |f|
6
6
  = hidden_field_tag "comment[user_id]", @current_user.id
@@ -1,4 +1,4 @@
1
- - title = (recent.subject.respond_to?(:full_name) ? h(recent.subject.full_name) : h(recent.subject.name))
2
- %li{ :class => recent != @recent.last ? "" : "last" }
3
- %dt= link_to(truncate(title, :length => 19), polymorphic_url(recent.subject), :title => title)
4
- %tt= t(recent.subject_type.downcase) + ":"
1
+ - title = (recent.item.respond_to?(:full_name) ? recent.item.full_name : recent.item.name)
2
+ %li{ :class => recent != @versions.last ? "" : "last" }
3
+ %dt= link_to(truncate(title, :length => 19), polymorphic_url(recent.item), :title => title)
4
+ %tt= t(recent.item_type.downcase) + ":"
@@ -1,7 +1,7 @@
1
- - @recent = Activity.for(@current_user).recent
1
+ - @versions = Version.recent_for_user(@current_user)
2
2
  .panel#recently
3
3
  .caption #{t :recent_items}
4
- - unless @recent.empty?
5
- = render :partial => "shared/recent", :collection => @recent
4
+ - if @versions.present?
5
+ = render :partial => "shared/recent", :collection => @versions
6
6
  - else
7
7
  %div #{t :no_recent_items}
@@ -1,3 +1,2 @@
1
- - type = timeline.class.to_s.downcase
2
- - template = "#{type.pluralize}/#{type}"
3
- = render template, :"#{type}" => timeline
1
+ - type = timeline.class.name.downcase
2
+ = render "#{type.pluralize}/#{type}", type.to_sym => timeline
@@ -1,10 +1,10 @@
1
- %li[assigned]{ highlightable(dom_id(assigned, :tools)) }
1
+ %li.highlight[assigned]
2
2
  - unless assigned.category.blank?
3
3
  .strip{:class => assigned.category}= t(assigned.category)
4
4
  - else
5
5
  .strip.white #{t :other}
6
6
 
7
- .tools{ invisible, :id => dom_id(assigned, :tools) }
7
+ .tools
8
8
  = link_to_task_edit(assigned, bucket) + " | "
9
9
  = link_to_discard(assigned) + " | " if shown_on_landing_page?
10
10
  = link_to_task_delete(assigned, bucket)
@@ -26,7 +26,7 @@
26
26
  - if assigned.at_specific_time?
27
27
  - if assigned.due_at < Time.now
28
28
  %span.warn= distance_of_time_in_words(assigned.due_at, Time.now)
29
- = t(:task_overdue)
29
+ = t(:task_overdue)
30
30
  = l(assigned.due_at.localtime, :format => :mmddhhss)
31
31
  - else
32
32
  = t(:task_due_in, distance_of_time_in_words(Time.now, assigned.due_at))
@@ -34,7 +34,7 @@
34
34
 
35
35
  - else
36
36
  - if assigned.due_at < Date.today
37
- %span.warn= distance_of_time_in_words(assigned.due_at, Time.now)
37
+ %span.warn= distance_of_time_in_words(assigned.due_at, Time.now)
38
38
  = t(:task_overdue)
39
39
  = l(assigned.due_at.localtime.to_date, :format => :mmdd)
40
40
  - elsif assigned.due_at > Date.today
@@ -1,10 +1,10 @@
1
- %li[completed]{ highlightable(dom_id(completed, :tools)) }
1
+ %li.highlight[completed]
2
2
  - unless completed.category.blank?
3
3
  .strip{:class => completed.category}= t(completed.category)
4
4
  - else
5
5
  .strip.white #{t :other}
6
6
 
7
- .tools{ invisible, :id => dom_id(completed, :tools) }
7
+ .tools
8
8
  - if shown_on_landing_page?
9
9
  = link_to_discard(completed) + (@current_user == completed.user ? ' | ' : '')
10
10
  = link_to_task_delete(completed, bucket) if @current_user == completed.user
@@ -1,10 +1,10 @@
1
- %li[pending]{ highlightable(dom_id(pending, :tools)) }
1
+ %li.highlight[pending]
2
2
  - unless pending.category.blank?
3
3
  .strip{:class => pending.category}= t(pending.category)
4
4
  - else
5
5
  .strip.white #{t :other}
6
6
 
7
- .tools{ invisible, :id => dom_id(pending, :tools) }
7
+ .tools
8
8
  = link_to_task_edit(pending, bucket) + " | "
9
9
  = link_to_discard(pending) + " | " if shown_on_landing_page?
10
10
  = link_to_task_delete(pending, bucket)
@@ -1,10 +1,9 @@
1
- %li[related]{ highlightable(dom_id(related, :tools)) }
1
+ %li.highlight[related]
2
2
  - unless related.category.blank?
3
3
  .strip{:class => related.category}= t(related.category)
4
4
  - else
5
5
  .strip{:style => "color:white"} #{t :other}
6
6
  %div
7
- .tools{ invisible, :id => dom_id(related, :tools) }
8
7
  - if related.assigned_to
9
8
  = link_to(related.assignee.full_name, user_path(related.assignee))
10
9
  - else
@@ -18,16 +17,16 @@
18
17
  %span.cool
19
18
  = t(:task_completed_ago, distance_of_time_in_words(related.completed_at, Time.now))
20
19
  - elsif related.bucket == "due_asap"
21
- %span.urgent
20
+ %span.urgent
22
21
  == #{t :due_now}.
23
22
  - elsif related.bucket == "due_later"
24
23
  == #{t :due_later}.
25
24
  - elsif related.due_at < Date.today
26
- %span.warn= distance_of_time_in_words(related.due_at, Date.today)
25
+ %span.warn= distance_of_time_in_words(related.due_at, Date.today)
27
26
  == #{t :overdue} #{related.due_at.strftime('%b %e')}
28
27
  - elsif related.due_at > Date.today
29
28
  = t(:task_due_in, distance_of_time_in_words(Time.now, related.due_at.end_of_day))
30
29
  - else
31
30
  %span.cool
32
31
  == #{t :due_today}.
33
-
32
+