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.
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/Gemfile +15 -2
- data/Gemfile.lock +34 -14
- data/README.md +37 -124
- data/app/assets/javascripts/application.js.erb +1 -1
- data/app/assets/javascripts/crm.js +22 -1
- data/app/assets/javascripts/crm_fields.js +2 -3
- data/app/assets/javascripts/jquery-noconflict.js +17 -0
- data/app/assets/stylesheets/application.css.erb +1 -0
- data/app/assets/stylesheets/common.scss +26 -0
- data/app/assets/stylesheets/ffcrm_chosen.scss +1 -1
- data/app/controllers/admin/application_controller.rb +1 -1
- data/app/controllers/application_controller.rb +0 -8
- data/app/controllers/{accounts_controller.rb → entities/accounts_controller.rb} +1 -13
- data/app/controllers/{campaigns_controller.rb → entities/campaigns_controller.rb} +1 -13
- data/app/controllers/{contacts_controller.rb → entities/contacts_controller.rb} +1 -7
- data/app/controllers/{leads_controller.rb → entities/leads_controller.rb} +1 -1
- data/app/controllers/{opportunities_controller.rb → entities/opportunities_controller.rb} +1 -7
- data/app/controllers/{tasks_controller.rb → entities/tasks_controller.rb} +1 -1
- data/app/controllers/{base_controller.rb → entities_controller.rb} +32 -1
- data/app/controllers/home_controller.rb +9 -9
- data/app/controllers/lists_controller.rb +17 -0
- data/app/helpers/admin/tags_helper.rb +1 -1
- data/app/helpers/application_helper.rb +14 -14
- data/app/helpers/crm_tags_helper.rb +1 -1
- data/app/helpers/home_helper.rb +13 -15
- data/app/helpers/lists_helper.rb +17 -0
- data/app/inputs/date_time_input.rb +17 -0
- data/app/inputs/text_input.rb +17 -1
- data/app/models/{base → entities}/account.rb +0 -1
- data/app/models/{base → entities}/account_contact.rb +0 -0
- data/app/models/{base → entities}/account_opportunity.rb +0 -0
- data/app/models/{base → entities}/campaign.rb +0 -1
- data/app/models/{base → entities}/contact.rb +0 -1
- data/app/models/{base → entities}/contact_opportunity.rb +0 -0
- data/app/models/{base → entities}/lead.rb +0 -1
- data/app/models/{base → entities}/opportunity.rb +0 -1
- data/app/models/{base → entities}/task.rb +5 -6
- data/app/models/list.rb +17 -0
- data/app/models/observers/lead_observer.rb +39 -0
- data/app/models/observers/opportunity_observer.rb +54 -0
- data/app/models/observers/task_observer.rb +41 -0
- data/app/models/polymorphic/address.rb +1 -3
- data/app/models/polymorphic/avatar.rb +0 -5
- data/app/models/polymorphic/comment.rb +2 -11
- data/app/models/polymorphic/email.rb +2 -9
- data/app/models/polymorphic/tag.rb +17 -0
- data/app/models/polymorphic/tagging.rb +17 -0
- data/app/models/users/ability.rb +13 -0
- data/app/models/users/user.rb +1 -4
- data/app/views/accounts/_account.html.haml +10 -6
- data/app/views/accounts/index.html.haml +1 -1
- data/app/views/accounts/show.html.haml +6 -24
- data/app/views/admin/fields/_field.html.haml +6 -6
- data/app/views/admin/tags/_tag.html.haml +2 -2
- data/app/views/admin/tags/index.html.haml +1 -1
- data/app/views/admin/users/_user.html.haml +3 -3
- data/app/views/admin/users/index.html.haml +1 -1
- data/app/views/campaigns/_campaign.html.haml +9 -5
- data/app/views/campaigns/index.html.haml +1 -1
- data/app/views/campaigns/show.html.haml +4 -24
- data/app/views/comments/_comment.html.haml +17 -14
- data/app/views/comments/_edit.html.haml +1 -1
- data/app/views/comments/_new.html.haml +3 -3
- data/app/views/contacts/_contact.html.haml +33 -15
- data/app/views/contacts/_contacts.html.haml +6 -0
- data/app/views/contacts/_sidebar_show.html.haml +1 -1
- data/app/views/contacts/index.html.haml +1 -1
- data/app/views/contacts/show.html.haml +3 -19
- data/app/views/emails/_email.html.haml +24 -21
- data/app/views/{base → entities}/_advanced_search.html.haml +0 -0
- data/app/views/{base → entities}/_condition_fields.html.haml +0 -0
- data/app/views/{base → entities}/_grouping_fields.html.haml +0 -0
- data/app/views/{base → entities}/_sort_fields.html.haml +0 -0
- data/app/views/{base → entities}/advanced_search.js.rjs +0 -0
- data/app/views/entities/contacts.js.rjs +3 -0
- data/app/views/entities/leads.js.rjs +3 -0
- data/app/views/entities/opportunities.js.rjs +3 -0
- data/app/views/entities/versions.js.rjs +3 -0
- data/app/views/home/_activity.html.haml +19 -18
- data/app/views/home/_events_menu.html.haml +8 -0
- data/app/views/home/_options.html.haml +2 -3
- data/app/views/home/index.html.haml +1 -1
- data/app/views/leads/_lead.html.haml +42 -23
- data/app/views/leads/_leads.html.haml +6 -0
- data/app/views/leads/_sidebar_show.html.haml +1 -1
- data/app/views/leads/index.html.haml +1 -1
- data/app/views/leads/show.html.haml +3 -13
- data/app/views/opportunities/_opportunities.html.haml +6 -0
- data/app/views/opportunities/_opportunity.html.haml +23 -11
- data/app/views/opportunities/index.html.haml +1 -1
- data/app/views/opportunities/show.html.haml +4 -18
- data/app/views/shared/_comment.html.haml +3 -3
- data/app/views/shared/_edit_comment.html.haml +1 -1
- data/app/views/shared/_recent.html.haml +4 -4
- data/app/views/shared/_recently.html.haml +3 -3
- data/app/views/shared/_timeline.html.haml +2 -3
- data/app/views/tasks/_assigned.html.haml +4 -4
- data/app/views/tasks/_completed.html.haml +2 -2
- data/app/views/tasks/_pending.html.haml +2 -2
- data/app/views/tasks/_related.html.haml +4 -5
- data/app/views/tasks/_tasks.html.haml +3 -0
- data/app/views/tasks/_title.html.haml +1 -1
- data/app/views/tasks/index.html.haml +1 -1
- data/app/views/users/_avatar.html.haml +2 -2
- data/app/views/versions/_version.html.haml +9 -12
- data/app/views/versions/_versions.html.haml +11 -0
- data/config/application.rb +3 -2
- data/config/environments/development.rb +2 -2
- data/config/environments/production.rb +0 -4
- data/config/environments/staging.rb +1 -1
- data/config/initializers/action_mailer.rb +9 -0
- data/config/initializers/paper_trail.rb +80 -0
- data/config/initializers/relative_url_root.rb +23 -0
- data/config/locales/cz_fat_free_crm.yml +1 -1
- data/config/locales/en-US_fat_free_crm.yml +22 -17
- data/config/locales/fr_fat_free_crm.yml +349 -134
- data/config/routes.rb +144 -140
- data/config/settings.default.yml +14 -2
- data/db/demo/addresses.yml +2 -2
- data/db/demo/emails.yml +2 -2
- data/db/migrate/20120216042541_is_paranoid_to_paper_trail.rb +1 -2
- data/db/migrate/20120309070209_add_versions_related.rb +6 -0
- data/db/migrate/20120316045804_activities_to_versions.rb +35 -0
- data/db/schema.rb +79 -53
- data/fat_free_crm.gemspec +8 -4
- data/lib/development_tasks/gem.rake +18 -1
- data/lib/development_tasks/license.rake +2 -4
- data/lib/development_tasks/rdoc.rake +17 -0
- data/lib/development_tasks/rspec.rake +17 -0
- data/lib/fat_free_crm.rb +20 -14
- data/lib/fat_free_crm/core_ext/array.rb +0 -27
- data/lib/fat_free_crm/dropbox.rb +11 -1
- data/lib/fat_free_crm/engine.rb +21 -3
- data/lib/fat_free_crm/gem_dependencies.rb +26 -0
- data/lib/fat_free_crm/gem_ext.rb +18 -1
- data/lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb +18 -1
- data/lib/fat_free_crm/gem_ext/authlogic/session/cookies.rb +17 -0
- data/lib/fat_free_crm/gem_ext/rails/engine.rb +17 -0
- data/lib/fat_free_crm/gem_ext/rails/text_helper.rb +17 -0
- data/lib/fat_free_crm/gem_ext/rake/task.rb +17 -0
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +18 -1
- data/lib/fat_free_crm/plugin_dependencies.rb +23 -5
- data/lib/fat_free_crm/renderers.rb +17 -0
- data/lib/fat_free_crm/syck_yaml.rb +17 -0
- data/lib/fat_free_crm/version.rb +1 -1
- data/lib/{country_select → plugins/country_select}/MIT-LICENSE +0 -0
- data/lib/{country_select → plugins/country_select}/README +0 -0
- data/lib/{country_select → plugins/country_select}/init.rb +0 -0
- data/lib/{country_select → plugins/country_select}/install.rb +0 -0
- data/lib/{country_select → plugins/country_select}/lib/country_select.rb +0 -0
- data/lib/{country_select → plugins/country_select}/uninstall.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/Gemfile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/README.textile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/ROADMAP.textile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/Rakefile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/VERSION +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/gravatar_image_tag.gemspec +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/init.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/lib/gravatar_image_tag.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/spec/gravatar_image_tag_spec.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/spec/test_helper.rb +0 -0
- data/lib/tasks/demo.rake +32 -29
- data/lib/tasks/dropbox.rake +1 -1
- data/lib/tasks/fat_free_crm.rake +3 -2
- data/lib/tasks/plugins.rake +1 -0
- data/spec/controllers/accounts_controller_spec.rb +7 -5
- data/spec/controllers/campaigns_controller_spec.rb +11 -9
- data/spec/controllers/contacts_controller_spec.rb +7 -5
- data/spec/controllers/home_controller_spec.rb +2 -2
- data/spec/controllers/leads_controller_spec.rb +7 -5
- data/spec/controllers/opportunities_controller_spec.rb +7 -5
- data/spec/factories/shared_factories.rb +8 -11
- data/spec/lib/dropbox_spec.rb +1 -0
- data/spec/models/polymorphic/version_spec.rb +247 -0
- data/spec/models/users/user_spec.rb +0 -9
- data/spec/spec_helper.rb +4 -0
- data/spec/views/home/index.haml_spec.rb +1 -1
- data/spec/views/home/index.rjs_spec.rb +4 -4
- data/spec/views/tasks/new.rjs_spec.rb +2 -2
- data/vendor/assets/javascripts/calendar_date_select/format_french.js +24 -0
- metadata +167 -126
- data/app/models/observers/activity_observer.rb +0 -84
- data/app/models/polymorphic/activity.rb +0 -106
- data/app/views/accounts/contacts.js.rjs +0 -3
- data/app/views/accounts/opportunities.js.rjs +0 -3
- data/app/views/campaigns/leads.js.rjs +0 -3
- data/app/views/campaigns/opportunities.js.rjs +0 -3
- data/app/views/contacts/opportunities.js.rjs +0 -3
- data/app/views/home/_actions_menu.html.haml +0 -8
- data/lib/dynamic_form/MIT-LICENSE +0 -20
- data/lib/dynamic_form/README +0 -13
- data/lib/dynamic_form/Rakefile +0 -10
- data/lib/dynamic_form/dynamic_form.gemspec +0 -12
- data/lib/dynamic_form/init.rb +0 -2
- data/lib/dynamic_form/lib/action_view/helpers/dynamic_form.rb +0 -301
- data/lib/dynamic_form/lib/action_view/locale/en-US.yml +0 -8
- data/lib/dynamic_form/lib/dynamic_form.rb +0 -6
- data/lib/dynamic_form/test/dynamic_form_i18n_test.rb +0 -42
- data/lib/dynamic_form/test/dynamic_form_test.rb +0 -370
- data/lib/dynamic_form/test/test_helper.rb +0 -10
- data/lib/responds_to_parent/MIT-LICENSE +0 -20
- data/lib/responds_to_parent/README +0 -47
- data/lib/responds_to_parent/Rakefile +0 -22
- data/lib/responds_to_parent/init.rb +0 -2
- data/lib/responds_to_parent/install.rb +0 -2
- data/lib/responds_to_parent/lib/responds_to_parent.rb +0 -70
- data/lib/responds_to_parent/test/responds_to_parent_test.rb +0 -11
- data/lib/responds_to_parent/test/test_helper.rb +0 -7
- data/lib/responds_to_parent/uninstall.rb +0 -2
- data/spec/models/polymorphic/activity_spec.rb +0 -303
@@ -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; } }
|
@@ -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 <
|
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 <
|
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 <
|
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 <
|
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 <
|
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 <
|
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 <
|
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
|
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[:
|
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[:
|
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[:
|
110
|
+
options[:event] ||= activity_event
|
111
111
|
options[:user] ||= activity_user
|
112
112
|
options[:duration] ||= activity_duration
|
113
113
|
|
114
|
-
|
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
|
129
|
-
|
130
|
-
if
|
131
|
-
|
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
|
-
|
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
|
|
@@ -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 =>
|
306
|
+
args = { :class => 'gravatar', :size => :large }.merge(args)
|
317
307
|
if model.avatar
|
318
|
-
|
308
|
+
Avatar
|
309
|
+
image_tag(model.avatar.image.url(args[:size]), args)
|
319
310
|
elsif model.email
|
320
|
-
|
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
|
-
|
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
|
data/app/helpers/home_helper.rb
CHANGED
@@ -17,21 +17,21 @@
|
|
17
17
|
|
18
18
|
module HomeHelper
|
19
19
|
def sort_by_assets
|
20
|
-
|
21
|
-
%Q[{ name: "#{t(asset
|
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
|
27
|
-
|
28
|
-
%Q[{ name: "#{t(
|
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
|
-
|
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.
|
56
|
-
type = t('subject_' + activity.
|
57
|
-
subject = if activity.
|
58
|
-
if
|
59
|
-
|
60
|
-
|
61
|
-
|
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}")
|
data/app/helpers/lists_helper.rb
CHANGED
@@ -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
|