Exemple #1
0
 def get_options_json(self):
     """Get configuration options for the story builder"""
     options = {
         'defaultImageUrl': Story.get_default_img_url(335, 200),
         # Show only the builder workflow steps
         'visibleSteps': {
             'build': True,
             'info': True,
             'tag': True,
             'publish': True
         },
         # Show the view that allows the user to edit
         # the story title and byline
         'showStoryInformation': True,
         # Show the view that allows the user to edit the call
         # to action or enable connected stories
         'showCallToAction': True,
         # Show a list of sections that the user can use to navigate
         # between sectons
         'showSectionList': True,
         # Show the input for editing section titles
         'showSectionTitles': True,
         # Show the select input for changing section layouts
         'showLayoutSelection': True,
         # Show the story title input in the section edit view 
         'showStoryInfoInline': False,
         # Prompt (for connected stories)
         'prompt': self.get_prompt(),
         # Show the sharing view
         'showSharing': True,
         # Show the builder tour
         'showTour': True,
         # Force showing the tour, even if the cookie has been set
         'forceTour': getattr(settings, 'STORYBASE_FORCE_BUILDER_TOUR',
                              False),
         # Endpoint for fetching license information
         'licenseEndpoint': reverse("api_cc_license_get"),
         # Site name (used for re-writing title)
         'siteName': settings.STORYBASE_SITE_NAME,
         # Template for generating preview URLs
         'previewURLTemplate': '/stories/{{story_id}}/preview/',
         # Template for generating view URLs
         'viewURLTemplate': '/stories/{{slug}}/viewer/',
     }
     if (self.template_object and self.template_object.slug == settings.STORYBASE_CONNECTED_STORY_TEMPLATE):
         # TODO: If these settings apply in cases other than just
         # connected stories, it might make more sense to store them
         # as part of the template model
         options.update({
             'visibleSteps': {
                 'build': True,
                 'publish': True
             },
             'showStoryInformation': False,
             'showCallToAction': False,
             'showSectionList': False,
             'showSectionTitles': False,
             'showLayoutSelection': False,
             'showStoryInfoInline': True,
             'showSharing': False,
             'showTour': False,
             'previewURLTemplate': '/stories/%s/preview/#connected-stories/{{story_id}}' % (self.source_story.story_id),
             'viewURLTemplate': '/stories/%s/viewer/#connected-stories/{{story_id}}' % (self.source_story.story_id),
         })
     return json.dumps(options)