started adding code for posting tags to remote server.
This commit is contained in:
parent
a54af6a323
commit
59412048d7
3 changed files with 34 additions and 16 deletions
|
@ -23,14 +23,21 @@ module tagIt {
|
|||
this.webPageService = WebPageService;
|
||||
|
||||
// Wire up clicklistener
|
||||
this.webPageService.wireUpListener(this.onWordSelected,
|
||||
this.onWordDeSelected);
|
||||
this.webPageService.wireUpListener(
|
||||
this.onWordSelected,
|
||||
this.onWordDeSelected
|
||||
);
|
||||
}
|
||||
|
||||
onTagSelect (sense: ISense) {
|
||||
onSenseSelect (sense: ISense) {
|
||||
this.webPageService.addTagToPage(sense);
|
||||
this.backendService.storeTaggingInformation(
|
||||
sense,
|
||||
this.webPageService.currentSelectionRange,
|
||||
this.selectedWord,
|
||||
"useremail@example.org"
|
||||
);
|
||||
this.clearMenuVariables();
|
||||
this.backendService.storeTaggingInformation({});
|
||||
}
|
||||
|
||||
onWordSelected = (newWord : string) => {
|
||||
|
@ -51,19 +58,11 @@ module tagIt {
|
|||
this.$scope.$apply();
|
||||
}
|
||||
|
||||
clearMenuVariables = () {
|
||||
clearMenuVariables () {
|
||||
this.selectedWord = "";
|
||||
this.senses = [];
|
||||
}
|
||||
|
||||
selectWord (sense : ISense) {
|
||||
this.backendService.storeTaggingInformation({
|
||||
mail: "mail@nilsnh.no",
|
||||
sentence: "whole sentence",
|
||||
senseid: sense.senseid,
|
||||
});
|
||||
}
|
||||
|
||||
removeMenu() {
|
||||
$('.tagit-body').children().unwrap();
|
||||
$('.tagit-menu').remove();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<input type="text" ng-model="wordToFilterBy" class="form-control" placeholder="Filter tags" />
|
||||
|
||||
<ul id="senses">
|
||||
<li ng-click="vm.onTagSelect(sense)" id="sense.senseid" ng-repeat="sense in vm.senses | filter:wordToFilterBy" class="list-unstyled">
|
||||
<li ng-click="vm.onSenseSelect(sense)" id="sense.senseid" ng-repeat="sense in vm.senses | filter:wordToFilterBy" class="list-unstyled">
|
||||
<strong>{{sense.word}}</strong> {{sense.explanation}}
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -29,9 +29,28 @@ module tagIt {
|
|||
|
||||
// save tagging information
|
||||
// Params: email, tagging, sentence
|
||||
storeTaggingInformation (tag : Object) {
|
||||
storeTaggingInformation (sense: ISense, range: Range, selectedWord: string, userEmail: string) {
|
||||
this.$log.debug('storeTaggingInformation() was called');
|
||||
this.$log.debug(tag);
|
||||
var messageToSendToServer = {
|
||||
sense: sense,
|
||||
range: range,
|
||||
selectedWord: selectedWord,
|
||||
userEmail: userEmail
|
||||
}
|
||||
|
||||
this.$log.debug('would have sent this to the server:');
|
||||
this.$log.debug(messageToSendToServer);
|
||||
this.$log.debug('please uncomment code for actually sending to server');
|
||||
|
||||
// this.$http.post("example.org", messageToSendToServer)
|
||||
// .then((response) => {
|
||||
// this.$log.debug('successfully posted to server. Response:');
|
||||
// this.$log.debug(response);
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// this.$log.error('something went wrong when posting to server');
|
||||
// this.$log.error(error);
|
||||
// });
|
||||
}
|
||||
|
||||
private createQuery (word: string) {
|
||||
|
|
Loading…
Reference in a new issue