Skip to content

Commit

Permalink
2143 - display bookmarked moments in care plan (#2154)
Browse files Browse the repository at this point in the history
* 2143 - bm moments display in care plan

* Delete application.js

* Delete development.js

* Delete environment.js

* Delete production.js

* Delete test.js

* fix typo replace strategy with moment

* fix moments bookmark while create
  • Loading branch information
yasirazgar committed Oct 11, 2022
1 parent 46ce2f1 commit a12a327
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 1 deletion.
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
4 changes: 3 additions & 1 deletion app/helpers/moments_form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def moment_bookmarked
'bookmarked', 'switch', 'moments.form.bookmarked_question'
).merge(
value: true, uncheckedValue: false,
checked: @moment.bookmarked, dark: true
checked: params[:bookmarked] ? true : @moment.bookmarked,
dark: true,
info: t('moments.form.bookmarked_info')
)
end

Expand Down
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 @@ -364,6 +364,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 @@ -334,6 +334,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 @@ -349,6 +349,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 @@ -360,6 +360,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 @@ -338,6 +338,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 @@ -341,6 +341,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 @@ -347,6 +347,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 @@ -320,6 +320,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 @@ -338,6 +338,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 @@ -343,6 +343,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 @@ -351,6 +351,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 @@ -345,6 +345,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 @@ -344,6 +344,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 @@ -316,6 +316,7 @@ zh-CN:
viewers_hint: 可以看到你日记的好友
draft_question: 你想将自己的日记分享保存为草稿吗?
bookmarked_question: 将日记加上个书签?
bookmarked_info: 书签时刻出现在您的护理计划中
resource_recommendations_question: 显示资源推荐?
index:
subtitle: 深入分析影响你心理健康的事件和情况。
Expand Down
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!(:moment_bm) { create(:moment, user: user, bookmarked: true) }
let!(:moment_no_bm) { create(:moment, name: 'Not bookmarked', user: user) }

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

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

0 comments on commit a12a327

Please sign in to comment.