-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5811 from MadelineCollier/admin-new-adjustment-re…
…ason [Admin] Create new Adjustment Reasons
- Loading branch information
Showing
8 changed files
with
152 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
admin/app/components/solidus_admin/adjustment_reasons/new/component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<%= turbo_frame_tag :new_adjustment_reason_modal do %> | ||
<%= render component("ui/modal").new(title: t(".title")) do |modal| %> | ||
<%= form_for @adjustment_reason, url: solidus_admin.adjustment_reasons_path, html: { id: form_id } do |f| %> | ||
<div class="flex flex-col gap-6 pb-4"> | ||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %> | ||
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %> | ||
<label class="flex gap-2 items-center"> | ||
<%= render component("ui/forms/checkbox").new( | ||
name: "#{f.object_name}[active]", | ||
value: "1", | ||
checked: f.object.active | ||
) %> | ||
<span class="font-semibold text-xs ml-2"><%= Spree::TaxCategory.human_attribute_name :active %></span> | ||
<%= render component("ui/toggletip").new(text: t(".hints.active")) %> | ||
</label> | ||
</div> | ||
<% modal.with_actions do %> | ||
<form method="dialog"> | ||
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %> | ||
</form> | ||
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= render component("adjustment_reasons/index").new(page: @page) %> |
12 changes: 12 additions & 0 deletions
12
admin/app/components/solidus_admin/adjustment_reasons/new/component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::BaseComponent | ||
def initialize(page:, adjustment_reason:) | ||
@page = page | ||
@adjustment_reason = adjustment_reason | ||
end | ||
|
||
def form_id | ||
dom_id(@adjustment_reason, "#{stimulus_id}_new_adjustment_reason_form") | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
admin/app/components/solidus_admin/adjustment_reasons/new/component.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Add your component translations here. | ||
# Use the translation in the example in your template with `t(".hello")`. | ||
en: | ||
title: "New Adjustment Reason" | ||
cancel: "Cancel" | ||
submit: "Add Adjustment Reason" | ||
hints: | ||
active: "When checked, this adjustment reason will be available for selection when adding adjustments to orders." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters