'use strict' ; import { inject , parentView , View , ActivityAPI } from '../../index' ; import { IActivityData , IFileData } from 'teambition' ; declare const wx ; @ parentView ( 'DetailView' ) @ inject ( [ 'ActivityAPI' ] ) export class ActivityView extends View { public activities : IActivityData [ ] ; private ActivityAPI : ActivityAPI ; public onInit ( ) { let _boundToObjectType = this . parent . _boundToObjectType ; let _boundToObjectId = this . parent . _boundToObjectId ; return this . ActivityAPI . fetch ( _boundToObjectType , _boundToObjectId ) . then ( ( activities ) => { this . activities = activities ; } ) ; } public openDetail ( linked ) { if ( linked ) { window . location . hash = `/detail/${ linked . objectType }/${ linked . _objectId }` ; } } public openAtta ( atta ) { if ( atta . fileCategory === 'image' ) { wx . previewImage ( { current : atta . downloadUrl , urls : [ atta . downloadUrl ] } ) ; } else { window . location . hash = `/detail/work/${ atta . _id }` ; } } } angular . module ( 'teambition' ) . controller ( 'ActivityView' , ActivityView ) ;