<% if @parent_frame -%>
<fieldset>
  <div class="table-sys-a1">
    <div class="item-body">
      <div class="item-tr">
        <div class="item-mid">親ページ</div>
        <div class="input-mid">
          <b><%= @parent_frame.title %></b>
        </div>
      </div>
    </div>
  </div>
</fieldset>
<br>
<% end -%>

<fieldset>
  <%= link_to "タイトル編集", {action: :edit_title, id: @content_frame.id} %><br />
  <div class="table-sys-a1">
    <div class="item-body">
      <div class="item-tr">
        <div class="item-mid">タイトル</div>
        <div class="input-mid">
          <%= @content_frame.title %>
        </div>
      </div>
    </div>
  </div>
</fieldset>

<br>

<fieldset>
  <%= link_to "説明編集", {action: :edit_description, id: @content_frame.id} %><br />
  <div class="table-sys-a1">
    <div class="item-body">
      <div class="item-tr">
        <div class="item-mid">説明</div>
        <div class="input-mid">
          <%= @content_frame.description %>
        </div>
      </div>
    </div>
  </div>
</fieldset>

<br><br>

<%= form_with(model: @content_item, url: {action: :edit_item}) do |f| %>
  <%= f.hidden_field :master_frame, {:value => @master_frame} %>
  <%= f.select :category, $content_item_category %>
  <%= f.submit "　アイテムの追加　" %>
<% end %>

<br>

<% if session[:target_for_back_id] -%>
<%= link_to "戻る", {:action => session[:target_for_back], :id => session[:target_for_back_id]} %><br />
<% else -%>
<%= link_to "戻る", {:action => session[:target_for_back]} %><br />
<% end -%>

<br>
<% amt = 0 -%>
<% @content_items.each.with_index do |content_item, count| %>
<% amt = amt + 1 -%>
<b><%= $content_item_category[content_item.category - 1][0] %></b>[ID: <%= content_item.id %>]　
<span>
  <%= link_to "編集", {action: :edit_item, id: content_item.id} %>
</span>
<span data-turbo="true">
  <%= link_to "削除", {action: :delete_item, id: content_item.id},
    data: { turbo_method: :delete,
            turbo_confirm: 'アイテムID:' + content_item.id.to_s + 'を削除してもよろしいですか?' }  %>
</span>
<br />

<%= render 'pickup_content_item', content_item: content_item %>
<div><br></div>
<% end -%>
<% if amt == 0 -%>
  データが登録されていません。<br>
<% end -%>
<br>

<% if session[:target_for_back_id] -%>
<%= link_to "戻る", {action: session[:target_for_back], id: session[:target_for_back_id]} %><br />
<% else -%>
<%= link_to "戻る", {action: session[:target_for_back]} %><br />
<% end -%>
