forked from openSUSE/open-build-service
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
8 changed files
with
64 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.error-message { | ||
color: var(--bs-danger-text-emphasis); | ||
} |
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,9 @@ | ||
module Webui::ValidationHelper | ||
def classes_with_validation(model, field) | ||
if model.errors.where(field).any? | ||
'form-control is-invalid' | ||
else | ||
'form-control' | ||
end | ||
end | ||
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 |
---|---|---|
|
@@ -6,6 +6,14 @@ def index? | |
true | ||
end | ||
|
||
def new? | ||
index? | ||
end | ||
|
||
def create? | ||
index? | ||
end | ||
|
||
def edit? | ||
index? | ||
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
24 changes: 24 additions & 0 deletions
24
src/api/app/views/webui/projects/label_templates/new.html.haml
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,24 @@ | ||
- @pagetitle = "Create label template for #{@project}" | ||
.card | ||
= render(partial: 'webui/project/tabs', locals: { project: @project }) | ||
|
||
.card-body | ||
%h3= @pagetitle | ||
.row | ||
.col-12.col-md-10.col-lg-8 | ||
= form_with(model: @label_template, url: [@project, @label_template], method: :post) do |f| | ||
.row | ||
.col-12.col-md-10.col-lg-9 | ||
.mb-3#name | ||
= f.label(:name, 'Name:', class: 'form-label') | ||
= f.text_field(:name, class: classes_with_validation(@label_template, :name)) | ||
- @label_template.errors.where(:name).each do |error| | ||
.error-message= error.message.capitalize | ||
.mb-3#color | ||
= f.label(:color, 'Color:', class: 'form-label') | ||
= f.color_field(:color, class: classes_with_validation(@label_template, :color)) | ||
- @label_template.errors.where(:color).each do |error| | ||
.error-message= error.message.capitalize | ||
.actions | ||
= link_to('Cancel', project_label_templates_path(@project), title: 'Cancel', class: 'btn btn-outline-secondary px-4 me-3 mt-3 mt-sm-0') | ||
= f.submit('Create', class: 'btn btn-primary px-4 mt-3 mt-sm-0') |
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