Skip to content

Commit 27edff9

Browse files
author
Tyranja
committed
make less queries in profile controller
1 parent eb01612 commit 27edff9

5 files changed

Lines changed: 32 additions & 18 deletions

File tree

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 & 5 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,12 +82,23 @@ $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;
@@ -91,7 +108,6 @@ $categories_dark_color: (
91108
}
92109
#category-#{$name} {
93110
color: $color;
94-
text-decoration: underline;
95111
}
96112
.bg-#{$name} {
97113
i { color: #{$color} }
@@ -116,12 +132,12 @@ $categories_bright_color: (
116132
color: black;
117133
}
118134
}
119-
a:link#v-pills-#{$name}-tab.active {
135+
a#v-pills-#{$name}-tab.active {
120136
background: none;
121137
color: $color;
122138
font-weight: bold;
123139
}
124-
a:link#v-pills-#{$name}-tab {
140+
a#v-pills-#{$name}-tab {
125141
i { color: $color; }
126142
&:hover {
127143
color: $color;

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
<% cache category, expires_in: 1.hour do %>

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)