Created
June 6, 2017 16:08
-
-
Save ckung/79aeb8ba2f24e286b8c7ba6538000f1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/brands/p4k/models/article.js b/app/brands/p4k/models/article.js | |
index 90b4d24..bc60e26 100644 | |
--- a/app/brands/p4k/models/article.js | |
+++ b/app/brands/p4k/models/article.js | |
@@ -9,6 +9,16 @@ export default BaseArticle.extend({ | |
longformLink: hasMany('externallink', {embedded:true}), | |
longformUrl: computed.reads('longformLink.firstObject.url'), | |
+ publishUriHook: computed('categories.sections.[]', function () { | |
+ let hierarchy = this.get('categories.sections.firstObject._embedded.hierarchy'); | |
+ hierarchy.pop(); | |
+ let categories = hierarchy.map((category) => { | |
+ return category.fields.slug; | |
+ }); | |
+ let uri = categories.reverse().join('/'); | |
+ return uri; | |
+ }), | |
+ | |
validations: { | |
channel: {}, | |
categories: { | |
diff --git a/app/models/publish-data.js b/app/models/publish-data.js | |
index 2c891b6..317ffad 100644 | |
--- a/app/models/publish-data.js | |
+++ b/app/models/publish-data.js | |
@@ -188,7 +188,11 @@ export default Ember.Object.extend(Ember.Validations, AutogeneratorMixin, { | |
} | |
} | |
if (typeof key === 'string' && !Ember.isEmpty(this.get('content.' + key))) { | |
- uris.push(slugify(this.get('content.' + key))); | |
+ if (this.get('softSlug')) { | |
+ uris.push(this.get('content.' + key)); | |
+ } else { | |
+ uris.push(slugify(this.get('content.' + key))); | |
+ } | |
} | |
}, this); | |
newPath = uris.join('/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment