Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c791ce62
Commit
c791ce62
authored
Jul 19, 2016
by
Brian Jacobel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vote button is now disabled for yourself, but count is still visible
parent
e6c88a24
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
14 deletions
+38
-14
common/static/common/js/discussion/views/discussion_content_view.js
+15
-13
common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
+1
-1
lms/static/sass/discussion/elements/_actions.scss
+22
-0
No files found.
common/static/common/js/discussion/views/discussion_content_view.js
View file @
c791ce62
...
...
@@ -107,10 +107,10 @@
},
can_vote
:
{
enable
:
function
()
{
return
this
.
$
(
".action-vote"
).
closest
(
".actions-item"
).
removeClass
(
"is-hidden"
);
this
.
$
(
'.action-vote'
).
closest
(
'.actions-item'
).
removeClass
(
'is-disabled'
);
},
disable
:
function
()
{
return
this
.
$
(
".action-vote"
).
closest
(
".actions-item"
).
addClass
(
"is-hidden"
);
this
.
$
(
'.action-vote'
).
closest
(
'.actions-item'
).
addClass
(
'is-disabled'
);
}
}
};
...
...
@@ -413,17 +413,19 @@
updates
=
{
upvoted_ids
:
(
is_voting
?
_
.
union
:
_
.
difference
)(
user
.
get
(
'upvoted_ids'
),
[
this
.
model
.
id
])
};
return
DiscussionUtil
.
updateWithUndo
(
user
,
updates
,
{
url
:
url
,
type
:
"POST"
,
$elem
:
$
(
event
.
currentTarget
)
},
gettext
(
"We had some trouble saving your vote. Please try again."
)).
done
(
function
()
{
if
(
is_voting
)
{
return
self
.
model
.
vote
();
}
else
{
return
self
.
model
.
unvote
();
}
});
if
(
!
$
(
event
.
target
.
closest
(
".actions-item"
)).
hasClass
(
'is-disabled'
))
{
return
DiscussionUtil
.
updateWithUndo
(
user
,
updates
,
{
url
:
url
,
type
:
"POST"
,
$elem
:
$
(
event
.
currentTarget
)
},
gettext
(
"We had some trouble saving your vote. Please try again."
)).
done
(
function
()
{
if
(
is_voting
)
{
return
self
.
model
.
vote
();
}
else
{
return
self
.
model
.
unvote
();
}
});
}
};
DiscussionContentShowView
.
prototype
.
togglePin
=
function
(
event
)
{
...
...
common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
View file @
c791ce62
...
...
@@ -474,7 +474,7 @@
});
it
(
"doesn't show voting button if can_vote ability is disabled"
,
function
()
{
this
.
view
.
render
();
return
expect
(
this
.
view
.
$el
.
find
(
".action-vote"
).
closest
(
".actions-item"
)).
toHaveClass
(
'is-
hidden
'
);
return
expect
(
this
.
view
.
$el
.
find
(
".action-vote"
).
closest
(
".actions-item"
)).
toHaveClass
(
'is-
disabled
'
);
});
});
});
...
...
lms/static/sass/discussion/elements/_actions.scss
View file @
c791ce62
...
...
@@ -18,6 +18,28 @@
&
.is-hidden
{
display
:
none
;
}
&
.is-disabled
{
a
{
pointer-events
:
none
;
.action-icon
{
display
:
none
;
}
.action-label
{
padding-right
:
0px
;
}
&
:hover
{
border-color
:
transparent
;
.action-label
{
color
:
$forum-color-active-text
;
}
}
}
}
}
.more-wrapper
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment