Skip to content

Commit

Permalink
検索結果が0件の時にメッセージの表示 #31
Browse files Browse the repository at this point in the history
  • Loading branch information
ishi720 committed Jun 6, 2024
1 parent eb37f4d commit 348c292
Showing 1 changed file with 32 additions and 27 deletions.
59 changes: 32 additions & 27 deletions app/views/characters/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,36 @@
<%= paginate @characters %>
</div>

<div class="ui cards">
<% @characters.each do |character| %>
<div class="ui card character-card">
<div class="character-name"><%= character.name %></div>
<div class="character-image"></div>
<div>
誕生日:
<span><%= character.month %></span><span><span>
<span><%= character.day %></span><span><span>
</div>
<div class="character-tag-area">
<% if character.tag.present? %>
<span class="character-tag"><%= character.tag %></span>
<% end %>
</div>

<div class="button-container">
<%= link_to edit_character_path(character), class: "ui primary button" do %>
<i class="edit icon"></i>編集
<% end %>
<%= button_to character_path(character), method: :delete, class: "ui button" do %>
<i class="trash icon"></i>削除
<% end %>
</div>
</div>
<% end %>
</div>

<% if @characters_count.zero? %>
<div style="text-align: center;">検索条件に一致するキャラクターはいませんでした。<br>検索条件を変えて検索してください</div>
<% else %>
<div class="ui cards">
<% @characters.each do |character| %>
<div class="ui card character-card">
<div class="character-name"><%= character.name %></div>
<div class="character-image"></div>
<div>
誕生日:
<span><%= character.month %></span><span><span>
<span><%= character.day %></span><span><span>
</div>
<div class="character-tag-area">
<% if character.tag.present? %>
<span class="character-tag"><%= character.tag %></span>
<% end %>
</div>

<div class="button-container">
<%= link_to edit_character_path(character), class: "ui primary button" do %>
<i class="edit icon"></i>編集
<% end %>
<%= button_to character_path(character), method: :delete, class: "ui button" do %>
<i class="trash icon"></i>削除
<% end %>
</div>
</div>
<% end %>
</div>
<% end %>

0 comments on commit 348c292

Please sign in to comment.