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
367a93fa
Commit
367a93fa
authored
Nov 22, 2015
by
Dominik Rosiek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usuwanie linkóœ
parent
e4f61b2c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
23 deletions
+87
-23
beacon.js
BeHub/Hub/static/js/beacon.js
+53
-2
beacon_list.html
BeHub/Hub/templates/user_panel/content/beacon_list.html
+3
-0
beacons.html
BeHub/Hub/templates/user_panel/content/beacons.html
+4
-0
dashboard.html
BeHub/Hub/templates/user_panel/content/dashboard.html
+3
-1
maps.html
BeHub/Hub/templates/user_panel/content/maps.html
+1
-20
project.html
BeHub/Hub/templates/user_panel/content/project.html
+22
-0
views.py
BeHub/Hub/views.py
+1
-0
No files found.
BeHub/Hub/static/js/beacon.js
View file @
367a93fa
...
@@ -17,7 +17,7 @@ function show_beacons(){
...
@@ -17,7 +17,7 @@ function show_beacons(){
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
(
""
))
'</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
(
""
))
}
}
html
.
push
([
'<p> <button class="btn btn-success">Dodaj link</button></p>'
,
html
.
push
([
'<p> <button class="btn btn-success"
onclick="dodajLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
)"
>Dodaj link</button></p>'
,
'</td>'
,
'</td>'
,
'</tr>'
,
'</tr>'
,
'</tbody>'
,
'</tbody>'
,
...
@@ -49,7 +49,7 @@ function show_beacons_list(){
...
@@ -49,7 +49,7 @@ function show_beacons_list(){
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
(
""
))
'</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
(
""
))
}
}
html
.
push
([
'<p> <button class="btn btn-success">Dodaj link</button></p>'
,
html
.
push
([
'<p> <button class="btn btn-success"
onclick="dodajLink(
\'
'
,
beacon_managers
[
i
].
url
,
'
\'
)"
>Dodaj link</button></p>'
,
'</td>'
,
'</td>'
,
'</tr>'
,
'</tr>'
,
'</tbody>'
,
'</tbody>'
,
...
@@ -92,4 +92,55 @@ function removeLink(beacon_manager, link){
...
@@ -92,4 +92,55 @@ function removeLink(beacon_manager, link){
}
}
});
});
}
function
dodajLink
(
beacon_manager
,
beacon
){
$
(
"#myModal"
).
modal
(
"show"
);
$
(
"#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">
\
<input id="desc" type="text" class="form-control" placeholder="Description" required autofocus name="desc">
\
</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 beacon</button>'
);
$
(
"#addProjectBtn"
).
off
(
"click"
);
$
(
"#addProjectBtn"
).
on
(
"click"
,
function
(){
var
link_url
=
$
(
"#url"
).
val
();
var
desc
=
$
(
"#desc"
).
val
();
var
data
=
{
"link_url"
:
link_url
,
"description"
:
desc
,
"categories"
:
[],
"author"
:
user_id
,
};
$
.
ajax
({
url
:
"/api/sites/"
,
type
:
'POST'
,
data
:
JSON
.
stringify
(
data
),
contentType
:
"application/json"
,
success
:
function
(
beacon_manager
){
return
function
(
result
)
{
$
.
ajax
({
url
:
beacon_manager
,
type
:
'GET'
,
data
:
JSON
.
stringify
(
data
),
contentType
:
"application/json"
,
success
:
function
(
site_data
){
return
function
(
result
)
{
result
[
'sites'
].
push
(
site_data
.
url
);
$
.
ajax
({
url
:
result
.
url
,
type
:
"PUT"
,
data
:
JSON
.
stringify
(
result
),
contentType
:
"application/json"
,
success
:
function
(){
document
.
location
.
reload
()
}
})
}}(
result
)
});
}}(
beacon_manager
)
});
});
}
}
\ No newline at end of file
BeHub/Hub/templates/user_panel/content/beacon_list.html
View file @
367a93fa
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
{% block content %}
{% block content %}
<script>
var
user_id
=
"/api/users/{{ user_id }}/"
;
</script>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-10 col-md-offset-1"
>
<div
class=
"col-md-10 col-md-offset-1"
>
...
...
BeHub/Hub/templates/user_panel/content/beacons.html
View file @
367a93fa
<script>
var
user_id
=
"/api/users/{{ user_id }}/"
;
</script>
<script>
<script>
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
show_beacons
();
show_beacons
();
...
...
BeHub/Hub/templates/user_panel/content/dashboard.html
View file @
367a93fa
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
{% block content %}
{% block content %}
<script>
var
user_id
=
"/api/users/{{ user_id }}/"
;
</script>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"row"
>
...
...
BeHub/Hub/templates/user_panel/content/maps.html
View file @
367a93fa
...
@@ -19,23 +19,4 @@
...
@@ -19,23 +19,4 @@
});
});
</script>
</script>
<script
async
defer
<script
async
defer
src=
"https://maps.googleapis.com/maps/api/js?key=AIzaSyAaYyVEcLFqwKP_VnzfRSIMkWWWrLtMiGQ&signed_in=true"
></script>
src=
"https://maps.googleapis.com/maps/api/js?key=AIzaSyAaYyVEcLFqwKP_VnzfRSIMkWWWrLtMiGQ&signed_in=true"
></script>
\ No newline at end of file
<!-- 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>
\ No newline at end of file
BeHub/Hub/templates/user_panel/content/project.html
View file @
367a93fa
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
{% block content %}
{% block content %}
<script>
var
user_id
=
"/api/users/{{ user_id }}/"
;
</script>
...
@@ -29,6 +32,25 @@
...
@@ -29,6 +32,25 @@
</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>
{% endblock content %}
{% endblock content %}
\ No newline at end of file
BeHub/Hub/views.py
View file @
367a93fa
...
@@ -182,5 +182,6 @@ def project(request, project_id):
...
@@ -182,5 +182,6 @@ def project(request, project_id):
data
=
{}
data
=
{}
user_project
=
UserProject
.
objects
.
get
(
id
=
project_id
)
user_project
=
UserProject
.
objects
.
get
(
id
=
project_id
)
data
[
'user_project'
]
=
user_project
data
[
'user_project'
]
=
user_project
data
[
'user_id'
]
=
request
.
user
.
id
data
[
'project_id'
]
=
project_id
data
[
'project_id'
]
=
project_id
return
render_to_response
(
'user_panel/content/project.html'
,
data
,
context
)
return
render_to_response
(
'user_panel/content/project.html'
,
data
,
context
)
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