Skip to content

Commit

Permalink
Fix Code block error state
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus89 committed May 15, 2018
1 parent 5a5e6c9 commit 233b12b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
27 changes: 17 additions & 10 deletions app/scripts/services/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -1291,15 +1291,18 @@ angular.module('icestudio')
return new Promise(function(resolve) {
_.each(cells, function(cell) {
var cellView;
if ((cell.get('type') === 'ice.Code') ||
(cell.get('type') === 'ice.Generic') ||
(cell.get('type') === 'ice.Constant'))
{
if (cell.get('type') === 'ice.Code') {
cellView = paper.findViewByModel(cell);
cellView.$box.find('.code-content').removeClass('highlight-error');
cellView.clearAnnotations();
}
else if (cell.get('type') === 'ice.Generic') {
cellView = paper.findViewByModel(cell);
cellView.$box.removeClass('highlight-error');
}
else if (cell.get('type') === 'ice.Constant') {
cellView = paper.findViewByModel(cell);
cellView.$box.removeClass('highlight-error');
if (cell.get('type') === 'ice.Code') {
cellView.clearAnnotations();
}
}
});
resolve();
Expand All @@ -1311,8 +1314,7 @@ angular.module('icestudio')
_.each(cells, function(cell) {
var blockId, cellView;
if ((codeError.blockType === 'code' && cell.get('type') === 'ice.Code') ||
(codeError.blockType === 'constant' && cell.get('type') === 'ice.Constant'))
{
(codeError.blockType === 'constant' && cell.get('type') === 'ice.Constant')) {
blockId = utils.digestId(cell.id);
}
else if (codeError.blockType === 'generic' && cell.get('type') === 'ice.Generic') {
Expand All @@ -1321,7 +1323,12 @@ angular.module('icestudio')
if (codeError.blockId === blockId) {
cellView = paper.findViewByModel(cell);
if (codeError.type === 'error') {
cellView.$box.addClass('highlight-error');
if (cell.get('type') === 'ice.Code') {
cellView.$box.find('.code-content').addClass('highlight-error');
}
else {
cellView.$box.addClass('highlight-error');
}
}
if (cell.get('type') === 'ice.Code') {
cellView.setAnnotation(codeError);
Expand Down
2 changes: 1 addition & 1 deletion app/styles/design.css
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ g {
}

.highlight-error {
background: #ff8084;
background: #ff8084 !important;
}

.highlight-yellow {
Expand Down

0 comments on commit 233b12b

Please sign in to comment.