Convert many buttons to `d-button`

This commit is contained in:
Robin Ward 2015-01-14 15:36:38 -05:00
parent e7443247dd
commit f8d3764d5e
10 changed files with 57 additions and 41 deletions

View File

@ -118,7 +118,7 @@
</p>
<p class="actions">
<small>{{i18n 'admin.dashboard.last_checked'}}: {{problemsTimestamp}}</small>
<button {{action "refreshProblems"}} class="btn btn-small"><i class="fa fa-refresh"></i>{{i18n 'admin.dashboard.refresh_problems'}}</button>
{{d-button action="refreshProblems" class="btn-small" icon="refresh" label="admin.dashboard.refresh_problems"}}
</p>
</div>
<div class="clearfix"></div>
@ -130,7 +130,7 @@
<div class="problem-messages">
<p>
{{i18n 'admin.dashboard.no_problems'}}
<button {{action "refreshProblems"}} class="btn btn-small"><i class="fa fa-refresh"></i>{{i18n 'admin.dashboard.refresh_problems'}}</button>
{{d-button action="refreshProblems" class="btn-small" icon="refresh" label="admin.dashboard.refresh_problems"}}
</p>
</div>
<div class="clearfix"></div>

View File

@ -3,7 +3,7 @@
<div>
{{i18n 'admin.dashboard.reports.start_date'}} {{input type="date" value=startDate}}
{{i18n 'admin.dashboard.reports.end_date'}} {{input type="date" value=endDate}}
<button {{action "refreshReport"}} class='btn btn-primary'>{{i18n 'admin.dashboard.reports.refresh_report'}}</button>
{{d-button action="refreshReport" class="btn-primary" label="admin.dashboard.reports.refresh_report" icon="refresh"}}
</div>
<div class='view-options'>

View File

@ -3,13 +3,26 @@ import { iconHTML } from 'discourse/helpers/fa-icon';
export default Ember.Component.extend({
tagName: 'button',
classNameBindings: [':btn'],
attributeBindings: ['disabled', 'translatedTitle:title'],
translatedTitle: function() {
var label = this.get('label');
if (label) {
return I18n.t(this.get('label'));
}
}.property('label'),
render: function(buffer) {
var icon = this.get('icon');
if (icon) {
buffer.push(iconHTML(icon) + ' ');
var title = this.get('translatedTitle'),
icon = this.get('icon');
if (title || icon) {
if (icon) { buffer.push(iconHTML(icon) + ' '); }
if (title) { buffer.push(title); }
} else {
// If no label or icon is present, yield
return this._super();
}
buffer.push(I18n.t(this.get('label')));
},
click: function() {

View File

@ -6,13 +6,9 @@
<div class='panel clearfix'>
{{#unless currentUser}}
{{#if showSignUpButton}}
<button {{action "showCreateAccount"}} class='btn btn-primary btn-small sign-up-button'>
{{i18n 'sign_up'}}
</button>
{{d-button action="showCreateAccount" class="btn-primary btn-small sign-up-button" label="sign_up"}}
{{/if}}
<button {{action "showLogin"}} class='btn btn-primary btn-small login-button'>
{{fa-icon "user"}} {{i18n 'log_in'}}
</button>
{{d-button action="showLogin" class="btn-primary btn-small login-button" icon="user" label="log_in"}}
{{/unless}}
<ul class='icons clearfix' role='navigation'>
{{#if currentUser}}

View File

@ -1,6 +1,7 @@
<button {{action "enterTop"}} class='btn full no-text jump-top'>
<i class='fa fa-caret-up'></i> {{{topDate}}}
</button>
<button {{action "enterBottom"}} class='btn full no-text jump-bottom'>
{{{bottomDate}}} <i class='fa fa-caret-down'></i>
</button>
{{#d-button action="enterTop" class="full no-text jump-top"}}
{{fa-icon 'caret-up'}} {{{topDate}}}
{{/d-button}}
{{#d-button action="enterBottom" class="full no-text jump-button"}}
{{{bottomDate}}} {{fa-icon 'caret-down'}}
{{/d-button}}

View File

@ -1,16 +1,19 @@
{{#if expanded}}
<nav id='topic-progress-expanded'>
<button {{action "jumpTop"}} {{bind-attr disabled=jumpTopDisabled}} class='btn full no-text'>
<i class="fa fa-caret-up"></i>
{{i18n 'topic.progress.go_top'}}
</button>
{{d-button action="jumpTop"
disabled=jumpTopDisabled
class="full no-text"
icon="caret-up"
label="topic.progress.go_top"}}
<div class='jump-form'>
{{input value=toPostIndex}} <button {{action "jumpPost"}} class='btn'>{{i18n 'topic.progress.go'}}</button>
{{input value=toPostIndex}}
{{d-button action="jumpPost" label="topic.progress.go"}}
</div>
<button {{action "jumpBottom"}} {{bind-attr disabled=jumpBottomDisabled}} class='btn full no-text jump-bottom'>
{{i18n 'topic.progress.go_bottom'}}
<i class="fa fa-caret-down"></i>
</button>
{{d-button action="jumpBottom"
disabled=jumpBottomDisabled
class="full no-text jump-bottom"
icon="caret-down"
label="topic.progress.go_bottom"}}
</nav>
{{/if}}
<nav id='topic-progress' title="{{i18n 'topic.progress.title'}}" {{bind-attr class="hideProgress:hidden"}}>

View File

@ -22,8 +22,8 @@
{{plugin-outlet "edit-topic"}}
<button class='btn btn-primary btn-small no-text' {{action "finishedEditingTopic"}}>{{fa-icon "check"}}</button>
<button class='btn btn-small no-text' {{action "cancelEditingTopic"}}>{{fa-icon "times"}}</button>
{{d-button action="finishedEditingTopic" class="btn-primary btn-small no-text" icon="check"}}
{{d-button action="cancelEditingTopic" class="btn-small no-text" icon="times"}}
{{else}}
<h1>
{{#unless is_warning}}
@ -118,10 +118,10 @@
<div>{{message}}</div>
{{#if noRetry}}
{{#unless currentUser}}
<button {{action "showLogin"}} class='btn btn-primary topic-retry'>{{fa-icon "user"}} {{i18n 'log_in'}}</button>
{{d-button action="showLogin" class="btn-primary topic-retry" icon="user" label="log_in"}}
{{/unless}}
{{else}}
<button class="btn btn-primary topic-retry" {{action "retryLoading"}}>{{fa-icon "refresh"}} {{i18n 'errors.buttons.again'}}</button>
{{d-button action="retryLoading" class="btn-primary topic-retry" icon="refresh" label="errors.buttons.again"}}
{{/if}}
</div>
{{loading-spinner condition=retrying}}

View File

@ -8,6 +8,6 @@
</li>
<li>{{#link-to 'userActivity.bookmarks' currentUser}}{{i18n 'user.bookmarks'}}{{/link-to}}</li>
<li>{{#link-to 'preferences' currentUser}}{{i18n 'user.preferences'}}{{/link-to}}</li>
<li><button {{action "logout"}} class='btn btn-danger right logout'><i class='fa fa-sign-out'></i>{{i18n 'user.log_out'}}</button></li>
<li>{{d-button action="logout" class="btn-danger right logout" icon="sign-out" label="user.log_out"}}</li>
</ul>
</section>

View File

@ -117,7 +117,7 @@
{{#if email}}
{{email}}
{{else}}
<button class="btn btn-primary" title="{{i18n 'admin.users.check_email.title'}}" {{action "checkEmail" this}}>{{fa-icon "envelope-o"}} {{i18n 'admin.users.check_email.text'}}</button>
{{d-button action="checkEmail" icon="envelope-o" label="admin.users.check_email.text" class="btn-primary"}}
{{/if}}
</dd>
{{/if}}
@ -130,10 +130,7 @@
</dd>
{{/if}}
{{#if canDeleteUser}}
<button class="btn btn-danger" {{action "adminDelete"}}>
<i class="fa fa-exclamation-triangle"></i>
{{i18n 'user.admin_delete'}}
</button>
{{d-button action="adminDelete" icon="exclamation-triangle" label="user.admin_delete" class="btn-danger"}}
{{/if}}
</dl>
{{plugin-outlet "user-profile-secondary"}}
@ -192,7 +189,7 @@
{{#if viewingSelf}}
<div class='user-archive'>
<button {{action "exportUserArchive"}} class="btn" title="{{i18n 'user.download_archive'}}">{{fa-icon "download"}} {{i18n 'user.download_archive'}}</button>
{{d-button action="exportUserArchive" label="user.download_archive" icon="download"}}
</div>
{{/if}}
</section>

View File

@ -1,10 +1,16 @@
#topic-title {
.title-wrapper {float: left; width: 90%;}
.title-wrapper {
float: left;
width: 90%;
.btn-small {
margin: 0 6px 0 0;
}
}
a.badge-category {
margin-top: 5px;
}
}
a.edit-topic i { font-size: 0.8em; }
}