forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Update nested form input component design #284
Merged
syphax-bouazzouni
merged 7 commits into
development
from
feature/update-nested-from-input-component-design
Jul 12, 2023
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d0212fd
update nested form input component design
syphax-bouazzouni 43a9241
add header slot to the nested form input component
syphax-bouazzouni 0d244b1
add nested form input component preview
syphax-bouazzouni cdf3666
add margin-top to the add new object button in nested form component
Bilelkihal 5757879
Merge branch 'development' into feature/update-nested-from-input-comp…
syphax-bouazzouni 9c5456c
remove unsed text in NestedFormInputComponentPreview
syphax-bouazzouni 4272999
Merge remote-tracking branch 'origin/feature/update-nested-from-input…
syphax-bouazzouni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,50 @@ | ||
.nested-form-input-container .titles{ | ||
display: flex; | ||
font-size: 11px; | ||
color: #666666; | ||
margin-bottom: 5px; | ||
width: 90%; | ||
} | ||
|
||
|
||
.nested-form-input-container input:focus{ | ||
border: 1px solid #31B404 !important; | ||
} | ||
|
||
.nested-form-input-container .delete{ | ||
display: flex; | ||
border: 1px dashed #BDBDBD; | ||
justify-content: center; | ||
align-items: center; | ||
height: 43px; | ||
width: 43px; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
.nested-form-input-container .add-another-object{ | ||
border: 1px dashed #BDBDBD; | ||
border-radius: 5px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 10px; | ||
cursor: pointer; | ||
margin-top: 10px; | ||
} | ||
.nested-form-input-container svg path{ | ||
fill: #DADADA; | ||
} | ||
.nested-form-input-container .add-another-object div{ | ||
color: #DADADA; | ||
margin-left: 10px; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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: 13 additions & 11 deletions
24
app/components/nested_form_inputs_component/nested_form_inputs_component.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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
%div{data: {controller: "nested-form"}} | ||
%div.nested-form-input-container{data: {controller: "nested-form"}} | ||
%template{'data-nested-form-target':"template"} | ||
%div.d-flex.align-items-center.nested-form-wrapper{'data-new-record': 'true'} | ||
%div.d-flex.align-items-center.nested-form-wrapper.my-1{'data-new-record': 'true'} | ||
%div{style: 'width: 90%'} | ||
= template | ||
%div.d-flex.justify-content-end{style: 'width: 10%'} | ||
%button.btn.btn-danger{data: {action:"nested-form#remove"}} | ||
%i.fas.fa-minus.fa-lg | ||
%div.delete{data: {action:"click->nested-form#remove"}} | ||
= inline_svg 'icons/delete.svg' | ||
%div.titles | ||
= header | ||
- rows.each_with_index do |row , index| | ||
%div.d-flex.align-items-center.nested-form-wrapper{'data-new-record': 'true'} | ||
%div.d-flex.align-items-center.nested-form-wrapper.my-1{'data-new-record': 'true'} | ||
%div{style: 'width: 90%'} | ||
= row | ||
%div.d-flex.justify-content-end{style: 'width: 10%'} | ||
- unless index == 0 | ||
%button.btn.btn-danger{data: {action:"nested-form#remove"}} | ||
%i.fas.fa-minus.fa-lg | ||
%div.delete{data: {action:"click->nested-form#remove"}} | ||
= inline_svg 'icons/delete.svg' | ||
|
||
%div{'data-nested-form-target': "target"} | ||
%div.float-right | ||
%button.btn.btn-success{data: {action:"nested-form#add"}} | ||
%i.fas.fa-plus.fa-lg | ||
%div.add-another-object{data: {action:"click->nested-form#add"}} | ||
= inline_svg 'icons/plus.svg' | ||
%div | ||
Add another #{@object_name} |
24 changes: 24 additions & 0 deletions
24
test/components/previews/nested_form_input_component_preview.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,24 @@ | ||
class NestedFormInputComponentPreview < ViewComponent::Preview | ||
|
||
include ActionView::Helpers::TagHelper | ||
include ActionView::Helpers::FormTagHelper | ||
|
||
# @param object_name text | ||
def default(object_name: 'contact') | ||
render NestedFormInputsComponent.new(object_name: object_name) do |c| | ||
c.header do | ||
content_tag(:div, 'Contact name', class: 'w-50 mx-1') + content_tag(:div, 'Contact email', class: 'w-50 mx-1') | ||
end | ||
|
||
c.template do | ||
syphax-bouazzouni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
raw "<div class='d-flex'> <input class='form-control w-50 mx-1'/> <input class='form-control w-50 mx-1'/></div>".html_safe | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def long_text | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to remove |
||
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use var(--primary-color) instead of fixed color