Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Multi-CI UI #406

Merged
merged 3 commits into from May 27, 2015
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
107 changes: 107 additions & 0 deletions app/assets/stylesheets/_pages/_commits.scss
Expand Up @@ -127,14 +127,121 @@
// -----------------------------------------------------------------------------

.status-group {
position: relative;
.status-items {
display: none;
position: absolute;
min-width: 20rem;
left: 2.25rem;
top: 0.25rem;
background: white;
border-radius: 3px;
border: 1px solid #ddd;
box-shadow: rgba(black, 0.1) 0 1px 5px;
}
&:hover .status-items {
display: block;
}
}

.status-summary, .status-item {
height: 1rem;
white-space: nowrap;
line-height: 1rem;
padding: 0.5rem;
span, strong, a {
display: inline-block;
vertical-align: top;
}
}

.status-summary {
font-weight: bold;
position: relative;
font-size: 0.9rem;
&:before, &:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
top: 50%;
margin-top: -7px;
border: 7px outset transparent;
}

&:before {
border-right: 7px solid #ddd;
left: -13px;
}

&:after {
border-right: 7px solid white;
left: -12px;
}
.status__icon {
display: inline-block;
width: 1rem;
height: 1rem;
background: asset-data-url("unknown.svg") center center no-repeat;
background-size: 90% 90%;
}
}

.status-item {
border-top: 1px solid #ddd !important;
background: #f5f5f5;
font-size: 0.8rem;
overflow: hidden;
&:last-child {
border-radius: 0 0 2px 2px;
}
.status__icon {
display: inline-block;
width: 1rem;
height: 1rem;
background: asset-data-url("unknown.svg") center center no-repeat;
background-size: 75% 75%;
}
a {
float: right;
}
}

.status-item.status--pending {
.status__icon {
background-image: none;
position: relative;
&:after {
content: "";
width: 6px;
height: 6px;
background: #ccc;
border-radius: 3px;
display: block;
position: absolute;
top: 50%;
left: 50%;
margin: -3px 0 0 -3px;
}
}
strong {
color: #999;
}
}

.status-item.status--success strong {
color: $green;
}
.status-item.status--failure, .status-item.status--error {
.status__icon {
background-size: 100% 100%;
}
strong {
color: $red;
}
}

.status {
flex-shrink: 0;

Expand Down
4 changes: 4 additions & 0 deletions app/models/status.rb
Expand Up @@ -22,6 +22,10 @@ def self.replicate_from_github!(github_status)
)
end

def group?
false
end

private

def enable_ci_on_stack
Expand Down
4 changes: 4 additions & 0 deletions app/models/status_group.rb
Expand Up @@ -24,6 +24,10 @@ def to_partial_path
'statuses/group'
end

def group?
true
end

private

def find_main_status
Expand Down
4 changes: 4 additions & 0 deletions app/models/unknown_status.rb
Expand Up @@ -25,6 +25,10 @@ def failure?
false
end

def group?
false
end

def target_url
nil
end
Expand Down
7 changes: 6 additions & 1 deletion app/views/statuses/_group.html.erb
Expand Up @@ -2,8 +2,13 @@
<%= render 'statuses/status', status: group %>

<div class="status-items">
<div class="status-summary status--<%= group.state %>">
<i class="status__icon"></i>
<span><%= group.description %></span>
</div>
<% group.statuses.each do |status| %>
<div class="status-item <%= status.state %>">
<div class="status-item status--<%= status.state %>">
<i class="status__icon"></i>
<strong><%= status.context %></strong>
<span><%= status.description %></span>
<a href="<%= status.target_url %>" target="_blank">Details</a>
Expand Down
2 changes: 1 addition & 1 deletion app/views/statuses/_status.html.erb
@@ -1,4 +1,4 @@
<a class="status status--<%= status.state %> <%= :disabled unless status.target_url.present? %>" data-tooltip="<%= status.description.presence || status.state.capitalize %>" href="<%= status.target_url%>" target="_blank">
<a class="status status--<%= status.state %> <%= :disabled unless status.target_url.present? %>" <% unless status.group? %>data-tooltip="<%= status.description.presence || status.state.capitalize %>"<% end %> href="<%= status.target_url%>" target="_blank">
Copy link
Member

Choose a reason for hiding this comment

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

There is a lot of logic on this line. Maybe it is worth to extract it.

<i class="status__icon"></i>
<span class="visually-hidden"><%= status.state %></span>
</a>