mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Made creating components open to everyone!
This commit is contained in:
parent
44e5c2826c
commit
d74a778f67
4 changed files with 11 additions and 7 deletions
|
@ -7,7 +7,10 @@ block modal-body-content
|
||||||
form.form
|
form.form
|
||||||
.form-group
|
.form-group
|
||||||
label(for="level-component-system", data-i18n="editor.new_component_field_system").control-label System
|
label(for="level-component-system", data-i18n="editor.new_component_field_system").control-label System
|
||||||
input.form-control#level-component-system(name="system", type="text")
|
select.form-control#level-component-system(name='system')
|
||||||
|
for system in systems
|
||||||
|
option(value=system)= system
|
||||||
|
//input.form-control#level-component-system(name="system", type="text")
|
||||||
.form-group
|
.form-group
|
||||||
label(for="level-component-name", data-i18n="general.name").control-label Name
|
label(for="level-component-name", data-i18n="general.name").control-label Name
|
||||||
input.form-control#level-component-name(name="name", type="text")
|
input.form-control#level-component-name(name="name", type="text")
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#components-treema.nano-content
|
#components-treema.nano-content
|
||||||
|
|
||||||
.edit-component-container
|
.edit-component-container
|
||||||
if me.isAdmin()
|
if !me.get('anonymous')
|
||||||
button.btn.btn-primary#create-new-component-button-no-select
|
button.btn.btn-primary#create-new-component-button-no-select
|
||||||
span.icon-plus
|
span.icon-plus
|
||||||
span.text(data-i18n="editor.level_component_btn_new") Create New Component
|
span.text(data-i18n="editor.level_component_btn_new") Create New Component
|
||||||
|
|
|
@ -13,7 +13,12 @@ module.exports = class LevelComponentNewView extends View
|
||||||
events:
|
events:
|
||||||
'click #new-level-component-submit': 'makeNewLevelComponent'
|
'click #new-level-component-submit': 'makeNewLevelComponent'
|
||||||
'submit form': 'makeNewLevelComponent'
|
'submit form': 'makeNewLevelComponent'
|
||||||
|
|
||||||
|
getRenderData: ->
|
||||||
|
c = super()
|
||||||
|
c.systems = LevelComponent.schema.properties.system.enum
|
||||||
|
c
|
||||||
|
|
||||||
makeNewLevelComponent: (e) ->
|
makeNewLevelComponent: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
system = @$el.find('#level-component-system').val()
|
system = @$el.find('#level-component-system').val()
|
||||||
|
|
|
@ -21,8 +21,4 @@ LevelComponentHandler = class LevelComponentHandler extends Handler
|
||||||
props.push('official') if req.user?.isAdmin()
|
props.push('official') if req.user?.isAdmin()
|
||||||
props
|
props
|
||||||
|
|
||||||
hasAccess: (req) ->
|
|
||||||
req.method in ['GET', 'PUT'] or req.user?.isAdmin()
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new LevelComponentHandler()
|
module.exports = new LevelComponentHandler()
|
||||||
|
|
Loading…
Reference in a new issue