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

refac profiles view for less queries #1397

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/assets/stylesheets/pages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ $header_nums: 0, 1, 2, 3, 4;

.category_name {
a:hover {
text-decoration: underline;
color: white;
}
}
Expand Down
26 changes: 21 additions & 5 deletions app/assets/stylesheets/tags_and_categories.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@

div#v-pills-tab a {
color: black;
text-decoration: none;
}

div#v-pills-tab a:hover {
background: none;
font-weight: bold;
}

.tag-button {
Expand Down Expand Up @@ -76,12 +82,23 @@ $categories_dark_color: (
color: white;
}
}
a:link#v-pills-#{$name}-tab.active {
a#v-pills-#{$name}-tab.active {
background: none;
color: $color;
font-weight: bold;
}
a#v-pills-#{$name}-tab {
i { color: $color; }
&:hover {
color: $color;
}
}
a#v-pills-#{$name}-tab.active {
background: none;
color: $color;
font-weight: bold;
}
a:link#v-pills-#{$name}-tab {
a#v-pills-#{$name}-tab {
i { color: $color; }
&:hover {
color: $color;
Expand All @@ -91,7 +108,6 @@ $categories_dark_color: (
}
#category-#{$name} {
color: $color;
text-decoration: underline;
}
.bg-#{$name} {
i { color: #{$color} }
Expand All @@ -116,12 +132,12 @@ $categories_bright_color: (
color: black;
}
}
a:link#v-pills-#{$name}-tab.active {
a#v-pills-#{$name}-tab.active {
background: none;
color: $color;
font-weight: bold;
}
a:link#v-pills-#{$name}-tab {
a#v-pills-#{$name}-tab {
i { color: $color; }
&:hover {
color: $color;
Expand Down
2 changes: 1 addition & 1 deletion app/views/profiles/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<h1><%= t(:title_topic_search, scope: 'profiles.index') %></h1>
</div>
</div>
<%= render partial: 'shared/category_filter' %>
<%= render partial: 'shared/category_filter', category: @category %>
</div> <!-- tag filter -->
<!-- <a href="#top"><%= t(:up_to_filter, scope: 'profiles.index') %> <i class='fa fa-filter pr-2'></i> </a> -->
<hr class="mt-5">
Expand Down
18 changes: 9 additions & 9 deletions app/views/shared/_category_filter.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
<p id="category_explantation" class="py-2 font-weight-bold"><%= t(:choose_category, scope: 'category') %></p>
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<% @categories.each do |category| %>
<a class="h5 category-link pb-2 <%= "active show" if category.id.to_s == @category.id.to_s %>" id="v-pills-<%= category.short_name %>-tab" data-toggle="pill" href="#v-pills-<%= category.short_name %>" role="tab" aria-controls="v-pills-<%= category.short_name %>" aria-selected="false">
<i class="fa fa-circle pr-2 small" id="icon-<%= category.short_name%>"></i><%= category.name %>
</a>
<%= link_to profiles_path(category_id: category.id),
class: "h5 category-link pb-2 #{'active show' if category.id.to_s == @category.id.to_s}",
id: "v-pills-#{category.short_name}-tab" do %>
<i class="fa fa-circle pr-2 small" id="icon-<%= category.short_name %>"></i>
<%= category.name %>
<% end %>
<% end %>
</div>
</div>

<div class="col-md-8">
<p id="tags_explantation" class="py-2 font-weight-bold <%= "d-none" unless params[:category_id] %>"><%= t(:filter, scope: 'category') %></p>
<% @categories.each do |category| %>
<span id="<%= category.short_name %>" class="btn btn-primary choose_all_tags mb-2 category-search category-search-<%= category.short_name %> <%= "d-none" unless category.id.to_s == params[:category_id] %> ">
<%= t(:choose_all_button, scope: 'category', category_name: category.name ).html_safe %>
</span>
<% end %>
<p id="tags_explantation" class="py-2 font-weight-bold <%= "d-none" unless params[:category_id] %>">
<%= t(:filter, scope: 'category', category_name: @category.name ) %>
</p>
<div class="tab-content mb-3" id="available-tags-box">
<% @categories.each do |category| %>
<% cache category, expires_in: 1.hour do %>
Expand Down
3 changes: 1 addition & 2 deletions config/locales/profile.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ en:
picture_too_big: " is too big. You cannot upload a file greater than 1MB."
category:
title: "Look through all the speakerinnen of the category <b>%{category_name}</b> <i class='fa fa-caret-right' style='font-size: 21px'></i>"
filter: "Choose one or more topics from any category:"
choose_all_button: "Choose all topics from %{category_name}"
filter: "Choose one or more topics from the category: %{category_name}"
choose_category: "Choose a category:"
clear_link: "X Clear all"
choose_button: "Speakers with these topics"
Expand Down
Loading