Badges admin UI improvements.
* Query param to allow linking. * Better handling of deleting unsaved badges. * New badge list item style improvement.
This commit is contained in:
parent
4de700b49b
commit
a25087b62a
|
@ -8,6 +8,15 @@
|
||||||
**/
|
**/
|
||||||
Discourse.AdminBadgesController = Ember.ArrayController.extend({
|
Discourse.AdminBadgesController = Ember.ArrayController.extend({
|
||||||
itemController: 'adminBadge',
|
itemController: 'adminBadge',
|
||||||
|
queryParams: ['badgeId'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
ID of the currently selected badge.
|
||||||
|
|
||||||
|
@property badgeId
|
||||||
|
@type {Integer}
|
||||||
|
**/
|
||||||
|
badgeId: Em.computed.alias('selectedItem.id'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
We don't allow setting a description if a translation for the given badge
|
We don't allow setting a description if a translation for the given badge
|
||||||
|
@ -68,6 +77,13 @@ Discourse.AdminBadgesController = Ember.ArrayController.extend({
|
||||||
@method destroy
|
@method destroy
|
||||||
**/
|
**/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
|
// Delete immediately if the selected badge is new.
|
||||||
|
if (!this.get('selectedItem.id')) {
|
||||||
|
this.get('model').removeObject(this.get('selectedItem'));
|
||||||
|
this.set('selectedItem', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
return bootbox.confirm(I18n.t("admin.badges.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
|
return bootbox.confirm(I18n.t("admin.badges.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<a {{action selectBadge this}} {{bind-attr class="selected:active"}}>
|
<a {{action selectBadge this}} {{bind-attr class="selected:active"}}>
|
||||||
{{displayName}}
|
{{displayName}}
|
||||||
{{#if newBadge}}
|
{{#if newBadge}}
|
||||||
({{i18n filters.new.lower_title}})
|
<span class="list-badge">{{i18n filters.new.lower_title}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -51,14 +51,14 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#unless readOnly}}
|
<div>
|
||||||
<div>
|
<span>
|
||||||
<span>
|
{{input type="checkbox" checked=allow_title disabled=readOnly}}
|
||||||
{{input type="checkbox" checked=allow_title}}
|
{{i18n admin.badges.allow_title}}
|
||||||
{{i18n admin.badges.allow_title}}
|
</span>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
{{#unless readOnly}}
|
||||||
<div class='buttons'>
|
<div class='buttons'>
|
||||||
<button {{action save}} {{bind-attr disabled=controller.disableSave}} class='btn btn-primary'>{{i18n admin.badges.save}}</button>
|
<button {{action save}} {{bind-attr disabled=controller.disableSave}} class='btn btn-primary'>{{i18n admin.badges.save}}</button>
|
||||||
<span class='saving'>{{savingStatus}}</span>
|
<span class='saving'>{{savingStatus}}</span>
|
||||||
|
|
|
@ -326,6 +326,16 @@ section.details {
|
||||||
.badges {
|
.badges {
|
||||||
.content-list ul {
|
.content-list ul {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.list-badge {
|
||||||
|
float: right;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: normal;
|
||||||
|
padding: 0 6px;
|
||||||
|
color: $secondary;
|
||||||
|
background-color: scale-color($tertiary, $lightness: 50%);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-badge {
|
.current-badge {
|
||||||
|
|
Loading…
Reference in New Issue