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.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")

View file

@ -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

View file

@ -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()

View file

@ -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()