Add formulas to steps tables

This commit is contained in:
Jure Grabnar 2016-09-05 15:06:48 +02:00
parent 5c88bdeeae
commit 3b364be70b
2 changed files with 41 additions and 25 deletions

View file

@ -291,6 +291,7 @@ function initHandsOnTable(root) {
rowHeaders: true,
colHeaders: true,
fillHandle: false,
formulas: true,
cells: function (row, col, prop) {
var cellProperties = {};
@ -338,6 +339,7 @@ function initEditableHandsOnTable(root) {
rowHeaders: true,
colHeaders: true,
contextMenu: true,
formulas: true,
preventOverflow: 'horizontal'
});
@ -627,30 +629,6 @@ function expandStep(step) {
});
}
// On init
initCallBacks();
initHandsOnTable($(document));
expandAllSteps();
setupAssetsLoading();
// Init comments edit/delete
initCommentOptions("ul.content-comments");
initEditComments("#steps");
initDeleteComments("#steps");
$(function () {
$("[data-action='collapse-steps']").click(function () {
$('.step .panel-collapse').collapse('hide');
$(document).find("span.collapse-step-icon").each(function() {
$(this).addClass("glyphicon-collapse-down");
$(this).removeClass("glyphicon-collapse-up");
});
});
$("[data-action='expand-steps']").click(expandAllSteps);
});
function renderTable(table) {
$(table).handsontable("render");
// Yet another dirty hack to solve HandsOnTable problems
@ -658,3 +636,29 @@ function renderTable(table) {
$(table).find(".ht_master .wtHolder").css("height", "100%");
}
}
$(document).ready(function() {
// On init
initCallBacks();
initHandsOnTable($(document));
expandAllSteps();
setupAssetsLoading();
// Init comments edit/delete
initCommentOptions("ul.content-comments");
initEditComments("#steps");
initDeleteComments("#steps");
$(function () {
$("[data-action='collapse-steps']").click(function () {
$('.step .panel-collapse').collapse('hide');
$(document).find("span.collapse-step-icon").each(function() {
$(this).addClass("glyphicon-collapse-down");
$(this).removeClass("glyphicon-collapse-up");
});
});
$("[data-action='expand-steps']").click(expandAllSteps);
});
})

View file

@ -30,4 +30,16 @@
</div>
<% end %>
<%= javascript_include_tag "protocols/steps" %>
<%= javascript_include_tag "protocols/steps" %>
<!-- Libraries for formulas -->
<%= javascript_include_tag "lodash" %>
<%= javascript_include_tag "numeral" %>
<%= javascript_include_tag "numeric" %>
<%= javascript_include_tag "md5" %>
<%= javascript_include_tag "jstat" %>
<%= javascript_include_tag "formula" %>
<%= javascript_include_tag "parser" %>
<%= javascript_include_tag "ruleJS" %>
<%= javascript_include_tag "handsontable.formula" %>
<%= stylesheet_link_tag "handsontable.formula" %>