Refactor views
This commit is contained in:
parent
7cc16748bf
commit
ec2b516727
21 changed files with 35 additions and 64 deletions
|
@ -1,26 +1,26 @@
|
|||
#flash
|
||||
- if flash[:error]
|
||||
.alert.alert-danger.alert-dismissable
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", type: "button"} ×
|
||||
%strong Error!
|
||||
= flash[:error]
|
||||
- if flash[:success]
|
||||
.alert.alert-success.alert-dismissable
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", type: "button"} ×
|
||||
%strong Success!
|
||||
= raw flash[:success]
|
||||
- if flash[:notice]
|
||||
.alert.alert-info.alert-dismissable
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", type: "button"} ×
|
||||
%strong Notice!
|
||||
= flash[:notice]
|
||||
- if flash[:warning]
|
||||
.alert.alert-warning.alert-dismissable
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", type: "button"} ×
|
||||
%strong Warning!
|
||||
= flash[:warning]
|
||||
- if flash[:alert]
|
||||
.alert.alert-danger.alert-dismissable
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", type: "button"} ×
|
||||
%strong Error!
|
||||
= flash[:alert]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
%h2 Sign in
|
||||
= render partial: 'flash'
|
||||
= content_for :title, "Sign in"
|
||||
.sign-in
|
||||
= f_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
||||
= f_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
|
||||
= f.text_field :name
|
||||
= f.password_field :password
|
||||
- if devise_mapping.rememberable?
|
||||
= f.check_box :remember_me
|
||||
= f.submit "Sign in"
|
||||
= render "devise/shared/links"
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
- unless controller_name == 'sessions'
|
||||
= link_to "Log in", new_session_path(resource_name)
|
||||
%br/
|
||||
- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
|
||||
= link_to "Forgot your password?", new_password_path(resource_name)
|
||||
%br/
|
||||
- if devise_mapping.confirmable? && controller_name != 'confirmations'
|
||||
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
|
||||
%br/
|
||||
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
|
||||
= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
|
||||
%br/
|
||||
- if devise_mapping.omniauthable?
|
||||
- resource_class.omniauth_providers.each do |provider|
|
||||
= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), class: "btn btn-large btn-primary"
|
||||
%br/
|
|
@ -2,7 +2,7 @@
|
|||
.container-fluid
|
||||
/ Brand and toggle get grouped for better mobile display
|
||||
.navbar-header
|
||||
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
|
||||
%button.navbar-toggle{data: { target: ".navbar-collapse", toggle: "collapse" } }
|
||||
%span.icon-bar
|
||||
%span.icon-bar
|
||||
%span.icon-bar
|
||||
|
@ -11,11 +11,7 @@
|
|||
- unless current_user && current_user.koelkast?
|
||||
.collapse.navbar-collapse
|
||||
.hidden-xs.navbar-form.navbar-right
|
||||
.form-group
|
||||
- if user_signed_in?
|
||||
= link_to "Logout", destroy_user_session_path, class: "btn btn-default form-control"
|
||||
- else
|
||||
= link_to "Login", omniauth_authorize_path("user", "zeuswpi"), class: "btn btn-success form-control"
|
||||
= render 'layouts/session_button'
|
||||
%ul.nav.navbar-nav.navbar-right
|
||||
%li= mail_to "tab@zeus.ugent.be", "Send feedback"
|
||||
- if user_signed_in?
|
||||
|
@ -33,13 +29,9 @@
|
|||
Logged in as #{current_user.name}
|
||||
%b.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to "Edit avatar", edit_user_path(current_user)
|
||||
%li= link_to "Edit profile", edit_user_path(current_user)
|
||||
%li
|
||||
%p.navbar-text
|
||||
Debt: #{euro(current_user.debt)}
|
||||
Balance: #{euro_from_cents(current_user.debt)}
|
||||
.visible-xs.navbar-form
|
||||
.form-group
|
||||
- if user_signed_in?
|
||||
= button_to "Logout", destroy_user_session_path, class: "btn btn-default form-control", method: :delete
|
||||
- else
|
||||
= link_to "Login", omniauth_authorize_path("user", "zeuswpi"), class: "btn btn-success form-control"
|
||||
= render 'layouts/session_button'
|
||||
|
|
5
app/views/layouts/_session_button.html.haml
Normal file
5
app/views/layouts/_session_button.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
|||
.form-group
|
||||
- if user_signed_in?
|
||||
= link_to "Logout", destroy_user_session_path, class: "btn btn-default form-control"
|
||||
- else
|
||||
= link_to "Login", omniauth_authorize_path("user", "zeuswpi"), class: "btn btn-success form-control"
|
|
@ -9,6 +9,8 @@
|
|||
%body
|
||||
= render 'layouts/header'
|
||||
.container
|
||||
%h2= yield :title
|
||||
= render partial: 'flash'
|
||||
= yield
|
||||
= render 'layouts/footer'
|
||||
= debug(params) if Rails.env.development?
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.col-md-3.form_products
|
||||
%div{class: "thumbnail#{' out-of-stock' if product.stock.zero?}"}
|
||||
%div.thumbnail{ class: ('out-of-stock' if product.stock.zero?) }
|
||||
.form_row.center
|
||||
.form_row_image
|
||||
= image_tag product.avatar
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
%strong Total price
|
||||
.input-group
|
||||
%span.input-group-addon €
|
||||
= content_tag :span, "", id: "order_price", class: "input-group-addon"
|
||||
%span#order_price.input-group-addon
|
||||
%span.input-group-btn
|
||||
= f.submit "Order!", class: "btn btn-primary big-form-button", skip_wrapper: true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%h3
|
||||
Order for #{@user.name} (Huidige schuld: #{euro(@user.debt)})
|
||||
Order for #{@user.name}
|
||||
.row
|
||||
= f_form_for [@user, @order] do |f|
|
||||
= f.error_messages
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
= render partial: 'flash'
|
||||
.row
|
||||
- @users.each do |user|
|
||||
= render 'users/new_order', user: user
|
||||
= render @users
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
%h1 Update product
|
||||
= content_for :title, "Update product"
|
||||
= render "form"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
%h1 All products
|
||||
= render partial: 'flash'
|
||||
= content_for :title, "All products"
|
||||
= render 'products/index'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
%h1 New product
|
||||
= content_for :title, "New product"
|
||||
= render "form"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
%tr{:id => "products_row_#{dom_id(product)}"}
|
||||
%td= image_tag product.avatar(:small)
|
||||
%tr{id: "products_row_#{dom_id(product)}"}
|
||||
%td= link_to image_tag(product.avatar(:small)), edit_product_path(product)
|
||||
%td= product.name
|
||||
%td= euro(product.price)
|
||||
%td= product.stock
|
||||
%td
|
||||
%span{:class => "glyphicon #{product.deleted ? "glyphicon-check" : "glyphicon-unchecked"}"}
|
||||
%span{class: "glyphicon #{product.deleted ? "glyphicon-check" : "glyphicon-unchecked"}"}
|
||||
%td= product.calories
|
||||
%td= button_to "Edit", edit_product_path(product), method: :get, class: "btn btn-default", remote: true
|
||||
%td= link_to "Edit", edit_product_path(product), class: "btn btn-default", remote: true
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
= content_for :title, "Products"
|
||||
#products-errors
|
||||
.row.products
|
||||
.col-md-8.col-md-offset-2
|
||||
%h1 Products
|
||||
= render partial: 'flash'
|
||||
= link_to "Add Stock", new_stock_path, class: "btn btn-default"
|
||||
%table#products-table.table.table-striped
|
||||
%tr
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
= content_for :title, "Add stock"
|
||||
.row
|
||||
.col-md-6.col-md-offset-3
|
||||
%h2 Add stock
|
||||
= f_form_for @stock do |f|
|
||||
= render 'stocks/errors'
|
||||
= f.fields_for :stock_entries do |se_field|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
= render 'flash'
|
||||
.row
|
||||
= render 'sidebar'
|
||||
.col-sm-9
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
%h3
|
||||
Choose new Dagschotel
|
||||
= render 'products/index'
|
||||
= content_for :title, "Choose new Dagschotel"
|
||||
= render 'products/index'
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
= render partial: 'flash'
|
||||
.row
|
||||
= render 'sidebar'
|
||||
#user_info.col-sm-9
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
%h2 Login
|
||||
= render 'flash'
|
||||
= content_for :title, "Login"
|
||||
If this is the first time you log in, an account will be created for you.
|
||||
%div
|
||||
%br/
|
||||
= link_to "Sign in with Zeus WPI account.", omniauth_authorize_path("user", "zeuswpi"), class: "btn btn-large btn-primary"
|
||||
%br/
|
||||
|
|
Loading…
Reference in a new issue