Skip to content

Commit

Permalink
Fix #41 -- Drag-and-drop ticket editor
Browse files Browse the repository at this point in the history
Undo/redo

Useful toolbox

Font selection

Add text content

Use hex for colors

JS-side dump and load

Save

Load layout, proper undo/redo

First steps to Python rendering

More PDF rendering

Copy and paste

Buttons for keyboard actions

Splash Screen

Block unbeforeunload in dirty state

Remove debugging output

Preview

Upload new PDFs via the editor

Fix bugs during PDF reload, link in settings form

New default ticket

Add OpenSans BI

Custom fonts, fix tests
  • Loading branch information
raphaelm committed May 9, 2017
1 parent c98b0aa commit 0d3f5e0
Show file tree
Hide file tree
Showing 27 changed files with 90,428 additions and 165 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ src/static/typeahead/* linguist-vendored
src/static/moment/* linguist-vendored
src/static/datetimepicker/* linguist-vendored
src/static/colorpicker/* linguist-vendored
src/static/fileupload/* linguist-vendored
src/static/charts/* linguist-vendored
src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/fabric.* linguist-vendored
src/pretix/plugins/ticketoutputpdf/static/pretixplugins/ticketoutputpdf/pdf.* linguist-vendored

# Denote all files that are truly binary and should not be modified.
*.eot binary
Expand Down
14 changes: 12 additions & 2 deletions src/pretix/base/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,25 @@ def get_plugins(self) -> "list[str]":
return []
return self.plugins.split(",")

def get_date_from_display(self, tz=None) -> str:
def get_date_from_display(self, tz=None, show_times=True) -> str:
"""
Returns a formatted string containing the start date of the event with respect
to the current locale and to the ``show_times`` setting.
"""
tz = tz or pytz.timezone(self.settings.timezone)
return _date(
self.date_from.astimezone(tz),
"DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT"
"DATETIME_FORMAT" if self.settings.show_times and show_times else "DATE_FORMAT"
)

def get_time_from_display(self, tz=None) -> str:
"""
Returns a formatted string containing the start time of the event, ignoring
the ``show_times`` setting.
"""
tz = tz or pytz.timezone(self.settings.timezone)
return _date(
self.date_from.astimezone(tz), "TIME_FORMAT"
)

def get_date_to_display(self, tz=None) -> str:
Expand Down
2 changes: 2 additions & 0 deletions src/pretix/control/templates/pretixcontrol/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<script type="text/javascript" src="{% static "pretixbase/js/asynctask.js" %}"></script>
<script type="text/javascript" src="{% static "pretixbase/js/asyncdownload.js" %}"></script>
<script type="text/javascript" src="{% static "colorpicker/bootstrap-colorpicker.js" %}"></script>
<script type="text/javascript" src="{% static "fileupload/jquery.ui.widget.js" %}"></script>
<script type="text/javascript" src="{% static "fileupload/jquery.fileupload.js" %}"></script>
{% endcompress %}
{{ html_head|safe }}
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down
49 changes: 48 additions & 1 deletion src/pretix/plugins/ticketoutputpdf/signals.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,56 @@
from django.dispatch import receiver
from django.dispatch import Signal, receiver
from django.template.loader import get_template
from django.urls import resolve

from pretix.base.signals import register_ticket_outputs
from pretix.control.signals import html_head


@receiver(register_ticket_outputs, dispatch_uid="output_pdf")
def register_ticket_outputs(sender, **kwargs):
from .ticketoutput import PdfTicketOutput
return PdfTicketOutput


@receiver(html_head, dispatch_uid="ticketoutputpdf_html_head")
def html_head_presale(sender, request=None, **kwargs):
url = resolve(request.path_info)
if url.namespace == 'plugins:ticketoutputpdf':
template = get_template('pretixplugins/ticketoutputpdf/control_head.html')
return template.render({
'request': request
})
else:
return ""


register_fonts = Signal()
"""
Return a dictionaries of the following structure. Paths should be relative to static root.
{
"font name": {
"regular": {
"truetype": "….ttf",
"woff": "…",
"woff2": "…"
},
"bold": {
...
},
"italic": {
...
},
"bolditalic": {
...
}
}
}
"""


def get_fonts():
f = {}
for recv, value in register_fonts.send(0):
f.update(value)
return f
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#fabric-container {
position: absolute;
top: 0;
left: 0;
}
#editor-canvas-area {
position: relative;
min-height: 500px;
}
body {
overflow-y: scroll;
}
#toolbox .control-group {
margin-bottom: 5px;
}
#toolbox .position, #toolbox .squaresize, #toolbox[data-type] .pdf-info, #toolbox .text, #toolbox .object-buttons {
display: none;
}
#toolbox[data-type] .position, #toolbox[data-type=barcodearea] .squaresize, #toolbox[data-type=text] .text, #toolbox[data-type=textarea] .text,
#toolbox[data-type] .object-buttons {
display: block;
}
#loading-container {
position: absolute;
top: 0;
left: 0;
height: 100%;
background: white;
width: 100%;
text-align: center;
}
#loading-container > div {
max-width: 600px;
margin: auto;
}
#loading-upload {
display: none;
}
.preload-font {
visibility: hidden;
}
Loading

0 comments on commit 0d3f5e0

Please sign in to comment.