Skip to content

Commit e0ae43d

Browse files
committed
Improve class naming symantics
1 parent a287d45 commit e0ae43d

6 files changed

Lines changed: 38 additions & 42 deletions

File tree

styles/prosilver/template/idea_body.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<dt class="idealabel">{{ lang('RATING') ~ lang('COLON') }}</dt>
1616
<dd>
1717
<div class="rating">
18-
<a {% if S_CAN_VOTE %}href="{{ U_IDEA_VOTE }}"{% endif %} class="minivoteup{{ not S_CAN_VOTE_UP ? ' dead' }}" title="{{ lang('VOTE_UP') }}" data-l-err="{{ lang('ERROR') }}" data-l-msg="{{ lang('VOTE_ERROR') ~ lang('COLON') }}"><i class="icon fa-check-circle user-voted{{ not S_VOTED or S_CAN_VOTE_UP ? ' hidden' }}" aria-hidden="true"></i><i class="icon fa-thumbs-up"></i><span class="vote-count">{{ IDEA_VOTES_UP }}</span></a> &nbsp;
19-
<a {% if S_CAN_VOTE %}href="{{ U_IDEA_VOTE }}"{% endif %} class="minivotedown{{ not S_CAN_VOTE_DOWN ? ' dead' }}" title="{{ lang('VOTE_DOWN') }}" data-l-err="{{ lang('ERROR') }}" data-l-msg="{{ lang('VOTE_ERROR') ~ lang('COLON') }}"><i class="icon fa-check-circle user-voted{{ not S_VOTED or S_CAN_VOTE_DOWN ? ' hidden' }}" aria-hidden="true"></i><i class="icon fa-thumbs-down"></i><span class="vote-count">{{ IDEA_VOTES_DOWN }}</span></a>
18+
<a {% if S_CAN_VOTE %}href="{{ U_IDEA_VOTE }}"{% endif %} class="minivote vote-up{{ not S_CAN_VOTE_UP ? ' vote-disabled' }}" title="{{ lang('VOTE_UP') }}" data-l-err="{{ lang('ERROR') }}" data-l-msg="{{ lang('VOTE_ERROR') ~ lang('COLON') }}"><i class="icon fa-check-circle user-voted{{ not S_VOTED or S_CAN_VOTE_UP ? ' hidden' }}" aria-hidden="true"></i><i class="icon fa-thumbs-up"></i><span class="vote-count">{{ IDEA_VOTES_UP }}</span></a> &nbsp;
19+
<a {% if S_CAN_VOTE %}href="{{ U_IDEA_VOTE }}"{% endif %} class="minivote vote-down{{ not S_CAN_VOTE_DOWN ? ' vote-disabled' }}" title="{{ lang('VOTE_DOWN') }}" data-l-err="{{ lang('ERROR') }}" data-l-msg="{{ lang('VOTE_ERROR') ~ lang('COLON') }}"><i class="icon fa-check-circle user-voted{{ not S_VOTED or S_CAN_VOTE_DOWN ? ' hidden' }}" aria-hidden="true"></i><i class="icon fa-thumbs-down"></i><span class="vote-count">{{ IDEA_VOTES_DOWN }}</span></a>
2020
<a href="#" class="votes bg3" data-l-msg="{{ lang('CLICK_TO_VIEW') }}">{{ lang('TOTAL_POINTS', IDEA_POINTS) }} {{ IDEA_VOTES ? lang('CLICK_TO_VIEW') }}</a> <span class="successvoted bg3" data-l-err="{{ lang('VOTE_FAIL') }}"></span>
2121
</div>
2222
<div class="clear"></div>

styles/prosilver/template/ideas.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
userVoted: $('.user-voted'),
3030
votes: $('.votes'),
3131
votesList: $('.voteslist'),
32-
voteDown: $('.minivotedown'),
33-
voteUp: $('.minivoteup'),
32+
voteDown: $('.vote-down'),
33+
voteUp: $('.vote-up'),
3434
voteRemove: $('#vote-remove')
3535
}, $loadingIndicator;
3636

@@ -70,9 +70,9 @@
7070

7171
var $this = $(this),
7272
url = $this.attr('href'),
73-
vote = $this.hasClass('minivoteup') ? 1 : 0;
73+
vote = $this.is($obj.voteUp) ? 1 : 0;
7474

75-
if ($this.hasClass('dead')) {
75+
if ($this.hasClass('vote-disabled')) {
7676
return false;
7777
}
7878

@@ -98,7 +98,7 @@
9898
var $this = $(this),
9999
url = $this.attr('href');
100100

101-
if ($this.hasClass('dead')) {
101+
if ($this.hasClass('vote-disabled')) {
102102
return false;
103103
}
104104

@@ -407,11 +407,11 @@
407407
}
408408

409409
function resetVoteButtons($this) {
410-
$obj.voteUp.add($obj.voteDown).removeClass('dead');
410+
$obj.voteUp.add($obj.voteDown).removeClass('vote-disabled');
411411
$obj.userVoted.hide();
412412

413413
if ($this) {
414-
$this.addClass('dead').find($obj.userVoted).show();
414+
$this.addClass('vote-disabled').find($obj.userVoted).show();
415415
}
416416
}
417417

styles/prosilver/template/index_list.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
</dt>
1818

1919
<dd class="topics"{% if idea.USER_VOTED !== '' %} title="{{ lang('USER_ALREADY_VOTED', idea.USER_VOTED) }}"{% endif %}>
20-
<div class="minivoteup dead">
21-
<i class="icon fa-thumbs-up"></i><span>{{ idea.VOTES_UP }}</span>{% if idea.USER_VOTED === 1 %}<i class="icon fa-check-circle user-voted" aria-hidden="true"></i>{% endif %}
20+
<div class="minivote vote-up vote-disabled">
21+
<i class="icon fa-thumbs-up"></i><span class="vote-count">{{ idea.VOTES_UP }}</span>{% if idea.USER_VOTED === 1 %}<i class="icon fa-check-circle user-voted" aria-hidden="true"></i>{% endif %}
2222
</div>
23-
<div class="minivotedown dead">
24-
<i class="icon fa-thumbs-down"></i><span>{{ idea.VOTES_DOWN }}</span>{% if idea.USER_VOTED === 0 %}<i class="icon fa-check-circle user-voted" aria-hidden="true"></i>{% endif %}
23+
<div class="minivote vote-down vote-disabled">
24+
<i class="icon fa-thumbs-down"></i><span class="vote-count">{{ idea.VOTES_DOWN }}</span>{% if idea.USER_VOTED === 0 %}<i class="icon fa-check-circle user-voted" aria-hidden="true"></i>{% endif %}
2525
</div>
2626
</dd>
2727
</dl>

styles/prosilver/theme/ideas.css

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ dd.topics {
1414
}
1515

1616
/* Vote buttons */
17-
.minivoteup,
18-
.minivotedown {
17+
.minivote {
1918
line-height: normal;
2019
white-space: nowrap;
2120
border-radius: 6px;
@@ -29,47 +28,51 @@ dd.topics {
2928
padding: 6px 10px;
3029
}
3130

32-
.minivoteup .icon,
33-
.minivotedown .icon {
31+
.minivote .icon {
3432
font-size: 16px;
3533
padding-right: 0;
3634
padding-left: 0;
3735
}
3836

39-
.minivoteup span,
40-
.minivotedown span {
37+
.minivote .vote-count {
4138
font-family: Verdana, Arial, sans-serif;
4239
font-size: 14px;
4340
text-align: center;
4441
display: inline-block;
4542
width: 40px;
4643
}
4744

48-
.minivoteup,
49-
.minivoteup.dead:hover {
45+
.rtl .minivote {
46+
float: right;
47+
margin-right: auto;
48+
margin-left: 10px;
49+
}
50+
51+
.vote-up,
52+
.vote-up.vote-disabled:hover {
5053
background: #00a9e2;
5154
border: solid 1px #00a9e2;
5255
}
5356

54-
.minivoteup:hover {
57+
.vote-up:hover {
5558
background: #009ad1;
5659
}
5760

58-
.minivoteup:active {
61+
.vote-up:active {
5962
background: #10b2e5;
6063
}
6164

62-
.minivotedown,
63-
.minivotedown.dead:hover {
65+
.vote-down,
66+
.vote-down.vote-disabled:hover {
6467
background: #f76c5e;
6568
border: solid 1px #f76c5e;
6669
}
6770

68-
.minivotedown:hover {
71+
.vote-down:hover {
6972
background: #e56155;
7073
}
7174

72-
.minivotedown:active {
75+
.vote-down:active {
7376
background: #f87768;
7477
}
7578

@@ -81,13 +84,6 @@ dd.topics {
8184
right: -4px;
8285
}
8386

84-
.rtl .minivoteup,
85-
.rtl .minivotedown {
86-
float: right;
87-
margin-right: auto;
88-
margin-left: 10px;
89-
}
90-
9187
.rtl .user-voted {
9288
right: auto;
9389
left: -4px;
@@ -152,15 +148,15 @@ dd.topics {
152148
border-top: dashed 1px #b9b9b9;
153149
}
154150

155-
.dead {
151+
.vote-disabled {
156152
cursor: default;
157153
}
158154

159-
.dead:hover {
155+
.vote-disabled:hover {
160156
text-decoration: none;
161157
}
162158

163-
.dead.removevote {
159+
.vote-disabled.removevote {
164160
display: none;
165161
}
166162

@@ -169,7 +165,7 @@ dd.topics {
169165
}
170166

171167
.idealabel {
172-
width: 10% !important;
168+
width: 120px !important;
173169
}
174170

175171
.ideainput {

tests/functional/ideas_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public function test_new_idea()
4444
$this->assertContains($this->lang('IDEAS'), $crawler->filter('#nav-breadcrumbs')->text());
4545
$this->assertContains($idea['title'], $crawler->filter('h2')->text());
4646
$this->assertContains($idea['message'], $crawler->filter('.content')->text());
47-
$this->assertContains('1', $crawler->filter('.rating > .minivoteup')->text());
48-
$this->assertContains('0', $crawler->filter('.rating > .minivotedown')->text());
47+
$this->assertContains('1', $crawler->filter('.rating > .vote-up')->text());
48+
$this->assertContains('0', $crawler->filter('.rating > .vote-down')->text());
4949
}
5050

5151
/**

tests/ui/ideas_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public function test_js_actions()
5050
$this->assertEquals('block', $votes->getCSSValue('display'));
5151

5252
// test voting
53-
$votedown = $this->find_element('className', 'minivotedown');
53+
$votedown = $this->find_element('className', 'vote-down');
5454
$this->assertEquals('0', $votedown->getText());
5555
$votedown->click();
5656
$this->waitForAjax();
57-
$this->assertEquals('1', $this->find_element('className', 'minivotedown')->getText());
57+
$this->assertEquals('1', $this->find_element('className', 'vote-down')->getText());
5858

5959
// test changing the status
6060
$this->assertEquals('New', $this->find_element('className', 'status-badge')->getText());

0 commit comments

Comments
 (0)