simple_crm/app/views/admin/all_page/_form.html.erb

64 lines
2.2 KiB
Plaintext

<%= stylesheet_link_tag 'select2' %>
<div class="box-body">
<% if @all_page.errors.any? %>
<%= raw errors_to_html(@all_page.errors) %>
<% end %>
<div class="form-group">
<label>Nazwa (Link w menu)</label>
<%= text_field :all_page, :name, class: "form-control", placeholder: 'Nazwa' %>
</div>
<div class="form-group">
<label>Tytuł (SEO)</label>
<%= text_field :all_page, :title, class: "form-control", placeholder: 'Tytuł' %>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Rodzaj strony</label>
<%= select(:all_page, :type_of, options_for_select(AllPage::FORM_PAGE_TYPES, @all_page.type_of.to_s), {:selected => @all_page.type_of.to_s}, {class: 'form-control select2'}) %>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Grupa wpisów</label>
<%= select(:all_page, :article_id, @articles.collect {|p| [ p.name, p.id ] }, {:include_blank => true, :selected => @all_page.article_id.to_s}, {class: 'form-control select2'}) %>
</div>
</div>
</div>
<div class="form-group">
<label>Treść</label>
<%= text_area :all_page, :full_text, :class => "summernote" %>
</div>
<div class="box-footer">
<%= hidden_field_tag 'publish', '0' %>
<%= submit_tag 'Zapisz', class: "btn btn-primary" %>
<%= link_to 'Zapisz i Opublikuj', '#', class: 'btn btn-success', onclick: 'publishForm()' %>
<% if action_name.eql?('edit') %>
<%= link_to 'Podgląd', '/site/preview/' + @all_page.id.to_s, class: 'btn btn-info pull-right', target: '__blank' %>
<% end %>
</div>
</div>
<% content_for :footer_scripts do %>
<%= javascript_include_tag 'select2' %>
<script type="text/javascript">
function publishForm() {
$('#publish').val('1');
<% if action_name.eql?('edit') %>
form = document.getElementById('all_page_form_id');
Rails.fire(form, 'submit');
<% else %>
$('#all_page_form_id').submit();
<% end %>
}
$(document).ready(function() {
$('.select2').select2();
$('.summernote').summernote({
height: 300,
tabsize: 2,
lang: 'pl-PL'
});
});
</script>
<% end %>