FIX: Use 1 column instead of 4 for permalink destination (#9260)

This commit is contained in:
Kane York 2020-03-25 11:30:39 -07:00 committed by GitHub
parent b09f79366e
commit 6a1fe9ff87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 13 deletions

View File

@ -1,4 +1,7 @@
import { ajax } from "discourse/lib/ajax";
import discourseComputed from "discourse-common/utils/decorators";
import DiscourseURL from "discourse/lib/url";
import Category from "discourse/models/category";
import EmberObject from "@ember/object";
const Permalink = EmberObject.extend({
@ -13,6 +16,16 @@ const Permalink = EmberObject.extend({
});
},
@discourseComputed("category_id")
category: function(category_id) {
return Category.findById(category_id);
},
@discourseComputed("external_url")
linkIsExternal: function(external_url) {
return !DiscourseURL.isInternal(external_url);
},
destroy: function() {
return ajax("/admin/permalinks/" + this.id + ".json", {
type: "DELETE"

View File

@ -15,33 +15,27 @@
<table class='admin-logs-table permalinks grid'>
<thead class="heading-container">
<th class="col heading first url">{{i18n 'admin.permalink.url'}}</th>
<th class="col heading topic">{{i18n 'admin.permalink.topic_title'}}</th>
<th class="col heading post">{{i18n 'admin.permalink.post_title'}}</th>
<th class="col heading category">{{i18n 'admin.permalink.category_title'}}</th>
<th class="col heading external_url">{{i18n 'admin.permalink.external_url'}}</th>
<th class="col heading destination">{{i18n 'admin.permalink.destination'}}</th>
<th class="col heading actions"></th>
</thead>
<tbody>
{{#each model as |pl|}}
<tr class="admin-list-item">
<td class="col first url">{{pl.url}}</td>
<td class="col topic">
<td class="col destination">
{{#if pl.topic_id}}
<a href={{pl.topic_url}}>{{pl.topic_title}}</a>
{{/if}}
</td>
<td class="col post">
{{#if pl.post_id}}
<a href={{pl.post_url}}>#{{pl.post_number}} {{pl.post_topic_title}}</a>
<a href={{pl.post_url}}>{{pl.post_topic_title}} #{{pl.post_number}}</a>
{{/if}}
</td>
<td class="col category">
{{#if pl.category_id}}
<a href={{pl.category_url}}>{{pl.category_name}}</a>
{{category-link pl.category}}
{{/if}}
</td>
<td class="col external_url">
{{#if pl.external_url}}
{{#if pl.linkIsExternal}}
{{d-icon "external-link-alt"}}
{{/if}}
<a href={{pl.external_url}}>{{pl.external_url}}</a>
{{/if}}
</td>

View File

@ -4593,6 +4593,7 @@ en:
category_id: "Category ID"
category_title: "Category"
external_url: "External URL"
destination: "Destination"
delete_confirm: Are you sure you want to delete this permalink?
form:
label: "New:"