Read-only users get "Details" instead of "Edit" button, remove "Save" option

This commit is contained in:
Braden MacDonald
2014-12-30 21:15:42 -08:00
committed by E. Kolpakov
parent d38e69c69a
commit 42ee0571e7
7 changed files with 39 additions and 34 deletions

View File

@@ -234,6 +234,7 @@ def xblock_view_handler(request, usage_key_string, view_name):
elif view_name in (PREVIEW_VIEWS + container_views):
is_pages_view = view_name == STUDENT_VIEW # Only the "Pages" view uses student view in Studio
can_edit = has_studio_write_access(request.user, usage_key.course_key)
# Determine the items to be shown as reorderable. Note that the view
# 'reorderable_container_child_preview' is only rendered for xblocks that
@@ -266,6 +267,7 @@ def xblock_view_handler(request, usage_key_string, view_name):
context = {
'is_pages_view': is_pages_view, # This setting disables the recursive wrapping of xblocks
'is_unit_page': is_unit(xblock),
'can_edit': can_edit,
'root_xblock': xblock if (view_name == 'container_preview') else None,
'reorderable_items': reorderable_items,
'paging': paging,

View File

@@ -226,6 +226,7 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False):
'content': frag.content,
'is_root': is_root,
'is_reorderable': is_reorderable,
'can_edit': context.get('can_edit', True),
}
html = render_to_string('studio_xblock_wrapper.html', template_context)
frag = wrap_fragment(frag, html)