Skip to content

Commit

Permalink
feat: update detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
tanakaworld committed Jun 20, 2019
1 parent ea40b14 commit dc5b385
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
19 changes: 19 additions & 0 deletions app/assets/stylesheets/articles.scss
@@ -1,3 +1,22 @@
// Place all the styles related to the articles controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

.ArticleWrap {
margin: 0 auto;
padding: 24px;
max-width: 600px;
background: #e6e6e6;

.ArticleTitle {
text-align: center;
}

.ArticleContent {

}

.ArticleCoverImage {
width: 100%;
}
}
8 changes: 8 additions & 0 deletions app/controllers/articles_controller.rb
Expand Up @@ -10,6 +10,14 @@ def index
# GET /articles/1
# GET /articles/1.json
def show
# respond_to do |f|
# f.html do
# @is_pdf = false
# end
# f.pdf do
# @is_pdf = true
# end
# end
end

# GET /articles/new
Expand Down
26 changes: 11 additions & 15 deletions app/views/articles/show.html.erb
@@ -1,19 +1,15 @@
<p id="notice"><%= notice %></p>
<div class="ArticleWrap">
<h1 class="ArticleTitle"><%= @article.title %></h1>

<p>
<strong>Title:</strong>
<%= @article.title %>
</p>
<%= image_tag @article.cover_image, class: 'ArticleCoverImage' %>

<p>
<strong>Content:</strong>
<%= @article.content %>
</p>
<p class="ArticleContent">
<%= @article.content %>
</p>
</div>

<p>
<strong>Cover:</strong>
<%= image_tag @article.cover_image, width: 50, height: 50 %>
</p>
<% if !@is_pdf %>
<%= link_to 'Edit', edit_article_path(@article) %> |
<%= link_to 'Back', articles_path %>
<% end %>

<%= link_to 'Edit', edit_article_path(@article) %> |
<%= link_to 'Back', articles_path %>

0 comments on commit dc5b385

Please sign in to comment.