Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2143 - display bookmarked moments in care plan #2154

Merged
merged 8 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/care_plan_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ class CarePlanController < ApplicationController
def index
@bookmarked_strategies = current_user.strategies.where(bookmarked: true)
@contacts = current_user.care_plan_contacts.order('LOWER(name)')
@bookmarked_moments = current_user.moments.where(bookmarked: true)
end
end
3 changes: 2 additions & 1 deletion app/helpers/moments_form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def moment_bookmarked
'bookmarked', 'switch', 'moments.form.bookmarked_question'
).merge(
value: true, uncheckedValue: false,
checked: @moment.bookmarked, dark: true
checked: @moment.bookmarked, dark: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked: @moment.bookmarked should be checked: params[:bookmarked] ? true : @moment.bookmarked so that when you create a Moment from the Care Plan page, it will automatically be bookmarked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah gotcha, updated now.

info: t('moments.form.bookmarked_info')
)
end

Expand Down
18 changes: 18 additions & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint no-console:0 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's delete this file since it's not necessary!

// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb


// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)

console.log('Hello World from Webpacker')
22 changes: 22 additions & 0 deletions app/views/care_plan/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,25 @@
<% end %>
</div>
<% end %>

<div class="pageSubtitle">
<h2><%= t('moments.plural') %></h2>
<div class="pageSubtitleRight">
<%= link_to(t('moments.new'), new_moment_path(bookmarked: true), class: 'buttonS') %>
</div>
</div>

<%= t('moments.form.bookmarked_info') %>

<% if @bookmarked_moments.any? %>
<div class="gridTwo marginTop">
<% @bookmarked_moments.each do |moment| %>
<div class="gridTwoItemBoxLight">
<%= react_component('Story', html_options: html_options, props: {
name: moment.name,
link: moment_path(moment)
}) %>
</div>
<% end %>
</div>
<% end %>
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ de:
viewers_hint: 'Helfer, die Dein Ereignis sehen können'
draft_question: Möchtest Du Dein Ereignis als Entwurf speichern?
bookmarked_question: Lesezeichen für dieses Ereignis anlegen?
bookmarked_info: Markierte Momente erscheinen in Ihrem Behandlungsplan
resource_recommendations_question: Empfohlene Ressourcen anzeigen?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ en:
viewers_hint: Allies who can view your moment
draft_question: Do you want to save your moment as draft?
bookmarked_question: Bookmark this moment?
bookmarked_info: Bookmarked moments appear in your Care Plan
resource_recommendations_question: Display Resource Recommendations?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ es:
viewers_hint: 'Aliados que pueden ver tu momento:'
draft_question: ¿Quieres guardar tu momento como borrador?
bookmarked_question: Marcar este momento?
bookmarked_info: Los momentos marcados aparecen en su plan de cuidados
resource_recommendations_question: ¿Mostrar recomendación de recursos?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ fr:
viewers_hint: Alliés qui peuvent visualiser ce moment
draft_question: Voulez-vous conserver ce moment comme brouillon ?
bookmarked_question: Ajouter ce moment aux favoris?
bookmarked_info: Les moments marqués apparaissent dans votre plan de soins
resource_recommendations_question: Voulez-vous afficher la recommandation de ressource?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/hi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ hi:
viewers_hint: सहयोगी जो आपके पल को देख सकते हैं
draft_question: क्या आप अपने पल को ड्राफ्ट के रूप में सहेजना चाहते हैं?
bookmarked_question: इस पल को बुकमार्क करें?
bookmarked_info: बुकमार्क किए गए क्षण आपकी देखभाल योजना में दिखाई देते हैं
resource_recommendations_question: अनुशंसित संसाधन प्रदर्शित करें?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ id:
viewers_hint: Teman yang dapat melihat momen Anda
draft_question: Apakah Anda ingin menyimpan momen Anda sebagai draf?
bookmarked_question: Tandai momen ini?
bookmarked_info: Momen yang ditandai muncul di Rencana Perawatan Anda
resource_recommendations_question: Tampilkan Rekomendasi Sumber Daya?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ it:
viewers_hint: Alleati che possono vedere il tuo momento
draft_question: Vuoi salvare il tuo momento come una bozza?
bookmarked_question: Aggiungi questo momento ai segnalibri?
bookmarked_info: I momenti contrassegnati vengono visualizzati nel tuo Piano di assistenza
resource_recommendations_question: Mostra raccomandazione sulle risorse?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ ko:
viewers_hint: 당신의 경험들을 볼 수 있는 공유자
draft_question: 이대로 경험을 저장하시겠습니까?
bookmarked_question: 이 경험을 북마크 하시겠습니까?
bookmarked_info: 북마크된 순간은 케어 플랜에 나타납니다.
resource_recommendations_question: 리소스 권장사항 표시
index:
subtitle: '여러분의 정신 건강에 영향을 미치는 사건들과 상황들, 경험들을 깊이 파고드세요.'
Expand Down
1 change: 1 addition & 0 deletions config/locales/nb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ nb:
viewers_hint: Allierte som kan se øyeblikket ditt
draft_question: Vil du lagre øyeblikket ditt som ett utkast?
bookmarked_question: Bokmerke dette øyeblikket?
bookmarked_info: Bokmerkede øyeblikk vises i pleieplanen din
resource_recommendations_question: Vise anbefalte ressurser?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ nl:
viewers_hint: Bondgenoten die je moment kunnen bekijken
draft_question: Wil je je moment als concept opslaan?
bookmarked_question: Bookmark dit moment?
bookmarked_info: Gemarkeerde momenten verschijnen in uw zorgplan
resource_recommendations_question: Aanbevolen bronnen weergeven?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ pt-BR:
viewers_hint: 'Aliados que podem ver esse seu momento:'
draft_question: Você quer salvar seu momento com um rascunho?
bookmarked_question: Marcar este momento como favorito?
bookmarked_info: Momentos marcados aparecem no seu Plano de Cuidados
resource_recommendations_question: Mostrar recomendação de recursos?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ sv:
viewers_hint: Allierade som kan se ditt ögonblick
draft_question: Vill du spara ditt ögonblick som ett utkast?
bookmarked_question: Bokmärk det här ögonblicket?
bookmarked_info: Bokmärkta ögonblick visas i din vårdplan
resource_recommendations_question: Visa rekommenderade resurser?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/vi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ vi:
viewers_hint: Những đồng minh có thể xem bình luận của bạn
draft_question: Bạn có muốn lưu lại khoản khắc này như một bản nháp không?
bookmarked_question: Đánh dấu thời điểm này?
bookmarked_info: Những khoảnh khắc được đánh dấu sẽ xuất hiện trong Kế hoạch chăm sóc của bạn
resource_recommendations_question: Hiển thị tài nguyên được đề xuất?
index:
subtitle: >-
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ zh-CN:
viewers_hint: 可以看到你日记的好友
draft_question: 你想将自己的日记分享保存为草稿吗?
bookmarked_question: 将日记加上个书签?
bookmarked_info: 书签时刻出现在您的护理计划中
resource_recommendations_question: 显示资源推荐?
index:
subtitle: 深入分析影响你心理健康的事件和情况。
Expand Down
5 changes: 5 additions & 0 deletions config/webpack/development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove this file!


const environment = require('./environment')

module.exports = environment.toWebpackConfig()
3 changes: 3 additions & 0 deletions config/webpack/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { environment } = require('@rails/webpacker')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove this file!


module.exports = environment
5 changes: 5 additions & 0 deletions config/webpack/production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove this file!


const environment = require('./environment')

module.exports = environment.toWebpackConfig()
5 changes: 5 additions & 0 deletions config/webpack/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove this file!


const environment = require('./environment')

module.exports = environment.toWebpackConfig()
11 changes: 11 additions & 0 deletions spec/requests/care_plan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
expect(response.body).to include(strategy.name)
end
end

context 'when there are bookmarked moments' do
let!(:strategy_bm) { create(:strategy, user: user, bookmarked: true) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should replace the strategy variables with moment ones!

let!(:strategy_no_bm) { create(:strategy, name: 'Not bookmarked', user: user) }

it 'assigns bookmarked_strategies' do
get care_plan_path
expect(response.body).to include(strategy_bm.name)
expect(response.body).to_not include(strategy_no_bm.name)
end
end
end

context 'when user is not signed in' do
Expand Down