Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
svk31 committed Dec 31, 2014
1 parent 988c1c2 commit 4430d14
Show file tree
Hide file tree
Showing 131 changed files with 104,461 additions and 1,891 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
generated/
node_modules/
push
4 changes: 4 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*global module:false*/
module.exports = function(grunt) {
require('./config/lineman').config.grunt.run(grunt);
};
68 changes: 62 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,67 @@
Bitsharesblocks
===============
Initial repo for files related to Bitsharesblocks. This will be deleted or reused when the whole site goes open-source later this year.
#Bitsharesblocks

Currently available: localization files
Repo for the source code of http://www.bitsharesblocks.com

Bounties for initial translations available here:
##Setup
Clone into your directory of choice, then do "npm install" (sudo might be necessary).

The website uses a component file structure, see https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/mobilebasic?pli=1.

In order to use lineman with this layout it is necessary to modify the grunt configuration file in:

/node_modules/lineman-angular/config/plugins/ngtemplates.coffee

Replace the following:

ngtemplates:
app:
options:
base: "app/templates"
src: "app/templates/**/*.html"
dest: "<%= files.ngtemplates.dest %>"

watch:
ngtemplates:
files: "app/templates/**/*.html",
tasks: ["ngtemplates", "concat_sourcemap:js"]

with: (this is coffeescript so make sure the indentations are correct)

ngtemplates:
app:
options:
base: "app/components"
src: ["app/templates/**/*.html",
"app/components/**/**/*.html"]
dest: "<%= files.ngtemplates.dest %>"

watch:
ngtemplates:
files: ["app/templates/**/*.html","app/components/**/*.html"]
tasks: ["ngtemplates", "concat_sourcemap:js"]

Then, in this file:

/node_modules/lineman-angular/node_modules/grunt-angular-templates/tasks/lib/compiler.js

Comment out line 18:

var id = (options.prepend || '') + path.relative(options.base || '.', file).replace( /\\/g, '/');

And add the following on line 19:

console.log('file: '+file);
var id = file.split('/');
id = id[id.length-1];
##Use
Launch the website locally using "lineman run". To compile, use "lineman build".

Access the website at localhost:8000.

##Translations
Bounties for translations available here:

https://bitsharestalk.org/index.php?topic=11695.0

Translations accepted for bounties: Chinese, German, Spanish, Russian
Translations accepted for bounties: Russian
58 changes: 58 additions & 0 deletions app/components/about/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!-- Content Section -->
<section id="about">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="section-heading text-left">Bitshares</h1>
<p class="lead section-lead">"BitShares: The Future of Banking"</p>
<p class="section-paragraph">Bitshares is a Decentralized Autonomous Corporation that allows you to trade, sell or buy virtual assets that track the value of real-world items such as currencies (USD,EUR++) and physical assets (gold, silver++)</p>
<p>Bitshares uses a novel technology called Delegated Proof of Stake to secure the network without the wasteful mining inherent in Bitcoin and it's many clones. This delivers Bitshares from the heavy tax on the system imposed by miners, making Bitshares the first inherently profitable cryptocurrency.
</p>
</div>
</div>
</div>

<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="section-heading text-left">Links</h1>
<p class="lead section-lead">Official resources</p>
<p class="section-paragraph"><a href="http://www.bitsharestalk.org/" target="_blank">Bitsharestalk.org</a> : The official Bitshares forum</p>
<p class="section-paragraph"><a href="http://bitshares-x.info/" target="_blank">Bitshares-x.info</a> : The official Bitshares website</p>
<p class="section-paragraph"><a href="https://github.com/BitShares/bitshares/" target="_blank">Bitshares Github</a> : The official Bitshares github repo</p>
<p class="lead section-lead">Community sites</p>
<p class="section-paragraph"><a href="http://wiki.bitshares.org/index.php/Main_Page" target="_blank">The Bitshares Wiki</a> : The number one place to start learning about the Bitshares Universe!</p>
<p class="section-paragraph"><a href="http://beyondbitcoinx.net/" target="_blank">BeyondBitcoinX.net</a> : Bitshares Mumble server, Dev Hangouts, Delegates Info and more</p>
<p class="section-paragraph"><a href="http://www.bitsharesmarket.com/" target="_blank">Bitshares market</a> : Directory of Distributed Autonomous Companies in the BitShares Marketplace</p>
</div>
</div>
</div>

<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="section-heading text-left">About me</h1>
<p class="lead section-lead">Bitshares fanatic with a passion for development</p>
<p>I'm a young engineer who's passionate about cryptocurreny in general and Bitshares in particular. I've built this site with two goals:
<ul>
<li><strong>Provide a service to the community to support my bid to be an elected delegate</strong></li>
<li><strong>Teach myself Angularjs in order to one day transition into web development</strong></li>
</ul>
</p>
<p>
To support this site, please vote for my delegates:
<ul>
<li><a href="bts:dev.bitsharesblocks/approve">dev.bitsharesblocks</a></li>
</ul>
</p>
<p>I also accept donations to this account: <a href="bts:donations.bitsharesblocks/transfer">donations.bitsharesblocks</a></p>
<p>Questions, comments, suggestions, criticism and other feedback gladly accepted here: <a href="mailto:[email protected]">[email protected]</a></p>
</div>
<p>

</p>
</div>
</div>


</section>
148 changes: 148 additions & 0 deletions app/components/accounts/AccountsFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
angular.module('app')

.factory('Accounts', ['api','$q', 'Assets', function(api, $q, Assets) {
var _accounts = {};
_accounts[0] = 'MARKET';

function getAccountName(id) {
var deferred = $q.defer();
if (_accounts[id]) {
deferred.resolve(_accounts[id]);
}
else {
api.getAccountByNr(id).success(function (account) {
_accounts[id] = account.name;
deferred.resolve(account.name);
});
}
return deferred.promise;
}


function fetchAccounts(mostRecent, highestID, query) {
var deferred = $q.defer();

_getAccounts(mostRecent, highestID, query).then(function(result) {
result.accounts = wallOps(result.accounts);
deferred.resolve(result);
});

return deferred.promise;
}

function _getAccounts(mostRecent, highestID, query) {
var deferred = $q.defer();
if (query) {
api.searchAccounts(query).success(function(accounts) {
getAccountsCount().then(function(accountsCount) {
deferred.resolve({
accounts: accounts,
accountsCount: accountsCount
});
});
});
}
else if (mostRecent) {
api.getAccounts().success(function (accounts) {
deferred.resolve({
accounts: accounts,
accountsCount: parseInt(accounts[0]._id,10)
});
});
}
else {
api.getAccountsPage(highestID).success(function (accounts) {
getAccountsCount().then(function(accountsCount) {
deferred.resolve({
accounts: accounts,
accountsCount: accountsCount
});
});
});
}
return deferred.promise;
}

function _getAccount(name, id) {
var deferred = $q.defer();
var accounts = [];
if (name) {
api.getAccount(name).success(function (result) {
accounts.push(result);
deferred.resolve(accounts);
});
}
else if (id) {
api.getAccountByNr(id).success(function (result) {
accounts.push(result);
deferred.resolve(accounts);
});
}
return deferred.promise;
}

function fetchAccount(name, id) {
var deferred = $q.defer();
_getAccount(name, id).then(function(result) {
deferred.resolve(wallOps(result));
});
return deferred.promise;
}

function getAccountsCount() {
var deferred = $q.defer();
api.getAccountsCount().success(function(accountscount) {
deferred.resolve(parseInt(accountscount,10));
});
return deferred.promise;
}

function wallOps(accounts) {
// Sum burn operations for each account
accounts.forEach(function(account, index) {
account.totalBurn = {};
account.burnArray = [];
if (account.burn.length > 0) {
account.burn.forEach(function(burn,index) {
if (!account.totalBurn[burn.amount.asset_id]) {
account.totalBurn[burn.amount.asset_id] = 0;
}
burn.assetSymbol = Assets.getSymbol(burn.amount.asset_id);
burn.realAmount = burn.amount.amount / Assets.getPrecision(burn.amount.asset_id);
account.totalBurn[burn.amount.asset_id] += burn.realAmount;

});
for (var assetID in account.totalBurn) {
account.burnArray.push({
asset: Assets.getSymbol(assetID),
amount: account.totalBurn[assetID]
});
}
}
else {
account.burnArray.push({
asset: '',
amount: 0
});
}
});
return accounts;
}

function getBlockNumber(id) {
var deferred = $q.defer();
api.getBlockByTrx(id).success(function(result) {
console.log(result);
deferred.resolve(result._id);
});
return deferred.promise;
}

return {
getAccountName: getAccountName,
fetchAccounts: fetchAccounts,
fetchAccount: fetchAccount,
getBlockNumber: getBlockNumber
};

}]);
52 changes: 52 additions & 0 deletions app/components/accounts/allAccounts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<div class="input-group filters form-group col-md-4 col-md-offset-4 col-xs-6 col-xs-offset-3">
<form ng-submit="submitAccount(query)">
<input type="text" class="form-control" ng-model="query" data-min-length="0" ng-options="account.name for account in accountNames" placeholder="{{ 'accounts.search1' | translate }}" bs-typeahead analytics-on analytics-event="Account search" analytics-category="Search" analytics-label="Account" >
</form>
<div id="alerts-container"></div>
</div>


<div id="blockstable" class="col-md-10 col-md-offset-1">
<div class="input-group">
<form ng-submit="setOverview(lastBlock)">
<input class="form-control" type="text" ng-model="lastBlock" placeholder="{{ 'accounts.search2' | translate }}" analytics-on analytics-event="Account search" analytics-category="Search" analytics-label="Account search">
</form>
</div>
<pagination ng-change="changePage()" total-items="accountsCount" ng-model="currentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" items-per-page="pageCount" next-text="{{ 'accounts.older' | translate }}" previous-text="{{ 'accounts.newer' | translate }}" first-text="{{ 'accounts.recent' | translate }}" last-text="{{ 'accounts.oldest' | translate }}" num-pages="numPages" style="margin-bottom:0; margin-top:10px;"></pagination>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{ 'accounts.title' | translate }}</h3>
</div>
<div>
<table class="table table-condensed table-hover table-bordered" style="margin-bottom:0;">
<thead>
<tr>
<th>{{ 'accounts.name' | translate }}</th>
<th>{{ 'accounts.id' | translate }}</th>
<th>{{ 'accounts.reg' | translate }}</th>
<th class="hidden-xs">{{ 'accounts.update' | translate }}</th>
<th> {{ 'accounts.wall' | translate }} </th>
<th>{{ 'blocks.delegate' | translate }}</th>
</tr>
</thead>
<tbody >
<tr ng-repeat="account in accounts track by $index" class="repeated-item">
<td><a ui-sref="account({ 'name' : account.name })" >{{account.name}}</a></td>
<td>{{account._id}}</td>
<td>{{account.registration_date | date:'medium'}}</td>
<td class="hidden-xs">{{account.last_update | date:'medium'}}</td>
<td><span ng-repeat="value in account.burnArray"><p style="margin:0;padding:0;"><span ng-if="value.asset=='BTC' || value.asset=='GOLD'">{{value.amount | number:6}}</span><span ng-if="value.asset!=='BTC' && value.asset!=='GOLD'">{{value.amount | number:2}}</span> <span ng-if="value.asset==='BTS'"> {{ value.asset }}</span> <a ng-if="value.asset!=='BTS'" ui-sref="asset({ 'id' : value.asset})">{{value.asset}}</a></p></span></td>
<td class="success" ng-if="account.isDelegate===true">{{'accounts.yes' | translate}}</td>
<td ng-if="account.isDelegate===false">{{'accounts.no' | translate}}</td>

</tr>
</tbody>
</table>
</div>
</div>

<pagination ng-change="changePage()" total-items="accountsCount" ng-model="currentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" items-per-page="pageCount" next-text="{{ 'accounts.older' | translate }}" previous-text="{{ 'accounts.newer' | translate }}" first-text="{{ 'accounts.recent' | translate }}" last-text="{{ 'accounts.oldest' | translate }}" num-pages="numPages" style="margin-bottom:0; margin-top:10px;"></pagination>
</div>


Loading

0 comments on commit 4430d14

Please sign in to comment.