-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reformat: reformat instrument detail code
- Loading branch information
1 parent
9f17515
commit b6334b6
Showing
4 changed files
with
227 additions
and
227 deletions.
There are no files selected for viewing
118 changes: 59 additions & 59 deletions
118
web-app/django/VIM/apps/instruments/static/instruments/css/detail.css
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,97 +1,97 @@ | ||
.instrument-detail { | ||
display: flex; | ||
flex-wrap: nowrap; | ||
align-items: center; | ||
flex-direction: column; | ||
padding: 50px; | ||
display: flex; | ||
flex-wrap: nowrap; | ||
align-items: center; | ||
flex-direction: column; | ||
padding: 50px; | ||
} | ||
.detail-header { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-start; | ||
flex-wrap: wrap; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-start; | ||
flex-wrap: wrap; | ||
width: 100%; | ||
} | ||
.detail-header hr { | ||
width: 100%; | ||
width: 100%; | ||
} | ||
.detail-body { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
justify-content: space-evenly; | ||
align-items: flex-start; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
justify-content: space-evenly; | ||
align-items: flex-start; | ||
width: 100%; | ||
} | ||
.detail-image { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
} | ||
.instrument-image { | ||
max-width: 50%; | ||
margin-right: 10px; | ||
max-width: 50%; | ||
margin-right: 10px; | ||
} | ||
.detail-image-caption { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
} | ||
.instrument-forms { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
justify-content: flex-start; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
justify-content: flex-start; | ||
width: 100%; | ||
} | ||
.name-form-item { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: space-between; | ||
align-items: center; | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
.name-field { | ||
width: 90%; | ||
width: 90%; | ||
} | ||
input.edit-field { | ||
width: inherit; | ||
width: inherit; | ||
} | ||
th[scope="col"] { | ||
width: 30%; | ||
width: 30%; | ||
} | ||
th[scope="row"] { | ||
width: 20%; | ||
width: 20%; | ||
} | ||
.button-group { | ||
display:flex; | ||
flex-direction: row; | ||
display:flex; | ||
flex-direction: row; | ||
} | ||
.edit-field, .btn.cancel, .btn.publish { | ||
display: none; | ||
display: none; | ||
} | ||
.btn { | ||
display: inline-block; | ||
padding: 5px 10px; | ||
cursor: pointer; | ||
text-align: center; | ||
text-decoration: none; | ||
outline: none; | ||
color: #fff; | ||
border: none; | ||
border-radius: 3px; | ||
margin-right: 5px; | ||
display: inline-block; | ||
padding: 5px 10px; | ||
cursor: pointer; | ||
text-align: center; | ||
text-decoration: none; | ||
outline: none; | ||
color: #fff; | ||
border: none; | ||
border-radius: 3px; | ||
margin-right: 5px; | ||
} | ||
.btn.edit { | ||
background-color: #ffc107; | ||
background-color: #ffc107; | ||
} | ||
.btn.cancel { | ||
background-color: #dc3545; | ||
background-color: #dc3545; | ||
} | ||
.btn.publish { | ||
background-color: #28a745; | ||
background-color: #28a745; | ||
} |
6 changes: 3 additions & 3 deletions
6
web-app/django/VIM/apps/instruments/static/instruments/css/index.css
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,9 +1,9 @@ | ||
@import url('https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css'); | ||
|
||
h2 { | ||
color: #435334; | ||
font-size: 30px; | ||
font-weight: 800; | ||
color: #435334; | ||
font-size: 30px; | ||
font-weight: 800; | ||
} | ||
|
||
h4 { | ||
|
70 changes: 35 additions & 35 deletions
70
web-app/django/VIM/apps/instruments/static/instruments/js/InstrumentDetail.js
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,42 +1,42 @@ | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
const editButtons = document.querySelectorAll('.btn.edit'); | ||
const cancelButtons = document.querySelectorAll('.btn.cancel'); | ||
const publishButtons = document.querySelectorAll('.btn.publish'); | ||
|
||
editButtons.forEach(button => { | ||
button.addEventListener('click', function() { | ||
const parentTd = this.closest('td'); | ||
parentTd.querySelector('.view-field').style.display = 'none'; | ||
parentTd.querySelector('.edit-field').style.display = 'inline-block'; | ||
parentTd.querySelector('.btn.cancel').style.display = 'inline-block'; | ||
parentTd.querySelector('.btn.publish').style.display = 'inline-block'; | ||
this.style.display = 'none'; | ||
}); | ||
const editButtons = document.querySelectorAll('.btn.edit'); | ||
const cancelButtons = document.querySelectorAll('.btn.cancel'); | ||
const publishButtons = document.querySelectorAll('.btn.publish'); | ||
|
||
editButtons.forEach(button => { | ||
button.addEventListener('click', function() { | ||
const parentTd = this.closest('td'); | ||
parentTd.querySelector('.view-field').style.display = 'none'; | ||
parentTd.querySelector('.edit-field').style.display = 'inline-block'; | ||
parentTd.querySelector('.btn.cancel').style.display = 'inline-block'; | ||
parentTd.querySelector('.btn.publish').style.display = 'inline-block'; | ||
this.style.display = 'none'; | ||
}); | ||
cancelButtons.forEach(button => { | ||
button.addEventListener('click', function() { | ||
const parentTd = this.closest('td'); | ||
parentTd.querySelector('.view-field').style.display = 'inline'; | ||
parentTd.querySelector('.edit-field').style.display = 'none'; | ||
parentTd.querySelector('.btn.edit').style.display = 'inline-block'; | ||
parentTd.querySelector('.btn.publish').style.display = 'none'; | ||
this.style.display = 'none'; | ||
}); | ||
}); | ||
|
||
cancelButtons.forEach(button => { | ||
button.addEventListener('click', function() { | ||
const parentTd = this.closest('td'); | ||
parentTd.querySelector('.view-field').style.display = 'inline'; | ||
parentTd.querySelector('.edit-field').style.display = 'none'; | ||
parentTd.querySelector('.btn.edit').style.display = 'inline-block'; | ||
parentTd.querySelector('.btn.publish').style.display = 'none'; | ||
this.style.display = 'none'; | ||
}); | ||
}); | ||
|
||
publishButtons.forEach(button => { | ||
button.addEventListener('click', function() { | ||
const parentTd = this.closest('td'); | ||
const newValue = parentTd.querySelector('.edit-field').value; | ||
// TODO: request to update the value on the server | ||
parentTd.querySelector('.view-field').textContent = newValue; | ||
parentTd.querySelector('.view-field').style.display = 'inline'; | ||
parentTd.querySelector('.edit-field').style.display = 'none'; | ||
parentTd.querySelector('.btn.edit').style.display = 'inline-block'; | ||
this.style.display = 'none'; | ||
parentTd.querySelector('.btn.cancel').style.display = 'none'; | ||
}); | ||
publishButtons.forEach(button => { | ||
button.addEventListener('click', function() { | ||
const parentTd = this.closest('td'); | ||
const newValue = parentTd.querySelector('.edit-field').value; | ||
// TODO: request to update the value on the server | ||
parentTd.querySelector('.view-field').textContent = newValue; | ||
parentTd.querySelector('.view-field').style.display = 'inline'; | ||
parentTd.querySelector('.edit-field').style.display = 'none'; | ||
parentTd.querySelector('.btn.edit').style.display = 'inline-block'; | ||
this.style.display = 'none'; | ||
parentTd.querySelector('.btn.cancel').style.display = 'none'; | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.