Last active
May 12, 2019 08:59
-
-
Save robypez/93ba2d78e27b1c5db4219e2704ba6dc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::ContentsController < AdminController | |
expose(:contents) | |
expose(:content) | |
def new | |
content = Content.create(author: current_user) | |
redirect_to edit_admin_content_path(content) | |
end | |
def edit | |
content.build_sponsorship unless content.sponsorship | |
content.build_live_blog unless content.live_blog | |
content.build_special_page_special_pageable unless content.special_page_special_pageable | |
end | |
end | |
#nella vista | |
- content_for(:javascript_packs) do | |
== javascript_pack_tag 'admin/content/form', 'data-turbolinks-track': 'reload' | |
== stylesheet_pack_tag 'admin/content/form' | |
#app-container | |
= simple_form_for [:admin, content], html: { multipart: true, class: 'kt-form' } do |form| | |
.kt-portlet | |
.kt-portlet__head | |
.kt-portlet__head-label | |
h3.kt-portlet__head-title | |
= content.new_record? ? "Creazione contenuto" : "Modifico contenuto <span class='kt-font-boldest'>#{content.name}</span>".html_safe | |
= render partial: "admin/contents/form/content_type", locals: {form: form} | |
div class="row complete-form" style="display: none" | |
.col-lg-8 | |
.kt-portlet | |
.kt-portlet__body | |
.kt-section.kt-section--first | |
.form-group | |
label | |
h4 Titolo del contenuto | |
= form.input :name, placeholder: 'Inserisci il titolo', class: 'input-form', label: false | |
.form-group | |
label Slug | |
= form.input :permalink, class: 'input-form', label: false, :disabled => content.published? | |
.row | |
.col-md-8 | |
.form-group | |
= form.association :author, label: 'Autore Principale', include_blank: false, collection: User.editors | |
.form-group | |
label Altri autori | |
= form.association :additional_authors, label: false, include_blank: false, collection: User.editors, multiple: true, input_html: { class: 'form-control select2 m-select2', style: 'width: 100%'} | |
.form-group | |
label Data pubblicazione: | |
.input-group.date | |
= form.input :published_at, label: false, as: :string, input_html: {readonly: true, value: content.published_at || now, class: 'datetime form-control'}, wrapper: false | |
.input-group-append | |
span.input-group-text | |
i.la.la-calendar.glyphicon-th | |
.form-group | |
label Brand: | |
ajax-multi-select[name='content[stringy_brand_ids]' saved=content.brands.to_json endpoint='/admin/brands/list'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment