Openstad
  • Introductie
  • Projectmanagement
    • Algemene kaders
    • Participatieprocessen
      • Voorkeurspeiling
      • Wedstrijd
      • Participatief begroten
  • Digitale tools
    • OpenStad CMS basis
      • Inloggen
      • De bouwstenen
      • Live in-page editing
      • Bewerkmodus (Draft)
      • Versiebeheer
    • Participatieprocessen
      • Voorkeurspeiling
      • Wedstrijd
      • Participatief begroten
    • How-to's
      • Nieuwe site aanmaken
      • Nieuwe pagina's toevoegen
      • Pagina's vullen
      • Inzendingen uploaden
      • Inzendingen weergeven
      • Filteren en categoriseren van inzendingen
      • Likes verzamelen
      • Reacties en argumenten
      • Interactieve kaart
      • Polygonen
      • Newsletter
      • Moderatie
      • Unieke stemcodes
      • Stemmen
      • Gebruikersbeheer
      • Gebruikers anonimiseren per website
      • Inzendingen exporteren en importeren
      • Vormgeving & logo aanpassen
      • E-mail notificaties
    • Widgets referentie
      • Accordeon
      • Agenda
      • Arguments
      • Columns
      • Slider
      • Counter
      • Date countdown bar
      • Ideas map
      • Ideeën op een kaart (Kaart applicatie)
      • iFrame
      • Image
      • Info bar
      • Link or button
      • List
      • Like
      • Location
      • Participatory budgeting
      • Keuzewijzer
      • Keuzewijzer resultaten
      • Rich text
      • Resource admin buttons
      • Resource overview
      • Resource form
      • Resource representation
      • Resource raw widget
      • Resource image
      • Speech bubble
      • Share widgets
      • Title
      • User remove form
      • Video upload
      • Video 3d party
      • Vorige volgende knoppen
    • Algemeen
      • Terminologie
      • Waarschuwingen
      • Adminpanel
      • Adminpanel (beta)/React admin
      • Page Settings
      • OpenStad hoofdmenu
        • Tags
        • Global
        • Open palette
        • Clear cache
        • Pages
        • Users
        • Images
        • Files
        • Workflow
        • Logout
      • Styles for the container
      • Interactieve kaart thema iconen
      • Inzendingen (ideas)
      • Artikelen (articles)
      • Gebruikers (users)
      • Authenticatie methodes
      • Rollen
      • URL's
      • Testen
      • Raw
      • Resources
  • Technical documentation (English)
    • Architecture
    • Getting started
    • Deploying to production
      • Kubernetes
      • Installing on Digital ocean with Kubernetes
      • Backups
      • Deploying a custom image
    • Frontend: CMS
      • Apostrophe CMS
      • The Openstad version of ApostropheCMS
      • Using openstad-components
      • Configuration
    • Frontend: Components
      • Use and configuration
      • Publishing
      • Components
        • Choices Guide
        • Ideas On Map
    • Api
      • Site
      • Idea
      • Argument
      • Vote
      • Article
      • Newsletter Signup
      • User
      • Auth
      • Resource & Data permissions
      • Pagination and search
      • Email settings
      • Database migrations
      • API configuration
    • oAuth2
      • Oauth2 configuration
    • Management panel
      • Management Panel configuration
    • Image server
    • Contributing & versioning
    • Git flow
    • Roadmap
Powered by GitBook
On this page
  • Configuration
  • Results
  • Technical
  • Datamodel
  • Notes
  • Plane
  1. Technical documentation (English)
  2. Frontend: Components
  3. Components

Choices Guide

PreviousComponentsNextIdeas On Map

Last updated 2 years ago

The choices guide helps a visitor to form an idea or opinion by answering a set of questions and seeing the effect on a set of possible choices.

The basic idea is very simple: each question is answered by a visitor with a value between 0 and 100. Each choice has an answer stored, also between 0 and 100. Both answers are compared and the result shown.

Basic setup and configuration of components is described in . This specific widget can be loaded using

   openstadcomponents['choices-guide'].ChoicesGuide.renderElement(element, config);

or

   OpenStadComponents['choices-guide'].ChoicesGuideResult.renderElement(element, config);

Once loaded and logged in as an admin you will find a button on the page that allows for creating questions and choices from within the component.

Configuration

config = {
  divId: "choices-guide",
  siteId: 1,
  choicesGuideId: 1,

Number of questions per page

  noOfQuestionsToShow: 10,

Should the comparison start assuming that all questions are answered at 50%

  startWithAllQuestionsAnswered: true,

Should a visitor answer each question or is the default answer enough

  startWithAllQuestionsAnsweredAndConfirmed: true,

How are the results shown

  choices: {

The way the results are shown: 'zero-to-100' (='default') or 'minus-to-plus-100' for a one dimensional view, 'plane' for two dimensional

    type: 'zero-to-100',

Colors used: 'default' is used by 'zero-to-100', 'min' and 'max' by 'minus-to-plus-100'

    barColor: { min: null, max: null, deafult: null }, // 

Header for the results block

    title: {
      noPreferenceYet: 'I have not yet made a choice',
      preference: '<b>My preference:</b><br/>{preferredChoice}',
      inBetween: 'My p[reference is in between choicesIk staat precies tussen meerdere voorkeuren in'
    },
  }

Urls that are used in the previous/next buttons

  beforeUrl: '/choices-guide/example.html?before',
  afterUrl: '/components/examples/choices-guide-result.html',
}

Results

ChoicesGuideResults have extra configuration options

config = {

Show a number next to the result bars

  choices: {
    withPercentage: true,
  }

Submit the result to the api

  submission: {

Type describes what to do: 'none' does nothing, 'auto' sends the result to the api as soon as the page is shown, and 'form' waits for a form to be filled in and submitted.

    type: 'none',
    form: {
    },

Optionally (in edit choices guide) you can require a user to be logged in before submitting the form

    requireLoginSettings: {
      title: "Stemcode",
      description: "Om te kunnen stemmen vul je de stemcode in die je per post hebt ontvangen. Wij controleren je stemcode op geldigheid. Als dat gelukt is kun je stemmen.",
      buttonTextLogin: "Vul je stemcode in",
      buttonTextLoggedIn: "Geldige stemcode",
      buttonTextAlreadySubmitted: "Ongeldige stemcode",
      changeLoginLinkText: "Vul een andere stemcode in",
      loggedInMessage: "Het controleren van je stemcode is gelukt! Klik op onderstaande knop om je keuze in te sturen.",
      notYetLoggedInError: "Klik hierboven om je stem te valideren.",
      alreadySubmittedMessage: "Deze stemcode is al gebruikt om te stemmen. Een stemcode kan maar één keer gebruikt worden.",
    },
  }
}

Technical

Datamodel

In pseude-json:

choices-guide: {
  title,
  decription,
  images,
  config,
  questionGroups: {
    title,
    decription,
    images,
    seqnr,
    answerDimensions,
    questions: {
      dimensions,
      minLable,
      maxLabel,
      title,
      decription,
      moreinfo,
      images,
      seqnr,
      type,
      values,
    },
    choices: {
      title,
      decription,
      images,
      seqnr,
      answers,
    },
    results: {
      extraData,
      result,
      userId,
      userFingerprint,
    }
  },
}

Notes

Questions belong to a questionGroup. AnswerDimensions is used for a 2d view of the results; see (later)[#plane].

Posible choices are also part of the questiongroup. (The API knows choices on the top level, but this is not (yet) used by the frontend.)

Choices contain an answer to each question, to compare the visitors answers:

{
  2: 37, // the answer to question with id=2 is 37
  3:  5,
  7: 82
}

Results are stored per user, identified by a login or by a generated userFingerprint. The fingerprint system is not 100% fool proof. Data from an optional form with extra questions is stored as extraData.

Plane

The two dimensional view on the results was created for a specific project.

The current implementation has limitations and should be reviewed/rebuild.

Documentation for this is not yet written.

See the for a description of these options

Use and configuration
forms docs