Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/SF-WDI/project1-scootwee int…
Browse files Browse the repository at this point in the history
…o dev

latest update on index
  • Loading branch information
Dereje24 committed Mar 5, 2018
2 parents a1e169b + b3ffdf4 commit f5a9926
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 20 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'bootstrap-datepicker-rails'
gem 'faker'
gem 'jquery-rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ GEM
arel (8.0.0)
bcrypt (3.1.11)
bindex (0.5.0)
bootstrap-datepicker-rails (1.7.1.1)
railties (>= 3.0)
builder (3.2.3)
byebug (10.0.0)
coffee-rails (4.2.2)
Expand Down Expand Up @@ -165,6 +167,7 @@ PLATFORMS

DEPENDENCIES
bcrypt (~> 3.1.7)
bootstrap-datepicker-rails
byebug
coffee-rails (~> 4.2)
faker
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//= require jquery
//= require jquery_ujs
//= require bootstrap.min
//= require bootstrap-datepicker
var directionsService = new google.maps.DirectionsService
var directionsDisplay = new google.maps.DirectionsRenderer
var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png",
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*= require_self
*= require bootstrap.min
*= require home.scss
*= require bootstrap-datepicker
*/
import 'owl.carousel/dist/assets/owl.carousel.css';

Expand Down
11 changes: 11 additions & 0 deletions app/assets/stylesheets/session.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
// Place all the styles related to the session controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

h2, h4, .date, .day{
text-align: center;
}

.listandmap{
display: flex;
justify-content: center;
justify-content: space-around;
}

33 changes: 33 additions & 0 deletions app/assets/stylesheets/users.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
// Place all the styles related to the users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

.logo{
text-align: center;
}

.logsession{
margin-top: 10%;
}

.login{
margin-top: 5%;
}

.line {
border-left: 2px solid black;
height: 600px;
}

.signup{
margin-top: 19%;
}

.everything{
display: flex;
justify-content: center;
justify-content: space-around;
}

input{
height: 40px;
width: 300px;
border-radius: 5px;
}
4 changes: 2 additions & 2 deletions app/controllers/rentals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def show
@rentals=User.find(session[:user_id]).rental.where("drop_date != 'nill' ")
@rentals.each do |r|
@vehicle=r.vehicle
@local_start=@vehicle.local
@local_end=Local.find(r.local_drop)
@local_start=r.local
@local_end=Local.find_by_id(r.local_drop.to_i)
@history.push({rental:r,vehicle:@vehicle,local_start:@local_start,local_end:@local_end})

end
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def show
@user=current
end


def create

@user = User.new({first_name:user_params[:first_name],last_name:user_params[:last_name],email:user_params[:email],password:user_params[:password]})
if(@user.save)
login(@user,user_params[:lat],user_params[:lng])
Expand All @@ -39,11 +41,13 @@ def create
end
end


def edit
end

def destroy
end

def map
@positions= ActiveRecord::Base.connection.execute("SELECT *,(((acos(sin((#{cookies['lat'].to_f} * pi()/180)) *
sin((CAST(lat AS DOUBLE PRECISION) * pi()/180))+cos((#{cookies['lat'].to_f} * pi()/180)) *
Expand Down
23 changes: 22 additions & 1 deletion app/views/session/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
<h1>Login</h1>
<%= form_with mode:@user , id:'login' do |t|%>

<div class= 'everything'>
<div class= 'logsession'>

<h1>Login</h1>

<div>
<%= t.label :email , 'Email' %>
<br>
<%= t.text_field :email , placeholder:'Email here' %>
</div>

<div>
<%= t.label :password, 'Password' %>
<br>
<%= t.password_field :password , placeholder:'Password' %>
</div>

<%= t.hidden_field :lat %>
<%= t.hidden_field :lng %>
<br>
<%= t.submit 'Login' %>
<% end %>
</div>

</div>




63 changes: 49 additions & 14 deletions app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,42 +1,77 @@
<h1>Users#new</h1>
<div class='container'>
<%= form_with url:user_login_path, id:'login' do |l|%>


<div class= 'logo'>
<%= image_tag "ScootweeLogo.png" %>
</div>

<div class = 'everything'>

<div class = 'login'>
<h1>LOGIN</h1>
<div>
<%= l.label :email %>
<br>
<%= l.text_field :email, placeholder: "Email" %>
</div>
<div>
<%= l.label :password %>
<br>
<%= l.password_field :password, placeholder: "Password" %>
</div>
<%= l.hidden_field :lat%>
<%= l.hidden_field :lng%>
<br>
<%= l.submit "Login" %>


<% end %>
</div>

<div class= 'line'>
</div>


<div>
<% if(flash[:user_error]) %>
<% flash[:user_error].each do |e| %>
<div class='bg-info'><p class='text-danger'><%= e %></p></div>
<% end %>
<% end %>
<%= form_with model:@user , id:'signup' ,class:'form col-lg-12' do |f|%>
<div class='form-group'>
<%= form_with model:@user , id:'signup' do |f|%>

<div class= 'signup'>
<h1> SIGN UP </h1>

<%= f.label :first_name %>
<br>
<%= f.text_field :first_name, placeholder: "First Name", class:'form-control' %>
<%= f.text_field :first_name, placeholder: "First Name" %>
</div>

<div class='form-group'>
<div>
<%= f.label :last_name %>
<br>
<%= f.text_field :last_name, placeholder: "Last Name" , class:'form-control' %>
<%= f.text_field :last_name, placeholder: "Last Name" %>
</div>

<div>
<%= f.label :email %>
<br>
<%= f.text_field :email, placeholder: "Email" %>
</div>

<div>
<%= f.label :password %>
<br>
<%= f.password_field :password, placeholder: "Password" %>
</div>
<%= f.hidden_field :lat%>
<%= f.hidden_field :lng%>



<br>
<%= f.submit "Sign Up" %>

<% end %>

<p>Find me in app/views/users/new.html.erb</p>

</div>


21 changes: 19 additions & 2 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<div id='page'>
<button id='ok'>OK</button>
<h1>Users#show</h1>

<h2>Hours Of Operation: 7AM - 9PM</h2>
<br>

<h4>Choose Date</h4>
<br>

<div class='date'>
<input class='day' type="text" data-provide='datepicker' >
</div>


<p>Find me in app/views/users/show.html.erb</p>
<%= link_to 'Logout' ,logout_path %>
<br>

<div id='list' style="height:500px;width:700px;float:left;margin-right:50px">

<div class= 'listandmap'>

<div id='list' style="height:500px;width:400px;float:left;margin-right:50px">

</div>
<div id='map' style="height:500px;width:400px;float:left"></div>
Expand Down Expand Up @@ -33,4 +47,7 @@
</div>
</div>
</div>


</div>

2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

post '/contact_us', to: 'home#create'
post '/sign_up', to: 'users#create' , as: 'users'
post '/login', to: 'session#create'
post '/login', to: 'session#create', as:'user_login'
get '/logout', to: 'session#destroy' , as:'logout'
get '/map' , to: 'users#map'
post '/rent', to: 'rentals#create' , as:'rental'
Expand Down

0 comments on commit f5a9926

Please sign in to comment.