work off today
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
//= link_tree ../images
|
||||
//
|
||||
//= link theme1/application.js
|
||||
//= link theme1/application.css
|
||||
//
|
||||
//= link cmtool/application.js
|
||||
//= link cmtool/application.css
|
||||
//
|
||||
//= link supplier/foundation1/application.js
|
||||
//= link supplier/foundation1/application.css
|
||||
@@ -1,7 +1,7 @@
|
||||
//= require modernizr
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require jquery-ui/sortable
|
||||
//= require jquery-ui/widgets/sortable
|
||||
// require ./im
|
||||
// require foundation FOUNDATION 5 JAVASCRIPT IMPLEMENTATIONS AND EMBER ARE NOT COMPATIBLE, FOUNDATION IS TOO SIMPLISTIC AT THE MOMENT AND DESTROYS DOM EVENTS
|
||||
//= require js-routes
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// spin-rotate is currently used when clicked on a section-element in a section view
|
||||
.spin-rotate
|
||||
+animation(spinRotate 2s)
|
||||
+keyframes(spinRotate)
|
||||
//animation(spinRotate 2s)
|
||||
animation-name: spinRotate
|
||||
animation-duration: 2s
|
||||
@keyframes spinRotate
|
||||
from
|
||||
transform: rotate(0deg)
|
||||
to
|
||||
|
||||
@@ -9,17 +9,19 @@
|
||||
font-weight: bold
|
||||
font-size: 1.4
|
||||
z-index: 8976
|
||||
+animation(flashMessageInactive 0.5s)
|
||||
animation-name: flashMessageInactive
|
||||
animation-duration: 0.5s
|
||||
&.active
|
||||
+animation(flashMessageActive 0.5s)
|
||||
animation-name: flashMessageActive
|
||||
animation-duration: 0.5s
|
||||
right: 20px
|
||||
|
||||
+keyframes(flashMessageActive)
|
||||
@keyframes flashMessageActive
|
||||
from
|
||||
right: -440px
|
||||
to
|
||||
right: 20px
|
||||
+keyframes(flashMessageInactive)
|
||||
@keyframes flashMessageInactive
|
||||
from
|
||||
right: 20px
|
||||
to
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
module Admin
|
||||
class ApplicationController < ::ApplicationController
|
||||
before_action :setup_administrator!
|
||||
load_and_authorize_resource
|
||||
#load_and_authorize_resource
|
||||
layout 'cmtool/application'
|
||||
|
||||
private
|
||||
|
||||
def setup_administrator!
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
module Admin
|
||||
class EmployeesController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
skip_before_filter :setup_administrator!, only: :test_login
|
||||
skip_authorize_resource only: :test_login
|
||||
skip_before_filter :set_locale, only: :test_login
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
skip_before_action :setup_administrator!, only: :test_login
|
||||
skip_before_action :set_locale, only: :test_login
|
||||
# GET /employees
|
||||
# GET /employees.json
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
module Admin
|
||||
module Admin
|
||||
class ListsController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
# GET /lists
|
||||
# GET /lists.json
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
module Admin
|
||||
module Admin
|
||||
class OrdersController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
# GET /orders
|
||||
# GET /orders.json
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
module Admin
|
||||
class ProductCategoriesController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
# GET /product_categories
|
||||
# GET /product_categories.json
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
module Admin
|
||||
class ProductsController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
# GET /products
|
||||
# GET /products.json
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
module Admin
|
||||
class SectionsController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
# GET /sections
|
||||
# GET /sections.json
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module Admin
|
||||
class SuppliersController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
skip_before_filter :authenticate_administrator!, only: :test_login
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
skip_before_action :setup_administrator!, only: :test_login
|
||||
# GET /suppliers
|
||||
# GET /suppliers.json
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
module Admin
|
||||
module Admin
|
||||
class TablesController < Admin::ApplicationController
|
||||
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
before_action :set_relation_options, only: [:new, :edit, :create, :update]
|
||||
# GET /tables
|
||||
# GET /tables.json
|
||||
def index
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
module Admin
|
||||
class UsersController < Admin::ApplicationController
|
||||
skip_before_filter :setup_administrator!, only: :test_login
|
||||
skip_authorize_resource only: :test_login
|
||||
skip_before_filter :set_locale, only: :test_login
|
||||
skip_before_action :setup_administrator!, only: :test_login
|
||||
skip_before_action :set_locale, only: :test_login
|
||||
# GET /users
|
||||
# GET /users.json
|
||||
def index
|
||||
|
||||
@@ -16,10 +16,10 @@ class ApplicationController < ActionController::Base
|
||||
private
|
||||
|
||||
def allow_all_origins
|
||||
headers['Access-Control-Allow-Origin'] = '*'
|
||||
headers['Access-Control-Allow-Origin'] = '*'
|
||||
headers['Access-Control-Request-Method'] = '*'
|
||||
headers['Access-Control-Allow-Headers'] = '*'
|
||||
headers['Access-Control-Allow-Methods'] = '*'
|
||||
headers['Access-Control-Allow-Headers'] = '*'
|
||||
headers['Access-Control-Allow-Methods'] = '*'
|
||||
end
|
||||
|
||||
#START CMTOOL
|
||||
@@ -89,9 +89,9 @@ private
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
case resource
|
||||
when Employee then supplier_root_path
|
||||
when Administrator then cmtool.root_path
|
||||
else root_path
|
||||
when Employee then supplier_root_path
|
||||
when Administrator then cmtool.root_path
|
||||
else root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
module Suppliers
|
||||
class ApplicationController < ::ApplicationController
|
||||
before_action :setup_employee_and_supplier!
|
||||
load_and_authorize_resource
|
||||
#load_and_authorize_resource
|
||||
if Rails.env.development?
|
||||
skip_before_action :setup_employee_and_supplier!, only: :employee_and_supplier
|
||||
end
|
||||
attr_reader :current_supplier
|
||||
helper_method :current_supplier
|
||||
layout 'supplier/app'
|
||||
@@ -16,6 +19,16 @@ module Suppliers
|
||||
end
|
||||
end
|
||||
|
||||
# GET
|
||||
def employee_and_supplier
|
||||
employee = current_employee || Employee.find_by_email('bterkuile@gmail.com')
|
||||
supplier = current_supplier || employee.suppliers.first
|
||||
render json: {
|
||||
employee: JSONAPI::Serializer.serialize(employee, serializer: Suppliers::EmployeeSerializer),
|
||||
supplier: JSONAPI::Serializer.serialize(supplier, serializer: Suppliers::SupplierSerializer)
|
||||
}
|
||||
end
|
||||
|
||||
def setup_employee_and_supplier!
|
||||
authenticate_employee!
|
||||
find_current_supplier!
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Suppliers::SessionsController < Devise::SessionsController
|
||||
respond_to :json
|
||||
|
||||
def destroy
|
||||
session[:supplier_id] = nil
|
||||
|
||||
+35
-1
@@ -23,9 +23,11 @@ class Employee
|
||||
property :unconfirmed_email
|
||||
|
||||
property :name
|
||||
property :authentication_token
|
||||
#property :email
|
||||
|
||||
has_many :employee_shifts, dependent: :destroy
|
||||
view :by_authentication_token, key: :authentication_token
|
||||
view :by_email, key: :email
|
||||
|
||||
class << self
|
||||
@@ -57,9 +59,41 @@ class Employee
|
||||
#settings.persist!
|
||||
#orig_save(*args)
|
||||
#end
|
||||
before_save { settings.persist! }
|
||||
before_save do
|
||||
ensure_authentication_token
|
||||
settings.persist!
|
||||
end
|
||||
|
||||
def settings
|
||||
@settings || SupplierEmployeesSettings.new(Supplier.new).for_employee(self)
|
||||
end
|
||||
|
||||
#####################################
|
||||
# Taken from devise 2.2
|
||||
#####################################
|
||||
|
||||
# Generate new authentication token (a.k.a. "single access token").
|
||||
def reset_authentication_token
|
||||
self.authentication_token = self.class.authentication_token
|
||||
end
|
||||
|
||||
# Generate new authentication token and save the record.
|
||||
def reset_authentication_token!
|
||||
reset_authentication_token
|
||||
save(:validate => false)
|
||||
end
|
||||
|
||||
# Generate authentication token unless already exists.
|
||||
def ensure_authentication_token
|
||||
reset_authentication_token if authentication_token.blank?
|
||||
end
|
||||
|
||||
# Generate authentication token unless already exists and save the record.
|
||||
def ensure_authentication_token!
|
||||
reset_authentication_token! if authentication_token.blank?
|
||||
end
|
||||
|
||||
def self.authentication_token
|
||||
SecureRandom.hex(24)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,8 +8,8 @@ class NewSupplier
|
||||
attribute :password
|
||||
attribute :password_confirmation
|
||||
|
||||
without_current_employee = { unless: 'current_employee.present?' }
|
||||
without_employee = { unless: 'employee.present?' }
|
||||
without_current_employee = { unless: -> { current_employee.present? } }
|
||||
without_employee = { unless: -> { employee.present? } }
|
||||
validates :supplier_name, presence: true
|
||||
validates :email, email: without_current_employee
|
||||
validates :password, presence: without_current_employee, confirmation: without_employee
|
||||
|
||||
Reference in New Issue
Block a user