Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added changeitem and finish change page
- Loading branch information
Showing
9 changed files
with
152 additions
and
4 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 |
---|---|---|
@@ -1 +1,4 @@ | ||
h1 changes | ||
md-list.changes-list | ||
md-subheader.md-no-sticky Latest changes | ||
md-divider | ||
change-item(change="change", ng-repeat="change in changes.list") |
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class Changes extends Controller | ||
constructor: () -> | ||
constructor: ($scope, dataService) -> | ||
opened = dataService.open() | ||
opened.closeOnDestroy($scope) | ||
@list = opened.getChanges(limit: 40, order: '-when_timestamp').getArray() |
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
37 changes: 37 additions & 0 deletions
37
www/md_base/src/app/common/directives/changeitem/changeitem.directive.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,37 @@ | ||
class ChangeItem extends Directive | ||
|
||
constructor: -> | ||
return { | ||
restrict: 'E' | ||
templateUrl: 'views/changeitem.html' | ||
controller: '_ChangeItemController' | ||
controllerAs: 'changeitem' | ||
bindToController: true | ||
scope: | ||
change: "=" | ||
} | ||
|
||
class _ChangeItem extends Controller | ||
showDetail: false | ||
|
||
toggleDetail: -> | ||
@showDetail = !@showDetail | ||
|
||
constructor: (dataService) -> | ||
@author = @change.author | ||
@revision = @change.revision[0...6] | ||
@comments = @change.comments | ||
@date = @change.when_timestamp | ||
@files = @change.files | ||
|
||
# Official W3C email regular expression | ||
emailRegex = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/ | ||
email = emailRegex.exec @author | ||
|
||
@email = email[0] if email | ||
|
||
@displayData = | ||
'Repository': @change.repository | ||
'Branch': @change.branch | ||
'Revision': @change.revision | ||
|
80 changes: 80 additions & 0 deletions
80
www/md_base/src/app/common/directives/changeitem/changeitem.less
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,80 @@ | ||
change-item { | ||
display: block; | ||
padding: 5px; | ||
|
||
.inner { | ||
line-height: 30px; | ||
font-size: 16px; | ||
color: #999; | ||
|
||
span { | ||
padding: 0 5px; | ||
} | ||
} | ||
|
||
.author { | ||
height: 20px; | ||
width: 20px; | ||
overflow: hidden; | ||
border-radius: 50%; | ||
margin: 5px; | ||
|
||
img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
} | ||
|
||
.comments { | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
outline: none; | ||
} | ||
|
||
.revision { | ||
width: 80px; | ||
text-align: right; | ||
font-family: monospace; | ||
color: #666; | ||
} | ||
|
||
.detail { | ||
color: #666; | ||
margin-left: 30px; | ||
padding: 10px 0; | ||
|
||
&>div { | ||
border-bottom: 1px solid #eee; | ||
padding-bottom: 10px; | ||
} | ||
} | ||
|
||
.sub-title { | ||
margin: 10px 0; | ||
text-transform: uppercase; | ||
font-size: 12px; | ||
font-weight: bold; | ||
} | ||
|
||
.meta { | ||
.author-name { | ||
font-weight: bold; | ||
} | ||
|
||
.time { | ||
float: right; | ||
} | ||
} | ||
|
||
.full-comment { | ||
|
||
.content { | ||
white-space: pre-wrap; | ||
} | ||
} | ||
|
||
.changed-files { | ||
|
||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
www/md_base/src/app/common/directives/changeitem/changeitem.spec.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 @@ | ||
beforeEach module 'app' | ||
|
||
describe 'changeitem', -> |
18 changes: 18 additions & 0 deletions
18
www/md_base/src/app/common/directives/changeitem/changeitem.tpl.jade
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,18 @@ | ||
div.inner(layout="row") | ||
a.author(title="{{ changeitem.author }}", ng-href="mailto:{{ changeitem.email }}") | ||
img(ng-if="changeitem.email", ng-src="avatar?email={{ changeitem.email }}") | ||
a.comments(flex, ng-click="changeitem.toggleDetail()") {{ changeitem.comments }} | ||
span.revision {{ changeitem.revision }} | ||
div.detail(ng-if="changeitem.showDetail") | ||
div.meta | ||
span.time(am-time-ago="changeitem.date", title="{{ changeitem.date|amCalendar }}") | ||
span.author-name {{ changeitem.author }} | ||
div.full-comment | ||
div.sub-title Comments | ||
div.content {{ changeitem.comments}} | ||
div.changed-files(ng-if="changeitem.files.length > 0") | ||
div.sub-title Changed files | ||
div.file-line(ng-repeat="file in changeitem.files") {{ file }} | ||
|
||
inspect-data(data="changeitem.displayData") | ||
|