diff --git a/src/control/content/index.html b/src/control/content/index.html index 37cd540..462c623 100644 --- a/src/control/content/index.html +++ b/src/control/content/index.html @@ -1,5 +1,6 @@  + @@ -16,13 +17,14 @@ - + + -
+
-
+
Text @@ -65,6 +67,52 @@ } }; + $scope.showContent = false; + + var showAISeeder = function() { + let seeder = new buildfire.components.aiStateSeeder({ + generateOptions: { + userMessage: 'Write a sample article about the [topic]', + systemMessage: 'Article should utilize images, figures, statistics. Article length should be less then 400 characters. For carousel images use source.unsplash.com', + jsonTemplate: { + content: { + carouselImages: [], + text: "" + } + }, + }, + importOptions: { + jsonTemplate: { + content: { + carouselImages: [], + text: "" + } + }, + sampleCsv: `https://source.unsplash.com/featured/?music,

The Magic of Music

Music Image

Music is a universal language that touches the hearts and souls of people all around the world. It has the power to evoke emotions, bring back memories, and create a sense of connection among individuals. Whether you're listening to your favorite tunes, playing an instrument, or attending a live concert, music has a way of transporting you to a different world.

Music can be found in various genres, each with its own unique style and characteristics. From classical masterpieces to upbeat pop songs, from soulful jazz melodies to energetic rock anthems, there's something for everyone's taste. It's incredible how a simple arrangement of notes and lyrics can stir up feelings of joy, sadness, excitement, or nostalgia.

Moreover, music has the ability to bring people together. It serves as a common ground where individuals from different cultures and backgrounds can find commonality and share their love for melodies and rhythms. Whether you're jamming with friends, joining a choir, or attending a music festival, music fosters a sense of community and unity.

So, let the power of music surround you. Explore new artists, discover different genres, and let the melodies guide your emotions. Whether you're seeking solace, motivation, or simply a form of entertainment, music will always be there to accompany you on your journey.

`, + systemMessage: `For blog post images use dummyimages.com. For carousel images, generate small array of image urls based on topic, use source.unsplash.com for image URLs.`, + } + }).smartShowEmptyState(null, (err, result) => { + $scope.$apply(function () { + $scope.showContent = true; + if (seeder.requestType === 'generate') { + $scope.data.content = { + carouselImages: result.data.content.carouselImages.map(el => { return { iconUrl: el, action: "noAction", title: "image" } }), + text: result.data.content.text + } + } else { + $scope.data.content = { + carouselImages: $scope.data.content.carouselImages.concat(result.data.content.carouselImages.map(el => { return { iconUrl: el, action: "noAction", title: "image" } })), + text: $scope.data.content.text + result.data.content.text + } + } + + editor.loadItems($scope.data.content.carouselImages); + seeder.requestResult.complete(); + }); + }); + $scope.showContent = true; + } + // create a new instance of the buildfire carousel editor var editor = new buildfire.components.carousel.editor("#carousel"); @@ -79,40 +127,16 @@ 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; + if (Object.keys(result.data).length && result.data.content.carouselImages.length > 0 && result.data.content.text) { + 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) + 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); + $scope.showContent = true; + } else { + showAISeeder(); } /* @@ -143,7 +167,7 @@ return; } - if(!newObj.content || !newObj.design) + if (!newObj.content || !newObj.design) return; buildfire.datastore.save(newObj, function (err, result) { @@ -177,4 +201,4 @@ }]); - + \ No newline at end of file diff --git a/src/widget/widget.js b/src/widget/widget.js index da91d57..282bfd7 100644 --- a/src/widget/widget.js +++ b/src/widget/widget.js @@ -7,23 +7,8 @@ const Layouts = { const defaultData = { 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"} - ] + text: "", + carouselImages : [] }, design: { backgroundImage: null,