nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
70 lines • 3.54 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component } from '@angular/core';
import { ContextService } from '../context.service';
import { ViewModelFactoryService } from '../view-model-factory.service';
import { ActivatedRoute } from '@angular/router';
import { UrlManagerService } from '../url-manager.service';
import { ErrorService } from '../error.service';
import { PaneComponent } from '../pane/pane';
import * as Models from '../models';
import { ConfigService } from '../config.service';
var AttachmentComponent = (function (_super) {
__extends(AttachmentComponent, _super);
function AttachmentComponent(activatedRoute, urlManager, viewModelFactory, context, error, configService) {
var _this = _super.call(this, activatedRoute, urlManager, context) || this;
_this.viewModelFactory = viewModelFactory;
_this.error = error;
_this.configService = configService;
return _this;
}
AttachmentComponent.prototype.setup = function (routeData) {
var _this = this;
var oid = Models.ObjectIdWrapper.fromObjectId(routeData.objectId, this.configService.config.keySeparator);
this.context.getObject(routeData.paneId, oid, routeData.interactionMode)
.then(function (object) {
var attachmentId = routeData.attachmentId;
var attachment = object.propertyMember(attachmentId);
if (attachment) {
var avm = _this.viewModelFactory.attachmentViewModel(attachment, routeData.paneId);
if (avm) {
avm.setImage(_this);
}
}
})
.catch(function (reject) { return _this.error.handleError(reject); });
};
return AttachmentComponent;
}(PaneComponent));
AttachmentComponent = __decorate([
Component({
selector: 'nof-attachment',
template: require('./attachment.component.html'),
styles: [require('./attachment.component.css')]
}),
__metadata("design:paramtypes", [ActivatedRoute,
UrlManagerService,
ViewModelFactoryService,
ContextService,
ErrorService,
ConfigService])
], AttachmentComponent);
export { AttachmentComponent };
//# sourceMappingURL=attachment.component.js.map