Skip to content

Commit

Permalink
broken fucking async directives..
Browse files Browse the repository at this point in the history
  • Loading branch information
SylTi committed Nov 29, 2014
1 parent ad102c2 commit a0c8d63
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 33 deletions.
12 changes: 10 additions & 2 deletions client/app/admin/admin.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ angular.module('bitCrowdFundsApp')

// Use the User $resource to fetch all users
$scope.message = '';

$scope.projects = [{}];
$scope.init = function ()
{
$scope.users = User.query(function ()
Expand All @@ -26,7 +26,10 @@ angular.module('bitCrowdFundsApp')
$scope.message = 'Something wrong happend';
});
});
$scope.projects = ProjectRes.query();
$scope.projects = ProjectRes.query(function (err)
{
$scope.$broadcast("Data_Ready");
});
};

$scope.isAdmin = function ()
Expand Down Expand Up @@ -96,4 +99,9 @@ angular.module('bitCrowdFundsApp')
$scope.message = 'Something wrong happend';
});
};

/*$scope.$watch('projects', function(projs)
{
//$scope.$digest();
});*/
});
46 changes: 23 additions & 23 deletions client/app/admin/admin.jade
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,29 @@ div(ng-include='"components/navbar/navbar.html"')
ul.list-group.well
tabset(justified='true', type="'pills'")
tab(heading='All').tabText.label-primary
//- adminProjectList(projects="projects")
li.list-group-item(ng-repeat='project in projects')
strong
span.label.label-success(ng-show="project.amountRaised >= project.amountToRaise") Finished
span.label.label-warning(ng-show="project.amountRaised !== 0 && project.amountRaised < project.amountToRaise") Ongoing
span.label.label-default(ng-show="project.amountRaised === 0") Not started
| &nbsp;&nbsp;
span {{project.name}} ({{project.amountRaised | toBTC}} / {{project.amountToRaise | toBTC}})
br
small.text-muted
span Project created
| &nbsp;
b(am-time-ago="project.dateCreat")
| &nbsp;
span and finishing
| &nbsp;
b(am-time-ago="project.dateEndCampaign")
.pull-right
a(ng-href='/projects/{{project.slug}}/edit')
span.glyphicon.glyphicon-pencil
| &nbsp;&nbsp;&nbsp;&nbsp;
a.trash(ng-click='deleteProject(project)')
span.glyphicon.glyphicon-trash
span(adminProjectList projects="projects")
//- li.list-group-item(ng-repeat='project in projects')
//- strong
//- span.label.label-success(ng-show="project.amountRaised >= project.amountToRaise") Finished
//- span.label.label-warning(ng-show="project.amountRaised !== 0 && project.amountRaised < project.amountToRaise") Ongoing
//- span.label.label-default(ng-show="project.amountRaised === 0") Not started
//- | &nbsp;&nbsp;
//- span {{project.name}} ({{project.amountRaised | toBTC}} / {{project.amountToRaise | toBTC}})
//- br
//- small.text-muted
//- span Project created
//- | &nbsp;
//- b(am-time-ago="project.dateCreat")
//- | &nbsp;
//- span and finishing
//- | &nbsp;
//- b(am-time-ago="project.dateEndCampaign")
//- .pull-right
//- a(ng-href='/projects/{{project.slug}}/edit')
//- span.glyphicon.glyphicon-pencil
//- | &nbsp;&nbsp;&nbsp;&nbsp;
//- a.trash(ng-click='deleteProject(project)')
//- span.glyphicon.glyphicon-trash
tab(heading='Not Started').label-default.tabText
li.list-group-item(ng-repeat='project in projects' ng-if='project.amountRaised === 0')
strong
Expand Down
24 changes: 20 additions & 4 deletions client/components/adminProjectList/adminProjectList.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@
angular.module('bitCrowdFundsApp')
.directive('adminProjectList', function () {
return {
templateUrl: 'components/adminProjectList/adminProjectList.html',
//templateUrl: 'components/adminProjectList/adminProjectList.html',
restrict: 'EA',
//replace: true,
//transclude: true,
//scope: true
scope: {
projects: '='
}/*,
link: function (scope, element, attrs)
},
//replace: true,
//transclude: true,
/*controller: function($scope)
{
$scope.$watch('projects', function(v) {
$scope.projects = v;
});
}*/
link: function(scope, element, attrs)
{
element.text('<div>shit</div>');
scope.$on("Data_Ready", function ()
{
element.text('<div>shit</div>');
});
}

};
});
10 changes: 6 additions & 4 deletions server/api/refund/refund.spec.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
'use strict';
/* jshint undef:false */

var should = require('should');
var app = require('../../app');
var request = require('supertest');
var User = require('../user/user.model.js');

describe('GET /api/refunds', function() {

it('should respond with JSON array', function(done) {
request(app)
.get('/api/refunds')
.expect(200)
.expect('Content-Type', /json/)
.expect(401)
.expect('Content-Type', 'text/html')
.end(function(err, res) {
if (err) return done(err);
res.body.should.be.instanceof(Array);
//res.body.should.be.instanceof(Array);
done();
});
});
});
});

0 comments on commit a0c8d63

Please sign in to comment.