MOBILE-2430 data: Click on image action fixed
parent
d97fdcee93
commit
83e41ba1a1
|
@ -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<number>; // 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.
|
||||
|
|
|
@ -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<number>; // 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
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
<ion-input type="text" [formControlName]="'f_'+field.id" [placeholder]="field.name"></ion-input>
|
||||
</span>
|
||||
|
||||
<span *ngIf="mode == 'list' && imageUrl" (click)="viewAction()"><img [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" core-external-content/></span>
|
||||
<span *ngIf="mode == 'list' && imageUrl" (click)="gotoEntry.emit(entryId)"><img [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" core-external-content/></span>
|
||||
|
||||
<img *ngIf="mode == 'show' && imageUrl" [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" [width]="width" [height]="height" core-external-content/>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<ion-navbar>
|
||||
<ion-title><core-format-text [text]="title"></core-format-text></ion-title>
|
||||
<ion-buttons end>
|
||||
<button ion-button icon-only (click)="save()" [attr.aria-label]="'core.save' | translate">
|
||||
<ion-icon name="send"></ion-icon>
|
||||
<button ion-button clear (click)="save()" [attr.aria-label]="'core.save' | translate">
|
||||
{{ 'core.save' | translate }}
|
||||
</button>
|
||||
</ion-buttons>
|
||||
</ion-navbar>
|
||||
|
|
|
@ -119,7 +119,7 @@ export class AddonModDataHelperProvider {
|
|||
|
||||
// Replace field by a generic directive.
|
||||
render = '<addon-mod-data-field-plugin [field]="fields[' + field.id + ']" [value]="entries[' + entry.id +
|
||||
'].contents[' + field.id + ']" mode="' + mode + '" [database]="data" (viewAction)="gotoEntry(' + entry.id +
|
||||
'].contents[' + field.id + ']" mode="' + mode + '" [database]="data" (gotoEntry)="gotoEntry(' + entry.id +
|
||||
')"></addon-mod-data-field-plugin>';
|
||||
template = template.replace(replace, render);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue