Skip to content

Commit

Permalink
Merge 26d22fa into f562de1
Browse files Browse the repository at this point in the history
  • Loading branch information
hellcp committed Dec 9, 2022
2 parents f562de1 + 26d22fa commit cdb2119
Show file tree
Hide file tree
Showing 61 changed files with 333 additions and 301 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'rails', '>= 5.0.0.rc2', '< 5.0.99'
gem 'rails', '>= 5.1.0', '< 5.1.99'
gem 'rails-i18n'
gem 'responders'

Expand Down Expand Up @@ -36,6 +36,8 @@ group :doc do
gem 'sdoc', require: false
end

gem 'listen'

# Debugger
gem 'byebug', group: [:development, :test]

Expand Down
147 changes: 78 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.3)
actioncable (5.0.7.2)
actionpack (= 5.0.7.2)
nio4r (>= 1.2, < 3.0)
actioncable (5.1.7)
actionpack (= 5.1.7)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
actionmailer (5.1.7)
actionpack (= 5.1.7)
actionview (= 5.1.7)
activejob (= 5.1.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.7.2)
actionview (= 5.0.7.2)
activesupport (= 5.0.7.2)
actionpack (5.1.7)
actionview (= 5.1.7)
activesupport (= 5.1.7)
rack (~> 2.0)
rack-test (~> 0.6.3)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7.2)
activesupport (= 5.0.7.2)
actionview (5.1.7)
activesupport (= 5.1.7)
builder (~> 3.1)
erubis (~> 2.7.0)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_hash (3.1.1)
activesupport (>= 5.0.0)
activejob (5.0.7.2)
activesupport (= 5.0.7.2)
activejob (5.1.7)
activesupport (= 5.1.7)
globalid (>= 0.3.6)
activemodel (5.0.7.2)
activesupport (= 5.0.7.2)
activerecord (5.0.7.2)
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activesupport (5.0.7.2)
activemodel (5.1.7)
activesupport (= 5.1.7)
activerecord (5.1.7)
activemodel (= 5.1.7)
activesupport (= 5.1.7)
arel (~> 8.0)
activesupport (5.1.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
afm (0.2.2)
arel (7.1.4)
arel (8.0.0)
ast (2.4.2)
autoprefixer-rails (10.4.7.0)
execjs (~> 2)
Expand Down Expand Up @@ -92,7 +92,7 @@ GEM
caxlsx_rails (0.6.3)
actionpack (>= 3.1)
caxlsx (>= 3.0)
clockwork (3.0.0)
clockwork (3.0.1)
activesupport
tzinfo
cocoon (1.2.15)
Expand All @@ -116,6 +116,7 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.1)
date_validator (0.12.0)
activemodel (>= 3)
activesupport (>= 3)
Expand All @@ -134,7 +135,7 @@ GEM
devise (>= 2.2)
diff-lcs (1.5.0)
docile (1.4.0)
erubis (2.7.0)
erubi (1.11.0)
exception_notification (4.4.3)
actionmailer (>= 4.0, < 7)
activesupport (>= 4.0, < 7)
Expand All @@ -145,24 +146,19 @@ GEM
rchardet (~> 1.8)
globalid (1.0.0)
activesupport (>= 5.0)
haml (5.2.2)
temple (>= 0.8.0)
haml (6.0.12)
temple (>= 0.8.2)
thor
tilt
haml-rails (1.0.0)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
haml-rails (2.1.0)
actionpack (>= 5.1)
activesupport (>= 5.1)
haml (>= 4.0.6)
railties (>= 5.1)
has_scope (0.7.2)
actionpack (>= 4.1)
activesupport (>= 4.1)
hashery (2.1.2)
html2haml (2.3.0)
erubis (~> 2.7.0)
haml (>= 4.0)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
htmlentities (4.3.4)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -201,12 +197,17 @@ GEM
letter_opener (~> 1.0)
railties (>= 3.2)
libv8-node (16.10.0.0)
libv8-node (16.10.0.0-x86_64-linux)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.19.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mail (2.8.0)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
Expand All @@ -216,12 +217,19 @@ GEM
mini_racer (0.6.3)
libv8-node (~> 16.10.0.0)
minitest (5.16.3)
net-imap (0.3.2)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.10-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.22.1)
parser (2.7.2.0)
Expand All @@ -248,19 +256,19 @@ GEM
nio4r (~> 2.0)
racc (1.6.1)
rack (2.2.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.7.2)
actioncable (= 5.0.7.2)
actionmailer (= 5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
activemodel (= 5.0.7.2)
activerecord (= 5.0.7.2)
activesupport (= 5.0.7.2)
rack-test (2.0.2)
rack (>= 1.3)
rails (5.1.7)
actioncable (= 5.1.7)
actionmailer (= 5.1.7)
actionpack (= 5.1.7)
actionview (= 5.1.7)
activejob (= 5.1.7)
activemodel (= 5.1.7)
activerecord (= 5.1.7)
activesupport (= 5.1.7)
bundler (>= 1.3.0)
railties (= 5.0.7.2)
railties (= 5.1.7)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
Expand All @@ -270,9 +278,9 @@ GEM
rails-i18n (5.1.3)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (5.0.7.2)
actionpack (= 5.0.7.2)
activesupport (= 5.0.7.2)
railties (5.1.7)
actionpack (= 5.1.7)
activesupport (= 5.1.7)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
Expand All @@ -285,10 +293,13 @@ GEM
activesupport (>= 5.0)
i18n
polyamorous (= 2.3.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rchardet (1.8.0)
rdoc (6.3.3)
redcarpet (3.5.1)
regexp_parser (2.6.0)
regexp_parser (2.6.1)
request_store (1.5.1)
rack (>= 1.4)
responders (3.0.1)
Expand Down Expand Up @@ -325,8 +336,6 @@ GEM
ruby-rc4 (0.1.5)
ruby-vips (2.1.4)
ffi (~> 1.12)
ruby_parser (3.19.1)
sexp_processor (~> 4.16)
rubyzip (2.3.2)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
Expand All @@ -344,7 +353,6 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sexp_processor (4.16.1)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
show_for (0.7.0)
Expand All @@ -370,12 +378,12 @@ GEM
sqlite3 (1.3.13)
ssrf_filter (1.1.1)
state_machines (0.5.0)
state_machines-activemodel (0.7.1)
activemodel (>= 4.1)
state_machines-activemodel (0.8.0)
activemodel (>= 5.1)
state_machines (>= 0.5.0)
state_machines-activerecord (0.6.0)
activerecord (>= 4.1)
state_machines-activemodel (>= 0.5.0)
state_machines-activerecord (0.8.0)
activerecord (>= 5.1)
state_machines-activemodel (>= 0.8.0)
state_machines-graphviz (0.0.2)
ruby-graphviz
state_machines
Expand All @@ -386,6 +394,7 @@ GEM
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.11)
timeout (0.3.1)
ttfunk (1.0.3)
tzinfo (1.2.10)
thread_safe (~> 0.1)
Expand All @@ -409,7 +418,6 @@ GEM

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
active_hash
Expand Down Expand Up @@ -439,13 +447,14 @@ DEPENDENCIES
jquery-ui-rails
kaminari
letter_opener_web
listen
mini_racer
pdf-reader
prawn (~> 0.13.0)
prawn_rails
psych (< 4.0)
puma
rails (>= 5.0.0.rc2, < 5.0.99)
rails (>= 5.1.0, < 5.1.99)
rails-i18n
ransack
redcarpet
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base
before_action :authenticate_and_audit_user, unless: :devise_controller?
load_and_authorize_resource unless: :devise_controller?
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :mailer_set_url_for_test, if: 'devise_controller? && Rails.env.test?'
before_action :mailer_set_url_for_test, if: -> { devise_controller? && Rails.env.test? }
before_action :set_breadcrumbs

protect_from_forgery prepend: true
Expand Down
8 changes: 4 additions & 4 deletions app/models/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ class BankAccount < ApplicationRecord
belongs_to :reimbursement, inverse_of: :bank_account

validates :reimbursement, presence: true
validates :holder, presence: true, unless: 'reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled?'
validates :bank_name, presence: true, unless: 'reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled?'
validates :holder, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? }
validates :bank_name, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? }
validates :format, presence: true, inclusion: { in: %w[iban national] }
validates :iban, :bic, presence: true, unless: 'reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || !iban?'
validates :national_account_code, :country_code, presence: true, unless: 'reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || iban?'
validates :iban, :bic, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || !iban? }
validates :national_account_code, :country_code, presence: true, unless: -> { reimbursement.nil? || reimbursement.incomplete? || reimbursement.canceled? || iban? }

after_initialize :set_default_attrs, if: :new_record?

Expand Down
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Event < ApplicationRecord
# Event Organizers for the event
has_many :event_organizers
# Budget to use as a limit for approved amounts
belongs_to :budget
belongs_to :budget, optional: true

validates :name, :start_date, :end_date, :country_code, presence: true
validates :end_date, date: { after_or_equal_to: :start_date }
Expand Down
4 changes: 2 additions & 2 deletions app/models/reimbursement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class Reimbursement < ApplicationRecord

validates :request, presence: true
validates_associated :expenses, :attachments, :links, :bank_account
validates :acceptance_file, presence: true, if: 'acceptance_file_required?'
validate :user_profile_is_complete, if: 'complete_profile_required?'
validates :acceptance_file, presence: true, if: -> { acceptance_file_required? }
validate :user_profile_is_complete, if: -> { complete_profile_required? }

mount_uploader :acceptance_file, AttachmentUploader

Expand Down
8 changes: 4 additions & 4 deletions app/models/request_expense.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class RequestExpense < ApplicationRecord
delegate :event, to: :request, prefix: false

validates :request, :subject, presence: true
validates :estimated_amount, :estimated_currency, presence: true, if: 'request && request.submitted?'
validates :approved_amount, :approved_currency, presence: true, if: 'request && request.approved?'
validates :total_amount, presence: true, if: 'request && request.reimbursement && request.reimbursement.submitted?'
validates :authorized_amount, presence: true, if: 'request && request.reimbursement && request.reimbursement.submitted?'
validates :estimated_amount, :estimated_currency, presence: true, if: -> { request && request.submitted? }
validates :approved_amount, :approved_currency, presence: true, if: -> { request && request.approved? }
validates :total_amount, presence: true, if: -> { request && request.reimbursement && request.reimbursement.submitted? }
validates :authorized_amount, presence: true, if: -> { request && request.reimbursement && request.reimbursement.submitted? }

before_validation :set_authorized_amount

Expand Down
4 changes: 2 additions & 2 deletions app/models/state_change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def machine_type=(class_name)
protected

def prevent_update
false
throw(:abort)
end

def update_machine_state
# Prevent saving if the method have not been redefined in the subclass
false
throw(:abort)
end

def notify_state
Expand Down

0 comments on commit cdb2119

Please sign in to comment.