mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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.resource('admin', function() {
|
||||||
this.route('dashboard', { path: '/' });
|
this.route('dashboard', { path: '/' });
|
||||||
this.resource('adminSiteSettings', { path: '/site_settings' }, function() {
|
this.resource('adminSiteSettings', { path: '/site_settings' }, function() {
|
||||||
@ -60,4 +60,4 @@ Discourse.Route.buildRoutes(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
}
|
@ -1,12 +1,4 @@
|
|||||||
/**
|
export default function() {
|
||||||
Builds the routes for the application
|
|
||||||
|
|
||||||
@method buildRoutes
|
|
||||||
@for Discourse.ApplicationRoute
|
|
||||||
**/
|
|
||||||
Discourse.Route.buildRoutes(function() {
|
|
||||||
var router = this;
|
|
||||||
|
|
||||||
// Error page
|
// Error page
|
||||||
this.route('exception', { path: '/exception' });
|
this.route('exception', { path: '/exception' });
|
||||||
|
|
||||||
@ -20,7 +12,6 @@ Discourse.Route.buildRoutes(function() {
|
|||||||
this.resource('topicBySlug', { path: '/t/:slug' });
|
this.resource('topicBySlug', { path: '/t/:slug' });
|
||||||
|
|
||||||
this.resource('discovery', { path: '/' }, function() {
|
this.resource('discovery', { path: '/' }, function() {
|
||||||
router = this;
|
|
||||||
// top
|
// top
|
||||||
this.route('top');
|
this.route('top');
|
||||||
this.route('topCategory', { path: '/c/:slug/l/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' });
|
this.route('topCategory', { path: '/c/:parentSlug/:slug/l/top' });
|
||||||
|
|
||||||
// top by periods
|
// top by periods
|
||||||
|
var self = this;
|
||||||
Discourse.Site.currentProp('periods').forEach(function(period) {
|
Discourse.Site.currentProp('periods').forEach(function(period) {
|
||||||
var top = 'top' + period.capitalize();
|
var top = 'top' + period.capitalize();
|
||||||
router.route(top, { path: '/top/' + period });
|
self.route(top, { path: '/top/' + period });
|
||||||
router.route(top + 'Category', { path: '/c/:slug/l/top/' + period });
|
self.route(top + 'Category', { path: '/c/:slug/l/top/' + period });
|
||||||
router.route(top + 'CategoryNone', { path: '/c/:slug/none/l/top/' + period });
|
self.route(top + 'CategoryNone', { path: '/c/:slug/none/l/top/' + period });
|
||||||
router.route(top + 'Category', { path: '/c/:parentSlug/:slug/l/top/' + period });
|
self.route(top + 'Category', { path: '/c/:parentSlug/:slug/l/top/' + period });
|
||||||
});
|
});
|
||||||
|
|
||||||
// filters
|
// filters
|
||||||
Discourse.Site.currentProp('filters').forEach(function(filter) {
|
Discourse.Site.currentProp('filters').forEach(function(filter) {
|
||||||
router.route(filter, { path: '/' + filter });
|
self.route(filter, { path: '/' + filter });
|
||||||
router.route(filter + 'Category', { path: '/c/:slug/l/' + filter });
|
self.route(filter + 'Category', { path: '/c/:slug/l/' + filter });
|
||||||
router.route(filter + 'CategoryNone', { path: '/c/:slug/none/l/' + filter });
|
self.route(filter + 'CategoryNone', { path: '/c/:slug/none/l/' + filter });
|
||||||
router.route(filter + 'Category', { path: '/c/:parentSlug/:slug/l/' + filter });
|
self.route(filter + 'Category', { path: '/c/:parentSlug/:slug/l/' + filter });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route('categories');
|
this.route('categories');
|
||||||
@ -62,9 +54,9 @@ Discourse.Route.buildRoutes(function() {
|
|||||||
// User routes
|
// User routes
|
||||||
this.resource('user', { path: '/users/:username' }, function() {
|
this.resource('user', { path: '/users/:username' }, function() {
|
||||||
this.resource('userActivity', { path: '/activity' }, function() {
|
this.resource('userActivity', { path: '/activity' }, function() {
|
||||||
router = this;
|
var self = this;
|
||||||
_.map(Discourse.UserAction.TYPES, function (id, userAction) {
|
_.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.resource('badges', function() {
|
||||||
this.route('show', {path: '/:id/:slug'});
|
this.route('show', {path: '/:id/:slug'});
|
||||||
});
|
});
|
||||||
});
|
}
|
@ -90,7 +90,23 @@ Discourse.Route.reopenClass({
|
|||||||
|
|
||||||
mapRoutes: function() {
|
mapRoutes: function() {
|
||||||
Discourse.Router.map(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'});
|
this.route('unknown', {path: '*path'});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -183,19 +183,6 @@
|
|||||||
background-color: $secondary;
|
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 {
|
th.stats {
|
||||||
width: 90px;
|
width: 90px;
|
||||||
}
|
}
|
||||||
@ -212,12 +199,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.category{
|
.category{
|
||||||
position: relative;
|
|
||||||
width: 45%;
|
width: 45%;
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 1.286em;
|
font-size: 1.286em;
|
||||||
|
i {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
a[href] {
|
a[href] {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
}
|
}
|
||||||
@ -225,20 +214,12 @@
|
|||||||
.subcategories {
|
.subcategories {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
.featured-users {
|
|
||||||
float: right;
|
|
||||||
margin-right: 13px;
|
|
||||||
}
|
|
||||||
.category-description {
|
.category-description {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
.clear-badge {
|
.clear-badge {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
}
|
}
|
||||||
.badge-category.bigger {
|
|
||||||
padding: 6px 10px;
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.featured-topic {
|
.featured-topic {
|
||||||
@ -313,10 +294,6 @@ button.dismiss-read {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-name {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-logo {
|
.category-logo {
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -78,7 +78,6 @@ class PostsController < ApplicationController
|
|||||||
def create_post(params)
|
def create_post(params)
|
||||||
post_creator = PostCreator.new(current_user, params)
|
post_creator = PostCreator.new(current_user, params)
|
||||||
post = post_creator.create
|
post = post_creator.create
|
||||||
DiscourseEvent.trigger(:topic_saved, post.topic, params)
|
|
||||||
|
|
||||||
if post_creator.errors.present?
|
if post_creator.errors.present?
|
||||||
# If the post was spam, flag all the user's posts as spam
|
# 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)]
|
[false, MultiJson.dump(errors: post_creator.errors.full_messages)]
|
||||||
|
|
||||||
else
|
else
|
||||||
|
DiscourseEvent.trigger(:topic_saved, post.topic, params)
|
||||||
post_serializer = PostSerializer.new(post, scope: guardian, root: false)
|
post_serializer = PostSerializer.new(post, scope: guardian, root: false)
|
||||||
post_serializer.draft_sequence = DraftSequence.current(current_user, post.topic.draft_key)
|
post_serializer.draft_sequence = DraftSequence.current(current_user, post.topic.draft_key)
|
||||||
[true, MultiJson.dump(post_serializer)]
|
[true, MultiJson.dump(post_serializer)]
|
||||||
|
Loading…
Reference in New Issue
Block a user