mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-08 21:18:00 +03:00
Added lesscss support for compressor
This commit is contained in:
parent
3094000c11
commit
a1e5a1357a
@ -185,7 +185,7 @@ COMPRESS_ENABLED = not DEBUG
|
||||
COMPRESS_OUTPUT_DIR = 'cache'
|
||||
COMPRESS_PRECOMPILERS = (
|
||||
('text/coffeescript', 'coffee --compile --stdio'),
|
||||
# ('text/less', 'lessc {infile} {outfile}'),
|
||||
('text/less', 'lessc {infile} {outfile}'),
|
||||
# ('text/x-sass', 'sass {infile} {outfile}'),
|
||||
# ('text/x-scss', 'sass --scss {infile} {outfile}'),
|
||||
# ('text/stylus', 'stylus < {infile} > {outfile}'),
|
||||
|
14
server/src/uds/templates/uds/html5/downloads.jade
Normal file
14
server/src/uds/templates/uds/html5/downloads.jade
Normal file
@ -0,0 +1,14 @@
|
||||
extends "uds/html5/templates/base.html"
|
||||
- load i18n
|
||||
block body
|
||||
div.panel.panel-info
|
||||
div.panel-heading
|
||||
- trans "Downloads"
|
||||
div.panel-body
|
||||
p
|
||||
- trans "This page contains a list of downloadables provided by different modules"
|
||||
div.list-group
|
||||
for f in files
|
||||
a.list-group-item(href!="{% url "uds.web.views.download" idDownload=f.id %}")
|
||||
h4.list-group-item-heading: f.name
|
||||
p.list-group-item-text: {{ f.comment|safe }}
|
@ -41,10 +41,10 @@
|
||||
<li><a href="{% url "uds.web.views.download" idDownload='' %}"><span class="fa fa-download"></span> {% trans "Downloads" %}</a></li>
|
||||
{% ifbrowser ie<8 %}
|
||||
{% else %}
|
||||
<li><a href="{% url "uds.admin.views.index" %}"><span class="fa fa-dashboard"></span> {% trans "Dashboard" %}</a></li>
|
||||
<li><a href="{% url "uds.admin.views.index" %}"><span class="fa fa-dashboard"></span> Dashboard</a></li>
|
||||
{% endifbrowser %}
|
||||
{% endif %}
|
||||
<li><a href="/logout"><span class="fa fa-power-off text-danger"></span> {% trans 'logout'|capfirst %}</a></li>
|
||||
<li><a href="{% url 'uds.web.views.logout' %}"><span class="fa fa-power-off text-danger"></span> {% trans 'Logout' %}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -4,27 +4,27 @@
|
||||
# Copyright (c) 2014 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@ -43,6 +43,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag(name='auth_token', takes_context=True)
|
||||
def auth_token(context):
|
||||
'''
|
||||
@ -51,19 +52,32 @@ def auth_token(context):
|
||||
request = context['request']
|
||||
return request.session.session_key
|
||||
|
||||
|
||||
@register.simple_tag(name='auth_token_header')
|
||||
def auth_token_header():
|
||||
return AUTH_TOKEN_HEADER
|
||||
|
||||
|
||||
@register.simple_tag(name='js_template_path', takes_context=True)
|
||||
def js_template_path(context, path):
|
||||
context['template_path'] = path
|
||||
return ''
|
||||
|
||||
|
||||
@register.simple_tag(name='js_template', takes_context=True)
|
||||
def js_template(context, template_name, template_id = None):
|
||||
def js_template(context, template_name, template_id=None):
|
||||
template_id = (template_id or 'tmpl_' + template_name).replace('/', '_')
|
||||
tmpl = template.loader.get_template(context['template_path'] + '/' + template_name + '.html').render(context)
|
||||
tmpl = template.loader.get_template(context['template_path'] + '/' + template_name + '.html').render(context)
|
||||
# Clean tmpl
|
||||
if not settings.DEBUG:
|
||||
tmpl = re.sub('\s+', ' ', tmpl)
|
||||
return '<script id="{0}" type="template/uds">{1}</script>'.format(template_id, tmpl)
|
||||
|
||||
|
||||
@register.simple_tag(name='js_template_jade', takes_context=True)
|
||||
def js_template_jade(context, template_name, template_id=None):
|
||||
template_id = (template_id or 'tmpl_' + template_name).replace('/', '_')
|
||||
tmpl = template.loader.get_template(context['template_path'] + '/' + template_name + '.jade').render(context)
|
||||
# Clean tmpl
|
||||
if not settings.DEBUG:
|
||||
tmpl = re.sub('\s+', ' ', tmpl)
|
||||
|
@ -4,27 +4,27 @@
|
||||
# Copyright (c) 2014 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@ -33,9 +33,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django import template
|
||||
from django.utils import formats
|
||||
from django.conf import settings
|
||||
from django.utils.translation import get_language, ugettext as _
|
||||
from uds.core.util import html
|
||||
|
||||
import logging
|
||||
@ -44,14 +41,15 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
register = template.Library()
|
||||
|
||||
# locele related
|
||||
|
||||
# locale related
|
||||
@register.filter(name='country')
|
||||
def country(lang):
|
||||
if lang == 'en':
|
||||
return 'US'
|
||||
if lang == 'ja':
|
||||
return 'JP'
|
||||
|
||||
|
||||
return lang.upper()
|
||||
|
||||
|
||||
@ -61,16 +59,17 @@ class IfBrowser(template.Node):
|
||||
self._nodelistTrue = nodelistTrue
|
||||
self._nodelistFalse = nodelistFalse
|
||||
self._browsers = browsers
|
||||
|
||||
|
||||
def render(self, context):
|
||||
for b in self._browsers:
|
||||
if html.checkBrowser(context['request'].META['HTTP_USER_AGENT'], b):
|
||||
if html.checkBrowser(context['request'].META['HTTP_USER_AGENT'], b):
|
||||
return self._nodelistTrue.render(context)
|
||||
if self._nodelistFalse is None:
|
||||
return ''
|
||||
|
||||
|
||||
return self._nodelistFalse.render(context)
|
||||
|
||||
|
||||
|
||||
@register.tag(name='ifbrowser')
|
||||
def ifbrowser(parser, token):
|
||||
cmd = token.split_contents()
|
||||
@ -78,11 +77,11 @@ def ifbrowser(parser, token):
|
||||
browsers = cmd[1:]
|
||||
except:
|
||||
raise template.TemplateSyntaxError('{0} tag requires browsers to be checked')
|
||||
|
||||
|
||||
states = {}
|
||||
|
||||
|
||||
default_states = ['ifbrowser', 'else']
|
||||
end_tag = 'endifbrowser'
|
||||
end_tag = 'endifbrowser'
|
||||
|
||||
while token.contents != end_tag:
|
||||
current = token.contents
|
||||
|
@ -447,7 +447,7 @@ def download(request, idDownload):
|
||||
if idDownload == '':
|
||||
files = [{'id': key, 'name': val['name'], 'comment': _(val['comment'])} for key, val in DownloadsManager.manager().getDownloadables().items()]
|
||||
logger.debug('Files: {0}'.format(files))
|
||||
return render_to_response(theme.template('downloads.html'), {'files': files}, context_instance=RequestContext(request))
|
||||
return render_to_response(theme.template('downloads.jade'), {'files': files}, context_instance=RequestContext(request))
|
||||
|
||||
return DownloadsManager.manager().send(request, idDownload)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user