Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BeHub-web
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dominik Rosiek
BeHub-web
Commits
17bb698f
Commit
17bb698f
authored
Nov 22, 2015
by
Rafal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add beacon view
parent
05b68be0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
86 deletions
+112
-86
beacon_list.html
BeHub/Hub/templates/user_panel/content/beacon_list.html
+111
-0
beacons.html
BeHub/Hub/templates/user_panel/content/beacons.html
+1
-86
No files found.
BeHub/Hub/templates/user_panel/content/beacon_list.html
View file @
17bb698f
...
...
@@ -2,7 +2,118 @@
{% block content %}
<div
class=
"row"
>
<div
class=
"col-md-10 col-md-offset-1"
>
<a
href=
"#"
onclick=
"showModal2()"
>
<div
class=
"col-xs-12 col-sm-6 col-md-6 col-lg-6 col-lg-offset-3"
>
<div
class=
"box opacity"
>
<div
class=
"box-icon"
>
<span
class=
"fa fa-4x fa-html5"
></span>
</div>
<div
class=
"info"
>
<h4
class=
"text-center"
>
<!-- Button trigger modal -->
Dodaj beacona
</h4>
</div>
</div>
</div>
</a>
{% for beacon_data in beacon_display %}
{% include 'user_panel/content/beacon_detail.html' %}
{% endfor %}
{% include 'user_panel/content/beacon_detail.html' %}
</div>
</div>
<!-- Modal -->
<div
class=
"modal fade"
id=
"myModal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
Modal title
</h4>
</div>
<div
class=
"modal-body"
id=
"modal-content"
>
</div>
<div
class=
"modal-footer"
id=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Close
</button>
<button
type=
"button"
class=
"btn btn-primary"
>
Add to category
</button>
</div>
</div>
</div>
</div>
<script>
function
showModal2
(){
$
(
"#myModal"
).
modal
(
"show"
);
$
(
"#modal-content"
).
html
(
'<form action="/login/" method="post" class="form-signin">
\
<input id="name" type="text" class="form-control" placeholder="Nazwa projektu" required autofocus name="name">
\
<input id="desc" type="text" class="form-control" placeholder="Description" required autofocus name="desc">
\
<input id="uuid" type="text" class="form-control" placeholder="UUID" required autofocus name="uuid">
\
<input id="long" type="text" class="form-control" placeholder="Longitude" required autofocus name="long">
\
<input id="lat" type="text" class="form-control" placeholder="latitude" required autofocus name="lat">
\
</form>'
);
$
(
"#modal-footer"
).
html
(
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
\
<button type="button" class="btn btn-primary" id="addProjectBtn">Add project</button>'
);
$
(
"#addProjectBtn"
).
off
(
"click"
);
$
(
"#addProjectBtn"
).
on
(
"click"
,
function
(){
var
name
=
$
(
"#name"
).
val
();
var
desc
=
$
(
"#desc"
).
val
();
var
uuid
=
$
(
"#uuid"
).
val
();
var
long
=
$
(
"#long"
).
val
();
var
lat
=
$
(
"#lat"
).
val
();
var
data
=
{
"beacon_manager"
:
null
,
"name"
:
name
,
"uuid"
:
uuid
,
"description"
:
desc
,
"longitude"
:
long
,
"latitude"
:
lat
,
};
$
.
ajax
({
url
:
"/api/beacons/"
,
type
:
'POST'
,
data
:
JSON
.
stringify
(
data
),
contentType
:
"application/json"
,
success
:
function
(
result
)
{
var
data
=
{
"beacon"
:
result
.
url
,
"sites"
:
[]
}
$
.
ajax
({
url
:
"/api/beacon_managers/"
,
type
:
'POST'
,
data
:
JSON
.
stringify
(
data
),
contentType
:
"application/json"
,
success
:
function
(
result_beacon
){
return
function
(
result
)
{
result_beacon
[
'beacon_manager'
]
=
result
.
url
;
$
.
ajax
({
url
:
result_beacon
.
url
,
type
:
'PUT'
,
data
:
JSON
.
stringify
(
result_beacon
),
contentType
:
"application/json"
,
success
:
function
(
result
)
{
document
.
location
.
reload
()
}
});
}}(
result
)
});
}
});
});
}
</script>
{% endblock content %}
\ No newline at end of file
BeHub/Hub/templates/user_panel/content/beacons.html
View file @
17bb698f
<div
class=
"container"
>
<a
href=
"#"
onclick=
"showModal2()"
>
asd
</a>
{% for beacon_data in beacon_display %}
{% include 'user_panel/content/beacon_detail.html' %}
{% endfor %}
{% include 'user_panel/content/beacon_detail.html' %}
<!-- Modal -->
<div
class=
"modal fade"
id=
"myModal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
Modal title
</h4>
</div>
<div
class=
"modal-body"
id=
"modal-content"
>
</div>
<div
class=
"modal-footer"
id=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Close
</button>
<button
type=
"button"
class=
"btn btn-primary"
>
Add to category
</button>
</div>
</div>
</div>
</div>
<script>
function
showModal2
(){
$
(
"#myModal"
).
modal
(
"show"
);
$
(
"#modal-content"
).
html
(
'<form action="/login/" method="post" class="form-signin">
\
<input id="name" type="text" class="form-control" placeholder="Nazwa projektu" required autofocus name="name">
\
<input id="desc" type="text" class="form-control" placeholder="Description" required autofocus name="desc">
\
<input id="uuid" type="text" class="form-control" placeholder="UUID" required autofocus name="uuid">
\
<input id="long" type="text" class="form-control" placeholder="Longitude" required autofocus name="long">
\
<input id="lat" type="text" class="form-control" placeholder="latitude" required autofocus name="lat">
\
</form>'
);
$
(
"#modal-footer"
).
html
(
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
\
<button type="button" class="btn btn-primary" id="addProjectBtn">Add project</button>'
);
$
(
"#addProjectBtn"
).
off
(
"click"
);
$
(
"#addProjectBtn"
).
on
(
"click"
,
function
(){
var
name
=
$
(
"#name"
).
val
();
var
desc
=
$
(
"#desc"
).
val
();
var
uuid
=
$
(
"#uuid"
).
val
();
var
long
=
$
(
"#long"
).
val
();
var
lat
=
$
(
"#lat"
).
val
();
var
data
=
{
"beacon_manager"
:
null
,
"name"
:
name
,
"uuid"
:
uuid
,
"description"
:
desc
,
"longitude"
:
long
,
"latitude"
:
lat
,
};
$
.
ajax
({
url
:
"/api/beacons/"
,
type
:
'POST'
,
data
:
JSON
.
stringify
(
data
),
contentType
:
"application/json"
,
success
:
function
(
result
)
{
var
data
=
{
"beacon"
:
result
.
url
,
"sites"
:
[]
}
$
.
ajax
({
url
:
"/api/beacon_managers/"
,
type
:
'POST'
,
data
:
JSON
.
stringify
(
data
),
contentType
:
"application/json"
,
success
:
function
(
result_beacon
){
return
function
(
result
)
{
result_beacon
[
'beacon_manager'
]
=
result
.
url
;
$
.
ajax
({
url
:
result_beacon
.
url
,
type
:
'PUT'
,
data
:
JSON
.
stringify
(
result_beacon
),
contentType
:
"application/json"
,
success
:
function
(
result
)
{
document
.
location
.
reload
()
}
});
}}(
result
)
});
}
});
});
}
</script>
</div>
\ No newline at end of file
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