-
Notifications
You must be signed in to change notification settings - Fork 480
/
edit.html.haml
41 lines (38 loc) · 1.32 KB
/
edit.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- content_for(:head) do
%script{src: asset_path('js/blockly.js')}
%script{src: asset_path("js/#{js_locale}/blockly_locale.js")}
%script{src: minifiable_asset_path('js/blocks/edit.js')}
= stylesheet_link_tag 'css/levelbuilder', media: 'all'
%h1= @block.new_record? ? "New Block" : "Editing block #{@block.name}"
.block-editor-container
.editor
= form_for(@block,
url: @block.new_record? ? blocks_path : block_path(id: @block.name),
html: {id: 'edit-block-form', method: @block.new_record? ? 'post' : 'patch'},
) do |f|
= f.label 'Level Type'
= f.select :level_type, ['GamelabJr']
= f.label 'Category'
= f.text_field :category
= f.label 'Name'
= f.text_field :name
= f.label 'Config'
= f.text_area :config
= f.label 'Helper Code'
= f.text_area :helper_code
%div
= f.submit class: 'btn'
- unless @block.new_record?
= form_for(@block,
url: block_path(id: @block.name),
html: {id: 'delete-block-form', method: 'delete'},
) do |f|
= f.submit 'Delete Block',
data: {confirm: 'Are you sure you want to delete this block?'},
class: 'btn btn-danger'
.block-preview
%h3 Block Preview
#blockly-container
%h3 Generated Code
%pre#code-preview
= link_to "Back", blocks_path