Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DAAExample
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Miguel Ferreiro Díaz
DAAExample
Commits
e9c2ea00
Commit
e9c2ea00
authored
Feb 26, 2019
by
miferreiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deletes name and surname columns from the view of a person's pets
Now there are no columns with repetitive information
parent
2b9622da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
people.js
src/main/webapp/js/view/people.js
+1
-1
pets.js
src/main/webapp/js/view/pets.js
+27
-4
No files found.
src/main/webapp/js/view/people.js
View file @
e9c2ea00
...
@@ -151,7 +151,7 @@ var PeopleView = (function() {
...
@@ -151,7 +151,7 @@ var PeopleView = (function() {
<thead>
\
<thead>
\
<tr class="row">
\
<tr class="row">
\
<th class="col-sm-2">Nombre</th>
\
<th class="col-sm-2">Nombre</th>
\
<th class="col-sm-
3
">Apellido</th>
\
<th class="col-sm-
4
">Apellido</th>
\
<th class="col-sm-5"> </th>
\
<th class="col-sm-5"> </th>
\
</tr>
\
</tr>
\
</thead>
\
</thead>
\
...
...
src/main/webapp/js/view/pets.js
View file @
e9c2ea00
...
@@ -68,12 +68,15 @@ var PetsView = (function() {
...
@@ -68,12 +68,15 @@ var PetsView = (function() {
this
.
initPetsPerson
=
function
(
id
,
person
)
{
this
.
initPetsPerson
=
function
(
id
,
person
)
{
$
(
'#'
+
formContainerId
).
before
(
'<h1 class="display-5 mt-3 mb-3" id="pets-tittle">Mascotas de '
+
person
.
name
+
'</h1>'
);
$
(
'#'
+
formContainerId
).
before
(
'<h1 class="display-5 mt-3 mb-3" id="pets-tittle">Mascotas de '
+
person
.
name
+
' '
+
person
.
surname
+
'</h1>'
);
$
(
'#person-name-th'
).
remove
();
$
(
'#person-surname-th'
).
remove
();
dao
.
listPeoplePets
(
id
,
dao
.
listPeoplePets
(
id
,
function
(
pets
)
{
function
(
pets
)
{
$
.
each
(
pets
,
function
(
key
,
pet
)
{
$
.
each
(
pets
,
function
(
key
,
pet
)
{
appendToTable
(
pet
,
person
);
appendToTable
PetsPerson
(
pet
);
});
});
});
});
...
@@ -196,8 +199,8 @@ var PetsView = (function() {
...
@@ -196,8 +199,8 @@ var PetsView = (function() {
<tr class="row">
\
<tr class="row">
\
<th class="col-sm-2" style="text-align:center;">Nombre</th>
\
<th class="col-sm-2" style="text-align:center;">Nombre</th>
\
<th class="col-sm-2" style="text-align:center;">Especie</th>
\
<th class="col-sm-2" style="text-align:center;">Especie</th>
\
<th class="col-sm-2" style="text-align:center;">Nombre Propietario</th>
\
<th class="col-sm-2" style="text-align:center;"
id="person-name-th"
>Nombre Propietario</th>
\
<th class="col-sm-2" style="text-align:center;">Apellido Propietario</th>
\
<th class="col-sm-2" style="text-align:center;"
id="person-surname-th"
>Apellido Propietario</th>
\
<th class="col-sm-3"> </th>
\
<th class="col-sm-3"> </th>
\
</tr>
\
</tr>
\
</thead>
\
</thead>
\
...
@@ -245,6 +248,20 @@ var PetsView = (function() {
...
@@ -245,6 +248,20 @@ var PetsView = (function() {
</tr>'
;
</tr>'
;
};
};
var
createPetRowPetsPerson
=
function
(
pet
)
{
return
'<tr id="pet-'
+
pet
.
id
+
'" class="row">
\
<td class="namePet col-sm-2" style="text-align:center;">'
+
pet
.
name
+
'</td>
\
<td class="specie col-sm-2" style="text-align:center;">'
+
pet
.
specie
+
'</td>
\
<td style="display:none;" class="idOwner col-sm-3" style="text-align:center;">'
+
pet
.
idOwner
+
'</td>
\
<td class="col-sm-3">
\
<a class="edit btn btn-primary" href="#">Editar</a>
\
<a class="delete btn btn-warning" href="#">Eliminar</a>
\
</td>
\
</tr>'
;
};
var
showErrorMessage
=
function
(
jqxhr
,
textStatus
,
error
)
{
var
showErrorMessage
=
function
(
jqxhr
,
textStatus
,
error
)
{
alert
(
textStatus
+
": "
+
error
);
alert
(
textStatus
+
": "
+
error
);
};
};
...
@@ -265,5 +282,11 @@ var PetsView = (function() {
...
@@ -265,5 +282,11 @@ var PetsView = (function() {
addRowListeners
(
pet
);
addRowListeners
(
pet
);
};
};
var
appendToTablePetsPerson
=
function
(
pet
)
{
$
(
listQuery
+
' > tbody:last'
)
.
append
(
createPetRowPetsPerson
(
pet
));
addRowListeners
(
pet
);
};
return
PetsView
;
return
PetsView
;
})();
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment