Skip to content

Commit

Permalink
basic displaying of builditem
Browse files Browse the repository at this point in the history
  • Loading branch information
shanzi committed Jun 1, 2015
1 parent 05b8bb9 commit 379cae6
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 1 deletion.
1 change: 1 addition & 0 deletions www/md_base/src/app/app.module.coffee
Expand Up @@ -4,6 +4,7 @@ angular.module 'app', [
'ngMaterial',
'ui.router',
'ng-sortable',
'angularMoment',
]
.config ($mdThemingProvider) ->
$mdThemingProvider.theme('default')
Expand Down
@@ -0,0 +1,24 @@
class BuildItem extends Directive

constructor: ->
return {
restrict: 'E'
templateUrl: 'views/builditem.html'
controller: '_BuildItemController'
controllerAs: 'builditem'
bindToController: true
scope:
build: '='
outBuilder: '=builder'
showBuilder: '='
}

class _BuildItem extends Controller
constructor: (buildbotService) ->
if @outBuilder
@builder = outBuilder
else if @showBuilder
buildbotService.one('builders', @build.builderid).get().then (data) =>
@builder = data


25 changes: 25 additions & 0 deletions www/md_base/src/app/common/directives/builditem/builditem.less
@@ -0,0 +1,25 @@
build-item {
display: block;
margin: 5px 0;
padding: 5px;
background: rgba(0, 0, 0, 0.05);

.inner {
line-height: 30px;
font-size: 16px;
color: #999;

span {
padding: 0 5px;
}
}

.builder-name {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 20%;
min-width: 100px;
border-right: 1px solid #ddd;
}
}
@@ -0,0 +1,12 @@
beforeEach module 'app'

describe 'panel', ->

$rootScope = $compile = null

injected = ($injector) ->
$compile = $injector.get('$compile')
$rootScope = $injector.get('$rootScope')

beforeEach inject injected

@@ -0,0 +1,5 @@
div.inner(layout="row")
build-status(build="builditem.build")
span.builder-name(ng-if="builditem.showBuilder") {{ builditem.builder.name }}
span.number(flex) \#{{ builditem.build.number }}
span.time(am-time-ago="builditem.build.started_at", am-preprocess="unix")
Expand Up @@ -10,6 +10,7 @@ class RecentBuilds extends Directive
}

class _RecentBuilds extends Controller
showBuilders: true
builds: []
constructor: ($scope, buildbotService) ->
buildbotService.all('builds').getList(
Expand Down
@@ -1,2 +1,2 @@
div.build(ng-repeat="build in recent.builds")
build-status(build="build")
build-item(build="build", show-builder="recent.showBuilders")

0 comments on commit 379cae6

Please sign in to comment.