Skip to content

Commit 0251abc

Browse files
committed
Implement style changes
This commit removes/adds spaces where needed, removes unnecessary comments and changes <a> to link_to in the sidebar. There are still some other <a> in the sidebar that I haven't changed yet as other people are in the process of adding routes to these pages (Topics and Languages).
1 parent 488517e commit 0251abc

File tree

3 files changed

+11
-32
lines changed

3 files changed

+11
-32
lines changed

app/controllers/users_controller.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ def index
55
@users = User.all
66
end
77

8+
def new
9+
@user = User.new
10+
end
11+
812
def create
913
@user = User.new(user_params)
1014

@@ -17,10 +21,6 @@ def create
1721
end
1822
end
1923

20-
21-
def new
22-
@user = User.new
23-
end
2424
def edit
2525
end
2626

@@ -33,6 +33,7 @@ def update
3333
end
3434
end
3535
end
36+
3637
def destroy
3738
@user.destroy!
3839

@@ -42,6 +43,7 @@ def destroy
4243
end
4344

4445
private
46+
4547
def set_user
4648
@user = User.find(params.expect(:id))
4749
end

app/views/layouts/_sidebar.html.erb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
<div id="sidebar">
33
<div class="sidebar-wrapper active">
44
<div class="sidebar-header position-relative">
@@ -72,16 +72,11 @@
7272
<% end %>
7373
</li>
7474

75-
<<<<<<< HEAD
7675
<li class="sidebar-item">
77-
<a href="application-chat.html" class="sidebar-link">
78-
=======
79-
<li class="sidebar-item ">
80-
<a href="<%= users_path%>" class='sidebar-link'>
81-
>>>>>>> add user crud action
76+
<%= link_to users_path, class: 'sidebar-link' do %>
8277
<i class="bi bi-people"></i>
8378
<span>Users</span>
84-
</a>
79+
<% end %>
8580
</li>
8681
</ul>
8782
</div>

spec/requests/users_spec.rb

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,14 @@
11
require "rails_helper"
22

3-
# This spec was generated by rspec-rails when you ran the scaffold generator.
4-
# It demonstrates how one might use RSpec to test the controller code that
5-
# was generated by Rails when you ran the scaffold generator.
6-
#
7-
# It assumes that the implementation code is generated by the rails scaffold
8-
# generator. If you are using any extension libraries to generate different
9-
# controller code, this generated spec may or may not pass.
10-
#
11-
# It only uses APIs available in rails and/or rspec-rails. There are a number
12-
# of tools you can use to make these specs even more expressive, but we're
13-
# sticking to rails and rspec-rails APIs to keep things simple and stable.
14-
153
RSpec.describe "/users", type: :request do
164
let(:user) { create(:user) }
17-
5+
let(:valid_attributes) { { email: "john@doe.com", password: "123" } }
6+
let(:invalid_attributes) { { email: "" } }
187

198
before do
209
sign_in(user)
2110
end
2211

23-
# This should return the minimal set of attributes required to create a valid
24-
# User. As you add validations to User, be sure to
25-
# adjust the attributes here as well.
26-
let(:valid_attributes) { { email: "john@doe.com", password: "123" } }
27-
28-
let(:invalid_attributes) { { email: "" } }
29-
3012
describe "GET /index" do
3113
it "renders a successful response" do
3214
user = FactoryBot.create(:user)

0 commit comments

Comments
 (0)