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
3f50c36d
Commit
3f50c36d
authored
Nov 22, 2015
by
Dominik Rosiek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usuwanie linkóœ
parent
367a93fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
42 deletions
+58
-42
beacon.js
BeHub/Hub/static/js/beacon.js
+58
-42
No files found.
BeHub/Hub/static/js/beacon.js
View file @
3f50c36d
...
@@ -96,51 +96,67 @@ function removeLink(beacon_manager, link){
...
@@ -96,51 +96,67 @@ function removeLink(beacon_manager, link){
function
dodajLink
(
beacon_manager
,
beacon
){
function
dodajLink
(
beacon_manager
,
beacon
){
$
(
"#myModal"
).
modal
(
"show"
);
$
.
getJSON
(
"/api/category/"
,
function
(
data
){
$
(
"#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>
\
$
(
"#myModal"
).
modal
(
"show"
);
<button type="button" class="btn btn-primary" id="addProjectBtn">Add beacon</button>'
);
var
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">'
;
$
(
"#addProjectBtn"
).
off
(
"click"
);
html
+=
"<select id=
\"
kat
\"
class=
\"
form-control
\"
>"
$
(
"#addProjectBtn"
).
on
(
"click"
,
function
(){
html
+=
"<option value=
\"
-
\"
>No category</option>"
;
var
link_url
=
$
(
"#url"
).
val
();
for
(
var
i
=
0
;
i
<
data
.
results
.
length
;
i
++
){
var
desc
=
$
(
"#desc"
).
val
();
html
+=
"<option value=
\"
"
+
data
.
results
[
i
].
url
+
"
\"
>"
+
data
.
results
[
i
].
name
+
"</option>"
;
var
data
=
{
}
"link_url"
:
link_url
,
html
+=
"</select>"
"description"
:
desc
,
html
+=
'</form>'
;
"categories"
:
[],
"author"
:
user_id
,
};
$
.
ajax
({
$
(
"#modal-content"
).
html
(
html
)
url
:
"/api/sites/"
,
type
:
'POST'
,
$
(
"#modal-footer"
).
html
(
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
\
data
:
JSON
.
stringify
(
data
),
<button type="button" class="btn btn-primary" id="addProjectBtn">Add beacon</button>'
);
contentType
:
"application/json"
,
success
:
function
(
beacon_manager
){
return
function
(
result
)
{
$
(
"#addProjectBtn"
).
off
(
"click"
);
$
.
ajax
({
$
(
"#addProjectBtn"
).
on
(
"click"
,
function
(){
url
:
beacon_manager
,
var
link_url
=
$
(
"#url"
).
val
();
type
:
'GET'
,
var
desc
=
$
(
"#desc"
).
val
();
data
:
JSON
.
stringify
(
data
),
var
kat
=
$
(
"#kat"
).
val
();
contentType
:
"application/json"
,
if
(
kat
==
"-"
){
success
:
function
(
site_data
){
return
function
(
result
)
{
delete
kat
;
result
[
'sites'
].
push
(
site_data
.
url
);
}
$
.
ajax
({
var
data
=
{
url
:
result
.
url
,
"link_url"
:
link_url
,
type
:
"PUT"
,
"description"
:
desc
,
data
:
JSON
.
stringify
(
result
),
"categories"
:
[],
contentType
:
"application/json"
,
"author"
:
user_id
,
success
:
function
(){
};
document
.
location
.
reload
()
}
$
.
ajax
({
})
url
:
"/api/sites/"
,
}}(
result
)
type
:
'POST'
,
});
data
:
JSON
.
stringify
(
data
),
}}(
beacon_manager
)
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
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