Commit 1a8b1ef8 authored by Juan Manuel Solaro's avatar Juan Manuel Solaro

(fix) adapt and fix code to mark's review

1 merge request!494WIP: epic/post-scheduler
Pipeline #77849124 running with stages
<div
class="m-poster-date-selector--input"
[class.selected]="hasDateSelected()"
mdl-datetime-picker [date]="date"
(dateChange)="onDateChange($event)"
>
<input
type="text"
[ngModel]="date | date:dateFormat"
(ngModelChange)="onDateChange($event)"
[hidden]="true"
>
<m-tooltip icon="date_range">
{{tooltipDate || 'now'}}
</m-tooltip>
<span></span>
</div>
\ No newline at end of file
......@@ -4,14 +4,7 @@ import { DatePipe } from '@angular/common';
@Component({
moduleId: module.id,
selector: 'm-poster-date-selector',
template: `
<div class="m-poster-date-selector--input" [class.selected]="hasDateSelected()" mdl-datetime-picker [date]="date" (dateChange)="onDateChange($event)">
<input type="text" [ngModel]="date | date:dateFormat" (ngModelChange)="onDateChange($event)" [hidden]="true">
<m-tooltip icon="date_range"> {{tooltipDate || 'now'}} </m-tooltip>
<span></span>
</div>
`,
templateUrl: 'poster-date-selector.component.html',
providers: [DatePipe]
})
......
......@@ -112,7 +112,10 @@
(validThreshold)="validThreshold = $event"
#thresholdInput
></m-wire-threshold-input>
<m-poster-date-selector [date]="blog.time_created" (dateChange)="onTimeCreatedChange($event)"></m-poster-date-selector>
<m-poster-date-selector
[date]="blog.time_created"
(dateChange)="onTimeCreatedChange($event)"
></m-poster-date-selector>
</div>
<div class="mdl-cell mdl-cell--12-col m-blog-edit--metadata mdl-color-text--blue-grey-200" *ngIf="blog.custom_meta">
......
......@@ -238,7 +238,11 @@ describe('BlogEdit', () => {
inputs: ['tags', 'alignLeft'],
outputs: ['tagsChange', 'tagsAdded', 'tagsRemoved'],
}),
MockComponent({ selector: 'm-poster-date-selector', inputs: ['date', 'dateFormat'], outputs: ['dateChange'] }),
MockComponent({
selector: 'm-poster-date-selector',
inputs: ['date', 'dateFormat'],
outputs: ['dateChange']
}),
BlogEdit,
MDLMock
], // declare the test component
......
......@@ -32,7 +32,7 @@ export class BlogEdit {
guid: 'new',
title: '',
description: '<p><br></p>',
time_created: Math.floor(+Date.now() / 1000),
time_created: Math.floor(Date.now() / 1000),
access_id: 2,
tags: [],
license: 'attribution-sharealike-cc',
......@@ -202,7 +202,7 @@ export class BlogEdit {
if (!this.blog.license)
this.blog.license = '';
this.blog.time_created = response.blog.time_created || Math.floor(+Date.now() / 1000);
this.blog.time_created = response.blog.time_created || Math.floor(Date.now() / 1000);
}
});
}
......@@ -248,7 +248,7 @@ export class BlogEdit {
blog.mature = blog.mature ? 1: 0;
blog.monetization = blog.monetization ? 1: 0;
blog.monetized = blog.monetized ? 1: 0;
blog.time_created = blog.time_created || Math.floor(+Date.now() / 1000);
blog.time_created = blog.time_created || Math.floor(Date.now() / 1000);
this.editing = false;
this.inProgress = true;
......
......@@ -6,8 +6,8 @@
<div class="minds-list">
<div>
<div class="mindsList__tools m-border">
<div class="mindsListTools__scheduled" (click)="toggleScheduled()" [class.selected]="seeScheduled">
<div class="m-mindsList__tools m-border">
<div class="m-mindsListTools__scheduled" (click)="toggleScheduled()" [class.selected]="viewScheduled">
<m-tooltip icon="date_range"> See Scheduled Activities </m-tooltip>
<span>scheduled: {{scheduledCount}}</span>
</div>
......
.mindsList__tools {
.m-mindsList__tools {
@include m-theme() {
background-color: themed($m-white);
}
......@@ -9,7 +9,7 @@
flex-direction: row;
align-items: center;
.mindsListTools__scheduled {
.m-mindsListTools__scheduled {
cursor: pointer;
i {
......
......@@ -65,7 +65,7 @@ export class ChannelSortedComponent implements OnInit {
initialized: boolean = false;
seeScheduled: boolean = false;
viewScheduled: boolean = false;
@ViewChild('poster', { static: false }) protected poster: PosterComponent;
......@@ -103,7 +103,7 @@ export class ChannelSortedComponent implements OnInit {
this.detectChanges();
let endpoint = 'api/v2/feeds/container';
if (this.seeScheduled) {
if (this.viewScheduled) {
endpoint = 'api/v2/channel/scheduled';
}
......@@ -188,7 +188,7 @@ export class ChannelSortedComponent implements OnInit {
}
toggleScheduled() {
this.seeScheduled = !this.seeScheduled;
this.viewScheduled = !this.viewScheduled;
this.load(true);
}
......
......@@ -465,7 +465,10 @@ describe('Activity', () => {
inputs: [ 'selected' ],
outputs: [ 'selected'],
}),
MockComponent({ selector: 'm-poster-date-selector', inputs: ['date', 'dateFormat'], outputs: ['dateChange'] }),
MockComponent({
selector: 'm-poster-date-selector',
inputs: ['date', 'dateFormat'],
outputs: ['dateChange'] }),
MockDirective({
selector: '[mIfFeature]',
inputs: [ 'mIfFeature' ],
......
......@@ -119,7 +119,10 @@
</ng-container>
<m-wire-threshold-input [(threshold)]="activity.wire_threshold" [(enabled)]="activity.paywall"></m-wire-threshold-input>
<m-poster-date-selector [date]="activity.time_created" (dateChange)="onTimeCreatedChange($event)"></m-poster-date-selector>
<m-poster-date-selector
[date]="activity.time_created"
(dateChange)="onTimeCreatedChange($event)"
></m-poster-date-selector>
<button class="mdl-button mdl-button--raised mdl-color--blue-grey-100" (click)="messageEdit.value = activity.message; editing=false;" i18n="@@M__ACTION__CANCEL">Cancel</button>
<button class="mdl-button mdl-button--colored mdl-button--raised" (click)="activity.message = messageEdit.value; save();" i18n="@@M__ACTION__SAVE">Save</button>
</div>
......
......@@ -173,7 +173,7 @@ export class Activity implements OnInit {
(this.activity.remind_object && this.translationService.isTranslatable(this.activity.remind_object))
);
this.activity.time_created = this.activity.time_created || Math.floor(+Date.now() / 1000);
this.activity.time_created = this.activity.time_created || Math.floor(Date.now() / 1000);
}
getOwnerIconTime() {
......@@ -195,7 +195,7 @@ export class Activity implements OnInit {
console.log('trying to save your changes to the server', this.activity);
this.editing = false;
this.activity.edited = true;
this.activity.time_created = this.activity.time_created || Math.floor(+Date.now() / 1000);
this.activity.time_created = this.activity.time_created || Math.floor(Date.now() / 1000);
let data = this.activity;
if (this.attachment.has()) {
......
......@@ -84,7 +84,10 @@
(validThreshold)="validThreshold = $event"
></m-wire-threshold-input>
<m-poster-date-selector [date]="meta.time_created" (dateChange)="onTimeCreatedChange($event)"></m-poster-date-selector>
<m-poster-date-selector
[date]="meta.time_created"
(dateChange)="onTimeCreatedChange($event)"
></m-poster-date-selector>
<button
type="submit"
......
......@@ -70,9 +70,18 @@ describe('PosterComponent', () => {
inputs: ['threshold', 'disabled', 'enabled'],
outputs: ['thresholdChange']
}),
MockComponent({ selector: 'minds-rich-embed', inputs: ['src', 'preview', 'maxheight', 'cropimage'] }),
MockComponent({ selector: 'm-poster-date-selector', inputs: ['date', 'dateFormat'], outputs: ['dateChange'] }),
MockComponent({ selector: 'm-tooltip', template: '<ng-content></ng-content>' }),
MockComponent({
selector: 'minds-rich-embed',
inputs: ['src', 'preview', 'maxheight', 'cropimage']
}),
MockComponent({
selector: 'm-poster-date-selector',
inputs: ['date', 'dateFormat'],
outputs: ['dateChange'] }),
MockComponent({
selector: 'm-tooltip',
template: '<ng-content></ng-content>'
}),
DropdownComponent,
TagsInput,
HashtagsSelectorComponent,
......
......@@ -28,7 +28,7 @@ export class PosterComponent {
meta: any = {
message : '',
wire_threshold: null,
time_created: Math.floor(+Date.now() / 1000)
time_created: Math.floor(Date.now() / 1000)
};
tags = [];
minds = window.Minds;
......@@ -172,7 +172,7 @@ export class PosterComponent {
return;
}
this.meta.time_created = this.meta.time_created || Math.floor(+Date.now() / 1000);
this.meta.time_created = this.meta.time_created || Math.floor(Date.now() / 1000);
this.errorMessage = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment