Basic site flow improvements and devise handling
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// the compiled file.
|
||||
//
|
||||
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
||||
// GO AFTER THE REQUIRES BELOW.
|
||||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require jquery-ui
|
||||
//= require_directory .
|
||||
//= require_self
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#= require jquery
|
||||
#= require jquery_ujs
|
||||
#= require_directory .
|
||||
#= require_self
|
||||
$(document).on 'click', '.flash-box', -> $(@).slideUp()
|
||||
@@ -1,4 +1,5 @@
|
||||
//= require_self
|
||||
//= require_directory .
|
||||
@import ./foundation_and_overrides
|
||||
@import ./elements/*
|
||||
@import ./structure
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
ul.devise-nav
|
||||
+inline-list
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
.flash-box
|
||||
&.alert
|
||||
+alert($bg: $alert-color)
|
||||
&.notice
|
||||
+alert
|
||||
.close
|
||||
+alert-close
|
||||
@@ -0,0 +1,46 @@
|
||||
.form-row
|
||||
@extend .row
|
||||
.form-label
|
||||
@media #{$small-only}
|
||||
+grid-column($columns:10, $center:true)
|
||||
@media #{$medium-only}
|
||||
+grid-column($columns:4, $offset:1)
|
||||
@media #{$large-up}
|
||||
+grid-column(3)
|
||||
.form-field
|
||||
@media #{$small-only}
|
||||
+grid-column($columns:10, $center:true, $last-column:true)
|
||||
@media #{$medium-only}
|
||||
+grid-column($columns:4, $last-column:true)
|
||||
@media #{$large-up}
|
||||
+grid-column($columns: 3, $last-column:true)
|
||||
&.full
|
||||
@media #{$large-up}
|
||||
+grid-column($columns: 9, $last-column:true)
|
||||
&.form-actions
|
||||
padding-top: 12px
|
||||
|
||||
.form-errors
|
||||
$form-error-color: #822
|
||||
color: $form-error-color
|
||||
h3
|
||||
color: $form-error-color
|
||||
font-size: 1.2em
|
||||
body
|
||||
label
|
||||
&.number
|
||||
display: inline-block
|
||||
padding: 4px 10px
|
||||
input
|
||||
&.number
|
||||
width: 60px
|
||||
display: inline-block
|
||||
.apply-filter
|
||||
+button($bg: $primary-color, $padding: $button-tny)
|
||||
.error
|
||||
input, textarea
|
||||
border-color: $alert-color
|
||||
.new-session-button
|
||||
+button
|
||||
input[type="number"]
|
||||
text-align: right
|
||||
@@ -4,6 +4,10 @@ class ApplicationController < ActionController::Base
|
||||
before_action :force_reloads
|
||||
end
|
||||
layout :layout_by_resource
|
||||
#before_action do
|
||||
#flash.now[:notice] = "Test notice"
|
||||
#flash.now[:alert] = "Test alert"
|
||||
#end
|
||||
#protect_from_forgery
|
||||
|
||||
rescue_from SimplyStored::RecordNotFound, with: :show_404
|
||||
@@ -26,7 +30,7 @@ private
|
||||
I18n.locale = (params[:locale].presence || I18n.default_locale).to_sym
|
||||
end
|
||||
|
||||
def layout_by_resource
|
||||
def layout_by_resource(*args)
|
||||
#if devise_controller?
|
||||
#return 'obtain_token' if session[:user_return_to].present? # resource_name == :user ????
|
||||
#return 'theme1' if session[:supplier_return_to].present?
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class PagesController < ApplicationController
|
||||
class PagesController < ::ApplicationController
|
||||
include Cmtool::Includes::PagesController
|
||||
end
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
module DeviseHelper
|
||||
def devise_error_messages!
|
||||
if resource.errors.present?
|
||||
content_tag(:div, content_tag(:h2, t("errors.messages.not_saved.#{resource.errors.size == 1 ? 'one' : 'other'}", count: resource.errors.size)) +content_tag(:ul, resource.errors.full_messages.map{|m| content_tag(:li, m)}.join.html_safe), class: 'alert alert-error')
|
||||
content_tag(:div,
|
||||
content_tag(:h3, t("errors.messages.not_saved.#{resource.errors.size == 1 ? 'one' : 'other'}", count: resource.errors.size)) +
|
||||
content_tag(:ul, resource.errors.full_messages.map{|m| content_tag(:li, m)}.join.html_safe),
|
||||
class: 'form-errors'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,8 +39,9 @@ class Supplier
|
||||
view :by_email, key: :email
|
||||
|
||||
validates :name, presence: true
|
||||
validates :email, email: true
|
||||
validates :iens_profile, numericality: {allow_blank: true}
|
||||
validates :password, confirmation: true
|
||||
validates :password, confirmation: true, presence: {if: ->(r){ r.new_record? }}
|
||||
|
||||
def location=(val)
|
||||
lat, lng = val.is_a?(Array) ? val : val.strip.split(/[ ,]+/).map(&:to_f)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ul.nav.nav-pills
|
||||
ul.nav.nav-pills.devise-nav
|
||||
- if controller_name != 'sessions'
|
||||
li= link_to t('devise.sessions.button'), new_session_path(resource_name), class: [:devise, :btn]
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ html lang="en"
|
||||
/[if lt IE 9]
|
||||
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
|
||||
= stylesheet_link_tag "theme1/application", :media => "all"
|
||||
= javascript_include_tag 'theme1/application'
|
||||
link href="/favicon.ico" rel="shortcut icon"
|
||||
link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'
|
||||
|
||||
@@ -45,11 +46,11 @@ html lang="en"
|
||||
.main-inner
|
||||
.general-alerts
|
||||
- if flash[:alert].present?
|
||||
.alert-box.warning
|
||||
.flash-box.alert
|
||||
div= flash[:alert]
|
||||
a.close data-dismiss="alert" ×
|
||||
- if flash[:notice].present?
|
||||
.alert-box
|
||||
.flash-box.notice
|
||||
div= flash[:notice]
|
||||
a.close data-dismiss="alert" ×
|
||||
= yield :page_title
|
||||
@@ -58,5 +59,4 @@ html lang="en"
|
||||
.footer-shadow
|
||||
.container
|
||||
.footer-content= render 'footer'
|
||||
.footer-bottom © Qwaiter 2013
|
||||
= javascript_include_tag "application"
|
||||
.footer-bottom © Qwaiter 2014
|
||||
|
||||
@@ -40,13 +40,13 @@ html lang="en"
|
||||
.container
|
||||
.main-inner
|
||||
- if flash[:alert].present?
|
||||
.alert.alert-error
|
||||
a.close data-dismiss="alert" ×
|
||||
.flash-box.alert
|
||||
div= flash[:alert]
|
||||
- if flash[:notice].present?
|
||||
.alert.alert-success
|
||||
a.close data-dismiss="alert" ×
|
||||
- if flash[:notice].present?
|
||||
.flash-box.notice
|
||||
div= flash[:notice]
|
||||
a.close data-dismiss="alert" ×
|
||||
- if @page && @page.title.present?
|
||||
h1.page-title= @page.title
|
||||
= yield
|
||||
|
||||
@@ -2,11 +2,8 @@ h2= t('devise.confirmations.title')
|
||||
|
||||
= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), html: { method: :post, class: 'form-horizontal' }) do |f|
|
||||
= devise_error_messages!
|
||||
.control-group
|
||||
= f.label :email, class: 'control-label'
|
||||
.controls
|
||||
= f.email_field :email
|
||||
|
||||
.control-group
|
||||
.controls= f.submit t('devise.confirmations.submit_text'), class: 'btn-primary'
|
||||
= f.row :email do
|
||||
.form-label= f.label :email, class: 'control-label'
|
||||
.form-field= f.email_field :email
|
||||
.form-row.form-actions= f.submit t('devise.confirmations.submit_text'), class: 'button'
|
||||
= render "links"
|
||||
|
||||
@@ -2,13 +2,11 @@ h2= t('devise.passwords.edit.title')
|
||||
= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal', method: :put}) do |f|
|
||||
= devise_error_messages!
|
||||
= f.hidden_field :reset_password_token
|
||||
.control-group
|
||||
= f.label :password, class: 'control-label'
|
||||
.controls= f.password_field :password
|
||||
.control-group
|
||||
= f.label :password_confirmation, class: 'control-label'
|
||||
.controls= f.password_field :password_confirmation
|
||||
.control-group
|
||||
.controls
|
||||
= f.submit t('devise.passwords.edit.button'), class: 'btn btn-primary'
|
||||
.form-row
|
||||
.form-label= f.label :password
|
||||
.form-field= f.password_field :password
|
||||
= f.row :password_confirmation do
|
||||
.form-label= f.label :password_confirmation
|
||||
.form-field= f.password_field :password_confirmation
|
||||
.form-row= f.submit t('devise.passwords.edit.button'), class: 'button'
|
||||
= render "links"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
h2= t('devise.passwords.title')
|
||||
= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal'}) do |f|
|
||||
= devise_error_messages!
|
||||
.control-group
|
||||
= f.label :email, class: 'control-label'
|
||||
.controls= f.email_field :email
|
||||
.control-group
|
||||
.controls
|
||||
= f.submit t('devise.passwords.button'), class: 'btn btn-primary'
|
||||
= f.row :email do
|
||||
.form-label= f.label :email, class: 'control-label'
|
||||
.form-field= f.email_field :email
|
||||
.form-row.form-actions= f.submit t('devise.passwords.button'), class: 'button'
|
||||
= render "links"
|
||||
|
||||
@@ -6,18 +6,17 @@ p
|
||||
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: 'form-horizontal'}) do |f|
|
||||
= devise_error_messages!
|
||||
.control-group
|
||||
= f.label :name, class: 'control-label'
|
||||
.controls= f.text_field :name
|
||||
.control-group
|
||||
= f.label :email, class: 'control-label'
|
||||
.controls= f.email_field :email
|
||||
.control-group
|
||||
= f.label :password, class: 'control-label'
|
||||
.controls= f.password_field :password
|
||||
.control-group
|
||||
= f.label :password_confirmation, class: 'control-label'
|
||||
.controls= f.password_field :password_confirmation
|
||||
.control-group
|
||||
.controls
|
||||
= f.submit t('devise.registrations.button'), class: 'btn btn-primary'
|
||||
= f.row :name do
|
||||
.form-label= f.label :name, class: 'control-label'
|
||||
.form-field= f.text_field :name
|
||||
= f.row :email do
|
||||
.form-label= f.label :email, class: 'control-label'
|
||||
.form-field= f.email_field :email
|
||||
= f.row :password do
|
||||
.form-label= f.label :password, class: 'control-label'
|
||||
.form-field= f.password_field :password
|
||||
= f.row :password_confirmation do
|
||||
.form-label= f.label :password_confirmation, class: 'control-label'
|
||||
.form-field= f.password_field :password_confirmation
|
||||
.form-row.form-actions= f.submit t('devise.registrations.button'), class: 'button'
|
||||
= render "links"
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
h2= t('devise.sessions.title')
|
||||
= form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-horizontal'}) do |f|
|
||||
= devise_error_messages!
|
||||
.control-group
|
||||
= f.label :email, class: 'control-label'
|
||||
.controls= f.email_field :email
|
||||
.control-group
|
||||
= f.label :password, class: 'control-label'
|
||||
.controls= f.password_field :password
|
||||
.control-group
|
||||
.controls
|
||||
= f.label :remember_me do
|
||||
= f.check_box :remember_me
|
||||
|
|
||||
= t('devise.sessions.remember_me')
|
||||
.control-group
|
||||
.controls
|
||||
= f.submit t('devise.sessions.button'), class: 'btn btn-primary'
|
||||
= f.row :email do
|
||||
.form-label= f.label :email
|
||||
.form-field= f.email_field :email
|
||||
.form-row
|
||||
= f.label :remember_me do
|
||||
= f.check_box :remember_me
|
||||
|
|
||||
= t('devise.sessions.remember_me')
|
||||
.form-row
|
||||
= f.submit t('devise.sessions.button'), class: 'new-session-button'
|
||||
= render "links"
|
||||
|
||||
@@ -11,5 +11,13 @@ class CustomFormBuilder < ActionView::Helpers::FormBuilder
|
||||
)
|
||||
t.content_tag(:div, elements.inject(&:+), class: 'form-actions')
|
||||
end
|
||||
def row(attribute, options={}, &block)
|
||||
t = @template
|
||||
classes = []
|
||||
classes << 'form-row'
|
||||
classes << attribute
|
||||
classes << 'error' if object.errors[attribute].present?
|
||||
t.content_tag(:div, t.capture(&block), class: classes)
|
||||
end
|
||||
end
|
||||
ActionView::Base.default_form_builder = CustomFormBuilder
|
||||
|
||||
@@ -29,7 +29,7 @@ nl:
|
||||
inactive: 'Your account was not activated yet.'
|
||||
not_found_in_database: "Je bent nog niet bij ons bekend. Meld je aan om Qwaiter te kunnen gebruiken!"
|
||||
sessions:
|
||||
title: Inloggen
|
||||
title: Inloggen voor horeca
|
||||
button: Inloggen
|
||||
signed_in: Succesvol ingelogd
|
||||
signed_out: Succesvol uitgelogd
|
||||
@@ -44,13 +44,14 @@ nl:
|
||||
send_instructions: 'U ontvangt binnen enkele minuten een e-mail met instructies voor het resetten van uw wachtwoord'
|
||||
updated: 'Uw wachtwoord is succesvol gewijzigd. U bent nu ingelogd.'
|
||||
forgot_password: Wachtwoord vergeten?
|
||||
no_token: Geen token gegeven
|
||||
send_instructions_button: Stuur mij reset instructies
|
||||
edit:
|
||||
title: Verander je wachtwoord
|
||||
button: Verander wachtwoord
|
||||
registrations:
|
||||
title: Aanmelden
|
||||
button: Aanmelden
|
||||
title: Nieuwe aanmelding als horeca
|
||||
button: Nieuwe aanmelding als horeca
|
||||
signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
|
||||
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
|
||||
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
|
||||
|
||||
Reference in New Issue
Block a user