Skip to content

Commit

Permalink
make less queries in profile controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyranja committed Jul 24, 2024
1 parent 9d89603 commit e570e47
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 21 deletions.
1 change: 0 additions & 1 deletion app/assets/stylesheets/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ html {

a, .link, #expander {
cursor: pointer;
text-decoration: underline;
color: $font-color;
padding: 0.2em;

Expand Down
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
27 changes: 21 additions & 6 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,20 +82,30 @@ $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;
}
}
#category-#{$name} {
color: $color;
text-decoration: underline;
}
.bg-#{$name} {
i { color: #{$color} }
Expand All @@ -114,20 +130,19 @@ $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;
}
}
#category-#{$name} {
color: $color;
text-decoration: underline;
}
.bg-#{$name} {
i { color: #{$color} }
Expand Down
2 changes: 1 addition & 1 deletion app/views/profiles/_profile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% tooltip_empty = !profile.iso_languages.present? && profile.city.nil? && profile.willing_to_travel.nil? && profile.nonprofit.nil? %>
<% title = render partial: "profiles/profile_tooltip", locals: { profile: profile } %>
<div class="col-sm-6 col-md-6 col-lg-3 my-3 profile-box">
<%= profile_image_link(Profile.find(profile.id)) %>
<%= profile_image_link(profile) %>
<div class="bg--white caption">
<div class="profile-name">
<%= link_to profile.fullname, profile_path(profile.id) %>
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| %>
<div style="min-height: 300px" class="tab-pane fade <%= "active show" if category.id.to_s == ( params[:category_id] || @category.id.to_s )%>" id="v-pills-<%= category.short_name %>" role="tabpanel" aria-labelledby="v-pills-<%= category.short_name %>-tab" >
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

0 comments on commit e570e47

Please sign in to comment.