Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d95eeec
commit 805f411
Showing
7 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,8 @@ | |
.alert:empty { | ||
display: none; | ||
} | ||
|
||
.logout { | ||
margin-top: 20px; | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class ProfilesController < ApplicationController | ||
|
||
before_action :authenticate_user!, only: [:index] | ||
|
||
def index | ||
@user = User.find(current_user.id) | ||
@posts = @user.post | ||
end | ||
|
||
def show | ||
@user = User.find(params[:id]) | ||
@posts = @user.post | ||
render :index | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ProfilesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<% content_for :title do %> | ||
Записи пользователя <%= @user.email %> | ||
<% end %> | ||
|
||
<main role="main" class="container"> | ||
<div class="row"> | ||
<% if params[:action] == 'index' %> | ||
<div class="col-md-3 mb-3 mt-1"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<div class="h2"> | ||
<!-- Email автора --> | ||
<%= @user.email %> | ||
</div> | ||
</div> | ||
|
||
<ul class="list-group list-group-flush"> | ||
<li class="list-group-item"> | ||
<a href="<%= url_for(new_post_path) %>" style="text-decoration:underline">Создать пост</a> | ||
</li> | ||
<li class="list-group-item"> | ||
<a href="<%= url_for(edit_user_registration_path) %>" style="text-decoration:underline">Смена пароля</a><br /> | ||
</li> | ||
<li class="list-group-item"> | ||
<div class="h6 text-muted"> | ||
<!-- Количество записей --> | ||
Записей: <%= @posts.count %> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="logout"> | ||
<%= button_to "logout", destroy_user_session_path, { method: :delete, class: 'btn btn-danger' } %> | ||
</div> | ||
</div> | ||
<% end %> | ||
<div class="col-md-9"> | ||
<!-- Начало блока с отдельным постом --> | ||
<% @posts.each do |post| %> | ||
<%= render 'posts/post', post: post %> | ||
<% end %> | ||
<!-- Остальные посты --> | ||
<!-- Здесь будет постраничная навигация паджинатора --> | ||
</div> | ||
</div> | ||
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require "test_helper" | ||
|
||
class ProfilesControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |