Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (25 commits)
  FIX: Don't autolink within a markdown link.
  missing semi colon
  FIX: Some more non-english category errors
  FIX: Show status icons on user topic pages
  FIX: issue 1538. After upgrading and before a new version check request has been made, dashboard might still say that an update is available.
  fixing user title line-height, adding @mention style back in, consistent category width/alignment
  FIX: emoticon 💩 wasn't working :)
  some general simplification to modal, menus, etc
  revert changes to magnific-popup.scss
  FIX issues with quote button
  shorter message for untranslated strings
  Rails 4 changes behavior of precompile not to include originals This patch will restore rails 3 beavior and fix emoji etc under rails 4
  Update client.nl.yml
  Update server.nl.yml
  Dont call `SiteSetting.uncategorized_category_id` twice
  Fix ActiveRecord::Associations::CollectionProxy serialization in Rails 4.
  Update client.zh_CN.yml
  automatically make developers admins on account creation, this solves the user #1 problem you can simply set the DEVELOPER_EMAILS to a comma delimited list and the users will be auto admined
  fix run-qunit
  add qunit to autospec
  ...
  • Loading branch information
rwdaigle committed Nov 4, 2013
2 parents 0f0af92 + b8e6371 commit 1868cb6
Show file tree
Hide file tree
Showing 66 changed files with 1,587 additions and 935 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/models/version_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Discourse.VersionCheck = Discourse.Model.extend({
}.property('updated_at'),

dataIsOld: function() {
return moment().diff(moment(this.get('updated_at')), 'hours') >= 48;
return this.get('version_check_pending') || moment().diff(moment(this.get('updated_at')), 'hours') >= 48;
}.property('updated_at'),

staleData: function() {
Expand Down
16 changes: 13 additions & 3 deletions app/assets/javascripts/admin/templates/dashboard.js.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,26 @@
{{#if versionCheck.staleData}}
<td class="version-number">&nbsp;</td>
<td class="face">
<span class="icon critical-updates-available">☹</span>
{{#if versionCheck.version_check_pending}}
<span class='icon up-to-date'>☻</span>
{{else}}
<span class="icon critical-updates-available">☹</span>
{{/if}}
</td>
<td class="version-notes">
<span class="normal-note">{{i18n admin.dashboard.stale_data}}</span>
<span class="normal-note">
{{#if versionCheck.version_check_pending}}
{{i18n admin.dashboard.version_check_pending}}
{{else}}
{{i18n admin.dashboard.stale_data}}
{{/if}}
</span>
</td>
{{else}}
<td class="version-number">{{ versionCheck.latest_version }}</td>
<td class="face">
{{#if versionCheck.upToDate }}
<span class='icon update-to-date'>☻</span>
<span class='icon up-to-date'>☻</span>
{{else}}
<span {{bindAttr class=":icon versionCheck.critical_updates:critical-updates-available:updates-available"}}>
{{#if versionCheck.behindByOneVersion}}
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/discourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,3 @@ Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
});

Discourse.Router = Discourse.Router.reopen({ location: 'discourse_location' });

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
This view is for rendering an icon representing the status of a topic
@class TopicStatusView
@extends Discourse.View
@class TopicStatusComponent
@extends Ember.Component
@namespace Discourse
@module Discourse
**/
Discourse.TopicStatusView = Discourse.View.extend({
Discourse.TopicStatusComponent = Ember.Component.extend({
classNames: ['topic-statuses'],

hasDisplayableStatus: Em.computed.or('topic.closed', 'topic.pinned', 'topic.invisible', 'topic.archetypeObject.notDefault'),
Expand All @@ -15,9 +15,9 @@ Discourse.TopicStatusView = Discourse.View.extend({
render: function(buffer) {
if (!this.get('hasDisplayableStatus')) { return; }

var topicStatusView = this;
var renderIconIf = function(conditionProp, name, key) {
if (!topicStatusView.get(conditionProp)) { return; }
var self = this,
renderIconIf = function(conditionProp, name, key) {
if (!self.get(conditionProp)) { return; }
var title = I18n.t("topic_statuses." + key + ".help");
buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>");
};
Expand All @@ -32,4 +32,4 @@ Discourse.TopicStatusView = Discourse.View.extend({
});


Discourse.View.registerHelper('topicStatus', Discourse.TopicStatusView);
Discourse.View.registerHelper('topicStatus', Discourse.TopicStatusComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,18 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
this.set('saving', true);
model.set('parentCategory', parentCategory);

self.set('saving', false);
this.get('model').save().then(function(result) {
// success
self.send('closeModal');
model.set('slug', result.category.slug);
model.setProperties({slug: result.category.slug, id: result.category.id });
Discourse.URL.redirectTo("/category/" + Discourse.Category.slugFor(model));
}).fail(function(error) {

}).fail(function(error) {
if (error && error.responseText) {
self.flash($.parseJSON(error.responseText).errors[0]);
} else {
self.flash(I18n.t('generic_error'));
}

self.set('saving', false);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ Discourse.ListController = Discourse.Controller.extend({
needs: ["composer", "modal", "listTopics"],

availableNavItems: function() {
var loggedOn = !!Discourse.User.current();
var category = this.get("category");

return Discourse.SiteSettings.top_menu.split("|").map(function(i) {
return Discourse.NavItem.fromText(i, {
loggedOn: loggedOn,
loggedOn: !!Discourse.User.current(),
category: category
});
}).filter(function(i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ Discourse.QuoteButtonController = Discourse.Controller.extend({
cloned = range.cloneRange(),
$ancestor = $(range.commonAncestorContainer);

// don't display the "quote reply" button if you select text spanning two posts
// note: the ".contents" is here to prevent selection of the topic summary
if ($ancestor.closest('.topic-body > .contents').length === 0) {
if ($ancestor.closest('.cooked').length === 0) {
this.set('buffer', '');
return;
}
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/discourse/dialects/autolink_dialect.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ var urlReplacerArgs = {
var url = matches[1],
displayUrl = url;


// Don't autolink a markdown link to something
if (url.match(/\]\[\d$/)) { return; }

// If we improperly caught a markdown link abort
if (url.match(/\(http/)) { return; }

Expand Down
20 changes: 10 additions & 10 deletions app/assets/javascripts/discourse/lib/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ Discourse.Utilities = {
var html = '';

if (typeof window.getSelection !== "undefined") {
var sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
html = container.innerHTML;
var sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
html = container.innerHTML;
}
} else if (typeof document.selection !== "undefined") {
if (document.selection.type === "Text") {
html = document.selection.createRange().htmlText;
}
if (document.selection.type === "Text") {
html = document.selection.createRange().htmlText;
}
}

// Strip out any .click elements from the HTML before converting it to text
Expand Down
11 changes: 5 additions & 6 deletions app/assets/javascripts/discourse/models/nav_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ Discourse.NavItem = Discourse.Model.extend({
// href from this item
filterMode: function() {
var name = this.get('name');

if( name.split('/')[0] === 'category' ) {
return 'category/' + this.get('categorySlug');
} else {
var mode = "";
var category = this.get("category");
var mode = "",
category = this.get("category");

if(category){
mode += "category/";

var parentSlug = category.get('parentCategory.slug');
if (parentSlug) { mode += parentSlug + "/"; }
mode += category.get("slug") + "/l/";
mode += Discourse.Category.slugFor(this.get('category')) + "/l/";
}
return mode + name.replace(' ', '-');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
<th class='num activity' colspan='2'>{{i18n activity}}</th>
</tr>

{{#groupedEach view.topics}}
<tr>
{{#each view.topics}}
<tr {{bindAttr class="archived"}}>
<td class='main-link'>
{{topicStatus topic=this}}
<a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
{{#if unread}}
<a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unbound unread}}</a>
Expand Down Expand Up @@ -55,7 +56,7 @@
<td class="activity"></td>
{{/if}}
</tr>
{{/groupedEach}}
{{/each}}

</table>
{{else}}
Expand Down
19 changes: 10 additions & 9 deletions app/assets/javascripts/discourse/views/nav_item_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ Discourse.NavItemView = Discourse.View.extend({
active: Discourse.computed.propertyEqual('content.filterMode', 'controller.filterMode'),

title: function() {
var categoryName, extra, name;
name = this.get('content.name');
categoryName = this.get('content.categoryName');
var categoryName = this.get('content.categoryName'),
name = this.get('content.name'),
extra;

if (categoryName) {
extra = { categoryName: categoryName };
name = "category";
Expand All @@ -29,12 +30,12 @@ Discourse.NavItemView = Discourse.View.extend({


name: function() {
var categoryName, extra, name;
name = this.get('content.name');
categoryName = this.get('content.categoryName');
extra = {
count: this.get('content.count') || 0
};
var categoryName = this.get('content.categoryName'),
name = this.get('content.name'),
extra = {
count: this.get('content.count') || 0
};

if (categoryName) {
name = 'category';
extra.categoryName = Discourse.Formatter.toTitleCase(categoryName);
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/discourse/views/quote_button_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Discourse.QuoteButtonView = Discourse.View.extend({
})
.on('selectionchange', function() {
// there is no need to handle this event when the mouse is down
// or if there is not a touch in progress
if (view.get('isMouseDown') || !view.get('isTouchInProgress')) return;
// or if there a touch in progress
if (view.get('isMouseDown') || view.get('isTouchInProgress')) return;
// `selection.anchorNode` is used as a target
view.selectText(window.getSelection().anchorNode, controller);
});
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ window.ENV = {

window.Discourse = {};
Discourse.SiteSettings = {};


33 changes: 9 additions & 24 deletions app/assets/javascripts/locales/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ I18n.locale = null;
// Set the placeholder format. Accepts `{{placeholder}}` and `%{placeholder}`.
I18n.PLACEHOLDER = /(?:\{\{|%\{)(.*?)(?:\}\}?)/gm;

I18n.fallbackRules = {
};
I18n.fallbackRules = {};

I18n.pluralizationRules = {
en: function (n) {
Expand Down Expand Up @@ -207,7 +206,7 @@ I18n.translate = function(scope, options) {
} else {
return this.interpolate(translation, options);
}
} catch(err) {
} catch (error) {
return this.missingTranslation(scope);
}
};
Expand Down Expand Up @@ -485,40 +484,26 @@ I18n.findAndTranslateValidNode = function(keys, translation) {
I18n.pluralize = function(count, scope, options) {
var translation;

try {
translation = this.lookup(scope, options);
} catch (error) {}
try { translation = this.lookup(scope, options); } catch (error) {}
if (!translation) { return this.missingTranslation(scope); }

if (!translation) {
return this.missingTranslation(scope);
}

var message;
options = this.prepareOptions(options);
options.count = count.toString();

var pluralizer = this.pluralizer(this.currentLocale());
var key = pluralizer(Math.abs(count));
var keys = ((typeof key == "object") && (key instanceof Array)) ? key : [key];

message = this.findAndTranslateValidNode(keys, translation);
var message = this.findAndTranslateValidNode(keys, translation);
if (message == null) message = this.missingTranslation(scope, keys[0]);

return this.interpolate(message, options);
};

I18n.missingTranslation = function() {
var message = '[missing "' + this.currentLocale()
, count = arguments.length
;

for (var i = 0; i < count; i++) {
message += "." + arguments[i];
}

message += '" translation]';

return message;
I18n.missingTranslation = function(scope, key) {
var message = '[' + this.currentLocale() + "." + scope;
if (key) { message += "." + key; }
return message + ']';
};

I18n.currentLocale = function() {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/common/admin/admin_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ table {
font-size: 26px;
}

.update-to-date {
.up-to-date {
color: green;
}
.updates-available {
Expand Down
6 changes: 2 additions & 4 deletions app/assets/stylesheets/common/components/navs.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
padding: 0;
overflow: hidden;
background-color: $nav-stacked-background-color;
@include border-radius-all(4px);
@include box-shadow(0 1px 0 $white);
> li {
border-bottom: 1px solid $nav-stacked-divider-color;
Expand All @@ -66,16 +65,15 @@
> a {
margin: 0;
padding: 13px 13px 13px 30px;
font-weight: bold;
font-size: 16px;
line-height: 20px;
cursor: pointer;
color: $nav-stacked-color;
}
}
.active > a,
.active .icon-chevron-right {
color: $nav-stacked-border-color-active;
text-shadow: 0 1px 0 rgba($white, 0.5);
color: $white;
background-color: $nav-stacked-background-color-active;
}
.count {
Expand Down
Loading

0 comments on commit 1868cb6

Please sign in to comment.