|
69 | 69 | var OverviewComponent = countlyVue.views.create({
|
70 | 70 | template: CV.T('/guides/templates/overview-component.html'),
|
71 | 71 | props: {
|
72 |
| - title: {type: String, required: true}, |
73 |
| - description: {type: String, required: true}, |
| 72 | + title: {type: String, required: false}, |
| 73 | + description: {type: String, required: false}, |
74 | 74 | link: {type: String, required: false},
|
75 | 75 | items: {type: Array, required: false},
|
76 | 76 | type: {type: String, required: true, default: 'walkthroughs'},
|
|
80 | 80 | 'walkthrough-component': WalkthroughComponent,
|
81 | 81 | 'article-component': ArticleComponent
|
82 | 82 | },
|
| 83 | + data: function() { |
| 84 | + return { |
| 85 | + guideConfig: {} |
| 86 | + }; |
| 87 | + }, |
83 | 88 | computed: {
|
| 89 | + titleContent: function() { |
| 90 | + return this.title || (this.type === 'walkthroughs' ? this.guideConfig.walkthroughTitle : this.guideConfig.articleTitle); |
| 91 | + }, |
| 92 | + descriptionContent: function() { |
| 93 | + return this.description || (this.type === 'walkthroughs' ? this.guideConfig.walkthroughDescription : this.guideConfig.articleDescription); |
| 94 | + }, |
84 | 95 | customClass: function() {
|
85 | 96 | return this.max <= 2 ? 'bu-is-half' : 'bu-is-full';
|
86 | 97 | },
|
87 | 98 | wrapperStyle: function() {
|
88 | 99 | return this.max > 0 ? `max-width:${100 / this.max}%;` : `max-width:50%;`;
|
89 | 100 | }
|
90 |
| - } |
| 101 | + }, |
| 102 | + created: function() { |
| 103 | + var self = this; |
| 104 | + countlyCMS.fetchEntry("server-guide-config").then(function(config) { |
| 105 | + self.guideConfig = (config && config.data && config.data[0] && config.data[0]) || {}; |
| 106 | + }); |
| 107 | + }, |
91 | 108 | });
|
92 | 109 |
|
93 | 110 | // GLOBAL COMPONENTS
|
|
163 | 180 | while (sections.length > 0 && !self.isButtonVisible) {
|
164 | 181 | let sectionID = '/' + sections.join('/');
|
165 | 182 | countlyGuides.fetchEntries({ sectionID }).then(function() {
|
166 |
| - let walkthroughs = countlyGuides.getWalkthroughs(sectionID); |
167 |
| - let articles = countlyGuides.getArticles(sectionID); |
168 |
| - if (walkthroughs.length > 0 || articles.length > 0) { |
| 183 | + let entry = countlyGuides.getEntry(sectionID); |
| 184 | + if (entry.walkthroughs.length > 0 || entry.articles.length > 0) { |
169 | 185 | self.isButtonVisible = true;
|
170 |
| - self.guideData = countlyGuides.getEntries()[0]; |
| 186 | + self.guideData = entry; |
171 | 187 | countlyCMS.fetchEntry("server-guide-config").then(function(config) {
|
172 | 188 | self.guideConfig = (config && config.data && config.data[0] && config.data[0]) || {};
|
173 | 189 | });
|
|
387 | 403 | },
|
388 | 404 | data: function() {
|
389 | 405 | return {
|
390 |
| - onboardingWalkthroughs: [], |
391 |
| - newWalkthroughs: [], |
392 |
| - suggestionsWalkthroughs: [], |
393 |
| - promotedArticles: [] |
| 406 | + onboardingEntry: {}, |
| 407 | + newEntry: {}, |
| 408 | + suggestionsEntry: {}, |
| 409 | + promotedEntry: {}, |
394 | 410 | };
|
395 | 411 | },
|
396 | 412 | created: function() {
|
397 | 413 | var self = this;
|
398 | 414 | countlyGuides.fetchEntries({ sectionID: { $in: ["/overview/getting-started", "/overview/whats-new", "/overview/suggestions", "/overview/promoted"] } })
|
399 | 415 | .then(function() {
|
400 |
| - self.onboardingWalkthroughs = countlyGuides.getWalkthroughs('/overview/getting-started').slice(0, 2); |
401 |
| - self.newWalkthroughs = countlyGuides.getWalkthroughs('/overview/whats-new').slice(0, 2); |
402 |
| - self.suggestionsWalkthroughs = countlyGuides.getWalkthroughs('/overview/suggestions').slice(0, 4); |
403 |
| - self.promotedArticles = countlyGuides.getArticles('/overview/promoted').slice(0, 3); |
| 416 | + self.onboardingEntry = countlyGuides.getEntry('/overview/getting-started'); |
| 417 | + self.newEntry = countlyGuides.getEntry('/overview/whats-new'); |
| 418 | + self.suggestionsEntry = countlyGuides.getEntry('/overview/suggestions'); |
| 419 | + self.promotedEntry = countlyGuides.getEntry('/overview/promoted'); |
404 | 420 | })
|
405 | 421 | .catch(function() {
|
406 | 422 | // console.log(error);
|
|
0 commit comments