Merge branch 'improve/uploadFileFilter' into devel

Conflicts:
	src/octoprint/server/views.py
This commit is contained in:
Gina Häußge 2016-02-09 18:05:27 +01:00
commit 90353c6e7d
3 changed files with 8 additions and 4 deletions

View file

@ -15,9 +15,10 @@ HEAD
\(detached.*
# maintenance is currently the branch for preparation of maintenance release 1.2.9
# so are any fix/... branches
# so are any fix/... and improve/... branches
maintenance 1.2.9 dedadbc9ac0305799e94ae279d3bca131629c4c5 pep440-dev
fix/.* 1.2.9 dedadbc9ac0305799e94ae279d3bca131629c4c5 pep440-dev
improve/.* 1.2.9 dedadbc9ac0305799e94ae279d3bca131629c4c5 pep440-dev
# every other branch is a development branch and thus gets resolved to 1.3.0-dev for now
.* 1.3.0 198d3450d94be1a2 pep440-dev

View file

@ -17,6 +17,7 @@ from octoprint.server import app, userManager, pluginManager, gettext, \
debug, LOCALES, VERSION, DISPLAY_VERSION, UI_API_KEY, BRANCH, preemptiveCache, \
NOT_MODIFIED
from octoprint.settings import settings
from octoprint.filemanager import get_all_extensions
import re
@ -249,6 +250,7 @@ def _get_render_kwargs(templates, plugin_names, plugin_vars, now):
first_run = settings().getBoolean(["server", "firstRun"])
locales = dict((l.language, dict(language=l.language, display=l.display_name, english=l.english_name)) for l in LOCALES)
extensions = map(lambda ext: ".{}".format(ext), get_all_extensions())
#~~ prepare full set of template vars for rendering
@ -260,6 +262,7 @@ def _get_render_kwargs(templates, plugin_names, plugin_vars, now):
templates=templates,
pluginNames=plugin_names,
locales=locales,
supportedExtensions=extensions
)
render_kwargs.update(plugin_vars)

View file

@ -54,18 +54,18 @@
<span class="btn btn-primary fileinput-button span6" data-bind="css: {disabled: !$root.loginState.isUser()}" style="margin-bottom: 10px">
<i class="icon-upload-alt icon-white"></i>
<span>{{ _('Upload') }}</span>
<input id="gcode_upload" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser()">
<input id="gcode_upload" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser()">
</span>
<span class="btn btn-primary fileinput-button span6" data-bind="css: {disabled: !$root.loginState.isUser() || !$root.isSdReady()}" style="margin-bottom: 10px">
<i class="icon-upload-alt icon-white"></i>
<span>{{ _('Upload to SD') }}</span>
<input id="gcode_upload_sd" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser() && isSdReady()">
<input id="gcode_upload_sd" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser() && isSdReady()">
</span>
{% else %}
<span class="btn btn-primary fileinput-button span12" data-bind="css: {disabled: !$root.loginState.isUser()}" style="margin-bottom: 10px">
<i class="icon-upload-alt icon-white"></i>
<span>{{ _('Upload') }}</span>
<input id="gcode_upload" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser()">
<input id="gcode_upload" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser()">
</span>
{% endif %}
</div>