Skip to content
This repository has been archived by the owner on Mar 13, 2019. It is now read-only.

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
josecolella committed Jun 29, 2014
1 parent 5a144b7 commit d90e56b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
37 changes: 20 additions & 17 deletions visualization/static/visualization/js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

var i = 0;
var rightStateClass = "glyphicon-chevron-right";
var downStateClass = 'glyphicon-chevron-down';
var csv;
Expand Down Expand Up @@ -236,7 +235,7 @@ var addDataGrid = function(data) {
$("#files-table").hide();

var workspace = $("#workspace");
var dataTableDiv = $("#dataTable");

//Doesn't exist create it
function buildMenu(activeCellType){
var menu = $('<ul></ul>').addClass('changeTypeMenu');
Expand Down Expand Up @@ -433,10 +432,9 @@ var getVisualizationModelTitles = function() {
var visualizationModels = {};
var titles = $(".titles p");
var containerElement = $(".titles");
var i = 0;
titles.each(function() {
visualizationModels[$(this).text()] = containerElement[i];
i++;

$.each(titles, function(index, vistitle) {
visualizationModels[$(vistitle).text()] = containerElement[index];
});

return visualizationModels;
Expand Down Expand Up @@ -519,7 +517,7 @@ var fileExtension = function(filename) {
/**
* Sets the handsontable with the columns and data that it needs to show to
* the user in the step dubbed `pre-visualization`
* @param object columns The column names
* @param Array columns The column names
* @param object data The reference to the data
*/
var initializeDataGrid = function(columns, data) {
Expand Down Expand Up @@ -645,19 +643,24 @@ var processExcelFileContents = function(url, extension) {

$(function() {

var modelTitles = getVisualizationModelTitles();

//Shows the Filter feature for the search input functionality
$("#search-term").bind('input', function() {

var input = $(this).val();
var regex = new RegExp(input.replace(input, '^'+ input), "i");
$.each(modelTitles, function(index, value) {
if (!regex.exec(index)) {
$(value).slideUp();
} else if(input === "") {
$(value).slideDown();
}
});
try {
var regex = new RegExp(input.replace(input, '^'+ input), "i");
$.each(modelTitles, function(index, value) {
if (!regex.exec(index)) {
$(value).slideUp();
} else if(input === "") {
$(value).slideDown();
}
});
}
catch(err) {
console.log(err);
}
});

$("#authetication").click(function() {
Expand All @@ -681,7 +684,7 @@ $(function() {
});
});

var modelTitles = getVisualizationModelTitles();

changeTitleCaretAction();
$("#dropzone").hide();
$(".editor").hide();
Expand Down
3 changes: 1 addition & 2 deletions visualization/templates/visualization/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ <h4 class="panel-title">
<div id="collapse{{ model.title|slugify }}" class="panel-collapse collapse">
<div class="panel-body">
<p>{{ model.description }}</p>
<button type="button" class="btn btn-info"><a class="example-button" id="{{model.title|slugify}}" href="{{ model.link }}" data-toggle="modal" data-target="#modal-{{ model.title|slugify }}">Show an example</a></button>

<button type="button" class="btn btn-info"><a class="example-button" id="{{model.title|slugify}}-example" href="#" data-toggle="modal" data-target="#modal-{{ model.title|slugify }}">Show an example</a></button>
</div>
</div>
</div>
Expand Down

0 comments on commit d90e56b

Please sign in to comment.