Skip to content

jinook929/_flatiron_project2

Repository files navigation

TraVlog Sinatra App

by Jinook Jung


How To Set Up the App

  1. Visit my Github repository and clone the code to your local directory:

git clone https://github.com/jinook929/_flatiron_project2.git

  1. Enter into the _flatiron_project2 folder: cd _flatiron_project2.
  2. Execute bundle install and run shotgun in terminal.
  3. Then, open your browser at http://localhost:9393/.

How To Use the App

  1. You can either sign up for your own account or use the existing accounts to log in.
  2. Before logging in, user still can see vlog list by countries and each individual vlog from there, but no more than that.
  3. If you log in as super (password: 123), you can create, read, update, and delete vlogs, comments, and even users, like making someone else admin, except for deleting yourself.
  4. If you log in as admin (password: 123), you can create, read, and update vlogs, and create, read, update, and delete comments, and read the users.
  5. If you log in as normal user (user, password: 123), you can create, update, and delete your own vlogs and comments, and read all vlogs and comments.
  6. Each user has access to his/her own profile (user info, vlog info, country info, and comment info) through Welcome, USER link on the navbar.
  7. Keyword search is available for any logged-in user via the search box on the navbar.

Screen Captures

Landing Page

Landing Page

Signup Page

Signup Page

Login Page

Login Page

Country List Page

Country List Page

Vlog List Page

Vlog List Page

Profile Page

Profile Page

Vlog Page

Vlog Page

New Vlog Page

New Vlog Page

Edit Vlog Page

Edit Vlog Page

Comment Section

Comment Section

Edit Comment

Edit Comment

Search Results

Search Results

Data Structure

Tables

users

  t.string :username
  t.string :email
  t.string :password_digest
  t.boolean :admin, default: false # (except for the first user)
  t.boolean :super, default: false # (except for the first user)

posts

  t.string :title
  t.text :content
  t.string :youtube
  t.integer :country_id
  t.integer :user_id

countries

  t.string :name
  t.string :url

comments

  t.string :content
  t.integer :post_id
  t.integer :commenter_id

Model Associations & Validations

User

  has_many :posts
  has_many :comments, foreign_key: "commenter_id"
  has_many :countries, through: :posts, source: :country
  has_many :commented_posts, through: :comments, source: :post

  has_secure_password

  validates :username, presence: true
  validates :username, uniqueness: true
  validates :email, presence: true
  validates :email, uniqueness: true
  validates :password, presence: true

Post

  belongs_to :user  
  belongs_to :country
  has_many :comments
  has_many :commenters, through: :comments, source: :user

  validates :title, presence: true
  validates :content, presence: true
  validates :youtube, presence: true

Comment

  belongs_to :post
  belongs_to :commenter, class_name: "User"

  validates :content, presence: true

Country

  has_many :posts

  validates :name, presence: true

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jinook929/_flatiron_project1. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Contributors

License & Copyright

© Jinook Jung

The app is available as open source under the terms of the MIT License.

About

Flatiron Project 2. Sinatra Project

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published