-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a2a70e
commit bfad392
Showing
8 changed files
with
156 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<%= turbo_stream.update "metadata_template_modal", | ||
partial: "shared/metadata_templates/edit_template_dialog", | ||
locals: { | ||
open: true, | ||
update_path: | ||
group_metadata_template_path( | ||
@namespace, | ||
@metadata_template, | ||
), | ||
} %> |
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,20 @@ | ||
<%= turbo_stream.update "metadata_template_modal", | ||
partial: "shared/metadata_templates/edit_template_dialog", | ||
locals: { | ||
open: @metadata_template.errors.any? ? true : false, | ||
update_path: | ||
group_metadata_template_path( | ||
@namespace, | ||
@metadata_template, | ||
), | ||
} %> | ||
|
||
<% if !@metadata_template.errors.any? %> | ||
<%= turbo_stream.append "flashes" do %> | ||
<%= viral_flash(type:, data: message) %> | ||
<% end %> | ||
|
||
<% else %> | ||
<%= turbo_stream.update "metadata_template_error_alert", | ||
viral_alert(type:, message:, classes: "mb-4") %> | ||
<% end %> |
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,11 @@ | ||
<%= turbo_stream.update "metadata_template_modal", | ||
partial: "shared/metadata_templates/edit_template_dialog", | ||
locals: { | ||
open: true, | ||
update_path: | ||
namespace_project_metadata_template_path( | ||
@namespace.parent, | ||
@namespace.project, | ||
@metadata_template, | ||
), | ||
} %> |
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,21 @@ | ||
<%= turbo_stream.update "metadata_template_modal", | ||
partial: "shared/metadata_templates/edit_template_dialog", | ||
locals: { | ||
open: @metadata_template.errors.any? ? true : false, | ||
update_path: | ||
namespace_project_metadata_template_path( | ||
@namespace.parent, | ||
@namespace.project, | ||
@metadata_template, | ||
), | ||
} %> | ||
|
||
<% if !@metadata_template.errors.any? %> | ||
<%= turbo_stream.append "flashes" do %> | ||
<%= viral_flash(type:, data: message) %> | ||
<% end %> | ||
|
||
<% else %> | ||
<%= turbo_stream.update "metadata_template_error_alert", | ||
viral_alert(type:, message:, classes: "mb-4") %> | ||
<% end %> |
72 changes: 72 additions & 0 deletions
72
app/views/shared/metadata_templates/_edit_template_dialog.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,72 @@ | ||
<%= viral_dialog(open: open, size: :large) do |dialog| %> | ||
<%= dialog.with_header(title: "Edit Template #{@metadata_template.name}") %> | ||
<%= dialog.with_section do %> | ||
<%= turbo_frame_tag "metadata_template_error_alert" %> | ||
<%= turbo_frame_tag "metadata_template_dialog_content" do %> | ||
<div | ||
data-controller="viral--sortable-lists--two-lists-selection" | ||
data-viral--sortable-lists--two-lists-selection-selected-list-value="selected" | ||
data-viral--sortable-lists--two-lists-selection-available-list-value="available" | ||
data-viral--sortable-lists--two-lists-selection-field-name-value="metadata_template[fields][]" | ||
class="font-normal text-slate-500 dark:text-slate-400" | ||
> | ||
<div class="grid gap-4"> | ||
<%= viral_sortable_lists( | ||
title: t("metadata_templates.new_template_dialog.metadata"), | ||
description: t("metadata_templates.new_template_dialog.description") | ||
) do |sortable_lists| %> | ||
<%= sortable_lists.with_list( | ||
id: "available", | ||
title: t("metadata_templates.new_template_dialog.available"), | ||
list_items: @available_metadata_fields, | ||
group: "metadata_selection", | ||
container_classes: "block mb-1 pr-2 text-sm font-medium", | ||
list_classes: "overflow-y-auto max-w-[356px] min-w-[356px] w-full", | ||
) %> | ||
<%= sortable_lists.with_list( | ||
id: "selected", | ||
title: t("metadata_templates.new_template_dialog.selected"), | ||
list_items: @current_template_fields, | ||
group: "metadata_selection", | ||
container_classes: "block mb-1 text-sm font-medium", | ||
list_classes: "overflow-y-auto max-w-[356px] min-w-[356px] w-full", | ||
) %> | ||
<% end %> | ||
<%= form_for(@metadata_template, url: update_path, method: :patch | ||
) do |form| %> | ||
<div class="grid gap-4"> | ||
<div class="form-field mt-2"> | ||
<%= form.label :name %> | ||
<%= form.text_field :name, | ||
class: "form-control", | ||
required: true, | ||
value: @metadata_template.name %> | ||
</div> | ||
<div class="form-field mt-2"> | ||
<%= form.label :description %> | ||
<%= form.text_area :description, | ||
class: "form-control", | ||
value: @metadata_template.description %> | ||
</div> | ||
<div | ||
class="hidden" | ||
data-viral--sortable-lists--two-lists-selection-target="field" | ||
></div> | ||
<div> | ||
<%= form.submit "Update", | ||
data: { | ||
turbo_frame: "_top", | ||
action: | ||
"click->viral--sortable-lists--two-lists-selection#constructParams", | ||
"viral--sortable-lists--two-lists-selection-target": "submitBtn", | ||
}, | ||
class: "button button--state-primary button--size-default", | ||
disabled: true %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> |