Merge branch 'filter-datatables' of https://github.com/ZeusWPI/Tab into filter-datatables
This commit is contained in:
commit
bd5f444869
6 changed files with 14 additions and 3 deletions
3
Gemfile
3
Gemfile
|
@ -24,6 +24,9 @@ gem 'cancancan'
|
||||||
# Haml for templating!
|
# Haml for templating!
|
||||||
gem "haml-rails", "~> 0.9"
|
gem "haml-rails", "~> 0.9"
|
||||||
|
|
||||||
|
# Friendly ids!
|
||||||
|
gem 'friendly_id', '~> 5.1.0'
|
||||||
|
|
||||||
# Pure for css
|
# Pure for css
|
||||||
gem 'purecss-rails'
|
gem 'purecss-rails'
|
||||||
# Use datatables
|
# Use datatables
|
||||||
|
|
|
@ -107,6 +107,8 @@ GEM
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
faraday (0.9.1)
|
faraday (0.9.1)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
|
friendly_id (5.1.0)
|
||||||
|
activerecord (>= 4.0.0)
|
||||||
globalid (0.3.6)
|
globalid (0.3.6)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
haml (4.0.7)
|
haml (4.0.7)
|
||||||
|
@ -299,6 +301,7 @@ DEPENDENCIES
|
||||||
devise
|
devise
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
faker
|
faker
|
||||||
|
friendly_id (~> 5.1.0)
|
||||||
haml-rails (~> 0.9)
|
haml-rails (~> 0.9)
|
||||||
high_voltage (~> 2.4.0)
|
high_voltage (~> 2.4.0)
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
|
|
|
@ -4,7 +4,10 @@ class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
redirect_to root_url, alert: exception.message
|
respond_to do |format|
|
||||||
|
format.json { render nothing: true, status: :forbidden }
|
||||||
|
format.html { redirect_to root_url, alert: exception.message }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticate_user_or_client!
|
def authenticate_user_or_client!
|
||||||
|
|
|
@ -86,7 +86,7 @@ class DataTable
|
||||||
}
|
}
|
||||||
if type == 'number-range'
|
if type == 'number-range'
|
||||||
h[:lower], h[:upper] = value.split('~').map do |euros|
|
h[:lower], h[:upper] = value.split('~').map do |euros|
|
||||||
(euros.to_f * 100).to_i rescue nil
|
(Float(euros) * 100).to_i rescue nil
|
||||||
end
|
end
|
||||||
elsif type == 'date-range'
|
elsif type == 'date-range'
|
||||||
h[:lower], h[:upper] = value.split('~').map do |string|
|
h[:lower], h[:upper] = value.split('~').map do |string|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
|
include FriendlyId
|
||||||
|
friendly_id :name, use: :finders
|
||||||
devise :timeoutable, :omniauthable, :omniauth_providers => [:zeuswpi]
|
devise :timeoutable, :omniauthable, :omniauth_providers => [:zeuswpi]
|
||||||
has_many :incoming_transactions,
|
has_many :incoming_transactions,
|
||||||
class_name: 'Transaction', foreign_key: 'creditor_id'
|
class_name: 'Transaction', foreign_key: 'creditor_id'
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
{
|
{
|
||||||
targets: 1,
|
targets: 1,
|
||||||
render: function(data, type, full, meta) {
|
render: function(data, type, full, meta) {
|
||||||
return data/100;
|
return (data/100).toFixed(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue