2014-03-05 07:52:20 -05:00
|
|
|
<div class="badges">
|
|
|
|
|
|
|
|
<div class='content-list span6'>
|
|
|
|
<h3>{{i18n admin.badges.title}}</h3>
|
|
|
|
<ul>
|
|
|
|
{{#each}}
|
|
|
|
<li>
|
2014-09-30 12:36:23 -04:00
|
|
|
<a {{action "selectBadge" this}} {{bind-attr class="selected:active"}}>
|
2014-10-16 16:43:10 -04:00
|
|
|
{{badge-button badge=this}}
|
2014-03-05 07:52:20 -05:00
|
|
|
{{#if newBadge}}
|
2014-05-19 01:20:57 -04:00
|
|
|
<span class="list-badge">{{i18n filters.new.lower_title}}</span>
|
2014-03-05 07:52:20 -05:00
|
|
|
{{/if}}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{{/each}}
|
|
|
|
</ul>
|
2014-09-30 12:36:23 -04:00
|
|
|
<button {{action "createNewBadge"}} {{bind-attr disabled=newBadgeExists}} class='btn'><i class="fa fa-plus"></i>{{i18n admin.badges.new}}</button>
|
2014-03-05 07:52:20 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{{#if selectedItem}}
|
2014-05-19 00:29:12 -04:00
|
|
|
{{#with selectedItem controller='adminBadge'}}
|
2014-03-19 01:13:38 -04:00
|
|
|
<div class='current-badge span13'>
|
2014-03-05 07:52:20 -05:00
|
|
|
<form class="form-horizontal">
|
|
|
|
<div>
|
|
|
|
<label for="name">{{i18n admin.badges.name}}</label>
|
2014-07-16 22:25:16 -04:00
|
|
|
{{input type="text" name="name" value=name}}
|
2014-03-05 07:52:20 -05:00
|
|
|
</div>
|
|
|
|
|
2014-05-19 00:29:12 -04:00
|
|
|
{{#if showDisplayName}}
|
|
|
|
<div>
|
|
|
|
<strong>{{i18n admin.badges.display_name}}</strong>
|
|
|
|
{{displayName}}
|
|
|
|
</div>
|
2014-03-05 07:52:20 -05:00
|
|
|
{{/if}}
|
|
|
|
|
2014-06-10 03:32:22 -04:00
|
|
|
<div>
|
|
|
|
<label for="name">{{i18n admin.badges.icon}}</label>
|
2014-07-16 22:25:16 -04:00
|
|
|
{{input type="text" name="name" value=icon}}
|
2014-10-16 16:43:10 -04:00
|
|
|
<p class='help'>{{i18n admin.badges.icon_help}}</p>
|
2014-06-10 03:32:22 -04:00
|
|
|
</div>
|
|
|
|
|
2014-03-05 07:52:20 -05:00
|
|
|
<div>
|
|
|
|
<label for="badge_type_id">{{i18n admin.badges.badge_type}}</label>
|
|
|
|
{{view Ember.Select name="badge_type_id" value=badge_type_id
|
|
|
|
content=controller.badgeTypes
|
|
|
|
optionValuePath="content.id"
|
2014-05-19 00:29:12 -04:00
|
|
|
optionLabelPath="content.name"
|
|
|
|
disabled=readOnly}}
|
2014-03-05 07:52:20 -05:00
|
|
|
</div>
|
|
|
|
|
2014-07-21 21:11:30 -04:00
|
|
|
<div>
|
|
|
|
<label for="badge_grouping_id">{{i18n admin.badges.badge_grouping}}</label>
|
|
|
|
{{view Ember.Select name="badge_grouping_id" value=badge_grouping_id
|
|
|
|
content=controller.badgeGroupings
|
|
|
|
optionValuePath="content.id"
|
2014-07-24 04:28:09 -04:00
|
|
|
optionLabelPath="content.name"}}
|
2014-09-30 12:36:23 -04:00
|
|
|
<button {{action "editGroupings" controller.badgeGroupings}}><i class="fa fa-pencil"></i></button>
|
2014-07-21 21:11:30 -04:00
|
|
|
</div>
|
|
|
|
|
2014-07-24 04:28:09 -04:00
|
|
|
|
2014-03-05 07:52:20 -05:00
|
|
|
<div>
|
|
|
|
<label for="description">{{i18n admin.badges.description}}</label>
|
|
|
|
{{#if controller.canEditDescription}}
|
|
|
|
{{textarea name="description" value=description}}
|
|
|
|
{{else}}
|
2014-05-21 03:22:42 -04:00
|
|
|
{{textarea name="description" value=displayDescription disabled=true}}
|
2014-03-05 07:52:20 -05:00
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
|
2014-07-24 04:28:09 -04:00
|
|
|
<div>
|
|
|
|
<label for="query">{{i18n admin.badges.query}}</label>
|
|
|
|
{{textarea name="query" value=query disabled=readOnly}}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{#if hasQuery}}
|
|
|
|
|
2014-09-30 12:36:23 -04:00
|
|
|
<a href {{action "preview" this "false"}}>{{i18n admin.badges.preview.link_text}}</a>
|
FEATURE: Badge query validation, preview results, and EXPLAIN
Upon saving a badge or requesting a badge result preview,
BadgeGranter.contract_checks! will examine the provided badge SQL for
some contractual obligations - namely, the returned columns and use of
trigger parameters.
Saving the badge is wrapped in a transaction to make this easier, by
raising ActiveRecord::Rollback on a detected violation.
On the client, a modal view is added for the badge query sample run
results, named admin-badge-preview.
The preview action is moved up to the route.
The save action, on failure, triggers a 'saveError' action (also in the
route).
The preview action gains a new parameter, 'explain', which will give the
output of an EXPLAIN query for the badge sql, which can be used by forum
admins to estimate the cost of their badge queries.
The preview link is replaced by two links, one which omits (false) and
includes (true) the EXPLAIN query.
The Badge.save() method is amended to propogate errors.
Badge::Trigger gets some utility methods for use in the
BadgeGranter.contract_checks! method.
Additionally, extra checks outside of BadgeGranter.contract_checks! are
added in the preview() method, to cover cases of null granted_at
columns.
An uninitialized variable path is removed in the backfill() method.
TODO - it would be nice to be able to get the actual names of all
columns the provided query returns, so we could give more errors
2014-08-25 18:17:29 -04:00
|
|
|
|
|
2014-09-30 12:36:23 -04:00
|
|
|
<a href {{action "preview" this "true"}}>{{i18n admin.badges.preview.plan_text}}</a>
|
FEATURE: Badge query validation, preview results, and EXPLAIN
Upon saving a badge or requesting a badge result preview,
BadgeGranter.contract_checks! will examine the provided badge SQL for
some contractual obligations - namely, the returned columns and use of
trigger parameters.
Saving the badge is wrapped in a transaction to make this easier, by
raising ActiveRecord::Rollback on a detected violation.
On the client, a modal view is added for the badge query sample run
results, named admin-badge-preview.
The preview action is moved up to the route.
The save action, on failure, triggers a 'saveError' action (also in the
route).
The preview action gains a new parameter, 'explain', which will give the
output of an EXPLAIN query for the badge sql, which can be used by forum
admins to estimate the cost of their badge queries.
The preview link is replaced by two links, one which omits (false) and
includes (true) the EXPLAIN query.
The Badge.save() method is amended to propogate errors.
Badge::Trigger gets some utility methods for use in the
BadgeGranter.contract_checks! method.
Additionally, extra checks outside of BadgeGranter.contract_checks! are
added in the preview() method, to cover cases of null granted_at
columns.
An uninitialized variable path is removed in the backfill() method.
TODO - it would be nice to be able to get the actual names of all
columns the provided query returns, so we could give more errors
2014-08-25 18:17:29 -04:00
|
|
|
{{#if preview_loading}}
|
|
|
|
{{i18n loading}}...
|
|
|
|
{{/if}}
|
2014-07-24 04:28:09 -04:00
|
|
|
|
|
|
|
<div>
|
|
|
|
<span>
|
|
|
|
{{input type="checkbox" checked=auto_revoke disabled=readOnly}}
|
|
|
|
{{i18n admin.badges.auto_revoke}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<span>
|
|
|
|
{{input type="checkbox" checked=target_posts disabled=readOnly}}
|
|
|
|
{{i18n admin.badges.target_posts}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<label for="trigger">{{i18n admin.badges.trigger}}</label>
|
|
|
|
{{view Ember.Select name="trigger" value=trigger
|
|
|
|
content=controller.badgeTriggers
|
|
|
|
optionValuePath="content.id"
|
|
|
|
optionLabelPath="content.name"
|
|
|
|
disabled=readOnly}}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{/if}}
|
|
|
|
|
2014-05-19 01:20:57 -04:00
|
|
|
<div>
|
|
|
|
<span>
|
2014-07-29 18:46:46 -04:00
|
|
|
{{input type="checkbox" checked=allow_title}}
|
2014-05-19 01:20:57 -04:00
|
|
|
{{i18n admin.badges.allow_title}}
|
|
|
|
</span>
|
|
|
|
</div>
|
2014-04-25 14:25:29 -04:00
|
|
|
|
2014-05-21 03:22:42 -04:00
|
|
|
<div>
|
|
|
|
<span>
|
|
|
|
{{input type="checkbox" checked=multiple_grant disabled=readOnly}}
|
|
|
|
{{i18n admin.badges.multiple_grant}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
2014-07-03 03:44:16 -04:00
|
|
|
<div>
|
|
|
|
<span>
|
|
|
|
{{input type="checkbox" checked=listable disabled=readOnly}}
|
|
|
|
{{i18n admin.badges.listable}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
2014-07-24 04:28:09 -04:00
|
|
|
<div>
|
|
|
|
<span>
|
|
|
|
{{input type="checkbox" checked=show_posts disabled=readOnly}}
|
|
|
|
{{i18n admin.badges.show_posts}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
2014-07-14 03:40:01 -04:00
|
|
|
<div>
|
|
|
|
<span>
|
|
|
|
{{input type="checkbox" checked=enabled}}
|
|
|
|
{{i18n admin.badges.enabled}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class='buttons'>
|
2014-09-30 12:36:23 -04:00
|
|
|
<button {{action "save"}} {{bind-attr disabled=controller.disableSave}} class='btn btn-primary'>{{i18n admin.badges.save}}</button>
|
2014-07-14 03:40:01 -04:00
|
|
|
<span class='saving'>{{savingStatus}}</span>
|
|
|
|
{{#unless readOnly}}
|
2014-09-30 12:36:23 -04:00
|
|
|
<a {{action "destroy"}} class='delete-link'>{{i18n admin.badges.delete}}</a>
|
2014-07-14 03:40:01 -04:00
|
|
|
{{/unless}}
|
|
|
|
</div>
|
2014-03-05 07:52:20 -05:00
|
|
|
</form>
|
|
|
|
</div>
|
2014-06-27 15:51:41 -04:00
|
|
|
|
2014-07-23 22:39:09 -04:00
|
|
|
{{#if grant_count}}
|
2014-06-27 15:51:41 -04:00
|
|
|
<div class="span13 current-badge-actions">
|
|
|
|
<div>
|
2014-07-23 22:39:09 -04:00
|
|
|
{{#link-to 'badges.show' this}}{{i18n badges.granted count=grant_count}}{{/link-to}}
|
2014-06-27 15:51:41 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2014-07-23 22:39:09 -04:00
|
|
|
{{/if}}
|
2014-03-05 07:52:20 -05:00
|
|
|
{{/with}}
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
</div>
|