Skip to content

Commit

Permalink
Merge pull request #179 from xsoameix/feature/steps-bar-of-bill-coverage
Browse files Browse the repository at this point in the history
Not found bill supported.
  • Loading branch information
clkao committed Aug 25, 2014
2 parents 79ce484 + e8261c2 commit db5fa7b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/bills.ls
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,13 @@ angular.module 'app.controllers.bills' <[ly.diff ly.spy]>
$scope.diffs = []
$scope.opts = {+show_date}
$scope.spies = {}
$scope.found = 'unknown'
$scope.$watch '$state.params.billId' ->
{billId} = $state.params
{committee}:bill <- LYModel.get "bills/#{billId}" .success
{bill-id} = $state.params
req = LYModel.get "bills/#{bill-id}"
req.error -> $scope.found = 'no'
{committee}:bill <- req.success
$scope.found = 'yes'
$state.current.title = "國會大代誌 - #{bill.bill_ref || bill.bill_id} - #{bill.summary}"

if bill.bill_ref #legislative
Expand Down
8 changes: 7 additions & 1 deletion app/partials/bills.jade
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@
.column(ng-repeat="version in bill_refs")
.ui.pointing.label.diff-comment(ng-bind="versions[version].comment", ng-show="versions[version].comment")

.bill
.bill(ng-if="found == 'no'")
h1 您要找的提案不在喔!
h2
| 或許您可以到
a(href="/bills") 這邊
| 看看?
.bill(ng-if="found == 'yes'")
.basic-info
.bill-meta
.links.ui.tiered.menu
Expand Down
13 changes: 13 additions & 0 deletions test/unit/bill.spec.ls
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ describe 'bills' ->
$http-backend.when 'GET', ly_api "/ttsmotions?q=%7B%22bill_refs%22:%7B%22$contains%22:%22#{bill.ref}%22%7D%7D&s=%7B%22date%22:-1%7D"
.respond -> [200, cassette['ttsmotions']]
controller = create-controller!
$scope.found.should.eq 'unknown'
$http-backend.flush!
snapshot = get_snapshot bill
$scope.found.should.eq 'yes'
$scope.steps.should.deep.eq snapshot['steps']

it 'bill not found' ->
bill = id: '沒有人' ref: '是萬能的'
$location.path "/bills/#{bill.ref}"
$state.params.bill-id = bill.ref
$http-backend.when 'GET', ly_api "/bills/#{bill.ref}"
.respond -> [404, '']
controller = create-controller!
$scope.found.should.eq 'unknown'
$http-backend.flush!
$scope.found.should.eq 'no'

0 comments on commit db5fa7b

Please sign in to comment.