Commit a206d84f by swdanielli

Merge pull request #30 from pmitros/danielli/code_review

add intro.css and replace deendorse with remove
parents 9fe1365b 15929164
......@@ -114,9 +114,9 @@ class RecommenderXBlock(XBlock):
# A list of recommendations removed by course staff. This is used to filter out
# cheats, give-aways, spam, etc.
# Usage: the same as default_recommendations plus
# deendorsed_recommendations[index]['reason'] = (String) the reason why
# removed_recommendations[index]['reason'] = (String) the reason why
# course staff remove this resource
deendorsed_recommendations = Dict(
removed_recommendations = Dict(
help="Dict of removed resources", default={}, scope=Scope.user_state_summary
)
......@@ -270,13 +270,13 @@ class RecommenderXBlock(XBlock):
raise JsonHandlerError(409, result['error'])
# check url for removed resources
if resource_id in self.deendorsed_recommendations:
if resource_id in self.removed_recommendations:
result['error'] = ('The resource you are attempting to ' +
'provide has been disallowed by the staff. ' +
'Reason: ' + self.deendorsed_recommendations[resource_id]['reason'])
'Reason: ' + self.removed_recommendations[resource_id]['reason'])
for field in self.resource_content_fields:
result['dup_' + field] = self.deendorsed_recommendations[resource_id][field]
result['dup_id'] = self.deendorsed_recommendations[resource_id]['id']
result['dup_' + field] = self.removed_recommendations[resource_id][field]
result['dup_id'] = self.removed_recommendations[resource_id]['id']
tracker.emit(event_name, result)
raise JsonHandlerError(405, result['error'])
......@@ -645,7 +645,7 @@ class RecommenderXBlock(XBlock):
return result
@XBlock.json_handler
def deendorse_resource(self, data, _suffix=''):
def remove_resource(self, data, _suffix=''):
"""
Remove an entry of resource. This removes it from the student view, and prevents students from being able to add it back.
......@@ -661,22 +661,22 @@ class RecommenderXBlock(XBlock):
"""
if not self.get_user_is_staff():
msg = "You don't have the permission to remove this resource"
self.error_handler(msg, 'deendorse_resource')
self.error_handler(msg, 'remove_resource')
resource_id = stem_url(data['id'])
if resource_id not in self.recommendations:
msg = 'The selected resource does not exist'
self.error_handler(msg, 'deendorse_resource', resource_id)
self.error_handler(msg, 'remove_resource', resource_id)
result = {}
result['id'] = resource_id
deendorsed_resource = deepcopy(self.recommendations[resource_id])
removed_resource = deepcopy(self.recommendations[resource_id])
del self.recommendations[resource_id]
deendorsed_resource['reason'] = data['reason']
self.deendorsed_recommendations[resource_id] = deendorsed_resource
result['recommendation'] = deendorsed_resource
tracker.emit('deendorse_resource', result)
removed_resource['reason'] = data['reason']
self.removed_recommendations[resource_id] = removed_resource
result['recommendation'] = removed_resource
tracker.emit('remove_resource', result)
return result
@XBlock.json_handler
......@@ -690,7 +690,7 @@ class RecommenderXBlock(XBlock):
result = {}
result['export'] = {
'recommendations': self.recommendations,
'deendorsed_recommendations': self.deendorsed_recommendations,
'removed_recommendations': self.removed_recommendations,
'endorsed_recommendation_ids': self.endorsed_recommendation_ids,
'endorsed_recommendation_reasons': self.endorsed_recommendation_reasons,
}
......@@ -720,9 +720,9 @@ class RecommenderXBlock(XBlock):
self.endorsed_recommendation_reasons = data['endorsed_recommendation_reasons']
self.endorsed_recommendation_ids = data['endorsed_recommendation_ids']
if 'deendorsed_recommendations' in data:
self.deendorsed_recommendations = data_structure_upgrade(data['deendorsed_recommendations'])
data['deendorsed_recommendations'] = self.deendorsed_recommendations
if 'removed_recommendations' in data:
self.removed_recommendations = data_structure_upgrade(data['removed_recommendations'])
data['removed_recommendations'] = self.removed_recommendations
self.recommendations = data_structure_upgrade(data['recommendations'])
data['recommendations'] = self.recommendations
......@@ -749,7 +749,7 @@ class RecommenderXBlock(XBlock):
}
for _, flagged_accum_resource_map in self.flagged_accum_resources.iteritems():
for resource_id in flagged_accum_resource_map:
if resource_id in self.deendorsed_recommendations:
if resource_id in self.removed_recommendations:
continue
if resource_id not in result['flagged_resources']:
result['flagged_resources'][resource_id] = []
......@@ -820,7 +820,7 @@ class RecommenderXBlock(XBlock):
frag.add_javascript_url('//cdnjs.cloudflare.com/ajax/libs/intro.js/0.5.0/intro.min.js')
frag.add_css(self.resource_string("static/css/tooltipster.css"))
frag.add_css(self.resource_string("static/css/recommender.css"))
frag.add_css_url("http://usablica.github.io/intro.js/introjs.css")
frag.add_css(self.resource_string("static/css/introjs.css"))
frag.add_javascript(self.resource_string("static/js/src/jquery.tooltipster.min.js"))
frag.add_javascript(self.resource_string("static/js/src/cats.js"))
frag.add_javascript(self.resource_string("static/js/src/recommender.js"))
......
.introjs-overlay {
position: absolute;
z-index: 999999;
background-color: #000;
opacity: 0;
background: -moz-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);
background: -webkit-gradient(radial,center center,0px,center center,100%,color-stop(0%,rgba(0,0,0,0.4)),color-stop(100%,rgba(0,0,0,0.9)));
background: -webkit-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);
background: -o-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);
background: -ms-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);
background: radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#66000000',endColorstr='#e6000000',GradientType=1);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.introjs-fixParent {
z-index: auto !important;
opacity: 1.0 !important;
position: absolute !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
-o-transform: none !important;
transform: none !important;
}
.introjs-showElement,
tr.introjs-showElement > td,
tr.introjs-showElement > th {
z-index: 9999999 !important;
}
.introjs-disableInteraction {
z-index: 99999999 !important;
position: absolute;
}
.introjs-relativePosition,
tr.introjs-showElement > td,
tr.introjs-showElement > th {
position: relative;
}
.introjs-helperLayer {
position: absolute;
z-index: 9999998;
background-color: #FFF;
background-color: rgba(255,255,255,.9);
border: 1px solid #777;
border: 1px solid rgba(0,0,0,.5);
border-radius: 4px;
box-shadow: 0 2px 15px rgba(0,0,0,.4);
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.introjs-tooltipReferenceLayer {
position: absolute;
z-index: 10000000;
background-color: transparent;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.introjs-helperLayer *,
.introjs-helperLayer *:before,
.introjs-helperLayer *:after {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
-ms-box-sizing: content-box;
-o-box-sizing: content-box;
box-sizing: content-box;
}
.introjs-helperNumberLayer {
position: absolute;
top: -16px;
left: -16px;
z-index: 9999999999 !important;
padding: 2px;
font-family: Arial, verdana, tahoma;
font-size: 13px;
font-weight: bold;
color: white;
text-align: center;
text-shadow: 1px 1px 1px rgba(0,0,0,.3);
background: #ff3019; /* Old browsers */
background: -webkit-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* Chrome10+,Safari5.1+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ff3019), color-stop(100%, #cf0404)); /* Chrome,Safari4+ */
background: -moz-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* FF3.6+ */
background: -ms-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* IE10+ */
background: -o-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* Opera 11.10+ */
background: linear-gradient(to bottom, #ff3019 0%, #cf0404 100%); /* W3C */
width: 20px;
height:20px;
line-height: 20px;
border: 3px solid white;
border-radius: 50%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019', endColorstr='#cf0404', GradientType=0); /* IE6-9 */
filter: progid:DXImageTransform.Microsoft.Shadow(direction=135, strength=2, color=ff0000); /* IE10 text shadows */
box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
.introjs-arrow {
border: 5px solid white;
content:'';
position: absolute;
}
.introjs-arrow.top {
top: -10px;
border-top-color:transparent;
border-right-color:transparent;
border-bottom-color:white;
border-left-color:transparent;
}
.introjs-arrow.top-right {
top: -10px;
right: 10px;
border-top-color:transparent;
border-right-color:transparent;
border-bottom-color:white;
border-left-color:transparent;
}
.introjs-arrow.top-middle {
top: -10px;
left: 50%;
margin-left: -5px;
border-top-color:transparent;
border-right-color:transparent;
border-bottom-color:white;
border-left-color:transparent;
}
.introjs-arrow.right {
right: -10px;
top: 10px;
border-top-color:transparent;
border-right-color:transparent;
border-bottom-color:transparent;
border-left-color:white;
}
.introjs-arrow.right-bottom {
bottom:10px;
right: -10px;
border-top-color:transparent;
border-right-color:transparent;
border-bottom-color:transparent;
border-left-color:white;
}
.introjs-arrow.bottom {
bottom: -10px;
border-top-color:white;
border-right-color:transparent;
border-bottom-color:transparent;
border-left-color:transparent;
}
.introjs-arrow.left {
left: -10px;
top: 10px;
border-top-color:transparent;
border-right-color:white;
border-bottom-color:transparent;
border-left-color:transparent;
}
.introjs-arrow.left-bottom {
left: -10px;
bottom:10px;
border-top-color:transparent;
border-right-color:white;
border-bottom-color:transparent;
border-left-color:transparent;
}
.introjs-tooltip {
position: absolute;
padding: 10px;
background-color: white;
min-width: 200px;
max-width: 300px;
border-radius: 3px;
box-shadow: 0 1px 10px rgba(0,0,0,.4);
-webkit-transition: opacity 0.1s ease-out;
-moz-transition: opacity 0.1s ease-out;
-ms-transition: opacity 0.1s ease-out;
-o-transition: opacity 0.1s ease-out;
transition: opacity 0.1s ease-out;
}
.introjs-tooltipbuttons {
text-align: right;
white-space: nowrap;
}
/*
Buttons style by http://nicolasgallagher.com/lab/css3-github-buttons/
Changed by Afshin Mehrabani
*/
.introjs-button {
position: relative;
overflow: visible;
display: inline-block;
padding: 0.3em 0.8em;
border: 1px solid #d4d4d4;
margin: 0;
text-decoration: none;
text-shadow: 1px 1px 0 #fff;
font: 11px/normal sans-serif;
color: #333;
white-space: nowrap;
cursor: pointer;
outline: none;
background-color: #ececec;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f4f4f4), to(#ececec));
background-image: -moz-linear-gradient(#f4f4f4, #ececec);
background-image: -o-linear-gradient(#f4f4f4, #ececec);
background-image: linear-gradient(#f4f4f4, #ececec);
-webkit-background-clip: padding;
-moz-background-clip: padding;
-o-background-clip: padding-box;
/*background-clip: padding-box;*/ /* commented out due to Opera 11.10 bug */
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
border-radius: 0.2em;
/* IE hacks */
zoom: 1;
*display: inline;
margin-top: 10px;
}
.introjs-button:hover {
border-color: #bcbcbc;
text-decoration: none;
box-shadow: 0px 1px 1px #e3e3e3;
}
.introjs-button:focus,
.introjs-button:active {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ececec), to(#f4f4f4));
background-image: -moz-linear-gradient(#ececec, #f4f4f4);
background-image: -o-linear-gradient(#ececec, #f4f4f4);
background-image: linear-gradient(#ececec, #f4f4f4);
}
/* overrides extra padding on button elements in Firefox */
.introjs-button::-moz-focus-inner {
padding: 0;
border: 0;
}
.introjs-skipbutton {
margin-right: 5px;
color: #7a7a7a;
}
.introjs-prevbutton {
-webkit-border-radius: 0.2em 0 0 0.2em;
-moz-border-radius: 0.2em 0 0 0.2em;
border-radius: 0.2em 0 0 0.2em;
border-right: none;
}
.introjs-nextbutton {
-webkit-border-radius: 0 0.2em 0.2em 0;
-moz-border-radius: 0 0.2em 0.2em 0;
border-radius: 0 0.2em 0.2em 0;
}
.introjs-disabled, .introjs-disabled:hover, .introjs-disabled:focus {
color: #9a9a9a;
border-color: #d4d4d4;
box-shadow: none;
cursor: default;
background-color: #f4f4f4;
background-image: none;
text-decoration: none;
}
.introjs-bullets {
text-align: center;
}
.introjs-bullets ul {
clear: both;
margin: 15px auto 0;
padding: 0;
display: inline-block;
}
.introjs-bullets ul li {
list-style: none;
float: left;
margin: 0 2px;
}
.introjs-bullets ul li a {
display: block;
width: 6px;
height: 6px;
background: #ccc;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
text-decoration: none;
}
.introjs-bullets ul li a:hover {
background: #999;
}
.introjs-bullets ul li a.active {
background: #999;
}
.introjs-progress {
overflow: hidden;
height: 10px;
margin: 10px 0 5px 0;
border-radius: 4px;
background-color: #ecf0f1
}
.introjs-progressbar {
float: left;
width: 0%;
height: 100%;
font-size: 10px;
line-height: 10px;
text-align: center;
background-color: #08c;
}
.introjsFloatingElement {
position: absolute;
height: 0;
width: 0;
left: 50%;
top: 50%;
}
......@@ -2,13 +2,13 @@
.clearFix {clear: both; height: 0.5em;}
.hideShow {
-webkit-transition:background-color 0.2s; color 0.2s;
transition:background-color 0.2s; color 0.2s;
-webkit-transition:background-color 0.2s; color 0.2s;
transition:background-color 0.2s; color 0.2s;
}
.hideShow:hover {
background-color:rgb(137, 183, 205);
color:rgb(11, 11, 11);
background-color:rgb(137, 183, 205);
color:rgb(11, 11, 11);
}
.recommenderBlock .count {
......@@ -22,21 +22,21 @@
.hidden { display: none; }
.recommenderBlock {
width : 100%;
width : 100%;
}
.recommenderContent {
width: 700px;
float: left;
width: 700px;
float: left;
}
.hideShow, .recommenderModifyTitleContainer {
font-size: 14px;
padding-top: 0.5em;
padding-left: 0.5em;
background-color: rgba(0,0,0,0.05);
height: 28px;
color: #948f8f;
font-size: 14px;
padding-top: 0.5em;
padding-left: 0.5em;
background-color: rgba(0,0,0,0.05);
height: 28px;
color: #948f8f;
}
.hideShow.resourceListExpanded { cursor: n-resize; }
......@@ -47,183 +47,183 @@
.notExpanded {display: block; }
.recommenderRow {
height: 380px;
height: 380px;
}
.recommenderTitle {
flex-grow : 1;
max-height: 65px;
overflow-y: auto;
flex-grow : 1;
max-height: 65px;
overflow-y: auto;
}
.question {
width:700px;
width:700px;
}
.recommenderResource {
padding-top : 0.25em;
padding-bottom : 0.25em;
float:left;
width : 100%;
padding-top : 0.25em;
padding-bottom : 0.25em;
float:left;
width : 100%;
}
.expanded, .notExpanded {
float: right;
width: 50px;
float: right;
width: 50px;
}
.recommenderModify {
width: 700px;
width: 700px;
}
.descriptionImg {
max-height: 1020px;
max-width: 700px;
margin-top: 2em;
max-height: 1020px;
max-width: 700px;
margin-top: 2em;
}
.descriptionText {
max-height: 200px;
overflow: auto;
padding: 0.5em;
background-color: rgba(0,0,0,0.05);
color: #948f8f;
max-height: 200px;
overflow: auto;
padding: 0.5em;
background-color: rgba(0,0,0,0.05);
color: #948f8f;
}
.showProblematicReasons {
max-height: 200px;
overflow: auto;
padding: 0.5em;
background-color: #B4053D;
color: white;
max-height: 200px;
overflow: auto;
padding: 0.5em;
background-color: #B4053D;
color: white;
}
.showEndorsedReasons {
max-height: 200px;
overflow: auto;
padding: 0.5em;
background-color: rgb(69, 194, 10);
color: white;
max-height: 200px;
overflow: auto;
padding: 0.5em;
background-color: rgb(69, 194, 10);
color: white;
}
.showProblematicReasons:before { content: 'This resource was flagged problematic by students.'; }
.showEndorsedReasons:before { content: 'This resource was endorsed by course staff.'; }
.previewingImg {
margin-top: 1em;
max-width: 700px;
max-height: 600px;
margin-top: 1em;
max-width: 700px;
max-height: 600px;
}
.recommenderVoteArrowDown {
width: 100%;
margin-left:auto;
margin-right:auto;
text-align:center;
width: 100%;
margin-left:auto;
margin-right:auto;
text-align:center;
}
.recommenderVoteArrowDown:before {
content: '↓';
font-weight: bold;
content: '↓';
font-weight: bold;
}
.recommenderVoteArrowUp {
width: 100%;
margin-left:auto;
margin-right:auto;
text-align:center;
width: 100%;
margin-left:auto;
margin-right:auto;
text-align:center;
}
.recommenderVoteArrowUp:before {
content: '↑';
font-weight: bold;
content: '↑';
font-weight: bold;
}
.recommenderVoteScore {
width: 100%;
text-align: center;
cursor: default;
font-weight: 900;
width: 100%;
text-align: center;
cursor: default;
font-weight: 900;
}
.recommenderRecommendations { display: table; }
.pagination {
display: table;
margin: 0 auto;
display: table;
margin: 0 auto;
}
.recommenderBlurb {
display:inline-block;
vertical-align: middle;
width:570px;
overflow:hidden;
word-wrap: break-word;
display:inline-block;
vertical-align: middle;
width:570px;
overflow:hidden;
word-wrap: break-word;
}
.recommenderEndorse { width:15px; display: inline-block; }
.recommenderEntryId, .recommenderDescriptionImg, .recommenderProblematicReason, .recommenderDescriptionText, .recommenderEndorseReason {
display:none;
display:none;
}
.recommenderVoteBox {
display:inline-block;
vertical-align: middle;
width:50px;
display:inline-block;
vertical-align: middle;
width:50px;
}
.recommenderEdit {
display:inline-block;
vertical-align: top;
float: right;
width: 40px;
display:inline-block;
vertical-align: top;
float: right;
width: 40px;
}
.redTxt { color: #B4053D; }
.redTxt:before { content: '*'; }
.recommenderVoteArrowDown, .recommenderVoteArrowUp, .resourceEditButton, .flagResource, .deendorse, .resourceImportButton, .resourceExportButton, .resourceAddButton, .paginationPageNumber, .backToViewButton, .endorse, .resourceRankingForDeendorsementButton { cursor: pointer; }
.recommenderVoteArrowDown, .recommenderVoteArrowUp, .resourceEditButton, .flagResource, .remove, .resourceImportButton, .resourceExportButton, .resourceAddButton, .paginationPageNumber, .backToViewButton, .endorse, .resourceRankingForRemovalButton { cursor: pointer; }
.resourceAddButton, .resourceExportButton, .resourceImportButton { float: right; background-color: rgba(0,0,0,0.05); padding: 0.3em 1em 0.3em 1em; margin-left: 1em;}
.resourceEditButton { float: left; }
.modifyPageTitle { margin-bottom: 1em; }
.editResourcePage, .addResourcePage, .flagResourcePage {
padding-left: 1em;
padding-left: 1em;
}
.paginationPageNumber {
display:table-cell;
text-align:center;
vertical-align: middle;
width:25px;
display:table-cell;
text-align:center;
vertical-align: middle;
width:25px;
}
.backToViewButton { color: #1d9dd9; float: left; }
.flagReasonSubmit, .editSubmit, .addSubmit, .deendorseResource, .endorseResource, .importResourceSubmit { margin-top: 0.5em; }
.flagReasonSubmit, .editSubmit, .addSubmit, .removeResource, .endorseResource, .importResourceSubmit { margin-top: 0.5em; }
input[type="button"]:not([DISABLED]){
background-image: linear-gradient(#1d9dd9,#1d9dd9);
color: white;
background-image: linear-gradient(#1d9dd9,#1d9dd9);
color: white;
}
.endorseResource, .deendorseResource { margin-top: 0.5em; float:left; }
.endorseResource, .removeResource { margin-top: 0.5em; float:left; }
.ui-icon.problematic {
background-image: url(http://download.jqueryui.com/themeroller/images/ui-icons_ff0000_256x240.png);
}
.inTitle, .editTitle, .inDescriptionText, .editDescriptionText {
height: 75px;
margin-left: 0.5em;
width:100%;
height: 75px;
margin-left: 0.5em;
width:100%;
}
.inUrl, .editUrl, .flagReason, .deendorseReason, .endorseReason, .awsAccessKey, .awsSecretKey, .bucketName, .uploadedFileUrl, .uploadedFileDir {
height: 25px;
margin-left: 0.5em;
width:100%;
.inUrl, .editUrl, .flagReason, .removeReason, .endorseReason, .awsAccessKey, .awsSecretKey, .bucketName, .uploadedFileUrl, .uploadedFileDir {
height: 25px;
margin-left: 0.5em;
width:100%;
}
.resourceHovered { background-color:#F2F7FA }
......@@ -235,20 +235,20 @@ input[type="button"]:not([DISABLED]){
.recommenderVoteScore.downvoting, .recommenderVoteArrowDown.downvoting { color: #B4053D; }
.recommenderVoteArrowUp.downvoting, .recommenderVoteArrowDown.upvoting { color: #948f8f; }
.resourceRankingForDeendorsementButton:not(.deendorsementMode) {
float: right;
background-color: rgba(0,0,0,0.05);
padding: 0.3em 1em 0.3em 1em;
color: black;
.resourceRankingForRemovalButton:not(.removeMode) {
float: right;
background-color: rgba(0,0,0,0.05);
padding: 0.3em 1em 0.3em 1em;
color: black;
}
.resourceRankingForDeendorsementButton.deendorsementMode {
float: right;
background-color: #B4053D;
padding: 0.3em 1em 0.3em 1em;
color: white;
.resourceRankingForRemovalButton.removeMode {
float: right;
background-color: #B4053D;
padding: 0.3em 1em 0.3em 1em;
color: white;
}
.resourceRankingForDeendorsementButton:not(deendorsementMode):before { content: 'Ordinary '; }
.resourceRankingForDeendorsementButton.deendorsementMode:before { content: 'Removal '; }
.resourceRankingForRemovalButton:not(removeMode):before { content: 'Ordinary '; }
.resourceRankingForRemovalButton.removeMode:before { content: 'Removal '; }
.endorse:not(.endorsed) { color: #DFD3D3; display: none; }
.endorse.endorsed { color: rgb(69, 194, 10); }
......
......@@ -116,7 +116,7 @@
<div class="resourceExportButton" role="button" tabindex="0">Download resources</div>
<div class="resourceImportButton" role="button" style='display: none;' tabindex="0" aria-hidden="true">Upload resources</div>
<div class="clearFix"></div>
<div class="resourceRankingForDeendorsementButton" style='display: none;' aria-hidden="true">mode</div>
<div class="resourceRankingForRemovalButton" style='display: none;' aria-hidden="true">mode</div>
<div class="clearFix"></div>
<div class='pagination'></div>
<div class="recommenderDescription">
......@@ -150,16 +150,16 @@
<input type="button" value="Upload resources" class="importResourceSubmit" disabled/>
</form>
</div>
<div class="deendorsePage" style='display: none;' aria-hidden="true">
<div class="removePage" style='display: none;' aria-hidden="true">
<div class="modifyPageTitle"></div>
<label>Reason&nbsp;
<input type="text"
aria-label='Provide reason for why this resource should be removed'
class="deendorseReason"
name="deendorseRationale"
class="removeReason"
name="removeRationale"
placeholder="Reason for why this resource should be removed"/>
</label>
<input type="button" value="Remove resource" class="deendorseResource"/>
<input type="button" value="Remove resource" class="removeResource"/>
</div>
<div class="endorsePage" style='display: none;' aria-hidden="true">
<div class="modifyPageTitle"></div>
......
......@@ -5,7 +5,7 @@ var tooltipsCatsPerResource = [
'.recommenderVoteScore',
'a',
'.flagResource',
'.deendorse',
'.remove',
'.checkIcon.endorsed'
];
......@@ -24,7 +24,7 @@ var tooltipsCats = [
'.uploadedFileDir',
'.deleteResource',
'.hideShow.resourceListExpanded',
'.resourceRankingForDeendorsementButton.deendorsementMode'
'.resourceRankingForRemovalButton.removeMode'
];
var tooltipsEditCats = [
......@@ -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>Remove this resource and give the reason why you do that</span>',
'.remove': '<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,8 +59,8 @@ 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 removal</span>',
'.resourceRankingForDeendorsementButton.deendorsementMode': '<span>Click to view resources in ordinary decreasing-vote order</span>'
'.resourceRankingForRemovalButton': '<span>Click to view resources for removal</span>',
'.resourceRankingForRemovalButton.removeMode': '<span>Click to view resources in ordinary decreasing-vote order</span>'
};
var uploadFileErrorText = {
......@@ -93,7 +93,7 @@ var headerText = {
'.editResourcePage': 'Edit existing resource',
'.flagResourcePage': 'Flag Resource',
'.endorsePage': 'Endorse Resource',
'.deendorsePage': 'Remove Resource'
'.removePage': 'Remove Resource'
};
var modifyPageTitle = {
......@@ -102,7 +102,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': 'Remove this resource and give the reason why you do that.'
'.removePage': 'Remove this resource and give the reason why you do that.'
};
var writeDatabaseEnum = {
......@@ -151,12 +151,12 @@ var ariaLabelText = {
'endorsedResource': 'endorsed resource',
'endorseResource': 'endorse resource',
'undoEndorseResource': 'undo endorse resource',
'deendorseResource': 'remove resource'
'removeResource': 'remove resource'
}
var toggleVoteFlag = 'toggle';
var endorseFlag = 'reason';
var deendorseIcon = '<span class="ui-icon ui-icon-gear deendorse"></span>';
var removeIcon = '<span class="ui-icon ui-icon-gear remove"></span>';
var loggerStatus = {
'hideShow': {
......@@ -195,7 +195,7 @@ var loggerStatus = {
'endorse': 'Endorse resource',
'unendorse': 'Unendorse resource'
},
'deendorseResource': {'deendorseResource': 'Remove resource'},
'removeResource': {'removeResource': 'Remove resource'},
'hover': {'hover': 'Hovering resource'},
'clickResource': {'clickResource': 'A resource was clicked'},
'backToView': {'backToView': 'Back to resource list mode'}
......
......@@ -13,7 +13,7 @@ function RecommenderXBlock(runtime, element, init_data) {
var exportResourceUrl = runtime.handlerUrl(element, 'export_resources');
var importResourceUrl = runtime.handlerUrl(element, 'import_resources');
var uploadScreenshotUrl = runtime.handlerUrl(element, 'upload_screenshot');
var deendorseResourceUrl = runtime.handlerUrl(element, 'deendorse_resource');
var removeResourceUrl = runtime.handlerUrl(element, 'remove_resource');
var endorseResourceUrl = runtime.handlerUrl(element, 'endorse_resource');
var accumFlaggedResourceUrl = runtime.handlerUrl(element, 'accum_flagged_resource');
......@@ -253,7 +253,7 @@ function RecommenderXBlock(runtime, element, init_data) {
'.flagResourcePage',
'.editResourcePage',
'.addResourcePage',
'.deendorsePage',
'.removePage',
'.endorsePage',
'.importResourcePage'
]
......@@ -296,7 +296,7 @@ function RecommenderXBlock(runtime, element, init_data) {
* flag, etc. to pages for viewing resources.
*/
function bindInterruptSubmissionEvent() {
var divs = $('.flagResourcePage, .editResourcePage, .addResourcePage, .deendorsePage, .endorsePage, .importResourcePage', element);
var divs = $('.flagResourcePage, .editResourcePage, .addResourcePage, .removePage, .endorsePage, .importResourcePage', element);
var activePage;
var logStudentInput = {};
......@@ -875,7 +875,7 @@ function RecommenderXBlock(runtime, element, init_data) {
*/
function bindStaffLimitedEvent() {
if (IS_USER_STAFF) {
if (!DISABLE_DEV_UX) { toggleDeendorseMode(); }
if (!DISABLE_DEV_UX) { toggleRemoveMode(); }
$('.recommenderResource', element).each(function(index, ele) {
bindStaffLimitedResourceDependentEvent(ele);
addResourceDependentTooltip(ele);
......@@ -893,12 +893,12 @@ function RecommenderXBlock(runtime, element, init_data) {
* Ordinary mode:
* Rank resources in the order of decreasing votes
*/
function toggleDeendorseMode() {
$('.resourceRankingForDeendorsementButton', element).show().attr('aria-hidden', 'false');
$('.resourceRankingForDeendorsementButton', element).click(function() {
$(this).toggleClass('deendorsementMode');
function toggleRemoveMode() {
$('.resourceRankingForRemovalButton', element).show().attr('aria-hidden', 'false');
$('.resourceRankingForRemovalButton', element).click(function() {
$(this).toggleClass('removeMode');
addTooltip();
if ($(this).hasClass('deendorsementMode')) {
if ($(this).hasClass('removeMode')) {
$.ajax({
type: "POST",
url: accumFlaggedResourceUrl,
......@@ -1014,7 +1014,7 @@ function RecommenderXBlock(runtime, element, init_data) {
var endorsedDiv = $('.recommenderResource:eq(' + endorsedResourceIdx.toString() + ')', element);
$('.endorse', endorsedDiv).toggleClass('endorsed').show().attr('aria-hidden', 'false');
addResourceDependentTooltip(endorsedDiv);
setEndorseDeendorseAriaParam(endorsedDiv);
setEndorseRemoveAriaParam(endorsedDiv);
if (endorseFlag in result) {
$('.recommenderEndorseReason', endorsedDiv).text(result['reason']);
backToView();
......@@ -1033,24 +1033,24 @@ function RecommenderXBlock(runtime, element, init_data) {
* 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); }
function bindResourceRemoveEvent(ele) {
if ($('.remove', ele).length === 0) { $('.recommenderEdit', ele).append(removeIcon); }
/* Enter removal mode */
$('.deendorse', ele).click(function() {
showModifyingPage('.deendorsePage')
$('.deendorsePage', element).find('input[type="text"]').val('');
$('.remove', ele).click(function() {
showModifyingPage('.removePage')
$('.removePage', element).find('input[type="text"]').val('');
var data = {};
data['id'] = $(this).parent().parent().find('.recommenderEntryId').text();
$('.deendorseResource', element).unbind();
$('.removeResource', element).unbind();
/* Remove a selected resource */
$('.deendorseResource', element).click(function() {
data['reason'] = $('.deendorseReason', element).val();
Logger.log('mit.recommender.deendorseResource', generateLog(loggerStatus['deendorseResource']['deendorseResource'], data));
$('.removeResource', element).click(function() {
data['reason'] = $('.removeReason', element).val();
Logger.log('mit.recommender.removeResource', generateLog(loggerStatus['removeResource']['removeResource'], data));
$.ajax({
type: "POST",
url: deendorseResourceUrl,
url: removeResourceUrl,
data: JSON.stringify(data),
success: function(result) {
var deletedResourceIdx = findResourceDiv(result['id']);
......@@ -1077,8 +1077,8 @@ function RecommenderXBlock(runtime, element, init_data) {
*/
function bindStaffLimitedResourceDependentEvent(ele) {
bindResourceEndorseEvent(ele);
bindResourceDeendorseEvent(ele);
setEndorseDeendorseAriaParam(ele);
bindResourceRemoveEvent(ele);
setEndorseRemoveAriaParam(ele);
}
/**
......@@ -1115,9 +1115,9 @@ function RecommenderXBlock(runtime, element, init_data) {
* buttons are limited to staff.
* @param {element} ele The recommenderResource element the buttons attached to.
*/
function setEndorseDeendorseAriaParam(ele) {
function setEndorseRemoveAriaParam(ele) {
$('.endorse', ele).attr('role', 'button').attr('tabindex', '0');
$('.deendorse', ele).attr('role', 'button').attr('tabindex', '0').attr('aria-label', ariaLabelText['deendorseResource']);;
$('.remove', ele).attr('role', 'button').attr('tabindex', '0').attr('aria-label', ariaLabelText['removeResource']);;
$('.endorse:not(.endorsed)', ele).attr('aria-label', ariaLabelText['endorseResource']);
$('.endorse.endorsed', ele).attr('aria-label', ariaLabelText['undoEndorseResource']);
}
......
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