Day 25

August 4, 2017 15:59 UTC Team Code Bears (diaspora*) [2017]Subscribe to this teams's activities

Today we looked mainly at the topic of Presenters, which was the main topic that was missing for us to get a step further in our issue. And it did!! First we looked at some tutorials but we realized quickly that we need a coaching session on this. So we had a really helpful session and at the end of the day we were able to show the option a user voted for in a poll in the browser.
This is what we did:
* Added a method in the models/poll.rb file which includes the call to the database
* Added a method in the app/presenters/post_presenter.rb file, passing the current user to the method in the model.
* Added this method in the non_directly_retrieved_attributes method of the app/presenters/post_presenter.rb file which is then passed to the as_json method.
* Called the relevant attribute of the json from the post_presenter in the app/assets/templates/poll_tpl.jst.hbs including an if-statement which refers to a variable in the app/assets/javascripts/app/views/poll_view.js to show the result only if the user has already participated (need to check if we really need this)
* Added some lines to the config/locales/javascript/javascript.en.yml translation file to be able to show the output in the poll_tpl.jst.hbs.

What a successful end of a very confusing week :)

Comments

You must be logged in to add a comment.