Skip to content

Test case functional and cosmetic issues fixed. #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"screenfull": "^3.0.0",
"node-uuid": "^1.4.7",
"comma-separated-values": "^3.6.4",
"FileSaver.js": "^0.0.2",
"file-saver": "^1.3.3",
"zepto": "^1.1.6",
"eventemitter3": "^1.2.0",
"lodash": "3.10.1",
"almond": "~0.3.2",
"html2canvas": "^0.4.1",
"moment-timezone": "^0.5.13"
}
}
}
37 changes: 21 additions & 16 deletions example/notebook/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ define([
"key": "mctEntryDnd",
"implementation": MCTEntryDnd,
"depends": [
"$rootScope","$compile","dndService","typeService"
"$rootScope",
"$compile",
"dndService",
"typeService",
"notificationService"
]
}
],
Expand All @@ -166,7 +170,22 @@ define([
"dndService",
"$rootScope",
]
},
},

{
"key": "remove-embed",
"implementation": removeEmbedAction,
"name": "Remove...",
"cssClass": "icon-trash labeled",
"description": "Remove this embed",
"category": [
"embed",
"embed-no-snap"
],
"depends":[
"dialogService"
]
},
{
"key": "remove-snapshot",
"implementation": removeSnapshotAction,
Expand All @@ -189,20 +208,6 @@ define([
"$compile"
]
},
{
"key": "remove-embed",
"implementation": removeEmbedAction,
"name": "Remove...",
"cssClass": "icon-trash labeled",
"description": "Remove this embed",
"category": [
"embed",
"embed-no-snap"
],
"depends":[
"dialogService"
]
},
{
"key": "notebook-new-entry",
"implementation": newEntryAction,
Expand Down
4 changes: 2 additions & 2 deletions example/notebook/res/templates/controls/embedControl.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
</div>
<div class="embed-info l-flex-col">
<div class="embed-title">{{objectName}}</div>
<div class="embed-date">{{snapshot.modified| date:'yyyy-MM-dd hh:mm:ss'}}</div>
<div class="embed-date">{{snapshot.modified| date:'yyyy-MM-dd HH:mm:ss'}}</div>
</div>
</div>
<div ng-if="!snapToggle" class="l-flex-row nosnapshot">
<div class="l-flex-row">
<span ng-class="cssClass" class="abs embed-icon"></span>
<div class="embed-info">
<span class="embed-title">{{objectName}}</span>
<span class="embed-date">{{snapshot.modified| date:'yyyy-MM-dd hh:mm:ss'}}
<span class="embed-date">{{snapshot.modified| date:'yyyy-MM-dd HH:mm:ss'}}
</span>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions example/notebook/res/templates/notebook.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
<div class="entries-wrapper" ng-mouseover="handleActive()">
<ul class="entries-list">
<li class="entry l-flex-row" id="{{'entry_'+entry.createdOn}}" ng-if="hoursFilter(showTime,entry.createdOn)" ng-repeat="entry in model.entries | filter:entrySearch | orderBy: sortEntries track by $index" ng-init="$last && finished(model.entries)" mct-entry-dnd>
<div class="entry-time">{{entry.createdOn | date:'yyyy-MM-dd hh:mm:ss'}}</div>
<div class="entry-time">{{entry.createdOn | date:'yyyy-MM-dd HH:mm:ss'}}</div>
<div class="entry-info">
<div class="entry-text">
<div class="unedited-text">
<p ng-repeat="line in parseText(entry.text) track by $index">
{{line}}
</p>
</div>
<textarea ng-blur="textBlur($event,entry.createdOn)" ng-model="entry.text" placeholder="Enter text here" class="sm" rows="{{parseText(entry.text).length}}">{{entry.text}}</textarea>
<textarea ng-blur="textBlur($event,entry.createdOn)" ng-focus="textFocus($event)" ng-model="entry.text" placeholder="Enter text here" class="sm" rows="{{parseText(entry.text).length}}">{{entry.text}}</textarea>
</div>
<!-- embeds -->
<div class="embeds l-flex-row">
Expand Down Expand Up @@ -98,15 +98,15 @@
</li>
<li ng-repeat="menu in embedActions"
ng-click="menu.perform()"
title="{{menu.getMetadata().description}}"
class="{{menu.getMetadata().cssClass}}">
{{menu.getMetadata().name}}
title="{{menu.name}}"
class="{{menu.cssClass}}">
{{menu.name}}
</li>
</ul>
</div>
</div>
</div>
<div class="embed-date">{{embed.id| date:'yyyy-MM-dd hh:mm:ss'}}</div>
<div class="embed-date">{{embed.id| date:'yyyy-MM-dd HH:mm:ss'}}</div>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions example/notebook/src/actions/annotateSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ define(
function saveNotes(param){
if(param=='ok'){
painterro.save();
}else{
rootscope.snapshot = "annotationCancelled";
}
}

Expand Down
40 changes: 20 additions & 20 deletions example/notebook/src/actions/newEntryContextual.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ define(
name: 'Entry',
key: 'entry',
control: 'textarea',
required: true,
"cssClass": "l-textarea-sm"
},
{
Expand Down Expand Up @@ -90,15 +91,23 @@ define(
var linkService = this.linkService;
var dialogService = this.dialogService;
var rootScope = this.$rootScope;
rootScope.newEntryText = '';
// Create the overlay element and add it to the document's body
this.$rootScope.selObj = domainObj;
this.$rootScope.selValue = "";
var element = this.$compile(SNAPSHOT_TEMPLATE)(this.$rootScope);
var newScope = rootScope.$new();
newScope.selObj = domainObj;
newScope.selValue = "";
var element = this.$compile(SNAPSHOT_TEMPLATE)(newScope);
//newScope.$destroy();

this.$rootScope.$watch("snapshot", setSnapshot);

function setSnapshot(value){
if(value){
if(value === "annotationCancelled"){
rootScope.snapshot = rootScope.lastValue;
rootScope.lastValue = '';
}else if(value && value !== rootScope.lastValue){
var overlayModel = {
title: NEW_TASK_FORM.name,
message: NEW_TASK_FORM.message,
Expand All @@ -111,19 +120,16 @@ define(
return overlayModel.value;
}

if(value !== rootScope.lastValue){
rootScope.currentDialog = overlayModel;
rootScope.currentDialog = overlayModel;

dialogService.getDialogResponse(
"overlay-dialog",
overlayModel,
resultGetter
).then(addNewEntry);
}

dialogService.getDialogResponse(
"overlay-dialog",
overlayModel,
resultGetter
).then(addNewEntry);

rootScope.lastValue = value;
}
}
}

function addNewEntry(options){
Expand All @@ -139,12 +145,8 @@ define(
if(!options.withSnapshot){
options.snapshot = '';
}

if (options.saveNotebook.getModel().composition.indexOf(options.embedObject.getId()) !== -1) {
createSnap(options)
}else{
linkService.perform(options.embedObject, options.saveNotebook).then(createSnap(options));
}

createSnap(options);
}

function createSnap(options){
Expand Down Expand Up @@ -179,8 +181,6 @@ define(
notification.info({
title: "Notebook Entry created"
});

self.$rootScope.newEntryText = '';
}
};

Expand Down
8 changes: 4 additions & 4 deletions example/notebook/src/actions/viewSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ define(
'<ul>'+
'<li ng-repeat="menu in embedActions"'+
'ng-click="menu.perform()"'+
'title="{{menu.getMetadata().description}}"'+
'class="{{menu.getMetadata().cssClass}}">'+
'{{menu.getMetadata().name}}'+
'title="{{menu.name}}"'+
'class="{{menu.cssClass}}">'+
'{{menu.name}}'+
'</li>'+
'</ul>'+
'</div>'+
Expand All @@ -115,7 +115,7 @@ define(
'<div class="view-date">'+
'<span class="icon-alert-rect" title="Snapshot">'+
'</span> '+
'SNAPSHOT {{snapDate | date:\'yyyy-MM-dd hh:mm:ss\'}}'+
'SNAPSHOT {{snapDate | date:\'yyyy-MM-dd HH:mm:ss\'}}'+
'</div>'+
'<a class="s-button icon-pencil" title="Annotate">'+
'<span class="title-label">Annotate</span>'+
Expand Down
43 changes: 31 additions & 12 deletions example/notebook/src/controllers/notebookController.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ define(
$scope.entrySearch = '';
$scope.entryTypes = [];
$scope.embedActions = [];
$scope.currentEntryValue = '';

/*--seconds in an hour--*/

Expand Down Expand Up @@ -126,12 +127,21 @@ define(
});
};

$scope.textFocus = function($event){
if($event.currentTarget && $event.currentTarget.value){
$scope.currentEntryValue = $event.currentTarget.value;
}
}

$scope.textBlur = function($event,entryId){
if($event.target && $event.target.value !== ""){
var elementPos = $scope.domainObject.model.entries.map(function(x) {return x.createdOn}).indexOf(+(entryId));
$scope.domainObject.model.entries[elementPos].text = $event.target.value;
$scope.domainObject.model.entries[elementPos].text = $event.target.value;
if($scope.currentEntryValue !== $event.target.value){
$scope.domainObject.model.entries[elementPos].createdOn = now();
}
$scope.domainObject.useCapability('mutation', function(model) {});
}
}
}

$scope.finished = function(model){
Expand Down Expand Up @@ -182,11 +192,12 @@ define(



function actionToMenuOption(action) {
$scope.actionToMenuOption = function(action) {
return {
key: action,
key: action.getMetadata().key,
name: action.getMetadata().name,
cssClass: action.getMetadata().cssClass
cssClass: action.getMetadata().cssClass,
perform: action.perform
};
};

Expand All @@ -204,18 +215,16 @@ define(
$scope.menuActions = $scope.action ?
$scope.action.getActions({key: 'window'}) :
[];

if($scope.action){
$scope.menuActions.push(actionToMenuOption($scope.action.getActions({key: 'navigate'})[0]));
}
};

// Update set of actions whenever the action capability
// changes or becomes available.
$scope.$watch("action", updateActions);

$scope.navigate = function($event,embedType){
$event.preventDefault();
if($event){
$event.preventDefault();
}
$scope.getDomainObj(embedType).then(function(resp){
navigationService.setNavigation(resp[embedType]);
});
Expand Down Expand Up @@ -250,10 +259,20 @@ define(

/*---popups menu embeds----*/

function getEmbedActions(embedType){
function getEmbedActions(embedType){
var self = this;
if(!$scope.embedActions.length){
$scope.getDomainObj(embedType).then(function(resp){
$scope.embedActions = $scope.action.getActions({key: 'window',selectedObject:resp[embedType]});
$scope.embedActions = [];
$scope.embedActions.push($scope.actionToMenuOption(
$scope.action.getActions({key: 'window',selectedObject:resp[embedType]})[0]
));
$scope.embedActions.push({
key:'navigate',
name: 'Go to Original',
cssClass: '',
perform: function(){$scope.navigate('',embedType)}
});
});
}
};
Expand Down
8 changes: 5 additions & 3 deletions example/notebook/src/directives/MCTSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ define([
function MCTSnapshot($rootScope,$document,exportImageService,dialogService,notificationService) {
var document = $document[0];

function link($scope, $element) {

function link($scope, $element,$attrs) {
var element = $element[0];
var layoutContainer = element.parentElement,
toggleOverlay,
Expand All @@ -50,7 +49,8 @@ define([
layoutContainer.remove();
}
document.body.removeChild(snapshot);
snapshot = undefined;
snapshot = undefined;
$element.remove();
}

toggleOverlay = function () {
Expand Down Expand Up @@ -90,6 +90,7 @@ define([
'modified':Date.now()
};
closeOverlay(false);
scope.$destroy();
};

}
Expand Down Expand Up @@ -119,6 +120,7 @@ define([

$scope.$on('$destroy', function () {
$element.off('click', toggleOverlay);
$element.remove();
});
}

Expand Down
Loading