Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Bojan Borovcanin
/
WBT1920_team30
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1ce2d736
authored
May 11, 2020
by
Bojan Borovcanin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add apartment
parent
3198024e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
test/views/pages/addNewApartment.php
test/views/pages/addNewApartment.php
View file @
1ce2d736
...
...
@@ -17,7 +17,7 @@
<body>
<form
action=
"
<?php
echo
base_url
();
?>
pages/addNewApartment"
id=
"form_add_new_apartment"
method=
"post"
>
<form
action=
"
<?php
echo
base_url
();
?>
pages/addNewApartment"
id=
"form_add_new_apartment"
method=
"post"
enctype=
"multipart/form-data"
>
<label
>
Title of the new apartment:
</label>
<br>
...
...
@@ -59,7 +59,49 @@
<br>
<input
type=
"text"
name=
"email"
placeholder=
"Title"
>
<div
class=
"errors"
>
<?php
echo
form_error
(
'email'
);
?>
</div>
<br>
<br>
<div
>
<?php
echo
form_error
(
'inpImage'
);
?>
</div>
<div
>
<div
class=
"imagePreview"
id=
"imagePreview"
>
<img
src=
""
alt=
"Image preview"
class=
"image-preview__image"
>
<span
class=
"image-preview__default-text"
>
Image preview
</span>
</div>
<br>
<input
type=
"file"
name=
"inpImage"
id=
"inpImage"
>
</div>
<script>
const
inpImage
=
document
.
getElementById
(
"inpImage"
);
const
previewContainer
=
document
.
getElementById
(
"imagePreview"
);
const
previewImage
=
previewContainer
.
querySelector
(
".image-preview__image"
);
const
previewDefaultText
=
previewContainer
.
querySelector
(
".image-preview__default-text"
);
inpImage
.
addEventListener
(
"change"
,
function
(){
const
file
=
this
.
files
[
0
];
if
(
file
)
{
const
reader
=
new
FileReader
();
previewDefaultText
.
style
.
display
=
"none"
;
previewImage
.
style
.
display
=
"block"
;
reader
.
addEventListener
(
"load"
,
function
(){
previewImage
.
setAttribute
(
"src"
,
this
.
result
);
});
reader
.
readAsDataURL
(
file
);
}
else
{
previewDefaultText
.
style
.
display
=
null
;
previewImage
.
style
.
display
=
null
;
previewImage
.
setAttribute
(
"src"
,
""
);
}
});
</script>
<br>
<input
type=
"submit"
name=
"add_new_apartment"
value=
"Add"
>
...
...
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