+ data-goal-form-target="avatarPreview">
<% if form.object.icon.present? %>
<%= icon(form.object.icon, color: "current", size: "md") %>
<% elsif form.object.name.present? %>
diff --git a/app/views/goals/_form.html.erb b/app/views/goals/_form.html.erb
new file mode 100644
index 000000000..ac64c468e
--- /dev/null
+++ b/app/views/goals/_form.html.erb
@@ -0,0 +1,89 @@
+<%# locals: (goal:, linkable_accounts:, currently_linked_account_ids: []) %>
+
+"
+ data-goal-form-suggested-no-date-value="<%= t("goals.form.suggested_no_date") %>">
+ <% if goal.errors[:base].any? %>
+ <%= render "shared/form_errors", model: goal %>
+ <% end %>
+
+ <%= styled_form_with model: goal,
+ url: goal.persisted? ? goal_path(goal) : goals_path,
+ method: goal.persisted? ? :patch : :post,
+ class: "space-y-5" do |f| %>
+
+ <%= render "color_picker", form: f, colors: Goal::COLORS, icons: Goal::ICONS %>
+
+
+
+ <%= f.text_field :name,
+ placeholder: t("goals.form.fields.name_placeholder"),
+ autofocus: true,
+ required: true,
+ label: t("goals.form.fields.name"),
+ data: { goal_form_target: "nameInput", action: "input->goal-form#nameChanged" } %>
+
<%= t("goals.form.errors.name_required") %>
+
+
+
+
+ <%= f.money_field :target_amount,
+ label: t("goals.form.fields.target_amount"),
+ hide_currency: true,
+ required: true,
+ amount_data: { goal_form_target: "amountInput", action: "input->goal-form#suggestedChanged" } %>
+
<%= t("goals.form.errors.amount_required") %>
+
+ <%= f.date_field :target_date,
+ label: t("goals.form.fields.target_date"),
+ data: { goal_form_target: "dateInput", action: "input->goal-form#suggestedChanged" } %>
+
+
+
+
+
+
+
<%= t("goals.form.fields.funding_accounts") %>
+
<%= t("goals.form.fields.funding_accounts_hint") %>
+
+
+ <% grouped = linkable_accounts.group_by { |a| a.subtype.to_s.presence || "other" } %>
+ <% grouped.each_with_index do |(subtype, accts), group_idx| %>
+
<%= t("goals.form.subtypes.#{subtype}", default: subtype.titleize) %>
+
">
+ <% accts.each_with_index do |account, idx| %>
+
+ <% end %>
+
+ <% end %>
+
+
<%= t("goals.form.errors.accounts_required") %>
+
+
+ <%= f.text_area :notes,
+ label: t("goals.form.fields.notes"),
+ rows: 2,
+ placeholder: t("goals.form.fields.notes_placeholder") %>
+
+
+ <%= f.submit goal.persisted? ? t("goals.form.save") : t("goals.form.create") %>
+
+ <% end %>
+
diff --git a/app/views/goals/_form_edit.html.erb b/app/views/goals/_form_edit.html.erb
deleted file mode 100644
index 784c8e645..000000000
--- a/app/views/goals/_form_edit.html.erb
+++ /dev/null
@@ -1,64 +0,0 @@
-<%# locals: (goal:, linkable_accounts:, currently_linked_account_ids:) %>
-
-<% if goal.errors.any? %>
- <%= render "shared/form_errors", model: goal %>
-<% end %>
-
-<%= styled_form_with model: goal,
- url: goal_path(goal),
- method: :patch,
- class: "space-y-3" do |f| %>
-
- <%= render "color_picker", form: f, colors: Goal::COLORS, icons: Goal::ICONS %>
-
-
- <%= f.text_field :name,
- label: t("goals.form_stepper.step1.fields.name"),
- required: true,
- autofocus: true %>
-
- <%= f.money_field :target_amount,
- label: t("goals.form_stepper.step1.fields.target_amount"),
- required: true %>
-
- <%= f.date_field :target_date,
- label: t("goals.form_stepper.step1.fields.target_date") %>
-
-
-
-
<%= t("goals.form_stepper.step1.fields.funding_accounts") %>
-
<%= t("goals.form_stepper.step1.fields.funding_accounts_hint") %>
-
-
- <% grouped = linkable_accounts.group_by { |a| a.subtype.to_s.presence || "other" } %>
- <% grouped.each_with_index do |(subtype, accts), group_idx| %>
-
<%= t("goals.form_stepper.step1.subtypes.#{subtype}", default: subtype.titleize) %>
-
">
- <% accts.each_with_index do |account, idx| %>
-
- <% end %>
-
- <% end %>
-
-
-
- <%= f.text_area :notes,
- label: t("goals.form_stepper.step1.fields.notes"),
- rows: 2 %>
-
-
- <%= f.submit t("goals.edit.save") %>
-
-<% end %>
diff --git a/app/views/goals/_form_stepper.html.erb b/app/views/goals/_form_stepper.html.erb
deleted file mode 100644
index a9cb8481d..000000000
--- a/app/views/goals/_form_stepper.html.erb
+++ /dev/null
@@ -1,157 +0,0 @@
-<%# locals: (goal:, linkable_accounts:) %>
-
-"
- data-goal-stepper-summary-no-date-value="<%= t("goals.form_stepper.step2.review.summary_no_date") %>"
- data-goal-stepper-account-count-one-value="<%= t("goals.form_stepper.step2.review.account_count.one") %>"
- data-goal-stepper-account-count-other-value="<%= t("goals.form_stepper.step2.review.account_count.other") %>"
- data-goal-stepper-suggested-with-date-value="<%= t("goals.form_stepper.step2.review.suggested_with_date") %>"
- data-goal-stepper-suggested-no-date-value="<%= t("goals.form_stepper.step2.review.suggested_no_date") %>">
- <% if goal.errors[:base].any? %>
- <%= render "shared/form_errors", model: goal %>
- <% end %>
-
- <%# Connected stepper %>
-
-
- 1
- <%= t("goals.form_stepper.step1.label") %>
-
-
-
- 2
- <%= t("goals.form_stepper.step2.label") %>
-
-
-
- <%= styled_form_with model: goal, url: goals_path, class: "space-y-4", data: { action: "keydown.enter->goal-stepper#blockEnter" } do |f| %>
-
-
-
<%= t("goals.form_stepper.step1.heading") %>
-
<%= t("goals.form_stepper.step1.subheading") %>
-
-
-
- <%= render "color_picker", form: f, colors: Goal::COLORS, icons: Goal::ICONS %>
-
-
-
- <%= f.text_field :name,
- placeholder: t("goals.form_stepper.step1.fields.name_placeholder"),
- autofocus: true,
- label: t("goals.form_stepper.step1.fields.name"),
- data: { goal_stepper_target: "nameInput", action: "input->goal-stepper#nameChanged" } %>
-
<%= t("goals.form_stepper.errors.name_required") %>
-
-
-
-
- <%= f.money_field :target_amount,
- label: t("goals.form_stepper.step1.fields.target_amount"),
- hide_currency: true,
- amount_data: { goal_stepper_target: "amountInput", action: "input->goal-stepper#amountChanged" } %>
-
<%= t("goals.form_stepper.errors.amount_required") %>
-
- <%= f.date_field :target_date,
- label: t("goals.form_stepper.step1.fields.target_date") %>
-
-
-
-
-
<%= t("goals.form_stepper.step1.fields.funding_accounts") %>
-
<%= t("goals.form_stepper.step1.fields.funding_accounts_hint") %>
-
-
- <% grouped = linkable_accounts.group_by { |a| a.subtype.to_s.presence || "other" } %>
- <% grouped.each_with_index do |(subtype, accts), group_idx| %>
-
<%= t("goals.form_stepper.step1.subtypes.#{subtype}", default: subtype.titleize) %>
-
">
- <% accts.each_with_index do |account, idx| %>
-
- <% end %>
-
- <% end %>
-
-
<%= t("goals.form_stepper.errors.accounts_required") %>
-
-
- <%= render DS::Disclosure.new(title: t("goals.form_stepper.step1.fields.notes_summary"), align: "right") do %>
- <%= f.text_area :notes,
- label: t("goals.form_stepper.step1.fields.notes"),
- rows: 3,
- placeholder: t("goals.form_stepper.step1.fields.notes_placeholder") %>
- <% end %>
-
-
-
-
-
-
<%= t("goals.form_stepper.step2.heading") %>
-
<%= t("goals.form_stepper.step2.subheading") %>
-
-
-
-
- <%= render DS::FilledIcon.new(variant: :container, icon: "target", size: "lg", rounded: false) %>
-
-
-
-
…
-
-
-
-
-
- <%= render DS::Button.new(
- variant: "ghost",
- text: t("goals.form_stepper.back"),
- icon: "arrow-left",
- icon_position: :left,
- data: {
- action: "click->goal-stepper#footerLeft"
- }
- ) %>
-
-
- <%= render DS::Button.new(
- text: t("goals.form_stepper.continue"),
- variant: "primary",
- icon: "arrow-right",
- icon_position: :right,
- data: {
- goal_stepper_target: "footerRightButton",
- action: "click->goal-stepper#footerRight"
- }
- ) %>
-
-
-
- <% end %>
-
diff --git a/app/views/goals/edit.html.erb b/app/views/goals/edit.html.erb
index 68d17ba25..de4628c7c 100644
--- a/app/views/goals/edit.html.erb
+++ b/app/views/goals/edit.html.erb
@@ -1,6 +1,6 @@
<%= render DS::Dialog.new do |dialog| %>
<% dialog.with_header(title: t(".heading")) %>
<% dialog.with_body do %>
- <%= render "form_edit", goal: @goal, linkable_accounts: @linkable_accounts, currently_linked_account_ids: @currently_linked_account_ids %>
+ <%= render "form", goal: @goal, linkable_accounts: @linkable_accounts, currently_linked_account_ids: @currently_linked_account_ids %>
<% end %>
<% end %>
diff --git a/app/views/goals/new.html.erb b/app/views/goals/new.html.erb
index 0f673e668..fb4162f45 100644
--- a/app/views/goals/new.html.erb
+++ b/app/views/goals/new.html.erb
@@ -6,16 +6,14 @@
<%= render DS::FilledIcon.new(variant: :container, icon: "target", size: "md", rounded: true) %>
<%= t(".heading") %>
-
- <%= t(".step1_subtitle") %>
-
+
<%= t(".subtitle") %>
<%= render DS::Button.new(variant: "icon", icon: "x", title: t("common.close"), aria_label: t("common.close"), data: { action: "DS--dialog#close" }) %>
<% end %>
<% dialog.with_body do %>
- <%= render "form_stepper", goal: @goal, linkable_accounts: @linkable_accounts %>
+ <%= render "form", goal: @goal, linkable_accounts: @linkable_accounts %>
<% end %>
<% end %>
<% else %>
@@ -24,11 +22,9 @@
<%= render DS::FilledIcon.new(variant: :container, icon: "target", size: "md", rounded: true) %>
<%= t(".heading") %>
-
- <%= t(".step1_subtitle") %>
-
+
<%= t(".subtitle") %>
- <%= render "form_stepper", goal: @goal, linkable_accounts: @linkable_accounts %>
+ <%= render "form", goal: @goal, linkable_accounts: @linkable_accounts %>
<% end %>
diff --git a/config/locales/views/goals/en.yml b/config/locales/views/goals/en.yml
index 46ee5e1c9..031633272 100644
--- a/config/locales/views/goals/en.yml
+++ b/config/locales/views/goals/en.yml
@@ -65,8 +65,7 @@ en:
completed: Completed
new:
heading: New goal
- step1_subtitle: Step 1 of 2 · Goal details
- step2_subtitle: Step 2 of 2 · Review & start
+ subtitle: Save toward something specific.
edit:
heading: Edit goal
save: Save changes
@@ -242,46 +241,29 @@ en:
footer_last_days:
one: Last pledge matched 1 day ago
other: "Last pledge matched %{count} days ago"
- form_stepper:
- cancel: Cancel
- continue: Continue
- back: Back
- submit: Create goal
+ form:
+ create: Create goal
+ save: Save changes
+ suggested_with_date: "Save {monthly}/mo across {accounts} to hit it on time."
+ suggested_no_date: Set a target date to project a finish line.
errors:
name_required: Give your goal a name.
amount_required: Set a target above zero.
accounts_required: Pick at least one funding account.
- step1:
- label: Goal details
- heading: What are you saving for?
- subheading: Give your goal a name and a target. You can change these later.
- fields:
- name: Name
- name_placeholder: Emergency fund, House down payment…
- target_amount: Target amount
- target_date: Target date
- color: Color
- notes: Notes (optional)
- notes_summary: Add notes (optional)
- notes_placeholder: A reminder for future you…
- funding_accounts: Funding accounts
- funding_accounts_hint: This goal's balance is the balance of these accounts.
- subtypes:
- checking: Checking
- savings: Savings
- hsa: HSA
- cd: CD
- money_market: Money market
- other: Other
- step2:
- label: Review & start
- heading: Looks good?
- subheading: Review your goal and confirm.
- review:
- summary_with_date: "{amount} by {date}"
- summary_no_date: "{amount}"
- account_count:
- one: 1 account
- other: "{count} accounts"
- suggested_with_date: "Save {monthly}/mo across {accounts} to hit it on time."
- suggested_no_date: Set a target date to project a finish line.
+ fields:
+ name: Name
+ name_placeholder: Emergency fund, House down payment…
+ target_amount: Target amount
+ target_date: Target date
+ color: Color
+ notes: Notes (optional)
+ notes_placeholder: A reminder for future you…
+ funding_accounts: Funding accounts
+ funding_accounts_hint: This goal's balance is the balance of these accounts.
+ subtypes:
+ checking: Checking
+ savings: Savings
+ hsa: HSA
+ cd: CD
+ money_market: Money market
+ other: Other