Skip to content

Commit

Permalink
Merge c37593e into bca6758
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaLekic committed Dec 11, 2019
2 parents bca6758 + c37593e commit e3e0440
Show file tree
Hide file tree
Showing 15 changed files with 9,661 additions and 487 deletions.
9,013 changes: 9,012 additions & 1 deletion ckanext/knowledgehub/fanstatic/css/main.css

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions ckanext/knowledgehub/fanstatic/javascript/copy_clipboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function copyToClipBoard() {

var copyText = document.getElementById("copyFrom")

copyText.select()

document.execCommand("copy")

}

// function copyToClipBoard() {
// var range = document.createRange();
// range.selectNode(document.getElementById("copyFrom"));
// window.getSelection().removeAllRanges(); // clear current selection
// window.getSelection().addRange(range); // to select text
// document.execCommand("copy");
// window.getSelection().removeAllRanges();// to deselect

// alert("clicked")
// alert(range + "clicked")
// }
3 changes: 2 additions & 1 deletion ckanext/knowledgehub/fanstatic/javascript/modules/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ ckan.module('chart', function () {

options.title = {
text: titleVal,
position: "upper-right",
//position: "upper-right",
padding: {
left: 0,
right: 150,
Expand Down Expand Up @@ -525,6 +525,7 @@ ckan.module('chart', function () {
}

var subtitle = (this.options.chart_subtitle === true) ? '' : this.options.chart_subtitle;

var chartDescription = (this.options.chart_description === true) ? '' : this.options.chart_description;

var info = [subtitle, chartDescription];
Expand Down
23 changes: 13 additions & 10 deletions ckanext/knowledgehub/fanstatic/javascript/modules/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,13 @@ ckan.module('table', function () {
var category_name = (this.options.category_name === true) ? '' : this.options.category_name;
var title = (this.options.table_title === true) ? '' : this.options.table_title;
var subtitle = (this.options.table_subtitle === true) ? '' : this.options.table_subtitle;
subtitle.length > 30 ? subtitle = subtitle.substring(0,30) + "..." : null;
subtitle.length > 30 ? subtitle = subtitle.substring(0, 30) + "..." : null;
var description = (this.options.table_description === true) ? '' : this.options.table_description;
description.length > 50 ? description = description.substring(0,50) + "..." : null;
description.length > 50 ? description = description.substring(0, 50) + "..." : null;
var filename_export = (title === '') ? this.options.resource_name : title;



filename_export = filename_export.split('.').slice(0, 1).join('.');

this.el.text('');
Expand All @@ -225,7 +227,7 @@ ckan.module('table', function () {
} else {
html = module.render_data_table(rows, main_value, y_axis);
}
// var table = module.el.next('#table-item-' + module.options.resource_id);
// var table = module.el.next('#table-item-' + module.options.resource_id);
var table = $('#table-item-' + module.options.resource_id);
// Enable jquery.datatable
if ($.fn.DataTable.isDataTable(table)) table.DataTable().destroy();
Expand All @@ -245,7 +247,8 @@ ckan.module('table', function () {
'className': 'btn btn-default',
'title': filename_export
},
{ 'extend': 'pdf',
{
'extend': 'pdf',
'className': 'btn btn-default',
'title': filename_export
},
Expand All @@ -254,7 +257,7 @@ ckan.module('table', function () {
});

// Set title value
$("div.dt-header").html(`<div></div><div>${title} <p>${subtitle}</p> <p>${description}</p><div>`);
$("div.dt-header").html(`<div>${title} <p>${subtitle}</p> <p>${description}</p><div>`);
} else {
this.el.text(this._('Table could not be created!'));
}
Expand All @@ -269,21 +272,21 @@ ckan.module('table', function () {
var sqlStringExceptSelect = parsedSqlString[1];
var tableField = this.el.closest('.table_item');

var y_operation_selected = tableField.find('[name*=table_y_axis_operation]');
var y_operation_selected = tableField.find('[name*=table_y_axis_operation]');
var y_operation_value = y_operation_selected.val();

// If category is set
// we need the first column as a pivot column
// see comments inside this.render_data_table_with_category
if (category_name) {
if(y_operation_value == "MAX") {
if (y_operation_value == "MAX") {
return 'SELECT ' + '"' + category_name + '", "' + main_value + '", MAX("' + y_axis + '") as ' + '"' + y_axis + '"' + sqlStringExceptSelect + ' GROUP BY "' + category_name + '", "' + main_value + '"';
}
else {
return 'SELECT ' + '"' + category_name + '", "' + main_value + '", SUM("' + y_axis + '") as ' + '"' + y_axis + '"' + sqlStringExceptSelect + ' GROUP BY "' + category_name + '", "' + main_value + '"';
}
} else {
if(y_operation_value == "MAX") {
if (y_operation_value == "MAX") {
return 'SELECT ' + '"' + main_value + '", MAX("' + y_axis + '") as ' + '"' + y_axis + '"' + sqlStringExceptSelect + ' GROUP BY "' + main_value + '"';
}
else {
Expand All @@ -296,7 +299,7 @@ ckan.module('table', function () {

// default tables
render_data_table: function (rows, main_value, y_axis) {
main_value = typeof main_value === 'string' ? main_value.toLowerCase(): main_value;
main_value = typeof main_value === 'string' ? main_value.toLowerCase() : main_value;
y_axis = typeof y_axis === 'string' ? y_axis.toLowerCase() : y_axis;

// Prepare data
Expand Down Expand Up @@ -455,7 +458,7 @@ ckan.module('table', function () {
this.createTable(yVal, xVal, true);
},

capitalize: function(s) {
capitalize: function (s) {
if (typeof s !== 'string') return s
return s.charAt(0).toUpperCase() + s.slice(1)
},
Expand Down
66 changes: 33 additions & 33 deletions ckanext/knowledgehub/fanstatic/javascript/resource_feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
api.get('resource_user_feedback', {
resource: resource
})
.done(function (data) {
if (data.success) {
var feedbacks = data.result;
feedbacks.forEach(function (feedback) {
var type = feedback.type;
userFeedbacks[type] = type;
.done(function (data) {
if (data.success) {
var feedbacks = data.result;
feedbacks.forEach(function (feedback) {
var type = feedback.type;
userFeedbacks[type] = type;

var activeButton = $("#btn-" + type);
activeButton.attr('disabled', true);
});
}
})
.fail(function (error) {
console.log("Resource feedback: " + error.statusText);
});
var activeButton = $("#btn-" + type);
activeButton.attr('disabled', true);
});
}
})
.fail(function (error) {
console.log("Resource feedback: " + error.statusText);
});
};

function resourceFeedback(type, resource, dataset) {
Expand All @@ -58,28 +58,28 @@
resource: resource,
dataset: dataset
})
.done(function (data) {
if (data.success) {
var oppositeType = oppositeRF[type];
var newUserCount = $("#count-" + type);
var userCount = $("#count-" + oppositeType);
.done(function (data) {
if (data.success) {
var oppositeType = oppositeRF[type];
var newUserCount = $("#count-" + type);
var userCount = $("#count-" + oppositeType);

if (Object.keys(userFeedbacks).length > 0) {
if (userFeedbacks[oppositeType] !== undefined) {
removeDisabledAttr(oppositeType);
userCount.text(parseInt(userCount.text()) - 1);
if (Object.keys(userFeedbacks).length > 0) {
if (userFeedbacks[oppositeType] !== undefined) {
removeDisabledAttr(oppositeType);
userCount.text(parseInt(userCount.text()) - 1);
}
}
}

newUserCount.text(parseInt(newUserCount.text()) + 1);
delete userFeedbacks[oppositeType];
userFeedbacks[type] = type;
btn.attr('disabled', true);
}
})
.fail(function (error) {
console.log("Add resource feedback: " + error.statusText);
});
newUserCount.text(parseInt(newUserCount.text()) + 1);
delete userFeedbacks[oppositeType];
userFeedbacks[type] = type;
btn.attr('disabled', true);
}
})
.fail(function (error) {
console.log("Add resource feedback: " + error.statusText);
});
};

function removeDisabledAttr(type) {
Expand Down
40 changes: 24 additions & 16 deletions ckanext/knowledgehub/fanstatic/less/_buttons.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,73 @@
}

.btn-primary-outline {

&,
&:hover {
border-color: @white;
}
}
.content_action{
& >.btn-danger{

.content_action {
&>.btn-danger {
margin-bottom: @grid-gutter-width / 3;
}
}

.content_action > .btn-default {
.content_action>.btn-default {
margin-bottom: @grid-gutter-width / 3;
outline: none;
border: none;
&:hover{

&:hover {
background-color: @gray-lighter;
}
}

.btn-data-source {
bottom: 49px;
left: 193px;
}

.btn-remove-data-source {
position: relative;
top: 31px;
right: 25px;
padding: 0 @grid-gutter-width / 2;
border-radius: @border-radius-xlarge;
}
.remove-filter-item-btn{

.remove-filter-item-btn {
color: @brand-danger;
background: transparent;

&:hover,
&:focus,
&:active{
&:active {
background: transparent;
border: 1px solid @brand-danger;
color: @brand-danger;
}

}
.dt-buttons{
&>*{

.dt-buttons {
&>* {
margin: .5rem .5rem .5rem 0;
}
& >*:first-child{

&>*:first-child {
margin: .5rem .5rem;
}
}

.add-visualization-btn {
margin-top: 25px;
margin-bottom: 50px;
margin-top: 25px;
margin-bottom: 50px;
}


.btn-chart-download{
.btn-chart-download {
cursor: pointer;
margin-left: auto;
padding: 0 10px;
Expand All @@ -69,7 +78,6 @@


.download-dashboard-btn {
position: absolute;
left: 10px;
bottom: 10px;
}
left: 10px;
bottom: 10px;
}
39 changes: 36 additions & 3 deletions ckanext/knowledgehub/fanstatic/less/_content.less
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,34 @@
}

.dashboard-section {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
min-height: 700px;
background-color: white;
margin-left: 0;
margin-right: 0;

}

.dashboard-wrapper {

// height: 100%;
// display: flex;
// align-content: center;
// justify-content: center;

background-color: #fff;
}

// .dashboard-section {
// max-width: 80%;
// min-height: 700px;
// //background-color: #fff;
// margin: auto;
// }


//Create Dataset
.stages li.active {
Expand Down Expand Up @@ -173,12 +191,27 @@
}

.viz-view-item {
float: left;
margin-left: 30px;
margin-top: 30px;
margin-bottom: 80px;
//flex: 1 0 450px;
//flex-grow: 1;
flex: 1 0 auto;
min-width: 450px;

@media only screen and (max-width: 465px) {
min-width: 300px;

}

}

// .viz-view-item {
// float: left;
// margin-left: 30px;
// margin-top: 30px;
// margin-bottom: 80px;
// }

//Tornado Chart Style
.bar--positive {
fill: #9BCCF5;
Expand Down
Loading

0 comments on commit e3e0440

Please sign in to comment.