forked from hpyhacking/peatio
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
858 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#= require jquery | ||
#= require pusher.min | ||
|
||
#= require ./lib/tiny-pubsub | ||
#= require angular | ||
#= require angular-resource | ||
#= require ./lib/angular-ui-router | ||
#= require ./lib/peatio_model | ||
#= require ./lib/ajax | ||
|
||
#= require ./lib/pusher_connection | ||
#= require ./lib/pusher_subscriber | ||
|
||
#= require ngDialog/ngDialog | ||
|
||
#= require_self | ||
#= require ./dividends/dividends | ||
|
||
#= require es5-shim.min | ||
#= require es5-sham.min | ||
#= require jquery_ujs | ||
#= require bootstrap | ||
# | ||
#= require bignumber | ||
#= require moment | ||
#= require ZeroClipboard | ||
#= require underscore | ||
#= require flight.min | ||
#= require list | ||
#= require qrcode | ||
|
||
#= require_tree ./helpers | ||
#= require_tree ./component_mixin | ||
#= require_tree ./component_data | ||
#= require_tree ./component_ui | ||
|
||
|
||
|
14 changes: 14 additions & 0 deletions
14
app/assets/javascripts/dividends/controllers/daily_controller.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
app.controller 'DailyController', ($scope, $stateParams, $http) -> | ||
ctrl = @ | ||
@list = gon.daily_list | ||
|
||
@noRecords = -> | ||
@list.length == 0 | ||
|
||
@refresh = -> | ||
@list = gon.daily_list | ||
$scope.$apply() | ||
|
||
do @event = -> | ||
Dividend.bind "create update destroy", -> | ||
ctrl.refresh() |
7 changes: 7 additions & 0 deletions
7
app/assets/javascripts/dividends/controllers/dividends_controller.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app.controller 'DividendsController', ['$scope', '$stateParams', '$http', '$filter', '$gon', 'ngDialog', ($scope, $stateParams, $http, $filter, $gon, ngDialog) -> | ||
@dividend = {} | ||
|
||
@signContracs = () -> | ||
console.log "signContract" | ||
|
||
] |
14 changes: 14 additions & 0 deletions
14
app/assets/javascripts/dividends/controllers/intraday_controller.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
app.controller 'IntradayController', ($scope, $stateParams, $http) -> | ||
ctrl = @ | ||
@list = gon.intraday_list | ||
|
||
@noRecords = -> | ||
@list.length == 0 | ||
|
||
@refresh = -> | ||
@list = gon.intraday_list | ||
$scope.$apply() | ||
|
||
do @event = -> | ||
Dividend.bind "create update destroy", -> | ||
ctrl.refresh() |
73 changes: 73 additions & 0 deletions
73
app/assets/javascripts/dividends/directives/dividends_directives.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#= require bootstrap | ||
#= require bootstrap-switch.min | ||
|
||
app.directive 'dividends', -> | ||
return { | ||
restrict: 'E' | ||
templateUrl: '/templates/dividends/dividends.html' | ||
scope: { localValue: '=dividends' } | ||
controller: ($scope, $state, $http, $filter, $gon, ngDialog) -> | ||
console.log Product.all()[0] | ||
|
||
ctrl = @ | ||
@state = $state | ||
|
||
$scope.product = Product.all()[0] | ||
$scope.dividend = Dividend.all()[0] | ||
$scope.asset = Asset.all()[0] | ||
$scope.interest = Interest.all()[0] | ||
$scope.interest_intraday = gon.interest_intraday | ||
$scope.interest_total = gon.interest_total | ||
$scope.error = false | ||
|
||
if $scope.dividend.aasm_state == 'accepted' | ||
$('div[name="product-panel"]').removeClass('hide') | ||
else | ||
$('div[name="product-panel"]').addClass('hide') | ||
|
||
$('input[name="sign-checkbox"]').bootstrapSwitch | ||
labelText: 'Signed' | ||
state: $scope.dividend.aasm_state == 'accepted' | ||
onText: 'YES' | ||
offText: 'NO' | ||
onSwitchChange: (event, state) -> | ||
if $scope.error | ||
$scope.error = false | ||
return | ||
|
||
if state | ||
$scope.acceptAgreement(event) | ||
else | ||
$scope.revokeAgreement(event) | ||
|
||
$scope.$apply() | ||
|
||
$scope.acceptAgreement = (event) -> | ||
$http.post("/dividends/accept_agreement", {}) | ||
.error (responseText) -> | ||
$scope.error = true | ||
$.publish 'flash', {message: responseText.errors } | ||
.finally -> | ||
if !$scope.error | ||
$('div[name="product-panel"]').removeClass('hide') | ||
if $scope.error | ||
$('input[name="sign-checkbox"]').bootstrapSwitch('state', false); | ||
|
||
$scope.revokeAgreement = (event) -> | ||
$http.post("/dividends/revoke_agreement", {}) | ||
.error (responseText) -> | ||
$scope.error = true | ||
$.publish 'flash', {message: responseText.errors } | ||
.finally -> | ||
if !$scope.error | ||
$('div[name="product-panel"]').addClass('hide') | ||
if $scope.error | ||
$('input[name="sign-checkbox"]').bootstrapSwitch('state', true); | ||
|
||
do @event = -> | ||
Dividend.bind "create update destroy", -> | ||
$scope.$apply() | ||
|
||
controllerAs: 'dividendsCtrl' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#= require_tree ./models | ||
#= require_tree ./filters | ||
#= require_self | ||
#= require_tree ./services | ||
#= require_tree ./directives | ||
#= require_tree ./controllers | ||
#= require ./router | ||
#= require ./events | ||
|
||
$ -> | ||
window.pusher_subscriber = new PusherSubscriber() | ||
|
||
Member.initData [gon.current_user] | ||
Product.initData gon.product | ||
Dividend.initData gon.dividend | ||
Asset.initData gon.asset | ||
Interest.initData gon.interest | ||
|
||
window.app = app = angular.module 'dividends', ["ui.router", "ngResource", "translateFilters", "textFilters", "precisionFilters", "smallPrecisionFilters", "ngDialog"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
$(window).load -> | ||
|
||
# flash message | ||
$.subscribe 'flash', (event, data) -> | ||
$('.flash-messages').show() | ||
$('#flash-content').html(data.message) | ||
setTimeout(-> | ||
$('.flash-messages').hide(1000) | ||
, 10000) | ||
|
||
# init the two factor auth | ||
$.subscribe 'two_factor_init', (event, data) -> | ||
TwoFactorAuth.attachTo('.two-factor-auth-container') | ||
|
||
$.publish 'two_factor_init' |
6 changes: 6 additions & 0 deletions
6
app/assets/javascripts/dividends/filters/precision_filters.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
angular.module('precisionFilters', []).filter 'round_down', -> | ||
(number) -> | ||
if number == null | ||
return 0.00000000 | ||
BigNumber(number).round(9, BigNumber.ROUND_DOWN).toF(9) | ||
|
6 changes: 6 additions & 0 deletions
6
app/assets/javascripts/dividends/filters/small_precision_filters.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
angular.module('smallPrecisionFilters', []).filter 'round_down_small', -> | ||
(number) -> | ||
if number == null | ||
return 0.0000 | ||
BigNumber(number).round(4, BigNumber.ROUND_DOWN).toF(4) | ||
|
6 changes: 6 additions & 0 deletions
6
app/assets/javascripts/dividends/filters/text_filters.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
angular.module('textFilters', []).filter 'truncate', -> | ||
(text, size) -> | ||
if text.length > 20 | ||
text.slice(0, size) + '...' | ||
else | ||
text |
3 changes: 3 additions & 0 deletions
3
app/assets/javascripts/dividends/filters/translate_filters.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
angular.module('translateFilters', []).filter 't', -> | ||
(key, args={}) -> | ||
I18n.t(key, args) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Asset extends PeatioModel.Model | ||
@configure 'Asset', 'member_id', 'currency', 'balance', 'locked', 'created_at', 'updated_at', 'in', 'out', 'deposit_address', 'name_text', 'is_online', 'blocks', 'headers', 'blocktime', 'gio_discount', 'coin_home', 'coin_btt', 'coin_be' | ||
|
||
@initData: (record) -> | ||
PeatioModel.Ajax.disable -> | ||
Asset.create(record) | ||
|
||
window.Asset = Asset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Dividend extends PeatioModel.Model | ||
@configure 'Dividend', 'member_id', 'product_id', 'aasm_state', 'created_at', 'updated_at' | ||
|
||
@initData: (record) -> | ||
PeatioModel.Ajax.disable -> | ||
Dividend.create(record) | ||
|
||
window.Dividend = Dividend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Interest extends PeatioModel.Model | ||
@configure 'Interest', 'member_id', 'currency', 'balance', 'locked', 'created_at', 'updated_at', 'in', 'out', 'deposit_address', 'name_text', 'is_online', 'blocks', 'headers', 'blocktime', 'gio_discount', 'coin_home', 'coin_btt', 'coin_be' | ||
|
||
@initData: (record) -> | ||
PeatioModel.Ajax.disable -> | ||
Interest.create(record) | ||
|
||
window.Interest = Interest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Member extends PeatioModel.Model | ||
@configure 'Member', 'sn', 'display_name', 'created_at', 'updated_at', 'state', | ||
'country_code', 'phone_number', 'name', 'app_activated', 'sms_activated', 'has_gio_deposite_50', 'two_fa_require_signin' | ||
|
||
@initData: (records) -> | ||
PeatioModel.Ajax.disable -> | ||
$.each records, (idx, record) -> | ||
Member.create(record) | ||
|
||
window.Member = Member |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Product extends PeatioModel.Model | ||
@configure 'Product', 'name', 'description', 'asset', 'interest', 'maturation', 'amount', 'rate', 'contract', 'created_at', 'updated_at' | ||
|
||
@initData: (record) -> | ||
PeatioModel.Ajax.disable -> | ||
Product.create(record) | ||
|
||
window.Product = Product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app.config ($stateProvider, $urlRouterProvider) -> | ||
$stateProvider | ||
.state('dividends', { | ||
url: '/dividends' | ||
templateUrl: "/templates/dividends/dividends.html" | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
app.factory '$gon', ['$window', (win)-> win.gon] |
7 changes: 7 additions & 0 deletions
7
app/assets/javascripts/dividends/services/ng_dialog.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app.config ['ngDialogProvider', (ngDialogProvider) -> | ||
ngDialogProvider.setDefaults | ||
closeByDocument: false | ||
closeByEscape: false | ||
trapFocus: false | ||
cache: false | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,10 @@ | |
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
.table-dividends { | ||
border-radius: 5px; | ||
right: -1px; | ||
margin-bottom: 0; | ||
> tbody > tr > td { | ||
border-top: none; | ||
border-bottom: none; | ||
padding: 20px; | ||
} | ||
} | ||
.currency-dividend-item { | ||
margin: 0; | ||
.currency-dividend-label { | ||
font-size: 12px; | ||
text-transform: uppercase; | ||
color: #fff; | ||
padding: 3px 10px; | ||
border-radius: 3px; | ||
background-color: #333; | ||
&.label-cny { | ||
background-color: #EC6060; | ||
} | ||
&.label-btc { | ||
background-color: #DDCD1B; | ||
} | ||
} | ||
.currency-dividend-logo { | ||
text-align: center; | ||
max-width: 60px; | ||
min-width: 10px; | ||
img { | ||
max-height: 64px; | ||
max-width: 64px; | ||
} | ||
.currency-dividend-symbol { | ||
display: block; | ||
margin-top: 5px; | ||
text-transform: uppercase; | ||
color: #999; | ||
font-size: 16px; | ||
} | ||
.currency-dividend-state { | ||
text-align: center; | ||
max-width: 16px; | ||
max-height: 16px; | ||
padding: 3px 0px 0; | ||
img { | ||
max-height: 12px; | ||
} | ||
} | ||
} | ||
.currency-dividend-balance-col { | ||
padding-left: 0; | ||
padding-right: 0; | ||
} | ||
.currency-dividend-balance { | ||
font-size: 24px; | ||
font-weight: bold; | ||
font-family: monospace; | ||
padding: -10px 0px 0; | ||
margin: 0; | ||
.currency-dividend-sign { | ||
display: none; | ||
font-size: 20px; | ||
margin-left: -4px; | ||
} | ||
} | ||
.currency-dividend-balance-locked { | ||
display: block; | ||
color: #999; | ||
font-size: 14px; | ||
font-weight: normal; | ||
} | ||
.currency-dividend-info-ext { | ||
color: #999; | ||
font-size: 14px; | ||
font-weight: normal; | ||
} | ||
.currency-dividend-info { | ||
padding: 5px 0px 0; | ||
display: block; | ||
color: #999; | ||
font-size: 12px; | ||
font-weight: normal; | ||
} | ||
} | ||
|
Oops, something went wrong.