Skip to content

Commit

Permalink
Add tag to gem show page if adoption is present
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalkr132 committed Feb 13, 2019
1 parent 03c6ca1 commit b36f01d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
20 changes: 20 additions & 0 deletions app/assets/stylesheets/modules/shared.css
Expand Up @@ -164,3 +164,23 @@ span#github-btn {
margin-bottom: 15px;
margin-top: 5px;
}

.adoption-tag {
display: inline-block;
font-size: 0.4em;
font-weight: 800;
color: #e9573f;
border: 1px solid #e9573f;
border-radius: 8px;
padding: 0.25em 1em;
margin-left: 0.75em;
vertical-align: 0.3em;
transition: color 0.25s ease-in,
background-color 0.25s ease-in,
transform 0.3s ease-out;
}

.adoption-tag:hover{
color: white;
background-color: #e9573f;
}
6 changes: 5 additions & 1 deletion app/views/layouts/application.html.erb
Expand Up @@ -108,7 +108,11 @@
<%= link_to @title, @title_url, class: "t-link--black" %>
<% if @subtitle %>
<i class="page__subheading"><%= @subtitle.html_safe %></i>
<i class="page__subheading"><%= @subtitle.html_safe %>
<% if @adoption %>
<%= link_to "adoption", rubygem_adoption_path(@rubygem), class: "adoption-tag" %>
<% end %>
</i>
<% end %>
</h1>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/profiles/adoptions.html.erb
Expand Up @@ -3,11 +3,11 @@
<div class="l-overflow">
<div class="l-colspan--l">
<%= render layout: "adoptions/list", locals: { adoptions: @adoptions, heading: t(".open_adoptions") } do |adoption| %>
<%= link_to adoption.rubygem.name, rubygem_path(adoption.rubygem.name), class: "t-link--black t-list__item" %>
<%= link_to adoption.rubygem.name, rubygem_adoption_path(adoption.rubygem), class: "t-link--black t-list__item" %>
<% end %>
<%= render layout: "adoption_requests/list", locals: { adoption_requests: @adoption_requests, heading: t(".requested_adoptions") } do |adoption_request| %>
<%= link_to adoption_request.rubygem.name, rubygem_path(adoption_request.rubygem.name), class: "t-link--black t-list__item" %>
<%= link_to adoption_request.rubygem.name, rubygem_adoption_path(adoption_request.rubygem), class: "t-link--black t-list__item" %>
<% end %>
</div>
</div>
1 change: 1 addition & 0 deletions app/views/rubygems/show.html.erb
@@ -1,5 +1,6 @@
<% @title = @rubygem.name %>
<% @subtitle = @latest_version.try(:slug) %>
<% @adoption = @rubygem.adoptions.any? %>
<% content_for :head do %>
<%= auto_discovery_link_tag(:atom, rubygem_versions_path(@rubygem, format: "atom"), {title: "#{@rubygem.name} Version Feed"}) %>
Expand Down
1 change: 1 addition & 0 deletions test/integration/adoptions_test.rb
Expand Up @@ -33,6 +33,7 @@ class AdoptionsTest < SystemTest

assert page.has_content? "example note"
assert page.has_selector? "#flash_success", text: "#{@rubygem.name} has been put up for adoption"
assert page.has_selector? ".adoption-tag"
end

test "requesting adoption" do
Expand Down

0 comments on commit b36f01d

Please sign in to comment.