@@ -1517,8 +1517,19 @@ input.input-inline {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
min-height: 12px;
|
min-height: 12px;
|
||||||
}
|
}
|
||||||
li input[type=checkbox] {
|
|
||||||
margin: 0px 10px 0px -20px;
|
li input[type="checkbox"].checkbox + label::before {
|
||||||
|
margin-left: -15px;
|
||||||
|
|
||||||
|
}
|
||||||
|
input[type="checkbox"].checkbox + label::before {
|
||||||
|
position: relative;
|
||||||
|
z-index: 100;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
li input[type="checkbox"].checkbox:not(:checked) + label::before {
|
||||||
|
background-color: $color-main-background;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||||||
* @returns array of [finished, total] checkboxes
|
* @returns array of [finished, total] checkboxes
|
||||||
*/
|
*/
|
||||||
$scope.getCheckboxes = function(text) {
|
$scope.getCheckboxes = function(text) {
|
||||||
const regTotal = /\[(X|\s|\_|\-)\]\s(.*)/ig;
|
const regTotal = /\[(X|\s|\_|\-)\]/igm;
|
||||||
const regFinished = /\[(X|\_|\-)\]\s(.*)/ig;
|
const regFinished = /\[(X|\_|\-)\]/igm;
|
||||||
return [
|
return [
|
||||||
((text || '').match(regFinished) || []).length,
|
((text || '').match(regFinished) || []).length,
|
||||||
((text || '').match(regTotal) || []).length
|
((text || '').match(regTotal) || []).length
|
||||||
@@ -375,7 +375,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||||||
itemMoved: function (event) {
|
itemMoved: function (event) {
|
||||||
event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column;
|
event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column;
|
||||||
var order = event.dest.index;
|
var order = event.dest.index;
|
||||||
var card = event.source.itemScope.c;
|
var card = $scope.cardservice.get(event.source.itemScope.c.id);
|
||||||
var newStack = event.dest.sortableScope.$parent.s.id;
|
var newStack = event.dest.sortableScope.$parent.s.id;
|
||||||
var oldStack = card.stackId;
|
var oldStack = card.stackId;
|
||||||
card.stackId = newStack;
|
card.stackId = newStack;
|
||||||
@@ -391,7 +391,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||||||
},
|
},
|
||||||
orderChanged: function (event) {
|
orderChanged: function (event) {
|
||||||
var order = event.dest.index;
|
var order = event.dest.index;
|
||||||
var card = event.source.itemScope.c;
|
var card = $scope.cardservice.get(event.source.itemScope.c.id);
|
||||||
var stack = event.dest.sortableScope.$parent.s.id;
|
var stack = event.dest.sortableScope.$parent.s.id;
|
||||||
CardService.reorder(card, order).then(function (data) {
|
CardService.reorder(card, order).then(function (data) {
|
||||||
StackService.reorderCard(card, order);
|
StackService.reorderCard(card, order);
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ app.controller('CardController', function ($scope, $rootScope, $sce, $location,
|
|||||||
$scope.toggleCheckbox = function (id) {
|
$scope.toggleCheckbox = function (id) {
|
||||||
$('#markdown input[type=checkbox]').attr('disabled', true);
|
$('#markdown input[type=checkbox]').attr('disabled', true);
|
||||||
$scope.status.edit = angular.copy(CardService.getCurrent());
|
$scope.status.edit = angular.copy(CardService.getCurrent());
|
||||||
var reg = /\[(X|\s|\_|\-)\]\s(.*)/ig;
|
var reg = /\[(X|\s|\_|\-)\]/ig;
|
||||||
var nth = 0;
|
var nth = 0;
|
||||||
$scope.status.edit.description = $scope.status.edit.description.replace(reg, function (match, i, original) {
|
$scope.status.edit.description = $scope.status.edit.description.replace(reg, function (match, i, original) {
|
||||||
var result = match;
|
var result = match;
|
||||||
if (nth++ === id) {
|
if ('' + nth++ === '' + id) {
|
||||||
if (match.match(/^\[\s\]/i)) {
|
if (match.match(/^\[\s\]/i)) {
|
||||||
result = match.replace(/\[\s\]/i, '[x]');
|
result = match.replace(/\[\s\]/i, '[x]');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,15 @@ checkboxReplace = function(md, options, Token) {
|
|||||||
idPrefix: 'checkbox'
|
idPrefix: 'checkbox'
|
||||||
};
|
};
|
||||||
options = Object.assign(defaults, options);
|
options = Object.assign(defaults, options);
|
||||||
pattern = /\[(X|\s|\_|\-)\]\s(.*)/i;
|
pattern = /(.*?)(\[(X|\s|\_|\-)\])(.*)/igm;
|
||||||
createTokens = function(checked, label, Token) {
|
createTokens = function(checked, label, Token, before) {
|
||||||
var id, idNumeric, nodes, token;
|
var id, idNumeric, nodes, token;
|
||||||
nodes = [];
|
nodes = [];
|
||||||
|
|
||||||
|
token = new Token("text", "", 0);
|
||||||
|
token.content = before;
|
||||||
|
nodes.push(token);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <div class="checkbox">
|
* <div class="checkbox">
|
||||||
*/
|
*/
|
||||||
@@ -42,6 +46,7 @@ checkboxReplace = function(md, options, Token) {
|
|||||||
if (checked === true) {
|
if (checked === true) {
|
||||||
token.attrs.push(["checked", "true"]);
|
token.attrs.push(["checked", "true"]);
|
||||||
}
|
}
|
||||||
|
token.attrs.push(["class", "checkbox"]);
|
||||||
nodes.push(token);
|
nodes.push(token);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,19 +73,20 @@ checkboxReplace = function(md, options, Token) {
|
|||||||
return nodes;
|
return nodes;
|
||||||
};
|
};
|
||||||
splitTextToken = function(original, Token) {
|
splitTextToken = function(original, Token) {
|
||||||
var checked, label, matches, text, value;
|
var checked, label, matches, text, value, before;
|
||||||
text = original.content;
|
text = original.content;
|
||||||
matches = text.match(pattern);
|
matches = pattern.exec(text);
|
||||||
if (matches === null) {
|
if (matches === null) {
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
checked = false;
|
checked = false;
|
||||||
value = matches[1];
|
before = matches[1];
|
||||||
label = matches[2];
|
value = matches[3];
|
||||||
|
label = matches[4];
|
||||||
if (value === "X" || value === "x") {
|
if (value === "X" || value === "x") {
|
||||||
checked = true;
|
checked = true;
|
||||||
}
|
}
|
||||||
return createTokens(checked, label, Token);
|
return createTokens(checked, label, Token, before);
|
||||||
};
|
};
|
||||||
return function(state) {
|
return function(state) {
|
||||||
lastId = 0;
|
lastId = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user