Made creating components open to everyone!

This commit is contained in:
Scott Erickson 2014-07-09 12:19:49 -07:00
parent 44e5c2826c
commit d74a778f67
4 changed files with 11 additions and 7 deletions

View file

@ -7,7 +7,10 @@ block modal-body-content
form.form
.form-group
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
label(for="level-component-name", data-i18n="general.name").control-label Name
input.form-control#level-component-name(name="name", type="text")

View file

@ -6,7 +6,7 @@
#components-treema.nano-content
.edit-component-container
if me.isAdmin()
if !me.get('anonymous')
button.btn.btn-primary#create-new-component-button-no-select
span.icon-plus
span.text(data-i18n="editor.level_component_btn_new") Create New Component

View file

@ -13,7 +13,12 @@ module.exports = class LevelComponentNewView extends View
events:
'click #new-level-component-submit': 'makeNewLevelComponent'
'submit form': 'makeNewLevelComponent'
getRenderData: ->
c = super()
c.systems = LevelComponent.schema.properties.system.enum
c
makeNewLevelComponent: (e) ->
e.preventDefault()
system = @$el.find('#level-component-system').val()

View file

@ -21,8 +21,4 @@ LevelComponentHandler = class LevelComponentHandler extends Handler
props.push('official') if req.user?.isAdmin()
props
hasAccess: (req) ->
req.method in ['GET', 'PUT'] or req.user?.isAdmin()
module.exports = new LevelComponentHandler()