Commit 0a0f89fd authored by Elena Grassi's avatar Elena Grassi
Browse files

Config documentation for ratings/piuma

parent f03f03a1
#Firstlife Client
# Firstlife Client
Here you will find generic information on how to use gulp to develop locally and deploy the client with
its different `domains`. Inside the doc directory there are more detailed files to document
specific functionalities, how to generate a ``new'' domain (aka instance/verticalizzazioni) and a global
its different _domains_. Inside the doc directory there are more detailed files to document
specific functionalities, how to generate a _new_ domain (aka instance/verticalizzazione) and a global
scheme of the services the webapp uses and of its controllers/directives/factories.
#### istruzioni installazione:
......
# Expanding posts
# Expanding posts: ratings
- tot parametri relativi al sostituire i post con le entita` di tipo rating, utili per aggiungere contenuti configurabili e con una logica di aggregazione sulla singola Thing implementata nel backend
Used in Piuma (maps4all) and unicarto for now.
\ No newline at end of file
Posts can be "replaced" by second level entities representing _ratings_ (numeric inputs or single choice from
a set of possibilities). These two kinds of ratings are right now configurable with a certain number of fields of the domain json - the backend
implements an aggregating logic for ratings referred to the same first level entity (i.e. average for numeric ratings, n. of single choices
and total choices done for categorical ratings).
Used in Piuma (maps4all) and unicarto for now.
All the json fields that we describe here are found in the behaviour section.
## How to setup a domain with ratings
In its behavour json section use:
```
"postIsRating": {
RATING_TYPES
},
```
instead of the default:
```
"postIsRating": {},
```
What one writes in RATING_TYPES determines which ratings are setup for this domain and their specific configurations.
### Implemented types of ratings
The basic types are defined in `defaults.json` and can be configured in the `postIsRating` section,
in the following we will define these basic types and how to configure them.
#### Dropdown
```
"PRICE": {
"label": "Valore della spesa",
"value": "",
"values": ["1-5€","5-10€","10-20€","20-50€","50-100€"],
"type":"DROPDOWN",
"for": ["FL_FOOD_BUY","FL_FOOD_EAT"]
},
```
The type field defines the type, for is an array of the entities keys for which we want to have this rating (it is possible
to configure different ratings for first level entities, but this "logic" is inforced only here and not in the backend).
Value defines the default starting value of the dropdown and values its list of possibilities.
The labels are unused right now (they are there for backend compatibility purposes), to ease i18n in the templates we translate their
key using the custom_labels system, i.e.:
```
"custom_labels":{
"it": {
"PRICE": "Valore della spesa",
},
"en": {
"PRICE": "Total expense"
}
```
Dropdown summaries are shown in entities details as pie charts or in textual form.
#### Slider
```
"NOISE": {
"label":"Noise level",
"value":2,
"type":"RANGE",
"for": ["FL_PLACES"],
"icon_left": "ion-volume-low",
"icon_right": "ion-volume-high"
},
```
Here we have the same fields as for dropdown (without the list of possible values) and in addition the two
ionicons to be displayed at the two ends of the slider.
By default range has a basic configuration in `default.json' with a minimum value of 1 and a maximum of 5, but this can
be changed. The limit right now is that all ranges for a given domain will have the same min/max.
***Caution*** 0 as a minimum value has caused issues with the backend/the slider directive that we are using, there could
be notes about it in git commits.
```
"RANGE": {
"min": 1,
"max": 5
},
```
Slider summaries are shown in entities details as not-changeable sliders.
#### Stars
Stars work like the `RANGE` type, their key is `5STARS` and by default they are from 1 to 5, 0 is not possible here as a value.
Aggregated data for first level entities can show also "half stars". The configuration of stars rating is the same as for
`RANGE` but they do not have a `icon_left/icon_right` field.
Stars summaries are shown in entities details as not-changeable stars.
## Other config options regarding ratings
Here we list the default configuration for ratings that can be altered
for specific domains:
- `"startWithOpenedRating": false,` this parameter can be set to true to bring the user directly back
to the details of newly added entity with a new rating ready to be compiled (at the end of the
add a new entity wizard)
- `"allowMultipleRatings": false,` set to true if the same user can add multiple ratings to the same entity
- `"noPhotoRatings": false,` set to true if alongside the ratings you want to offer users the possibility to add a photo
- `"noEditDeleteMenu": false,` set to true if you want to remove the edit and delete voices from the single rating menu - this
was used mainly during development when certain features were not ready in the backend
- `"noEditMenu": false,` set to true if you want to remove the edit voice from the single rating menu
- `"anonymousRatings": false,` set to true if you want to avoid displaying the user name that added specific ratings
- `"startWithCollapsedRating": false,`, set to true if you want the interface to show all the ratings when opening
entities details, by default both the aggregated information and the single ratings are collapsed.
*TODO*: make more button-like the div that expands/collapses the ratings in `templates/thing/card.html` and in ratings templates.
- `"ratingsAltPlaceholders": {},` use this option to specify different headings for different rating types. By default the content of the
label ```CREATE_POST``` will be shown for all of them.
For example:
```
"ratingsAltPlaceholders": {
"FL_FOOD_BUY": "POSTEDITOR_PLACEHOLDER_BUY"
},
```
Will use the POSTEDITOR_PLACEHOLDER_BUY label only for the FL_FOOD_BUY (entity type key specific for unicarto domain) related ratings.
## Minimal code guide
TODO
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment