diff --git a/app/assets/javascripts/discourse/helpers/application_helpers.js b/app/assets/javascripts/discourse/helpers/application_helpers.js
index 89a58dc90..b703ceef5 100644
--- a/app/assets/javascripts/discourse/helpers/application_helpers.js
+++ b/app/assets/javascripts/discourse/helpers/application_helpers.js
@@ -315,3 +315,21 @@ Handlebars.registerHelper('faqLink', function(property, options) {
"'>" + I18n.t('faq') + ""
);
});
+
+
+Ember.Handlebars.registerHelper('link-to-categories', function(){
+
+ var options = [].slice.call(arguments, -1)[0],
+ params = Discourse.SiteSettings.enable_wide_category_list ? ['list.wideCategories'] : ['list.categories'],
+ hash = options.hash;
+
+ hash.disabledBinding = hash.disabledWhen;
+
+ hash.parameters = {
+ context: this,
+ options: options,
+ params: params
+ };
+
+ return Ember.Handlebars.helpers.view.call(this, Ember.LinkView, options);
+});
diff --git a/app/assets/javascripts/discourse/routes/application_routes.js b/app/assets/javascripts/discourse/routes/application_routes.js
index 5772dc6a3..9efe95414 100644
--- a/app/assets/javascripts/discourse/routes/application_routes.js
+++ b/app/assets/javascripts/discourse/routes/application_routes.js
@@ -29,11 +29,15 @@ Discourse.Route.buildRoutes(function() {
});
// the homepage is the first item of the 'top_menu' site setting
- var settings = Discourse.SiteSettings || PreloadStore.get('siteSettings');
+ var settings = Discourse.SiteSettings;
var homepage = settings.top_menu.split("|")[0].split(",")[0];
this.route(homepage, { path: '/' });
- this.route('categories', { path: '/categories' });
+ if(settings.enable_wide_category_list) {
+ this.route('wideCategories', { path: '/categories' });
+ } else {
+ this.route('categories', { path: '/categories' });
+ }
this.route('category', { path: '/category/:slug/more' });
this.route('category', { path: '/category/:slug' });
});
diff --git a/app/assets/javascripts/discourse/routes/list_categories_route.js b/app/assets/javascripts/discourse/routes/list_categories_route.js
index 5ebd12d4d..8a12779b6 100644
--- a/app/assets/javascripts/discourse/routes/list_categories_route.js
+++ b/app/assets/javascripts/discourse/routes/list_categories_route.js
@@ -8,6 +8,8 @@
**/
Discourse.ListCategoriesRoute = Discourse.Route.extend({
+ template: 'listCategories',
+
redirect: function() { Discourse.redirectIfLoginRequired(this); },
actions: {
@@ -32,7 +34,7 @@ Discourse.ListCategoriesRoute = Discourse.Route.extend({
},
renderTemplate: function() {
- this.render('listCategories', { into: 'list', outlet: 'listView' });
+ this.render(this.get('template'), { into: 'list', outlet: 'listView' });
},
afterModel: function(categoryList) {
diff --git a/app/assets/javascripts/discourse/routes/list_wide_categories_route.js b/app/assets/javascripts/discourse/routes/list_wide_categories_route.js
new file mode 100644
index 000000000..7d594a309
--- /dev/null
+++ b/app/assets/javascripts/discourse/routes/list_wide_categories_route.js
@@ -0,0 +1,7 @@
+Discourse.ListWideCategoriesRoute = Discourse.ListCategoriesRoute.extend({
+ template: 'listWideCategories'
+});
+
+
+Discourse.ListWideCategoriesController = Discourse.Controller.extend({
+});
diff --git a/app/assets/javascripts/discourse/templates/header.js.handlebars b/app/assets/javascripts/discourse/templates/header.js.handlebars
index c3790dde1..38b18f31b 100644
--- a/app/assets/javascripts/discourse/templates/header.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/header.js.handlebars
@@ -139,7 +139,7 @@
{{#if categories}}
-
- {{#link-to "list.categories"}}{{i18n filters.categories.title}}{{/link-to}}
+ {{#link-to-categories}}{{i18n filters.categories.title}}{{/link-to-categories}}
{{#each categories}}
diff --git a/app/assets/javascripts/discourse/templates/list/topics.js.handlebars b/app/assets/javascripts/discourse/templates/list/topics.js.handlebars
index 236787cd7..b2ca8c9d5 100644
--- a/app/assets/javascripts/discourse/templates/list/topics.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/list/topics.js.handlebars
@@ -60,7 +60,7 @@
{{i18n topic.suggest_create_topic}}
{{/if}}
{{else}}
- {{#link-to 'list.categories'}}{{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}
+ {{#link-to-categories}}{{i18n topic.browse_all_categories}}{{/link-to-categories}} {{i18n or}} {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}
{{/if}}
{{/if}}
diff --git a/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars b/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars
new file mode 100644
index 000000000..6fd96e37a
--- /dev/null
+++ b/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars
@@ -0,0 +1,39 @@
+
+
+
+
+
+ {{i18n categories.category}} |
+ {{i18n categories.participants}} |
+ {{i18n categories.topics}} |
+ {{i18n categories.posts}} |
+ {{i18n categories.latest}} |
+
+
+
+ {{#each model.categories}}
+
+ {{categoryLink this}}
+ {{#if description_excerpt}}
+
+ {{{description_excerpt}}}
+
+ {{/if}}
+ |
+ {{#each featured_users}}
+ {{avatar this imageSize="small"}}
+ {{/each}}
+ |
+ {{number topics_total}} |
+ {{number posts_total}} |
+ this is a link to a post 4d |
+
+ {{/each}}
+
+
+
+
+
+
+
diff --git a/app/assets/stylesheets/desktop/topic-list.scss b/app/assets/stylesheets/desktop/topic-list.scss
index a72e077ac..139841bcd 100644
--- a/app/assets/stylesheets/desktop/topic-list.scss
+++ b/app/assets/stylesheets/desktop/topic-list.scss
@@ -191,6 +191,20 @@
}
}
+
+#topic-list.categories {
+ .category{
+ width: 50%;
+ .category-description {
+ margin-top: 10px;
+ }
+ .badge-category {
+ padding: 6px 10px;
+ font-size: 14px;
+ }
+ }
+}
+
// Category list
// --------------------------------------------------
diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb
index 81befe43c..ff32a727c 100644
--- a/app/models/site_setting.rb
+++ b/app/models/site_setting.rb
@@ -51,6 +51,7 @@ class SiteSetting < ActiveRecord::Base
client_setting(:min_body_similar_length, 15)
# cf. https://github.com/discourse/discourse/pull/462#issuecomment-14991562
client_setting(:category_colors, 'BF1E2E|F1592A|F7941D|9EB83B|3AB54A|12A89D|25AAE2|0E76BD|652D90|92278F|ED207B|8C6238|231F20|808281|B3B5B4|283890')
+ client_setting(:enable_wide_category_list, false)
# auto-replace rules for title
setting(:title_prettify, true)
diff --git a/app/views/common/_discourse_javascript.html.erb b/app/views/common/_discourse_javascript.html.erb
index b980c8b1b..151927422 100644
--- a/app/views/common/_discourse_javascript.html.erb
+++ b/app/views/common/_discourse_javascript.html.erb
@@ -21,7 +21,7 @@
Discourse.BaseUrl = '<%= RailsMultisite::ConnectionManagement.current_hostname %>';
Discourse.BaseUri = '<%= Discourse::base_uri "/" %>';
Discourse.Environment = '<%= Rails.env %>';
- Discourse.SiteSettings.login_required && !Discourse.User.current();
+ Discourse.SiteSettings = PreloadStore.get('siteSettings');
Discourse.Router.map(function() {
Discourse.routeBuilder.call(this);
});
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index c7cdfee8f..146eb7d62 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -183,6 +183,13 @@ en:
"12": "Sent Items"
"13": "Inbox"
+ categories:
+ category: "Category"
+ participants: "Participants"
+ posts: "Posts"
+ topics: "Topics"
+ latest: "Latest"
+
user:
said: "{{username}} said:"
profile: "Profile"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 41a2ff4d7..27d06d17c 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -667,6 +667,8 @@ en:
min_body_similar_length: "The minimum length of a post's body before it will be checked for similar topics"
category_colors: "A pipe (|) separated list of hexadecimal color values allowed for categories"
+ enable_wide_category_list: "Enable traditional full width, non-tiling, category list"
+
max_image_size_kb: "The maximum size of images we allow users to upload in kB - configure the limit in nginx (client_max_body_size) / apache or proxy as well."
max_attachment_size_kb: "The maximum size of files we allow users to upload in kB - configure the limit in nginx (client_max_body_size) / apache or proxy as well."
authorized_extensions: "A pipe (|) separated list of file extensions allowed for upload"