Merge branch 'master' of github.com:discourse/discourse
This commit is contained in:
commit
880dcbb365
|
@ -1,4 +1,4 @@
|
|||
Discourse.Route.buildRoutes(function() {
|
||||
export default function() {
|
||||
this.resource('admin', function() {
|
||||
this.route('dashboard', { path: '/' });
|
||||
this.resource('adminSiteSettings', { path: '/site_settings' }, function() {
|
||||
|
@ -60,4 +60,4 @@ Discourse.Route.buildRoutes(function() {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,12 +1,4 @@
|
|||
/**
|
||||
Builds the routes for the application
|
||||
|
||||
@method buildRoutes
|
||||
@for Discourse.ApplicationRoute
|
||||
**/
|
||||
Discourse.Route.buildRoutes(function() {
|
||||
var router = this;
|
||||
|
||||
export default function() {
|
||||
// Error page
|
||||
this.route('exception', { path: '/exception' });
|
||||
|
||||
|
@ -20,7 +12,6 @@ Discourse.Route.buildRoutes(function() {
|
|||
this.resource('topicBySlug', { path: '/t/:slug' });
|
||||
|
||||
this.resource('discovery', { path: '/' }, function() {
|
||||
router = this;
|
||||
// top
|
||||
this.route('top');
|
||||
this.route('topCategory', { path: '/c/:slug/l/top' });
|
||||
|
@ -28,20 +19,21 @@ Discourse.Route.buildRoutes(function() {
|
|||
this.route('topCategory', { path: '/c/:parentSlug/:slug/l/top' });
|
||||
|
||||
// top by periods
|
||||
var self = this;
|
||||
Discourse.Site.currentProp('periods').forEach(function(period) {
|
||||
var top = 'top' + period.capitalize();
|
||||
router.route(top, { path: '/top/' + period });
|
||||
router.route(top + 'Category', { path: '/c/:slug/l/top/' + period });
|
||||
router.route(top + 'CategoryNone', { path: '/c/:slug/none/l/top/' + period });
|
||||
router.route(top + 'Category', { path: '/c/:parentSlug/:slug/l/top/' + period });
|
||||
self.route(top, { path: '/top/' + period });
|
||||
self.route(top + 'Category', { path: '/c/:slug/l/top/' + period });
|
||||
self.route(top + 'CategoryNone', { path: '/c/:slug/none/l/top/' + period });
|
||||
self.route(top + 'Category', { path: '/c/:parentSlug/:slug/l/top/' + period });
|
||||
});
|
||||
|
||||
// filters
|
||||
Discourse.Site.currentProp('filters').forEach(function(filter) {
|
||||
router.route(filter, { path: '/' + filter });
|
||||
router.route(filter + 'Category', { path: '/c/:slug/l/' + filter });
|
||||
router.route(filter + 'CategoryNone', { path: '/c/:slug/none/l/' + filter });
|
||||
router.route(filter + 'Category', { path: '/c/:parentSlug/:slug/l/' + filter });
|
||||
self.route(filter, { path: '/' + filter });
|
||||
self.route(filter + 'Category', { path: '/c/:slug/l/' + filter });
|
||||
self.route(filter + 'CategoryNone', { path: '/c/:slug/none/l/' + filter });
|
||||
self.route(filter + 'Category', { path: '/c/:parentSlug/:slug/l/' + filter });
|
||||
});
|
||||
|
||||
this.route('categories');
|
||||
|
@ -62,9 +54,9 @@ Discourse.Route.buildRoutes(function() {
|
|||
// User routes
|
||||
this.resource('user', { path: '/users/:username' }, function() {
|
||||
this.resource('userActivity', { path: '/activity' }, function() {
|
||||
router = this;
|
||||
var self = this;
|
||||
_.map(Discourse.UserAction.TYPES, function (id, userAction) {
|
||||
router.route(userAction, { path: userAction.replace('_', '-') });
|
||||
self.route(userAction, { path: userAction.replace('_', '-') });
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -99,4 +91,4 @@ Discourse.Route.buildRoutes(function() {
|
|||
this.resource('badges', function() {
|
||||
this.route('show', {path: '/:id/:slug'});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -90,7 +90,23 @@ Discourse.Route.reopenClass({
|
|||
|
||||
mapRoutes: function() {
|
||||
Discourse.Router.map(function() {
|
||||
routeBuilder.call(this);
|
||||
var router = this;
|
||||
|
||||
if (routeBuilder) {
|
||||
Ember.warn("The Discourse `routeBuilder` is deprecated. Export a `route-map` instead");
|
||||
routeBuilder.call(router);
|
||||
}
|
||||
|
||||
// If a module is defined as `route-map` in discourse or a plugin, its routes
|
||||
// will be built automatically.
|
||||
Ember.keys(requirejs._eak_seen).forEach(function(key) {
|
||||
if (/route-map$/.test(key)) {
|
||||
var module = require(key, null, null, true);
|
||||
if (!module) { throw new Error(key + ' must export a map function.'); }
|
||||
module.default.call(router);
|
||||
}
|
||||
});
|
||||
|
||||
this.route('unknown', {path: '*path'});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -183,19 +183,6 @@
|
|||
background-color: $secondary;
|
||||
}
|
||||
}
|
||||
th .toggle-admin {
|
||||
position: absolute;
|
||||
padding: 3px 8px;
|
||||
font-size: 0.857em;
|
||||
right: -35px;
|
||||
top: 4px;
|
||||
}
|
||||
th.latest, td.latest {
|
||||
padding-left: 12px;
|
||||
}
|
||||
th.num {
|
||||
width: 45px;
|
||||
}
|
||||
th.stats {
|
||||
width: 90px;
|
||||
}
|
||||
|
@ -212,12 +199,14 @@
|
|||
}
|
||||
}
|
||||
.category{
|
||||
position: relative;
|
||||
width: 45%;
|
||||
|
||||
h3 {
|
||||
display: inline-block;
|
||||
font-size: 1.286em;
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
a[href] {
|
||||
color: $primary;
|
||||
}
|
||||
|
@ -225,20 +214,12 @@
|
|||
.subcategories {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.featured-users {
|
||||
float: right;
|
||||
margin-right: 13px;
|
||||
}
|
||||
.category-description {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.clear-badge {
|
||||
color: $primary;
|
||||
}
|
||||
.badge-category.bigger {
|
||||
padding: 6px 10px;
|
||||
font-size: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.featured-topic {
|
||||
|
@ -313,10 +294,6 @@ button.dismiss-read {
|
|||
}
|
||||
}
|
||||
|
||||
.category-name {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.category-logo {
|
||||
max-height: 150px;
|
||||
float: left;
|
||||
|
|
|
@ -78,7 +78,6 @@ class PostsController < ApplicationController
|
|||
def create_post(params)
|
||||
post_creator = PostCreator.new(current_user, params)
|
||||
post = post_creator.create
|
||||
DiscourseEvent.trigger(:topic_saved, post.topic, params)
|
||||
|
||||
if post_creator.errors.present?
|
||||
# If the post was spam, flag all the user's posts as spam
|
||||
|
@ -86,6 +85,7 @@ class PostsController < ApplicationController
|
|||
[false, MultiJson.dump(errors: post_creator.errors.full_messages)]
|
||||
|
||||
else
|
||||
DiscourseEvent.trigger(:topic_saved, post.topic, params)
|
||||
post_serializer = PostSerializer.new(post, scope: guardian, root: false)
|
||||
post_serializer.draft_sequence = DraftSequence.current(current_user, post.topic.draft_key)
|
||||
[true, MultiJson.dump(post_serializer)]
|
||||
|
|
Loading…
Reference in New Issue