Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
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
captainwong
douban-api-proxy
Commits
7fce2879
Commit
7fce2879
authored
May 02, 2016
by
Cervinko Cera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add search_form.html
parent
431b6009
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
search_form.html
cps/templates/search_form.html
+50
-0
web.py
cps/web.py
+0
-1
No files found.
cps/templates/search_form.html
0 → 100644
View file @
7fce2879
{% extends "layout.html" %}
{% block body %}
<div
class=
"col-sm-8"
>
<form
role=
"form"
action=
"{{ url_for('advanced_search') }}"
method=
"GET"
>
<div
class=
"form-group"
>
<label
for=
"book_title"
>
Book Title
</label>
<input
type=
"text"
class=
"form-control"
name=
"book_title"
id=
"book_title"
value=
""
>
</div>
<div
class=
"form-group"
>
<label
for=
"bookAuthor"
>
Author
</label>
<input
type=
"text"
class=
"form-control typeahead"
name=
"author_name"
id=
"bookAuthor"
value=
""
autocomplete=
"off"
>
</div>
<label
for=
"Tags"
>
Select Tags
</label>
<div
class=
"form-group"
>
<div
class=
"btn-toolbar btn-toolbar-lg"
data-toggle=
"buttons"
>
{% for tag in tags %}
<label
id=
"tag_{{tag.id}}"
class=
"btn btn-primary tag_click"
>
<input
type=
"checkbox"
autocomplete=
"off"
name=
"tag"
value=
"{{tag.id}}"
>
{{tag.name}}
</input>
</label>
{% endfor %}
</div>
</div>
<button
type=
"submit"
class=
"btn btn-default"
>
Submit
</button>
</form>
</div>
{% endblock %}
{% block js %}
<script
src=
"{{ url_for('static', filename='js/typeahead.bundle.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/edit_books.js') }}"
></script>
<script>
$
(
'form'
).
on
(
'change input'
,
function
()
{
form
=
$
(
'form'
).
serialize
();
$
.
getJSON
(
"{{ url_for('get_matching_tags') }}"
,
form
,
function
(
data
)
{
$
(
'.tag_click'
).
each
(
function
()
{
console
.
log
(
data
.
tags
);
if
(
$
.
inArray
(
parseInt
(
$
(
this
).
children
(
'input'
).
first
().
val
(),
10
),
data
.
tags
)
==
-
1
)
{
$
(
this
).
addClass
(
'disabled'
);
}
else
{
$
(
this
).
removeClass
(
'disabled'
);
}
});
});
});
</script>
{% endblock %}
{% block header %}
<link
href=
"{{ url_for('static', filename='css/typeahead.css') }}"
rel=
"stylesheet"
media=
"screen"
>
{% endblock %}
cps/web.py
View file @
7fce2879
...
...
@@ -446,7 +446,6 @@ def search():
@
login_required_if_no_ano
def
advanced_search
():
if
request
.
method
==
'GET'
:
print
"GETTTTTTTTTTTT"
q
=
db
.
session
.
query
(
db
.
Books
)
tag_inputs
=
request
.
args
.
getlist
(
'tag'
)
author_name
=
request
.
args
.
get
(
"author_name"
)
...
...
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