<div class="content-field universe">
  <div class="input-field">
    <div>
      <i class="material-icons grey-text left"><%= Universe.icon %></i>
      <%= f.label field[:id], field[:label] %>
    </div>

    <% if !page.persisted? || (page.persisted? && page.universe && page.universe.user == current_user) || page.universe_id.nil? %>
      <%# todo not like this %>
      <%
        valid_universes = []
        show_premium_notice = false

        if Rails.application.config.content_types[:free].map(&:name).include?(raw_model.class.name)
          valid_universes += current_user.universes
          valid_universes += current_user.contributable_universes
        else
          # Premium content
          if current_user.on_premium_plan? \
            || PermissionService.user_has_active_promotion_for_this_content_type(user: current_user, content_type: page.class.name)

            valid_universes += current_user.universes

            # Allow premium users to add premium content to non-premium universes
            valid_universes += current_user.contributable_universes
          else
            show_premium_notice = true
          end

          current_user.contributable_universes.each do |potential_universe|
            if potential_universe.user.on_premium_plan?
              valid_universes += [potential_universe]
            end
          end
        end
      %>

      <%= hidden_field_tag "field[name]", field[:id] %>
      <%=
        @universe_dropdown_options ||= valid_universes.uniq.sort_by(&:name).map { |u| [u.name, u.id] }
        select_tag "field[value]",
          options_for_select(
            @universe_dropdown_options.compact,
            page.try(:universe_id) || @universe_scope.try(:id)
          ),
          include_blank: current_user.on_premium_plan? || Rails.application.config.content_types[:free].map(&:name).include?(raw_model.class.name),
          class: 'autosave-closest-form-on-change'
      %>
      <% if show_premium_notice %>
        <div class="help-text">
          <i class="material-icons" style="font-size: 90%">info</i>
          While on a <%= link_to 'Starter plan', subscription_path %>, you can only create premium content in universes you're a contributor to.
        </div>
      <% end %>
    <% else %>
      <br />
      <%= link_to(page.universe.name, page.universe) if page.universe %>
    <% end %>
  </div>
</div>