1
0
Fork 0

Add create_group

Dieser Commit ist enthalten in:
Angus McLeod 2020-07-16 15:25:06 +10:00
Ursprung 11bf892bcc
Commit 8fb44749f5
7 geänderte Dateien mit 199 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -21,6 +21,7 @@ export default Component.extend(UndoChanges, {
addToGroup: equal('action.type', 'add_to_group'), addToGroup: equal('action.type', 'add_to_group'),
routeTo: equal('action.type', 'route_to'), routeTo: equal('action.type', 'route_to'),
createCategory: equal('action.type', 'create_category'), createCategory: equal('action.type', 'create_category'),
createGroup: equal('action.type', 'create_group'),
apiEmpty: empty('action.api'), apiEmpty: empty('action.api'),
groupPropertyTypes: selectKitContent(['id', 'name']), groupPropertyTypes: selectKitContent(['id', 'name']),
hasAdvanced: or('hasCustomFields', 'routeTo'), hasAdvanced: or('hasCustomFields', 'routeTo'),

Datei anzeigen

@ -17,7 +17,7 @@ export default Component.extend(UndoChanges, {
isText: equal('field.type', 'text'), isText: equal('field.type', 'text'),
isTextarea: equal('field.type', 'textarea'), isTextarea: equal('field.type', 'textarea'),
isUrl: equal('field.type', 'url'), isUrl: equal('field.type', 'url'),
showPrefill: or('isCategory', 'isTag', 'isGroup', 'isDropdown'), showPrefill: or('isText', 'isCategory', 'isTag', 'isGroup', 'isDropdown'),
showContent: or('isCategory', 'isTag', 'isGroup', 'isDropdown'), showContent: or('isCategory', 'isTag', 'isGroup', 'isDropdown'),
showLimit: or('isCategory', 'isTag'), showLimit: or('isCategory', 'isTag'),
showMinLength: or('isText', 'isTextarea', 'isUrl', 'isComposer'), showMinLength: or('isText', 'isTextarea', 'isUrl', 'isComposer'),

Datei anzeigen

@ -165,6 +165,17 @@ const action = {
text_color: "FFFFFF", text_color: "FFFFFF",
parent_category_id: null, parent_category_id: null,
permissions: null permissions: null
},
create_group: {
name: null,
full_name: null,
title: null,
bio_raw: null,
grant_trust_level: null,
mentionable_level: null,
messageable_level: null,
visibility_level: null,
members_visibility_level: null
} }
}, },
mapped: [ mapped: [

Datei anzeigen

@ -340,6 +340,171 @@
</div> </div>
{{/if}} {{/if}}
{{#if createGroup}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.name"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.name
property='name'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.full_name"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.full_name
property='full_name'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.title"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.title
property='title'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.bio_raw"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.bio_raw
property='bio_raw'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.grant_trust_level"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.grant_trust_level
property='grant_trust_level'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.mentionable_level"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.mentionable_level
property='mentionable_level'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.messageable_level"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.messageable_level
property='messageable_level'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.visibility_level"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.visibility_level
property='visibility_level'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.create_group.members_visibility_level"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=action.members_visibility_level
property='members_visibility_level'
onUpdate=(action 'mappedFieldUpdated')
options=(hash
textSelection=true
wizardFieldSelection=true
userFieldSelection=true
context='action'
)}}
</div>
</div>
{{/if}}
{{#if createCategory}} {{#if createCategory}}
<div class="setting full field-mapper-setting"> <div class="setting full field-mapper-setting">
<div class="setting-label"> <div class="setting-label">

Datei anzeigen

@ -249,6 +249,17 @@ en:
text_color: Text color text_color: Text color
parent_category: Parent Category parent_category: Parent Category
permissions: Permissions permissions: Permissions
create_group:
label: Create Group
name: Name
full_name: Full Name
title: Title
bio_raw: About
grant_trust_level: Automatic Trust Level
mentionable_level: Mentionable Level
messageable_level: Messageable Level
visibility_level: Visibility Level
members_visibility_level: Members Visibility Level
submissions: submissions:
nav_label: "Submissions" nav_label: "Submissions"

Datei anzeigen

@ -136,7 +136,16 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
color: mapped_params, color: mapped_params,
text_color: mapped_params, text_color: mapped_params,
parent_category_id: mapped_params, parent_category_id: mapped_params,
permissions: mapped_params permissions: mapped_params,
full_name: mapped_params,
bio_raw: mapped_params,
title: mapped_params,
bio_raw: mapped_params,
grant_trust_level: mapped_params,
mentionable_level: mapped_params,
messageable_level: mapped_params,
visibility_level: mapped_params,
members_visibility_level: mapped_params
] ]
) )
end end

Datei anzeigen

@ -297,8 +297,6 @@ class CustomWizard::Action
def create_category def create_category
guardian.ensure_can_create!(Category) guardian.ensure_can_create!(Category)
byebug
category = category =
begin begin
Category.new(new_category_params.merge(user: user)) Category.new(new_category_params.merge(user: user))