Lot of styles, and some other stuff
This commit is contained in:
parent
0c06c4bedb
commit
191517bda7
7
Gemfile
7
Gemfile
|
@ -44,6 +44,8 @@ end
|
||||||
group :test do
|
group :test do
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'launchy'
|
gem 'launchy'
|
||||||
|
gem "codeclimate-test-reporter", require: nil
|
||||||
|
gem 'faker', '1.4.2'
|
||||||
end
|
end
|
||||||
|
|
||||||
#bootstrap
|
#bootstrap
|
||||||
|
@ -65,9 +67,6 @@ gem 'devise'
|
||||||
# Use cancancan for authorization
|
# Use cancancan for authorization
|
||||||
gem 'cancancan'
|
gem 'cancancan'
|
||||||
|
|
||||||
#ik wil test data maken dus dit
|
|
||||||
gem 'faker', '1.4.2'
|
|
||||||
|
|
||||||
# Safety first
|
# Safety first
|
||||||
gem 'paper_trail', '~> 4.0.0.beta'
|
gem 'paper_trail', '~> 4.0.0.beta'
|
||||||
|
|
||||||
|
@ -76,4 +75,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
|
||||||
|
|
||||||
gem 'coveralls', require: false
|
gem 'coveralls', require: false
|
||||||
|
|
||||||
gem "codeclimate-test-reporter", group: :test, require: nil
|
gem 'omniauth'
|
||||||
|
|
|
@ -111,6 +111,7 @@ GEM
|
||||||
ffi (1.9.6-x64-mingw32)
|
ffi (1.9.6-x64-mingw32)
|
||||||
globalid (0.3.2)
|
globalid (0.3.2)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
|
hashie (3.4.0)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
jbuilder (2.2.6)
|
jbuilder (2.2.6)
|
||||||
|
@ -140,6 +141,9 @@ GEM
|
||||||
mini_portile (~> 0.6.0)
|
mini_portile (~> 0.6.0)
|
||||||
nokogiri (1.6.6.2-x64-mingw32)
|
nokogiri (1.6.6.2-x64-mingw32)
|
||||||
mini_portile (~> 0.6.0)
|
mini_portile (~> 0.6.0)
|
||||||
|
omniauth (1.2.2)
|
||||||
|
hashie (>= 1.2, < 4)
|
||||||
|
rack (~> 1.0)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
paper_trail (4.0.0.beta2)
|
paper_trail (4.0.0.beta2)
|
||||||
activerecord (>= 3.0, < 6.0)
|
activerecord (>= 3.0, < 6.0)
|
||||||
|
@ -263,6 +267,7 @@ DEPENDENCIES
|
||||||
jquery-rails
|
jquery-rails
|
||||||
launchy
|
launchy
|
||||||
mysql2
|
mysql2
|
||||||
|
omniauth
|
||||||
paper_trail (~> 4.0.0.beta)
|
paper_trail (~> 4.0.0.beta)
|
||||||
paperclip
|
paperclip
|
||||||
rails (= 4.2)
|
rails (= 4.2)
|
||||||
|
|
|
@ -29,83 +29,57 @@ $gray-medium-light: #eaeaea;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* miscellaneous */
|
/* miscellaneous */
|
||||||
|
|
||||||
.nowrap {
|
.nowrap {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.center{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-field{
|
||||||
|
margin-bottom: 15px;
|
||||||
|
text-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bootstrap */
|
||||||
|
|
||||||
/* boostrap */
|
|
||||||
body {
|
body {
|
||||||
padding-top: 80px;
|
padding-top: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* footer */
|
/* footer */
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
margin-top: 45px;
|
margin-top: 45px;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
border-top: 1px solid #eaeaea;
|
border-top: 1px solid $gray-medium-light;
|
||||||
color: #777;
|
color: #777;
|
||||||
}
|
a {
|
||||||
|
color: #555;
|
||||||
footer a {
|
&:hover {
|
||||||
color: #555;
|
color: #222;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a:hover {
|
|
||||||
color: #222;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer small {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer ul {
|
|
||||||
float: right;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer ul li {
|
|
||||||
float: left;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overview{
|
|
||||||
margin-bottom: 0px;
|
|
||||||
border: 0px;
|
|
||||||
|
|
||||||
.btn{
|
|
||||||
margin-top: -55px;
|
|
||||||
width: 80%;
|
|
||||||
margin-left:10%;
|
|
||||||
border: 0px;
|
|
||||||
}
|
}
|
||||||
|
small {
|
||||||
.dagschotel{
|
float: left;
|
||||||
float:left;
|
|
||||||
position: absolute;
|
|
||||||
}
|
}
|
||||||
|
ul {
|
||||||
.avatar{
|
float: right;
|
||||||
height: 150px;
|
list-style: none;
|
||||||
width: 150px;
|
li {
|
||||||
|
float: left;
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.center{
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.debug_dump{
|
.debug_dump{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-field{
|
|
||||||
margin-bottom: 15px;
|
|
||||||
text-align: bottom;
|
|
||||||
|
|
||||||
}
|
|
||||||
.nav-logo{
|
.nav-logo{
|
||||||
margin:10px;
|
margin:10px;
|
||||||
font-size:30px;
|
font-size:30px;
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
img {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.form_row_image img {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
21
app/assets/stylesheets/overview.css.scss
Normal file
21
app/assets/stylesheets/overview.css.scss
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
.overviewthumbnail {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
border: 0px;
|
||||||
|
|
||||||
|
.btn{
|
||||||
|
margin-top: -55px;
|
||||||
|
width: 80%;
|
||||||
|
margin-left:10%;
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dagschotel{
|
||||||
|
float:left;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar{
|
||||||
|
height: 150px;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,7 +62,7 @@ class OrdersController < ApplicationController
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
unless current_user.koelkast? || current_user == @user
|
unless current_user.koelkast? || current_user.admin? || current_user == @user
|
||||||
flash[:error] = "Please don't order stuff for other people"
|
flash[:error] = "Please don't order stuff for other people"
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,15 +31,30 @@ class UsersController < ApplicationController
|
||||||
redirect_to users_path
|
redirect_to users_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def dagschotel
|
def edit_dagschotel
|
||||||
user = User.find(params[:user_id])
|
@user = User.find(params[:user_id])
|
||||||
|
@dagschotel = @user.dagschotel
|
||||||
|
end
|
||||||
|
|
||||||
if user.update_attributes(dagschotel: Product.find(params[:product_id]))
|
def update_dagschotel
|
||||||
|
@user = User.find(params[:user_id])
|
||||||
|
@user.dagschotel = Product.find(params[:product_id])
|
||||||
|
|
||||||
|
if @user.save
|
||||||
flash[:success] = "Succesfully updated dagschotel"
|
flash[:success] = "Succesfully updated dagschotel"
|
||||||
|
redirect_to @user
|
||||||
else
|
else
|
||||||
flash[:error] = "Error updating dagschotel"
|
flash[:error] = "Error updating dagschotel"
|
||||||
|
@dagschotel = @user.reload.dagschotel
|
||||||
|
render 'edit_dagschotel'
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to edit_user_registration_path(user)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def init
|
||||||
|
@user = User.find(params[:user_id])
|
||||||
|
redirect_to root_path, error: "You are not authorized to access this page." unless @user == current_user || current_user.admin?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,8 @@ class Ability
|
||||||
elsif user[:id]
|
elsif user[:id]
|
||||||
can :read, :all
|
can :read, :all
|
||||||
can :update, User
|
can :update, User
|
||||||
can :dagschotel, User
|
can :edit_dagschotel, User
|
||||||
|
can :update_dagschotel, User
|
||||||
can :create, Order
|
can :create, Order
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,15 +13,3 @@
|
||||||
|
|
||||||
<%= f.submit "Update" %>
|
<%= f.submit "Update" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if current_user.dagschotel.present? %>
|
|
||||||
<h3>Current Dagschotel:</h3>
|
|
||||||
<div>
|
|
||||||
<%= image_tag current_user.dagschotel.avatar %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<h4>Choose new Dagschotel:</h4>
|
|
||||||
<% Product.all.each do |p| %>
|
|
||||||
<%= link_to image_tag(p.avatar), user_dagschotel_path(current_user, p) %>
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -12,12 +12,12 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<body>
|
<body>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render "layouts/header" %>
|
<%= render 'layouts/header' %>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="container" >
|
<div class="container">
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "layouts/footer" %>
|
<%= render 'layouts/footer' %>
|
||||||
<%= debug(params) if Rails.env.development? %>
|
<%= debug(params) if Rails.env.development? %>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="col-md-2 thumbnail overview">
|
<div class="col-md-2 overviewthumbnail">
|
||||||
<% unless user.dagschotel.nil? %>
|
<% unless user.dagschotel.nil? %>
|
||||||
<%= link_to user_quickpay_path(user) do %>
|
<%= link_to user_quickpay_path(user) do %>
|
||||||
<%= image_tag user.dagschotel.avatar(:dagschotel), class: "img-circle dagschotel" %>
|
<%= image_tag user.dagschotel.avatar(:dagschotel), class: "img-circle dagschotel" %>
|
||||||
|
|
11
app/views/users/edit_dagschotel.html.erb
Normal file
11
app/views/users/edit_dagschotel.html.erb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<% if current_user.dagschotel.present? %>
|
||||||
|
<h3>Current Dagschotel:</h3>
|
||||||
|
<div>
|
||||||
|
<%= render current_user.dagschotel %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<h4>Choose new Dagschotel:</h4>
|
||||||
|
<% Product.all.each do |p| %>
|
||||||
|
<%= link_to image_tag(p.avatar), user_dagschotel_path(current_user, p) %>
|
||||||
|
<% end %>
|
|
@ -1,7 +1,10 @@
|
||||||
<%= render partial: 'flash' %>
|
<%= render partial: 'flash' %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="user_info">
|
<div class="user_info">
|
||||||
<h5><%= link_to "[Edit profile]" , edit_user_registration_path if current_user == @user%></h5>
|
<h5>
|
||||||
|
<%= link_to "[Edit dagschotel]" , user_edit_dagschotel_path(@user) if current_user == @user %>
|
||||||
|
<%= link_to "[Edit profile]" , edit_user_registration_path if current_user == @user %>
|
||||||
|
</h5>
|
||||||
<h2><%= @user.nickname %> (<%= @user.full_name %>)</h2>
|
<h2><%= @user.nickname %> (<%= @user.full_name %>)</h2>
|
||||||
<%= button_to "PLACE ORDER!", new_user_order_path(@user), method: :get if current_user == @user %>
|
<%= button_to "PLACE ORDER!", new_user_order_path(@user), method: :get if current_user == @user %>
|
||||||
<div class="balance">BALANCE: <%= euro(@user.balance) %></div>
|
<div class="balance">BALANCE: <%= euro(@user.balance) %></div>
|
||||||
|
|
|
@ -17,8 +17,9 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :users do
|
resources :users do
|
||||||
resources :orders
|
resources :orders
|
||||||
get 'quickpay' => 'orders#quickpay'
|
get 'quickpay' => 'orders#quickpay'
|
||||||
get 'dagschotel/:product_id' => 'users#dagschotel', as: "dagschotel"
|
get 'dagschotel/edit' => 'users#edit_dagschotel', as: 'edit_dagschotel'
|
||||||
|
get 'dagschotel/:product_id' => 'users#update_dagschotel', as: 'dagschotel'
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :products do
|
resources :products do
|
||||||
|
|
6
db/migrate/20150319134138_add_columns_to_users.rb
Normal file
6
db/migrate/20150319134138_add_columns_to_users.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class AddColumnsToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :provider, :string
|
||||||
|
add_column :users, :uid, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150310150231) do
|
ActiveRecord::Schema.define(version: 20150319134138) do
|
||||||
|
|
||||||
create_table "order_items", force: :cascade do |t|
|
create_table "order_items", force: :cascade do |t|
|
||||||
t.integer "order_id"
|
t.integer "order_id"
|
||||||
|
@ -65,6 +65,8 @@ ActiveRecord::Schema.define(version: 20150310150231) do
|
||||||
t.datetime "avatar_updated_at"
|
t.datetime "avatar_updated_at"
|
||||||
t.integer "orders_count", default: 0
|
t.integer "orders_count", default: 0
|
||||||
t.boolean "koelkast", default: false
|
t.boolean "koelkast", default: false
|
||||||
|
t.string "provider"
|
||||||
|
t.string "uid"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["koelkast"], name: "index_users_on_koelkast"
|
add_index "users", ["koelkast"], name: "index_users_on_koelkast"
|
||||||
|
|
Loading…
Reference in a new issue