Skip to content

Commit 337f79a

Browse files
committed
fix: changed the order of the buttons in the tag list
it was also necessary to change a test. Issue #631.
1 parent 3badc1a commit 337f79a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

app/controllers/tags_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def index
1212
def alpha_grouped_index
1313
redirect_to users_path && return unless current_organization
1414

15-
post_type = params[:post_type] || "offer"
15+
post_type = params[:post_type] || "user"
1616
@tags = case post_type
1717
when "offer"
1818
Offer.by_organization(current_organization).active.of_active_members

app/views/application/_navbar.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
<%= Inquiry.model_name.human(count: :many) %>
7171
<% end %>
7272
</li>
73-
<li class="<%= "active" if current_page?(alpha_grouped_index_tags_path(post_type: "offer")) %>">
74-
<%= link_to alpha_grouped_index_tags_path(post_type: "offer") do %>
73+
<li class="<%= "active" if current_page?(alpha_grouped_index_tags_path(post_type: "user")) %>">
74+
<%= link_to alpha_grouped_index_tags_path(post_type: "user") do %>
7575
<%= glyph :tags %>
7676
<%= t ".tags" %>
7777
<% end %>

app/views/tags/alpha_grouped_index.html.erb

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
<%= form_tag alpha_grouped_index_tags_path, method: :get do %>
44
<div class="btn-group" data-toggle="buttons">
5-
<label class="btn btn-primary active switch_offer-js">
6-
<%= radio_button_tag 'switch_offer', 'offer', true %>
5+
<label class="btn btn-primary active switch_member-js">
6+
<%= radio_button_tag 'switch_member', 'user', true %>
7+
<%= t "users.index.members" %>
8+
</label>
9+
<label class="btn btn-primary switch_offer-js">
10+
<%= radio_button_tag 'switch_offer', 'offer' %>
711
<%= Offer.model_name.human count: :many %>
812
</label>
913
<label class="btn btn-primary switch_inquiry-js">
1014
<%= radio_button_tag 'switch_inquiry', 'inquiry' %>
1115
<%= Inquiry.model_name.human count: :many %>
1216
</label>
13-
<label class="btn btn-primary switch_member-js">
14-
<%= radio_button_tag 'switch_member', 'user' %>
15-
<%= t "users.index.members" %>
16-
</label>
1717
</div>
1818
<% end %>
1919

spec/controllers/tags_controller_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
describe "GET alpha_grouped_index" do
5050
before { session[:current_organization_id] = organization.id }
5151

52-
it "load offers tags by default if no type is passed" do
52+
it "load users tags by default if no type is passed" do
5353
get :alpha_grouped_index
5454

5555
expect(assigns(:tags)).to eq({
56-
"B" => [["bar", 1], ["baz", 1]],
57-
"F" => [["foo", 1]]
56+
"H" => [["html", 2], ["html5", 1]],
57+
"C" => [["css", 1]]
5858
})
5959
end
6060

0 commit comments

Comments
 (0)