censis-archive/obrand/obrand-admin/app/models/page.js
2016-06-06 11:45:51 +01:00

45 lines
1.6 KiB
JavaScript

import DS from 'ember-data';
import Ember from 'ember';
export default DS.Model.extend({
cid: DS.attr('string'),
vid: DS.attr('string'),
pid: DS.attr('string'),
category: DS.attr(),
title: DS.attr('string'),
content: DS.attr(),
imageUrl: DS.attr('string'),
link1Text: DS.attr('string'),
link1Url: DS.attr('string'),
link2Text: DS.attr('string'),
link2Url: DS.attr('string'),
link3Text: DS.attr('string'),
link3Url: DS.attr('string'),
link4Text: DS.attr('string'),
link4Url: DS.attr('string'),
usefulPid: function() {
'use strict';
return !Ember.isBlank(this.get('pid')) ? ('/export/' + this.get('pid') + '.html').toString() : false;
}.property('pid'),
visibleLink1: function() {
return !((Ember.isBlank(this.get('link1Text'))) || (Ember.isBlank(this.get('link1Url'))));
}.property('link1Url','link1Text'),
visibleLink2: function() {
return !((Ember.isBlank(this.get('link2Text'))) || (Ember.isBlank(this.get('link2Url'))));
}.property('link2Url','link2Text'),
visibleLink3: function() {
return !((Ember.isBlank(this.get('link3Text'))) || (Ember.isBlank(this.get('link3Url'))));
}.property('link3Url','link3Text'),
visibleLink4: function() {
return !((Ember.isBlank(this.get('link4Text'))) || (Ember.isBlank(this.get('link4Url'))));
}.property('link4Url','link4Text'),
noImage: function() {
return Ember.isBlank(this.get('imageUrl'));
}.property('imageUrl'),
pageMode: function() {
let modeArray = ['Basic Page', 'Other type 1', 'Other type 2', 'Other type 3'];
return modeArray[this.get('content')];
}.property('content')
});