Skip to content

Commit

Permalink
add organization_name and backlog info to website api response
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwoldatwork authored Apr 11, 2023
2 parents fdfc59d + 4923363 commit 4392cc5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
4 changes: 4 additions & 0 deletions app/models/website.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ def tld?
domain.split('.').size == 2
end

def organization_name
organization ? organization.name : nil
end

def login_supported
return false if self.authentication_tool == nil
return false if self.authentication_tool == ""
Expand Down
4 changes: 4 additions & 0 deletions app/serializers/website_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class WebsiteSerializer < ActiveModel::Serializer
attributes :id,
:domain,
:organization_id,
:organization_name,
:parent_domain,
:office,
# :office_id,
Expand All @@ -27,6 +29,8 @@ class WebsiteSerializer < ActiveModel::Serializer
:uses_feedback,
:feedback_tool,
:sitemap_url,
:backlog_tool,
:backlog_url,
:mobile_friendly,
:has_search,
:uses_tracking_cookies,
Expand Down
32 changes: 23 additions & 9 deletions app/views/admin/websites/_step_indicator.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="border border-base-lighter padding-2 margin-bottom-2">
<div class="border border-base-lighter padding-2 padding-bottom-0 margin-bottom-2">

<div class="font-sans-sm margin-bottom-1">
Publication status:
Expand Down Expand Up @@ -47,27 +47,32 @@
<div class="usa-step-indicator" aria-label="progress">
<ol class="usa-step-indicator__segments">
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--complete" if website.submitted? || website.published? %>
<%= "usa-step-indicator__segment--complete" if website.submitted? || website.published? || website.archived? %>
<%= "usa-step-indicator__segment--current" if website.created? %>"
aria-current="true">
<span class="usa-step-indicator__segment-label">Created</span>
</li>
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--complete" if website.published? %>
<%= "usa-step-indicator__segment--complete" if website.published? || website.archived? %>
<%= "usa-step-indicator__segment--current" if website.submitted? %>" aria-current="true">
<span class="usa-step-indicator__segment-label">Submitted</span>
</li>
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--complete" if website.published? %>
<%= "usa-step-indicator__segment--complete" if website.published? || website.archived? %>
<%= "usa-step-indicator__segment--current" if website.published? %>" aria-current="true">
<span class="usa-step-indicator__segment-label">Published</span>
</li>
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--complete" if website.archived? %>
<%= "usa-step-indicator__segment--current" if website.archived? %>" aria-current="true">
<span class="usa-step-indicator__segment-label">Archived</span>
</li>
</ol>
</div>
</div>


<div class="border border-base-lighter padding-2 margin-bottom-2">
<div class="border border-base-lighter padding-2 padding-bottom-0 margin-bottom-2">

<div class="font-sans-sm margin-bottom-1">
Website lifecycle status:
Expand Down Expand Up @@ -116,19 +121,28 @@
<div class="usa-step-indicator" aria-label="progress">
<ol class="usa-step-indicator__segments">
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--complete" if website.staging? || website.production? || website.redirect? || website.archived? || website.decommissioned? %>
<%= "usa-step-indicator__segment--complete" if website.staging? || website.production? || website.redirect? || website.decommissioned? %>
<%= "usa-step-indicator__segment--current" if website.in_development? %>"
aria-current="true">
<span class="usa-step-indicator__segment-label">In development</span>
</li>
<li class="usa-step-indicator__segment <%= "usa-step-indicator__segment--complete" if website.production? || website.decommissioned? %> <%= "usa-step-indicator__segment--current" if website.staging? %>" aria-current="true">
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--complete" if website.production? || website.decommissioned? || website.redirect? %>
<%= "usa-step-indicator__segment--current" if website.staging? %>" aria-current="true">
<span class="usa-step-indicator__segment-label">Staging</span>
</li>
<li class="usa-step-indicator__segment <%= "usa-step-indicator__segment--complete" if website.redirect? || website.archived? || website.decommissioned? %> <%= "usa-step-indicator__segment--current" if website.production? %>" aria-current="true">
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--complete" if website.redirect? || website.decommissioned? %>
<%= "usa-step-indicator__segment--current" if website.production? %>" aria-current="true">
<span class="usa-step-indicator__segment-label">Production</span>
</li>
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--current" if website.archived? || website.decommissioned? %>" aria-current="true">
<%= "usa-step-indicator__segment--complete" if website.redirect? || website.decommissioned? %>
<%= "usa-step-indicator__segment--current" if website.redirect? %>" aria-current="true">
<span class="usa-step-indicator__segment-label">Redirect</span>
</li>
<li class="usa-step-indicator__segment
<%= "usa-step-indicator__segment--current" if website.decommissioned? %>" aria-current="true">
<span class="usa-step-indicator__segment-label">Decommissioned</span>
</li>
</ol>
Expand Down
6 changes: 6 additions & 0 deletions spec/controllers/api/v1/websites_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
expect(@parsed_response['data'].size).to eq(2)
expect(@parsed_response['data'].first.class).to be(Hash)
expect(@parsed_response['data'].first['type']).to eq("websites")

expect(@parsed_response['data'].first['attributes'].keys).to include("domain")
expect(@parsed_response['data'].first['attributes'].keys).to include("organization_id")
expect(@parsed_response['data'].first['attributes'].keys).to include("organization_name")
expect(@parsed_response['data'].first['attributes'].keys).to include("backlog_tool")
expect(@parsed_response['data'].first['attributes'].keys).to include("backlog_url")
end
end
end
Expand Down

0 comments on commit 4392cc5

Please sign in to comment.