Skip to content

Commit

Permalink
Remove base.entry.js, declare all JS dependencies in explore using np…
Browse files Browse the repository at this point in the history
…m. Pin older select2 version to enable select2Sortable.
  • Loading branch information
williaster committed Feb 24, 2016
1 parent 71073d8 commit 3e83460
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 59 deletions.
8 changes: 1 addition & 7 deletions panoramix/assets/html/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{% extends "refactor/base.html" %}

{% block content_fluid %}
<div id="app">
Oops! React.js is not working properly.
</div>
{% endblock %}
{% extends "panoramix/base.html" %}

{% block tail_js %}
{{ super() }}
Expand Down
6 changes: 0 additions & 6 deletions panoramix/assets/javascripts/base.js

This file was deleted.

17 changes: 11 additions & 6 deletions panoramix/assets/javascripts/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
// Init explorer view -> load vis dependencies -> read data (from dynamic html) -> render slice
// nb: to add a new vis, you must also add a Python fn in viz.py

// css
require('../vendor/pygments.css');
require('../vendor/bootstrap-toggle/bootstrap-toggle.min.css');

// js
var $ = window.$ || require('jquery');
var px = window.px || require('./modules/panoramix.js');
var $ = window.$ = require('jquery');
var jQuery = window.jQuery = $;
var px = require('./modules/panoramix.js');
var d3 = require('d3');

require('bootstrap');
require('jquery-ui');
require('select2');
require('../vendor/bootstrap-toggle/bootstrap-toggle.min.js');
require('../vendor/select2.sortable.js');

// css
require('../vendor/pygments.css');
require('../vendor/bootstrap-toggle/bootstrap-toggle.min.css');

// vis sources
var sourceMap = {
area: 'nvd3_vis.js',
Expand Down
3 changes: 2 additions & 1 deletion panoramix/assets/javascripts/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var $ = require('jquery');
var jQuery = $;
import React from 'react';
import { render } from 'react-dom';
import { Jumbotron } from 'react-bootstrap';
require('bootstrap');

class App extends React.Component {
render () {
Expand Down
7 changes: 4 additions & 3 deletions panoramix/assets/javascripts/modules/panoramix.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var $ = window.$ || require('jquery');
var d3 = window.d3 || require('d3');
var $ = require('jquery'), jQuery = $;
var d3 = require('d3');

var color = function(){
// Color related utility functions go in this object
Expand Down Expand Up @@ -447,7 +447,8 @@ var px = (function() {
}
}
var obj = parent.append(
'<input class="' + $(this).attr('class') + '" name="'+ name +'" type="text" value="' + selected + '">');
'<input class="' + $(this).attr('class') + '" name="'+ name +'" type="text" value="' + selected + '">'
);
$("input[name='" + name +"']").select2({
createSearchChoice: create_choices,
initSelection: initSelectionToValue,
Expand Down
2 changes: 1 addition & 1 deletion panoramix/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"react": "^0.14.7",
"react-bootstrap": "^0.28.3",
"react-dom": "^0.14.7",
"select2": "^4.0.1",
"select2": "3.5",
"topojson": "^1.6.22",
"webpack": "^1.12.12"
},
Expand Down
8 changes: 0 additions & 8 deletions panoramix/assets/stylesheets/panoramix.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ form div {
text-align: right;
}

.select2-results .select2-highlighted {
background-color: #005c66;
}

.notbtn {
cursor: default;
}
Expand Down Expand Up @@ -154,10 +150,6 @@ legend {
border: 5px solid black;
}

.datasource .select2-container-multi .select2-choices {
height: 70px;
overflow: auto;
}
.datasource form div.form-control {
margin-bottom: 5px !important;
}
Expand Down
17 changes: 2 additions & 15 deletions panoramix/assets/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ var BUILD_DIR = path.resolve(__dirname, './javascripts/dist'); // output
var config = {
// for now generate one compiled js file per entry point / html page
entry: {
base: APP_DIR + '/javascripts/base.js',
index: APP_DIR + '/javascripts/index.jsx',
// dashboard: APP_DIR + '/javascripts/dist/dashboard.js',
explore: APP_DIR + '/javascripts/explore.js',
// dashboard: APP_DIR + '/javascripts/dist/dashboard.js',
},
output: {
path: BUILD_DIR,
Expand All @@ -31,19 +30,7 @@ var config = {
}
]
},
plugins: [
// // @TODO: this will be used in the future to expose these packages through global window vars
// new webpack.ProvidePlugin({
// '$': "jquery",
// 'window.$': "jquery",

// 'jQuery': "jquery",
// 'window.jQuery': "jquery",

// 'window.d3': "d3",
// 'window.px': APP_DIR + '/javascripts/modules/panoramix.js'
// })
]
plugins: []
};

module.exports = config;
24 changes: 12 additions & 12 deletions panoramix/templates/panoramix/basic.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<html>
<head>
<title>{% block title %}{{ app_name }}{% endblock %}</title>
<title>
{% block title %}
{% if appbuilder and appbuilder.app_name %} {{ appbuilder.app_name }} {% endif %}
{% endblock %}
</title>
{% block head_meta %}{% endblock %}
{% block head_css %}
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/jquery-ui/themes/base/minified/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/select2/dist/css/select2.min.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/themes/bootswatch.paper.min.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/select2/select2.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/select2/select2-bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/panoramix.css" />
<!-- Replace with custom bootstrap theme -->
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/themes/bootswatch.paper.min.css" />
{% endblock %}
{% block head_js %}
<script src="/static/refactor/node_modules/jquery/dist/jquery.min.js"></script>
<script src="/static/refactor/node_modules/select2/dist/js/select2.full.min.js"></script>
<script src="/static/refactor/vendor/jquery-ui/jquery-ui.min.js"></script>
<script src="/static/refactor/vendor/select2.sortable.js"></script>
{% endblock %}
{% block head_js %}{% endblock %}
</head>

<body>
Expand All @@ -31,8 +33,6 @@
</div>
{% endblock %}

{% block tail_js %}
<script src="/static/refactor/javascripts/dist/base.entry.js"></script>
{% endblock %}
{% block tail_js %}{% endblock %}
</body>
</html>

0 comments on commit 3e83460

Please sign in to comment.