From e7975f25b854471971291d041be8467768619b8e Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Tue, 7 Jan 2014 18:13:35 -0500 Subject: [PATCH] Remove remaining code for two-column categories page --- .../controllers/list_categories_controller.js | 15 --- .../discourse/routes/list_categories_route.js | 7 +- .../templates/list/categories.js.handlebars | 117 ++++++++++++++++-- .../list/wide_categories.js.handlebars | 111 ----------------- ...gories_view.js => list_categories_view.js} | 2 +- app/controllers/categories_controller.rb | 3 - config/locales/server.da.yml | 1 - config/locales/server.en.yml | 1 - config/locales/server.fr.yml | 1 - config/locales/server.ko.yml | 1 - config/locales/server.nl.yml | 1 - config/locales/server.pseudo.yml | 3 - config/locales/server.pt_BR.yml | 1 - config/locales/server.ru.yml | 1 - config/site_settings.yml | 3 - ...220141_remove_enable_wide_category_list.rb | 9 ++ 16 files changed, 121 insertions(+), 156 deletions(-) delete mode 100644 app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars rename app/assets/javascripts/discourse/views/list/{list_wide_categories_view.js => list_categories_view.js} (93%) create mode 100644 db/migrate/20140107220141_remove_enable_wide_category_list.rb diff --git a/app/assets/javascripts/discourse/controllers/list_categories_controller.js b/app/assets/javascripts/discourse/controllers/list_categories_controller.js index 079c480fc..2f285bc94 100644 --- a/app/assets/javascripts/discourse/controllers/list_categories_controller.js +++ b/app/assets/javascripts/discourse/controllers/list_categories_controller.js @@ -15,21 +15,6 @@ Discourse.ListCategoriesController = Discourse.ObjectController.extend({ } }, - categoriesEven: function() { - if (this.blank('categories')) return Em.A(); - - return this.get('categories').filter(function(item, index) { - return (index % 2) === 0; - }); - }.property('categories.@each'), - - categoriesOdd: function() { - if (this.blank('categories')) return Em.A(); - return this.get('categories').filter(function(item, index) { - return (index % 2) === 1; - }); - }.property('categories.@each'), - canEdit: function() { return Discourse.User.currentProp('staff'); }.property(), diff --git a/app/assets/javascripts/discourse/routes/list_categories_route.js b/app/assets/javascripts/discourse/routes/list_categories_route.js index b5c96de0e..ed8ec0a71 100644 --- a/app/assets/javascripts/discourse/routes/list_categories_route.js +++ b/app/assets/javascripts/discourse/routes/list_categories_route.js @@ -8,12 +8,7 @@ **/ Discourse.ListCategoriesRoute = Discourse.Route.extend({ - template: function() { - // Remove the option to have 2-column layout on categories page. - // TODO: remove this old code when we're sure about it. - // return Discourse.SiteSettings.enable_wide_category_list ? 'listWideCategories' : 'listCategories'; - return 'listWideCategories'; - }.property(), + template: 'listCategories', redirect: function() { Discourse.redirectIfLoginRequired(this); }, diff --git a/app/assets/javascripts/discourse/templates/list/categories.js.handlebars b/app/assets/javascripts/discourse/templates/list/categories.js.handlebars index 315f4d16b..8ab40b0f5 100644 --- a/app/assets/javascripts/discourse/templates/list/categories.js.handlebars +++ b/app/assets/javascripts/discourse/templates/list/categories.js.handlebars @@ -1,8 +1,111 @@ -
- {{each categoriesEven itemViewClass="Discourse.FeaturedTopicsView"}} -
-
- {{each categoriesOdd itemViewClass="Discourse.FeaturedTopicsView"}} -
+
+ + + + + + + + + + + + {{#each model.categories}} + + + + + + + {{/each}} + + +
{{i18n categories.category}}{{i18n categories.latest}}{{i18n categories.topics}}{{i18n categories.posts}} + {{#if canEdit}} + + {{/if}} +
+
+
+ {{#if controller.ordering}} + + {{/if}} + {{categoryLink this allowUncategorized=true}} + {{#if unreadTopics}} + {{unbound unreadTopics}} + {{/if}} + {{#if newTopics}} + {{unbound newTopics}} + {{/if}} +
+ +
+
+ {{#if description_excerpt}} +
+ {{{description_excerpt}}} +
+ {{/if}} + + {{#if subcategories}} +
+ {{i18n categories.subcategories}} + {{#each subcategory in subcategories}} + {{categoryLink subcategory}} + {{/each}} +
+ {{/if}} +
+ {{#each featuredTopics}} + + {{/each}} + + + {{#each topicCountStats}} + + + + + {{/each}} +
{{value}}{{unit}}
+
+ + {{#each postCountStats}} + + + + + {{/each}} +
{{value}}{{unit}}
+
+
+ + -
\ No newline at end of file diff --git a/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars b/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars deleted file mode 100644 index 8ab40b0f5..000000000 --- a/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars +++ /dev/null @@ -1,111 +0,0 @@ -
- - - - - - - - - - - - {{#each model.categories}} - - - - - - - {{/each}} - - -
{{i18n categories.category}}{{i18n categories.latest}}{{i18n categories.topics}}{{i18n categories.posts}} - {{#if canEdit}} - - {{/if}} -
-
-
- {{#if controller.ordering}} - - {{/if}} - {{categoryLink this allowUncategorized=true}} - {{#if unreadTopics}} - {{unbound unreadTopics}} - {{/if}} - {{#if newTopics}} - {{unbound newTopics}} - {{/if}} -
- -
-
- {{#if description_excerpt}} -
- {{{description_excerpt}}} -
- {{/if}} - - {{#if subcategories}} -
- {{i18n categories.subcategories}} - {{#each subcategory in subcategories}} - {{categoryLink subcategory}} - {{/each}} -
- {{/if}} -
- {{#each featuredTopics}} - - {{/each}} - - - {{#each topicCountStats}} - - - - - {{/each}} -
{{value}}{{unit}}
-
- - {{#each postCountStats}} - - - - - {{/each}} -
{{value}}{{unit}}
-
-
- - - diff --git a/app/assets/javascripts/discourse/views/list/list_wide_categories_view.js b/app/assets/javascripts/discourse/views/list/list_categories_view.js similarity index 93% rename from app/assets/javascripts/discourse/views/list/list_wide_categories_view.js rename to app/assets/javascripts/discourse/views/list/list_categories_view.js index 6f7579bab..5dc7999f9 100644 --- a/app/assets/javascripts/discourse/views/list/list_wide_categories_view.js +++ b/app/assets/javascripts/discourse/views/list/list_categories_view.js @@ -1,4 +1,4 @@ -Discourse.ListWideCategoriesView = Discourse.View.extend({ +Discourse.ListCategoriesView = Discourse.View.extend({ orderingChanged: function(){ if (this.get("controller.ordering")) { diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index 8b9d0c1e4..14d0b36f5 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -9,9 +9,6 @@ class CategoriesController < ApplicationController def index @description = SiteSetting.site_description - # TODO: remove this when we're sure about removing 2-column layout on categories page - # wide_mode = SiteSetting.enable_wide_category_list - options = {} options[:latest_posts] = params[:latest_posts] || SiteSetting.category_featured_topics diff --git a/config/locales/server.da.yml b/config/locales/server.da.yml index bc6218395..57761a7de 100644 --- a/config/locales/server.da.yml +++ b/config/locales/server.da.yml @@ -723,7 +723,6 @@ da: min_body_similar_length: "Den mindste længde af en brødtekst før der ledes efter lignende emner." category_colors: "En pipe-separeret (|) liste af tilladte hexadecimale farveværdier for kategorier." - enable_wide_category_list: "Aktivér traditionel, fuldbredde kategoriliste uden tiling. BEMÆRK: Denne indstilling har ingen virkning og bliver fjernet. Den brede liste er den eneste mulighed nu." max_image_size_kb: "Den maksimale billedstørrelse som vi lader brugerne uploade, i kB - husk at tilpasse den tilsvarende værdi i nginx (client_max_body_size) / apache eller proxy." max_attachment_size_kb: "Den maksimale filstørrelse som vi lader brugerne uploade, i kB - husk at tilpasse den tilsvarende værdi i nginx (client_max_body_size) / apache eller proxy." diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 3c0ab1f55..696fd815a 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -720,7 +720,6 @@ 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. NOTE: this setting currently does nothing and will be removed. Wide list is the only option now." 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." diff --git a/config/locales/server.fr.yml b/config/locales/server.fr.yml index dd2ee993f..ba13b42f5 100644 --- a/config/locales/server.fr.yml +++ b/config/locales/server.fr.yml @@ -615,7 +615,6 @@ fr: min_title_similar_length: "La taille minimale d'un titre avant que l'on vérifie l'existence de discussions identiques" min_body_similar_length: "La taille minimale d'un message avant que l'on vérifie l'existence de discussions identiques" category_colors: "Une liste de couleurs autorisées pour les catégories (au format hexadécimal, séparés par un |)" - enable_wide_category_list: "Activer pleine largeur, sans cadrillage, liste des catégories" max_image_size_kb: "La taille maximale des images que nous permettons aux utilisateurs d'envoyer (en Ko) - configure la limite dans nginx (client_max_body_size) / apache ou proxy aussi." max_attachment_size_kb: "La taille maximale des fichiers que nous permettons aux utilisateurs d'envoyer (en Ko) - configure la limite dans nginx (client_max_body_size) / apache ou proxy aussi." authorized_extensions: "Une liste d'extensions de fichier autorisées pour les envois de fichiers (séparés par un |)" diff --git a/config/locales/server.ko.yml b/config/locales/server.ko.yml index 4afc16dd2..21e4c0994 100644 --- a/config/locales/server.ko.yml +++ b/config/locales/server.ko.yml @@ -670,7 +670,6 @@ ko: 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: "사용자가 업로드 할 수 있는 이미지 최대 kB 사이즈 - nginx(client_max_body_size), apache, proxy 역시 설정해야함" max_attachment_size_kb: "사용자가 업로드 할 수 있는 파일 최대 kB 사이즈 - nginx(client_max_body_size), apache, proxy 역시 설정해야함" diff --git a/config/locales/server.nl.yml b/config/locales/server.nl.yml index f81a788da..2e180f2aa 100644 --- a/config/locales/server.nl.yml +++ b/config/locales/server.nl.yml @@ -683,7 +683,6 @@ nl: min_body_similar_length: De minimale lengte die de inhoud van een bericht moet hebben voordat er wordt gezocht naar vergelijkbare topics category_colors: "Een lijst, gescheiden door een pipe (|), van hexadecimal kleurwaardes die gebruikt kunnen worden voor categorien" - enable_wide_category_list: "Activeer traditionele volle breedte, non-tiling, categorielijst" max_image_size_kb: "De maximale afbeeldingsgrootte die we toestaan voor uploads, in kB. Zorg er voor dat deze limiet ook ingesteld is in nginx (client_max_body_size) / apache of een proxy." max_attachment_size_kb: "De maximale bestandsgrootte die we toestaan voor uploads, in kB. Zorg er voor dat deze limiet ook ingesteld is in nginx (client_max_body_size) / apache of een proxy." diff --git a/config/locales/server.pseudo.yml b/config/locales/server.pseudo.yml index 69effb4ba..3f18132cb 100644 --- a/config/locales/server.pseudo.yml +++ b/config/locales/server.pseudo.yml @@ -874,9 +874,6 @@ pseudo: ƀé čĥéčǩéď ƒóř šíɱíłář ťóƿíčš ]]' category_colors: '[[ Á ƿíƿé (|) šéƿářáťéď łíšť óƒ ĥéхáďéčíɱáł čółóř νáłůéš áłłóŵéď ƒóř čáťéǧóříéš ]]' - enable_wide_category_list: '[[ Éɳáƀłé ťřáďíťíóɳáł ƒůłł ŵíďťĥ, ɳóɳ-ťíłíɳǧ, čáťéǧóřý - łíšť. ЍÓŤÉ: ťĥíš šéťťíɳǧ čůřřéɳťłý ďóéš ɳóťĥíɳǧ áɳď ŵíłł ƀé řéɱóνéď. Ŵíďé łíšť - íš ťĥé óɳłý óƿťíóɳ ɳóŵ. ]]' max_image_size_kb: '[[ Ťĥé ɱáхíɱůɱ šížé óƒ íɱáǧéš ŵé áłłóŵ ůšéřš ťó ůƿłóáď íɳ ǩƁ - čóɳƒíǧůřé ťĥé łíɱíť íɳ ɳǧíɳх (čłíéɳť_ɱáх_ƀóďý_šížé) / áƿáčĥé óř ƿřóхý áš ŵéłł. ]]' diff --git a/config/locales/server.pt_BR.yml b/config/locales/server.pt_BR.yml index 576164d32..78a41f287 100644 --- a/config/locales/server.pt_BR.yml +++ b/config/locales/server.pt_BR.yml @@ -662,7 +662,6 @@ pt_BR: min_body_similar_length: "Tamanho mínimo do corpo de uma postagem antes de ele ser checado por tópicos similares" category_colors: "Lista separada por barra (|) das cores em hexadecimal permitidas para as categorias" - enable_wide_category_list: "Habilitar lista de categorias tradicional com largura total" max_image_size_kb: "Tamanho máximo de imagens que os usuários podem enviar em kB - certifique-se de configurar o limite no nginx (client_max_body_size) / apache, e também no proxy." max_attachment_size_kb: "Tamanho máximo de arquivos que os usuários podem enviar em kB - certifique-se de configurar o limite no nginx (client_max_body_size) / apache, e também no proxy." diff --git a/config/locales/server.ru.yml b/config/locales/server.ru.yml index 8e6787cc2..ce174d9dd 100644 --- a/config/locales/server.ru.yml +++ b/config/locales/server.ru.yml @@ -641,7 +641,6 @@ ru: min_title_similar_length: 'Минимальная длина названия темы, при которой тема будет проверена на наличие похожих' min_body_similar_length: 'Минимальная длина тела сообщения, при которой оно будет проверено на наличие похожих тем' category_colors: 'Разделенный чертой (|) список дозволенных hexadecimal цветов для категорий' - enable_wide_category_list: 'Использовать обычный полноразмерный список категорий. ВНИМАНИЕ: на текущий момент данная настройка ничего не делает и в скором времени будет удалена. Полноразмерный список является единственно возможным.' max_image_size_kb: 'Максимальный размер изображений для загрузки пользователем в КБ – убедитесь, что вы так же настроили лимит в nginx (client_max_body_size) / apache или прокси.' max_attachment_size_kb: 'Максимальный размер файлов для загрузки пользователем в кб – убедитесь, что вы настроили лимит также в nginx (client_max_body_size) / apache или proxy.' authorized_extensions: 'Список расширений файлов, разрешенных к загрузке, разделенный вертикальной чертой (|)' diff --git a/config/site_settings.yml b/config/site_settings.yml index 02b8547fc..c030f5e3a 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -30,9 +30,6 @@ basic: ga_domain_name: client: true default: '' - enable_wide_category_list: - client: true - default: true category_featured_topics: client: true default: 3 diff --git a/db/migrate/20140107220141_remove_enable_wide_category_list.rb b/db/migrate/20140107220141_remove_enable_wide_category_list.rb new file mode 100644 index 000000000..80850969f --- /dev/null +++ b/db/migrate/20140107220141_remove_enable_wide_category_list.rb @@ -0,0 +1,9 @@ +class RemoveEnableWideCategoryList < ActiveRecord::Migration + def up + execute "DELETE FROM site_settings WHERE name = 'enable_wide_category_list'" + end + + def down + # Nothing. Default site setting value will be used. + end +end