2018-07-20 23:35:53 -04:00
|
|
|
<div class="sections">
|
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="admin-dashboard-moderation-top" tagName="span" connectorTagName="div"}}
|
2018-07-19 14:33:11 -04:00
|
|
|
|
2020-04-30 11:31:04 -04:00
|
|
|
{{#if isModeratorsActivityVisible}}
|
|
|
|
<div class="moderators-activity section">
|
|
|
|
<div class="section-title">
|
|
|
|
<h2>
|
|
|
|
<a href={{get-url "/admin/reports/moderators_activity"}}>
|
|
|
|
{{i18n "admin.dashboard.moderators_activity"}}
|
|
|
|
</a>
|
|
|
|
</h2>
|
|
|
|
{{period-chooser
|
|
|
|
period=period
|
|
|
|
action=(action "changePeriod")
|
|
|
|
content=availablePeriods
|
2020-10-05 04:32:12 -04:00
|
|
|
fullDay=false}}
|
2020-04-30 11:31:04 -04:00
|
|
|
</div>
|
2018-07-19 14:33:11 -04:00
|
|
|
|
2020-04-30 11:31:04 -04:00
|
|
|
<div class="section-body">
|
|
|
|
{{admin-report
|
|
|
|
filters=filters
|
|
|
|
showHeader=false
|
|
|
|
dataSourceName="moderators_activity"}}
|
|
|
|
</div>
|
2018-07-19 14:33:11 -04:00
|
|
|
</div>
|
2020-04-30 11:31:04 -04:00
|
|
|
{{/if}}
|
2018-07-19 14:33:11 -04:00
|
|
|
|
2018-07-20 23:35:53 -04:00
|
|
|
<div class="main-section">
|
|
|
|
{{admin-report
|
|
|
|
dataSourceName="flags_status"
|
|
|
|
reportOptions=flagsStatusOptions
|
2018-07-27 01:22:00 -04:00
|
|
|
filters=lastWeekfilters}}
|
2018-07-20 23:35:53 -04:00
|
|
|
|
|
|
|
{{admin-report
|
|
|
|
dataSourceName="post_edits"
|
2018-07-27 01:22:00 -04:00
|
|
|
filters=lastWeekfilters}}
|
2018-07-20 23:35:53 -04:00
|
|
|
|
2018-10-26 09:59:04 -04:00
|
|
|
{{admin-report
|
2018-11-12 16:23:10 -05:00
|
|
|
dataSourceName="user_flagging_ratio"
|
2018-10-26 09:59:04 -04:00
|
|
|
filters=lastWeekfilters
|
2018-11-12 16:23:10 -05:00
|
|
|
reportOptions=userFlaggingRatioOptions}}
|
2018-10-26 09:59:04 -04:00
|
|
|
|
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="admin-dashboard-moderation-bottom" tagName="span" connectorTagName="div"}}
|
2018-07-20 23:35:53 -04:00
|
|
|
</div>
|
|
|
|
</div>
|