Due: Thursday May 28, 11pm
Submit to: https://www.crowdgrader.org/crowdgrader/venues/view_venue/4648
You must implement a "thumbs up / down" component. This component should be modeled after the starrater component, and it should enable people to rate items using up/down thumbs, rather than stars.
The thumbs themselves should have the same behavior as in Homework 5, and if you could not get them to work then, please study again solutions from CrowdGrader. Here is an example of how the thumbs, and the component, should behave.
Please read these instructions very carefully before starting your work, as the development of this homework is somewhat non-standard.
You must use the homework7_starter starter code; get it with:
cd py4web/apps
git clone https://luca_de_alfaro@bitbucket.org/luca_de_alfaro/homework7_starter.git homework7
which will put it in the apps/homework7 directory, thus, in an app called homework7 (do this, exactly, please).
Within it, you must only change these files:
components/thumbrater.py
static/components/thumbrater/thumbrater.css
(optional; you can leave it empty)static/components/thumbrater/thumbrater.html
static/components/thumbrater/thumbrater.js
If you change any other file, you will receive no credit, as your solution will break in the testing phase!
The point here is that the homework consists just in the design of the component, which is modeled after the starrater component. The use of that component has already been implemented, so that you can find in controllers.py already done:
All this is already done for you! The homework really is not that difficult: all you need to do is write a thumbrater component that makes all the rest of the code work! And you can, or better, should, style it after the starrater. And you should have most of the logic implemented from Homework 5, be it from you, or from one of the students whose solution you revised.
This time, you will not submit the entire app. You will just submit the component.
To do so, please get a copy of my component manager (written expressly for this homework, no less!):
cd somewhere
git clone https://luca_de_alfaro@bitbucket.org/luca_de_alfaro/component_manager.git
You can pack a component with the command:
./component_manager.py pack thumbrater path/to/py4web/apps/homework7
This will create in the current directory a file thumbrater.zip
. If this file already exists, to overwrite it do:
./component_manager.py pack --force thumbrater path/to/py4web/apps/homework7
You must submit this .zip file. Submitting the whole app will give you no credit! We just want the component!
To test another student's work, and indeed, to test your own work before submitting it, proceed as follows.
First, get a clean copy of the application, and remove the (skeletal) component in it:
cd py4web/apps
git clone https://luca_de_alfaro@bitbucket.org/luca_de_alfaro/homework7_starter.git homework7_testing
cd somewhere
./component_manager.py remove thumbrater path/to/py4web/apps/homework7_testing
where I have assumed that you have cloned the component manager into ~/work/component_manager
; if not, change accordingly the above command line.
The command gives you a nice and clean version of homework 7 starter code, without the component to be tested.
Then, assume that you have a component somewhere/thumbrater.zip, which is either yours (packed as above), or downloaded from CrowdGrader, you can do:
./component_manager.py install thumbrater -z somewhere/thumbrater.zip path/to/py4web/apps/homework7_testing
(note that Google Sites is adding funny line breaks). This will install for you the component under test, and you can now check that the application works.
Remember that when you replace a component, you must restart py4web (unless you are using the new --watch
option), and hard-reload (shift-reload, whatever your browser wants) the application.