Skip to content

Commit

Permalink
Update Issues page
Browse files Browse the repository at this point in the history
  • Loading branch information
andyl committed Jul 24, 2018
1 parent 7ce7129 commit 6716151
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
16 changes: 13 additions & 3 deletions exercise/intern/webapp/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@
# show one issue
get "/issues/:uuid" do
protected!
@issue = Issue.find_by_uuid(params['uuid'])
@events = Event.where("payload->>'exid' = ?", @issue.exid) || []
@offers = @issue.offers.open.without_branch_position
@issue = Issue.find_by_uuid(params['uuid'])
@contracts = @issue.contracts
@events = Event.where("payload->>'exid' = ?", @issue.exid) || []
@offers = @issue.offers.open.without_branch_position
slim :issue
end

Expand All @@ -88,6 +89,15 @@
slim :issues
end

get "/sync_now" do
protected!
script = File.expand_path("../script/issue_sync", __dir__)
job = fork {exec script}
Process.detach(job)
flash[:success] = "Issue sync has started - estimated finish in 60 seconds..."
redirect "/issues"
end

# render a dynamic SVG for the issues
get '/badge_ex/*' do |issue_exid|
content_type 'image/svg+xml'
Expand Down
7 changes: 5 additions & 2 deletions exercise/intern/webapp/views/issue.slim
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ css:
ul.nav.nav-tabs#xTab[role="tablist"]
li.nav-item
a.nav-link.active#offers-tab[data-toggle="tab" href="#offers" role="tab"] Open Offers
li.nav-item
a.nav-link#contracts-tab[data-toggle="tab" href="#contracts" role="tab"] Contracts
li.nav-item
a.nav-link#history-tab[data-toggle="tab" href="#history" role="tab"] Sync History

Expand All @@ -59,7 +61,6 @@ ul.nav.nav-tabs#xTab[role="tablist"]
th Payout
th Maturation
th
th Resolution
th
tbody
- @offers.each do |offer|
Expand All @@ -72,11 +73,13 @@ ul.nav.nav-tabs#xTab[role="tablist"]
td == offer_maturation_date(offer)
td
i.fa.fa-calendar-times.exDate[title="offer expires<br/>#{offer_expiration_date(offer)}"]
td == offer_awardee(offer)
td
- if offer.user.uuid == current_user.uuid && offer.is_open?
a.cancelOffer[href="/offer_cancel/#{offer.uuid}"]
i.fa.fa-window-close-o
.tab-pane.fade#contracts[role="tabpanel"]
p Num Contracts: #{@contracts.count}
p Num Open Contracts: #{@contracts.open.count}
.tab-pane.fade#history[role="tabpanel"]
table.table.table-sm
thead
Expand Down
5 changes: 4 additions & 1 deletion exercise/intern/webapp/views/issues.slim
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ table.table#xtable
.row
.col-md-12.text-center
small <b>*</b> issues where you have an offer or contract
br
small
a[href="/sync_now"] Sync issues now

- content_for :page_js do
coffee:
table = $('#xtable').DataTable();
table = $('#xtable').DataTable(stateSave: true);
# table = $('#xtable').DataTable({
# "lengthMenu": [[-1, 50 100 200], ["All", 50, 100, 200]]
# });
Expand Down

0 comments on commit 6716151

Please sign in to comment.