"
+ }, design: {
+ backgroundImage: null, backgroundBlur: 0, selectedLayout: 1
+ }
+ };
+
+ // create a new instance of the buildfire carousel editor
+ var editor = new buildfire.components.carousel.editor("#carousel");
+
+ /*
+ * Go pull any previously saved data
+ * */
+ buildfire.datastore.get(function (err, result) {
+
+ if (!err) {
+ datastoreInitialized = true;
+ } else {
+ console.error("Error: ", err);
+ return;
+ }
+
+ if (result && result.data && !angular.equals({}, result.data) && result.id) {
+ if (!result.data.design) result.data.design = $scope.data.design;
+ $scope.data = result.data;
+ $scope.id = result.id;
+ if ($scope.data.content && $scope.data.content.carouselImages) editor.loadItems($scope.data.content.carouselImages);
+ if (tmrDelay) clearTimeout(tmrDelay);
+ } else {
+ $scope.data = {
+ content: {
+ text: '
The WYSIWYG (which stands for What You See Is What You Get) allows you to do some really cool stuff. You can add images like this
\
+ \
+
You can even create links like these: Link to web content like this Link to a phone number like this 8005551234 Link to an email like this noreply@google.com
\
+
Want to add some super cool videos about this item? You can do that too!
\
+ \
+
You can create bulleted and numbered lists like this:
\
+
\
+
This is an item in a list
\
+
This is another item in a list
\
+
This is a last item in a list
\
+
\
+
Want more info? Check out our tutorial by clicking the help button at the top of this page.
',
+
+ carouselImages: [{
+ "action": "noAction",
+ "iconUrl": "http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/5db61d30-0854-11e6-8963-f5d737bc276b.jpg",
+ "title": "image 1"
+ }, {
+ "action": "noAction",
+ "iconUrl": "http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/31c88a00-0854-11e6-8963-f5d737bc276b.jpeg",
+ "title": "image 2"
+ }]
+ }, design: {
+ backgroundImage: null, backgroundBlur: 0, selectedLayout: 1
+ }
+ };
+ editor.loadItems($scope.data.content.carouselImages);
+ }
+
+ /*
+ * watch for changes in data and trigger the saveDataWithDelay function on change
+ * */
+ $scope.$watch('data', saveDataWithDelay, true);
+
+ if (!$scope.$$phase && !$scope.$root.$$phase) {
+ $scope.$apply();
+ }
+ });
+
+ AuthManager.refreshCurrentUser().then(function () {
+ Settings.get().then((data) => $scope.searchEngineIndexing = data.searchEngineIndexing);
+ });
+
+ /*
+ * Call the datastore to save the data object
+ */
+ var saveData = function (newObj, callBack) {
+ if (!datastoreInitialized) {
+ console.error("Error with datastore didn't get called");
+ return;
+ }
+ if (newObj.content.text.indexOf("src=\"//") != -1) {
+ newObj.content.text = newObj.content.text.replace("src=\"//", "src=\"https://")
+ }
+ if (newObj == undefined) return;
+
+ if ($scope.frmMain.$invalid) {
+ console.warn('invalid data, details will not be saved');
+ return;
+ }
+
+ if (!newObj.content || !newObj.design) return;
+
+ buildfire.datastore.save(newObj, function (err, result) {
+ if (err || !result) {
+ console.error('Error saving the widget details: ', err);
+ }
+ callBack();
+ });
+ };
+ var saveSearchEngine = function (content) {
+ if (!$scope.searchEngineIndexing) return;
+ buildfire.dynamic.expressions.evaluate({expression: content}, (err, result) => {
+ if (err) return console.error(err);
+ const content = prepareSearchEngineContent(result.evaluatedExpression);
+ if (!content.title || !content.description) {
+ SearchEngineService.delete().catch(()=>{
+ buildfire.dialog.toast({
+ message: 'Error indexing data.',
+ type:'danger'
+ });
+ });
+ return;
+ }
+ SearchEngineService.save(content.title, content.description).catch(()=>{
+ buildfire.dialog.toast({
+ message: 'Error indexing data.',
+ type:'danger'
+ });
+ });
+ })
+ };
+ /*
+ * create an artificial delay so api isnt called on every character entered
+ * */
+ var tmrDelay = null;
+
+ var saveDataWithDelay = function (newObj, oldObj) {
+ if (tmrDelay) clearTimeout(tmrDelay);
+ if (angular.equals(newObj, oldObj)) return;
+ tmrDelay = setTimeout(function () {
+ saveData(newObj, function () {saveSearchEngine(newObj.content.text)});
+ }, 500);
+ };
+
+ // this method will be called when a new item added to the list
+ editor.onAddItems = editor.onDeleteItem = editor.onItemChange = editor.onOrderChange = function () {
+ $scope.data.content.carouselImages = editor.items;
+ saveData($scope.data);
+ };
+}]);
diff --git a/src/control/content/style.css b/src/control/content/style.css
new file mode 100644
index 0000000..55a8022
--- /dev/null
+++ b/src/control/content/style.css
@@ -0,0 +1,19 @@
+body {
+ font-family: 'Conv_apercu_regular','Helvetica','Sans-Serif','Arial';
+}
+#frMain {
+ height: 95vh;
+ flex-direction: column;
+}
+.tinymce-editor{
+ flex: 1;
+}
+.tinymce-editor .main {
+ height: 100%;
+}
+
+/* This rule overrides the height of the TinyMCE editor */
+.tox.tox-tinymce {
+ min-height: 100% !important;
+}
+
diff --git a/src/control/settings/index.html b/src/control/settings/index.html
index 97a74b4..65c089f 100644
--- a/src/control/settings/index.html
+++ b/src/control/settings/index.html
@@ -1,10 +1,41 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-no settings
+
+
+
+
+
+
+
Please note: Any changes to the content will update automatically in
+ the search engine, but you still need to publish the app for users to see these updates.