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
3a6b2c30
Commit
3a6b2c30
authored
Jul 29, 2015
by
Zia Fazal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide certificate configuration activate/deactivate and delete buttons
added line break
parent
601f1602
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
6 deletions
+35
-6
cms/djangoapps/contentstore/views/certificates.py
+1
-0
cms/static/js/certificates/spec/views/certificate_details_spec.js
+8
-0
cms/static/js/certificates/spec/views/certificate_editor_spec.js
+8
-2
cms/static/js/certificates/spec/views/certificate_preview_spec.js
+11
-3
cms/templates/certificates.html
+2
-0
cms/templates/js/certificate-details.underscore
+2
-0
cms/templates/js/certificate-editor.underscore
+1
-1
cms/templates/js/certificate-web-preview.underscore
+2
-0
No files found.
cms/djangoapps/contentstore/views/certificates.py
View file @
3a6b2c30
...
@@ -375,6 +375,7 @@ def certificates_list_handler(request, course_key_string):
...
@@ -375,6 +375,7 @@ def certificates_list_handler(request, course_key_string):
'course_modes'
:
course_modes
,
'course_modes'
:
course_modes
,
'certificate_web_view_url'
:
certificate_web_view_url
,
'certificate_web_view_url'
:
certificate_web_view_url
,
'is_active'
:
is_active
,
'is_active'
:
is_active
,
'is_global_staff'
:
GlobalStaff
()
.
has_user
(
request
.
user
),
'certificate_activation_handler_url'
:
activation_handler_url
'certificate_activation_handler_url'
:
activation_handler_url
})
})
elif
"application/json"
in
request
.
META
.
get
(
'HTTP_ACCEPT'
):
elif
"application/json"
in
request
.
META
.
get
(
'HTTP_ACCEPT'
):
...
...
cms/static/js/certificates/spec/views/certificate_details_spec.js
View file @
3a6b2c30
...
@@ -55,10 +55,12 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
...
@@ -55,10 +55,12 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
course_modes
:
[
'honor'
,
'test'
],
course_modes
:
[
'honor'
,
'test'
],
certificate_web_view_url
:
'/users/1/courses/orgX/009/2016'
certificate_web_view_url
:
'/users/1/courses/orgX/009/2016'
});
});
window
.
CMS
.
User
=
{
isGlobalStaff
:
true
};
});
});
afterEach
(
function
()
{
afterEach
(
function
()
{
delete
window
.
course
;
delete
window
.
course
;
delete
window
.
CMS
.
User
;
});
});
describe
(
'Certificate Details Spec:'
,
function
()
{
describe
(
'Certificate Details Spec:'
,
function
()
{
...
@@ -141,6 +143,12 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
...
@@ -141,6 +143,12 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
expect
(
this
.
view
.
$
(
'.action-delete .delete'
)).
toExist
();
expect
(
this
.
view
.
$
(
'.action-delete .delete'
)).
toExist
();
});
});
it
(
'should not present a Delete action if user is not global staff'
,
function
()
{
window
.
CMS
.
User
=
{
isGlobalStaff
:
false
};
appendSetFixtures
(
this
.
view
.
render
().
el
);
expect
(
this
.
view
.
$
(
'.action-delete .delete'
)).
not
.
toExist
();
});
it
(
'should prompt the user when when clicking the Delete button'
,
function
(){
it
(
'should prompt the user when when clicking the Delete button'
,
function
(){
expect
(
this
.
view
.
$
(
'.action-delete .delete'
)).
toExist
();
expect
(
this
.
view
.
$
(
'.action-delete .delete'
)).
toExist
();
this
.
view
.
$
(
'.action-delete .delete'
).
click
();
this
.
view
.
$
(
'.action-delete .delete'
).
click
();
...
...
cms/static/js/certificates/spec/views/certificate_editor_spec.js
View file @
3a6b2c30
...
@@ -86,12 +86,12 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
...
@@ -86,12 +86,12 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
num
:
'course_num'
,
num
:
'course_num'
,
revision
:
'course_rev'
revision
:
'course_rev'
});
});
window
.
CMS
.
User
=
{
isGlobalStaff
:
true
};
});
});
afterEach
(
function
()
{
afterEach
(
function
()
{
delete
window
.
course
;
delete
window
.
course
;
delete
window
.
CMS
.
User
;
});
});
describe
(
'Certificate editor view'
,
function
()
{
describe
(
'Certificate editor view'
,
function
()
{
...
@@ -151,6 +151,12 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
...
@@ -151,6 +151,12 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
expect
(
this
.
view
.
$
(
'.action-delete'
)).
toExist
();
expect
(
this
.
view
.
$
(
'.action-delete'
)).
toExist
();
});
});
it
(
'should not have delete button is user is not global staff'
,
function
()
{
window
.
CMS
.
User
=
{
isGlobalStaff
:
false
};
appendSetFixtures
(
this
.
view
.
render
().
el
);
expect
(
this
.
view
.
$
(
'.action-delete'
)).
not
.
toExist
();
});
it
(
'should save properly'
,
function
()
{
it
(
'should save properly'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
var
requests
=
AjaxHelpers
.
requests
(
this
),
notificationSpy
=
ViewHelpers
.
createNotificationSpy
();
notificationSpy
=
ViewHelpers
.
createNotificationSpy
();
...
...
cms/static/js/certificates/spec/views/certificate_preview_spec.js
View file @
3a6b2c30
...
@@ -18,7 +18,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
...
@@ -18,7 +18,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
preview_certificate
:
'.preview-certificate-link'
preview_certificate
:
'.preview-certificate-link'
};
};
beforeEach
(
function
()
{
beforeEach
(
function
()
{
window
.
course
=
new
Course
({
window
.
course
=
new
Course
({
id
:
'5'
,
id
:
'5'
,
name
:
'Course Name'
,
name
:
'Course Name'
,
...
@@ -27,11 +27,13 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
...
@@ -27,11 +27,13 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
num
:
'course_num'
,
num
:
'course_num'
,
revision
:
'course_rev'
revision
:
'course_rev'
});
});
window
.
CMS
.
User
=
{
isGlobalStaff
:
true
};
});
});
afterEach
(
function
()
{
afterEach
(
function
()
{
delete
window
.
course
;
delete
window
.
course
;
});
delete
window
.
CMS
.
User
;
});
describe
(
'Certificate Web Preview Spec:'
,
function
()
{
describe
(
'Certificate Web Preview Spec:'
,
function
()
{
...
@@ -85,6 +87,12 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
...
@@ -85,6 +87,12 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
expect
(
this
.
view
.
toggleCertificateActivation
).
toHaveBeenCalled
();
expect
(
this
.
view
.
toggleCertificateActivation
).
toHaveBeenCalled
();
});
});
it
(
'toggle certificate activation button should not be present if user is not global staff'
,
function
()
{
window
.
CMS
.
User
=
{
isGlobalStaff
:
false
};
appendSetFixtures
(
this
.
view
.
render
().
el
);
expect
(
this
.
view
.
$
(
SELECTORS
.
activate_certificate
)).
not
.
toExist
();
});
it
(
'certificate deactivation works fine'
,
function
()
{
it
(
'certificate deactivation works fine'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
var
requests
=
AjaxHelpers
.
requests
(
this
),
notificationSpy
=
ViewHelpers
.
createNotificationSpy
();
notificationSpy
=
ViewHelpers
.
createNotificationSpy
();
...
...
cms/templates/certificates.html
View file @
3a6b2c30
...
@@ -22,7 +22,9 @@ from django.utils.translation import ugettext as _
...
@@ -22,7 +22,9 @@ from django.utils.translation import ugettext as _
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
window
.
CMS
=
window
.
CMS
||
{};
window
.
CMS
=
window
.
CMS
||
{};
CMS
.
URL
=
CMS
.
URL
||
{};
CMS
.
URL
=
CMS
.
URL
||
{};
CMS
.
User
=
CMS
.
User
||
{};
CMS
.
URL
.
UPLOAD_ASSET
=
'${upload_asset_url}'
;
CMS
.
URL
.
UPLOAD_ASSET
=
'${upload_asset_url}'
;
CMS
.
User
.
isGlobalStaff
=
'${is_global_staff}'
==
'True'
?
true
:
false
;
</script>
</script>
</
%
block>
</
%
block>
...
...
cms/templates/js/certificate-details.underscore
View file @
3a6b2c30
...
@@ -33,8 +33,10 @@
...
@@ -33,8 +33,10 @@
<li class="action action-edit">
<li class="action action-edit">
<button class="edit"><i class="icon fa fa-pencil" aria-hidden="true"></i> <%= gettext("Edit") %></button>
<button class="edit"><i class="icon fa fa-pencil" aria-hidden="true"></i> <%= gettext("Edit") %></button>
</li>
</li>
<% if (CMS.User.isGlobalStaff) { %>
<li class="action action-delete wrapper-delete-button" data-tooltip="<%= gettext('Delete') %>">
<li class="action action-delete wrapper-delete-button" data-tooltip="<%= gettext('Delete') %>">
<button class="delete action-icon"><i class="icon fa fa-trash-o" aria-hidden="true"></i><span><%= gettext("Delete") %></span></button>
<button class="delete action-icon"><i class="icon fa fa-trash-o" aria-hidden="true"></i><span><%= gettext("Delete") %></span></button>
</li>
</li>
<% } %>
</ul>
</ul>
</div>
</div>
cms/templates/js/certificate-editor.underscore
View file @
3a6b2c30
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<div class="actions">
<div class="actions">
<button class="action action-primary" type="submit"><% if (isNew) { print(gettext("Create")) } else { print(gettext("Save")) } %></button>
<button class="action action-primary" type="submit"><% if (isNew) { print(gettext("Create")) } else { print(gettext("Save")) } %></button>
<button class="action action-secondary action-cancel"><%= gettext("Cancel") %></button>
<button class="action action-secondary action-cancel"><%= gettext("Cancel") %></button>
<% if (!isNew) { %>
<% if (!isNew
&& CMS.User.isGlobalStaff
) { %>
<span class="wrapper-delete-button">
<span class="wrapper-delete-button">
<a class="button action-delete delete" href="#"><%= gettext("Delete") %></a>
<a class="button action-delete delete" href="#"><%= gettext("Delete") %></a>
</span>
</span>
...
...
cms/templates/js/certificate-web-preview.underscore
View file @
3a6b2c30
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<a href=<%= certificate_web_view_url %> class="button preview-certificate-link" target="_blank">
<a href=<%= certificate_web_view_url %> class="button preview-certificate-link" target="_blank">
<%= gettext("Preview Certificate") %>
<%= gettext("Preview Certificate") %>
</a>
</a>
<% if (CMS.User.isGlobalStaff) { %>
<button class="button activate-cert">
<button class="button activate-cert">
<span>
<span>
<% if(!is_active) { %>
<% if(!is_active) { %>
...
@@ -15,3 +16,4 @@
...
@@ -15,3 +16,4 @@
<%= gettext("Deactivate") %></span>
<%= gettext("Deactivate") %></span>
<% } %>
<% } %>
</button>
</button>
<% } %>
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