Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
explore: improved user interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vitoravelino committed Sep 6, 2017
1 parent 274c090 commit 9d6cc25
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 67 deletions.
3 changes: 0 additions & 3 deletions app/assets/stylesheets/components/layout.scss
Expand Up @@ -89,9 +89,6 @@ body.login {
.forgot-password {
text-align: right;
}
h2 {
color: $white
}
}

body:not([class*="login"]) {
Expand Down
29 changes: 0 additions & 29 deletions app/assets/stylesheets/components/repositories.scss

This file was deleted.

30 changes: 30 additions & 0 deletions app/assets/stylesheets/pages/explore.scss
@@ -0,0 +1,30 @@
.explore {
h2 {
color: $white;
margin-bottom: 15px;
}

.result-list {
list-style-type: none;
padding: 0;
}

.result-item {
background: rgba(255, 255, 255, 0.7);
border-radius: 5px;
margin-bottom: 10px;
padding: 15px;
}

.result-item-name {
margin-top: 0;
}

.result-item-stars {
line-height: 23px; // 18 height + 5 diff between fonts

.fa-star {
color: $primary-colour;
}
}
}
2 changes: 1 addition & 1 deletion app/controllers/explore_controller.rb
Expand Up @@ -16,7 +16,7 @@ def index

if @current
repository = @current.split(":").first
@repositories = policy_scope(Repository).search(repository)
@repositories = policy_scope(Repository).includes(:stars).search(repository)
else
@repositories = []
end
Expand Down
25 changes: 6 additions & 19 deletions app/views/explore/index.slim
@@ -1,20 +1,7 @@
section.row-0
.center-panel
.col-md-4.col-sm-2.col-xs-1
.col-md-4.col-sm-8.col-xs-10.text-center
= render 'shared/notifications'
= image_tag 'layout/portus-logo-login-page.png', class: 'login-picture'

= form_for(:explore, method: "GET") do |f|
= f.text_field :search, class: 'input form-control input-lg first', placeholder: "Repository", autofocus: true, required: true, value: @current
= f.button "Search", id: "login-btn", class: 'classbutton btn btn-primary btn-block btn-lg'

.text-center = link_to 'Go back to the login page', new_user_session_path, class: 'btn btn-link'

- if @repositories.any?
.text-left
h2
| Search results
ul.repository
- @repositories.each do |r|
= render r
.center-panel.explore
.col-md-4.col-sm-3.col-xs-1
.col-md-4.col-sm-6.col-xs-10.text-center
= render 'explore/partials/top'
= render 'explore/partials/form'
= render 'explore/partials/result'
4 changes: 4 additions & 0 deletions app/views/explore/partials/_form.html.slim
@@ -0,0 +1,4 @@
= form_for(:explore, method: "GET") do |f|
= f.text_field :search, class: 'input form-control input-lg first', placeholder: "Repository", autofocus: true, required: true, value: @current

= f.button "Search", type: "submit", id: "login-btn", class: 'classbutton btn btn-primary btn-block btn-lg'
10 changes: 10 additions & 0 deletions app/views/explore/partials/_result.html.slim
@@ -0,0 +1,10 @@
- if @repositories.any?
h2
- repo_count = @repositories.count
| #{pluralize(repo_count, 'repository')} #{repo_count == 1 ? "was" : "were"} found
ul.result-list
- @repositories.each do |r|
= render partial: 'explore/partials/result_item', locals: { repository: r }

- if params[:explore] && !@repositories.any?
h2 Your search did not match any repositories.
18 changes: 18 additions & 0 deletions app/views/explore/partials/_result_item.slim
@@ -0,0 +1,18 @@
li.result-item.text-left
.clearfix
h4.result-item-name.pull-left
= repository.full_name

.result-item-stars.pull-right
= repository.stars.count
|  
i.fa.fa-star

.clearfix
.tags-list.pull-left
- repository.tags.each do |t|
.label.label-success.tag
= t.name

.pull-right
| Updated #{time_ago_in_words(repository.updated_at)} ago
4 changes: 4 additions & 0 deletions app/views/explore/partials/_top.html.slim
@@ -0,0 +1,4 @@
= render 'shared/notifications'
= image_tag 'layout/portus-logo-login-page.png', class: 'login-picture'

.text-center = link_to 'Go back to the login page', new_user_session_path, class: 'btn btn-link'
15 changes: 0 additions & 15 deletions app/views/repositories/_repository.slim

This file was deleted.

0 comments on commit 9d6cc25

Please sign in to comment.