TRIVIAL: use class instead of id for the 'topic-list'

This commit is contained in:
Régis Hanol
2014-07-29 23:38:36 +02:00
parent 2096861d79
commit b196de0821
19 changed files with 45 additions and 45 deletions

View File

@ -29,14 +29,14 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
'c': '#create-topic', // create new topic 'c': '#create-topic', // create new topic
// star topic // star topic
'f': '#topic-footer-buttons button.star, #topic-list tr.topic-list-item.selected a.star', 'f': '#topic-footer-buttons button.star, .topic-list tr.topic-list-item.selected a.star',
'm m': 'div.notification-options li[data-id="0"] a', // mark topic as muted 'm m': 'div.notification-options li[data-id="0"] a', // mark topic as muted
'm r': 'div.notification-options li[data-id="1"] a', // mark topic as regular 'm r': 'div.notification-options li[data-id="1"] a', // mark topic as regular
'm t': 'div.notification-options li[data-id="2"] a', // mark topic as tracking 'm t': 'div.notification-options li[data-id="2"] a', // mark topic as tracking
'm w': 'div.notification-options li[data-id="3"] a', // mark topic as watching 'm w': 'div.notification-options li[data-id="3"] a', // mark topic as watching
'n': '#user-notifications', // open notifictions menu 'n': '#user-notifications', // open notifictions menu
'o,enter': '#topic-list tr.selected a.title', // open selected topic 'o,enter': '.topic-list tr.selected a.title', // open selected topic
'shift+r': '#topic-footer-buttons button.create', // reply to topic 'shift+r': '#topic-footer-buttons button.create', // reply to topic
'shift+s': '#topic-footer-buttons button.share', // share topic 'shift+s': '#topic-footer-buttons button.share', // share topic
's': '.topic-post.selected a.post-date' // share post 's': '.topic-post.selected a.post-date' // share post
@ -248,11 +248,11 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
}, },
_findArticles: function() { _findArticles: function() {
var $topicList = $('#topic-list'), var $topicList = $('.topic-list'),
$topicArea = $('.posts-wrapper'); $topicArea = $('.posts-wrapper');
if ($topicArea.size() > 0) { if ($topicArea.size() > 0) {
return $('.posts-wrapper .topic-post, #topic-list tbody tr'); return $('.posts-wrapper .topic-post, .topic-list tbody tr');
} }
else if ($topicList.size() > 0) { else if ($topicList.size() > 0) {
return $topicList.find('.topic-list-item'); return $topicList.find('.topic-list-item');

View File

@ -1,6 +1,6 @@
{{#if loaded}} {{#if loaded}}
{{#if topics}} {{#if topics}}
<table id="topic-list"> <table class="topic-list">
<thead> <thead>
<tr> <tr>
<th class="default">{{i18n topic.title}}</th> <th class="default">{{i18n topic.title}}</th>

View File

@ -1,6 +1,6 @@
{{#if categories}} {{#if categories}}
<div class='contents'> <div class='contents'>
<table id='topic-list' class='categories'> <table class='topic-list categories'>
<thead> <thead>
<tr> <tr>
<th class='category'>{{i18n categories.category}}</th> <th class='category'>{{i18n categories.category}}</th>
@ -107,5 +107,5 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<footer id='topic-list-bottom'></footer> <footer class='topic-list-bottom'></footer>
{{/if}} {{/if}}

View File

@ -30,7 +30,7 @@
{{#if content.daily.topics.length}}<a href="{{unbound showMoreDailyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}} {{#if content.daily.topics.length}}<a href="{{unbound showMoreDailyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}}
</div> </div>
{{/if}} {{/if}}
<footer id="topic-list-bottom"> <footer class="topic-list-bottom">
<h3> <h3>
{{#if hasDisplayedAllTopLists}} {{#if hasDisplayedAllTopLists}}
{{#link-to "discovery.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}. {{#link-to "discovery.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}.

View File

@ -24,7 +24,7 @@
{{#if daily}}<h2><i class="fa fa-calendar-o"></i>&nbsp;{{i18n filters.top.today}}</h2>{{/if}} {{#if daily}}<h2><i class="fa fa-calendar-o"></i>&nbsp;{{i18n filters.top.today}}</h2>{{/if}}
{{/if}} {{/if}}
{{#if showTable}} {{#if showTable}}
<table id='topic-list'> <table class='topic-list'>
<thead> <thead>
<tr> <tr>
{{#if currentUser}} {{#if currentUser}}
@ -83,7 +83,7 @@
{{/if}} {{/if}}
</div> </div>
<footer id='topic-list-bottom'> <footer class='topic-list-bottom'>
{{#if loadingMore}} {{#if loadingMore}}
<div class='topics-loading'>{{i18n topic.loading_more}}</div> <div class='topics-loading'>{{i18n topic.loading_more}}</div>
{{/if}} {{/if}}

View File

@ -1,6 +1,6 @@
{{#if loaded}} {{#if loaded}}
{{#if topics}} {{#if topics}}
<table id="topic-list"> <table class="topic-list">
{{#groupedEach topic in topics}} {{#groupedEach topic in topics}}
<tr {{bind-attr class="archived"}}> <tr {{bind-attr class="archived"}}>
<td> <td>

View File

@ -1,6 +1,6 @@
{{#each categories}} {{#each categories}}
<div class='category-list-item'> <div class='category-list-item'>
<table id='topic-list'> <table class='topic-list'>
<tr> <tr>
<th class="main-link"> <th class="main-link">
{{category-link this allowUncategorized=true}} {{category-link this allowUncategorized=true}}
@ -14,7 +14,7 @@
</td> </td>
</tr> </tr>
{{/if}} {{/if}}
{{#each topics}} {{#each topics}}
<tr {{bind-attr class="archived :category-topic-link"}}> <tr {{bind-attr class="archived :category-topic-link"}}>
<td class='main-link'> <td class='main-link'>

View File

@ -6,7 +6,7 @@
{{#if weekly}}<h2><i class="fa fa-calendar-o"></i>&nbsp;{{i18n filters.top.this_week}}</h2>{{/if}} {{#if weekly}}<h2><i class="fa fa-calendar-o"></i>&nbsp;{{i18n filters.top.this_week}}</h2>{{/if}}
{{#if daily}}<h2><i class="fa fa-calendar-o"></i>&nbsp;{{i18n filters.top.today}}</h2>{{/if}} {{#if daily}}<h2><i class="fa fa-calendar-o"></i>&nbsp;{{i18n filters.top.today}}</h2>{{/if}}
{{/if}} {{/if}}
<table id='topic-list'> <table class='topic-list'>
{{#if topicTrackingState.hasIncoming}} {{#if topicTrackingState.hasIncoming}}
<tbody> <tbody>
<tr> <tr>
@ -24,7 +24,7 @@
{{/if}} {{/if}}
</div> </div>
<footer id='topic-list-bottom'> <footer class='topic-list-bottom'>
{{#if loadingMore}} {{#if loadingMore}}
<div class='topics-loading'>{{i18n topic.loading_more}}</div> <div class='topics-loading'>{{i18n topic.loading_more}}</div>
{{/if}} {{/if}}

View File

@ -11,7 +11,7 @@ export default Discourse.View.extend(UrlRefresh, {
}.observes("controller.ordering"), }.observes("controller.ordering"),
rows: function() { rows: function() {
return $('#topic-list tbody'); return $('.topic-list tbody');
}, },
enableOrdering: function(){ enableOrdering: function(){

View File

@ -1,5 +1,5 @@
export default Discourse.View.extend(Discourse.LoadMore, { export default Discourse.View.extend(Discourse.LoadMore, {
classNames: ['paginated-topics-list'], classNames: ['paginated-topics-list'],
eyelineSelector: '.paginated-topics-list #topic-list tr', eyelineSelector: '.paginated-topics-list .topic-list tr',
templateName: 'list/user_topics_list' templateName: 'list/user_topics_list'
}); });

View File

@ -13,7 +13,7 @@
} }
} }
#topic-list { .topic-list {
width: 100%; width: 100%;
border-collapse: separate; border-collapse: separate;
border-spacing: 0; border-spacing: 0;
@ -21,7 +21,7 @@
background: rgba($secondary, .8); background: rgba($secondary, .8);
> tbody > tr { > tbody > tr {
&.archived a { &.archived a {
opacity: 0.6; opacity: 0.6;
} }
@ -95,7 +95,7 @@
} }
#topic-list.categories { .topic-list.categories {
td.category { td.category {
vertical-align: top; vertical-align: top;
@ -121,7 +121,7 @@
} }
.loading #topic-list { .loading .topic-list {
border: 0; border: 0;
@include box-shadow(none); @include box-shadow(none);
tr { tr {
@ -186,7 +186,7 @@ clear: both;
} }
} }
#topic-list { .topic-list {
.alert { .alert {
margin-bottom: 0; margin-bottom: 0;
font-size: 14px; font-size: 14px;

View File

@ -126,7 +126,7 @@
font-size: 18px; font-size: 18px;
} }
#topic-list th, #topic-list td { .topic-list th, .topic-list td {
padding: 12px 5px; padding: 12px 5px;
line-height: 1.25; line-height: 1.25;
text-align: right; text-align: right;
@ -343,12 +343,12 @@
float: left; float: left;
} }
#topic-list .star { .topic-list .star {
width: 20px; width: 20px;
padding-left: 0px; padding-left: 0px;
} }
#topic-list th:first-of-type, #topic-list td:first-of-type { .topic-list th:first-of-type, .topic-list td:first-of-type {
padding-right: 10px; padding-right: 10px;
} }
@ -386,7 +386,7 @@
float: right; float: right;
} }
#topic-list .pull-left { .topic-list .pull-left {
float: right; float: right;
} }

View File

@ -2,7 +2,7 @@
border-left: 1px solid transparent; border-left: 1px solid transparent;
} }
#topic-list tr.selected td:first-child, .topic-list-item.selected td:first-child, .topic-post.selected { .topic-list tr.selected td:first-child, .topic-list-item.selected td:first-child, .topic-post.selected {
border-left: 1px solid $danger; border-left: 1px solid $danger;
} }

View File

@ -41,7 +41,7 @@
// Base list // Base list
// -------------------------------------------------- // --------------------------------------------------
#topic-list { .topic-list {
margin: 0 0 10px; margin: 0 0 10px;
.fa-thumb-tack {color: $primary;} .fa-thumb-tack {color: $primary;}
.fa-thumb-tack.unpinned {color: $primary;} .fa-thumb-tack.unpinned {color: $primary;}
@ -149,12 +149,12 @@
#list-area .top-lists h2 { margin: 5px 0 10px; } #list-area .top-lists h2 { margin: 5px 0 10px; }
#topic-list tbody tr.has-excerpt .star { .topic-list tbody tr.has-excerpt .star {
vertical-align: top; vertical-align: top;
margin-top: 3px; margin-top: 3px;
} }
#topic-list.categories { .topic-list.categories {
a.title {color: $tertiary;} a.title {color: $tertiary;}
a.title:visited:not(.badge-notification) {color: scale-color($tertiary, $lightness: 35%);} a.title:visited:not(.badge-notification) {color: scale-color($tertiary, $lightness: 35%);}
@ -244,7 +244,7 @@
} }
} }
#topic-list-bottom { .topic-list-bottom {
margin: 20px 0; margin: 20px 0;
} }
@ -325,7 +325,7 @@ and (max-width : 850px) {
} }
#topic-list { .topic-list {
.categories td.category { .categories td.category {
padding-left: 10px; padding-left: 10px;
} }

View File

@ -464,7 +464,7 @@ a.star {
#suggested-topics { #suggested-topics {
clear: left; clear: left;
padding: 20px 0 15px 0; padding: 20px 0 15px 0;
#topic-list { .topic-list {
> tbody > tr { > tbody > tr {
&:nth-child(odd) { &:nth-child(odd) {
background-color: darken($secondary, 3%); background-color: darken($secondary, 3%);

View File

@ -27,7 +27,7 @@
// Base list // Base list
// -------------------------------------------------- // --------------------------------------------------
#topic-list { .topic-list {
> tbody > tr { > tbody > tr {
&:nth-child(odd) { &:nth-child(odd) {
@ -85,7 +85,7 @@ tr.category-topic-link:nth-of-type(odd) {
background-color: darken($secondary, 3%) !important; background-color: darken($secondary, 3%) !important;
} }
#topic-list.categories { .topic-list.categories {
td.latest { td.latest {
vertical-align: top; vertical-align: top;
padding: 5px; padding: 5px;
@ -127,7 +127,7 @@ tr.category-topic-link:nth-of-type(odd) {
.category-list-item { .category-list-item {
#topic-list > tbody > tr { .topic-list > tbody > tr {
&:nth-child(odd) { &:nth-child(odd) {
background-color: $secondary; background-color: $secondary;
} }
@ -170,7 +170,7 @@ tr.category-topic-link:nth-of-type(odd) {
} }
#topic-list-bottom { .topic-list-bottom {
margin: 20px 12px 0 12px; margin: 20px 12px 0 12px;
} }
@ -278,7 +278,7 @@ ol.category-breadcrumb {
.top-lists { .top-lists {
h2 { margin-left: 10px; } h2 { margin-left: 10px; }
#topic-list { padding-bottom: 10px; } .topic-list { padding-bottom: 10px; }
.btn-default.pull-right { margin-right: 10px; } .btn-default.pull-right { margin-right: 10px; }
} }
@ -286,7 +286,7 @@ ol.category-breadcrumb {
display: none; display: none;
} }
#topic-list-bottom h3 { .topic-list-bottom h3 {
clear:both; clear:both;
padding-top:10px; padding-top:10px;
} }

View File

@ -92,7 +92,7 @@ var run = function(){
page.runTests = function(){ page.runTests = function(){
test("at least one topic shows up", function() { test("at least one topic shows up", function() {
return $('#topic-list tbody tr').length > 0; return $('.topic-list tbody tr').length > 0;
}); });
test("expect a log in button", function(){ test("expect a log in button", function(){

View File

@ -35,7 +35,7 @@ module("Discourse.KeyboardShortcuts", {
" <li data-id='3'><a></a></li>", " <li data-id='3'><a></a></li>",
" </ul>", " </ul>",
"</div>", "</div>",
"<table id='topic-list'>", "<table class='topic-list'>",
" <tr class='topic-list-item selected'><td>", " <tr class='topic-list-item selected'><td>",
" <a class='title'></a>", " <a class='title'></a>",
" </td></tr>", " </td></tr>",

View File

@ -4,8 +4,8 @@ test("Default List", function() {
expect(2); expect(2);
visit("/").then(function() { visit("/").then(function() {
ok(exists("#topic-list"), "The list of topics was rendered"); ok(exists(".topic-list"), "The list of topics was rendered");
ok(exists('#topic-list .topic-list-item'), "has topics"); ok(exists('.topic-list .topic-list-item'), "has topics");
}); });
}); });
@ -13,8 +13,8 @@ test("List one Category", function() {
expect(2); expect(2);
visit("/category/bug").then(function() { visit("/category/bug").then(function() {
ok(exists("#topic-list"), "The list of topics was rendered"); ok(exists(".topic-list"), "The list of topics was rendered");
ok(exists('#topic-list .topic-list-item'), "has topics"); ok(exists('.topic-list .topic-list-item'), "has topics");
}); });
}); });