think_feel_do_dashboard 1.1.19 → 1.1.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6920f2ca865ff9bf8ed7262534ff7655c2317aa
4
- data.tar.gz: 04c3d6af43b677e230357db4471173db354ec868
3
+ metadata.gz: 60c04e6bf832febb87121a5d4b9dfd4a5d36f331
4
+ data.tar.gz: c490cf52e688ff1ba77995d668508f6009308fbd
5
5
  SHA512:
6
- metadata.gz: 257b05c606e24f987e4c4f98a18138f2aa61d2f563c2e6b2c351ea112221173fcaba3c3e75f5651c2382e996cce3784bf4ccb72174a8708383d7780b6c6bf18b
7
- data.tar.gz: f77d2bf05cb88a7dea0fc5337d64c2827aa5bc42d432dec72977e32bb1440a8ae15ebddd7da0b74705dd2915032ad89e8966f070f45d8d7691c7d9ec010d6490
6
+ metadata.gz: 5ca8a9ed20bb1f0522da2ee5f5fec4e2cbd78b7b9695e1559f7a14c45fbc6a74e1156319bd77869e991184c528ec3b86118bab80823b5190c216d5c9d87a69e2
7
+ data.tar.gz: a6fd2463370bb7d652d8bc4f5561fc58097b9d227d80dbb62f21b659e456ed4e0472d4f080a6eae18aa22aab8b3dbb1e491a7b8c3cd49e2dcf9097f80b19e6de
@@ -81,7 +81,8 @@ module ThinkFeelDoDashboard
81
81
  def set_new_woz_coach
82
82
  @coach_assignment = CoachAssignment.new(
83
83
  participant: @participant,
84
- coach_id: @participant.active_group.moderator_id)
84
+ coach_id: @participant.active_group.moderator_id
85
+ )
85
86
  if @coach_assignment.save
86
87
  notification = "Coach/Moderator was successfully assigned"
87
88
  else
@@ -13,11 +13,11 @@ module ThinkFeelDoDashboard
13
13
  concat(content_tag(:li, link_to("Home", root_path)))
14
14
 
15
15
  if can_view_resource_index?
16
- concat(content_tag(:li,
17
- link_to(controller_name.capitalize,
18
- url_for(controller: controller_name))
19
- )
20
- )
16
+ concat(
17
+ content_tag(
18
+ :li, controller_link
19
+ )
20
+ )
21
21
  end
22
22
  end
23
23
  )
@@ -44,5 +44,9 @@ module ThinkFeelDoDashboard
44
44
 
45
45
  !klass.is_a?(Class) || can?(:index, klass)
46
46
  end
47
+
48
+ def controller_link
49
+ link_to(controller_name.capitalize, url_for(controller: controller_name))
50
+ end
47
51
  end
48
52
  end
@@ -2,12 +2,21 @@ module ThinkFeelDoDashboard
2
2
  # Display the membership status for a participant and membership
3
3
  module ParticipantsHelper
4
4
  def membership_status(participant, membership)
5
- if participant.memberships.active.where(
6
- "memberships.is_complete = false").include?(membership)
5
+ if participant_active?(participant, membership)
7
6
  "<span class=\"label label-success\">Active</span> ".html_safe
8
7
  else
9
8
  "<span class=\"label label-danger\">Inactive</span> ".html_safe
10
9
  end
11
10
  end
11
+
12
+ private
13
+
14
+ def participant_active?(participant, membership)
15
+ participant
16
+ .memberships
17
+ .active
18
+ .where("memberships.is_complete = false")
19
+ .include?(membership)
20
+ end
12
21
  end
13
22
  end
@@ -46,7 +46,8 @@ module ThinkFeelDoDashboard
46
46
  memberships.build(
47
47
  participant_id: participant.id,
48
48
  start_date: Time.zone.today,
49
- end_date: Time.zone.today.advance(days: days))
49
+ end_date: Time.zone.today.advance(days: days)
50
+ )
50
51
  end
51
52
  end
52
53
 
@@ -62,14 +63,16 @@ module ThinkFeelDoDashboard
62
63
  is_admin: true,
63
64
  password: password,
64
65
  password_confirmation: password,
65
- study_id: study_id)
66
+ study_id: study_id
67
+ )
66
68
  end
67
69
 
68
70
  def create_profile(participant_id)
69
71
  ::SocialNetworking::Profile.create!(
70
72
  participant_id: participant_id,
71
73
  icon_name: "admin",
72
- active: true)
74
+ active: true
75
+ )
73
76
  end
74
77
  end
75
78
  end
@@ -1,4 +1,5 @@
1
1
  require "think_feel_do_dashboard/engine"
2
+ require "jquery-rails"
2
3
 
3
4
  # Rails engine that is replacing rails_admin
4
5
  # Provides admin functionailty such as assigning participants
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # Version number of engine
3
3
  module ThinkFeelDoDashboard
4
- VERSION = "1.1.19".freeze
4
+ VERSION = "1.1.20".freeze
5
5
  end
@@ -24,7 +24,8 @@ module ThinkFeelDoDashboard
24
24
  let(:group) do
25
25
  instance_double(
26
26
  Group,
27
- arm: instance_double(Arm))
27
+ arm: instance_double(Arm)
28
+ )
28
29
  end
29
30
 
30
31
  before do
@@ -13,7 +13,8 @@ module ThinkFeelDoDashboard
13
13
  Group,
14
14
  id: 1,
15
15
  arm: instance_double(Arm, is_social?: true),
16
- title: "best group eva!!111")
16
+ title: "best group eva!!111"
17
+ )
17
18
  end
18
19
  let(:membership) do
19
20
  instance_double Membership
@@ -22,7 +23,8 @@ module ThinkFeelDoDashboard
22
23
  instance_double(
23
24
  Participant,
24
25
  id: 1,
25
- memberships: double("memberships"))
26
+ memberships: double("memberships")
27
+ )
26
28
  end
27
29
 
28
30
  context "view membership" do
@@ -57,7 +59,8 @@ module ThinkFeelDoDashboard
57
59
  instance_double(
58
60
  Group,
59
61
  arm: instance_double(Arm, is_social?: true),
60
- title: "best group eva!!111")
62
+ title: "best group eva!!111"
63
+ )
61
64
  end
62
65
  let(:participant) do
63
66
  instance_double(
@@ -69,7 +72,10 @@ module ThinkFeelDoDashboard
69
72
  group: group,
70
73
  display_name: nil,
71
74
  errors:
72
- double("errors", full_messages: []))))
75
+ double("errors", full_messages: [])
76
+ )
77
+ )
78
+ )
73
79
  end
74
80
 
75
81
  context "create new membership in social arm" do
@@ -18,7 +18,8 @@ module ThinkFeelDoDashboard
18
18
  .to receive(:find) do
19
19
  instance_double(
20
20
  Group,
21
- moderating_participant: user)
21
+ moderating_participant: user
22
+ )
22
23
  end
23
24
  expect(controller).to receive(:sign_in).with(user)
24
25
  allow(controller)
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
3
3
  # Pick the frameworks you want:
4
4
  require "active_record/railtie"
5
5
  require "action_controller/railtie"
6
- require "action_mailer/railtie"
6
+ #require "action_mailer/railtie"
7
7
  require "action_view/railtie"
8
8
  require "sprockets/railtie"
9
9
  # require "rails/test_unit/railtie"
@@ -14,7 +14,7 @@ Rails.application.configure do
14
14
  config.action_controller.perform_caching = false
15
15
 
16
16
  # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
17
+ #config.action_mailer.raise_delivery_errors = false
18
18
 
19
19
  # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
@@ -36,5 +36,5 @@ Rails.application.configure do
36
36
  # config.action_view.raise_on_missing_translations = true
37
37
 
38
38
  # Devise - visit https://github.com/plataformatec/devise
39
- config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
39
+ #config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
40
40
  end
@@ -29,7 +29,7 @@ Rails.application.configure do
29
29
  # Tell Action Mailer not to deliver emails to the real world.
30
30
  # The :test delivery method accumulates sent emails in the
31
31
  # ActionMailer::Base.deliveries array.
32
- config.action_mailer.delivery_method = :test
32
+ #config.action_mailer.delivery_method = :test
33
33
 
34
34
  # Print deprecation notices to the stderr.
35
35
  config.active_support.deprecation = :stderr
@@ -1,10 +1,12 @@
1
+ require "devise"
2
+
1
3
  # Use this hook to configure devise mailer, warden hooks and so forth.
2
4
  # Many of these configuration options can be set straight in your model.
3
5
  Devise.setup do |config|
4
6
  # The secret key used by Devise. Devise uses this key to generate
5
7
  # random tokens. Changing this key will render invalid all existing
6
8
  # confirmation, reset password and unlock tokens in the database.
7
- # config.secret_key = '178a41b361b8d846f1c32a0ed56cbc1b10e629e08248c41f3a7b97e3e02702f51a9d86a8570d762fc7d23c4c81423259acafffb5b379f3f62b3f9c47007c295c'
9
+ config.secret_key = '178a41b361b8d846f1c32a0ed56cbc1b10e629e08248c41f3a7b97e3e02702f51a9d86a8570d762fc7d23c4c81423259acafffb5b379f3f62b3f9c47007c295c'
8
10
 
9
11
  # ==> Mailer Configuration
10
12
  # Configure the e-mail address which will be shown in Devise::Mailer,
@@ -68,13 +68,12 @@ ActiveRecord::Schema.define(version: 20150410175659) do
68
68
  t.inet "current_sign_in_ip"
69
69
  t.inet "last_sign_in_ip"
70
70
  t.boolean "is_admin"
71
+ t.index ["email"], name: "index_participants_on_email", unique: true, using: :btree
72
+ t.index ["phone_number"], name: "index_participants_on_phone_number", unique: true, using: :btree
73
+ t.index ["reset_password_token"], name: "index_participants_on_reset_password_token", unique: true, using: :btree
74
+ t.index ["study_id"], name: "index_participants_on_study_id", unique: true, using: :btree
71
75
  end
72
76
 
73
- add_index "participants", ["email"], name: "index_participants_on_email", unique: true, using: :btree
74
- add_index "participants", ["phone_number"], name: "index_participants_on_phone_number", unique: true, using: :btree
75
- add_index "participants", ["reset_password_token"], name: "index_participants_on_reset_password_token", unique: true, using: :btree
76
- add_index "participants", ["study_id"], name: "index_participants_on_study_id", unique: true, using: :btree
77
-
78
77
  create_table "slideshow_anchors", force: :cascade do |t|
79
78
  t.integer "bit_core_slideshow_id"
80
79
  t.string "target_name"
@@ -125,9 +124,8 @@ ActiveRecord::Schema.define(version: 20150410175659) do
125
124
  t.datetime "last_sign_in_at"
126
125
  t.inet "current_sign_in_ip"
127
126
  t.inet "last_sign_in_ip"
127
+ t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
128
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
128
129
  end
129
130
 
130
- add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
131
- add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
132
-
133
131
  end
@@ -372305,3 +372305,5 @@ WHERE c.contype = 'f'
372305
372305
  AND t3.nspname = ANY (current_schemas(false))
372306
372306
  ORDER BY c.conname
372307
372307
  
372308
+ Participant Load (31.0ms) SELECT "participants".* FROM "participants" ORDER BY "participants"."id" ASC LIMIT 1
372309
+ Participant Load (0.7ms) SELECT "participants".* FROM "participants" ORDER BY "participants"."id" ASC LIMIT 1
@@ -9,7 +9,8 @@ describe "Group concern" do
9
9
  Participant.create!(
10
10
  contact_preference: "email",
11
11
  study_id: "bar",
12
- email: "foo@ex.com")
12
+ email: "foo@ex.com"
13
+ )
13
14
  end
14
15
 
15
16
  it "augments default password to ensure validity" do
@@ -24,13 +25,15 @@ describe "Group concern" do
24
25
  display_name: anything,
25
26
  email: anything,
26
27
  is_admin: true,
27
- study_id: anything)
28
+ study_id: anything
29
+ )
28
30
  .and_return(participant)
29
31
 
30
32
  Group.create!(
31
33
  title: "Valid",
32
34
  arm: arms(:arm1),
33
- moderator: users(:clinician1))
35
+ moderator: users(:clinician1)
36
+ )
34
37
  end
35
38
  end
36
39
  end
@@ -77,7 +77,8 @@ describe Group do
77
77
  Group.new(
78
78
  arm_id: social_arm.id,
79
79
  moderator_id: clinician2.id,
80
- title: "Test")
80
+ title: "Test"
81
+ )
81
82
  end
82
83
 
83
84
  describe "when invalid" do
@@ -104,7 +105,8 @@ describe Group do
104
105
  Group.create!(
105
106
  arm_id: social_arm.id,
106
107
  moderator_id: clinician2.id,
107
- title: "Test")
108
+ title: "Test"
109
+ )
108
110
  end
109
111
 
110
112
  before do
data/spec/rails_helper.rb CHANGED
@@ -8,6 +8,8 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
8
  require "rspec/rails"
9
9
  require "capybara/poltergeist"
10
10
 
11
+ require "timecop"
12
+
11
13
  Capybara.javascript_driver = :poltergeist
12
14
  options = {
13
15
  js_errors: false,
@@ -1,3 +1,7 @@
1
+ if Rails::VERSION::MAJOR == 5
2
+ require "rails-controller-testing"
3
+ end
4
+
1
5
  module ControllerSpecHelpers
2
6
  def sign_in_participant(participant = double("participant"))
3
7
  sign_in_resource(participant, "participant")
@@ -24,6 +28,10 @@ module ControllerSpecHelpers
24
28
  end
25
29
 
26
30
  RSpec.configure do |config|
31
+ if Rails::VERSION::MAJOR == 5
32
+ config.include ::Rails::Controller::Testing::TemplateAssertions,
33
+ type: :controller
34
+ end
27
35
  config.include Devise::TestHelpers, type: :controller
28
36
  config.include ControllerSpecHelpers, type: :controller
29
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: think_feel_do_dashboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.19
4
+ version: 1.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Carty-Fickes
@@ -10,22 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-04-27 00:00:00.000000000 Z
13
+ date: 2016-05-20 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rails
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - '='
20
- - !ruby/object:Gem::Version
21
- version: 4.2.5.2
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - '='
27
- - !ruby/object:Gem::Version
28
- version: 4.2.5.2
29
15
  - !ruby/object:Gem::Dependency
30
16
  name: turbolinks
31
17
  requirement: !ruby/object:Gem::Requirement
@@ -41,47 +27,47 @@ dependencies:
41
27
  - !ruby/object:Gem::Version
42
28
  version: '2.2'
43
29
  - !ruby/object:Gem::Dependency
44
- name: devise
30
+ name: cancancan
45
31
  requirement: !ruby/object:Gem::Requirement
46
32
  requirements:
47
33
  - - "~>"
48
34
  - !ruby/object:Gem::Version
49
- version: '3.2'
35
+ version: '1.9'
50
36
  type: :runtime
51
37
  prerelease: false
52
38
  version_requirements: !ruby/object:Gem::Requirement
53
39
  requirements:
54
40
  - - "~>"
55
41
  - !ruby/object:Gem::Version
56
- version: '3.2'
42
+ version: '1.9'
57
43
  - !ruby/object:Gem::Dependency
58
- name: cancancan
44
+ name: phonelib
59
45
  requirement: !ruby/object:Gem::Requirement
60
46
  requirements:
61
47
  - - "~>"
62
48
  - !ruby/object:Gem::Version
63
- version: '1.9'
49
+ version: '0.5'
64
50
  type: :runtime
65
51
  prerelease: false
66
52
  version_requirements: !ruby/object:Gem::Requirement
67
53
  requirements:
68
54
  - - "~>"
69
55
  - !ruby/object:Gem::Version
70
- version: '1.9'
56
+ version: '0.5'
71
57
  - !ruby/object:Gem::Dependency
72
- name: phonelib
58
+ name: jquery-rails
73
59
  requirement: !ruby/object:Gem::Requirement
74
60
  requirements:
75
61
  - - "~>"
76
62
  - !ruby/object:Gem::Version
77
- version: '0.5'
63
+ version: 3.1.3
78
64
  type: :runtime
79
65
  prerelease: false
80
66
  version_requirements: !ruby/object:Gem::Requirement
81
67
  requirements:
82
68
  - - "~>"
83
69
  - !ruby/object:Gem::Version
84
- version: '0.5'
70
+ version: 3.1.3
85
71
  - !ruby/object:Gem::Dependency
86
72
  name: pg
87
73
  requirement: !ruby/object:Gem::Requirement
@@ -102,14 +88,14 @@ dependencies:
102
88
  requirements:
103
89
  - - "~>"
104
90
  - !ruby/object:Gem::Version
105
- version: '3.0'
91
+ version: 3.5.0.beta3
106
92
  type: :development
107
93
  prerelease: false
108
94
  version_requirements: !ruby/object:Gem::Requirement
109
95
  requirements:
110
96
  - - "~>"
111
97
  - !ruby/object:Gem::Version
112
- version: '3.0'
98
+ version: 3.5.0.beta3
113
99
  - !ruby/object:Gem::Dependency
114
100
  name: poltergeist
115
101
  requirement: !ruby/object:Gem::Requirement
@@ -166,6 +152,34 @@ dependencies:
166
152
  - - "~>"
167
153
  - !ruby/object:Gem::Version
168
154
  version: 0.9.1
155
+ - !ruby/object:Gem::Dependency
156
+ name: rubocop
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: '0.26'
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - "~>"
167
+ - !ruby/object:Gem::Version
168
+ version: '0.26'
169
+ - !ruby/object:Gem::Dependency
170
+ name: timecop
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - "~>"
174
+ - !ruby/object:Gem::Version
175
+ version: '0.7'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - "~>"
181
+ - !ruby/object:Gem::Version
182
+ version: '0.7'
169
183
  description: Enables users to manage arms/trials, groups, users, participants, and
170
184
  memberships.
171
185
  email:
@@ -2392,7 +2406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2392
2406
  version: '0'
2393
2407
  requirements: []
2394
2408
  rubyforge_project:
2395
- rubygems_version: 2.4.6
2409
+ rubygems_version: 2.5.1
2396
2410
  signing_key:
2397
2411
  specification_version: 4
2398
2412
  summary: Provides administrational tasks.