Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Action items -> Needs attention auctions #987

Merged
merged 1 commit into from
Aug 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions app/controllers/admin/action_items_controller.rb

This file was deleted.

5 changes: 5 additions & 0 deletions app/controllers/admin/auctions/needs_attention_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Admin::Auctions::NeedsAttentionController < Admin::BaseController
def index
@view_model = Admin::NeedsAttentionAuctionsViewModel.new
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jessieay should these be renamed, too? to something like Admin::Auctions::NeedsAttentionViewModel?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I did not do that for the other controller but probably makes sense. If you do it, mind also renaming https://github.com/18F/micropurchase/blob/develop/app/view_models/admin/closed_auctions_list_item_view_model.rb ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problemo

On Tuesday, August 2, 2016, Jessie A. Young notifications@github.com
wrote:

In app/controllers/admin/auctions/needs_attention_controller.rb
#987 (comment):

@@ -0,0 +1,5 @@
+class Admin::Auctions::NeedsAttentionController < Admin::BaseController

  • def index
  • @view_model = Admin::NeedsAttentionAuctionsViewModel.new

yeah I did not do that for the other controller but probably makes sense.
If you do it, mind also renaming
https://github.com/18F/micropurchase/blob/develop/app/view_models/admin/closed_auctions_list_item_view_model.rb
?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/18F/micropurchase/pull/987/files/358f90120da907053c6e0f39e7bb1291c42e3871#r73193822,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAFTBq1aEURip_BsNYXiyMvoot6JZj8Yks5qb3ZNgaJpZM4JatzG
.

end
end
2 changes: 1 addition & 1 deletion app/controllers/authentications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def auth_hash

def redirect_back_or_root_path
if Admins.verify?(current_user.github_id)
redirect_to(return_to || admin_action_items_path)
redirect_to(return_to || admin_auctions_needs_attention_path)
else
redirect_to(return_to || root_path)
end
Expand Down
2 changes: 1 addition & 1 deletion app/view_models/admin/base_view_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def drafts_nav_class
''
end

def action_items_nav_class
def needs_attention_auctions_nav_class
''
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Admin::ActionItemListItem < Admin::BaseViewModel
class Admin::NeedsAttentionAuctionListItem < Admin::BaseViewModel
attr_reader :auction

def initialize(auction)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Admin::ActionItemsViewModel < Admin::BaseViewModel
def action_items_nav_class
class Admin::NeedsAttentionAuctionsViewModel < Admin::BaseViewModel
def needs_attention_auctions_nav_class
'usa-current'
end

Expand All @@ -26,6 +26,6 @@ def rejected
private

def list_items(auctions)
auctions.map { |auction| Admin::ActionItemListItem.new(auction) }
auctions.map { |auction| Admin::NeedsAttentionAuctionListItem.new(auction) }
end
end
2 changes: 1 addition & 1 deletion app/views/admin/_auctions_subnav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<nav class="site-nav-secondary">
<ul>
<li><%= link_to 'All', admin_auctions_path, class: view_model.auctions_nav_class %></li>
<li><%= link_to 'Action Items', admin_action_items_path, class: view_model.action_items_nav_class %></li>
<li><%= link_to 'Needs Attention', admin_auctions_needs_attention_path, class: view_model.needs_attention_auctions_nav_class %></li>
<li><%= link_to 'Draft Auctions', admin_drafts_path, class: view_model.drafts_nav_class %></li>
<li><%= link_to 'Closed', admin_auctions_closed_path, class: view_model.closed_auctions_nav_class %></li>
<li class='new-button'>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
namespace :admin do
resources :auction_reports, only: [:show]
resources :user_reports, only: [:index]
resources :action_items, only: [:index]
resources :drafts, only: [:index]
resources :proposals, only: [:create]
resources :users, only: [:show, :edit, :update]

namespace :auctions do
get '/closed', to: 'closed#index'
get '/needs_attention', to: 'needs_attention#index'
end

resources :auctions
Expand Down
2 changes: 1 addition & 1 deletion features/admin_signs_in.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Feature: Admin signs in
Scenario: Admin signs in
Given I am an administrator
And I sign in
Then I should be on the admin action items page
Then I should be on the admin needs attention auctions page
16 changes: 8 additions & 8 deletions features/admin_views_action_items.feature
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Feature: Admin view action items
Feature: Admin view needs attention auctions
As an admin
I want to see the action items dashboard
I want to see the needs attention auctions dashboard
So I can tell what actions I might need to take

Background:
Given I am an administrator
And I sign in

Scenario: Viewing the action items dashboard
Scenario: Viewing the needs attention auctions dashboard
Given there is a complete and successful auction
And there is also an unpublished auction
When I visit the admin action items page
When I visit the admin needs attention auctions page
Then I should see the name of the auction
And I should see the edit link for the auction

Expand All @@ -21,10 +21,10 @@ Feature: Admin view action items

Scenario: Viewing rejected auction
Given there is a rejected auction
When I visit the admin action items page
Then I should see the rejected auction as an action item
When I visit the admin needs attention auctions page
Then I should see the rejected auction as a needs attention auction

Scenario: Viewing rejected auction with no bids
Given there is a rejected auction with no bids
When I visit the admin action items page
Then I should see the rejected auction as an action item
When I visit the admin needs attention auctions page
Then I should see the rejected auction as a needs attention auction
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Then(/^I should see the rejected auction as an action item$/) do
auction = Admin::ActionItemListItem.new(@auction)
Then(/^I should see the rejected auction as a needs attention auction$/) do
auction = Admin::NeedsAttentionAuctionListItem.new(@auction)

['Title', 'Delivery Deadline', 'Delivery URL', 'Vendor Name', 'Rejected At'].each_with_index do |header, i|
within(:xpath, th_xpath(table_id: 'table-rejected', column: i + 1)) do
Expand Down
8 changes: 4 additions & 4 deletions features/step_definitions/navigation_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
visit edit_admin_auction_path(@auction)
end

When(/^I visit the admin action items page$/) do
visit admin_action_items_path
When(/^I visit the admin needs attention auctions page$/) do
visit admin_auctions_needs_attention_path
end

When(/^I visit the admin drafts page$/) do
Expand Down Expand Up @@ -118,8 +118,8 @@
expect(page.current_path).to eq(sign_up_path)
end

When(/^I should be on the admin action items page$/) do
expect(page.current_path).to eq admin_action_items_path
When(/^I should be on the admin needs attention auctions page$/) do
expect(page.current_path).to eq admin_auctions_needs_attention_path
end

When(/^I should be on the admin admins page$/) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'rails_helper'

describe Admin::ActionItemListItem do
describe Admin::NeedsAttentionAuctionListItem do
describe '#c2_proposal_url' do
context 'auction for default purchase card' do
it 'returns c2 proposal URL' do
auction = create(:auction, purchase_card: :default)

view_model = Admin::ActionItemListItem.new(auction)
view_model = Admin::NeedsAttentionAuctionListItem.new(auction)

expect(view_model.c2_proposal_url).to eq auction.c2_proposal_url
end
Expand All @@ -16,7 +16,7 @@
it 'returns n/a' do
auction = create(:auction, purchase_card: :other)

view_model = Admin::ActionItemListItem.new(auction)
view_model = Admin::NeedsAttentionAuctionListItem.new(auction)

expect(view_model.c2_proposal_url).to eq 'N/A'
end
Expand Down