Example of easy_admin config with custom codemirror implementation
var codemirrorInstance = [];
var foundtextareasarr = document.getElementsByClassName('codemirror');
for(var i = 0; foundtextareasarr[i]; ++i) {
codemirrorInstance[i] = CodeMirror.fromTextArea(foundtextareasarr[i], {
lineNumbers: true,
autoCloseTags: true,
viewportMargin: Infinity,
theme:'darcula',
mode: 'htmlmixed',
tags: {
style: [["type", /^text\/(x-)?scss$/, "text/x-scss"],
[null, null, "css"]],
custom: [[null, null, "customMode"]]
},
lineWrapping: true,
extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
});
}
easy_admin:
site_name: '<h2>Learning</h2>'
user:
name_property_path: 'FullName'
design:
menu:
- { label: 'Homepage', route: 'homepage', icon: 'home' }
- { label: 'Blog' }
- { entity: 'Articles', icon: 'newspaper', default: true }
- { entity: 'Category', icon: 'stream'}
brand_color: '#3551BC'
assets:
# # all kinds of assets are supported and linked accordingly
css:
- '/codemirror/lib/codemirror.css'
- '/codemirror/addon/fold/foldgutter.css'
- '/codemirror/theme/darcula.css'
js:
- '/codemirror/lib/codemirror.js'
- '/codemirror/addon/edit/closetag.js'
- '/codemirror/addon/fold/foldcode.js'
- '/codemirror/addon/fold/foldgutter.js'
- '/codemirror/addon/fold/brace-fold.js'
- '/codemirror/addon/fold/xml-fold.js'
- '/codemirror/addon/fold/indent-fold.js'
- '/codemirror/addon/fold/markdown-fold.js'
- '/codemirror/addon/fold/comment-fold.js'
- '/codemirror/mode/xml/xml.js'
- '/codemirror/mode/css/css.js'
- '/codemirror/mode/htmlmixed/htmlmixed.js'
- '/codemirror/lib/codemirror_init.js'
entities:
Category:
class: App\Entity\Categories
label: 'Kategorie'
list:
fields:
- id
- {property: 'category', label: 'Kategoria'}
- {property: 'parentPage', label: 'Nadrzędna'}
# - isEnabled
- {property: 'createdAt', label: 'Utworzono', format: 'j-n-Y'}
- {property: 'UpdatedAt', label: 'Aktualizacja', format: 'j-n-Y'}
form:
title: "Dodaj/edytuj Kategorię"
fields:
- { type: 'group', css_class: 'col-md-10', label: 'Opis'}
- { property: 'description', label: 'Opis kategorii', css_class: 'input-large', type: 'textarea', type_options: {attr: { class: 'codemirror w-100', style: 'max-width:100%' }}}
- { type: 'group', css_class: 'col-md-2', label: 'Dane kategorii'}
- {property: 'category', label: 'Kategoria'}
- { property: 'parentPage', label: 'Wybierz nadzędną', css_class: 'input-large' }
Articles:
class: App\Entity\Articles
label: 'Artykuły'
list:
fields:
- id
- {property: 'title', label: 'Tytuł'}
- {property: 'category_id', label: 'Kategoria', format: 'text'}
- {property: 'user_id', label: 'Autor'}
- isPublished
- {property: 'createdAt', label: 'Utworzono', format: 'j-n-Y'}
form:
title: "Dodaj/edytuj artykuł"
fields:
- { type: 'group', css_class: 'col-md-10', label: 'Artykuł'}
- { property: 'content', label: 'Opis kategorii', css_class: 'input-large', type: 'textarea', type_options: {attr: { class: 'codemirror w-100', style: 'max-width:100%' }}}
- { type: 'group', css_class: 'col-md-2', label: 'Dane artykułu'}
- {property: 'title', label: 'Tytuł'}
- {property: 'category_id', label: 'Kategoria'}
- {property: 'user_id', label: 'Autor'}
- isPublished
- { property: 'isPublished', label: 'Opublikowany?' }