Broken WIP

This commit is contained in:
Robin Ward 2015-04-28 17:05:06 -04:00
parent 48f4589c6f
commit b3b4fd21ed
55 changed files with 24009 additions and 11887 deletions

View File

@ -18,10 +18,10 @@
</div>
</div>
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#if showHtml}}
{{{html_content}}}
{{else}}
<pre>{{{text_content}}}</pre>
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -147,7 +147,7 @@
</tbody>
</table>
{{loading-spinner condition=view.loading}}
{{conditional-loading-spinner condition=view.loading}}
{{else}}
<p>{{i18n 'admin.flags.no_results'}}</p>
{{/if}}

View File

@ -4,7 +4,7 @@
</p>
<br>
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#if model.length}}
<div class='table screened-emails'>
@ -25,4 +25,4 @@
{{else}}
{{i18n 'search.no_results'}}
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -7,7 +7,7 @@
{{screened-ip-address-form action="recordAdded"}}
<br/>
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#if model.length}}
<div class='table admin-logs-table screened-ip-addresses'>
@ -27,4 +27,4 @@
{{else}}
{{i18n 'search.no_results'}}
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -4,7 +4,7 @@
</p>
<br>
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#if model.length}}
<div class='table screened-urls'>
<div class="heading-container">
@ -21,4 +21,4 @@
{{else}}
{{i18n 'search.no_results'}}
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -48,11 +48,11 @@
<div class="clearfix"></div>
</div>
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#if model.length}}
{{view "staff-action-logs-list" content=controller}}
{{else}}
{{i18n 'search.no_results'}}
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</div>

View File

@ -20,7 +20,7 @@
{{/if}}
</div>
{{#loading-spinner condition=refreshing}}
{{#conditional-loading-spinner condition=refreshing}}
<table class='table report'>
<tr>
<th>{{xaxis}}</th>
@ -43,4 +43,4 @@
</tr>
{{/each}}
</table>
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -6,7 +6,7 @@
</div>
</div>
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
<div class='admin-container user-badges'>
<h2>{{i18n 'admin.badges.grant_badge'}}</h2>
<br>
@ -67,4 +67,4 @@
{{/each}}
</table>
</div>
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -1,7 +1,7 @@
{{#if hasSelection}}
<div id='selected-controls'>
<button {{action "approveUsers"}} class='btn'>{{countI18n admin.users.approved_selected count=selectedCount}}</button>
<button {{action "rejectUsers"}} class='btn btn-danger'>{{countI18n admin.users.reject_selected count=selectedCount}}</button>
<button {{action "approveUsers"}} class='btn'>{{count-i18n key=admin.users.approved_selected count=selectedCount}}</button>
<button {{action "rejectUsers"}} class='btn btn-danger'>{{count-i18n key=admin.users.reject_selected count=selectedCount}}</button>
</div>
{{/if}}
@ -19,7 +19,7 @@
{{/unless}}
</div>
{{#loading-spinner condition=refreshing}}
{{#conditional-loading-spinner condition=refreshing}}
{{#if model}}
<table class='table'>
<tr>
@ -81,4 +81,4 @@
{{else}}
<p>{{i18n 'search.no_results'}}</p>
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -1,4 +1,4 @@
import ComboboxView from 'discourse/views/combo-box';
import ComboboxView from 'discourse/components/combo-box';
import { categoryBadgeHTML } from 'discourse/helpers/category-link';
export default ComboboxView.extend({
@ -41,7 +41,7 @@ export default ComboboxView.extend({
}
}.property(),
template(item) {
comboTemplate(item) {
let category;

View File

@ -1,5 +1,4 @@
// This view handles rendering of a combobox
export default Discourse.View.extend({
export default Ember.Component.extend({
tagName: 'select',
attributeBindings: ['tabindex'],
classNames: ['combobox'],
@ -65,7 +64,7 @@ export default Discourse.View.extend({
o.selected = !!$(o).attr('selected');
});
$elem.select2({formatResult: this.template, minimumResultsForSearch: 5, width: 'resolve'});
$elem.select2({formatResult: this.comboTemplate, minimumResultsForSearch: 5, width: 'resolve'});
const castInteger = this.get('castInteger');
$elem.on("change", function (e) {

View File

@ -9,7 +9,7 @@ export default Ember.Component.extend({
if (this.get('condition')) {
buffer.push('<div class="spinner ' + this.get('size') + '"}}></div>');
} else {
return this._super();
return this._super(buffer);
}
},

View File

@ -0,0 +1,8 @@
export default Ember.Component.extend(Discourse.StringBuffer, {
tagName: 'span',
rerenderTriggers: ['count', 'suffix'],
renderString: function(buffer) {
buffer.push(I18n.t(this.get('key') + (this.get('suffix') || ''), { count: this.get('count') }));
}
});

View File

@ -26,7 +26,7 @@ export default Ember.Component.extend({
if (label) { buffer.push(label); }
} else {
// If no label or icon is present, yield
return this._super();
return this._super(buffer);
}
},

View File

@ -0,0 +1,17 @@
import StringBuffer from 'discourse/mixins/string-buffer';
import { iconHTML } from 'discourse/helpers/fa-icon';
export default Ember.Component.extend(StringBuffer, {
classNameBindings: [':tip', 'good', 'bad'],
rerenderTriggers: ['validation'],
bad: Em.computed.alias('validation.failed'),
good: Em.computed.not('bad'),
renderString(buffer) {
const reason = this.get('validation.reason');
if (reason) {
buffer.push(iconHTML(this.get('good') ? 'check' : 'times') + ' ' + reason);
}
}
});

View File

@ -1,23 +1,12 @@
/**
This view extends the functionality of InputTipView with these extra features:
* it can be dismissed
* it bounces when it's shown
* it's absolutely positioned beside the input element, with the help of
extra css you'll need to write to line it up correctly.
import { iconHTML } from 'discourse/helpers/fa-icon';
@class PopupInputTipView
@extends Discourse.View
@namespace Discourse
@module Discourse
**/
Discourse.PopupInputTipView = Discourse.View.extend({
templateName: 'popup_input_tip',
export default Ember.Component.extend({
classNameBindings: [':popup-tip', 'good', 'bad', 'shownAt::hide'],
animateAttribute: null,
bouncePixels: 6,
bounceDelay: 100,
click: function() {
click() {
this.set('shownAt', false);
},
@ -43,17 +32,23 @@ Discourse.PopupInputTipView = Discourse.View.extend({
}
}.observes('shownAt'),
bounceLeft: function($elem) {
render(buffer) {
const reason = this.get('validation.reason');
if (!reason) { return; }
buffer.push("<span class='close'>" + iconHTML('times-circle') + "</span>");
buffer.push(reason);
},
bounceLeft($elem) {
for( var i = 0; i < 5; i++ ) {
$elem.animate({ left: '+=' + this.bouncePixels }, this.bounceDelay).animate({ left: '-=' + this.bouncePixels }, this.bounceDelay);
}
},
bounceRight: function($elem) {
bounceRight($elem) {
for( var i = 0; i < 5; i++ ) {
$elem.animate({ right: '-=' + this.bouncePixels }, this.bounceDelay).animate({ right: '+=' + this.bouncePixels }, this.bounceDelay);
}
}
});
Discourse.View.registerHelper('popupInputTip', Discourse.PopupInputTipView);

View File

@ -1,17 +0,0 @@
/**
Set up an i18n binding that will update as a count changes, complete with pluralization.
@method countI18n
@for Handlebars
**/
Ember.Handlebars.registerHelper('countI18n', function(key, options) {
var view = Discourse.View.extend(Discourse.StringBuffer, {
tagName: 'span',
rerenderTriggers: ['count', 'suffix'],
renderString: function(buffer) {
buffer.push(I18n.t(key + (this.get('suffix') || ''), { count: this.get('count') }));
}
});
return Ember.Handlebars.helpers.view.call(this, view, options);
});

View File

@ -1,4 +1,4 @@
Handlebars.registerHelper('custom-html', function(name, contextString, options) {
Ember.Handlebars.registerHelper('custom-html', function(name, contextString, options) {
var html = Discourse.HTML.getCustomHTML(name);
if (html) { return html; }

View File

@ -1,5 +1,3 @@
import ConditionalLoadingSpinner from 'discourse/components/conditional-loading-spinner';
function renderSpinner(cssClass) {
var html = "<div class='spinner";
if (cssClass) { html += ' ' + cssClass; }
@ -7,25 +5,9 @@ function renderSpinner(cssClass) {
}
var spinnerHTML = renderSpinner();
/**
If you use it as a regular helper {{loading-spinner}} you'll just get the
HTML for a spinner.
If you provide an `condition=xyz` parameter, it will be bound to that property
and only show when it's truthy.
If you use the block form `{{#loading-spinner}} ... {{/loading-spinner}`,
the contents will shown when the loading condition finishes.
**/
Handlebars.registerHelper('loading-spinner', function(options) {
var hash = options.hash;
if (hash && hash.condition) {
var types = options.hashTypes;
Discourse.Utilities.normalizeHash(hash, types);
return Ember.Handlebars.helpers.view.call(this, ConditionalLoadingSpinner, options);
} else {
return new Handlebars.SafeString(renderSpinner((hash && hash.size) ? hash.size : undefined));
}
Ember.Handlebars.registerHelper('loading-spinner', function(params) {
const hash = params.hash;
return new Handlebars.SafeString(renderSpinner((hash && hash.size) ? hash.size : undefined));
});
export { spinnerHTML, renderSpinner };

View File

@ -102,6 +102,9 @@ function buildConnectorCache() {
export default function(connectionName, options) {
if (!_connectorCache) { buildConnectorCache(); }
console.warn('plugin outlets are disabled');
return;
if (_connectorCache[connectionName]) {
const childViews = _connectorCache[connectionName];

View File

@ -22,11 +22,14 @@ function resolveParams(ctx, options) {
}
export default function registerUnbound(name, fn) {
Handlebars.registerHelper(name, function(property, options) {
const func = function(property, options) {
if (options.types && options.types[0] === "ID") {
property = get(this, property, options);
}
return fn.call(this, property, resolveParams(this, options));
});
};
Handlebars.registerHelper(name, func);
Ember.Handlebars.registerHelper(name, func);
}

View File

@ -1,25 +0,0 @@
var helpers = ['input-tip',
'category-chooser',
'combo-box',
'choose-topic',
'activity-filter'];
/**
Creates view helpers for some views. Many of these should probably be converted
into components in the long term as it's a better fit.
**/
export default {
name: 'view-hlpers',
initialize: function(container) {
helpers.forEach(function(h) {
Ember.Handlebars.registerHelper(h, function(options) {
var helper = container.lookupFactory('view:' + h),
hash = options.hash,
types = options.hashTypes;
Discourse.Utilities.normalizeHash(hash, types);
return Ember.Handlebars.helpers.view.call(this, helper, options);
});
});
}
};

View File

@ -42,6 +42,6 @@
{{/each}}
</div>
{{loading-spinner condition=canLoadMore}}
{{conditional-loading-spinner condition=canLoadMore}}
{{/if}}
</div>

View File

@ -1,4 +1,4 @@
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#if topics}}
{{topic-list
showParticipants=showParticipants
@ -9,4 +9,4 @@
{{i18n 'choose_topic.none_found'}}
</div>
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -16,7 +16,7 @@
{{#if categories}}
<a href {{action "expand"}} {{bind-attr class="dropdownButtonClass" style="badgeStyle"}}><i {{bind-attr class="iconClass"}}></i></a>
<section {{bind-attr class="expanded::hidden :category-dropdown-menu"}} class='chooser'>
<section {{bind-attr class="expanded::hidden :category-dropdown-menu :chooser"}}>
<div class='cat'><a {{bind-attr href=allCategoriesUrl}} data-drop-close="true" class='badge-category home'>{{allCategoriesLabel}}</a></div>
{{#if subCategory}}
<div class='cat'><a {{bind-attr href=noCategoriesUrl}} data-drop-close="true" class='badge-category home'>{{i18n 'categories.no_subcategory'}}</a></div>

View File

@ -46,7 +46,7 @@
</button>
{{/if}}
</dt>
{{#loading-spinner size="small" condition=otherAccountsLoading}}
{{#conditional-loading-spinner size="small" condition=otherAccountsLoading}}
{{#if other_accounts.length}}
<dd class="other-accounts">
<table class="table table-condensed table-hover">
@ -73,7 +73,7 @@
</table>
</dd>
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</dl>
</div>
{{/if}}

View File

@ -57,13 +57,13 @@ so I'm going to stop rendering it until we figure out what's up
<div class="title-input">
{{text-field value=model.title tabindex="2" id="reply-title" maxLength=maxTitleLength placeholderKey="composer.title_placeholder"}}
{{popupInputTip validation=view.titleValidation shownAt=view.showTitleTip}}
{{popup-input-tip validation=view.titleValidation shownAt=view.showTitleTip}}
</div>
{{#unless model.privateMessage}}
<div class="category-input">
{{category-chooser valueAttribute="id" value=model.categoryId scopedCategoryId=scopedCategoryId tabindex="3"}}
{{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
{{popup-input-tip validation=view.categoryValidation shownAt=view.showCategoryTip}}
</div>
{{#if model.archetype.hasOptions}}
<button class='btn' {{action "showOptions"}}>{{i18n 'topic.options'}}</button>
@ -80,7 +80,7 @@ so I'm going to stop rendering it until we figure out what's up
<div class='wmd-button-bar' id='wmd-button-bar'></div>
<div id='wmd-preview-scroller'></div>
{{composer-text-area tabindex="4" value=model.reply}}
{{popupInputTip validation=view.replyValidation shownAt=view.showReplyTip}}
{{popup-input-tip validation=view.replyValidation shownAt=view.showReplyTip}}
</div>
<!-- keep the classes here in sync with post.hbs -->
<div class='preview-wrapper regular'>

View File

@ -10,7 +10,7 @@
</div>
</div>
{{loading-spinner condition=loading}}
{{conditional-loading-spinner condition=loading}}
<div {{bind-attr class=":container :list-container loading:hidden"}}>
<div class="row">

View File

@ -25,7 +25,7 @@
{{#if topicTrackingState.hasIncoming}}
<div class="show-more">
<div class='alert alert-info clickable' {{action "showInserted"}}>
{{countI18n topic_count_ suffix=topicTrackingState.filter count=topicTrackingState.incomingCount}}
{{count-i18n key=topic_count_ suffix=topicTrackingState.filter count=topicTrackingState.incomingCount}}
{{i18n 'click_to_show'}}
</div>
</div>
@ -51,7 +51,7 @@
</div>
<footer class='topic-list-bottom'>
{{loading-spinner condition=loadingMore}}
{{conditional-loading-spinner condition=loadingMore}}
{{#if allLoaded}}
{{#if showDismissRead}}
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissRead" "topics"}}>{{i18n 'topics.bulk.dismiss_topics'}}</button>

View File

@ -16,7 +16,7 @@
{{#each buttonData in enabledButtons}}
<button class="btn {{unbound buttonData.classes}}" {{action buttonData.action}}>{{boundI18n buttonData.key}}</button>
{{/each}}
{{loading-spinner condition=loading}}
{{conditional-loading-spinner condition=loading}}
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#if topics}}
<table class="topic-list">
<tbody>
@ -54,4 +54,4 @@
{{i18n 'choose_topic.none_found'}}
</div>
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -7,7 +7,7 @@
{{#if topicTrackingState.hasIncoming}}
<div class='alert alert-info' {{action "showInserted"}}>
{{countI18n topic_count_ suffix=topicTrackingState.filter count=topicTrackingState.incomingCount}}
{{count-i18n key=topic_count_ suffix=topicTrackingState.filter count=topicTrackingState.incomingCount}}
{{i18n 'click_to_show'}}
</div>
{{/if}}
@ -22,7 +22,7 @@
</div>
<footer class='topic-list-bottom'>
{{loading-spinner condition=loadingMore}}
{{conditional-loading-spinner condition=loadingMore}}
{{#if allLoaded}}
{{#if showDismissRead}}
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissRead" "topics"}}>{{i18n 'topics.bulk.dismiss_topics'}}</button>

View File

@ -2,6 +2,6 @@
<p>{{category-chooser value=newCategoryId}}</p>
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{d-button action="changeCategory" label="topics.bulk.change_category"}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -88,11 +88,11 @@
{{#if showCreateForm}}
<div class="modal-footer">
<button class='btn btn-large btn-primary' {{bind-attr disabled="submitDisabled"}} {{action "createAccount"}}>{{i18n 'create_account.title'}}</button>
{{#loading-spinner condition=formSubmitted size="small"}}
{{#conditional-loading-spinner condition=formSubmitted size="small"}}
<button class="btn btn-large" id="login-link" {{action "showLogin"}}>
{{i18n 'log_in'}}
</button>
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</div>
{{/if}}
{{/unless}}

View File

@ -9,16 +9,16 @@
{{#if pinned_globally}}
<p>{{i18n "topic.feature_topic.global_pin_note"}}</p>
<p>
{{#loading-spinner size="small" condition=loading}}
{{#conditional-loading-spinner size="small" condition=loading}}
{{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</p>
{{else}}
<p>{{i18n "topic.feature_topic.pin_note"}}</p>
<p>
{{#loading-spinner size="small" condition=loading}}
{{#conditional-loading-spinner size="small" condition=loading}}
{{{alreadyPinnedMessage}}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</p>
{{/if}}
</div>
@ -32,9 +32,9 @@
<p>{{{pinMessage}}}</p>
<p>{{i18n "topic.feature_topic.pin_note"}}</p>
<p>
{{#loading-spinner size="small" condition=loading}}
{{#conditional-loading-spinner size="small" condition=loading}}
{{{alreadyPinnedMessage}}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</p>
</div>
</div>
@ -47,9 +47,9 @@
<p>{{i18n "topic.feature_topic.pin_globally"}}</p>
<p>{{i18n "topic.feature_topic.global_pin_note"}}</p>
<p>
{{#loading-spinner size="small" condition=loading}}
{{#conditional-loading-spinner size="small" condition=loading}}
{{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</p>
</div>
</div>
@ -71,9 +71,9 @@
{{/if}}
<p>{{i18n "topic.feature_topic.banner_note"}}</p>
<p>
{{#loading-spinner size="small" condition=loading}}
{{#conditional-loading-spinner size="small" condition=loading}}
{{{i18n "topic.feature_topic.already_banner" count=bannerCount}}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</p>
</div>
</div>

View File

@ -4,9 +4,9 @@
<button title="{{i18n 'post.revisions.controls.first'}}" {{bind-attr class=":btn :standard :no-text displayGoToFirst::invisible" disabled=loading}} {{action "loadFirstVersion"}}><i class="fa fa-fast-backward"></i></button>
<button title="{{i18n 'post.revisions.controls.previous'}}" {{bind-attr class=":btn :standard :no-text displayGoToPrevious::invisible" disabled=loading}} {{action "loadPreviousVersion"}}><i class="fa fa-backward"></i></button>
<div id="revision-numbers" {{bind-attr class="displayRevisions::invisible"}}>
{{#loading-spinner condition=loading size="small"}}
{{#conditional-loading-spinner condition=loading size="small"}}
{{boundI18n revisionsTextKey previousBinding="previousVersion" currentBinding="current_version" totalBinding="version_count"}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</div>
<button title="{{i18n 'post.revisions.controls.next'}}" {{bind-attr class=":btn :standard :no-text displayGoToNext::invisible" disabled=loading}} {{action "loadNextVersion"}}><i class="fa fa-forward"></i></button>
<button title="{{i18n 'post.revisions.controls.last'}}" {{bind-attr class=":btn :standard :no-text displayGoToLast::invisible" disabled=loading}} {{action "loadLastVersion"}}><i class="fa fa-fast-forward"></i></button>

View File

@ -56,5 +56,5 @@
&nbsp; {{i18n 'login.authenticating'}}
{{/if}}
{{loading-spinner condition=showSpinner size="small"}}
{{conditional-loading-spinner condition=showSpinner size="small"}}
</div>

View File

@ -1,7 +1,7 @@
<div class="modal-body">
<p>{{{description}}}</p>
<p>{{{i18n "queue.approval.pending_posts" count=model.pending_count}}}
<p>{{{i18n "queue.approval.pending_posts" count=model.pending_count}}}</p>
</div>
<div class="modal-footer">
{{d-button action="closeModal" class="btn-primary" label="queue.approval.ok"}}

View File

@ -1,5 +1,5 @@
<section class="d-dropdown" id="notifications-dropdown">
{{#loading-spinner condition=loadingNotifications}}
{{#conditional-loading-spinner condition=loadingNotifications}}
{{#if content}}
<ul>
{{#each n in model itemController="notification"}}
@ -12,5 +12,5 @@
{{else}}
<div class="none">{{i18n 'notifications.none'}}</div>
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</section>

View File

@ -1,2 +0,0 @@
<span class="close"><i class="fa fa-times-circle"></i></span>
{{{view.validation.reason}}}

View File

@ -1,8 +1,2 @@
<aside class='quote' {{#params}}data-{{key}}="{{value}}" {{/params}}>
<div class='title'>
<div class='quote-controls'></div>
{{{avatarImg}}}
{{username}}
</div>
<blockquote>{{{quote}}}</blockquote>
</aside>
NEEDS FIXING

View File

@ -1,4 +1,4 @@
<p>{{countI18n topic.multi_select.description countBinding="selectedPostsCount"}}</p>
<p>{{count-i18n key=topic.multi_select.description countBinding="selectedPostsCount"}}</p>
{{#if canSelectAll}}
<p><a href='#' {{action "selectAll"}}>{{i18n 'topic.multi_select.select_all'}}</a></p>

View File

@ -64,7 +64,7 @@
{{render 'topic-progress'}}
{{loading-spinner condition=postStream.loadingAbove}}
{{conditional-loading-spinner condition=postStream.loadingAbove}}
{{#unless postStream.loadingFilter}}
{{cloaked-collection itemViewClass="post"
@ -79,11 +79,11 @@
offsetFixedBottom="#reply-control"}}
{{/unless}}
{{loading-spinner condition=postStream.loadingBelow}}
{{conditional-loading-spinner condition=postStream.loadingBelow}}
</div>
<div id='topic-bottom'></div>
{{#loading-spinner condition=postStream.loadingFilter}}
{{#conditional-loading-spinner condition=postStream.loadingFilter}}
{{#if loadedAllPosts}}
{{view 'topic-closing' topic=model}}
@ -113,7 +113,7 @@
{{/if}}
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</section>
</div>
@ -121,7 +121,7 @@
</div>
{{else}}
<div class='container'>
{{#loading-spinner condition=noErrorYet}}
{{#conditional-loading-spinner condition=noErrorYet}}
{{#if notFoundHtml}}
{{{notFoundHtml}}}
{{else}}
@ -135,9 +135,9 @@
{{d-button action="retryLoading" class="btn-primary topic-retry" icon="refresh" label="errors.buttons.again"}}
{{/if}}
</div>
{{loading-spinner condition=retrying}}
{{conditional-loading-spinner condition=retrying}}
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</div>
{{/if}}

View File

@ -69,7 +69,7 @@
</tr>
{{/each}}
</table>
{{loading-spinner condition=invitesLoading}}
{{conditional-loading-spinner condition=invitesLoading}}
{{else}}
{{#if canBulkInvite}}

View File

@ -23,7 +23,7 @@
</div>
{{/each}}
{{#loading-spinner condition=loading}}
{{#conditional-loading-spinner condition=loading}}
{{#unless canLoadMore}}
{{#if showDismissButton}}
<div class='notification-buttons'>
@ -31,4 +31,4 @@
</div>
{{/if}}
{{/unless}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}

View File

@ -6,7 +6,7 @@
{{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name"}}
</div>
{{#loading-spinner condition=model.loading}}
{{#conditional-loading-spinner condition=model.loading}}
{{#if model.length}}
<div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>
@ -43,12 +43,12 @@
</tbody>
</table>
{{loading-spinner condition=model.loadingMore}}
{{conditional-loading-spinner condition=model.loadingMore}}
{{else}}
<div class='clearfix'></div>
<p>{{i18n "directory.no_results"}}</p>
{{/if}}
{{/loading-spinner}}
{{/conditional-loading-spinner}}
</div>
</div>

View File

@ -1,17 +0,0 @@
import StringBuffer from 'discourse/mixins/string-buffer';
export default Discourse.View.extend(StringBuffer, {
classNameBindings: [':tip', 'good', 'bad'],
rerenderTriggers: ['validation'],
bad: Em.computed.alias('validation.failed'),
good: Em.computed.not('bad'),
renderString: function(buffer) {
var reason = this.get('validation.reason');
if (reason) {
var icon = this.get('good') ? 'fa-check' : 'fa-times';
return buffer.push("<i class=\"fa " + icon + "\"></i> " + reason);
}
}
});

View File

@ -1,17 +1,3 @@
import Presence from 'discourse/mixins/presence';
const View = Ember.View.extend(Presence, {});
View.reopenClass({
registerHelper(helperName, helperClass) {
Ember.Handlebars.registerHelper(helperName, function(options) {
var hash = options.hash,
types = options.hashTypes;
Discourse.Utilities.normalizeHash(hash, types);
return Ember.Handlebars.helpers.view.call(this, helperClass, options);
});
}
});
export default View;
export default Ember.View.extend(Presence);

View File

@ -1,5 +1,6 @@
<%
if Rails.env.development? || Rails.env.test?
require_asset ("ember-template-compiler.js")
require_asset ("development/ember.js")
else
require_asset ("production/ember.js")

View File

@ -42,7 +42,7 @@
//= require ./discourse/views/container
//= require ./discourse/views/modal-body
//= require ./discourse/views/flag
//= require ./discourse/views/combo-box
//= require ./discourse/components/combo-box
//= require ./discourse/views/button
//= require ./discourse/components/dropdown-button
//= require ./discourse/components/notifications-button

View File

@ -1,34 +0,0 @@
import Presence from 'discourse/mixins/presence';
var oldHelpers;
module("Discourse.View", {
setup: function() {
oldHelpers = Ember.Handlebars.helpers;
},
teardown: function() {
Ember.Handlebars.helpers = oldHelpers;
}
});
test("mixes in Presence", function() {
ok(Presence.detect(Discourse.View.create()));
});
test("registerHelper: enables embedding a child view in a parent view via dedicated, named helper instead of generic 'view' helper", function() {
Discourse.View.registerHelper("childViewHelper", Ember.View.extend({
template: Ember.Handlebars.compile('{{view.text}}')
}));
var parentView = Ember.View.extend({
template: Ember.Handlebars.compile('{{childViewHelper id="child" text="foo"}}')
}).create();
Ember.run(function() {
parentView.appendTo("#qunit-fixture");
});
equal(parentView.$("#child").length, 1, "child view registered as helper is appended to the parent view");
equal(parentView.$("#child").text(), "foo", "child view registered as helper gets parameters provided during helper invocation in parent's template");
});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff