Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract css rules and scripts into separate files. #38

Merged
merged 3 commits into from
Oct 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,487 changes: 0 additions & 6,487 deletions panoramix/static/bootstrap-theme.css

This file was deleted.

90 changes: 0 additions & 90 deletions panoramix/static/main.css

This file was deleted.

123 changes: 122 additions & 1 deletion panoramix/static/panoramix.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,129 @@ input[type="checkbox"] {
height: 16px;
float: right;
}

form div {
padding-top: 1px;
}
.navbar-brand a {
color: white;
}
.navbar {
-webkit-box-shadow: 0px 3px 3px #AAA;
-moz-box-shadow: 0px 3px 3px #AAA;
box-shadow: 0px 3px 3px #AAA;
z-index: 999;
}
.panel.panel-primary {
margin: 10px;
}

.index .carousel img {
max-height: 500px;
}
.index .carousel {
overflow: hidden;
height: 500px;
}
.index .carousel-caption h1 {
font-size: 80px;
}
.index .carousel-caption p {
font-size: 25px;
}
.index div.carousel-caption{
background: rgba(0,0,0,0.5);
border-radius: 20px;
top: 150px;
bottom: auto !important;
}
.index .carousel-inner > .item > img {
margin: 0 auto;
}
.index {
margin: -20px;
}
.index .carousel-indicators li {
background-color: #AAA;
border: 1px solid black;
}

.index .carousel-indicators .active {
background-color: #000;
border: 5px solid black;
}

.datasource .select2-container-multi .select2-choices {
height: 70px;
overflow: auto;
}
.datasource form div.form-control {
margin-bottom: 5px !important;
}
.datasource form input.form-control {
margin-bottom: 5px !important;
}
.datasource .tooltip-inner {
max-width: 350px;
}
.datasource img.loading {
width: 30px;
}

.dashboard a i {
cursor: pointer;
}
.dashboard i.drag {
cursor: move; !important
}
.dashboard .gridster .preview-holder {
z-index: 1;
position: absolute;
background-color: #AAA;
border-color: #AAA;
opacity: 0.3;
}
.dashboard .gridster li {
list-style-type: none;
border: 1px solid gray;
overflow: hidden;
box-shadow: 2px 2px 2px #AAA;
border-radius: 5px;
background-color: white;
}
.dashboard .gridster .dragging,
.dashboard .gridster .resizing {
opacity: 0.5;
}
.dashboard img.loading {
width: 20px;
margin: 5px;
}
.dashboard .title {
text-align: center;
}
.dashboard .slice_title {
text-align: center;
font-weight: bold;
font-size: 14px;
padding: 5px;
}
.dashboard div.gridster {
visibility: hidden
}
.dashboard div.slice_content {
width: 100%;
height: 100%;
}
.dashboard table.widget_header {
width: 100%;
height: 20px;
}
.dashboard td.icons {
width: 50px;
}
.dashboard td.icons nobr {
display: none;
}
div.header {
font-weight: bold;
}
164 changes: 164 additions & 0 deletions panoramix/static/panoramix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
function initializeDatasourceView() {
function getParam(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

$(".select2").select2();
$("form").show();
$('[data-toggle="tooltip"]').tooltip({container: 'body'});

function set_filters(){
for (var i = 1; i < 10; i++){
var eq = getParam("flt_eq_" + i);
if (eq != ''){
add_filter(i);
}
}
}
set_filters();

function add_filter(i) {
cp = $("#flt0").clone();
$(cp).appendTo("#filters");
$(cp).show();
if (i != undefined){
$(cp).find("#flt_eq_0").val(getParam("flt_eq_" + i));
$(cp).find("#flt_op_0").val(getParam("flt_op_" + i));
$(cp).find("#flt_col_0").val(getParam("flt_col_" + i));
}
$(cp).find('select').select2();
$(cp).find('.remove').click(function() {
$(this).parent().parent().remove();
});
}

function druidify(){
var i = 1;
// Assigning the right id to form elements in filters
$("#filters > div").each(function() {
$(this).attr("id", function() {return "flt_" + i;})
$(this).find("#flt_col_0")
.attr("id", function() {return "flt_col_" + i;})
.attr("name", function() {return "flt_col_" + i;});
$(this).find("#flt_op_0")
.attr("id", function() {return "flt_op_" + i;})
.attr("name", function() {return "flt_op_" + i;});
$(this).find("#flt_eq_0")
.attr("id", function() {return "flt_eq_" + i;})
.attr("name", function() {return "flt_eq_" + i;});
i++;
});
$("#query").submit();
}

$("#plus").click(add_filter);
$("#save").click(function () {
var slice_name = prompt("Name your slice!");
if (slice_name != "" && slice_name != null) {
$("#slice_name").val(slice_name);
$("#action").val("save");
druidify();
}
})
add_filter();
$("#druidify").click(druidify);

function create_choices(term, data) {
var filtered = $(data).filter(function() {
return this.text.localeCompare(term) === 0;
});
if (filtered.length === 0) {
return {id: term, text: term};
}
}
function initSelectionToValue(element, callback) {
callback({id: element.val(), text: element.val()});
}
$(".select2_free_since").select2({
createSearchChoice: create_choices,
initSelection: initSelectionToValue,
multiple: false,
data: [
{id: '-1 hour', text: '-1 hour'},
{id: '-12 hours', text: '-12 hours'},
{id: '-1 day', text: '-1 day'},
{id: '-7 days', text: '-7 days'},
{id: '-28 days', text: '-28 days'},
{id: '-90 days', text: '-90 days'},
]
});
$(".select2_free_until").select2({
createSearchChoice: create_choices,
initSelection: initSelectionToValue,
multiple: false,
data: [
{id: 'now', text: 'now'},
{id: '-1 day', text: '-1 day'},
{id: '-7 days', text: '-7 days'},
{id: '-28 days', text: '-28 days'},
{id: '-90 days', text: '-90 days'},
]
});
$(".select2_free_granularity").select2({
createSearchChoice: create_choices,
initSelection: initSelectionToValue,
multiple: false,
data: [
{id: 'all', text: 'all'},
{id: '5 seconds', text: '5 seconds'},
{id: '30 seconds', text: '30 seconds'},
{id: '1 minute', text: '1 minute'},
{id: '5 minutes', text: '5 minutes'},
{id: '1 day', text: '1 day'},
{id: '7 days', text: '7 days'},
]
});
}

function initializeDashboardView() {
var gridster = $(".gridster ul").gridster({
widget_margins: [5, 5],
widget_base_dimensions: [100, 100],
draggable: {
handle: '.drag',
},
resize: {
enabled: true,
stop: function(e, ui, _widget) {
_widget.find("a.refresh").click();
}
},
serialize_params: function(_w, wgd) {
return {
slice_id: $(_w).attr('slice_id'),
col: wgd.col,
row: wgd.row,
size_x: wgd.size_x,
size_y: wgd.size_y
};
},
}).data('gridster');
$("div.gridster").css('visibility', 'visible');
$("#savedash").click(function() {
var data = gridster.serialize();
$.ajax({
type: "POST",
url: '/panoramix/save_dash/{{ dashboard.id }}/',
data: {data: JSON.stringify(data)},
success: function() {},
});
});
$("a.closewidget").click(function() {
var li = $(this).parents("li");
gridster.remove_widget(li);
});
$("table.widget_header").mouseover(function() {
$(this).find("td.icons nobr").show();
});
$("table.widget_header").mouseout(function() {
$(this).find("td.icons nobr").hide();
});
}
Loading