diff --git a/src/addon/mod/data/classes/field-plugin-component.ts b/src/addon/mod/data/classes/field-plugin-component.ts index 349ac1be7..9265a9ff6 100644 --- a/src/addon/mod/data/classes/field-plugin-component.ts +++ b/src/addon/mod/data/classes/field-plugin-component.ts @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -import { Input, OnInit, OnChanges, SimpleChange } from '@angular/core'; +import { Input, Output, OnInit, OnChanges, SimpleChange, EventEmitter } from '@angular/core'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; /** @@ -23,11 +23,13 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges { @Input() value?: any; // The value of the field. @Input() database?: any; // Database object. @Input() error?: string; // Error when editing. - @Input() viewAction?: string; // Action to perform. + @Output() gotoEntry?: EventEmitter; // Action to perform. @Input() form?: FormGroup; // Form where to add the form control. Just required for edit and search modes. @Input() search?: any; // The search value of all fields. - constructor(protected fb: FormBuilder) { } + constructor(protected fb: FormBuilder) { + this.gotoEntry = new EventEmitter(); + } /** * Add the form control for the search mode. diff --git a/src/addon/mod/data/components/field-plugin/field-plugin.ts b/src/addon/mod/data/components/field-plugin/field-plugin.ts index cf08b715e..fcab3b7dd 100644 --- a/src/addon/mod/data/components/field-plugin/field-plugin.ts +++ b/src/addon/mod/data/components/field-plugin/field-plugin.ts @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -import { Component, Input, OnInit, Injector, ViewChild, OnChanges, SimpleChange } from '@angular/core'; +import { Component, Input, Output, OnInit, Injector, ViewChild, OnChanges, SimpleChange, EventEmitter } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { AddonModDataProvider } from '../../providers/data'; import { AddonModDataFieldsDelegate } from '../../providers/fields-delegate'; @@ -32,7 +32,7 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges { @Input() value?: any; // The value of the field. @Input() database?: any; // Database object. @Input() error?: string; // Error when editing. - @Input() viewAction: string; // Action to perform. + @Output() gotoEntry: EventEmitter; // Action to perform. @Input() form?: FormGroup; // Form where to add the form control. Just required for edit and search modes. @Input() search?: any; // The search value of all fields. @@ -42,6 +42,7 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges { constructor(protected injector: Injector, protected dataDelegate: AddonModDataFieldsDelegate, protected dataProvider: AddonModDataProvider) { + this.gotoEntry = new EventEmitter(); } /** @@ -66,7 +67,7 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges { value: this.value, database: this.database, error: this.error, - viewAction: this.viewAction, + gotoEntry: this.gotoEntry, form: this.form, search: this.search }; diff --git a/src/addon/mod/data/components/index/index.ts b/src/addon/mod/data/components/index/index.ts index f7cfca607..8f9e00fa0 100644 --- a/src/addon/mod/data/components/index/index.ts +++ b/src/addon/mod/data/components/index/index.ts @@ -329,7 +329,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp this.jsData = { fields: this.fields, entries: this.entries, - data: this.data + data: this.data, + gotoEntry: this.gotoEntry.bind(this) }; }); } else if (!this.search.searching) { diff --git a/src/addon/mod/data/fields/picture/component/addon-mod-data-field-picture.html b/src/addon/mod/data/fields/picture/component/addon-mod-data-field-picture.html index ee6cdcad0..267cc3a08 100644 --- a/src/addon/mod/data/fields/picture/component/addon-mod-data-field-picture.html +++ b/src/addon/mod/data/fields/picture/component/addon-mod-data-field-picture.html @@ -11,6 +11,6 @@ - + diff --git a/src/addon/mod/data/pages/edit/edit.html b/src/addon/mod/data/pages/edit/edit.html index a345aa70c..2c0beac1f 100644 --- a/src/addon/mod/data/pages/edit/edit.html +++ b/src/addon/mod/data/pages/edit/edit.html @@ -2,8 +2,8 @@ - diff --git a/src/addon/mod/data/providers/helper.ts b/src/addon/mod/data/providers/helper.ts index dd152ae51..3a592ccfe 100644 --- a/src/addon/mod/data/providers/helper.ts +++ b/src/addon/mod/data/providers/helper.ts @@ -119,7 +119,7 @@ export class AddonModDataHelperProvider { // Replace field by a generic directive. render = ''; template = template.replace(replace, render); });