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
27081410
Commit
27081410
authored
Apr 19, 2016
by
Jesse Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Adding background image for xseries certificates on dashboard side bar panel"
parent
adcf4a98
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
8 additions
and
216 deletions
+8
-216
lms/djangoapps/learner_dashboard/tests/test_programs.py
+1
-60
lms/djangoapps/learner_dashboard/views.py
+2
-3
lms/static/images/xseries-certificate-visual.png
+0
-0
lms/static/js/learner_dashboard/views/certificate_view.js
+0
-31
lms/static/js/learner_dashboard/views/sidebar_view.js
+0
-6
lms/static/js/spec/learner_dashboard/certificate_view_spec.js
+0
-65
lms/static/js/spec/learner_dashboard/sidebar_view_spec.js
+2
-15
lms/static/js/spec/main.js
+1
-2
lms/static/sass/_build-lms-v1.scss
+0
-1
lms/static/sass/_xseries_certificates.scss
+0
-17
lms/static/sass/views/_program-list.scss
+0
-5
lms/templates/learner_dashboard/certificate.underscore
+0
-7
lms/templates/learner_dashboard/programs.html
+1
-3
lms/templates/learner_dashboard/sidebar.underscore
+1
-1
No files found.
lms/djangoapps/learner_dashboard/tests/test_programs.py
View file @
27081410
...
...
@@ -14,8 +14,6 @@ from edx_oauth2_provider.tests.factories import ClientFactory
from
opaque_keys.edx
import
locator
from
provider.constants
import
CONFIDENTIAL
from
openedx.core.djangoapps.credentials.models
import
CredentialsApiConfig
from
openedx.core.djangoapps.credentials.tests.mixins
import
CredentialsDataMixin
,
CredentialsApiConfigMixin
from
openedx.core.djangoapps.programs.tests.mixins
import
(
ProgramsApiConfigMixin
,
ProgramsDataMixin
)
...
...
@@ -31,9 +29,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
class
TestProgramListing
(
ModuleStoreTestCase
,
ProgramsApiConfigMixin
,
ProgramsDataMixin
,
CredentialsDataMixin
,
CredentialsApiConfigMixin
):
ProgramsDataMixin
):
"""
Unit tests for getting the list of programs enrolled by a logged in user
...
...
@@ -45,7 +41,6 @@ class TestProgramListing(
Add a student
"""
super
(
TestProgramListing
,
self
)
.
setUp
()
ClientFactory
(
name
=
CredentialsApiConfig
.
OAUTH2_CLIENT_NAME
,
client_type
=
CONFIDENTIAL
)
ClientFactory
(
name
=
ProgramsApiConfig
.
OAUTH2_CLIENT_NAME
,
client_type
=
CONFIDENTIAL
)
self
.
student
=
UserFactory
()
self
.
create_programs_config
(
xseries_ad_enabled
=
True
,
program_listing_enabled
=
True
)
...
...
@@ -144,57 +139,3 @@ class TestProgramListing(
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertIsInstance
(
response
,
HttpResponseRedirect
)
self
.
assertIn
(
'login'
,
response
.
url
)
# pylint: disable=no-member
def
_expected_credetials_data
(
self
):
""" Dry method for getting expected credentials."""
return
[
{
"display_name"
:
"Test Program A"
,
"credential_url"
:
"http://credentials.edx.org/credentials/dummy-uuid-1/"
},
{
"display_name"
:
"Test Program B"
,
"credential_url"
:
"http://credentials.edx.org/credentials/dummy-uuid-2/"
}
]
@httpretty.activate
def
test_get_xseries_certificates_with_data
(
self
):
self
.
create_programs_config
(
program_listing_enabled
=
True
)
self
.
create_credentials_config
(
is_learner_issuance_enabled
=
True
)
self
.
client
.
login
(
username
=
self
.
student
.
username
,
password
=
self
.
PASSWORD
)
# mock programs and credentials apis
self
.
mock_programs_api
()
self
.
mock_credentials_api
(
self
.
student
,
data
=
self
.
CREDENTIALS_API_RESPONSE
,
reset_url
=
False
)
response
=
self
.
client
.
get
(
reverse
(
"program_listing_view"
))
self
.
assertEqual
(
response
.
status_code
,
200
)
for
certificate
in
self
.
_expected_credetials_data
():
self
.
assertIn
(
certificate
[
'display_name'
],
response
.
content
)
self
.
assertIn
(
certificate
[
'credential_url'
],
response
.
content
)
self
.
assertIn
(
'images/xseries-certificate-visual.png'
,
response
.
content
)
@httpretty.activate
def
test_get_xseries_certificates_without_data
(
self
):
self
.
create_programs_config
(
program_listing_enabled
=
True
)
self
.
create_credentials_config
(
is_learner_issuance_enabled
=
True
)
self
.
client
.
login
(
username
=
self
.
student
.
username
,
password
=
self
.
PASSWORD
)
# mock programs and credentials apis
self
.
mock_programs_api
()
self
.
mock_credentials_api
(
self
.
student
,
data
=
{
"results"
:
[]},
reset_url
=
False
)
response
=
self
.
client
.
get
(
reverse
(
"program_listing_view"
))
self
.
assertEqual
(
response
.
status_code
,
200
)
for
certificate
in
self
.
_expected_credetials_data
():
self
.
assertNotIn
(
certificate
[
'display_name'
],
response
.
content
)
self
.
assertNotIn
(
certificate
[
'credential_url'
],
response
.
content
)
lms/djangoapps/learner_dashboard/views.py
View file @
27081410
...
...
@@ -9,7 +9,7 @@ from django.http import Http404
from
edxmako.shortcuts
import
render_to_response
from
openedx.core.djangoapps.programs.utils
import
get_engaged_programs
from
openedx.core.djangoapps.programs.models
import
ProgramsApiConfig
from
student.views
import
get_course_enrollments
,
_get_xseries_credentials
from
student.views
import
get_course_enrollments
@login_required
...
...
@@ -35,6 +35,5 @@ def view_programs(request):
'programs'
:
programs
,
'xseries_url'
:
marketing_root
if
ProgramsApiConfig
.
current
()
.
show_xseries_ad
else
None
,
'nav_hidden'
:
True
,
'show_program_listing'
:
show_program_listing
,
'credentials'
:
_get_xseries_credentials
(
request
.
user
)
'show_program_listing'
:
show_program_listing
})
lms/static/images/xseries-certificate-visual.png
deleted
100644 → 0
View file @
adcf4a98
14 KB
lms/static/js/learner_dashboard/views/certificate_view.js
deleted
100644 → 0
View file @
adcf4a98
;(
function
(
define
)
{
'use strict'
;
define
([
'backbone'
,
'jquery'
,
'underscore'
,
'gettext'
,
'text!../../../templates/learner_dashboard/certificate.underscore'
],
function
(
Backbone
,
$
,
_
,
gettext
,
certificateTpl
)
{
return
Backbone
.
View
.
extend
({
el
:
'.certificates-list'
,
tpl
:
_
.
template
(
certificateTpl
),
initialize
:
function
(
data
)
{
this
.
context
=
data
.
context
;
this
.
render
();
},
render
:
function
()
{
if
(
this
.
context
.
certificatesData
.
length
>
0
)
{
this
.
$el
.
html
(
this
.
tpl
(
this
.
context
));
}
}
});
}
);
}).
call
(
this
,
define
||
RequireJS
.
define
);
lms/static/js/learner_dashboard/views/sidebar_view.js
View file @
27081410
...
...
@@ -6,7 +6,6 @@
'underscore'
,
'gettext'
,
'js/learner_dashboard/views/explore_new_programs_view'
,
'js/learner_dashboard/views/certificate_view'
,
'text!../../../templates/learner_dashboard/sidebar.underscore'
],
function
(
...
...
@@ -15,7 +14,6 @@
_
,
gettext
,
NewProgramsView
,
CertificateView
,
sidebarTpl
)
{
return
Backbone
.
View
.
extend
({
...
...
@@ -36,10 +34,6 @@
this
.
newProgramsView
=
new
NewProgramsView
({
context
:
this
.
context
});
this
.
newCertificateView
=
new
CertificateView
({
context
:
this
.
context
});
}
});
}
...
...
lms/static/js/spec/learner_dashboard/certificate_view_spec.js
deleted
100644 → 0
View file @
adcf4a98
define
([
'backbone'
,
'jquery'
,
'js/learner_dashboard/views/certificate_view'
],
function
(
Backbone
,
$
,
CertificateView
)
{
'use strict'
;
describe
(
'Certificate View'
,
function
()
{
var
view
=
null
,
data
=
{
context
:
{
certificatesData
:
[
{
"display_name"
:
"Testing"
,
"credential_url"
:
"https://credentials.stage.edx.org/credentials/dummy-uuid-1/"
},
{
"display_name"
:
"Testing2"
,
"credential_url"
:
"https://credentials.stage.edx.org/credentials/dummy-uuid-2/"
}
],
xseriesImage
:
"/images/testing.png"
}
};
beforeEach
(
function
()
{
setFixtures
(
'<div class="certificates-list"></div>'
);
view
=
new
CertificateView
(
data
);
view
.
render
();
});
afterEach
(
function
()
{
view
.
remove
();
});
it
(
'should exist'
,
function
()
{
expect
(
view
).
toBeDefined
();
});
it
(
'should load the certificates based on passed in certificates list'
,
function
()
{
var
$certificates
=
view
.
$el
.
find
(
'.certificate-box'
);
expect
(
$certificates
.
length
).
toBe
(
2
);
$certificates
.
each
(
function
(
index
,
el
){
expect
(
$
(
el
).
html
().
trim
()).
toEqual
(
data
.
context
.
certificatesData
[
index
].
display_name
);
expect
(
$
(
el
).
attr
(
'href'
)).
toEqual
(
data
.
context
.
certificatesData
[
index
].
credential_url
);
});
expect
(
view
.
$el
.
find
(
'.title'
).
html
().
trim
()).
toEqual
(
'XSeries Program Certificates:'
);
expect
(
view
.
$el
.
find
(
'img'
).
attr
(
'src'
)).
toEqual
(
'/images/testing.png'
);
});
it
(
'should display no certificate box if certificates list is empty'
,
function
()
{
var
$certificate
;
view
.
remove
();
setFixtures
(
'<div class="certificates-list"></div>'
);
view
=
new
CertificateView
({
context
:
{
certificatesData
:
[]}
});
view
.
render
();
$certificate
=
view
.
$el
.
find
(
'.certificate-box'
);
expect
(
$certificate
.
length
).
toBe
(
0
);
});
});
}
);
lms/static/js/spec/learner_dashboard/sidebar_view_spec.js
View file @
27081410
...
...
@@ -10,14 +10,7 @@ define([
describe
(
'Sidebar View'
,
function
()
{
var
view
=
null
,
context
=
{
xseriesUrl
:
'http://www.edx.org/xseries'
,
certificatesData
:
[
{
"display_name"
:
"Testing"
,
"credential_url"
:
"https://credentials.stage.edx.org/credentials/dummy-uuid-1/"
}
],
xseriesImage
:
'/image/test.png'
xseriesUrl
:
'http://www.edx.org/xseries'
};
beforeEach
(
function
()
{
...
...
@@ -45,23 +38,17 @@ define([
expect
(
$sidebar
.
find
(
'.program-advertise .ad-link a'
).
attr
(
'href'
)).
toEqual
(
context
.
xseriesUrl
);
});
it
(
'should load the certificates based on passed in certificates list'
,
function
()
{
expect
(
view
.
$
(
'.certificate-box'
).
length
).
toBe
(
1
);
});
it
(
'should not load the xseries advertising if no xseriesUrl passed in'
,
function
(){
var
$ad
;
view
.
remove
();
view
=
new
SidebarView
({
el
:
'.sidebar'
,
context
:
{
certificatesData
:
[]
}
context
:
{}
});
view
.
render
();
$ad
=
view
.
$el
.
find
(
'.program-advertise'
);
expect
(
$ad
.
length
).
toBe
(
0
);
expect
(
view
.
$
(
'.certificate-box'
).
length
).
toBe
(
0
);
});
});
}
);
lms/static/js/spec/main.js
View file @
27081410
...
...
@@ -754,8 +754,7 @@
'lms/include/js/spec/markdown_editor_spec.js'
,
'lms/include/js/spec/learner_dashboard/collection_list_view_spec.js'
,
'lms/include/js/spec/learner_dashboard/sidebar_view_spec.js'
,
'lms/include/js/spec/learner_dashboard/program_card_view_spec.js'
,
'lms/include/js/spec/learner_dashboard/certificate_view_spec.js'
'lms/include/js/spec/learner_dashboard/program_card_view_spec.js'
]);
}).
call
(
this
,
requirejs
,
define
);
lms/static/sass/_build-lms-v1.scss
View file @
27081410
...
...
@@ -59,7 +59,6 @@
@import
"views/financial-assistance"
;
@import
'views/bookmarks'
;
@import
'course/auto-cert'
;
@import
'xseries_certificates'
;
@import
'views/program-list'
;
@import
'views/api-access'
;
...
...
lms/static/sass/_xseries_certificates.scss
deleted
100644 → 0
View file @
adcf4a98
@mixin
xseries-certificate-container
{
border
:
1px
solid
$gray-l3
;
box-sizing
:
border-box
;
padding
:
$baseline
;
background
:
$gray-l6
;
margin-top
:
$baseline
;
.title
{
@extend
%t-title6
;
@extend
%t-weight3
;
margin-bottom
:
$baseline
;
color
:
$gray
;
}
.certificate-box
{
padding-top
:
$baseline
;
display
:
block
;
}
}
lms/static/sass/views/_program-list.scss
View file @
27081410
...
...
@@ -19,11 +19,6 @@ $pl-button-color: #0079bc;
.sidebar
{
@include
outer-container
;
@include
span-columns
(
12
);
float
:
right
!
important
;
margin-bottom
:
$baseline
;
.certificate-container
{
@include
xseries-certificate-container
();
}
.program-advertise
{
padding
:
$baseline
;
background-color
:
$body-bg
;
...
...
lms/templates/learner_dashboard/certificate.underscore
deleted
100644 → 0
View file @
adcf4a98
<div class="certificate-container">
<p class="title"><%- gettext('XSeries Program Certificates') %>:</p>
<img src="<%- xseriesImage %>" alt="">
<% _.each(certificatesData, function(certificate){ %>
<a class="certificate-box" href="<%- gettext(certificate.credential_url) %>"><%- gettext(certificate.display_name) %></a>
<% }); %>
</div>
lms/templates/learner_dashboard/programs.html
View file @
27081410
...
...
@@ -12,9 +12,7 @@ from openedx.core.djangolib.js_utils import (
<
%
static:require_module
module_name=
"js/learner_dashboard/program_list_factory"
class_name=
"ProgramListFactory"
>
ProgramListFactory({
programsData: ${programs | n, dump_js_escaped_json},
certificatesData: ${credentials | n, dump_js_escaped_json},
xseriesUrl: '${xseries_url | n, js_escaped_string}',
xseriesImage: '${static.url('images/xseries-certificate-visual.png')}'
xseriesUrl: '${xseries_url | n, js_escaped_string}'
});
</
%
static:require
_module
>
</
%
block>
...
...
lms/templates/learner_dashboard/sidebar.underscore
View file @
27081410
<div class="program-advertise"></div>
<div class="certificate
s-list
"></div>
<div class="certificate
-container
"></div>
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