repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Humblemonk/DiceMaiden | https://github.com/Humblemonk/DiceMaiden/blob/e2ae45c4669cb621fbf1a7af25c515d4d9445cb9/src/godbound_logic.rb | src/godbound_logic.rb | # frozen_string_literal: true
# godbound roll logic
def godbound_damage_total(results)
results.reduce(0) do |sum, n|
sum + godbound_damage_conversion(n)
end
end
def godbound_damage_conversion(raw_number)
case [raw_number, 10].min
when 10
4
when 6..9
2
when 2..5
1
when 1
0
end
end
| ruby | Apache-2.0 | e2ae45c4669cb621fbf1a7af25c515d4d9445cb9 | 2026-01-04T17:41:21.204678Z | false |
Humblemonk/DiceMaiden | https://github.com/Humblemonk/DiceMaiden/blob/e2ae45c4669cb621fbf1a7af25c515d4d9445cb9/src/earthdawn_logic.rb | src/earthdawn_logic.rb | # Given how specific earthdawn logic is, the logic to convert the request to something parsable by dice-maiden is done here
@earthdawn_replacements = Array[
'',
'1d4 ie - 2', # Step 1
'1d4 ie - 1', # Step 2
'1d4 ie', # Step 3... | ruby | Apache-2.0 | e2ae45c4669cb621fbf1a7af25c515d4d9445cb9 | 2026-01-04T17:41:21.204678Z | false |
Humblemonk/DiceMaiden | https://github.com/Humblemonk/DiceMaiden/blob/e2ae45c4669cb621fbf1a7af25c515d4d9445cb9/test/dice_maiden_test.rb | test/dice_maiden_test.rb | #!/usr/bin/ruby
# frozen_string_literal: true
# test various dice maiden commands
# Test single die rolls
[
'd5 + d6',
'1d6 + 2d8 d1',
'1d6 + 2d8 d1',
'd6',
'd5 + 2d6',
'1d5 + d6',
'd5 + d6 d1',
'd20 d1'
].each do |s|
print "#{s.ljust(16, ' ')}=> "
print s.gsub(/(?<!\d)(^|[+-]\s?)d(\d+)/, '\11d\2... | ruby | Apache-2.0 | e2ae45c4669cb621fbf1a7af25c515d4d9445cb9 | 2026-01-04T17:41:21.204678Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/.watchr.rb | .watchr.rb | def run_spec(file)
unless File.exist?(file)
puts "#{file} does not exist"
return
end
puts "Running #{file}"
system "bundle exec rspec #{file}"
puts
end
watch("spec/.*/*_spec\.rb") do |match|
run_spec match[0]
end
watch("app/(.*/.*)\.rb") do |match|
run_spec %{spec/#{match[1]}_spec.rb}
end
watc... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/update_default_password.rb | app/services/update_default_password.rb | class UpdateDefaultPassword < BaseForm
attribute :password, String
attribute :password_confirmation, String
attribute :user, User
validates_length_of :password, minimum: PASSWORD_LENGTH, maximum: 32
validate :valid_password_confimation
validates_presence_of :user
def update_password
return false un... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/conciliate_account.rb | app/services/conciliate_account.rb | # author: Boris Barroso
# email: boriscyber@gmail.com
class ConciliateAccount
attr_reader :account_ledger
delegate :account, :account_to, :amount, :amount_currency,
:approver_id, :nuller_id, :is_nulled?, to: :account_ledger
def initialize(ledger)
raise 'an AccountLedger instance was expected' unl... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/controller_service_serializer.rb | app/services/controller_service_serializer.rb | class ControllerServiceSerializer < Struct.new(:model)
def to_json(methods: [], only: [], except: [])
opts = {}
opts[:methods] = (Array(methods) + [:errors, :to_s]).uniq
opts[:only] = only if Array(only).any?
opts[:except] = except if Array(except).any?
opts[:methods].push(:destroyed?) if mod... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/transference.rb | app/services/transference.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class Transference < BaseForm
attr_reader :ledger
# Attributes
attribute :account_id, Integer
attribute :account_to_id, Integer
attribute :date, Date
attribute :amount, Decimal, default: 0
attribute :exchange_rate, Decimal, default: ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/devolution.rb | app/services/devolution.rb | # encoding: utf-8
# Base class used to make devolutions for Income and Expense models
class Devolution < BaseForm
attr_reader :ledger
# Attributes
attribute :account_id, Integer
attribute :account_to_id, Integer
attribute :date, Date
attribute :amount, Decimal, default: 0
attribute :exchange_rate, Decima... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/quick_form.rb | app/services/quick_form.rb | # encoding: utf-8
# Generates a quick income with all data
class QuickForm < BaseForm
attr_reader :account_ledger, :transaction
attribute :ref_number , String
attribute :account_to_id , Integer
attribute :contact_id , Integer
attribute :date , Date
attribute :amount , Decimal
attri... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/contact_balance_status.rb | app/services/contact_balance_status.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ContactBalanceStatus < Struct.new(:transactions)
attr_reader :h
delegate :currency, to: OrganisationSession
# Creates a hash with the balance by currency
def create_balances
@h = { 'TOTAL' => calculate_total }
return @h if tr... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/tenant_creator.rb | app/services/tenant_creator.rb | # encoding: utf-8
class TenantCreator
include PgTools
########################################
# Attributes
attr_reader :tenant, :organisation
########################################
# Methods
def initialize(organisation)
@organisation = organisation
raise ArgumentError, 'Please select an orga... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/number_to_words_es.rb | app/services/number_to_words_es.rb | # Creates number to works in spanish
# This class has bee modified from an original class
class NumberToWordsEs
attr_reader :number
def initialize(number)
@number = number.to_i
rescue
@number = 0
end
def to_words
num = number
if num == 0
words << zero_string
else
num = num.t... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/registration.rb | app/services/registration.rb | # encoding: utf-8
class Registration < BaseForm
attr_reader :organisation, :user
attribute :name , String
attribute :email , String
attribute :password , String
validates :name, presence: true, length: {within: 2..100}
validates :password, presence: true, length: {within: PASSWORD_LENGTH..100}
v... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/base_form.rb | app/services/base_form.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class BaseForm
include Virtus.model
#include ActiveModel::Model
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::Validations
VALID_BOOLEAN = [true, 1, false, 0, "true", "1", "false", "0"]
attr_reader :... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/movement_params.rb | app/services/movement_params.rb | # encoding: utf-8
class MovementParams
attr_reader :params
def quick
[:account_to_id, :contact_id, :amount, :date, :reference]
end
def quick_income
quick
end
def income
default + [income_details_attributes: details]
end
def expense
default + [expense_details_attributes: details]
en... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/reset_password_email.rb | app/services/reset_password_email.rb | # encoding: utf-8
class ResetPasswordEmail < BaseForm
attribute :email, String
validate :valid_email_present?
attr_reader :tenant
def reset_password
return false unless valid?
user.reset_password_token = SecureRandom.urlsafe_base64(32)
user.reset_password_sent_at = Time.zone.now
save_and_s... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/reset_password.rb | app/services/reset_password.rb | class ResetPassword < BaseForm
attribute :password, String
attribute :password_confirmation, String
attribute :user, User
validates :password, length: { minimum: PASSWORD_LENGTH, maximum: 32 }
validate :valid_password_confimation
validates_presence_of :user
def update_password
return false unless v... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/unique_item.rb | app/services/unique_item.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
# Checks for unique item_ids and adds an error to the found details
class UniqueItem < Struct.new(:klass)
delegate :details, to: :klass
def valid?
res = true
details.each do |det|
add_to_hash(det.item_id)
if repeated_item?... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/user_password.rb | app/services/user_password.rb | # encoding: utf-8
class UserPassword < BaseForm
attribute :password, String
attribute :password_confirmation, String
attribute :old_password, String
attr_reader :tenant
delegate :change_default_password?, to: :user
validates_length_of :password, minimum: PASSWORD_LENGTH, maximum: 32
validate :valid_old... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/admin_user.rb | app/services/admin_user.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
# Used to add or update users by the admin
class AdminUser < BaseForm
attribute :email, String
attribute :first_name, String
attribute :last_name, String
attribute :role, String
attribute :organisation, Organisation
validates :email, e... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/movement_service.rb | app/services/movement_service.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
# Sets and Income or expense
class MovementService
attr_reader :errors, :klass, :movement
ATTRIBUTES = [:date, :due_date, :contact_id, :total, :currency, :exchange_rate, :project_id, :due_date, :description].freeze
delegate :discount, :total... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/base_service.rb | app/services/base_service.rb | # encoding: utf-8
class BaseService
include Virtus.model
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::Validations
VALID_BOOLEAN = [true, 1, false, 0, "true", "1", "false", "0"]
attr_reader :errors
def initialize(attributes = {})
super attributes
@errors = Acti... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/inventory.rb | app/services/inventory.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class Inventory < InventoryOperationService
def save_in
res = true
commit_or_rollback do
inventory_operation.ref_number = InventoryOperation.get_ref_number('Ing')
inventory_operation.operation = 'in'
res = inventory_op... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/payment_service.rb | app/services/payment_service.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class PaymentService < BaseService
attr_reader :ledger, :movement
# Attributes
attribute :account_id, Integer
attribute :account_to_id, Integer
attribute :date, Date
attribute :amount, Decimal, default: 0
attribute :exchange_rate, De... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/null_account_ledger.rb | app/services/null_account_ledger.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class NullAccountLedger
attr_reader :account_ledger
delegate :account, :account_to, :amount, :amount_currency,
:nuller_id, :approver_id, :operation, to: :account_ledger
def initialize(ledger)
raise 'an AccountLedger instance ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/services/inventory_report_service.rb | app/services/inventory_report_service.rb | # ir = InventoryReport.new(type: 'Income', start_date: '2014-07-01', end_date: '2014-07-16', state: 'approved')
class InventoryReportService
attr_reader :type, :date_start, :date_end, :state, :date_field, :tag_group_id
def initialize(attrs)
@date_field = attrs[:date_field]
@type = attrs[:type]
@state= ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/serializers/contact_serializer.rb | app/serializers/contact_serializer.rb | # encoding: utf-8
class ContactSerializer < ActiveModel::Serializer
attributes :id, :matchcode, :first_name, :last_name, :to_s, :label
def label
to_s
end
end
| ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/serializers/account_serializer.rb | app/serializers/account_serializer.rb | # encoding: utf-8
class AccountSerializer < ActiveModel::Serializer
attributes :id, :type, :currency, :amount, :name, :to_s
end
| ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/serializers/item_serializer.rb | app/serializers/item_serializer.rb | class ItemSerializer
attr_reader :items, :store_id
def income(items)
@items = items
items.map do |item|
{
id: item.id, name: item.name,
code: item.code, price: item.price,
unit_symbol: item.unit_symbol, unit_name: item.unit_name, label: item.to_s
}
end
end
def e... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/history_presenter.rb | app/presenters/history_presenter.rb | class HistoryPresenter < BasePresenter
attr_reader :klass
def changes
if new_item?
template.text_green_dark 'creó el registro', nil, 'b'
else
if (ch = present_changes).present?
ch.html_safe
else
'modificó la fecha de actualización'.html_safe
end
end
end
def ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/ledger_operation_presenter.rb | app/presenters/ledger_operation_presenter.rb | class LedgerOperationPresenter < BasePresenter
attr_reader :current_id, :klass
delegate :operation_tag, :operation_text, to: :klass
def initialize(ledger, current_id, v_context)
super(ledger, v_context)
@current_id = current_id
set_operation_klass
end
def set_operation_klass
if unrelated_op... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/loan_history_presenter.rb | app/presenters/loan_history_presenter.rb | class LoanHistoryPresenter < HistoryPresenter
def changes
if new_item?
template.text_green_dark 'creó el registro', nil, 'b'
else
if (ch = present_changes).present?
"modificó: <br/>#{ch}".html_safe
else
'modificó la fecha de actualización'.html_safe
end
end
end
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/expense_history_presenter.rb | app/presenters/expense_history_presenter.rb | class ExpenseHistoryPresenter < MovementHistoryPresenter
def movement
'Egreso'
end
def details
expense_details
end
def details_col
:expense_details
end
def inventory_operation
get_inventory_operation if inventory_operation?
end
def inventory_operation?
['inventory_in', 'invent... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/store_presenter.rb | app/presenters/store_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class StorePresenter < BasePresenter
def address_tag
"#{ icon 'icon-building muted', 'Dirección' } #{sanitize address}".html_safe if address.present?
end
def phone_tag
"#{ icon 'icon-phone muted', 'Teléfono' } #{sanitize phone}".htm... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/base_presenter.rb | app/presenters/base_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class BasePresenter < Resubject::Presenter
delegate( *(
LabelTagHelper.instance_methods +
IconsHelper.instance_methods +
TextHelper.instance_methods +
ActionView::Helpers::SanitizeHelper.instance_methods +
[:link_to, :ntc, :text_re... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/income_presenter.rb | app/presenters/income_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class IncomePresenter < MovementPresenter
def income_payment
Incomes::Payment.new(account_id: id, date: Date.today, amount: 0)
end
def income_devolution
Incomes::Devolution.new(account_id: id, date: Date.today, amount: 0)
end
d... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/money_account_presenter.rb | app/presenters/money_account_presenter.rb | class MoneyAccountPresenter < BasePresenter
def active_tag
active? ? icon('icon-ok green', 'Visible') : icon('icon-cross red', 'Invisible')
end
def pendent_ledgers_tag
if pendent_ledgers.any?
link_to template.bank_path(id, pendent: true) , class: 'text-error' do
"#{icon 'icon-warning'} Tien... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/expense_presenter.rb | app/presenters/expense_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ExpensePresenter < MovementPresenter
def expense_payment
Expenses::Payment.new(account_id: id, date: Date.today, amount: 0.0)
end
def expense_devolution
Expenses::Devolution.new(account_id: id, date: Date.today, amount: 0)
e... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/movement_presenter.rb | app/presenters/movement_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class MovementPresenter < BasePresenter
def present_ledgers
present AccountLedgers::Query.new.payments_ordered(id), AccountLedgerPresenter
end
alias_method :payments_and_devolutions, :present_ledgers
def pendent_ledgers
present Ac... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/inventory_presenter.rb | app/presenters/inventory_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class InventoryPresenter < BasePresenter
def link
case
when(is_income? || is_expense?)
"/inventories/#{id}/show_movement"
when is_trans?
"/inventories/#{id}/show_trans"
else
to_model
end
end
def operati... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/movement_history_details_presenter.rb | app/presenters/movement_history_details_presenter.rb | class MovementHistoryDetailsPresenter < BasePresenter
delegate :currency, :creator, to: :historiable
#alias_method :movement, :historiable
def details_col
@details_col ||= historiable.is_a?(Income) ? 'income_details' : 'expense_details'
end
def details
@details ||= all_data[details_col]
.map ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/income_history_presenter.rb | app/presenters/income_history_presenter.rb | class IncomeHistoryPresenter < MovementHistoryPresenter
def movement
'Ingreso'
end
def details
income_details
end
def details_col
:income_details
end
def inventory_operation
get_inventory_operation if inventory_operation?
end
def inventory_operation?
['inventory_in', 'inventor... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/user_log_module.rb | app/presenters/user_log_module.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
module UserLogModule
def creator_label
return user_icon(class: 'text creator', title: "CREADO: #{user_label_text creator, created_at}") if creator.present?
''
end
def approver_label
return user_icon(class: 'bonsai-dark approver',... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/dashboard_presenter.rb | app/presenters/dashboard_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class DashboardPresenter < Struct.new(:view_context, :date_range)
delegate :render, :link_to, to: :view_context
delegate :incomes_by_item, :expenses_by_item, :total_incomes, :total_expenses, :total,
:incomes_percentage, :expenses_pecentage, ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/contact_presenter.rb | app/presenters/contact_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ContactPresenter < BasePresenter
def address_tag
"#{ icon 'icon-building muted', 'Dirección' } #{sanitize address}".html_safe if address.present?
end
def phone_tag
"#{ icon 'icon-phone muted', 'Teléfono' } #{sanitize phone}".ht... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/user_presenter.rb | app/presenters/user_presenter.rb | class UserPresenter < BasePresenter
delegate :active?, :role, to: :link, prefix: true
def roles_hash
Hash[User::ROLES.zip(roles_list)]
end
def role
roles_hash[link_role]
end
def role_options
roles_hash.map { |k, v| [v, k] }
end
def sliced_role_options
role_options.slice(1, 3)
end
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/item_presenter.rb | app/presenters/item_presenter.rb | class ItemPresenter < BasePresenter
def unit_tag
"(<span title='#{unit_name}' data-toggle='tooltip'>#{sanitize unit_symbol }</span>)".html_safe
end
def code_tag
to_model.code if to_model.code.present?
end
end
| ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/account_presenter.rb | app/presenters/account_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class AccountPresenter < BasePresenter
end
| ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/payment_presenter.rb | app/presenters/payment_presenter.rb | # encoding: utf-8
class PaymentPresenter
def initialize(transaction)
@transaction = transaction
end
def accounts
if @transaction.is_a? Income
Account.contact_money(@transaction.contact_id)
else
Account.contact_money_buy(@transaction.contact_id)
end
end
def devolution_accounts
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/account_ledger_presenter.rb | app/presenters/account_ledger_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class AccountLedgerPresenter < BasePresenter
attr_accessor :current_account_id
delegate :operation_tag, :operation_text, to: :ledger_operation_presenter
def initials(name)
name.split(' ').map(&:first).join('')
end
def status_text
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/movement_history_presenter.rb | app/presenters/movement_history_presenter.rb | class MovementHistoryPresenter < HistoryPresenter
def changes
if new_item?
template.text_green_dark "creó el #{movement}", nil, 'b'
else
present_changes.html_safe
end
end
def movement
end
def present_changes
res = [filter_changes, details_changes].flatten.compact.join(', ')
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/report_presenter.rb | app/presenters/report_presenter.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ReportPresenter < Struct.new(:view_context)
delegate :render, :link_to, to: :view_context
delegate :incomes_by_item, :expenses_by_item, to: :report
alias :vc :view_context
def pendent_ledgers
total = AccountLedger.pendent.count
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/loans/receive_presenter.rb | app/presenters/loans/receive_presenter.rb | class Loans::ReceivePresenter < BasePresenter
def loan_type_tag
"#{icon 'icon-login fs130 red'} Prestamo recibido".html_safe
end
def due_date_tag
txt = (due_date < today) ? text_red(template.l due_date) : template.l(due_date)
"<span class='muted'>Vence el</span> #{txt}".html_safe unless is_paid?
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/presenters/loans/give_presenter.rb | app/presenters/loans/give_presenter.rb | class Loans::GivePresenter < BasePresenter
def loan_type_tag
"#{icon 'icon-logout fs130 green'} Prestamo otorgado".html_safe
end
def due_date_tag
txt = due_date < today ? text_red(template.l due_date) : template.l(due_date)
"<span class='muted'>Vence el</span> #{txt}".html_safe unless is_paid?
e... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/icons_helper.rb | app/helpers/icons_helper.rb | # encoding: utf-8
module IconsHelper
ICONS = {new: 'plus-circle', edit: 'pencil', list: 'table', show: 'eye', delete: 'trash' }
ICONS.each do |tit, icon|
define_method :"icon_#{tit}" do |title = nil|
title ||= I18n.t("common.#{tit}")
t = " title='#{title}' data-toggle='tooltip'"
"<i class='i... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/label_tag_helper.rb | app/helpers/label_tag_helper.rb | # encoding: utf-8
module LabelTagHelper
{
black: 'label-inverse',
blue: 'label-info',
green: 'bg-bonsai-dark',
red: 'label-important',
yellow: 'label-warning',
gray: ''
}.each do |met, lbl|
define_method :"label_#{met}" do |text, title = ''|
tag_labeler text, lbl, title
end
e... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/bonsai_helper.rb | app/helpers/bonsai_helper.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
# Especial methods created to make easier the development
module BonsaiHelper
# Creates the links show, edit, destroy
def bonsai_links(klass, options={})
["edit", "destroy"].inject([]) do |t, m|
t << bonsai_method_path(m, klass)
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/movement_helper.rb | app/helpers/movement_helper.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
module MovementHelper
def search_path(trans, options = {})
options[:format] ||= 'json'
case
when trans.class.to_s =~ /Income/
search_income_items_path(options)
when trans.class.to_s =~ /Expense/
search_expense_items_p... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/tags_helper.rb | app/helpers/tags_helper.rb | module TagsHelper
# Presents a list for json
def tags_list
@tags_list ||= Tag.list.order("name").map { |val|
{ id: val.id, name: val.name, label: val.to_s, bgcolor: val.bgcolor }
}
end
def tags_list_hash
@tags_list_hash ||= Hash[tags_list.map { |el|
[el[:id], el]
}]
end
end
| ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/pagination_helper.rb | app/helpers/pagination_helper.rb | module PaginationHelper
def page_disabled_css(val)
val ? 'disabled' : ''
end
def page_current_css(val)
val ? 'active' : ''
end
end
| ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/text_helper.rb | app/helpers/text_helper.rb | module TextHelper
{red: 'red',
green: 'bonsai-dark',
green_dark: 'bonsai-darker',
blue: 'blue',
black: 'black',
dark: 'dark',
gray: 'gray',
gray_light: 'gray-light'
}.each do |meth, color|
define_method :"text_#{meth}" do |txt, title = '', css=''|
css << " #{color}"
title = "tit... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/cache_keys_helper.rb | app/helpers/cache_keys_helper.rb | module CacheKeysHelper
def klass_default_key(klass)
count = klass.count
max_updated_at = klass.maximum(:updated_at).try(:utc).try(:to_s, :to_number)
"#{tenant}-#{count}-#{max_updated_at}"
end
def today_key
@today_key ||= Time.zone.now.to_date.to_s
end
def cache_key_for_tags
@cache_key_f... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/application_helper.rb | app/helpers/application_helper.rb | # encoding: utf-8 # author: Boris Barroso
# email: boriscyber@gmail.com
module ApplicationHelper
# Checks if is set the organisation session
# @return [True, False]
def organisation?
session[:organisation] and session[:organisation].size > 0
end
# Presens the logo of an organisation based on the session... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/contacts_helper.rb | app/helpers/contacts_helper.rb | module ContactsHelper
# Sets the contact type
def contact_type(type, plural = true)
if type == 'clients'
plural ? 'Clientes' : 'cliente'
elsif type == "suppliers"
plural ? 'Proveedores' : 'proveedor'
end
end
def link_contact_ledger(al, account_ids)
if al.transaction_id.present?
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/currency_helper.rb | app/helpers/currency_helper.rb | # Methods for currency
# currency method is defined in application controller, and is the currency the organisation uses
module CurrencyHelper
# ApplicationController#currency method is defined
def currency_options
Currency.options *Currency::FILTER
end
def currency_name(cur = currency)
CURRENCIES[cur... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/helpers/cdn_helper.rb | app/helpers/cdn_helper.rb | module CdnHelper
ANGULAR_VERSION = "1.3.15"
SCRIPTS = {
"jquery" => {
klass: "jQuery",
cdn: "http://code.jquery.com/jquery-1.11.0.min.js",
local: "/assets/jquery/jquery-1.11.0.min.js"
},
"angular" => {
klass: "angular",
cdn: "https://ajax.googleapis.com/ajax/libs/angularjs/... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/expenses_inventory_ins_controller.rb | app/controllers/expenses_inventory_ins_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ExpensesInventoryInsController < ApplicationController
before_filter :set_store_and_expense
# GET
# /expenses_inventory_ins/new?store_id=:store_id&expense_id=:expense_id
def new
@inv = Expenses::InventoryIn.new(
store_id: @... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/stocks_controller.rb | app/controllers/stocks_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class StocksController < ApplicationController
# PUT, PATCH /stocks/:id
def update
@stock = Stock.find(params[:id])
if @stock.save_minimum(params[:minimum])
render json: { success: true, id: params[:id], minimum: @stock.minimum }... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/inventory_transferences_controller.rb | app/controllers/inventory_transferences_controller.rb | # author: Boris Barroso
# email: boriscyber@gmail.com
class InventoryTransferencesController < ApplicationController
before_filter :set_store, only: [:new, :create]
# GET /inventory_transferences/new
def new
@trans = Inventories::Transference.new(store_id: @store.id, date: Date.today)
2.times { @trans.d... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/loan_payments_controller.rb | app/controllers/loan_payments_controller.rb | class LoanPaymentsController < ApplicationController
before_filter :check_loan!
#####################################
# Loans::Receive
# GET /loans_paymens/:id/new_pay
def new_pay
@payment = Loans::ReceivePaymentForm.new(account_id: params[:id], date: today)
end
# POST /loan_payments/:id/pay
def... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/loans_controller.rb | app/controllers/loans_controller.rb | class LoansController < ApplicationController
# GET /loans
def index
params[:type] = "all" if params[:type].blank? and params[:search].blank?
@loans = Loans::Query.filter(params).page(@page).page(@page)
end
# GET /loans_receive/new
def new_receive
@loan = Loans::ReceiveForm.new(date: Date.toda... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/stores_controller.rb | app/controllers/stores_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class StoresController < ApplicationController
before_action :set_date_range, :set_show_params, only: ['show']
# GET /stores
def index
@stores = present Store.all
respond_to do |format|
format.html
end
end
# GET /stor... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/transferences_controller.rb | app/controllers/transferences_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class TransferencesController < ApplicationController
before_filter :find_account
# GET /transferences?account_id
def new
@transference = Transference.new(account_id: params[:account_id], date: Time.zone.now.to_date)
end
def create
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/configurations_controller.rb | app/controllers/configurations_controller.rb | class ConfigurationsController < ApplicationController
# GET /configurations
def index
end
end
| ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/organisation_updates_controller.rb | app/controllers/organisation_updates_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class OrganisationUpdatesController < ApplicationController
def edit
end
def update
if current_organisation.update_attributes(organisation_params)
redirect_to configurations_path(anchor: 'organisation'), notice: 'Se actualizo corre... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/contacts_controller.rb | app/controllers/contacts_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ContactsController < ApplicationController
include Controllers::TagSearch
before_filter :find_contact, only: [:show, :edit, :update, :destroy, :incomes, :expenses]
# GET /contacts
def index
@contacts = Contacts::Query.new.index.o... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/batch_payments_controller.rb | app/controllers/batch_payments_controller.rb | # Class that allows payments in batch
# The payment is the full amount
class BatchPaymentsController < ApplicationController
# /batch_payments/income
def income
ip = Incomes::BatchPayment.new(batch_params)
ip.make_payments
render json: { errors: ip.errors, success: true }
end
# /batch_payments/ex... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/payments_controller.rb | app/controllers/payments_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class PaymentsController < ApplicationController
# GET /payments/:id/new_income
def new_income
@payment = Incomes::Payment.new(account_id: params[:id], date: Time.zone.now.to_date)
check_income
@payment.amount = @payment.income.amo... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/export_incomes_controller.rb | app/controllers/export_incomes_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ExportIncomesController < ApplicationController
include ::Controllers::DateRange
before_filter :set_date_range
# GET /export_incomes
def index
end
# POST /export_incomes
def create
exp = Incomes::Export.new(@date_range)
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/tags_controller.rb | app/controllers/tags_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class TagsController < ApplicationController
# GET /tags/new
#def new
# @tag = Tag.new
#end
# POST /tags
def create
@tag = Tag.new(tag_params)
if @tag.save
render json: @tag
else
render json: { errors: @tag.e... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/export_expenses_controller.rb | app/controllers/export_expenses_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ExportExpensesController < ApplicationController
include ::Controllers::DateRange
before_filter :set_date_range
# GET /export_incomes
def index
end
# POST /export_incomes
def create
exp = Expenses::Export.new(@date_range)... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/incomes_inventory_outs_controller.rb | app/controllers/incomes_inventory_outs_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class IncomesInventoryOutsController < ApplicationController
before_filter :set_store_and_income
# GET
# /incomes_inventory_ins/new?store_id=:store_id&income_id=:income_id
def new
@inv = Incomes::InventoryOut.new(
store_id: @stor... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/user_passwords_controller.rb | app/controllers/user_passwords_controller.rb | # encoding: utf-8
class UserPasswordsController < ApplicationController
before_filter :check_change_password!, only: [:new, :create]
before_filter :check_change_default_password!, only: [:new_default, :create_default]
# GET user_passwords/new
def new
@user_password = UserPassword.new
end
# POST user_p... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/projects_controller.rb | app/controllers/projects_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ProjectsController < ApplicationController
before_filter :set_project, :only => [:show, :edit, :update, :destroy]
# GET /projects
def index
@projects = Project.page(@page)
end
# GET /projects/1
def show
end
# GET /projec... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/tests_controller.rb | app/controllers/tests_controller.rb | class TestsController < ApplicationController
skip_before_filter :set_tenant, :check_authorization!
def index
params[:view] ||= 'email'
case params[:view]
when 'email'
render file: 'tests/email', layout: 'email'
when 'testemail'
email = params[:email] || 'boriscyber@gmail.com'
na... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/dashboard_controller.rb | app/controllers/dashboard_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class DashboardController < ApplicationController
include Controllers::DateRange
before_filter :set_date_range, only: [:index]
skip_before_action :check_authorization!, only: [:home]
before_action :check_user_session
# GET /home
def ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/expenses_inventory_outs_controller.rb | app/controllers/expenses_inventory_outs_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ExpensesInventoryOutsController < ApplicationController
before_filter :set_store_and_expense
# GET
# /expenses_inventory_ins/new?store_id=:store_id&expense_id=:expense_id
def new
@inv = Expenses::InventoryOut.new(
store_id:... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/items_controller.rb | app/controllers/items_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ItemsController < ApplicationController
include Controllers::TagSearch
before_action :set_item, only: [:show, :edit, :update, :destroy]
# GET /items
def index
search_items
respond_to do |format|
format.html
form... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/inventory_outs_controller.rb | app/controllers/inventory_outs_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class InventoryOutsController < ApplicationController
before_filter :check_store
def new
@inv = Inventories::Out.new(store_id: params[:store_id], date: Date.today,
description: "Egreso de ítems")
2.times ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/inventory_ins_controller.rb | app/controllers/inventory_ins_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class InventoryInsController < ApplicationController
before_filter :check_store
def new
@inv = Inventories::In.new(store_id: params[:store_id], date: Date.today,
description: "Ingreso de ítems")
2.times { ... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/users_controller.rb | app/controllers/users_controller.rb | # encoding: utf-8 # author: Boris Barroso
# email: boriscyber@gmail.com
class UsersController < ApplicationController
# GET /users/:id
def show
end
# GET /users/:id/edit
def edit
end
# PUT /users/:id
def update
if current_user.update_attributes(user_params)
redirect_to current_user, notice:... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/inventories_controller.rb | app/controllers/inventories_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class InventoriesController < ApplicationController
include Controllers::Print
before_filter :set_date_range, only: [:index]
# GET /inventories
def index
@inventories = get_inventories
end
# GET /inventories/1
def show
@inv... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/tag_groups_controller.rb | app/controllers/tag_groups_controller.rb | class TagGroupsController < ApplicationController
# GET /tag_groups
def index
@tag_groups = TagGroup.order(:name).page(@page)
end
# GET /tag_groups/new
def new
@tag_group = TagGroup.new
end
# POST /tag_groups
def create
tag_group = TagGroup.new(tag_group_params)
if tag_group.save
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/account_ledgers_controller.rb | app/controllers/account_ledgers_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class AccountLedgersController < ApplicationController
include Controllers::Print
before_action :set_ledger, only: [:conciliate, :null, :update]
# GET /account_ledger
def index
if params[:pendent]
@title = "Transacciones no pend... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/staff_accounts_controller.rb | app/controllers/staff_accounts_controller.rb | class StaffAccountsController < ApplicationController
before_filter :set_staff_account, only: [:show, :edit, :update, :destroy]
include Controllers::Money
# GET /staff_accounts
def index
@staff_accounts = present StaffAccount.order('name asc'), MoneyAccountPresenter
end
# GET /staff_accounts/:id
de... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/expenses_controller.rb | app/controllers/expenses_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ExpensesController < ApplicationController
include Controllers::TagSearch
before_action :set_expense, only: [:approve, :null, :inventory]
# GET /expenses
def index
@expenses = Movements::Search.new(params, Expense).search.order(... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/admin_users_controller.rb | app/controllers/admin_users_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class AdminUsersController < ApplicationController
rescue_from MasterAccountError, with: :redirect_to_conf
before_action :check_organisation_users, except: [:active]
# GET /admin_users/:id
def show
@user = get_user
end
# GET /admi... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/reset_passwords_controller.rb | app/controllers/reset_passwords_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class ResetPasswordsController < ApplicationController
layout 'sessions'
skip_before_filter :set_tenant, :check_authorization!
before_filter :find_user_or_redirect!, only: [:edit, :update]
def index
end
# GET /reset_passwords/new
d... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
bonsaiERP/bonsaiERP | https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/app/controllers/incomes_controller.rb | app/controllers/incomes_controller.rb | # encoding: utf-8
# author: Boris Barroso
# email: boriscyber@gmail.com
class IncomesController < ApplicationController
include Controllers::TagSearch
include Controllers::Print
#respond_to :html, :js, :pdf
before_action :set_income, only: [:approve, :null, :inventory, :destroy]
# GET /incomes
def index
... | ruby | MIT | 0edb91af594f81e7534dbc90525a406c645ad164 | 2026-01-04T17:40:51.865869Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.