Skip to content

Commit e570e47

Browse files
author
Tyranja
committed
make less queries in profile controller
1 parent 9d89603 commit e570e47

7 files changed

Lines changed: 33 additions & 21 deletions

File tree

app/assets/stylesheets/custom.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ html {
1010

1111
a, .link, #expander {
1212
cursor: pointer;
13-
text-decoration: underline;
1413
color: $font-color;
1514
padding: 0.2em;
1615

app/assets/stylesheets/pages.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ $header_nums: 0, 1, 2, 3, 4;
221221

222222
.category_name {
223223
a:hover {
224-
text-decoration: underline;
225224
color: white;
226225
}
227226
}

app/assets/stylesheets/tags_and_categories.scss

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939

4040
div#v-pills-tab a {
4141
color: black;
42+
text-decoration: none;
43+
}
44+
45+
div#v-pills-tab a:hover {
46+
background: none;
47+
font-weight: bold;
4248
}
4349

4450
.tag-button {
@@ -76,20 +82,30 @@ $categories_dark_color: (
7682
color: white;
7783
}
7884
}
79-
a:link#v-pills-#{$name}-tab.active {
85+
a#v-pills-#{$name}-tab.active {
86+
background: none;
87+
color: $color;
88+
font-weight: bold;
89+
}
90+
a#v-pills-#{$name}-tab {
91+
i { color: $color; }
92+
&:hover {
93+
color: $color;
94+
}
95+
}
96+
a#v-pills-#{$name}-tab.active {
8097
background: none;
8198
color: $color;
8299
font-weight: bold;
83100
}
84-
a:link#v-pills-#{$name}-tab {
101+
a#v-pills-#{$name}-tab {
85102
i { color: $color; }
86103
&:hover {
87104
color: $color;
88105
}
89106
}
90107
#category-#{$name} {
91108
color: $color;
92-
text-decoration: underline;
93109
}
94110
.bg-#{$name} {
95111
i { color: #{$color} }
@@ -114,20 +130,19 @@ $categories_bright_color: (
114130
color: black;
115131
}
116132
}
117-
a:link#v-pills-#{$name}-tab.active {
133+
a#v-pills-#{$name}-tab.active {
118134
background: none;
119135
color: $color;
120136
font-weight: bold;
121137
}
122-
a:link#v-pills-#{$name}-tab {
138+
a#v-pills-#{$name}-tab {
123139
i { color: $color; }
124140
&:hover {
125141
color: $color;
126142
}
127143
}
128144
#category-#{$name} {
129145
color: $color;
130-
text-decoration: underline;
131146
}
132147
.bg-#{$name} {
133148
i { color: #{$color} }

app/views/profiles/_profile.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<% tooltip_empty = !profile.iso_languages.present? && profile.city.nil? && profile.willing_to_travel.nil? && profile.nonprofit.nil? %>
33
<% title = render partial: "profiles/profile_tooltip", locals: { profile: profile } %>
44
<div class="col-sm-6 col-md-6 col-lg-3 my-3 profile-box">
5-
<%= profile_image_link(Profile.find(profile.id)) %>
5+
<%= profile_image_link(profile) %>
66
<div class="bg--white caption">
77
<div class="profile-name">
88
<%= link_to profile.fullname, profile_path(profile.id) %>

app/views/profiles/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<h1><%= t(:title_topic_search, scope: 'profiles.index') %></h1>
3131
</div>
3232
</div>
33-
<%= render partial: 'shared/category_filter' %>
33+
<%= render partial: 'shared/category_filter', category: @category %>
3434
</div> <!-- tag filter -->
3535
<!-- <a href="#top"><%= t(:up_to_filter, scope: 'profiles.index') %> <i class='fa fa-filter pr-2'></i> </a> -->
3636
<hr class="mt-5">

app/views/shared/_category_filter.erb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
<p id="category_explantation" class="py-2 font-weight-bold"><%= t(:choose_category, scope: 'category') %></p>
44
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
55
<% @categories.each do |category| %>
6-
<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">
7-
<i class="fa fa-circle pr-2 small" id="icon-<%= category.short_name%>"></i><%= category.name %>
8-
</a>
6+
<%= link_to profiles_path(category_id: category.id),
7+
class: "h5 category-link pb-2 #{'active show' if category.id.to_s == @category.id.to_s}",
8+
id: "v-pills-#{category.short_name}-tab" do %>
9+
<i class="fa fa-circle pr-2 small" id="icon-<%= category.short_name %>"></i>
10+
<%= category.name %>
11+
<% end %>
912
<% end %>
1013
</div>
1114
</div>
1215

1316
<div class="col-md-8">
14-
<p id="tags_explantation" class="py-2 font-weight-bold <%= "d-none" unless params[:category_id] %>"><%= t(:filter, scope: 'category') %></p>
15-
<% @categories.each do |category| %>
16-
<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] %> ">
17-
<%= t(:choose_all_button, scope: 'category', category_name: category.name ).html_safe %>
18-
</span>
19-
<% end %>
17+
<p id="tags_explantation" class="py-2 font-weight-bold <%= "d-none" unless params[:category_id] %>">
18+
<%= t(:filter, scope: 'category', category_name: @category.name ) %>
19+
</p>
2020
<div class="tab-content mb-3" id="available-tags-box">
2121
<% @categories.each do |category| %>
2222
<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" >

config/locales/profile.en.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ en:
163163
picture_too_big: " is too big. You cannot upload a file greater than 1MB."
164164
category:
165165
title: "Look through all the speakerinnen of the category <b>%{category_name}</b> <i class='fa fa-caret-right' style='font-size: 21px'></i>"
166-
filter: "Choose one or more topics from any category:"
167-
choose_all_button: "Choose all topics from %{category_name}"
166+
filter: "Choose one or more topics from the category: %{category_name}"
168167
choose_category: "Choose a category:"
169168
clear_link: "X Clear all"
170169
choose_button: "Speakers with these topics"

0 commit comments

Comments
 (0)