discourse/app/assets/javascripts/admin/addon/templates/web-hooks-show.hbs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
4.0 KiB
Handlebars
Raw Normal View History

2016-06-15 13:49:57 -04:00
{{#link-to "adminWebHooks" class="go-back"}}
{{d-icon "arrow-left"}}
2016-06-15 13:49:57 -04:00
{{i18n "admin.web_hooks.go_back"}}
{{/link-to}}
<div class="web-hook-container">
<p>{{i18n "admin.web_hooks.detailed_instruction"}}</p>
<form class="web-hook form-horizontal">
2021-09-20 09:52:03 -04:00
<div class="control-group">
2016-06-15 13:49:57 -04:00
<label for="payload-url">{{i18n "admin.web_hooks.payload_url"}}</label>
{{text-field name="payload-url" value=model.payload_url placeholderKey="admin.web_hooks.payload_url_placeholder"}}
{{input-tip validation=urlValidation}}
</div>
2021-09-20 09:52:03 -04:00
<div class="control-group">
2016-06-15 13:49:57 -04:00
<label for="content-type">{{i18n "admin.web_hooks.content_type"}}</label>
{{combo-box
content=contentTypes
name="content-type"
value=model.content_type
onChange=(action (mut model.content_type))
}}
2016-06-15 13:49:57 -04:00
</div>
2021-09-20 09:52:03 -04:00
<div class="control-group">
2016-06-15 13:49:57 -04:00
<label for="secret">{{i18n "admin.web_hooks.secret"}}</label>
{{text-field name="secret" value=model.secret placeholderKey="admin.web_hooks.secret_placeholder"}}
{{input-tip validation=secretValidation}}
</div>
2021-09-20 09:52:03 -04:00
<div class="control-group">
2016-06-15 13:49:57 -04:00
<label>{{i18n "admin.web_hooks.event_chooser"}}</label>
<div>
{{radio-button class="subscription-choice" name="subscription-choice" value="individual" selection=model.webHookType}}
{{i18n "admin.web_hooks.individual_event"}}
{{input-tip validation=eventTypeValidation}}
</div>
{{#unless model.wildcard_web_hook}}
<div class="event-selector">
{{#each eventTypes as |type|}}
{{admin-web-hook-event-chooser type=type model=model.web_hook_event_types}}
{{/each}}
</div>
{{/unless}}
<div>
{{radio-button class="subscription-choice" name="subscription-choice" value="wildcard" selection=model.webHookType}}
{{i18n "admin.web_hooks.wildcard_event"}}
</div>
</div>
2021-09-20 09:52:03 -04:00
<div class="filters control-group">
2018-07-02 23:14:53 -04:00
<div class="filter">
<label>{{d-icon "circle" class="tracking"}}{{i18n "admin.web_hooks.categories_filter"}}</label>
{{category-selector
categories=model.categories
onChange=(action (mut model.categories))
}}
2016-06-15 13:49:57 -04:00
<div class="instructions">{{i18n "admin.web_hooks.categories_filter_instructions"}}</div>
</div>
{{#if showTagsFilter}}
<div class="filter">
<label>{{d-icon "circle" class="tracking"}}{{i18n "admin.web_hooks.tags_filter"}}</label>
{{tag-chooser tags=model.tag_names everyTag=true excludeSynonyms=true}}
<div class="instructions">{{i18n "admin.web_hooks.tags_filter_instructions"}}</div>
</div>
{{/if}}
2018-07-02 23:14:53 -04:00
<div class="filter">
<label>{{d-icon "circle" class="tracking"}}{{i18n "admin.web_hooks.groups_filter"}}</label>
2016-06-15 13:49:57 -04:00
{{group-selector groupNames=model.groupsFilterInName groupFinder=model.groupFinder}}
<div class="instructions">{{i18n "admin.web_hooks.groups_filter_instructions"}}</div>
</div>
</div>
DEV: Update default tagName and connectorTagName for plugin outlets (#13685) This commit should be a no-op for all existing core outlets. Outlets which are introduced by themes/plugins may see a change in behavior, and should follow the steps below if they want to maintain their previous behavior. `tagName="" connectorTagName=""` is almost always the correct choice for plugin outlets. 40eba8cd introduced a `noTags=true` shortcut which achieved this, and left a comment saying it should be the future default. This commit does exactly that. To avoid any breaking changes for plugins, all existing plugin outlets have been reviewed and adjusted by following this logic: 1) If `noTags=true`, remove the `noTags` parameter, and do not complete any further steps 2) If `tagName` is not specified, set `tagName="span"` (the previous default) 3) If `connectorTagName` is not specified, set `selectorTagName="div"` (the previous default) 4) If `tagName=""`, remove it 5) If `connectorTagName=""`, remove it The updates were accomplished with the help of a ruby script: ```ruby def removeAttr(tag, attribute) tag = tag.sub /\s#{attribute}="?\w*"? /, " " tag = tag.sub /\s#{attribute}="?\w*"?}}/, "}}" tag = tag.sub /^\s*#{attribute}="?\w*"?\n/, "" tag end files = Dir.glob("app/assets/javascripts/**/*.hbs") puts "Checking #{files.count} files..." files.each do |f| content = File.read(f) count = 0 edits = 0 content.gsub!(/{{\s*plugin-outlet.*?}}/m) do |match| count += 1 result = match noTags = result.include?("noTags=true") tagName = result[/tagName="(\w*)"/, 1] connectorTagName = result[/connectorTagName="(\w*)"/, 1] if noTags result = removeAttr(result, "noTags") else if connectorTagName == "" result = removeAttr(result, "connectorTagName") elsif connectorTagName.nil? result = result.sub(/name="[\w-]+"/) { |m| "#{m} connectorTagName=\"div\"" } end if tagName == "" result = removeAttr(result, "tagName") elsif tagName.nil? result = result.sub(/name="[\w-]+"/) { |m| "#{m} tagName=\"span\"" } end end edits += 1 if match != result result end puts "#{count} outlets, #{edits} edited -> #{f}" File.write(f, content) end ```
2022-01-06 15:38:17 -05:00
{{plugin-outlet name="web-hook-fields" tagName="span" connectorTagName="div" args=(hash model=model)}}
2016-06-15 13:49:57 -04:00
<div>
{{input type="checkbox" name="verify_certificate" checked=model.verify_certificate}} {{i18n "admin.web_hooks.verify_certificate"}}
</div>
<div>
<div>
{{input type="checkbox" name="active" checked=model.active}} {{i18n "admin.web_hooks.active"}}
</div>
{{#if model.active}}
<div class="instructions">{{i18n "admin.web_hooks.active_notice"}}</div>
{{/if}}
</div>
</form>
<div class="controls">
{{d-button class="btn-default" translatedLabel=saveButtonText action=(action "save") disabled=saveButtonDisabled}}
2016-06-15 13:49:57 -04:00
{{#unless model.isNew}}
{{d-button class="btn-danger" label="admin.web_hooks.destroy" action=(action "destroy")}}
2016-06-15 13:49:57 -04:00
{{#link-to "adminWebHooks.showEvents" model.id class="btn"}}
{{i18n "admin.web_hooks.events.go_events"}}
{{/link-to}}
{{/unless}}
<span class="saving">{{savingStatus}}</span>
</div>
</div>