fat_free_crm 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +170 -0
- data/README.md +3 -6
- data/app/assets/config/manifest.js +3 -0
- data/app/helpers/accounts_helper.rb +2 -0
- data/app/helpers/application_helper.rb +22 -3
- data/app/helpers/tasks_helper.rb +1 -2
- data/app/models/entities/account.rb +1 -1
- data/app/models/entities/campaign.rb +1 -1
- data/app/models/entities/contact.rb +1 -1
- data/app/models/entities/lead.rb +1 -1
- data/app/models/entities/opportunity.rb +1 -1
- data/app/models/polymorphic/avatar.rb +1 -30
- data/app/models/polymorphic/task.rb +2 -0
- data/app/views/home/index.xls.builder +1 -0
- data/app/views/shared/_address.html.haml +1 -1
- data/config/application.rb +13 -0
- data/config/environments/development.rb +3 -0
- data/config/puma.rb +2 -2
- data/config/storage.yml +34 -0
- data/db/migrate/20100928030617_drop_openid_tables.rb +2 -1
- data/db/migrate/20230526211831_create_active_storage_tables.active_storage.rb +51 -0
- data/db/migrate/20230526212613_convert_to_active_storage.rb +91 -0
- data/db/schema.rb +65 -35
- data/db/seeds/fields.rb +7 -21
- data/lib/development_tasks/license.rake +10 -10
- data/lib/fat_free_crm/errors.rb +2 -10
- data/lib/fat_free_crm/exceptions.rb +1 -0
- data/lib/fat_free_crm/fields.rb +4 -5
- data/lib/fat_free_crm/gem_dependencies.rb +0 -1
- data/lib/fat_free_crm/i18n.rb +1 -1
- data/lib/fat_free_crm/version.rb +2 -2
- metadata +16 -279
- data/.docker/nginx/sites-enabled/ffcrm.conf +0 -8
- data/.github/workflows/brakeman-analysis.yml +0 -46
- data/.github/workflows/rubocop-analysis.yml +0 -40
- data/.github/workflows/ruby.yml +0 -52
- data/.gitignore +0 -39
- data/.rubocop.yml +0 -73
- data/.rubocop_todo.yml +0 -286
- data/.teatro.yml +0 -3
- data/.travis.yml +0 -60
- data/CONTRIBUTORS.md +0 -135
- data/Capfile +0 -27
- data/Dockerfile +0 -51
- data/Gemfile +0 -106
- data/Gemfile.lock +0 -529
- data/Guardfile +0 -26
- data/Procfile +0 -1
- data/SECURITY.md +0 -11
- data/Vagrantfile +0 -92
- data/custom_plan.rb +0 -11
- data/docker-compose.yml +0 -27
- data/fat_free_crm.gemspec +0 -62
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/.gitkeep~master +0 -0
- data/script/rails +0 -8
- data/spec/controllers/admin/groups_controller_spec.rb +0 -11
- data/spec/controllers/admin/users_controller_spec.rb +0 -251
- data/spec/controllers/applications_controller_spec.rb +0 -43
- data/spec/controllers/comments_controller_spec.rb +0 -195
- data/spec/controllers/emails_controller_spec.rb +0 -37
- data/spec/controllers/entities/accounts_controller_spec.rb +0 -607
- data/spec/controllers/entities/campaigns_controller_spec.rb +0 -645
- data/spec/controllers/entities/contacts_controller_spec.rb +0 -705
- data/spec/controllers/entities/leads_controller_spec.rb +0 -1009
- data/spec/controllers/entities/opportunities_controller_spec.rb +0 -904
- data/spec/controllers/entities_controller_spec.rb +0 -47
- data/spec/controllers/home_controller_spec.rb +0 -235
- data/spec/controllers/lists_controller_spec.rb +0 -11
- data/spec/controllers/tasks_controller_spec.rb +0 -517
- data/spec/controllers/users_controller_spec.rb +0 -375
- data/spec/factories/account_factories.rb +0 -40
- data/spec/factories/campaign_factories.rb +0 -30
- data/spec/factories/contact_factories.rb +0 -45
- data/spec/factories/field_factories.rb +0 -40
- data/spec/factories/lead_factories.rb +0 -36
- data/spec/factories/list_factories.rb +0 -13
- data/spec/factories/opportunity_factories.rb +0 -39
- data/spec/factories/sequences.rb +0 -32
- data/spec/factories/setting_factories.rb +0 -15
- data/spec/factories/shared_factories.rb +0 -70
- data/spec/factories/subscription_factories.rb +0 -13
- data/spec/factories/tag_factories.rb +0 -12
- data/spec/factories/task_factories.rb +0 -29
- data/spec/factories/user_factories.rb +0 -66
- data/spec/features/acceptance_helper.rb +0 -11
- data/spec/features/accounts_spec.rb +0 -126
- data/spec/features/admin/groups_spec.rb +0 -31
- data/spec/features/admin/users_spec.rb +0 -40
- data/spec/features/campaigns_spec.rb +0 -104
- data/spec/features/contacts_spec.rb +0 -134
- data/spec/features/dashboard_spec.rb +0 -67
- data/spec/features/devise/sign_in_spec.rb +0 -58
- data/spec/features/devise/sign_up_spec.rb +0 -36
- data/spec/features/leads_spec.rb +0 -138
- data/spec/features/opportunities_overview_spec.rb +0 -88
- data/spec/features/opportunities_spec.rb +0 -132
- data/spec/features/support/autocomlete_helper.rb +0 -17
- data/spec/features/support/browser.rb +0 -28
- data/spec/features/support/headless.rb +0 -19
- data/spec/features/support/paths.rb +0 -48
- data/spec/features/support/selector_helpers.rb +0 -36
- data/spec/features/tasks_spec.rb +0 -94
- data/spec/fixtures/rails.png +0 -0
- data/spec/helpers/accounts_helper_spec.rb +0 -73
- data/spec/helpers/admin/field_groups_helper_spec.rb +0 -20
- data/spec/helpers/admin/plugins_helper_spec.rb +0 -11
- data/spec/helpers/admin/settings_helper_spec.rb +0 -11
- data/spec/helpers/admin/users_helper_spec.rb +0 -11
- data/spec/helpers/application_helper_spec.rb +0 -86
- data/spec/helpers/authentications_helper_spec.rb +0 -16
- data/spec/helpers/campaigns_helper_spec.rb +0 -16
- data/spec/helpers/comments_helper_spec.rb +0 -16
- data/spec/helpers/contacts_helper_spec.rb +0 -16
- data/spec/helpers/emails_helper_spec.rb +0 -11
- data/spec/helpers/fields_helper_spec.rb +0 -12
- data/spec/helpers/groups_helper_spec.rb +0 -21
- data/spec/helpers/home_helper_spec.rb +0 -16
- data/spec/helpers/leads_helper_spec.rb +0 -16
- data/spec/helpers/lists_helper_spec.rb +0 -21
- data/spec/helpers/opportunities_helper_spec.rb +0 -16
- data/spec/helpers/passwords_helper_spec.rb +0 -16
- data/spec/helpers/tasks_helper_spec.rb +0 -20
- data/spec/helpers/users_helper_spec.rb +0 -39
- data/spec/lib/comment_extensions_spec.rb +0 -42
- data/spec/lib/core_ext/string_spec.rb +0 -23
- data/spec/lib/errors_spec.rb +0 -32
- data/spec/lib/fields_spec.rb +0 -101
- data/spec/lib/mail_processor/base_spec.rb +0 -169
- data/spec/lib/mail_processor/comment_replies_spec.rb +0 -70
- data/spec/lib/mail_processor/dropbox_spec.rb +0 -306
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +0 -173
- data/spec/lib/permissions_spec.rb +0 -155
- data/spec/lib/secret_token_generator_spec.rb +0 -69
- data/spec/lib/view_factory_spec.rb +0 -69
- data/spec/mailers/devise_mailer_spec.rb +0 -35
- data/spec/mailers/subscription_mailer_spec.rb +0 -48
- data/spec/mailers/user_mailer_spec.rb +0 -115
- data/spec/models/entities/account_contact_spec.rb +0 -34
- data/spec/models/entities/account_opportunity_spec.rb +0 -34
- data/spec/models/entities/account_spec.rb +0 -206
- data/spec/models/entities/campaign_spec.rb +0 -131
- data/spec/models/entities/contact_opportunity_spec.rb +0 -34
- data/spec/models/entities/contact_spec.rb +0 -314
- data/spec/models/entities/lead_spec.rb +0 -102
- data/spec/models/entities/opportunity_spec.rb +0 -299
- data/spec/models/fields/custom_field_date_pair_spec.rb +0 -92
- data/spec/models/fields/custom_field_pair_spec.rb +0 -76
- data/spec/models/fields/custom_field_spec.rb +0 -129
- data/spec/models/fields/field_group_spec.rb +0 -29
- data/spec/models/fields/field_spec.rb +0 -69
- data/spec/models/list_spec.rb +0 -19
- data/spec/models/observers/entity_observer_spec.rb +0 -74
- data/spec/models/polymorphic/address_spec.rb +0 -34
- data/spec/models/polymorphic/avatar_spec.rb +0 -46
- data/spec/models/polymorphic/comment_spec.rb +0 -45
- data/spec/models/polymorphic/email_spec.rb +0 -53
- data/spec/models/polymorphic/task_spec.rb +0 -395
- data/spec/models/polymorphic/version_spec.rb +0 -241
- data/spec/models/setting_spec.rb +0 -77
- data/spec/models/users/abilities/user_ability_spec.rb +0 -70
- data/spec/models/users/group_spec.rb +0 -11
- data/spec/models/users/permission_spec.rb +0 -58
- data/spec/models/users/preference_spec.rb +0 -71
- data/spec/models/users/user_spec.rb +0 -238
- data/spec/routing/accounts_routing_spec.rb +0 -60
- data/spec/routing/admin/users_routing_spec.rb +0 -40
- data/spec/routing/campaigns_routing_spec.rb +0 -64
- data/spec/routing/comments_routing_spec.rb +0 -32
- data/spec/routing/contacts_routing_spec.rb +0 -60
- data/spec/routing/emails_routing_spec.rb +0 -40
- data/spec/routing/leads_routing_spec.rb +0 -88
- data/spec/routing/opportunities_routing_spec.rb +0 -64
- data/spec/routing/tasks_routing_spec.rb +0 -68
- data/spec/routing/users_routing_spec.rb +0 -106
- data/spec/shared/controllers.rb +0 -99
- data/spec/shared/models.rb +0 -141
- data/spec/spec_helper.rb +0 -117
- data/spec/support/assert_select.rb +0 -167
- data/spec/support/devise_helpers.rb +0 -28
- data/spec/support/feature_helpers.rb +0 -32
- data/spec/support/macros.rb +0 -49
- data/spec/support/mail_processor_mocks.rb +0 -37
- data/spec/support/uploaded_file.rb +0 -10
- data/spec/views/accounts/_edit.haml_spec.rb +0 -43
- data/spec/views/accounts/_new.haml_spec.rb +0 -42
- data/spec/views/accounts/create.js.haml_spec.rb +0 -52
- data/spec/views/accounts/destroy.js.haml_spec.rb +0 -34
- data/spec/views/accounts/edit.js.haml_spec.rb +0 -66
- data/spec/views/accounts/index.haml_spec.rb +0 -43
- data/spec/views/accounts/index.js.haml_spec.rb +0 -34
- data/spec/views/accounts/new.js.haml_spec.rb +0 -44
- data/spec/views/accounts/show.haml_spec.rb +0 -38
- data/spec/views/accounts/update.js.haml_spec.rb +0 -93
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +0 -30
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +0 -31
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +0 -24
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +0 -25
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +0 -29
- data/spec/views/admin/users/_create.haml_spec.rb +0 -23
- data/spec/views/admin/users/create.js.haml_spec.rb +0 -41
- data/spec/views/admin/users/destroy.js.haml_spec.rb +0 -47
- data/spec/views/admin/users/edit.js.haml_spec.rb +0 -44
- data/spec/views/admin/users/index.haml_spec.rb +0 -22
- data/spec/views/admin/users/index.js.haml_spec.rb +0 -26
- data/spec/views/admin/users/new.js.haml_spec.rb +0 -34
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +0 -22
- data/spec/views/admin/users/show.haml_spec.rb +0 -18
- data/spec/views/admin/users/suspend.js.haml_spec.rb +0 -22
- data/spec/views/admin/users/update.js.haml_spec.rb +0 -37
- data/spec/views/application/auto_complete.haml_spec.rb +0 -48
- data/spec/views/campaigns/_edit.haml_spec.rb +0 -44
- data/spec/views/campaigns/_new.haml_spec.rb +0 -41
- data/spec/views/campaigns/create.js.haml_spec.rb +0 -49
- data/spec/views/campaigns/destroy.js.haml_spec.rb +0 -31
- data/spec/views/campaigns/edit.js.haml_spec.rb +0 -66
- data/spec/views/campaigns/index.haml_spec.rb +0 -37
- data/spec/views/campaigns/index.js.haml_spec.rb +0 -34
- data/spec/views/campaigns/new.js.haml_spec.rb +0 -50
- data/spec/views/campaigns/show.haml_spec.rb +0 -38
- data/spec/views/campaigns/update.js.haml_spec.rb +0 -78
- data/spec/views/comments/edit.js.haml_spec.rb +0 -30
- data/spec/views/contacts/_edit.haml_spec.rb +0 -73
- data/spec/views/contacts/_new.haml_spec.rb +0 -52
- data/spec/views/contacts/create.js.haml_spec.rb +0 -65
- data/spec/views/contacts/destroy.js.haml_spec.rb +0 -45
- data/spec/views/contacts/edit.js.haml_spec.rb +0 -74
- data/spec/views/contacts/index.haml_spec.rb +0 -37
- data/spec/views/contacts/index.js.html_spec.rb +0 -34
- data/spec/views/contacts/new.js.haml_spec.rb +0 -47
- data/spec/views/contacts/show.haml_spec.rb +0 -35
- data/spec/views/contacts/update.js.haml_spec.rb +0 -128
- data/spec/views/home/index.haml_spec.rb +0 -36
- data/spec/views/home/index.js.haml_spec.rb +0 -33
- data/spec/views/home/options.js.haml_spec.rb +0 -53
- data/spec/views/leads/_convert.haml_spec.rb +0 -30
- data/spec/views/leads/_edit.haml_spec.rb +0 -47
- data/spec/views/leads/_new.haml_spec.rb +0 -45
- data/spec/views/leads/_sidebar_show.haml_spec.rb +0 -31
- data/spec/views/leads/convert.js.haml_spec.rb +0 -79
- data/spec/views/leads/create.js.haml_spec.rb +0 -67
- data/spec/views/leads/destroy.js.haml_spec.rb +0 -47
- data/spec/views/leads/edit.js.haml_spec.rb +0 -76
- data/spec/views/leads/index.haml_spec.rb +0 -37
- data/spec/views/leads/index.js.haml_spec.rb +0 -34
- data/spec/views/leads/new.js.haml_spec.rb +0 -47
- data/spec/views/leads/promote.js.haml_spec.rb +0 -135
- data/spec/views/leads/reject.js.haml_spec.rb +0 -45
- data/spec/views/leads/show.haml_spec.rb +0 -32
- data/spec/views/leads/update.js.haml_spec.rb +0 -118
- data/spec/views/opportunities/_edit.haml_spec.rb +0 -70
- data/spec/views/opportunities/_new.haml_spec.rb +0 -51
- data/spec/views/opportunities/create.js.haml_spec.rb +0 -86
- data/spec/views/opportunities/destroy.js.haml_spec.rb +0 -64
- data/spec/views/opportunities/edit.js.haml_spec.rb +0 -75
- data/spec/views/opportunities/index.haml_spec.rb +0 -38
- data/spec/views/opportunities/index.js.haml_spec.rb +0 -35
- data/spec/views/opportunities/new.js.haml_spec.rb +0 -54
- data/spec/views/opportunities/show.haml_spec.rb +0 -35
- data/spec/views/opportunities/update.js.haml_spec.rb +0 -143
- data/spec/views/tasks/_edit.haml_spec.rb +0 -50
- data/spec/views/tasks/complete.js.haml_spec.rb +0 -67
- data/spec/views/tasks/create.js.haml_spec.rb +0 -119
- data/spec/views/tasks/destroy.js.haml_spec.rb +0 -57
- data/spec/views/tasks/edit.js.haml_spec.rb +0 -76
- data/spec/views/tasks/index.haml_spec.rb +0 -46
- data/spec/views/tasks/new.js.haml_spec.rb +0 -49
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +0 -45
- data/spec/views/tasks/update.js.haml_spec.rb +0 -140
- data/spec/views/users/avatar.js.haml_spec.rb +0 -35
- data/spec/views/users/change_password.js.haml_spec.rb +0 -51
- data/spec/views/users/edit.js.haml_spec.rb +0 -35
- data/spec/views/users/password.js.haml_spec.rb +0 -36
- data/spec/views/users/update.js.haml_spec.rb +0 -46
- data/spec/views/users/upload_avatar.js.haml_spec.rb +0 -45
- data/vendor/gems/globby-0.1.2/LICENSE.txt +0 -20
- data/vendor/gems/globby-0.1.2/README.md +0 -65
- data/vendor/gems/globby-0.1.2/Rakefile +0 -9
- data/vendor/gems/globby-0.1.2/lib/globby/glob.rb +0 -90
- data/vendor/gems/globby-0.1.2/lib/globby/globject.rb +0 -18
- data/vendor/gems/globby-0.1.2/lib/globby/result.rb +0 -20
- data/vendor/gems/globby-0.1.2/lib/globby.rb +0 -47
- data/vendor/gems/globby-0.1.2/spec/gitignore_spec.rb +0 -109
- data/vendor/gems/globby-0.1.2/spec/globby_spec.rb +0 -93
- data/zeus.json +0 -22
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
9
|
-
|
10
|
-
describe OpportunitiesController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/opportunities").to route_to(controller: "opportunities", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #new" do
|
17
|
-
expect(get: "/opportunities/new").to route_to(controller: "opportunities", action: "new")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #show" do
|
21
|
-
expect(get: "/opportunities/1").to route_to(controller: "opportunities", action: "show", id: "1")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "doesn't recognize #show with non-numeric id" do
|
25
|
-
expect(get: "/opportunities/aaron").not_to be_routable
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #edit" do
|
29
|
-
expect(get: "/opportunities/1/edit").to route_to(controller: "opportunities", action: "edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "doesn't recognize #edit with non-numeric id" do
|
33
|
-
expect(get: "/opportunities/aaron/edit").not_to be_routable
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #create" do
|
37
|
-
expect(post: "/opportunities").to route_to(controller: "opportunities", action: "create")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "recognizes and generates #update" do
|
41
|
-
expect(put: "/opportunities/1").to route_to(controller: "opportunities", action: "update", id: "1")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "doesn't recognize #update with non-numeric id" do
|
45
|
-
expect(put: "/opportunities/aaron").not_to be_routable
|
46
|
-
end
|
47
|
-
|
48
|
-
it "recognizes and generates #destroy" do
|
49
|
-
expect(delete: "/opportunities/1").to route_to(controller: "opportunities", action: "destroy", id: "1")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "doesn't recognize #destroy with non-numeric id" do
|
53
|
-
expect(delete: "/opportunities/aaron").not_to be_routable
|
54
|
-
end
|
55
|
-
|
56
|
-
it "recognizes and generates #auto_complete" do
|
57
|
-
expect(get: "/opportunities/auto_complete").to route_to(controller: "opportunities", action: "auto_complete")
|
58
|
-
end
|
59
|
-
|
60
|
-
it "recognizes and generates #filter" do
|
61
|
-
expect(post: "/opportunities/filter").to route_to(controller: "opportunities", action: "filter")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
9
|
-
|
10
|
-
describe TasksController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/tasks").to route_to(controller: "tasks", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #new" do
|
17
|
-
expect(get: "/tasks/new").to route_to(controller: "tasks", action: "new")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #show" do
|
21
|
-
expect(get: "/tasks/1").to route_to(controller: "tasks", action: "show", id: "1")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "doesn't recognize #show with non-numeric id" do
|
25
|
-
expect(get: "/tasks/aaron").not_to be_routable
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #edit" do
|
29
|
-
expect(get: "/tasks/1/edit").to route_to(controller: "tasks", action: "edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "doesn't recognize #edit with non-numeric id" do
|
33
|
-
expect(get: "/tasks/aaron/edit").not_to be_routable
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #create" do
|
37
|
-
expect(post: "/tasks").to route_to(controller: "tasks", action: "create")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "recognizes and generates #update" do
|
41
|
-
expect(put: "/tasks/1").to route_to(controller: "tasks", action: "update", id: "1")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "doesn't recognize #update with non-numeric id" do
|
45
|
-
expect(put: "/tasks/aaron").not_to be_routable
|
46
|
-
end
|
47
|
-
|
48
|
-
it "recognizes and generates #destroy" do
|
49
|
-
expect(delete: "/tasks/1").to route_to(controller: "tasks", action: "destroy", id: "1")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "doesn't recognize #destroy with non-numeric id" do
|
53
|
-
expect(delete: "/tasks/aaron").not_to be_routable
|
54
|
-
end
|
55
|
-
|
56
|
-
it "recognizes and generates #filter" do
|
57
|
-
expect(post: "/tasks/filter").to route_to(controller: "tasks", action: "filter")
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should generate params for #complete" do
|
61
|
-
expect(put: "/tasks/1/complete").to route_to(controller: "tasks", action: "complete", id: "1")
|
62
|
-
end
|
63
|
-
|
64
|
-
it "doesn't recognize #complete with non-numeric id" do
|
65
|
-
expect(put: "/tasks/aaron/complete").not_to be_routable
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
9
|
-
|
10
|
-
describe UsersController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes #index" do
|
13
|
-
expect(get: "/users").to route_to(controller: "users", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates Devise registrations routes" do
|
17
|
-
expect(get: "/users/sign_up").to route_to(controller: "registrations", action: "new")
|
18
|
-
expect(get: "/users/edit").to route_to(controller: "registrations", action: "edit")
|
19
|
-
expect(get: "/users/cancel").to route_to(controller: "registrations", action: "cancel")
|
20
|
-
expect(post: "/users").to route_to(controller: "registrations", action: "create")
|
21
|
-
expect(put: "/users").to route_to(controller: "registrations", action: "update")
|
22
|
-
expect(patch: "/users").to route_to(controller: "registrations", action: "update")
|
23
|
-
expect(delete: "/users").to route_to(controller: "registrations", action: "destroy")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "recognizes and generates Devise sessions routes" do
|
27
|
-
expect(get: "/users/sign_in").to route_to(controller: "sessions", action: "new")
|
28
|
-
expect(post: "/users/sign_in").to route_to(controller: "sessions", action: "create")
|
29
|
-
expect(delete: "/users/sign_out").to route_to(controller: "sessions", action: "destroy")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "recognizes and generates Devise passwords routes" do
|
33
|
-
expect(get: "/users/password/new").to route_to(controller: "passwords", action: "new")
|
34
|
-
expect(get: "/users/password/edit").to route_to(controller: "passwords", action: "edit")
|
35
|
-
expect(post: "/users/password").to route_to(controller: "passwords", action: "create")
|
36
|
-
expect(put: "/users/password").to route_to(controller: "passwords", action: "update")
|
37
|
-
expect(patch: "/users/password").to route_to(controller: "passwords", action: "update")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "recognizes and generates Devise confirmations routes" do
|
41
|
-
expect(get: "/users/confirmation/new").to route_to(controller: "confirmations", action: "new")
|
42
|
-
expect(get: "/users/confirmation").to route_to(controller: "confirmations", action: "show")
|
43
|
-
expect(post: "/users/confirmation").to route_to(controller: "confirmations", action: "create")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "recognizes and generates #show as /profile" do
|
47
|
-
expect(get: "/profile").to route_to(controller: "users", action: "show")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "recognizes and generates #edit" do
|
51
|
-
expect(get: "/users/1/edit").to route_to(controller: "users", action: "edit", id: "1")
|
52
|
-
end
|
53
|
-
|
54
|
-
it "doesn't recognize #edit with non-numeric id" do
|
55
|
-
expect(get: "/users/aaron/edit").not_to be_routable
|
56
|
-
end
|
57
|
-
|
58
|
-
it "recognizes and generates #update" do
|
59
|
-
expect(put: "/users/1").to route_to(controller: "users", action: "update", id: "1")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "doesn't recognize #update with non-numeric id" do
|
63
|
-
expect(put: "/users/aaron").not_to be_routable
|
64
|
-
end
|
65
|
-
|
66
|
-
it "doesn't recognize #destroy" do
|
67
|
-
expect(delete: "/users/1").not_to be_routable
|
68
|
-
end
|
69
|
-
|
70
|
-
it "doesn't recognize #destroy with non-numeric id" do
|
71
|
-
expect(delete: "/users/aaron").not_to be_routable
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should generate params for #avatar" do
|
75
|
-
expect(get: "/users/1/avatar").to route_to(controller: "users", action: "avatar", id: "1")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "doesn't recognize #avatar with non-numeric id" do
|
79
|
-
expect(get: "/users/aaron/avatar").not_to be_routable
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should generate params for #upload_avatar" do
|
83
|
-
expect(put: "/users/1/upload_avatar").to route_to(controller: "users", action: "upload_avatar", id: "1")
|
84
|
-
end
|
85
|
-
|
86
|
-
it "doesn't recognize #upload_avatar with non-numeric id" do
|
87
|
-
expect(put: "/users/aaron/upload_avatar").not_to be_routable
|
88
|
-
end
|
89
|
-
|
90
|
-
it "should generate params for #password" do
|
91
|
-
expect(get: "/users/1/password").to route_to(controller: "users", action: "password", id: "1")
|
92
|
-
end
|
93
|
-
|
94
|
-
it "doesn't recognize #password with non-numeric id" do
|
95
|
-
expect(get: "/users/aaron/password").not_to be_routable
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should generate params for #change_password" do
|
99
|
-
expect(patch: "/users/1/change_password").to route_to(controller: "users", action: "change_password", id: "1")
|
100
|
-
end
|
101
|
-
|
102
|
-
it "doesn't recognize #change_password with non-numeric id" do
|
103
|
-
expect(patch: "/users/aaron/change_password").not_to be_routable
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
data/spec/shared/controllers.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
|
9
|
-
shared_examples "auto complete" do
|
10
|
-
before(:each) do
|
11
|
-
@query = "Hello"
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should do the search and find records that match autocomplete query" do
|
15
|
-
get :auto_complete, params: { term: @query }
|
16
|
-
expect(assigns[:query]).to eq(@query)
|
17
|
-
expect(assigns[:auto_complete]).to eq(@auto_complete_matches) # Each controller must define it.
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should save current autocomplete controller in a session" do
|
21
|
-
get :auto_complete, params: { term: @query }
|
22
|
-
|
23
|
-
# We don't save Admin/Users autocomplete controller in a session since Users are not
|
24
|
-
# exposed through the Jumpbox.
|
25
|
-
expect(session[:auto_complete]).to eq(@controller.controller_name.to_sym) unless controller.class.to_s.starts_with?("Admin::")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should render application/_auto_complete template" do
|
29
|
-
post :auto_complete, params: { term: @query }
|
30
|
-
expect(response).to render_template("application/_auto_complete")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
shared_examples "attach" do
|
35
|
-
it "should attach existing asset to the parent asset of different type" do
|
36
|
-
put :attach, params: { id: @model.id, assets: @attachment.class.name.tableize, asset_id: @attachment.id }, xhr: true
|
37
|
-
expect(@model.send(@attachment.class.name.tableize)).to include(@attachment)
|
38
|
-
expect(assigns[:attachment]).to eq(@attachment)
|
39
|
-
expect(assigns[:attached]).to eq([@attachment])
|
40
|
-
expect(assigns[:campaign]).to eq(@attachment.reload.campaign) if @model.is_a?(Campaign) && (@attachment.is_a?(Lead) || @attachment.is_a?(Opportunity))
|
41
|
-
expect(assigns[:account]).to eq(@attachment.reload.account) if @model.is_a?(Account) && @attachment.respond_to?(:account) # Skip Tasks...
|
42
|
-
expect(response).to render_template("entities/attach")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should not attach the asset that is already attached" do
|
46
|
-
if @model.is_a?(Campaign) && (@attachment.is_a?(Lead) || @attachment.is_a?(Opportunity))
|
47
|
-
@attachment.update_attribute(:campaign_id, @model.id)
|
48
|
-
else
|
49
|
-
@model.send(@attachment.class.name.tableize) << @attachment
|
50
|
-
end
|
51
|
-
|
52
|
-
put :attach, params: { id: @model.id, assets: @attachment.class.name.tableize, asset_id: @attachment.id }, xhr: true
|
53
|
-
expect(assigns[:attached]).to eq(nil)
|
54
|
-
expect(response).to render_template("entities/attach")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should display flash warning when the model is no longer available" do
|
58
|
-
@model.destroy
|
59
|
-
|
60
|
-
put :attach, params: { id: @model.id, assets: @attachment.class.name.tableize, asset_id: @attachment.id }, xhr: true
|
61
|
-
expect(flash[:warning]).not_to eq(nil)
|
62
|
-
expect(response.body).to eq("window.location.reload();")
|
63
|
-
end
|
64
|
-
it "should display flash warning when the attachment is no longer available" do
|
65
|
-
@attachment.destroy
|
66
|
-
|
67
|
-
put :attach, params: { id: @model.id, assets: @attachment.class.name.tableize, asset_id: @attachment.id }, xhr: true
|
68
|
-
expect(flash[:warning]).not_to eq(nil)
|
69
|
-
expect(response.body).to eq("window.location.reload();")
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
shared_examples "discard" do
|
74
|
-
it "should discard the attachment without deleting it" do
|
75
|
-
post :discard, params: { id: @model.id, attachment: @attachment.class.name, attachment_id: @attachment.id }, xhr: true
|
76
|
-
expect(assigns[:attachment]).to eq(@attachment.reload) # The attachment should still exist.
|
77
|
-
expect(@model.reload.send(@attachment.class.name.tableize.to_s)).to eq([]) # But no longer associated with the model.
|
78
|
-
expect(assigns[:account]).to eq(@model) if @model.is_a?(Account)
|
79
|
-
expect(assigns[:campaign]).to eq(@model) if @model.is_a?(Campaign)
|
80
|
-
|
81
|
-
expect(response).to render_template("entities/discard")
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should display flash warning when the model is no longer available" do
|
85
|
-
@model.destroy
|
86
|
-
|
87
|
-
post :discard, params: { id: @model.id, attachment: @attachment.class.name, attachment_id: @attachment.id }, xhr: true
|
88
|
-
expect(flash[:warning]).not_to eq(nil)
|
89
|
-
expect(response.body).to eq("window.location.reload();")
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should display flash warning when the attachment is no longer available" do
|
93
|
-
@attachment.destroy
|
94
|
-
|
95
|
-
post :discard, params: { id: @model.id, attachment: @attachment.class.name, attachment_id: @attachment.id }, xhr: true
|
96
|
-
expect(flash[:warning]).not_to eq(nil)
|
97
|
-
expect(response.body).to eq("window.location.reload();")
|
98
|
-
end
|
99
|
-
end
|
data/spec/shared/models.rb
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require "cancan/matchers"
|
9
|
-
|
10
|
-
shared_examples_for "exportable" do
|
11
|
-
it "Model#export returns all records with extra attributes added" do
|
12
|
-
# User/assignee for the second record has no first/last name.
|
13
|
-
expect(exported.size).to eq(2)
|
14
|
-
if exported[0].respond_to?(:user_id)
|
15
|
-
expect(exported[0].user_id_full_name).to eq(exported[0].user.full_name)
|
16
|
-
expect(exported[1].user_id_full_name).to eq(exported[1].user.email)
|
17
|
-
end
|
18
|
-
|
19
|
-
if exported[0].respond_to?(:assigned_to)
|
20
|
-
if exported[0].assigned_to?
|
21
|
-
expect(exported[0].assigned_to_full_name).to eq(exported[0].assignee.full_name)
|
22
|
-
else
|
23
|
-
expect(exported[0].assigned_to_full_name).to eq('')
|
24
|
-
end
|
25
|
-
if exported[1].assigned_to?
|
26
|
-
expect(exported[1].assigned_to_full_name).to eq(exported[1].assignee.email)
|
27
|
-
else
|
28
|
-
expect(exported[1].assigned_to_full_name).to eq('')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
if exported[0].respond_to?(:completed_by)
|
33
|
-
if exported[0].completed_by?
|
34
|
-
expect(exported[0].completed_by_full_name).to eq(exported[0].completor.full_name)
|
35
|
-
else
|
36
|
-
expect(exported[0].completed_by_full_name).to eq('')
|
37
|
-
end
|
38
|
-
if exported[1].completed_by?
|
39
|
-
expect(exported[1].completed_by_full_name).to eq(exported[1].completor.email)
|
40
|
-
else
|
41
|
-
expect(exported[1].completed_by_full_name).to eq('')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
shared_examples Ability do |klass|
|
48
|
-
subject { ability }
|
49
|
-
let(:ability) { Ability.new(user) }
|
50
|
-
let(:user) { create(:user) }
|
51
|
-
let(:factory) { klass.model_name.to_s.underscore }
|
52
|
-
|
53
|
-
context "create" do
|
54
|
-
it { is_expected.to be_able_to(:create, klass) }
|
55
|
-
end
|
56
|
-
|
57
|
-
context "when public access" do
|
58
|
-
let!(:asset) { create(factory, access: 'Public') }
|
59
|
-
|
60
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
61
|
-
end
|
62
|
-
|
63
|
-
context "when private access owner" do
|
64
|
-
let!(:asset) { create(factory, access: 'Private', user_id: user.id) }
|
65
|
-
|
66
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
67
|
-
end
|
68
|
-
|
69
|
-
context "when private access administrator" do
|
70
|
-
let!(:asset) { create(factory, access: 'Private') }
|
71
|
-
let(:user) { create(:user, admin: true) }
|
72
|
-
|
73
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
74
|
-
end
|
75
|
-
|
76
|
-
context "when private access not owner" do
|
77
|
-
let!(:asset) { create(factory, access: 'Private') }
|
78
|
-
|
79
|
-
it { is_expected.not_to be_able_to(:manage, asset) }
|
80
|
-
end
|
81
|
-
|
82
|
-
context "when private access not owner but is assigned" do
|
83
|
-
let!(:asset) { create(factory, access: 'Private', assigned_to: user.id) }
|
84
|
-
|
85
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
86
|
-
end
|
87
|
-
|
88
|
-
context "when shared access with permission" do
|
89
|
-
let!(:asset) { create(factory, access: 'Shared', permissions: [permission]) }
|
90
|
-
let(:permission) { Permission.new(user: user) }
|
91
|
-
|
92
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
93
|
-
end
|
94
|
-
|
95
|
-
context "when shared access with no permission" do
|
96
|
-
let!(:asset) { create(factory, access: 'Shared', permissions: [permission]) }
|
97
|
-
let(:permission) { Permission.new(user: create(:user)) }
|
98
|
-
|
99
|
-
it { is_expected.not_to be_able_to(:manage, asset) }
|
100
|
-
end
|
101
|
-
|
102
|
-
context "when shared access with no permission but administrator" do
|
103
|
-
let!(:asset) { create(factory, access: 'Shared', permissions: [permission]) }
|
104
|
-
let(:permission) { Permission.new(user: create(:user)) }
|
105
|
-
let(:user) { create(:user, admin: true) }
|
106
|
-
|
107
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
108
|
-
end
|
109
|
-
|
110
|
-
context "when shared access with no permission but assigned" do
|
111
|
-
let!(:asset) { create(factory, access: 'Shared', permissions: [permission], assigned_to: user.id) }
|
112
|
-
let(:permission) { Permission.new(user: create(:user)) }
|
113
|
-
|
114
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
115
|
-
end
|
116
|
-
|
117
|
-
context "when shared access with group permission" do
|
118
|
-
let!(:asset) { create(factory, access: 'Shared', permissions: [permission]) }
|
119
|
-
let(:permission) { Permission.new(group: group) }
|
120
|
-
let(:group) { create(:group, users: [user]) }
|
121
|
-
|
122
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
123
|
-
end
|
124
|
-
|
125
|
-
context "when shared access with several group permissions" do
|
126
|
-
let!(:asset) { create(factory, access: 'Shared', permissions: permissions) }
|
127
|
-
let(:permissions) { [Permission.new(group: group1), Permission.new(group: group2)] }
|
128
|
-
let(:group1) { create(:group, users: [user]) }
|
129
|
-
let(:group2) { create(:group, users: [user]) }
|
130
|
-
|
131
|
-
it { is_expected.to be_able_to(:manage, asset) }
|
132
|
-
end
|
133
|
-
|
134
|
-
context "when shared access with no group permission" do
|
135
|
-
let!(:asset) { create(factory, access: 'Shared', permissions: [permission]) }
|
136
|
-
let(:permission) { Permission.new(group: group) }
|
137
|
-
let(:group) { create(:group) }
|
138
|
-
|
139
|
-
it { is_expected.not_to be_able_to(:manage, asset) }
|
140
|
-
end
|
141
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'rubygems'
|
9
|
-
|
10
|
-
ENV["RAILS_ENV"] = 'test'
|
11
|
-
require File.expand_path('../config/environment', __dir__)
|
12
|
-
require 'rspec/rails'
|
13
|
-
require 'capybara/rails'
|
14
|
-
require 'paper_trail/frameworks/rspec'
|
15
|
-
|
16
|
-
require 'factory_bot_rails'
|
17
|
-
require 'ffaker'
|
18
|
-
require 'timecop'
|
19
|
-
require 'webdrivers'
|
20
|
-
|
21
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
22
|
-
# in spec/support/ and its subdirectories.
|
23
|
-
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
|
24
|
-
|
25
|
-
# Load shared behavior modules to be included by Runner config.
|
26
|
-
Dir["./spec/shared/**/*.rb"].sort.each { |f| require f }
|
27
|
-
|
28
|
-
TASK_STATUSES = %w[pending assigned completed].freeze
|
29
|
-
|
30
|
-
I18n.locale = 'en-US'
|
31
|
-
|
32
|
-
Paperclip.options[:log] = false
|
33
|
-
|
34
|
-
RSpec.configure do |config|
|
35
|
-
config.infer_spec_type_from_file_location!
|
36
|
-
|
37
|
-
config.mock_with :rspec
|
38
|
-
|
39
|
-
config.fixture_path = "#{Rails.root}/spec/fixtures"
|
40
|
-
|
41
|
-
# RSpec configuration options for Fat Free CRM.
|
42
|
-
config.include RSpec::Rails::Matchers
|
43
|
-
config.include FactoryBot::Syntax::Methods
|
44
|
-
config.include Devise::Test::ControllerHelpers, type: :controller
|
45
|
-
config.include Devise::Test::ControllerHelpers, type: :view
|
46
|
-
config.include Devise::Test::IntegrationHelpers, type: :features
|
47
|
-
config.include Warden::Test::Helpers
|
48
|
-
config.include DeviseHelpers
|
49
|
-
config.include FeatureHelpers
|
50
|
-
|
51
|
-
Warden.test_mode!
|
52
|
-
|
53
|
-
config.before(:each) do
|
54
|
-
# Overwrite locale settings within "config/settings.yml" if necessary.
|
55
|
-
# In order to ensure that test still pass if "Setting.locale" is not set to "en-US".
|
56
|
-
I18n.locale = 'en-US'
|
57
|
-
Setting.locale = 'en-US' unless Setting.locale == 'en-US'
|
58
|
-
end
|
59
|
-
|
60
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
61
|
-
# examples within a transaction, remove the following line or assign false
|
62
|
-
# instead of true.
|
63
|
-
config.use_transactional_fixtures = false
|
64
|
-
|
65
|
-
config.before(:suite) do
|
66
|
-
DatabaseCleaner.clean_with(:truncation)
|
67
|
-
end
|
68
|
-
|
69
|
-
config.before(:each) do
|
70
|
-
DatabaseCleaner.strategy = :transaction
|
71
|
-
end
|
72
|
-
|
73
|
-
config.before(:each, :js) do
|
74
|
-
DatabaseCleaner.strategy = :truncation
|
75
|
-
end
|
76
|
-
|
77
|
-
config.before(:each, :truncate) do
|
78
|
-
DatabaseCleaner.strategy = :truncation
|
79
|
-
end
|
80
|
-
|
81
|
-
config.before(:each) do
|
82
|
-
DatabaseCleaner.start
|
83
|
-
end
|
84
|
-
|
85
|
-
config.append_after(:each) do
|
86
|
-
DatabaseCleaner.clean
|
87
|
-
end
|
88
|
-
|
89
|
-
# If true, the base class of anonymous controllers will be inferred
|
90
|
-
# automatically. This will be the default behavior in future versions of
|
91
|
-
# rspec-rails.
|
92
|
-
config.infer_base_class_for_anonymous_controllers = false
|
93
|
-
end
|
94
|
-
|
95
|
-
ActionView::TestCase::TestController.class_eval do
|
96
|
-
def controller_name
|
97
|
-
HashWithIndifferentAccess.new(request.path_parameters)["controller"].split('/').last
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
ActionView::Base.class_eval do
|
102
|
-
def controller_name
|
103
|
-
HashWithIndifferentAccess.new(request.path_parameters)["controller"].split('/').last
|
104
|
-
end
|
105
|
-
|
106
|
-
def called_from_index_page?(controller = controller_name)
|
107
|
-
request.referer =~ if controller != "tasks"
|
108
|
-
%r{/#{controller}$}
|
109
|
-
else
|
110
|
-
/tasks\?*/
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def called_from_landing_page?(controller = controller_name)
|
115
|
-
request.referer =~ %r{/#{controller}/\w+}
|
116
|
-
end
|
117
|
-
end
|