COSC2675 Rapid Application Development
Computer Science and Information Technology School of Science, RMIT
Assignment 2 – Semester 1 2018
Introduction
This assignment is worth 35% towards your final grade. You are required to develop a web
application as specified below. It is designed to: ! Practise your knowledge of Rails development
! Practise testing and debugging
This is a group assignment. A group should not have more than 2 members. Individual submission does not receive any extra marks. By default, both group members receive the same mark unless there is a significant discrepancy in their contributions.
Academic Integrity
The submitted assignment must be your own work. No marks will be awarded for any parts, which are not created by you. More on http://www.rmit.edu.au/academicintegrity.
Plagiarism is treated very seriously at RMIT. Plagiarism includes copying code directly from other students, internet or other resources without proper reference. Sometimes, students study and work on assignments together and submit similar files which may be regarded as plagiarism. Please note that you should always create your own assignment even if you have very similar ideas.
Plagiarism-detection tools may be used for all submissions. Penalties will be applied in cases of plagiarism.
Client Request
This assignment is developed based on the following fictitious message from the school admin team.
Dear Andy
Our school is thinking of building a news website to let everyone share relevant news. RAD students may be able to help as we’ve heard from many that they know how to quickly build a good website from scratch.
There is no formal specification yet. We just want a news-sharing site, which is easy to use and has good look-n-feel, for our staff and students. People with a proper RMIT email address should be able to register to be a user. Do you think we should only allow registered users to post, update and remove news? Viewing the news should not be a problem. Mmm… it would be nice that the site looks like Hacker News. Students and staff can comment on the news and see latest comments from fellow users.
Thank you and talk soon.
RMIT News
In this assignment, you will build a news sharing web application for RMIT. That is kind of a subset of famous hacker news (https://news.ycombinator.com/). For whom is new to Hacker News, it is a social news website focusing on computer science and entrepreneurship. It is run by Paul Graham’s investment fund and startup incubator, Y Combinator. In general, news that can be submitted is defined as “anything that gratifies one’s intellectual curiosity”.
Part 1
Section 1 – Home Page
Your application should meet the following requirements
- It has a navigation bar with RMIT logo and site name on it
- The navigation bar must contains at least four hyperlinks
- Home – to show the home page
- Comments – to show the latest comments (of all news)
- Submit – to submit a news (login required)
- Login – login or create user account
3. The news content
- The news posts are sorted by the creation date using Unix timestamps.
- The headline of a news contains the title and the source of the news (if exists)
- By clicking on the source, the user will be redirected to the source website.
- The source news text is the domain name of that particular news website.
- The meta information about each news contains:
- The author who submitted the news
- The time when the news got submitted
- The number of total comments on that news
- The text e.g. “25 comments”, is clickable and will take the user to the
comments page of that news. (see below)
4. The footer
- API: a link to the API documentation
(https://github.com/pigfly/RMIT-CSIT-RAD/tree/master/2018_S1/assignment2)
- About: the makers of your web application
i. The names of your group members
ii. The student number of each member.iii. Your heroku deployed URL
iv. Your assignment 2 bitbucket URL
5. Pagination
- The news home page will show eight news per page
- The pagination is triggered by pressing the more button
Section 2 – Home Page Pagination
2.3
Requirements:
- When the more button is clicked, the page will show the next eight news
- The page’s relative URL is /news?p=#{number} e.g. /news?p=2
- The page title should be changed into
Home page #{your_current_pagination_number}
The page number for the above example is 1.
The page number is zero indexed, meaning that number for the Home page is 0.
Section 3 – New Comments
3.2
Requirements:
- The New Comments page shows the latest comments of all news posts.
- The New Comments page’s relative URL path is /newcomments
- The New Comments page is sorted by the creation date & time
- Each comment has two parts:
- Headline: include the user who commented on that particular news, the date that
the comment was created, and the title of the news.
- Body: the comment message body
- Headline: include the user who commented on that particular news, the date that
- The New comments page will show and only show three comments sorted by the creation date.
Section 4 – Comments Per News
4.3
Requirements:
- The Comments page of each news shows a text area for commenting and all the
comments related to that particular news. Comments are sorted by date and time.
- The Comment Per News page’s relative URL path is /item?id=#{id_number}
- The page title is the same title of the news, which is to be commented on.
- The comment section has four parts:
a. Headline: the news title
- Sub header: the creator of the news, the news creation date/time and the total number of comments at present
- A text area for the commenting
- A submit button – “add comment”
- Validation rules for comment messages
- Must not be blank
- Must be at least 3 characters excluding white spaces, new lines and tabs
- Must be less than 1000 characters
- Banner messages:
- If the comment doesn’t pass the validation, show a warning banner message (see
banner message page in Section 6).
- If comment does pass the validation, show a success banner message (see
banner message page in Section 6) and redirect the user to /newcomments
- You can decide the text for both types of banner messages yourself.
- If the comment doesn’t pass the validation, show a warning banner message (see
- The list of all comments
- It should show all the comments that belongs to this particular news
- All the comments that belongs to this particular news should be sorted by creation
date/time
- It should show no comments if there is no comment for that news
Section 5 – Submit
Requirements:
- The Submit Page allows the user to submit a news
- The Submit Page’s relative URL path is /submit
- If the user is not logged in, redirect the user to the login page (/login)
- The navigation title of this page should be “Submit a news”
- The submit section has three parts
- The text area for the submitted news title (required)
- The source of the news (optional)
- The submit button
- Validation rules for the submit text area:
- Must not be blank
- Must be at least 10 characters (including white spaces, new lines and tabs)
- Must be less than 200 characters
Note: The text area is for entering the news title only. There is no news body.
- Validation rule for the source of the news
a. Must be a valid URL if the URL is not empty
8. Banner messages
- If a submission doesn’t pass the validation, show a warning banner message (see
banner message page in Section 6).
- If comment does pass the validation, show a success banner message (see
banner message page in Section 6) and redirect the user to the home page. You can decide the text for both types of banner message yourself.
Section 5 – Login
Requirements:
- The login page shows the login and creates an account
- The login page’s relative URL is /login
- The validation rule for user name
- Must not be blank
- Can only contain letters, digits, dashes and underscores.
- Should be between 2 and 15 characters.
- Must be a unique username in the database.
- The validation rule for password
- Must not be blank
- Must contain at least one uppercase letter, one special character, one number and one lowercase letter
- Must contain at least 10 characters
- Both username and password must be valid in order to pass the validation
- Banner messages
- If a submission doesn’t pass the validation, show a warning banner message (see
banner message page in Section 6).
- If comment does pass the validation, show a success banner message (see
banner message page in Section 6) and redirect the user to the home page. You can decide the text for both types of banner message yourself.
- If a submission doesn’t pass the validation, show a warning banner message (see
Section 6 – Banner Message
Guidelines
- – Your web application should be mobile friendly
- – You can use your favourite CSS/HTML style as you wish
Part 2 API
In this part, you will implement your API endpoint for RMIT news.
Overview
This is sample documentation for RMIT News API (RAD course)
Please post your relevant thoughts in canvas if found anything unclear.
URI and Versioning
The first version will have URIs prefixed with http://*.*/v0/ and is structured as described below.
Design
The v0 API is essentially a dump of your database.
It’s not the ideal public API, but it’s the one you can get a taste how RESTful API works internally.
Items
News, comments are just items. They’re identified by their ids, which are unique integers, and live under /v0/item/<id>.
All items have some of the following properties, with required properties in bold:
Field |
Description |
id |
The item’s unique id. |
type |
The type of item. One of “news”, “comment” |
by |
The username of the item’s author. |
time |
Creation date of the item, in Unix Time. |
text |
The comment text |
Field |
Description |
url |
The source URL of the news |
title |
The title of the news |
For example, a news: http://yourownurl/v0/item/8863.json
{
“by” : “dhouston”,
“id” : 8863,
“time” : 1175714200,
“title” : “My YC app: Dropbox – Throw away your USB drive”, “type” : “news”,
“url” : “http://www.getdropbox.com/u/2/screencast.html”
}
comment: http://yourownurl/v0/item/2921983.json
{
“by” : “norvig”,
“id” : 2921983,
“text” : “Aw shucks, guys … you make me blush with your compliments.<p>Tell you what, Ill make a deal:
I’ll keep writing if you keep reading. K?”, “time” : 1314211127,
“type” : “comment”
}
another news: http://yourownurl/v0/item/121003.json
{
“by” : “tel”,
“id” : 121003,
“text” : “<i>or</i> HN: the Next Iteration<p>I get the impression that with Arc being released a lot of
people who never had time for HN before are suddenly dropping in more often. (PG: what are the numbers on this? I’m envisioning a spike.)<p>Not to say that isn’t great, but I’m wary of Diggification. Between links comparing programming to sex and a flurry of gratuitous, ostentatious adjectives in the headlines it’s a bit concerning.<p>80% of the stuff that makes the front page is still pretty awesome, but what’s in place to keep the signal/noise ratio high? Does the HN model still work as the community scales? What’s in store for (++ HN)?”,
“time” : 1203647620, “title” : “The Arc Effect”, “type” : “news”,
“url” : “”
}
Endpoint to implement:
– /v0/item/<id>
o Request Type: GET
o Authentication: None
o Return status code: 200 for OK, 400 for Errors
– /v0/item/create
o Request Type: POST
o Request Body:
o Authentication: None
o Return status code: 200 for OK, 400 for Errors
{
“username” : “alex”,
“text” : “Create a sample news”,
“type” : “news”,
“new source” : “https://www.rmit.edu.au”
}
Additional Notes 1: Your application is expected to be production ready. Proper test and data validation should be embedded in your application. 2: There is no need for your application to look and behave exactly like the above example. You can make necessary adjustment to improve the design. However the aforementioned functionalities are the minimum requirement and should be well supported. 3: Only the following GEMS should be used in your application. |
gem gem gem gem gem gem gem gem gem gem gem
‘rails’ ‘bootstrap-sass’ ‘puma’
‘sass-rails’
‘uglifier’
‘coffee-rails’ ‘jquery-rails’ ‘turbolinks’
‘jbuilder’ “font-awesome-rails” ‘bcrypt’
Submission
– This assignment will also be using bitbucket to host all your Rails files
https://bitbucket.org/
o Create a private repo named as RAD18_Assign_2_group_{studentNumber_small}_{studentNumber_large}
ONLY ONE submission for each group is needed. For duplicate group submissions, we will randomly select one to mark.
o Make a branch called “submission”
o Invite the following people as default reviewers to your project
- – junliang.jiang@rmit.edu.au
- – anto.dominic@rmit.edu.au
- – andy.song@rmit.edu.au
o Make a pull request to merge your branch submission to branch master
and include the following default reviewers (to ensure our access)
- – junliang.jiang@rmit.edu.au
- – anto.dominic@rmit.edu.au
- – andy.song@rmit.edu.au
o The due date: 11:59pm of the 20th of May.
o A final submission before 15th May 11:59pm will receive 10% extra as the bonus. o This assignment will attract additional marks for individual lab demonstration.
o For one professional developer working alone, the expected completion time is less than 5 full days.
– It is a good habit to keep track of the hours that you spent on a project. For that purpose, we recommend toggl.com, a free online time tracker.
– Warning
o You will receive ZERO mark if you don’t host your assignment in bitbucket before the due day (see details later).
o You will receive ZERO mark if your application fails to run (see details later).