Skip to content

Commit

Permalink
Remove remaining code for two-column categories page
Browse files Browse the repository at this point in the history
  • Loading branch information
nlalonde committed Jan 7, 2014
1 parent b268ea8 commit e7975f2
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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); },

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,111 @@
<section class="category-column first">
{{each categoriesEven itemViewClass="Discourse.FeaturedTopicsView"}}
</section>
<section class="category-column">
{{each categoriesOdd itemViewClass="Discourse.FeaturedTopicsView"}}
</section>

<div class='clearfix'></div>
<div class='contents'>

<table id='topic-list' class='categories'>
<thead>
<tr>
<th class='category'>{{i18n categories.category}}</th>
<th class='latest'>{{i18n categories.latest}}</th>
<th class='stats topics'>{{i18n categories.topics}}</th>
<th class='stats posts'>{{i18n categories.posts}}
{{#if canEdit}}
<button title='{{i18n categories.toggle_ordering}}' class='btn toggle-admin no-text' {{action toggleOrdering}}><i class='fa fa-wrench'></i></button>
{{/if}}
</th>
</tr>
</thead>
<tbody>
{{#each model.categories}}
<tr data-category_id='{{unbound id}}' {{bindAttr class="description_excerpt:has-description:no-description"}}>
<td class='category'>
<div>
<div class="pull-left">
{{#if controller.ordering}}
<i class="fa fa-bars"></i>
{{/if}}
{{categoryLink this allowUncategorized=true}}
{{#if unreadTopics}}
<a href={{unbound unreadUrl}} class='badge new-posts badge-notification' title='{{i18n topic.unread_topics count="unreadTopics"}}'>{{unbound unreadTopics}}</a>
{{/if}}
{{#if newTopics}}
<a href={{unbound newUrl}} class='badge new-posts badge-notification' title='{{i18n topic.new_topics count="newTopics"}}'>{{unbound newTopics}} <i class='fa fa-asterisk'></i></a>
{{/if}}
</div>
<div class='featured-users'>
{{#each featured_users}}
<a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
{{/each}}
</div>
<div class="clearfix"></div>
</div>
{{#if description_excerpt}}
<div class="category-description">
{{{description_excerpt}}}
</div>
{{/if}}

{{#if subcategories}}
<div class='subcategories'>
{{i18n categories.subcategories}}
{{#each subcategory in subcategories}}
{{categoryLink subcategory}}
{{/each}}
</div>
{{/if}}
</td>
<td {{bindAttr class="archived :latest"}}>
{{#each featuredTopics}}
<div class="featured-topic">
{{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"}}'>{{unread}}</a>
{{/if}}
{{#if new_posts}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts count="new_posts"}}'>{{new_posts}}</a>
{{/if}}
{{#if unseen}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new}}'><i class='fa fa-asterisk'></i></a>
{{/if}}

{{#if controller.latestTopicOnly}}
<div class='last-user-info'>
{{i18n categories.latest_by}} <a href="{{{unbound lastPosterUrl}}}">{{unbound last_poster.username}}</a>
<a href="{{unbound lastPostUrl}}">{{unboundAge last_posted_at}}</a>
</div>
{{else}}
&nbsp;
<a href="{{unbound lastPostUrl}}" class="last-posted-at">{{unboundAge last_posted_at}}</a>
{{/if}}
</div>
{{/each}}
</td>
<td class='stats' {{bindAttr title="topicStatsTitle"}}>
<table class="categoryStats">
{{#each topicCountStats}}
<tr>
<td class="value">{{value}}</td>
<td class="unit">{{unit}}</td>
</tr>
{{/each}}
</table>
</td>
<td class='stats' {{bindAttr title="postStatsTitle"}}>
<table class="categoryStats">
{{#each postCountStats}}
<tr>
<td class="value">{{value}}</td>
<td class="unit">{{unit}}</td>
</tr>
{{/each}}
</table>
</td>
</tr>
{{/each}}
</tbody>

</table>
</div>

<footer id='topic-list-bottom'>
</footer>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Discourse.ListWideCategoriesView = Discourse.View.extend({
Discourse.ListCategoriesView = Discourse.View.extend({

orderingChanged: function(){
if (this.get("controller.ordering")) {
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion config/locales/server.da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 |)"
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 역시 설정해야함"
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
3 changes: 0 additions & 3 deletions config/locales/server.pseudo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,6 @@ pseudo:
ƀé čĥéčǩéď ƒóř šíɱíłář ťóƿíčš ]]'
category_colors: '[[ Á ƿíƿé (|) šéƿářáťéď łíšť óƒ ĥéхáďéčíɱáł čółóř νáłůéš áłłóŵéď
ƒóř čáťéǧóříéš ]]'
enable_wide_category_list: '[[ Éɳáƀłé ťřáďíťíóɳáł ƒůłł ŵíďťĥ, ɳóɳ-ťíłíɳǧ, čáťéǧóřý
łíšť. ЍÓŤÉ: ťĥíš šéťťíɳǧ čůřřéɳťłý ďóéš ɳóťĥíɳǧ áɳď ŵíłł ƀé řéɱóνéď. Ŵíďé łíšť
íš ťĥé óɳłý óƿťíóɳ ɳóŵ. ]]'
max_image_size_kb: '[[ Ťĥé ɱáхíɱůɱ šížé óƒ íɱáǧéš ŵé áłłóŵ ůšéřš ťó ůƿłóáď íɳ
ǩƁ - čóɳƒíǧůřé ťĥé łíɱíť íɳ ɳǧíɳх (čłíéɳť_ɱáх_ƀóďý_šížé) / áƿáčĥé óř ƿřóхý áš
ŵéłł. ]]'
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.pt_BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'Список расширений файлов, разрешенных к загрузке, разделенный вертикальной чертой (|)'
Expand Down
3 changes: 0 additions & 3 deletions config/site_settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20140107220141_remove_enable_wide_category_list.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e7975f2

Please sign in to comment.