2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00

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>
</div> </div>
{{#loading-spinner condition=loading}} {{#conditional-loading-spinner condition=loading}}
{{#if showHtml}} {{#if showHtml}}
{{{html_content}}} {{{html_content}}}
{{else}} {{else}}
<pre>{{{text_content}}}</pre> <pre>{{{text_content}}}</pre>
{{/if}} {{/if}}
{{/loading-spinner}} {{/conditional-loading-spinner}}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
{{#if hasSelection}} {{#if hasSelection}}
<div id='selected-controls'> <div id='selected-controls'>
<button {{action "approveUsers"}} class='btn'>{{countI18n admin.users.approved_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'>{{countI18n admin.users.reject_selected count=selectedCount}}</button> <button {{action "rejectUsers"}} class='btn btn-danger'>{{count-i18n key=admin.users.reject_selected count=selectedCount}}</button>
</div> </div>
{{/if}} {{/if}}
@ -19,7 +19,7 @@
{{/unless}} {{/unless}}
</div> </div>
{{#loading-spinner condition=refreshing}} {{#conditional-loading-spinner condition=refreshing}}
{{#if model}} {{#if model}}
<table class='table'> <table class='table'>
<tr> <tr>
@ -81,4 +81,4 @@
{{else}} {{else}}
<p>{{i18n 'search.no_results'}}</p> <p>{{i18n 'search.no_results'}}</p>
{{/if}} {{/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'; import { categoryBadgeHTML } from 'discourse/helpers/category-link';
export default ComboboxView.extend({ export default ComboboxView.extend({
@ -41,7 +41,7 @@ export default ComboboxView.extend({
} }
}.property(), }.property(),
template(item) { comboTemplate(item) {
let category; let category;

View file

@ -1,5 +1,4 @@
// This view handles rendering of a combobox export default Ember.Component.extend({
export default Discourse.View.extend({
tagName: 'select', tagName: 'select',
attributeBindings: ['tabindex'], attributeBindings: ['tabindex'],
classNames: ['combobox'], classNames: ['combobox'],
@ -65,7 +64,7 @@ export default Discourse.View.extend({
o.selected = !!$(o).attr('selected'); 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'); const castInteger = this.get('castInteger');
$elem.on("change", function (e) { $elem.on("change", function (e) {

View file

@ -9,7 +9,7 @@ export default Ember.Component.extend({
if (this.get('condition')) { if (this.get('condition')) {
buffer.push('<div class="spinner ' + this.get('size') + '"}}></div>'); buffer.push('<div class="spinner ' + this.get('size') + '"}}></div>');
} else { } 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); } if (label) { buffer.push(label); }
} else { } else {
// If no label or icon is present, yield // 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 @@
/** import { iconHTML } from 'discourse/helpers/fa-icon';
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.
@class PopupInputTipView export default Ember.Component.extend({
@extends Discourse.View
@namespace Discourse
@module Discourse
**/
Discourse.PopupInputTipView = Discourse.View.extend({
templateName: 'popup_input_tip',
classNameBindings: [':popup-tip', 'good', 'bad', 'shownAt::hide'], classNameBindings: [':popup-tip', 'good', 'bad', 'shownAt::hide'],
animateAttribute: null, animateAttribute: null,
bouncePixels: 6, bouncePixels: 6,
bounceDelay: 100, bounceDelay: 100,
click: function() { click() {
this.set('shownAt', false); this.set('shownAt', false);
}, },
@ -43,17 +32,23 @@ Discourse.PopupInputTipView = Discourse.View.extend({
} }
}.observes('shownAt'), }.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++ ) { for( var i = 0; i < 5; i++ ) {
$elem.animate({ left: '+=' + this.bouncePixels }, this.bounceDelay).animate({ left: '-=' + this.bouncePixels }, this.bounceDelay); $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++ ) { for( var i = 0; i < 5; i++ ) {
$elem.animate({ right: '-=' + this.bouncePixels }, this.bounceDelay).animate({ right: '+=' + this.bouncePixels }, this.bounceDelay); $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); var html = Discourse.HTML.getCustomHTML(name);
if (html) { return html; } if (html) { return html; }

View file

@ -1,5 +1,3 @@
import ConditionalLoadingSpinner from 'discourse/components/conditional-loading-spinner';
function renderSpinner(cssClass) { function renderSpinner(cssClass) {
var html = "<div class='spinner"; var html = "<div class='spinner";
if (cssClass) { html += ' ' + cssClass; } if (cssClass) { html += ' ' + cssClass; }
@ -7,25 +5,9 @@ function renderSpinner(cssClass) {
} }
var spinnerHTML = renderSpinner(); var spinnerHTML = renderSpinner();
/** Ember.Handlebars.registerHelper('loading-spinner', function(params) {
If you use it as a regular helper {{loading-spinner}} you'll just get the const hash = params.hash;
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)); return new Handlebars.SafeString(renderSpinner((hash && hash.size) ? hash.size : undefined));
}
}); });
export { spinnerHTML, renderSpinner }; export { spinnerHTML, renderSpinner };

View file

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

View file

@ -22,11 +22,14 @@ function resolveParams(ctx, options) {
} }
export default function registerUnbound(name, fn) { export default function registerUnbound(name, fn) {
Handlebars.registerHelper(name, function(property, options) { const func = function(property, options) {
if (options.types && options.types[0] === "ID") { if (options.types && options.types[0] === "ID") {
property = get(this, property, options); property = get(this, property, options);
} }
return fn.call(this, property, resolveParams(this, 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}} {{/each}}
</div> </div>
{{loading-spinner condition=canLoadMore}} {{conditional-loading-spinner condition=canLoadMore}}
{{/if}} {{/if}}
</div> </div>

View file

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

View file

@ -16,7 +16,7 @@
{{#if categories}} {{#if categories}}
<a href {{action "expand"}} {{bind-attr class="dropdownButtonClass" style="badgeStyle"}}><i {{bind-attr class="iconClass"}}></i></a> <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> <div class='cat'><a {{bind-attr href=allCategoriesUrl}} data-drop-close="true" class='badge-category home'>{{allCategoriesLabel}}</a></div>
{{#if subCategory}} {{#if subCategory}}
<div class='cat'><a {{bind-attr href=noCategoriesUrl}} data-drop-close="true" class='badge-category home'>{{i18n 'categories.no_subcategory'}}</a></div> <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> </button>
{{/if}} {{/if}}
</dt> </dt>
{{#loading-spinner size="small" condition=otherAccountsLoading}} {{#conditional-loading-spinner size="small" condition=otherAccountsLoading}}
{{#if other_accounts.length}} {{#if other_accounts.length}}
<dd class="other-accounts"> <dd class="other-accounts">
<table class="table table-condensed table-hover"> <table class="table table-condensed table-hover">
@ -73,7 +73,7 @@
</table> </table>
</dd> </dd>
{{/if}} {{/if}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</dl> </dl>
</div> </div>
{{/if}} {{/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"> <div class="title-input">
{{text-field value=model.title tabindex="2" id="reply-title" maxLength=maxTitleLength placeholderKey="composer.title_placeholder"}} {{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> </div>
{{#unless model.privateMessage}} {{#unless model.privateMessage}}
<div class="category-input"> <div class="category-input">
{{category-chooser valueAttribute="id" value=model.categoryId scopedCategoryId=scopedCategoryId tabindex="3"}} {{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> </div>
{{#if model.archetype.hasOptions}} {{#if model.archetype.hasOptions}}
<button class='btn' {{action "showOptions"}}>{{i18n 'topic.options'}}</button> <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 class='wmd-button-bar' id='wmd-button-bar'></div>
<div id='wmd-preview-scroller'></div> <div id='wmd-preview-scroller'></div>
{{composer-text-area tabindex="4" value=model.reply}} {{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> </div>
<!-- keep the classes here in sync with post.hbs --> <!-- keep the classes here in sync with post.hbs -->
<div class='preview-wrapper regular'> <div class='preview-wrapper regular'>

View file

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

View file

@ -25,7 +25,7 @@
{{#if topicTrackingState.hasIncoming}} {{#if topicTrackingState.hasIncoming}}
<div class="show-more"> <div class="show-more">
<div class='alert alert-info clickable' {{action "showInserted"}}> <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'}} {{i18n 'click_to_show'}}
</div> </div>
</div> </div>
@ -51,7 +51,7 @@
</div> </div>
<footer class='topic-list-bottom'> <footer class='topic-list-bottom'>
{{loading-spinner condition=loadingMore}} {{conditional-loading-spinner condition=loadingMore}}
{{#if allLoaded}} {{#if allLoaded}}
{{#if showDismissRead}} {{#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> <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}} {{#each buttonData in enabledButtons}}
<button class="btn {{unbound buttonData.classes}}" {{action buttonData.action}}>{{boundI18n buttonData.key}}</button> <button class="btn {{unbound buttonData.classes}}" {{action buttonData.action}}>{{boundI18n buttonData.key}}</button>
{{/each}} {{/each}}
{{loading-spinner condition=loading}} {{conditional-loading-spinner condition=loading}}
</div> </div>
</div> </div>
</div> </div>

View file

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

View file

@ -7,7 +7,7 @@
{{#if topicTrackingState.hasIncoming}} {{#if topicTrackingState.hasIncoming}}
<div class='alert alert-info' {{action "showInserted"}}> <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'}} {{i18n 'click_to_show'}}
</div> </div>
{{/if}} {{/if}}
@ -22,7 +22,7 @@
</div> </div>
<footer class='topic-list-bottom'> <footer class='topic-list-bottom'>
{{loading-spinner condition=loadingMore}} {{conditional-loading-spinner condition=loadingMore}}
{{#if allLoaded}} {{#if allLoaded}}
{{#if showDismissRead}} {{#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> <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> <p>{{category-chooser value=newCategoryId}}</p>
{{#loading-spinner condition=loading}} {{#conditional-loading-spinner condition=loading}}
{{d-button action="changeCategory" label="topics.bulk.change_category"}} {{d-button action="changeCategory" label="topics.bulk.change_category"}}
{{/loading-spinner}} {{/conditional-loading-spinner}}

View file

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

View file

@ -9,16 +9,16 @@
{{#if pinned_globally}} {{#if pinned_globally}}
<p>{{i18n "topic.feature_topic.global_pin_note"}}</p> <p>{{i18n "topic.feature_topic.global_pin_note"}}</p>
<p> <p>
{{#loading-spinner size="small" condition=loading}} {{#conditional-loading-spinner size="small" condition=loading}}
{{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}} {{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</p> </p>
{{else}} {{else}}
<p>{{i18n "topic.feature_topic.pin_note"}}</p> <p>{{i18n "topic.feature_topic.pin_note"}}</p>
<p> <p>
{{#loading-spinner size="small" condition=loading}} {{#conditional-loading-spinner size="small" condition=loading}}
{{{alreadyPinnedMessage}}} {{{alreadyPinnedMessage}}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</p> </p>
{{/if}} {{/if}}
</div> </div>
@ -32,9 +32,9 @@
<p>{{{pinMessage}}}</p> <p>{{{pinMessage}}}</p>
<p>{{i18n "topic.feature_topic.pin_note"}}</p> <p>{{i18n "topic.feature_topic.pin_note"}}</p>
<p> <p>
{{#loading-spinner size="small" condition=loading}} {{#conditional-loading-spinner size="small" condition=loading}}
{{{alreadyPinnedMessage}}} {{{alreadyPinnedMessage}}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</p> </p>
</div> </div>
</div> </div>
@ -47,9 +47,9 @@
<p>{{i18n "topic.feature_topic.pin_globally"}}</p> <p>{{i18n "topic.feature_topic.pin_globally"}}</p>
<p>{{i18n "topic.feature_topic.global_pin_note"}}</p> <p>{{i18n "topic.feature_topic.global_pin_note"}}</p>
<p> <p>
{{#loading-spinner size="small" condition=loading}} {{#conditional-loading-spinner size="small" condition=loading}}
{{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}} {{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</p> </p>
</div> </div>
</div> </div>
@ -71,9 +71,9 @@
{{/if}} {{/if}}
<p>{{i18n "topic.feature_topic.banner_note"}}</p> <p>{{i18n "topic.feature_topic.banner_note"}}</p>
<p> <p>
{{#loading-spinner size="small" condition=loading}} {{#conditional-loading-spinner size="small" condition=loading}}
{{{i18n "topic.feature_topic.already_banner" count=bannerCount}}} {{{i18n "topic.feature_topic.already_banner" count=bannerCount}}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</p> </p>
</div> </div>
</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.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> <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"}}> <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"}} {{boundI18n revisionsTextKey previousBinding="previousVersion" currentBinding="current_version" totalBinding="version_count"}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</div> </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.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> <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'}} &nbsp; {{i18n 'login.authenticating'}}
{{/if}} {{/if}}
{{loading-spinner condition=showSpinner size="small"}} {{conditional-loading-spinner condition=showSpinner size="small"}}
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="modal-body"> <div class="modal-body">
<p>{{{description}}}</p> <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>
<div class="modal-footer"> <div class="modal-footer">
{{d-button action="closeModal" class="btn-primary" label="queue.approval.ok"}} {{d-button action="closeModal" class="btn-primary" label="queue.approval.ok"}}

View file

@ -1,5 +1,5 @@
<section class="d-dropdown" id="notifications-dropdown"> <section class="d-dropdown" id="notifications-dropdown">
{{#loading-spinner condition=loadingNotifications}} {{#conditional-loading-spinner condition=loadingNotifications}}
{{#if content}} {{#if content}}
<ul> <ul>
{{#each n in model itemController="notification"}} {{#each n in model itemController="notification"}}
@ -12,5 +12,5 @@
{{else}} {{else}}
<div class="none">{{i18n 'notifications.none'}}</div> <div class="none">{{i18n 'notifications.none'}}</div>
{{/if}} {{/if}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</section> </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}}> NEEDS FIXING
<div class='title'>
<div class='quote-controls'></div>
{{{avatarImg}}}
{{username}}
</div>
<blockquote>{{{quote}}}</blockquote>
</aside>

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}} {{#if canSelectAll}}
<p><a href='#' {{action "selectAll"}}>{{i18n 'topic.multi_select.select_all'}}</a></p> <p><a href='#' {{action "selectAll"}}>{{i18n 'topic.multi_select.select_all'}}</a></p>

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
{{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name"}} {{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name"}}
</div> </div>
{{#loading-spinner condition=model.loading}} {{#conditional-loading-spinner condition=model.loading}}
{{#if model.length}} {{#if model.length}}
<div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div> <div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>
@ -43,12 +43,12 @@
</tbody> </tbody>
</table> </table>
{{loading-spinner condition=model.loadingMore}} {{conditional-loading-spinner condition=model.loadingMore}}
{{else}} {{else}}
<div class='clearfix'></div> <div class='clearfix'></div>
<p>{{i18n "directory.no_results"}}</p> <p>{{i18n "directory.no_results"}}</p>
{{/if}} {{/if}}
{{/loading-spinner}} {{/conditional-loading-spinner}}
</div> </div>
</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'; import Presence from 'discourse/mixins/presence';
const View = Ember.View.extend(Presence, {}); export default 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;

View file

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

View file

@ -42,7 +42,7 @@
//= require ./discourse/views/container //= require ./discourse/views/container
//= require ./discourse/views/modal-body //= require ./discourse/views/modal-body
//= require ./discourse/views/flag //= require ./discourse/views/flag
//= require ./discourse/views/combo-box //= require ./discourse/components/combo-box
//= require ./discourse/views/button //= require ./discourse/views/button
//= require ./discourse/components/dropdown-button //= require ./discourse/components/dropdown-button
//= require ./discourse/components/notifications-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