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
fac83a10
Commit
fac83a10
authored
Dec 27, 2016
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added display and linking of IDs (Amazon, ISBN, and DIO Links are working)
parent
e0459eb6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
db.py
cps/db.py
+36
-1
style.css
cps/static/css/style.css
+1
-0
detail.html
cps/templates/detail.html
+11
-0
No files found.
cps/db.py
View file @
fac83a10
...
@@ -76,6 +76,40 @@ for row in cc:
...
@@ -76,6 +76,40 @@ for row in cc:
cc_classes
[
row
.
id
]
=
type
(
'Custom_Column_'
+
str
(
row
.
id
),
(
Base
,),
ccdict
)
cc_classes
[
row
.
id
]
=
type
(
'Custom_Column_'
+
str
(
row
.
id
),
(
Base
,),
ccdict
)
class
Identifiers
(
Base
):
__tablename__
=
'identifiers'
id
=
Column
(
Integer
,
primary_key
=
True
)
type
=
Column
(
String
)
val
=
Column
(
String
)
book
=
Column
(
Integer
,
ForeignKey
(
'books.id'
))
def
__init__
(
self
,
val
,
type
,
book
):
self
.
val
=
val
self
.
type
=
type
self
.
book
=
book
def
formatType
(
self
):
if
self
.
type
==
"amazon"
:
return
u"Amazon"
elif
self
.
type
==
"isbn"
:
return
u"ISBN"
elif
self
.
type
==
"doi"
:
return
u"DOI"
else
:
return
self
.
type
def
__repr__
(
self
):
if
self
.
type
==
"amazon"
:
return
u"https://amzn.com/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"isbn"
:
return
u"http://http://www.worldcat.org/isbn/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"doi"
:
return
u"http://dx.doi.org/{0}"
.
format
(
self
.
val
)
else
:
return
u""
class
Comments
(
Base
):
class
Comments
(
Base
):
__tablename__
=
'comments'
__tablename__
=
'comments'
...
@@ -203,7 +237,8 @@ class Books(Base):
...
@@ -203,7 +237,8 @@ class Books(Base):
series
=
relationship
(
'Series'
,
secondary
=
books_series_link
,
backref
=
'books'
)
series
=
relationship
(
'Series'
,
secondary
=
books_series_link
,
backref
=
'books'
)
ratings
=
relationship
(
'Ratings'
,
secondary
=
books_ratings_link
,
backref
=
'books'
)
ratings
=
relationship
(
'Ratings'
,
secondary
=
books_ratings_link
,
backref
=
'books'
)
languages
=
relationship
(
'Languages'
,
secondary
=
books_languages_link
,
backref
=
'books'
)
languages
=
relationship
(
'Languages'
,
secondary
=
books_languages_link
,
backref
=
'books'
)
identifiers
=
relationship
(
'Identifiers'
,
backref
=
'books'
)
def
__init__
(
self
,
title
,
sort
,
author_sort
,
timestamp
,
pubdate
,
series_index
,
last_modified
,
path
,
has_cover
,
authors
,
tags
):
def
__init__
(
self
,
title
,
sort
,
author_sort
,
timestamp
,
pubdate
,
series_index
,
last_modified
,
path
,
has_cover
,
authors
,
tags
):
self
.
title
=
title
self
.
title
=
title
self
.
sort
=
sort
self
.
sort
=
sort
...
...
cps/static/css/style.css
View file @
fac83a10
...
@@ -27,6 +27,7 @@ a{color: #45b29d}a:hover{color: #444;}
...
@@ -27,6 +27,7 @@ a{color: #45b29d}a:hover{color: #444;}
span
.glyphicon.glyphicon-tags
{
padding-right
:
5px
;
color
:
#999
;
vertical-align
:
text-top
;}
span
.glyphicon.glyphicon-tags
{
padding-right
:
5px
;
color
:
#999
;
vertical-align
:
text-top
;}
.book-meta
{
padding-bottom
:
20px
;}
.book-meta
{
padding-bottom
:
20px
;}
.book-meta
.tags
a
{
display
:
inline
;}
.book-meta
.tags
a
{
display
:
inline
;}
.book-meta
.identifiers
a
{
display
:
inline
;}
.container-fluid
.single
.cover
img
{
.container-fluid
.single
.cover
img
{
border
:
1px
solid
#fff
;
border
:
1px
solid
#fff
;
/*border-radius: 7px;*/
/*border-radius: 7px;*/
...
...
cps/templates/detail.html
View file @
fac83a10
...
@@ -46,6 +46,17 @@
...
@@ -46,6 +46,17 @@
</div>
</div>
{% endif %}
{% endif %}
{% if entry.identifiers|length > 0 %}
<div
class=
"identifiers"
>
<span
class=
"glyphicon glyphicon-link"
></span>
{% for identifier in entry.identifiers %}
<a
href=
"{{identifier}}"
target=
"_blank"
class=
"btn btn-xs btn-success"
role=
"button"
>
{{identifier.formatType()}}
</a>
{%endfor%}
</div>
</p>
{% endif %}
{% if entry.tags|length > 0 %}
{% if entry.tags|length > 0 %}
<p>
<p>
<div
class=
"tags"
>
<div
class=
"tags"
>
...
...
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