-
Notifications
You must be signed in to change notification settings - Fork 4
/
bitcoin_exchange.rb
62 lines (46 loc) · 1.24 KB
/
bitcoin_exchange.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
path = File.expand_path '../', __FILE__
require "#{path}/config/env.rb"
class BitcoinExchange < Sinatra::Base
use Rack::MethodOverride
include Voidtools::Sinatra::ViewHelpers
require "#{PATH}/lib/mixins/html_helpers"
require "#{PATH}/lib/mixins/formats_helpers"
require "#{PATH}/lib/mixins/resources_helpers"
require "#{PATH}/lib/mixins/form_helpers"
require "#{PATH}/lib/mixins/flashes"
helpers do
include ViewHelpers
include FormatsHelpers
include ResourcesHelpers
include FormHelpers
include Flashes
def cur_user_balance
current_user.balance
end
end
end
require_all "routes"
LOAD_MODULES_ROUTES.call
# TEST routes
#
# remove them in production!!
#
#
if App.env != "production"
class BitcoinExchange < Sinatra::Base
# get "/reset" do
# DataMapper.auto_migrate!
# "DB RESET!<br><br>(remove this route from production!)"
# end
post "/force_login/:id" do |id|
return_url = params[:return_url]
return_url = params[:return_url] if return_url && !return_url.blank?
session[:user_id] = id.to_i
redirect return_url || "/"
end
# TODO: move all the admin_move dir in admin app
get "/redis" do
haml :"../admin/views/redis"
end
end
end