Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hunter-ht.cn
Overview
Overview
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
刘莹莹
hunter-ht.cn
Commits
a60cd234
Commit
a60cd234
authored
Apr 30, 2020
by
liuyingying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发布功能
parent
11e101b4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
1 deletions
+69
-1
style.css
Hunter_ht/hunter/static/hunter/style.css
+11
-0
user.html
Hunter_ht/hunter/templates/hunter/user.html
+45
-0
urls.py
Hunter_ht/hunter/urls.py
+1
-0
views.py
Hunter_ht/hunter/views.py
+12
-1
No files found.
Hunter_ht/hunter/static/hunter/style.css
View file @
a60cd234
...
@@ -698,4 +698,14 @@ li svg{
...
@@ -698,4 +698,14 @@ li svg{
border-radius
:
7px
;
border-radius
:
7px
;
margin
:
0px
auto
;
margin
:
0px
auto
;
display
:
block
;
display
:
block
;
}
.change_open
{
width
:
50px
!important
;
color
:
black
;
font-size
:
12px
;
background-color
:
transparent
!important
;
}
.change_open
:hover
{
color
:
dimgrey
;
}
}
\ No newline at end of file
Hunter_ht/hunter/templates/hunter/user.html
View file @
a60cd234
...
@@ -70,6 +70,16 @@
...
@@ -70,6 +70,16 @@
<li
class=
"right"
><button
class=
"dele_img"
onclick=
"delePub({{ publication.pubID }})"
></button></li>
<li
class=
"right"
><button
class=
"dele_img"
onclick=
"delePub({{ publication.pubID }})"
></button></li>
{#
<li
class=
"right"
><button
onclick=
"editPublication({{ publication.pubID }})"
><svg
t=
"1587711451871"
class=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"2741"
width=
"20"
height=
"20"
><path
d=
"M863.079412 351.09129a29.2569 29.2569 0 0 1 58.5138 0v555.881108a117.027602 117.027602 0 0 1-117.027601 117.027602H219.427602a117.027602 117.027602 0 0 1-117.027602-117.027602V146.292987a117.027602 117.027602 0 0 1 117.027602-117.027602h380.339706a29.2569 29.2569 0 0 1 0 58.513801H219.427602a58.513801 58.513801 0 0 0-58.513801 58.513801v760.679411a58.513801 58.513801 0 0 0 58.513801 58.513801h585.138009a58.513801 58.513801 0 0 0 58.513801-58.513801V351.09129zM855.414104 10.306913a29.2569 29.2569 0 1 1 44.587516 37.916943l-248.683654 292.569005a29.2569 29.2569 0 1 1-44.587516-37.916943l248.683654-292.569005zM307.198303 526.632692h263.312104a29.2569 29.2569 0 0 1 0 58.513801H307.198303a29.2569 29.2569 0 0 1 0-58.513801z m0 175.541403h409.596606a29.2569 29.2569 0 0 1 0 58.513801H307.198303a29.2569 29.2569 0 0 1 0-58.513801z"
p-id=
"2742"
fill=
"#6e829e"
></path></svg>
#}
{#
<li
class=
"right"
><button
onclick=
"editPublication({{ publication.pubID }})"
><svg
t=
"1587711451871"
class=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"2741"
width=
"20"
height=
"20"
><path
d=
"M863.079412 351.09129a29.2569 29.2569 0 0 1 58.5138 0v555.881108a117.027602 117.027602 0 0 1-117.027601 117.027602H219.427602a117.027602 117.027602 0 0 1-117.027602-117.027602V146.292987a117.027602 117.027602 0 0 1 117.027602-117.027602h380.339706a29.2569 29.2569 0 0 1 0 58.513801H219.427602a58.513801 58.513801 0 0 0-58.513801 58.513801v760.679411a58.513801 58.513801 0 0 0 58.513801 58.513801h585.138009a58.513801 58.513801 0 0 0 58.513801-58.513801V351.09129zM855.414104 10.306913a29.2569 29.2569 0 1 1 44.587516 37.916943l-248.683654 292.569005a29.2569 29.2569 0 1 1-44.587516-37.916943l248.683654-292.569005zM307.198303 526.632692h263.312104a29.2569 29.2569 0 0 1 0 58.513801H307.198303a29.2569 29.2569 0 0 1 0-58.513801z m0 175.541403h409.596606a29.2569 29.2569 0 0 1 0 58.513801H307.198303a29.2569 29.2569 0 0 1 0-58.513801z"
p-id=
"2742"
fill=
"#6e829e"
></path></svg>
#}
{#
</button></li>
#}
{#
</button></li>
#}
<li
class=
"right"
>
<button
class=
"change_open"
onclick=
"change_open(this,{{ publication.pubID }})"
>
{% if publication.isOpen == '1' %}
取消发布
{% else %}
发布
{% endif %}
</button>
</li>
<li
class=
"middle_text right"
>
{{ publication.date }}
</li>
<li
class=
"middle_text right"
>
{{ publication.date }}
</li>
<li
class=
"right"
>
{{ publication.journalname }}
</li>
<li
class=
"right"
>
{{ publication.journalname }}
</li>
<li
class=
"right"
>
{{ publication.publishType }}
</li>
<li
class=
"right"
>
{{ publication.publishType }}
</li>
...
@@ -591,6 +601,40 @@
...
@@ -591,6 +601,40 @@
$
(
'#edit_div'
).
addClass
(
'show_edit'
);
$
(
'#edit_div'
).
addClass
(
'show_edit'
);
}
}
function
change_open
(
thisBtn
,
pubID
){
if
(
thisBtn
.
innerText
===
'取消发布'
){
isOpen
=
'0'
;
console
.
log
(
isOpen
);
}
else
{
isOpen
=
'1'
}
$
.
ajax
({
url
:
'/change/publication/status/'
,
type
:
'post'
,
data
:{
'pubID'
:
pubID
,
'isOpen'
:
isOpen
,
},
success
:
function
(
response
){
if
(
response
[
'message'
]){
console
.
log
(
thisBtn
);
if
(
isOpen
===
'1'
){
$
(
thisBtn
).
empty
();
$
(
thisBtn
).
append
(
'取消发布'
);
}
else
{
$
(
thisBtn
).
empty
();
$
(
thisBtn
).
append
(
'发布'
);
}
}
else
{
console
.
log
(
response
[
'error'
]);
}
},
error
:
function
(
xhr
){
console
.
log
(
"something went wrong..."
);
}
})
}
</script>
</script>
</body>
</body>
</html>
</html>
\ No newline at end of file
Hunter_ht/hunter/urls.py
View file @
a60cd234
...
@@ -17,6 +17,7 @@ urlpatterns = [
...
@@ -17,6 +17,7 @@ urlpatterns = [
path
(
'add/article/url/'
,
views
.
add_url_article
,
name
=
'add_url_article'
),
path
(
'add/article/url/'
,
views
.
add_url_article
,
name
=
'add_url_article'
),
path
(
'login/'
,
views
.
login
,
name
=
'login'
),
path
(
'login/'
,
views
.
login
,
name
=
'login'
),
path
(
'delete/publication/'
,
views
.
delete_publication
,
name
=
'delete_publication'
),
path
(
'delete/publication/'
,
views
.
delete_publication
,
name
=
'delete_publication'
),
path
(
'change/publication/status/'
,
views
.
change_pub_status
,
name
=
'change_pub_status'
),
path
(
'delete/cve/'
,
views
.
delete_cve
,
name
=
'delete_cve'
),
path
(
'delete/cve/'
,
views
.
delete_cve
,
name
=
'delete_cve'
),
path
(
'delete/article/'
,
views
.
delete_article
,
name
=
'delete_article'
),
path
(
'delete/article/'
,
views
.
delete_article
,
name
=
'delete_article'
),
path
(
'add/publication/'
,
views
.
add_publication
,
name
=
'add_publication'
),
path
(
'add/publication/'
,
views
.
add_publication
,
name
=
'add_publication'
),
...
...
Hunter_ht/hunter/views.py
View file @
a60cd234
...
@@ -93,7 +93,7 @@ def index(request):
...
@@ -93,7 +93,7 @@ def index(request):
newest_post_list
=
{}
newest_post_list
=
{}
start
=
datetime
.
datetime
.
now
()
.
date
()
-
datetime
.
timedelta
(
hours
=
23
*
7
,
minutes
=
59
,
seconds
=
59
)
start
=
datetime
.
datetime
.
now
()
.
date
()
-
datetime
.
timedelta
(
hours
=
23
*
7
,
minutes
=
59
,
seconds
=
59
)
newest_publication
=
Publications
.
objects
.
filter
(
date__gte
=
start
)
.
order_by
(
'-editDateTime'
)
newest_publication
=
Publications
.
objects
.
filter
(
date__gte
=
start
,
isOpen
=
'1'
)
.
order_by
(
'-editDateTime'
)
for
pub
in
newest_publication
:
for
pub
in
newest_publication
:
pub
.
author
=
pub
.
uploadByUser
pub
.
author
=
pub
.
uploadByUser
pub
.
url
=
'/static/hunter/publications/'
+
pub
.
link
.
split
(
'/'
)[
-
1
]
pub
.
url
=
'/static/hunter/publications/'
+
pub
.
link
.
split
(
'/'
)[
-
1
]
...
@@ -368,6 +368,17 @@ def delete_article(request):
...
@@ -368,6 +368,17 @@ def delete_article(request):
@csrf_exempt
@csrf_exempt
def
change_pub_status
(
request
):
pubID
=
request
.
POST
[
'pubID'
]
isOpen
=
request
.
POST
[
'isOpen'
]
print
(
isOpen
)
try
:
Publications
.
objects
.
filter
(
pubID
=
pubID
)
.
update
(
isOpen
=
isOpen
)
return
JsonResponse
({
'message'
:
1
})
except
ObjectDoesNotExist
as
e
:
return
JsonResponse
({
'message'
:
0
,
'error'
:
e
})
@csrf_exempt
def
add_publication
(
request
):
def
add_publication
(
request
):
title
=
request
.
POST
[
'title'
]
title
=
request
.
POST
[
'title'
]
print
(
title
)
print
(
title
)
...
...
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