This commit is contained in:
j 2013-02-12 16:27:30 +05:30
parent 62f4de2a5e
commit 8763fdef67
3 changed files with 4 additions and 5 deletions

View file

@ -86,12 +86,12 @@ def index(request):
})
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)
edit = edit and item.editable(request.user)
editable = item.editable(request.user)
context = RequestContext(request, {
'item': item,
'edit': json.dumps(edit)
'editable': json.dumps(editable)
})
return render_to_response('item.html', context)

View file

@ -33,7 +33,7 @@ limitations under the License.
<script type="text/javascript">
var DEFAULT_URL = '{{item.get_absolute_pdf_url}}';
var videoOverlay = {{item.get_overlay|safe}};
var edit = {{edit}};
var editable = {{editable}};
</script>
<script type="text/javascript" src="/static/videoOverlay.js"></script>
<script type="text/javascript" src="/static/viewer.js"></script>

View file

@ -32,7 +32,6 @@ urlpatterns += patterns('item.views',
(r'^add$', 'add'),
(r'^([A-Z0-9].*)/$', 'item'),
(r'^([A-Z0-9].*)/chunk$', 'chunk'),
(r'^([A-Z0-9].*)/edit$', 'item', {'edit': True}),
(r'^([A-Z0-9].*)/(.+.pdf)$', 'pdf'),
(r'^([A-Z0-9].*)$', 'item'),
)