Skip to content
This repository was archived by the owner on Mar 7, 2022. It is now read-only.

Commit 235d87b

Browse files
committed
Merge branch 'release/08-August-2017'
2 parents 850f7d7 + 5c40c75 commit 235d87b

File tree

6 files changed

+115
-80
lines changed

6 files changed

+115
-80
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A git repository for PyCon Korea 2017
2-
## Version 07-August-2017
2+
## Version 08-August-2017
33

44
[![Build Status](https://travis-ci.org/pythonkr/pyconkr-2017.svg?branch=master)](https://travis-ci.org/pythonkr/pyconkr-2017)
55

pyconkr/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
SponsorList.as_view(), name='sponsors'),
4646
url(r'^about/patron/$',
4747
PatronList.as_view(), name='patrons'),
48-
url(r'^about/sponsor/(?P<slug>\w+)$',
48+
url(r'^about/sponsor/(?P<slug>[\w|-]+)$',
4949
SponsorDetail.as_view(), name='sponsor'),
5050
url(r'^programs?/list/$',
5151
ProgramList.as_view(), name='programs'),
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{% load staticfiles %}
2+
<html>
3+
<head>
4+
<style>
5+
@page {
6+
size: 90mm 29mm;
7+
margin: 0cm;
8+
}
9+
@import url(http://fonts.googleapis.com/earlyaccess/jejugothic.css);
10+
11+
.name-tag {
12+
position:absolute;
13+
top:50%;
14+
left:50%;
15+
transform:translate(-50%, -50%);
16+
}
17+
.name-tag .name {
18+
font-family: 'Jeju Gothic', serif;
19+
font-size: 10mm;
20+
position:relative;
21+
top: 5mm;
22+
left: 20mm;
23+
}
24+
.name-tag .org {
25+
font-family: 'Jeju Gothic', serif;
26+
color: gray;
27+
font-size: 6mm;
28+
position:relative;
29+
top: 6mm;
30+
left: 35mm;
31+
}
32+
33+
.preview-border {
34+
width: 90mm;
35+
height: 28mm;
36+
border: 1px solid red;
37+
}
38+
39+
40+
@media print {
41+
.no-print {display:none}
42+
.preview-border {
43+
width: 90mm;
44+
height: 28mm;
45+
border: 1px solid white;
46+
line-height:10mm;
47+
}
48+
}
49+
50+
</style>
51+
</head>
52+
<body>
53+
<div class='no-print'>
54+
현재 발권횟수: {{ registration.issueticket_set.count }}
55+
</div>
56+
<button id='ticket_issue' class='no-print'>발권</button>
57+
<div class='print name-tag preview-border'>
58+
<div class='name'>{{ registration.name }}</div>
59+
<div class='org'>{{ registration.company }}</div>
60+
</div>
61+
<script src="{% static "components/jquery/dist/jquery.min.js" %}"></script>
62+
<script src="{% static "components/js-cookie/src/js.cookie.js" %}" charset="utf-8"></script>
63+
<script type="text/javascript">
64+
function csrfSafeMethod(method) {
65+
// these HTTP methods do not require CSRF protection
66+
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
67+
}
68+
$(document).ready( function () {
69+
$('#ticket_issue').click(function(){
70+
window.print();
71+
issueTicketConfirm({{ registration.id }});
72+
});
73+
});
74+
75+
function issueTicketConfirm(userId) {
76+
var csrftoken = Cookies.get('csrftoken');
77+
$.ajaxSetup({
78+
beforeSend: function(xhr, settings) {
79+
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
80+
xhr.setRequestHeader("X-CSRFToken", csrftoken);
81+
}
82+
}
83+
});
84+
$.ajax("{% url 'registration_issue_submit' %}", {
85+
data: {'user_id': userId},
86+
method: 'POST',
87+
success: function(data) {
88+
alert('발권처리 기록 되었습니다.');
89+
},
90+
error: function(data) {
91+
alert('발권처리 기록에 실패 하였습니다.');
92+
}
93+
});
94+
}
95+
96+
</script>
97+
</body>
98+
</html>

registration/templates/registration/issue_ticket.html

Lines changed: 6 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
<td>{{ user.email }}</td>
2020
<td>
2121
<div class="btn-group">
22-
<button type="button" class="btn btn-success btn-filter" onclick="printLabelPopup('{{ user.name }}', {{ user.id }},'{{ user.top_size }}')">발권</button>
23-
<a class="btn btn-default btn-filter"
24-
href='/admin/registration/registration/{{user.id}}'
25-
target='_blank' role="button">관리</a>
22+
<a class="btn btn-success btn-filter"
23+
target='_blank' role="button"
24+
href='{% url "registration_issue_print" user.id %}'>발권</a>
25+
<a class="btn btn-default btn-filter"
26+
href='/admin/registration/registration/{{user.id}}'
27+
target='_blank' role="button">관리</a>
2628
</div>
2729
</td>
2830
</tr>
@@ -41,40 +43,6 @@
4143
<script src="{% static "components/datatables.net/js/jquery.dataTables.min.js" %}" charset="utf-8"></script>
4244
<script src="{% static "components/datatables.net-bs/js/dataTables.bootstrap.min.js" %}" charset="utf-8"></script>
4345

44-
{% verbatim %}
45-
<script id="print_template" type="text/x-handlebars-template">
46-
<div class="ui brother-label">
47-
<p class="ui name">{{name}}</p>
48-
</div>
49-
<div class="ui brother-label">
50-
<p class="ui name">{{topSize}}</p>
51-
</div>
52-
<style>
53-
.brother-label {
54-
margin: 0 auto;
55-
padding: 0 auto;
56-
width: 88mm;
57-
height: 27mm;
58-
}
59-
.name{
60-
font-size: {{fontSize}};
61-
font-weight: bold;
62-
text-align: center;
63-
letter-spacing: 1rem;
64-
}
65-
@media print {
66-
body, html, p{
67-
margin: 0mm !important;
68-
padding: 0mm !important;
69-
}
70-
@page{
71-
margin: 0mm !important;
72-
padding: 0mm !important;
73-
}
74-
}
75-
</script>
76-
{% endverbatim %}
77-
7846
<script type="text/javascript">
7947
$(document).ready( function () {
8048
$('#issue-ticket').DataTable({
@@ -86,45 +54,6 @@
8654
searching: true,
8755
});
8856
});
89-
90-
function issueTicketConfirm(userId) {
91-
var csrftoken = Cookies.get('csrftoken');
92-
$.ajaxSetup({
93-
beforeSend: function(xhr, settings) {
94-
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
95-
xhr.setRequestHeader("X-CSRFToken", csrftoken);
96-
}
97-
}
98-
});
99-
$.ajax("{% url 'registration_issue_submit' %}", {
100-
data: {'user_id': userId},
101-
method: 'POST',
102-
success: function(data) {
103-
alert('발권처리 기록 되었습니다.');
104-
},
105-
error: function(data) {
106-
alert('발권처리 기록에 실패 하였습니다.');
107-
}
108-
});
109-
}
110-
111-
function printLabelPopup(name, userId, topSize) {
112-
var printWindow = window.open('', '', 'width=600, height=400');
113-
var fontSize = '1em';
114-
var printTemplateScript = $('#print_template').html();
115-
var printTemplate = Handlebars.compile(printTemplateScript);
116-
var context = {
117-
'name': name,
118-
'topSize': topSize,
119-
'fontSize': fontSize
120-
};
121-
printWindow.document.write(printTemplate(context));
122-
printWindow.document.close();
123-
printWindow.focus();
124-
printWindow.print();
125-
printWindow.close();
126-
issueTicketConfirm(userId);
127-
}
12857
</script>
12958

13059
{% endblock %}

registration/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
url(r'^payment/manual/payment/$', views.manual_payment_process, name='manual_payment'),
1616
url(r'^issue/$', views.issue, name='registration_issue'),
1717
url(r'^issue/submit/$', views.issue_submit, name='registration_issue_submit'),
18-
18+
url(r'^issue/print/(?P<registration_id>\d+)/$', views.issue_print, name='registration_issue_print'),
1919
]

registration/views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,14 @@ def issue(request):
362362
}
363363
return render(request, 'registration/issue_ticket.html', context)
364364

365+
@group_required('admin', 'organizer', 'volunteer')
366+
def issue_print(request, registration_id):
367+
registration = get_object_or_404(Registration, id=registration_id)
368+
context = {
369+
'registration': registration,
370+
'title': _("Ticket Print"),
371+
}
372+
return render(request, 'registration/issue_print.html', context)
365373

366374
@group_required('admin', 'organizer', 'volunteer')
367375
@require_http_methods(["POST"])

0 commit comments

Comments
 (0)