- channels.each_slice(slice).each do |channels|
  .row.mb-3
    - channels.each do |channel|
      - pds = defined?(program_details) ? program_details.select { |pd| pd.channel_id == channel.id } : channel.program_details.includes(:channel).published.where(work: work)
      div class="col-#{12 / slice}"
        - if pds.present? && pds.length > 1
          .btn-group.w-100
            button.btn.u-btn-link.w-100.dropdown-toggle type="button" data-toggle="dropdown"
              = channel.name
            .dropdown-menu.w-100
              - pds.each do |pd|
                = link_to pd.vod_title_name, vod_title_url(channel.id, pd.vod_title_code), class: "dropdown-item", target: "_blank"
        - elsif pds.present? && pds.length == 1
          = link_to channel.name, vod_title_url(channel.id, pds[0].vod_title_code), class: "btn u-btn-link w-100", target: "_blank"
        - else
          button.btn.u-btn-link.w-100 type="button" disabled=""
            = channel.name

- channels.each_slice(slice).each do |channels|
  .row.mb-3
    - channels.each do |channel|
      - pds = defined?(program_details) ? program_details.select { |pd| pd.channel_id == channel.id } : channel.program_details.includes(:channel).published.where(work: work)
      div class="col-#{12 / slice}"
        - if pds.present? && pds.length > 1
          .btn-group.w-100
            button.btn.u-btn-link.w-100.dropdown-toggle type="button" data-toggle="dropdown"
              = channel.name
            .dropdown-menu.w-100
              - pds.each do |pd|
                = link_to pd.vod_title_name, vod_title_url(channel.id, pd.vod_title_code), class: "dropdown-item", target: "_blank"
        - elsif pds.present? && pds.length == 1 && pds[0].vod_title_code.present?
          = link_to channel.name, vod_title_url(channel.id, pds[0].vod_title_code), class: "btn u-btn-link w-100", target: "_blank"
        - else
          button.btn.u-btn-link.w-100 type="button" disabled=""
            = channel.name

Disable button if vod_title_code is blank
Disable button if vod_title_code is blank

annict/annict,annict/annict,annict/annict,annict/annict