Commit ba7a8ebe by swdanielli

change deendorse to remove

parent 33445405
......@@ -106,13 +106,13 @@ class RecommenderXBlock(XBlock):
# Usage: the same as default_recommendations
deendorsed_recommendations = Dict(
help="Dict of deendorsed resources", default={}, scope=Scope.user_state_summary
help="Dict of removed resources", default={}, scope=Scope.user_state_summary
)
# A list of recommendations deendorsed by course staff, it is a JSON object
# A list of recommendations removed by course staff, it is a JSON object
# aggregated across many users of a single block.
# Usage: the same as default_recommendations plus
# deendorsed_recommendations[index]['reason'] = (String) the reason why
# course staff deendorse this resource
# course staff remove this resource
endorsed_recommendation_ids = List(
help="List of endorsed resources' ID", default=[], scope=Scope.user_state_summary
......@@ -489,7 +489,7 @@ class RecommenderXBlock(XBlock):
# check url for de-endorsed resources
if resource_id in self.deendorsed_recommendations:
result['error'] = ('The resource you are attempting to ' +
'provide has been de-endorsed by staff, ' +
'provide has been removed by staff, ' +
'because: ' + self.deendorsed_recommendations[resource_id]['reason'])
for field in self.resource_content_fields:
result['dup_' + field] = self.deendorsed_recommendations[resource_id][field]
......@@ -556,7 +556,7 @@ class RecommenderXBlock(XBlock):
# check url for de-endorsed resources
if edited_resource_id in self.deendorsed_recommendations:
result['error'] = ('The resource you are attempting to ' +
'provide has been de-endorsed by ' +
'provide has been removed by ' +
'staff, because: ' +
self.deendorsed_recommendations[edited_resource_id]['reason'])
for field in self.resource_content_fields:
......@@ -678,21 +678,21 @@ class RecommenderXBlock(XBlock):
@XBlock.json_handler
def deendorse_resource(self, data, _suffix=''):
"""
Deendorse an entry of resource.
Remove an entry of resource.
Args:
data: dict in JSON format
data['id']: the ID of the resouce to be deendorsed
data['reason']: the reason why the resouce was deendorsed
data['id']: the ID of the resouce to be removed
data['reason']: the reason why the resouce was removed
Returns:
result: dict in JSON format
result['Success']: the boolean indicator for whether the deendorsement is complete
result['error']: the error message generated when the deendorsement fails
result['recommendation']: (Dict) the deendorsed resource
result['recommendation']['reason']: the reason why the resouce was deendorsed
result['Success']: the boolean indicator for whether the removal is complete
result['error']: the error message generated when the removal fails
result['recommendation']: (Dict) the removed resource
result['recommendation']['reason']: the reason why the resouce was removed
"""
if not self.get_user_is_staff():
msg = 'Deendorse resource without permission'
msg = 'Remove resource without permission'
return self.error_handler(msg, 'deendorse_resource')
resource_id = stem_url(data['id'])
......
......@@ -248,7 +248,7 @@ input[type="button"]:not([DISABLED]){
color: white;
}
.resourceRankingForDeendorsementButton:not(deendorsementMode):before { content: 'Ordinary '; }
.resourceRankingForDeendorsementButton.deendorsementMode:before { content: 'De-endorsement '; }
.resourceRankingForDeendorsementButton.deendorsementMode:before { content: 'Removal '; }
.endorse:not(.endorsed) { color: #DFD3D3; display: none; }
.endorse.endorsed { color: rgb(69, 194, 10); }
......@@ -259,7 +259,6 @@ input[type="button"]:not([DISABLED]){
.plusIcon:before { content: '+'; }
.nextPageIcon:before { content: '►'; }
.previousPageIcon:before { content: '◄'; }
/*.morePageIcon:before { content: '...'; }*/
.highlightActivePageNumber { background-color: #948f8f; }
.my-custom-theme {
......
......@@ -159,7 +159,7 @@
name="deendorseRationale"
placeholder="Reason for why this resource should be removed"/>
</label>
<input type="button" value="Deendorse resource" class="deendorseResource"/>
<input type="button" value="Remove resource" class="deendorseResource"/>
</div>
<div class="endorsePage" style='display: none;' aria-hidden="true">
<div class="modifyPageTitle"></div>
......
......@@ -41,7 +41,7 @@ var tooltipsCatsText = {
'.recommenderVoteArrowDown': '<span>Downvote if the resource is not helpful</span>',
'.recommenderVoteScore': '<span>Votes</span>', //
'a': '<span>Resource title</span>', // TODO: I would suggest making the description be the tooltip.
'.deendorse': '<span>Deendorse this resource and give the reason why you do that</span>',
'.deendorse': '<span>Remove this resource and give the reason why you do that</span>',
'.previewingImg': '<span>Preview image (typically, a screenshot)</span>',
'.inTitle': '<span>Give a short (1-3 sentence) summary of the resource; ideally, this should be concise, but give enough detail to let students know whether this resources is useful to them</span>',
'.inUrl': '<span>Cut-and-paste the URL of the resource.</span>',
......@@ -59,7 +59,7 @@ var tooltipsCatsText = {
'.hideShow.resourceListExpanded': '<span>Hide the recommendations list</span>',
'.checkIcon': '<span>Check the icon to endorse this resource</span>',
'.checkIcon.endorsed': '<span>This resource is endorsed by staff</span>',
'.resourceRankingForDeendorsementButton': '<span>Click to view resources for de-endorsement</span>',
'.resourceRankingForDeendorsementButton': '<span>Click to view resources for removal</span>',
'.resourceRankingForDeendorsementButton.deendorsementMode': '<span>Click to view resources in ordinary decreasing-vote order</span>'
};
......@@ -106,7 +106,7 @@ var headerText = {
'.editResourcePage': 'Edit existing resource',
'.flagResourcePage': 'Flag Resource',
'.endorsePage': 'Endorse Resource',
'.deendorsePage': 'Deendorse Resource'
'.deendorsePage': 'Remove Resource'
};
var modifyPageTitle = {
......@@ -115,7 +115,7 @@ var modifyPageTitle = {
'.editResourcePage': 'Edit the resource and make it more helpful for other students with this problem. Please do not give the answer directly.',
'.flagResourcePage': 'Why would you like to flag this resource? The staff will review all flagged resources, and remove inappropriate ones (spam, incorrect, abusive, etc.). Giving a clear reason will help us do this efficiently.',
'.endorsePage': 'Endorse this resource and give the reason why you do that.',
'.deendorsePage': 'Deendorse this resource and give the reason why you do that.'
'.deendorsePage': 'Remove this resource and give the reason why you do that.'
};
var writeDatabaseEnum = {
......@@ -164,7 +164,7 @@ var ariaLabelText = {
'endorsedResource': 'endorsed resource',
'endorseResource': 'endorse resource',
'undoEndorseResource': 'undo endorse resource',
'deendorseResource': 'deendorse resource'
'deendorseResource': 'remove resource'
}
var toggleVoteFlag = 'toggle';
......@@ -208,7 +208,7 @@ var loggerStatus = {
'endorse': 'Endorse resource',
'unendorse': 'Unendorse resource'
},
'deendorseResource': {'deendorseResource': 'Deendorse resource'},
'deendorseResource': {'deendorseResource': 'Remove resource'},
'hover': {'hover': 'Hovering resource'},
'clickResource': {'clickResource': 'A resource was clicked'},
'backToView': {'backToView': 'Back to resource list mode'}
......
......@@ -188,7 +188,7 @@ function RecommenderXBlock(runtime, element, init_data) {
/**
* Hide resource list and show pages for modifying
* (i.e., add/edit/endorse/deendorse/import/flag) recommender
* (i.e., add/edit/endorse/remove/import/flag) recommender
* @param {string} page The string indicating the page we are going to show.
*/
function showModifyingPage(page) {
......@@ -298,7 +298,7 @@ function RecommenderXBlock(runtime, element, init_data) {
}
/**
* Interrupt a submission (resource add, edit, flag, endorse, deendorse,
* Interrupt a submission (resource add, edit, flag, endorse, remove,
* import, etc.). First, log the typed information for an incomplete
* submission. Second, go back from pages for resource addition, edit,
* flag, etc. to pages for viewing resources.
......@@ -893,9 +893,9 @@ function RecommenderXBlock(runtime, element, init_data) {
}
/**
* This is a function restricted to course staff, where we can toggle between viewing mode for deendorsement and
* This is a function restricted to course staff, where we can toggle between viewing mode for removal and
* ordinary browsing
* Deendorsement mode:
* Removal mode:
* Re-rank resources by first showing flagged resource, then non-flagged one in the order of increasing votes
* Show the reason and accumulated flagged result
* Ordinary mode:
......@@ -1036,13 +1036,13 @@ function RecommenderXBlock(runtime, element, init_data) {
/**
* Bind the event for deendorsing a resource and submitting the
* reason why the staff think the resource should be deendorsed.
* reason why the staff think the resource should be removed.
* @param {element} ele The recommenderResource element the event will be bound to.
*/
function bindResourceDeendorseEvent(ele) {
if ($('.deendorse', ele).length == 0) { $('.recommenderEdit', ele).append(deendorseIcon); }
/* Enter deendorse mode */
/* Enter removal mode */
$('.deendorse', ele).click(function() {
showModifyingPage('.deendorsePage')
$('.deendorsePage', element).find('input[type="text"]').val('');
......@@ -1050,7 +1050,7 @@ function RecommenderXBlock(runtime, element, init_data) {
data['id'] = $(this).parent().parent().find('.recommenderEntryId').text();
$('.deendorseResource', element).unbind();
/* Deendorse a selected resource */
/* Remove a selected resource */
$('.deendorseResource', element).click(function() {
data['reason'] = $('.deendorseReason', element).val();
Logger.log('mit.recommender.deendorseResource', generateLog(loggerStatus['deendorseResource']['deendorseResource'], data));
......@@ -1062,7 +1062,7 @@ function RecommenderXBlock(runtime, element, init_data) {
if (result['Success']) {
var deletedResourceIdx = findResourceDiv(result['id']);
$('.recommenderResource:eq(' + deletedResourceIdx.toString() + ')', element).remove();
/* Deendorse (remove) last resource */
/* Remove last resource */
if ($('.recommenderResource', element).length == deletedResourceIdx) { deletedResourceIdx--; }
CURRENT_PAGE = Math.ceil((deletedResourceIdx + 1)/ENTRIES_PER_PAGE);
paginationItem();
......@@ -1116,7 +1116,7 @@ function RecommenderXBlock(runtime, element, init_data) {
}
/**
* Set the text of endorse/deendorse buttons for accessibility, these
* Set the text of endorse/remove buttons for accessibility, these
* buttons are limited to staff.
* @param {element} ele The recommenderResource element the buttons attached to.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment