diff --git a/critiquebrainz/expand.py b/critiquebrainz/expand.py new file mode 100644 index 000000000..a93c54705 --- /dev/null +++ b/critiquebrainz/expand.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +import html +import re + + +def encode_entities(string, quote=True): + return html.escape(string, quote).encode('ascii', 'xmlcharrefreplace').decode('utf8') + + +def expand(string, args, tag='a', default_attribute='href'): + + def make_link(match): + var = match.group(1) + text = match.group(2) + if text in args.keys(): + final_text = args[text] + else: + final_text = text + + if isinstance(args[var], dict): + d = args[var] + else: + if default_attribute: + d = {default_attribute: args[var]} + else: + d = {} + attribs = ' '.join(["%s=\"%s\"" % (k, encode_entities(d[k])) for k + in sorted(d.keys())]) + if attribs: + attribs = ' ' + attribs + return '<%s%s>%s%s>' % (tag, attribs, final_text, tag) + + def simple_expr(match): + var = match.group(1) + if var in args.keys(): + return args[var] + return '{' + var + '}' + + r = '|'.join([re.escape(k) for k in args.keys()]) + + r1 = re.compile('\{(' + r + ')\|(.*?)\}', re.UNICODE) + r2 = re.compile('\{(' + r + ')\}', re.UNICODE) + + string = r1.sub(make_link, string) + string = r2.sub(simple_expr, string) + + return string diff --git a/critiquebrainz/frontend/__init__.py b/critiquebrainz/frontend/__init__.py index 0d8038253..b96029cf6 100644 --- a/critiquebrainz/frontend/__init__.py +++ b/critiquebrainz/frontend/__init__.py @@ -18,6 +18,10 @@ def create_app(debug=None, config_path=None): use_flask_uuid=True, ) + # Template utilities + from critiquebrainz.expand import expand + app.jinja_env.filters['expand'] = expand + # Configuration files app.config.from_pyfile(os.path.join( os.path.dirname(os.path.realpath(__file__)), @@ -76,9 +80,9 @@ def create_app(debug=None, config_path=None): add_robots(app) # BookBrainz Database - import critiquebrainz.frontend.external.bookbrainz_db as bookbrainz_db + import critiquebrainz.frontend.external.bookbrainz_db as bookbrainz_db bookbrainz_db.init_db_engine(app.config.get("BB_DATABASE_URI")) - + # MusicBrainz Database from brainzutils import musicbrainz_db musicbrainz_db.init_db_engine(app.config.get("MB_DATABASE_URI")) diff --git a/critiquebrainz/frontend/static/images/logo_text.svg b/critiquebrainz/frontend/static/images/logo_text.svg new file mode 100644 index 000000000..d15167ef2 --- /dev/null +++ b/critiquebrainz/frontend/static/images/logo_text.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/critiquebrainz/frontend/static/images/metabrainz-icon-detail.svg b/critiquebrainz/frontend/static/images/metabrainz-icon-detail.svg new file mode 100644 index 000000000..9795e24e6 --- /dev/null +++ b/critiquebrainz/frontend/static/images/metabrainz-icon-detail.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/critiquebrainz/frontend/static/styles/main.less b/critiquebrainz/frontend/static/styles/main.less index 70eb9e048..a91d187eb 100644 --- a/critiquebrainz/frontend/static/styles/main.less +++ b/critiquebrainz/frontend/static/styles/main.less @@ -56,23 +56,81 @@ body { } } -// Footer .footer { - font-size: 13px; - line-height: 20px; - border-top: 2px solid #36b5b2; - padding-top: 20px; - .title { - font-weight: bold; - margin-bottom: 6px; + hr { + border: none; + height: 8px; + background: linear-gradient(to right, #37b5b3, #ffa501); } + + h3 { + font-size: 2rem; + font-weight: 600; + } + ul { - padding: 0; - li { list-style: none; } + line-height: 2; } - .meb-credit { - margin-top: 10px; - font-weight: bold; + + li>.glyphicon { + font-size: 10px; + padding-right: 4px; + } + + .section-line { + padding-top: 30px; + border-top: 1px solid #ddd; + text-align: center; + } + + .footer-links { + margin-bottom: 20px; + } + + .footer-credits { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-evenly; + + .footer-source-link { + flex-basis: 30%; + text-align: start; + align-self: center; + padding-left: 15px; + } + + .footer-foundation { + flex-basis: content; + align-self: center; + flex-grow: 100; + } + + .footer-ticket-link { + flex-basis: 30%; + text-align: end; + align-self: center; + padding-right: 15px; + } + + @media (max-width: @screen-sm-max) { + flex-wrap: wrap; + + .footer-foundation { + order: 1; + flex-basis: 100%; + } + + .footer-source-link { + order: 2; + flex-basis: 50%; + } + + .footer-ticket-link { + order: 3; + flex-basis: 50%; + } + } } } diff --git a/critiquebrainz/frontend/templates/footer.html b/critiquebrainz/frontend/templates/footer.html index ea7ba27ef..2ae13550a 100644 --- a/critiquebrainz/frontend/templates/footer.html +++ b/critiquebrainz/frontend/templates/footer.html @@ -9,46 +9,118 @@ {% endif %} -