editable
This commit is contained in:
parent
62f4de2a5e
commit
8763fdef67
3 changed files with 4 additions and 5 deletions
|
@ -86,12 +86,12 @@ def index(request):
|
||||||
})
|
})
|
||||||
return render_to_response('index.html', context)
|
return render_to_response('index.html', context)
|
||||||
|
|
||||||
def item(request, slug, edit=False):
|
def item(request, slug):
|
||||||
item = get_object_or_404(models.Item, slug=slug)
|
item = get_object_or_404(models.Item, slug=slug)
|
||||||
edit = edit and item.editable(request.user)
|
editable = item.editable(request.user)
|
||||||
context = RequestContext(request, {
|
context = RequestContext(request, {
|
||||||
'item': item,
|
'item': item,
|
||||||
'edit': json.dumps(edit)
|
'editable': json.dumps(editable)
|
||||||
})
|
})
|
||||||
return render_to_response('item.html', context)
|
return render_to_response('item.html', context)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ limitations under the License.
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DEFAULT_URL = '{{item.get_absolute_pdf_url}}';
|
var DEFAULT_URL = '{{item.get_absolute_pdf_url}}';
|
||||||
var videoOverlay = {{item.get_overlay|safe}};
|
var videoOverlay = {{item.get_overlay|safe}};
|
||||||
var edit = {{edit}};
|
var editable = {{editable}};
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/static/videoOverlay.js"></script>
|
<script type="text/javascript" src="/static/videoOverlay.js"></script>
|
||||||
<script type="text/javascript" src="/static/viewer.js"></script>
|
<script type="text/javascript" src="/static/viewer.js"></script>
|
||||||
|
|
|
@ -32,7 +32,6 @@ urlpatterns += patterns('item.views',
|
||||||
(r'^add$', 'add'),
|
(r'^add$', 'add'),
|
||||||
(r'^([A-Z0-9].*)/$', 'item'),
|
(r'^([A-Z0-9].*)/$', 'item'),
|
||||||
(r'^([A-Z0-9].*)/chunk$', 'chunk'),
|
(r'^([A-Z0-9].*)/chunk$', 'chunk'),
|
||||||
(r'^([A-Z0-9].*)/edit$', 'item', {'edit': True}),
|
|
||||||
(r'^([A-Z0-9].*)/(.+.pdf)$', 'pdf'),
|
(r'^([A-Z0-9].*)/(.+.pdf)$', 'pdf'),
|
||||||
(r'^([A-Z0-9].*)$', 'item'),
|
(r'^([A-Z0-9].*)$', 'item'),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue