Skip to content

Commit 9ddcb31

Browse files
committed
Add button to add more content at the top of content#index pages
1 parent 6eda3a9 commit 9ddcb31

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

app/controllers/characters_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def content_param_list
1515
:facialhair, :eyecolor, :race, :skintone, :bodytype, :identmarks, :hairstyle,
1616
:religion, :politics, :prejudices, :occupation, :pets, :aliases,
1717
:mannerisms, :birthday, :education, :background,
18-
:motivations, :flaws, :talents, :hobbies, :personality_type
18+
:motivations, :flaws, :talents, :hobbies, :personality_type,
1919
:fave_color, :fave_food, :fave_possession, :fave_weapon, :fave_animal,
2020
:notes, :private_notes, :privacy,
2121
siblingships_attributes: [:id, :sibling_id, :_destroy],

app/views/content/index.html.erb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,24 @@
88
<% end %>
99

1010
<% if @content.any? %>
11-
<h4>You've created <%= pluralize(@content.count, content_type) %></h4>
11+
<h4>
12+
You've created <%= pluralize(@content.count, content_type) %>
13+
<% if @content.count > 0 %>
14+
<small class="right">
15+
<%= link_to new_polymorphic_path(@content.build), class: "btn white #{content_type_class.color}-text" do %>
16+
+
17+
<i class="material-icons <%= content_type_class.color %>-text">
18+
<%= content_type_class.icon %>
19+
</i>
20+
<% end %>
21+
</small>
22+
<% end %>
23+
</h4>
1224
<%= render partial: 'content/list/list', locals: { content_list: @content } %>
1325
<%= link_to "Create another #{content_type}", new_polymorphic_path(@content.build), :class => 'btn' %>
1426

1527
<% elsif @content.empty? %>
16-
<div class="center">
28+
<div class="center" style="margin-bottom: 50px;">
1729
<h4>You haven't created any <%= content_type.pluralize %> yet!</h4>
1830
<h1>
1931
<i class="material-icons <%= content_type_class.color %>-text" style="font-size: 200%">

0 commit comments

Comments
 (0)