-
-
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 #5697 from nebulab/spaghetticode/update-tax-category
[Admin] Add Update Tax Category feature
- Loading branch information
Showing
7 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
admin/app/components/solidus_admin/tax_categories/edit/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,28 @@ | ||
<%= turbo_frame_tag :edit_tax_category_modal do %> | ||
<%= render component("ui/modal").new(title: t(".title")) do |modal| %> | ||
<%= form_for @tax_category, url: solidus_admin.tax_category_path(@tax_category), html: { id: form_id } do |f| %> | ||
<div class="flex flex-col gap-6 pb-4"> | ||
<%= render component("ui/forms/field").text_field(f, :name) %> | ||
<%= render component("ui/forms/field").text_field(f, :tax_code) %> | ||
<%= render component("ui/forms/field").text_field(f, :description) %> | ||
<label class="flex gap-2 items-center"> | ||
<%= render component("ui/forms/checkbox").new( | ||
name: "#{f.object_name}[is_default]", | ||
value: "1", | ||
checked: f.object.is_default | ||
) %> | ||
<span class="font-semibold text-xs ml-2"><%= Spree::TaxCategory.human_attribute_name :is_default %></span> | ||
<%= render component("ui/toggletip").new(text: t(".hints.is_default")) %> | ||
</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("tax_categories/index").new(page: @page) %> |
12 changes: 12 additions & 0 deletions
12
admin/app/components/solidus_admin/tax_categories/edit/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::TaxCategories::Edit::Component < SolidusAdmin::TaxCategories::Index::Component | ||
def initialize(page:, tax_category:) | ||
@page = page | ||
@tax_category = tax_category | ||
end | ||
|
||
def form_id | ||
dom_id(@tax_category, "#{stimulus_id}_edit_tax_category_form") | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
admin/app/components/solidus_admin/tax_categories/edit/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: "Edit Tax Category" | ||
cancel: "Cancel" | ||
submit: "Update Tax Category" | ||
hints: | ||
is_default: "When checked, this tax category will be selected by default when creating new products or variants." |
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