forked from grid-synergy/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in features/LMA-551 (pull request grid-synergy#4)
Implemented Reviews Tab on lms Approved-by: Oksana Slusarenko
- Loading branch information
Showing
16 changed files
with
619 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.apps import AppConfig | ||
from edx_django_utils.plugins import PluginSettings, PluginURLs | ||
from openedx.core.constants import COURSE_ID_PATTERN | ||
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType | ||
|
||
|
||
class ReviewsConfig(AppConfig): | ||
name = 'lms.djangoapps.reviews' | ||
plugin_app = { | ||
PluginURLs.CONFIG: { | ||
ProjectType.LMS: { | ||
PluginURLs.NAMESPACE: u'', | ||
PluginURLs.REGEX: u'^courses/{}/reviews/'.format(COURSE_ID_PATTERN), | ||
PluginURLs.RELATIVE_PATH: u'urls', | ||
} | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
Definition of the course review feature. | ||
""" | ||
|
||
from django.utils.translation import ugettext_noop | ||
from lms.djangoapps.courseware.tabs import EnrolledTab | ||
from xmodule.tabs import TabFragmentViewMixin | ||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview | ||
|
||
|
||
class ReviewsTab(TabFragmentViewMixin, EnrolledTab): | ||
""" | ||
The representation of the course reviews view type. | ||
""" | ||
name = "reviews" | ||
tab_id = "reviews" | ||
|
||
type = "reviews" | ||
title = ugettext_noop("Reviews") | ||
body_class = "reviews-tab" | ||
is_hideable = False | ||
is_default = True | ||
fragment_view_name = 'lms.djangoapps.reviews.views.ReviewsTabFragmentView' | ||
|
||
@classmethod | ||
def is_enabled(cls, course, user=None): | ||
"""Returns true if the reviews feature is enabled in the course. | ||
Args: | ||
course (CourseDescriptor): the course using the feature | ||
user (User): the user interacting with the course | ||
""" | ||
if not super(ReviewsTab, cls).is_enabled(course, user=user): | ||
return False | ||
|
||
course = CourseOverview.get_from_id(course.id) | ||
return course.allow_review |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
.rateit { | ||
position: relative; | ||
-webkit-user-select: none; | ||
-khtml-user-select: none; | ||
-moz-user-select: none; | ||
-o-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
-webkit-touch-callout: none; | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.rateit .rateit-range { | ||
position: relative; | ||
display: -moz-inline-box; | ||
display: inline-block; | ||
background: url(star.gif); | ||
height: 16px; | ||
outline: none; | ||
} | ||
|
||
.rateit .rateit-range * { | ||
display: block; | ||
} | ||
|
||
/* for IE 6 */ | ||
* html .rateit, * html .rateit .rateit-range { | ||
display: inline; | ||
} | ||
|
||
/* for IE 7 */ | ||
* + html .rateit, * + html .rateit .rateit-range { | ||
display: inline; | ||
} | ||
|
||
.rateit .rateit-hover, .rateit .rateit-selected { | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
width: 0; | ||
} | ||
|
||
.rateit .rateit-hover-rtl, .rateit .rateit-selected-rtl { | ||
left: auto; | ||
right: 0; | ||
} | ||
|
||
.rateit .rateit-hover { | ||
background: url(star.gif) left -32px; | ||
color: rgb(239, 197, 41); | ||
} | ||
|
||
.rateit .rateit-hover-rtl { | ||
background-position: right -32px; | ||
} | ||
|
||
.rateit .rateit-selected { | ||
background: url(star.gif) left -16px; | ||
color: rgb(191,66,66); | ||
} | ||
|
||
.rateit .rateit-selected-rtl { | ||
background-position: right -16px; | ||
} | ||
|
||
.rateit .rateit-preset { | ||
background: url(star.gif) left -48px; | ||
color: orange; | ||
} | ||
|
||
.rateit .rateit-preset-rtl { | ||
background: url(star.gif) right -48px; | ||
} | ||
|
||
.rateit button.rateit-reset { | ||
background: url(delete.gif) 0 0; | ||
width: 16px; | ||
height: 16px; | ||
display: -moz-inline-box; | ||
display: inline-block; | ||
float: left; | ||
outline: none; | ||
border: none; | ||
padding: 0; | ||
margin-right: 10px; | ||
} | ||
|
||
.rateit .rateit-reset span { | ||
display: none; | ||
} | ||
|
||
.rateit button.rateit-reset:hover, .rateit button.rateit-reset:focus { | ||
background-position: 0 -16px; | ||
} | ||
|
||
|
||
.rateit-font { | ||
font-size: 24px; | ||
line-height: 1em; | ||
} | ||
|
||
.rateit-font .rateit-range { | ||
background: none; | ||
height: auto; | ||
} | ||
|
||
.rateit-font .rateit-empty { | ||
color: #ccc; | ||
} | ||
|
||
.rateit-font .rateit-range > div, .rateit-font .rateit-range > span { | ||
background: none; | ||
overflow: hidden; | ||
cursor: default; | ||
} | ||
|
||
.rateit.rateit-font .rateit-reset { | ||
font-size: inherit; | ||
background: none; | ||
width: 16px; | ||
height: 16px; | ||
margin-top: 0.2em; | ||
background: gray; | ||
border-radius: 50%; | ||
position: relative; | ||
} | ||
|
||
.rateit.rateit-font .rateit-reset span { | ||
display: block; | ||
font-weight: bold; | ||
color: #fff; | ||
height: 2px; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
position: absolute; | ||
background: #fff; | ||
width: 70%; | ||
} | ||
|
||
|
||
.rateit.rateit-font .rateit-reset:hover, .rateit.rateit-font button.rateit-reset:focus { | ||
background: #e6574b; /* Old browsers */ | ||
background: radial-gradient(ellipse at center, #e6574b 55%,#f6836b 77%,#f9d3cc 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ | ||
background-position: 0 0; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
lms/djangoapps/reviews/static/reviews/js/jquery.rateit.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
(function ($) { | ||
$(document).ready(function () { | ||
$('#submitRating').on("click", function() { | ||
let rating = $('#rateit-range-3').attr('aria-valuenow'); | ||
let review = $('#feedbackTextarea').val(); | ||
let url = $('#submitRating').data('url'); | ||
$.ajax({ | ||
type: "POST", | ||
url: url, | ||
data: { | ||
"rating": rating, | ||
"review": review, | ||
}, | ||
success: function (){ | ||
location.reload(); | ||
} | ||
}); | ||
}) | ||
}); | ||
}(jQuery)); |
Oops, something went wrong.