Skip to content
Snippets Groups Projects
Commit e515f6fe authored by Koneswaran, Nithesh (UG - Computer Science)'s avatar Koneswaran, Nithesh (UG - Computer Science)
Browse files

Finalised comments

parent 4b1c0ca2
No related branches found
No related tags found
No related merge requests found
...@@ -19,18 +19,16 @@ ...@@ -19,18 +19,16 @@
//= require turbolinks //= require turbolinks
//= require_tree . //= require_tree .
$(document).ready(function(e){ $(document).ready(function(e){
//Only changes the name of the selected tem in the drop down
$('.search-panel .dropdown-menu').find('a').click(function(e) { $('.search-panel .dropdown-menu').find('a').click(function(e) {
e.preventDefault(); //prevents the page from refreshing when clicking an item
var concept = $(this).text(); e.preventDefault();
$('.search-panel span#search_concept').text(concept); $('.search-panel span#search_concept').text($(this).text());
}); });
$('#toggle').click(function() {
$(this).toggleClass('clicked');
});
//When the mouse goes off the navbar toggle button, it will not be highlighted
$(".navbar-toggle").mouseup(function(){ $(".navbar-toggle").mouseup(function(){
$(this).blur(); $(this).blur();
}) })
}); });
\ No newline at end of file
...@@ -18,26 +18,20 @@ ...@@ -18,26 +18,20 @@
@import "bootstrap-sprockets"; @import "bootstrap-sprockets";
@import "bootstrap"; @import "bootstrap";
/* Variables*/
$warm-colour: #efefef; $warm-colour: #efefef;
$shadow-effect: inset 0px 0px 50px rgba(0,0,0,0.55); $shadow-effect: inset 0px 0px 50px rgba(0,0,0,0.55);
$hover-colour: #d3d3d3; $hover-colour: #d3d3d3;
$font: sans serif; $font: sans serif;
$white: #FFFFFF; $white: #FFFFFF;
/* Nav bar colours */ /* Nav bar colours */
$navbar-background: #323232; $navbar-background: #323232;
/*Toggle button background colour */ /*Toggle button background colour */
$toggle-active-background: #3c3c3c; $toggle-active-background: #3c3c3c;
/* Globally setting font family to be sans serif */ /* Globally setting font family to be sans serif */
* { * {
font-family: $font !important; font-family: $font !important;
} }
/*Sets the background color*/ /*Sets the background color*/
body { body {
background: $warm-colour; background: $warm-colour;
...@@ -51,6 +45,7 @@ body { ...@@ -51,6 +45,7 @@ body {
} }
/* Setting some global attributes for the tag hr */
hr { hr {
height: 1px; height: 1px;
color: #d2d2d2; color: #d2d2d2;
...@@ -59,16 +54,13 @@ hr { ...@@ -59,16 +54,13 @@ hr {
border: none; border: none;
} }
/* Setting some global attributes for the tag a */
a:hover, a:focus, a:active { a:hover, a:focus, a:active {
background: transparent; background: transparent;
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
/* DEVISE: LOGIN STYLING /* DEVISE: LOGIN STYLING
========================================*/ ========================================*/
...@@ -205,6 +197,8 @@ Flash container msg ...@@ -205,6 +197,8 @@ Flash container msg
} }
/* Editing the footer so that the text are in line
making sure the footer covers the whole width*/
footer { footer {
width: 100%; width: 100%;
background-color: $navbar-background; background-color: $navbar-background;
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
/* Makes sure the footer stays at the bottom
Makes sure the container is below the navbar when loaded*/
#contact.row { #contact.row {
margin-top: 80px; margin-top: 80px;
position: relative; position: relative;
......
...@@ -3,21 +3,20 @@ ...@@ -3,21 +3,20 @@
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
/* Moves header below the nav bar */ /* Provides room for the list of posts that belong to the user */
.halfpage { .halfpage {
min-height:35vh; min-height:35vh;
} }
/* Makes sure the footer stays at the bottom
Makes sure the container is below the navbar when loaded
this is applied to the similar views*/
#profile_show.row { #profile_show.row {
margin-top: 80px; margin-top: 80px;
position: relative; position: relative;
padding: 0 30px; padding: 0 30px;
height: 45vh; height: 45vh;
} }
#profile_new.row { #profile_new.row {
margin: 80px 0px; margin: 80px 0px;
padding: 0 30px; padding: 0 30px;
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
height: 70vh; height: 70vh;
} }
/* reducing the padding on this hr tag */
hr.divider { hr.divider {
margin: 0em; margin: 0em;
border-width: 2px; border-width: 2px;
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
/* Makes sure the footer stays at the bottom
Makes sure the container is below the navbar when loaded
this is applied to the similar views*/
#reviews_new.row { #reviews_new.row {
margin-top: 80px; margin-top: 80px;
padding: 0 30px; padding: 0 30px;
......
/* CSS GENERATED BY SCAFFOLD */
body { body {
background-color: #fff; background-color: #fff;
color: #333; color: #333;
......
...@@ -7,10 +7,7 @@ class ReviewsController < ApplicationController ...@@ -7,10 +7,7 @@ class ReviewsController < ApplicationController
before_action :same_account, :authenticate_user!, :must_make_account, only: [:new, :edit, :create, :update, :destroy, ] before_action :same_account, :authenticate_user!, :must_make_account, only: [:new, :edit, :create, :update, :destroy, ]
#Finds the currently viewed profile #Finds the currently viewed profile
before_action :find_profile before_action :find_profile
#The index action which displays all the reviews onto a form
def index
@reviews = Review.all
end
#The new action allows the user to create a new review #The new action allows the user to create a new review
def new def new
@review = Review.new @review = Review.new
......
...@@ -8,10 +8,9 @@ class Post < ActiveRecord::Base ...@@ -8,10 +8,9 @@ class Post < ActiveRecord::Base
validates :title, :description, :price, :address_one, :city, :postal_code, validates :title, :description, :price, :address_one, :city, :postal_code,
:city, :postal_code, :phone_number, :category_id, :user_id, presence: true :city, :postal_code, :phone_number, :category_id, :user_id, presence: true
#Validates the phone number checking if it has a valid phone number #Validates the phone number checking if it has a valid phone number
validates :phone_number, format: { with: /\d{11}/, message: "Enter valid phone number" } validates :phone_number, format: { with: /\d{11}/}
#Validates the postal code checking if it has a valida email #Validates the postal code checking if it has a valida email
validates :postal_code, format: { with: /([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9][A-Za-z]?))))\s?[0-9][A-Za-z]{2})/, validates :postal_code, format: { with: /([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9][A-Za-z]?))))\s?[0-9][A-Za-z]{2})/}
message: "Enter valid postal code" }
#Sets up paper clip to be used within post #Sets up paper clip to be used within post
has_attached_file :post_image, styles: { post_index: "300x300>", post_show: "300x300>" }, default_url: "/images/:style/missing.png" has_attached_file :post_image, styles: { post_index: "300x300>", post_show: "300x300>" }, default_url: "/images/:style/missing.png"
#validates an image, #validates an image,
......
...@@ -28,7 +28,11 @@ ...@@ -28,7 +28,11 @@
%input.form-control{:name => "x", :placeholder => "Search for something", :type => "text"} %input.form-control{:name => "x", :placeholder => "Search for something", :type => "text"}
%span.input-group-btn %span.input-group-btn
%button.btn.btn-default{:type => "button"} %button.btn.btn-default{:type => "button"}
%span.glyphicon.glyphicon-search Search
-#SUBHEADING -#SUBHEADING
%br %br
%span.subheading Find something in time for christmas %span.subheading Find something in time for christmas
= simple_form_for :search, {url: posts_path} do |f|
= f.input :user_email, :as => :hidden, :input_html => { :value => current_user.email}
= f.input :user_telephone, :as => :hidden, :input_html => { :value => current_user.profile.number}
...@@ -24,6 +24,8 @@ en: ...@@ -24,6 +24,8 @@ en:
app_Description: Sell sell sell app_Description: Sell sell sell
back: Back back: Back
additional: Contact Information additional: Contact Information
model:
phonenumber: Enter a valid phone number
devise: devise:
passwords: passwords:
new: new:
......
...@@ -20,13 +20,6 @@ class ReviewsControllerTest < ActionController::TestCase ...@@ -20,13 +20,6 @@ class ReviewsControllerTest < ActionController::TestCase
# resets the cache # resets the cache
Rails.cache.clear Rails.cache.clear
end end
test "should get index" do
get :index, profile_id: @profile.id
assert_response :success
assert_not_nil assigns(:reviews)
end
test "should get new" do test "should get new" do
get :new, profile_id: @profile.id get :new, profile_id: @profile.id
assert_select "h1" , I18n.t('reviews.new.title') assert_select "h1" , I18n.t('reviews.new.title')
......
...@@ -8,7 +8,7 @@ class CategoryTest < ActiveSupport::TestCase ...@@ -8,7 +8,7 @@ class CategoryTest < ActiveSupport::TestCase
#Cannot create a category with empty name field #Cannot create a category with empty name field
test 'should not save invalid user' do test 'should not save invalid category' do
category = Category.new category = Category.new
category.save category.save
refute category.valid? refute category.valid?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment