diff --git a/plugins/guides/frontend/public/javascripts/countly.models.js b/plugins/guides/frontend/public/javascripts/countly.models.js index 3dadd2ecc34..92402e2fedb 100755 --- a/plugins/guides/frontend/public/javascripts/countly.models.js +++ b/plugins/guides/frontend/public/javascripts/countly.models.js @@ -37,6 +37,12 @@ return _entries; }; + countlyGuides.getEntry = function(sectionID) { + return _entries.find(function(entry) { + return entry.sectionID === sectionID; + }); + }; + countlyGuides.getWalkthroughs = function(sectionID) { let entries = _entries; if (sectionID) { diff --git a/plugins/guides/frontend/public/javascripts/countly.views.js b/plugins/guides/frontend/public/javascripts/countly.views.js index 19c4ec29cf0..83473af8525 100755 --- a/plugins/guides/frontend/public/javascripts/countly.views.js +++ b/plugins/guides/frontend/public/javascripts/countly.views.js @@ -69,8 +69,8 @@ var OverviewComponent = countlyVue.views.create({ template: CV.T('/guides/templates/overview-component.html'), props: { - title: {type: String, required: true}, - description: {type: String, required: true}, + title: {type: String, required: false}, + description: {type: String, required: false}, link: {type: String, required: false}, items: {type: Array, required: false}, type: {type: String, required: true, default: 'walkthroughs'}, @@ -80,14 +80,31 @@ 'walkthrough-component': WalkthroughComponent, 'article-component': ArticleComponent }, + data: function() { + return { + guideConfig: {} + }; + }, computed: { + titleContent: function() { + return this.title || (this.type === 'walkthroughs' ? this.guideConfig.walkthroughTitle : this.guideConfig.articleTitle); + }, + descriptionContent: function() { + return this.description || (this.type === 'walkthroughs' ? this.guideConfig.walkthroughDescription : this.guideConfig.articleDescription); + }, customClass: function() { return this.max <= 2 ? 'bu-is-half' : 'bu-is-full'; }, wrapperStyle: function() { return this.max > 0 ? `max-width:${100 / this.max}%;` : `max-width:50%;`; } - } + }, + created: function() { + var self = this; + countlyCMS.fetchEntry("server-guide-config").then(function(config) { + self.guideConfig = (config && config.data && config.data[0] && config.data[0]) || {}; + }); + }, }); // GLOBAL COMPONENTS @@ -163,11 +180,10 @@ while (sections.length > 0 && !self.isButtonVisible) { let sectionID = '/' + sections.join('/'); countlyGuides.fetchEntries({ sectionID }).then(function() { - let walkthroughs = countlyGuides.getWalkthroughs(sectionID); - let articles = countlyGuides.getArticles(sectionID); - if (walkthroughs.length > 0 || articles.length > 0) { + let entry = countlyGuides.getEntry(sectionID); + if (entry.walkthroughs.length > 0 || entry.articles.length > 0) { self.isButtonVisible = true; - self.guideData = countlyGuides.getEntries()[0]; + self.guideData = entry; countlyCMS.fetchEntry("server-guide-config").then(function(config) { self.guideConfig = (config && config.data && config.data[0] && config.data[0]) || {}; }); @@ -387,20 +403,20 @@ }, data: function() { return { - onboardingWalkthroughs: [], - newWalkthroughs: [], - suggestionsWalkthroughs: [], - promotedArticles: [] + onboardingEntry: {}, + newEntry: {}, + suggestionsEntry: {}, + promotedEntry: {}, }; }, created: function() { var self = this; countlyGuides.fetchEntries({ sectionID: { $in: ["/overview/getting-started", "/overview/whats-new", "/overview/suggestions", "/overview/promoted"] } }) .then(function() { - self.onboardingWalkthroughs = countlyGuides.getWalkthroughs('/overview/getting-started').slice(0, 2); - self.newWalkthroughs = countlyGuides.getWalkthroughs('/overview/whats-new').slice(0, 2); - self.suggestionsWalkthroughs = countlyGuides.getWalkthroughs('/overview/suggestions').slice(0, 4); - self.promotedArticles = countlyGuides.getArticles('/overview/promoted').slice(0, 3); + self.onboardingEntry = countlyGuides.getEntry('/overview/getting-started'); + self.newEntry = countlyGuides.getEntry('/overview/whats-new'); + self.suggestionsEntry = countlyGuides.getEntry('/overview/suggestions'); + self.promotedEntry = countlyGuides.getEntry('/overview/promoted'); }) .catch(function() { // console.log(error); diff --git a/plugins/guides/frontend/public/localization/guides.properties b/plugins/guides/frontend/public/localization/guides.properties index ee294e7e06f..2047523eef5 100755 --- a/plugins/guides/frontend/public/localization/guides.properties +++ b/plugins/guides/frontend/public/localization/guides.properties @@ -21,15 +21,6 @@ guides.feedback = Do you have any feedback? guides.read-more = Read more guides.see-all = See all -guides.get-started = Get started -guides.get-started.desc = Run through out onboarding setup to get started -guides.suggestions = Suggestions for you -guides.suggestions.desc = First time here or just need a quick overview? Run through our onboarding setup to get started -guides.promoted = Promoted Articles -guides.promoted.desc = First time here or just need a quick overview? Run through our onboarding setup to get started -guides.new = What's new? -guides.new.desc = Run through our onboarding setup to get started - guides.search.in-guides = Search in Guides guides.search.in-countly-guides = Search in Countly Guides guides.search.results-count = {0} results for "{1}" diff --git a/plugins/guides/frontend/public/templates/dialog.html b/plugins/guides/frontend/public/templates/dialog.html index 35a46b05c20..2bb306b7014 100755 --- a/plugins/guides/frontend/public/templates/dialog.html +++ b/plugins/guides/frontend/public/templates/dialog.html @@ -31,12 +31,12 @@

{{ guideData.sectionTitle || "" }}

-
- {{ guideData.description }} +
+ {{ guideData.sectionDescription }}
-
{{ guideConfig.walkthroughTitle }}
-
{{ guideConfig.walkthroughDescription }}
+
{{ guideData.walkthroughTitle || guideConfig.walkthroughTitle }}
+
{{ guideData.walkthroughDescription || guideConfig.walkthroughDescription }}
@@ -53,8 +53,8 @@

{{ guideData.sectionTitle || "" }}

-
{{ guideConfig.articleTitle }}
-
{{ guideConfig.articleDescription }}
+
{{ guideData.articleTitle || guideConfig.articleTitle }}
+
{{ guideData.articleDescription || guideConfig.articleDescription }}
+
-
{{ title }}
-
{{ description }}
+
{{ titleContent }}
+
{{ descriptionContent }}
diff --git a/plugins/guides/frontend/public/templates/overview-tab.html b/plugins/guides/frontend/public/templates/overview-tab.html index 137a0820b9f..f20b653807e 100755 --- a/plugins/guides/frontend/public/templates/overview-tab.html +++ b/plugins/guides/frontend/public/templates/overview-tab.html @@ -1,36 +1,32 @@
\ No newline at end of file