= javascript_include_tag 'pages_cms/wysihtml5x-toolbar' = javascript_include_tag 'pages_cms/advanced_and_extended' = javascript_include_tag 'pages_cms/select2.min' = stylesheet_link_tag 'pages_cms/select2.min' = form_for article, url: url, method: method do |f| = f.text_field :title, placeholder: 'article title', class: 'form-control med', 'data-parsley-minlength' => '1'
- if f.object.content? - markdown = '' - wysiwyg = 'active' - elsif f.object.content_md? - markdown = 'active' - wysiwyg = '' - else - markdown = '' - wysiwyg = 'active' %div.row %div.col-md-6
%ul.nav.nav-tabs{ role: 'tablist' } %li{ role: 'presentation', class: markdown } %a{ href: '#markdown', 'aria-controls' => 'markdown', role: 'tab', 'data-toggle' => 'tab' } Markdown Editor %li{ role: 'presentation', class: wysiwyg } %a{ href: '#wysiwyg', 'aria-controls' => 'wysiwyg', role: 'tab', 'data-toggle' => 'tab' } Wysiwyg Editor %div.col-md-6 = f.select(:image_id, PagesCms::Image.all.collect {|p| [p.name, p.id] }, {include_blank: 'Choose a picture'}, class: 'form-control') = f.text_field :tags, value: f.object.tags.join(','), placeholder: 'tags, comma separated', class: 'form-control'
%div.tab-content %div.tab-pane#markdown{ role: 'tabpanel', class: markdown }
= f.text_area :content_md, class: 'form-control', rows: 15 %div.tab-pane#wysiwyg{ role: 'tabpanel', class: wysiwyg } = render 'pages_cms/admin/pages/editor', f: f = f.label :draft = f.check_box :draft, value: false = f.label :archived = f.check_box :archived, value: false = f.submit 'Submit', class: 'btn btn-primary'