Skip to content

Commit

Permalink
Dynamic models, controllers, routes, and code itself for currencies (c…
Browse files Browse the repository at this point in the history
…loses openware#646)
  • Loading branch information
yivo committed Mar 15, 2018
1 parent 058b38e commit 4fc3b6c
Show file tree
Hide file tree
Showing 99 changed files with 243 additions and 1,052 deletions.
@@ -1,6 +1,7 @@
app.controller 'DepositsController', ['$scope', '$stateParams', '$http', '$filter', '$gon', 'ngDialog', ($scope, $stateParams, $http, $filter, $gon, ngDialog) ->
@deposit = {}
$scope.currency = $stateParams.currency
$scope.currencyTranslationLocals = currency: $stateParams.currency.toUpperCase()
$scope.current_user = current_user = $gon.user
$scope.name = current_user.name
$scope.bank_details_html = $gon.bank_details_html
Expand Down
Expand Up @@ -7,6 +7,7 @@ app.controller 'WithdrawsController', ['$scope', '$stateParams', '$http', '$gon'
return false

$scope.currency = currency = $stateParams.currency
$scope.currencyTranslationLocals = currency: currency.toUpperCase()
$scope.current_user = current_user = $gon.user
$scope.account = Account.findBy('currency', $scope.currency)
$scope.balance = $scope.account.balance
Expand Down Expand Up @@ -49,7 +50,7 @@ app.controller 'WithdrawsController', ['$scope', '$stateParams', '$http', '$gon'

$('.form-submit > input').attr('disabled', 'disabled')

$http.post("/withdraws/#{withdraw_channel.resource_name}", data)
$http.post("/withdraws/#{currency}", data)
.success ->
location.reload()
.error (responseText) ->
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/locales/en.js.erb
@@ -1,2 +1,3 @@
//= require i18n
//
<%= JsLocaleHelper.output_locale(:en) %>
4 changes: 2 additions & 2 deletions app/controllers/admin/deposits/banks_controller.rb
Expand Up @@ -4,7 +4,7 @@ module Admin
module Deposits
class BanksController < BaseController

load_and_authorize_resource :class => '::Deposits::Bank'
load_and_authorize_resource :class => '::Deposits::Fiat'

def index
start_at = DateTime.now.ago(60 * 60 * 24)
Expand All @@ -24,7 +24,7 @@ def show
end

def create
@bank = ::Deposits::Bank.new(deposit_params)
@bank = ::Deposits::Fiat.new(deposit_params)
if @bank.save
redirect_to action: :index
else
Expand Down
7 changes: 0 additions & 7 deletions app/controllers/admin/deposits/bitcoin_cash_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/deposits/duffs_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/deposits/ethereums_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/deposits/litoshis_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/deposits/ripples_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/deposits/satoshis_controller.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/controllers/admin/withdraws/banks_controller.rb
Expand Up @@ -3,7 +3,7 @@
module Admin
module Withdraws
class BanksController < BaseController
load_and_authorize_resource :class => '::Withdraws::Bank'
load_and_authorize_resource :class => '::Withdraws::Fiat'
before_action :find_withdraw, only: [:show, :update, :destroy]

def index
Expand Down
7 changes: 0 additions & 7 deletions app/controllers/admin/withdraws/bitcoin_cash_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/withdraws/duffs_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/withdraws/ethereums_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/withdraws/litoshis_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/withdraws/ripples_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/withdraws/satoshis_controller.rb

This file was deleted.

13 changes: 0 additions & 13 deletions app/controllers/concerns/deposits/ctrl_coinable.rb

This file was deleted.

44 changes: 0 additions & 44 deletions app/controllers/concerns/withdraws/withdrawable.rb

This file was deleted.

18 changes: 0 additions & 18 deletions app/controllers/private/deposits/base_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/private/deposits/bitcoin_cash_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/private/deposits/duffs_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/private/deposits/ethereums_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/private/deposits/litoshis_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/private/deposits/ripples_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/private/deposits/satoshis_controller.rb

This file was deleted.

21 changes: 21 additions & 0 deletions app/controllers/private/deposits_controller.rb
@@ -0,0 +1,21 @@
module Private
class DepositsController < BaseController
before_action :auth_verified!

def gen_address
return head 404 unless currency.coin?

current_user.get_account(currency).tap do |account|
next unless account.payment_address.address.blank?
account.payment_address.enqueue_address_generation
end
head 204
end

private

def currency
@currency ||= Currency.find_by_code!(params[:currency])
end
end
end
4 changes: 4 additions & 0 deletions app/controllers/private/funds_controller.rb
@@ -1,5 +1,7 @@
module Private
class FundsController < BaseController
include CurrencyHelper

layout 'funds'

before_action :auth_verified!
Expand All @@ -16,6 +18,8 @@ def index
gon.jbuilder
end

helper_method :currency_icon_url

def gen_address
current_user.accounts.each do |account|
next unless account.currency&.coin?
Expand Down
5 changes: 0 additions & 5 deletions app/controllers/private/withdraws/banks_controller.rb

This file was deleted.

17 changes: 0 additions & 17 deletions app/controllers/private/withdraws/base_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/private/withdraws/bitcoin_cash_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/private/withdraws/duffs_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/private/withdraws/ethereums_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/private/withdraws/litoshis_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/private/withdraws/ripples_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/private/withdraws/satoshis_controller.rb

This file was deleted.

0 comments on commit 4fc3b6c

Please sign in to comment.