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
0f1b4c09
Commit
0f1b4c09
authored
Nov 22, 2015
by
Dominik Rosiek
Browse files
Options
Browse Files
Download
Plain Diff
usuwanie linkóœ
parents
3f50c36d
aca8c732
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
15 deletions
+42
-15
models.py
BeHub/Hub/models.py
+1
-0
beacon.js
BeHub/Hub/static/js/beacon.js
+5
-5
beacon_list.html
BeHub/Hub/templates/user_panel/content/beacon_list.html
+6
-6
dashboard.html
BeHub/Hub/templates/user_panel/content/dashboard.html
+2
-2
project.html
BeHub/Hub/templates/user_panel/content/project.html
+1
-1
base.html
BeHub/Hub/templates/user_panel/default/base.html
+1
-1
views.py
BeHub/Hub/views.py
+26
-0
No files found.
BeHub/Hub/models.py
View file @
0f1b4c09
...
@@ -22,6 +22,7 @@ class Category(models.Model):
...
@@ -22,6 +22,7 @@ class Category(models.Model):
class
Beacon
(
models
.
Model
):
class
Beacon
(
models
.
Model
):
uuid
=
models
.
CharField
(
max_length
=
300
,
unique
=
True
)
uuid
=
models
.
CharField
(
max_length
=
300
,
unique
=
True
)
name
=
models
.
CharField
(
max_length
=
300
)
name
=
models
.
CharField
(
max_length
=
300
)
description
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
description
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
...
...
BeHub/Hub/static/js/beacon.js
View file @
0f1b4c09
...
@@ -15,7 +15,7 @@ function show_beacons(){
...
@@ -15,7 +15,7 @@ function show_beacons(){
'<td>'
].
join
(
""
));
'<td>'
].
join
(
""
));
for
(
var
j
=
0
;
j
<
beacon_managers
[
i
].
sites
.
length
;
j
++
){
for
(
var
j
=
0
;
j
<
beacon_managers
[
i
].
sites
.
length
;
j
++
){
html
.
push
([
'<p> <a href="'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'">'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'</a>'
,
html
.
push
([
'<p> <a href="'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'">'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'</a>'
,
'<
/td><td class="col-md-offset-0">'
,
'<button onclick="removeLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
,
\'
'
,
beacon_managers
[
i
].
sites
[
j
].
url
,
'
\'
)" class="btn btn-danger
" >Usun</button></p>'
].
join
(
""
))
'<
button style="float: right;" onclick="removeLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
,
\'
'
,
beacon_managers
[
i
].
sites
[
j
].
url
,
'
\'
)" class="btn btn-danger btn-sm
" >Usun</button></p>'
].
join
(
""
))
}
}
html
.
push
([
'<p> <button class="btn btn-success" onclick="dodajLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
)">Dodaj link</button></p>'
,
html
.
push
([
'<p> <button class="btn btn-success" onclick="dodajLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
)">Dodaj link</button></p>'
,
'</td>'
,
'</td>'
,
...
@@ -47,7 +47,7 @@ function show_beacons_list(){
...
@@ -47,7 +47,7 @@ function show_beacons_list(){
'<td>'
].
join
(
""
));
'<td>'
].
join
(
""
));
for
(
var
j
=
0
;
j
<
beacon_managers
[
i
].
sites
.
length
;
j
++
){
for
(
var
j
=
0
;
j
<
beacon_managers
[
i
].
sites
.
length
;
j
++
){
html
.
push
([
'<p> <a href="'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'">'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'</a>'
,
html
.
push
([
'<p> <a href="'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'">'
,
beacon_managers
[
i
].
sites
[
j
].
link_url
,
'</a>'
,
'</td><td class="col-md-offset-0">'
,
'<button onclick="removeLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
,
\'
'
,
beacon_managers
[
i
].
sites
[
j
].
url
,
'
\'
)" class="btn btn-danger
" >Usun</button></p>'
].
join
(
""
))
,
'<button <button style="float: right;" onclick="removeLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
,
\'
'
,
beacon_managers
[
i
].
sites
[
j
].
url
,
'
\'
)" class="btn btn-danger btn-sm
" >Usun</button></p>'
].
join
(
""
))
}
}
html
.
push
([
'<p> <button class="btn btn-success" onclick="dodajLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
)">Dodaj link</button></p>'
,
html
.
push
([
'<p> <button class="btn btn-success" onclick="dodajLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
)">Dodaj link</button></p>'
,
'</td>'
,
'</td>'
,
...
@@ -99,9 +99,9 @@ function dodajLink(beacon_manager, beacon){
...
@@ -99,9 +99,9 @@ function dodajLink(beacon_manager, beacon){
$
.
getJSON
(
"/api/category/"
,
function
(
data
){
$
.
getJSON
(
"/api/category/"
,
function
(
data
){
$
(
"#myModal"
).
modal
(
"show"
);
$
(
"#myModal"
).
modal
(
"show"
);
var
html
=
'<form action="/login/" method="post" class="form-signin">
\
$
(
"#modal-content"
).
html
(
'<form action="/login/" method="post" class="form-signin">
\
<input id="url" type="text" class="form-control" placeholder="Nazwa beacona" required autofocus name="name"
>
\
<p><input id="url" type="text" class="form-control" placeholder="Link url" required autofocus name="name"></p
>
\
<input id="desc" type="text" class="form-control" placeholder="Description" required autofocus name="desc"
>'
;
<p><input id="desc" type="text" class="form-control" placeholder="Description" required autofocus name="desc"></p
>'
;
html
+=
"<select id=
\"
kat
\"
class=
\"
form-control
\"
>"
html
+=
"<select id=
\"
kat
\"
class=
\"
form-control
\"
>"
html
+=
"<option value=
\"
-
\"
>No category</option>"
;
html
+=
"<option value=
\"
-
\"
>No category</option>"
;
...
...
BeHub/Hub/templates/user_panel/content/beacon_list.html
View file @
0f1b4c09
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<div
class=
"modal-content"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<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>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
Add
</h4>
</div>
</div>
<div
class=
"modal-body"
id=
"modal-content"
>
<div
class=
"modal-body"
id=
"modal-content"
>
...
@@ -66,11 +66,11 @@
...
@@ -66,11 +66,11 @@
$
(
"#myModal"
).
modal
(
"show"
);
$
(
"#myModal"
).
modal
(
"show"
);
$
(
"#modal-content"
).
html
(
'<form action="/login/" method="post" class="form-signin">
\
$
(
"#modal-content"
).
html
(
'<form action="/login/" method="post" class="form-signin">
\
<
input id="name" type="text" class="form-control" placeholder="Nazwa beacona" required autofocus name="name"
>
\
<
p><input id="name" type="text" class="form-control" placeholder="Nazwa beacona" required autofocus name="name"></p
>
\
<
input id="desc" type="text" class="form-control" placeholder="Description" required autofocus name="desc"
>
\
<
p><input id="desc" type="text" class="form-control" placeholder="Description" required autofocus name="desc"></p
>
\
<
input id="uuid" type="text" class="form-control" placeholder="UUID" required autofocus name="uuid"
>
\
<
p><input id="uuid" type="text" class="form-control" placeholder="UUID" required autofocus name="uuid"></p
>
\
<
input id="long" type="text" class="form-control" placeholder="Longitude" required autofocus name="long"
>
\
<
p><input id="long" type="text" class="form-control" placeholder="Longitude" required autofocus name="long"></p
>
\
<
input id="lat" type="text" class="form-control" placeholder="latitude" required autofocus name="lat"
>
\
<
p><input id="lat" type="text" class="form-control" placeholder="latitude" required autofocus name="lat"></p
>
\
</form>'
);
</form>'
);
$
(
"#modal-footer"
).
html
(
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
\
$
(
"#modal-footer"
).
html
(
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
\
...
...
BeHub/Hub/templates/user_panel/content/dashboard.html
View file @
0f1b4c09
...
@@ -58,8 +58,8 @@
...
@@ -58,8 +58,8 @@
<div
class=
"modal-body"
id=
"modal-content"
>
<div
class=
"modal-body"
id=
"modal-content"
>
<form
action=
"/login/"
method=
"post"
class=
"form-signin"
>
<form
action=
"/login/"
method=
"post"
class=
"form-signin"
>
<
input
id=
"name"
type=
"text"
class=
"form-control"
placeholder=
"Nazwa projektu"
required
autofocus
name=
"name"
>
<
p><input
id=
"name"
type=
"text"
class=
"form-control"
placeholder=
"Nazwa projektu"
required
autofocus
name=
"name"
></p
>
<
textarea
id=
"desc"
class=
"form-control"
type=
"description"
id=
"article_content"
name=
"content"
placeholder=
"Zawartosc"
maxlength=
"140"
rows=
"7"
></textarea
>
<
p><textarea
id=
"desc"
class=
"form-control"
type=
"description"
id=
"article_content"
name=
"content"
placeholder=
"Zawartosc"
maxlength=
"140"
rows=
"7"
></textarea></p
>
</form>
</form>
</div>
</div>
...
...
BeHub/Hub/templates/user_panel/content/project.html
View file @
0f1b4c09
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-10 col-md-offset-1
"
>
<div
class=
"col-md-10 col-md-offset-1
"
>
<ul
class=
"nav nav-tabs nav-justified"
>
<ul
class=
"nav nav-tabs nav-justified"
>
<li
class=
"active"
><a
data-toggle=
"tab"
href=
"#beacons"
>
Twoje beacony
</a></li>
<li
class=
"active"
><a
data-toggle=
"tab"
href=
"#beacons"
>
Twoje beacony
</a></li>
...
...
BeHub/Hub/templates/user_panel/default/base.html
View file @
0f1b4c09
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
{% block content %}
{% block content %}
{% endblock %}
{% endblock %}
</div>
</div>
{% include 'user_panel/default/footer.html' %}
<script
src=
"{% static 'js/map.js' %}"
></script>
<script
src=
"{% static 'js/map.js' %}"
></script>
<script
src=
"{% static 'js/beacon.js' %}"
></script>
<script
src=
"{% static 'js/beacon.js' %}"
></script>
...
...
BeHub/Hub/views.py
View file @
0f1b4c09
...
@@ -24,6 +24,32 @@ class BeaconViewSet(viewsets.ModelViewSet):
...
@@ -24,6 +24,32 @@ class BeaconViewSet(viewsets.ModelViewSet):
queryset
=
Beacon
.
objects
.
all
()
queryset
=
Beacon
.
objects
.
all
()
serializer_class
=
BeaconSerializer
serializer_class
=
BeaconSerializer
@
detail_route
(
methods
=
[
'post'
])
def
add
(
self
,
request
,
pk
=
None
):
print
request
.
data
uuid
=
request
.
data
.
get
(
'uuid'
)
longitude
=
request
.
data
.
get
(
'longitude'
)
latitude
=
request
.
data
.
get
(
'latitude'
)
try
:
beacon
=
Beacon
.
objects
.
get
(
uuid
=
uuid
)
except
ObjectDoesNotExist
:
beacon
=
Beacon
.
objects
.
create
(
longitude
=
longitude
,
latitude
=
latitude
)
manager
=
BeaconManager
.
objects
.
create
(
beacon
=
beacon
)
manager
.
sites
=
[]
beacon
.
uuid
=
uuid
beacon
.
name
=
"default Lo:{longitude}, La:{latitude}"
.
format
(
longitude
=
longitude
,
latitude
=
latitude
)
beacon
.
description
=
"default"
beacon
.
longitude
=
longitude
beacon
.
latitude
=
latitude
beacon
.
beacon_manager
=
manager
beacon
.
save
()
manager
.
save
()
return
Response
({
"success"
:
"True"
})
return
Response
(
status
=
rest_framework
.
status
.
HTTP_400_BAD_REQUEST
,
data
=
{
"Somethin wrong my friend"
})
class
UserViewSet
(
viewsets
.
ModelViewSet
):
class
UserViewSet
(
viewsets
.
ModelViewSet
):
"""
"""
...
...
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