|
50 | 50 | }
|
51 | 51 | end
|
52 | 52 | let(:strategy_form_inputs_res) do
|
| 53 | + [ |
| 54 | + { |
| 55 | + id: 'strategy_name', |
| 56 | + type: 'text', |
| 57 | + name: 'strategy[name]', |
| 58 | + label: t('common.name'), |
| 59 | + value: strategy.name || nil, |
| 60 | + placeholder: t('strategies.form.name_hint'), |
| 61 | + required: true, |
| 62 | + dark: true |
| 63 | + }, |
| 64 | + { |
| 65 | + id: 'strategy_description', |
| 66 | + type: 'textarea', |
| 67 | + name: 'strategy[description]', |
| 68 | + label: t('strategies.form.describe'), |
| 69 | + value: strategy.description || nil, |
| 70 | + required: true, |
| 71 | + dark: true |
| 72 | + }, |
| 73 | + { |
| 74 | + id: 'strategy_category', |
| 75 | + type: 'quickCreate', |
| 76 | + name: 'strategy[category][]', |
| 77 | + label: t('categories.plural'), |
| 78 | + placeholder: t('common.form.search_by_keywords'), |
| 79 | + checkboxes: category_checkboxes, |
| 80 | + formProps: category_form_inputs_res |
| 81 | + }, |
| 82 | + get_viewers_input(viewers, 'strategy', 'strategies', strategy), |
| 83 | + { |
| 84 | + id: 'strategy_comment', |
| 85 | + type: 'switch', |
| 86 | + name: 'strategy[comment]', |
| 87 | + label: t('comment.allow_comments'), |
| 88 | + value: true, |
| 89 | + uncheckedValue: false, |
| 90 | + checked: strategy.comment, |
| 91 | + info: t('comment.hint'), |
| 92 | + dark: true |
| 93 | + }, |
| 94 | + { |
| 95 | + id: 'strategy_publishing', |
| 96 | + type: 'switch', |
| 97 | + label: t('strategies.form.draft_question'), |
| 98 | + dark: true, |
| 99 | + name: 'publishing', |
| 100 | + value: '0', |
| 101 | + uncheckedValue: '1', |
| 102 | + checked: strategy.published? |
| 103 | + }, |
| 104 | + { id: 'strategy_visible', |
| 105 | + type: 'switch', |
| 106 | + label: t('shared.stats.make_visible_in_stats'), |
| 107 | + dark: true, |
| 108 | + name: 'strategy[visible]', |
| 109 | + value: true, |
| 110 | + uncheckedValue: false, |
| 111 | + checked: strategy.visible |
| 112 | + }, |
| 113 | + { |
| 114 | + checked: false, |
| 115 | + dark: true, |
| 116 | + id: 'strategy_bookmarked', |
| 117 | + info: 'Bookmarked strategies appear in your Care Plan', label: 'Bookmark this strategy?', |
| 118 | + name: 'strategy[bookmarked]', |
| 119 | + type: 'switch', |
| 120 | + uncheckedValue: false, |
| 121 | + value: true |
| 122 | + }, |
| 123 | + { |
| 124 | + id: 'strategy_perform_strategy_reminder', |
| 125 | + type: 'checkbox', |
| 126 | + name: 'strategy[perform_strategy_reminder_attributes][active]', |
| 127 | + label: t('common.daily_reminder'), |
| 128 | + info: t('strategies.form.daily_reminder_hint'), |
| 129 | + value: true, |
| 130 | + uncheckedValue: false, |
| 131 | + checked: strategy&.perform_strategy_reminder&.active, |
| 132 | + dark: true |
| 133 | + }, |
| 134 | + { |
| 135 | + id: 'strategy_perform_strategy_reminder_attributes_id', |
| 136 | + name: 'strategy[perform_strategy_reminder_attributes][id]', |
| 137 | + type: 'hidden', |
| 138 | + value: strategy&.perform_strategy_reminder&.id |
| 139 | + } |
| 140 | + ] |
| 141 | + end |
| 142 | + let(:strategy_form_inputs_edit_res) do |
53 | 143 | [
|
54 | 144 | {
|
55 | 145 | id: 'strategy_name',
|
|
177 | 267 | it 'returns correct props' do
|
178 | 268 | expect(subject).to eq(
|
179 | 269 | edit_form_props(
|
180 |
| - strategy_form_inputs_res, |
| 270 | + strategy_form_inputs_edit_res, |
181 | 271 | "/strategies/#{strategy.slug}"
|
182 | 272 | )
|
183 | 273 | )
|
|
0 commit comments