Commit d4ab70d9 authored by Elena Grassi's avatar Elena Grassi
Browse files

Added minimal code guide to ratings documentation

parent 0a0f89fd
......@@ -130,4 +130,20 @@ Will use the POSTEDITOR_PLACEHOLDER_BUY label only for the FL_FOOD_BUY (entity t
## Minimal code guide
TODO
\ No newline at end of file
The general structure of the code has been borrowed by the post code, therefore there is a `rating` directory for the templates, a directive `ratings.js`
and a factory called `RatingFact.js` - probably the directive could have been developed in a more DRY fashion avoiding a bit of code duplication but due to
time constraints we opted to KISS completely.
There are other templates and directive with small code additions to manage ratings, mainly `modal.js` to show the aggregated ratings.
Also the tab management in the modal with entities details has been simply changed to have a "Ratings" tab instead of a "Posts" one - this
behaviour is triggered using the config option `behaviour.postIsRating`.
Main issues faced during development, probably these notes are not useful for someone who knows well AngularJS:
- implementing `startWithOpenedRating` required a new app state to be defined in `EditorCtrl.js`, basically the information that we
finished adding a new Entity has to fall back up to the status management in `MapCtrl.js` to reach the modal containing entities details
and the tabs with ratings
- all templates have a switch to manage separately the three kind of ratings
- to adapt the objects with ratings, that we derive directly from the config, to the backend, some "adapter" methods were written in `RatingFact.js`
- some checks were added in `modal.js` to display the summarized ratings not only considering the config file but if the entity in question effectively has some ratings
This could be a good place to start refactoring code, especially if more complex ratings would be needed.
\ 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