view app/views/pastes/new.html.erb @ 478:46ed68bf9918

Add more length check
author nanaya <me@nanaya.pro>
date Sat, 10 Oct 2020 18:14:57 +0900
parents c8e2f6b22527
children
line wrap: on
line source

<% provide :title, t(".title") %>

<%= form_for @paste do |f| %>
  <%= render "shared/filter_spam" %>

  <div class="form-group">
    <%= f.text_area :paste,
      autofocus: true,
      class: "form-control paste-paste js-paste-paste #{error_class f.object, :paste}",
      rows: 20
    %>
  </div>


  <div class="row"><div class="col-12">
      <button type="button" class="btn btn-secondary ml-auto d-block js-paste-preview-md">
        <%= t(".preview_md") %>
      </button>
  </div></div>

  <div class="form-group row">
    <%= f.label :key, t('.deletion_key'), class: 'col-sm-2 col-form-label' %>

    <div class="col-auto">
      <%= f.text_field :key,
        autocomplete: 'off',
        class: "form-control #{error_class f.object, :key}"
      %>
    </div>
  </div>

  <div class="form-group row">
    <label class="col-sm-2 col-form-label pt-0">
      <%= t(".privacy.label") %>
    </label>

    <div class="col-sm-10">
      <% paste_privacy_options.each do |label, value| %>
        <label class="custom-control custom-radio mb-0">
          <%= f.radio_button :is_private, value, class: 'custom-control-input' %>

          <span class="custom-control-label d-inline-block">
            <%= t(".privacy.#{label}") %>
          </span>
        </label>
      <% end %>
    </div>
  </div>

  <div class="form-group row">
    <%= f.label :language, class: 'col-sm-2 col-form-label' %>

    <div class="col-auto">
      <%= f.select :language, [], { prompt: t(".language_none") }, class: 'custom-select' %>
    </div>
  </div>

  <div class="form-group">
    <%= f.button :class => "btn btn-primary" %>

    <%= link_to t(".clear"), "#", :class => "btn btn-danger js-paste-clear" %>
  </div>
<% end %>

<div class="modal fade js-paste-preview-md-modal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-body js-paste-preview-md-box">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">
          <%= t("buttons.close") %>
        </button>
      </div>
    </div>
  </div>
</div>