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
8ed78a38
Commit
8ed78a38
authored
Jul 20, 2016
by
Brian Jacobel
Committed by
GitHub
Jul 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TNL-5011 (#13031)
Vote button is now disabled for yourself, but count is still visible
parent
92010f00
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 @
8ed78a38
...
@@ -107,10 +107,10 @@
...
@@ -107,10 +107,10 @@
},
},
can_vote
:
{
can_vote
:
{
enable
:
function
()
{
enable
:
function
()
{
return
this
.
$
(
".action-vote"
).
closest
(
".actions-item"
).
removeClass
(
"is-hidden"
);
this
.
$
(
'.action-vote'
).
closest
(
'.actions-item'
).
removeClass
(
'is-disabled'
);
},
},
disable
:
function
()
{
disable
:
function
()
{
return
this
.
$
(
".action-vote"
).
closest
(
".actions-item"
).
addClass
(
"is-hidden"
);
this
.
$
(
'.action-vote'
).
closest
(
'.actions-item'
).
addClass
(
'is-disabled'
);
}
}
}
}
};
};
...
@@ -415,17 +415,19 @@
...
@@ -415,17 +415,19 @@
updates
=
{
updates
=
{
upvoted_ids
:
(
is_voting
?
_
.
union
:
_
.
difference
)(
user
.
get
(
'upvoted_ids'
),
[
this
.
model
.
id
])
upvoted_ids
:
(
is_voting
?
_
.
union
:
_
.
difference
)(
user
.
get
(
'upvoted_ids'
),
[
this
.
model
.
id
])
};
};
return
DiscussionUtil
.
updateWithUndo
(
user
,
updates
,
{
if
(
!
$
(
event
.
target
.
closest
(
".actions-item"
)).
hasClass
(
'is-disabled'
))
{
url
:
url
,
return
DiscussionUtil
.
updateWithUndo
(
user
,
updates
,
{
type
:
"POST"
,
url
:
url
,
$elem
:
$
(
event
.
currentTarget
)
type
:
"POST"
,
},
gettext
(
"We had some trouble saving your vote. Please try again."
)).
done
(
function
()
{
$elem
:
$
(
event
.
currentTarget
)
if
(
is_voting
)
{
},
gettext
(
"We had some trouble saving your vote. Please try again."
)).
done
(
function
()
{
return
self
.
model
.
vote
();
if
(
is_voting
)
{
}
else
{
return
self
.
model
.
vote
();
return
self
.
model
.
unvote
();
}
else
{
}
return
self
.
model
.
unvote
();
});
}
});
}
};
};
DiscussionContentShowView
.
prototype
.
togglePin
=
function
(
event
)
{
DiscussionContentShowView
.
prototype
.
togglePin
=
function
(
event
)
{
...
...
common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
View file @
8ed78a38
...
@@ -474,7 +474,7 @@
...
@@ -474,7 +474,7 @@
});
});
it
(
"doesn't show voting button if can_vote ability is disabled"
,
function
()
{
it
(
"doesn't show voting button if can_vote ability is disabled"
,
function
()
{
this
.
view
.
render
();
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 @
8ed78a38
...
@@ -18,6 +18,28 @@
...
@@ -18,6 +18,28 @@
&
.is-hidden
{
&
.is-hidden
{
display
:
none
;
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
{
.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