From f5e0ed7239ecf3b404e56d6d7352079e915648d1 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 23 Feb 2016 11:19:58 -0800 Subject: [PATCH] A simple base template for npm --- panoramix/assets/html/base.html | 1 - panoramix/assets/html/explore.html | 8 ++-- panoramix/assets/javascripts/base.js | 3 ++ panoramix/assets/javascripts/index.jsx | 1 + panoramix/assets/package.json | 1 + panoramix/config.py | 9 ---- .../templates/appbuilder/navbar_right.html | 43 +++++++++++++++++++ panoramix/templates/panoramix/basic.html | 38 ++++++++++++++++ panoramix/templates/panoramix/explore.html | 7 ++- 9 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 panoramix/templates/appbuilder/navbar_right.html create mode 100644 panoramix/templates/panoramix/basic.html diff --git a/panoramix/assets/html/base.html b/panoramix/assets/html/base.html index 4baa4648e1678..006b74d1cce69 100644 --- a/panoramix/assets/html/base.html +++ b/panoramix/assets/html/base.html @@ -9,7 +9,6 @@ - {% endblock %} {% block body %} diff --git a/panoramix/assets/html/explore.html b/panoramix/assets/html/explore.html index 27f49b0a0129d..7f94ed1b337f0 100644 --- a/panoramix/assets/html/explore.html +++ b/panoramix/assets/html/explore.html @@ -1,6 +1,6 @@ -{% extends "refactor/base.html" %} +{% extends "panoramix/basic.html" %} -{% block content_fluid %} +{% block body %} {% set datasource = viz.datasource %} {% set form = viz.form %} @@ -132,14 +132,14 @@ {{ form.flt_op_0(class_="form-control inc") }} {{ form.flt_eq_0(class_="form-control inc") }}
diff --git a/panoramix/assets/javascripts/base.js b/panoramix/assets/javascripts/base.js index ff883732e78fa..456d34af1947a 100644 --- a/panoramix/assets/javascripts/base.js +++ b/panoramix/assets/javascripts/base.js @@ -1,3 +1,6 @@ // Currently requires global app dependencies in one place. Css could go here too. +require('select2'); +require('bootstrap'); + window.d3 = require('d3'); window.px = require('./modules/panoramix.js'); diff --git a/panoramix/assets/javascripts/index.jsx b/panoramix/assets/javascripts/index.jsx index 433d6959fab8e..26fd378102ccf 100644 --- a/panoramix/assets/javascripts/index.jsx +++ b/panoramix/assets/javascripts/index.jsx @@ -1,6 +1,7 @@ import React from 'react'; import { render } from 'react-dom'; import { Jumbotron } from 'react-bootstrap'; +require('bootstrap'); class App extends React.Component { render () { diff --git a/panoramix/assets/package.json b/panoramix/assets/package.json index 10a743d6bc7d3..8857c4de524c0 100644 --- a/panoramix/assets/package.json +++ b/panoramix/assets/package.json @@ -46,6 +46,7 @@ "d3-tip": "^0.6.7", "d3.layout.cloud": "^1.2.0", "exports-loader": "^0.6.3", + "font-awesome": "^4.5.0", "gridster": "^0.5.6", "imports-loader": "^0.6.5", "jquery": "^2.2.1", diff --git a/panoramix/config.py b/panoramix/config.py index 7b57117c72f59..2b05cffbcfc8d 100644 --- a/panoramix/config.py +++ b/panoramix/config.py @@ -97,16 +97,7 @@ # The allowed translation for you app LANGUAGES = { 'en': {'flag': 'us', 'name': 'English'}, - 'fr': {'flag': 'fr', 'name': 'French'}, } -""" -'pt': {'flag':'pt', 'name':'Portuguese'}, -'pt_BR': {'flag':'br', 'name': 'Pt Brazil'}, -'es': {'flag':'es', 'name':'Spanish'}, -'de': {'flag':'de', 'name':'German'}, -'zh': {'flag':'cn', 'name':'Chinese'}, -'ru': {'flag':'ru', 'name':'Russian'} -""" # --------------------------------------------------- # Image and file configuration # --------------------------------------------------- diff --git a/panoramix/templates/appbuilder/navbar_right.html b/panoramix/templates/appbuilder/navbar_right.html new file mode 100644 index 0000000000000..433bf1bf48db2 --- /dev/null +++ b/panoramix/templates/appbuilder/navbar_right.html @@ -0,0 +1,43 @@ + +{% macro locale_menu(languages) %} +{% set locale = session['locale'] %} +{% if not locale %} + {% set locale = 'en' %} +{% endif %} + +{% endmacro %} + + + +{% if not current_user.is_anonymous() %} + +{% else %} +
  • + {{_("Login")}}
  • +{% endif %} diff --git a/panoramix/templates/panoramix/basic.html b/panoramix/templates/panoramix/basic.html new file mode 100644 index 0000000000000..65b3c61413bbe --- /dev/null +++ b/panoramix/templates/panoramix/basic.html @@ -0,0 +1,38 @@ + + + {% block title %}{{ app_name }}{% endblock %} + {% block head_meta %}{% endblock %} + {% block head_css %} + + + + + {% endblock %} + {% block head_js %} + + + + + {% endblock %} + + + + {% block navbar %} + {% if not viz or viz.request.args.get("standalone") != "true" %} +
    + {% include 'appbuilder/navbar.html' %} +
    + {% endif %} + {% endblock %} + + {% block body %} +
    + Oops! React.js is not working properly. +
    + {% endblock %} + + {% block tail_js %} + + {% endblock %} + + diff --git a/panoramix/templates/panoramix/explore.html b/panoramix/templates/panoramix/explore.html index f291edee88037..67b52435436eb 100644 --- a/panoramix/templates/panoramix/explore.html +++ b/panoramix/templates/panoramix/explore.html @@ -1,9 +1,8 @@ -{% extends "panoramix/base.html" %} +{% extends "panoramix/basic.html" %} {% block head_css %} {{super()}} - {% endblock %} {% block content_fluid %} @@ -124,13 +123,13 @@ {{ form.flt_op_0(class_="form-control inc") }} {{ form.flt_eq_0(class_="form-control inc") }}