# HG changeset patch # User ymh # Date 1378300702 -7200 # Node ID 945b144d68c13f8b713efe78627f1290bf9c1967 # Parent f625ad551908c055de1f9924498537fb2fa27bc2 put context variables in a single object diff -r f625ad551908 -r 945b144d68c1 src/p4l/static/p4l/js/p4l.js --- a/src/p4l/static/p4l/js/p4l.js Wed Sep 04 15:01:50 2013 +0200 +++ b/src/p4l/static/p4l/js/p4l.js Wed Sep 04 15:18:22 2013 +0200 @@ -3,12 +3,12 @@ var app = angular.module("recordApp", ['ngResource']) -app.service("Api", function($resource) { - this.record = $resource(record_api_url); +app.service("Api", function($resource, context) { + this.record = $resource(context.urls.record_api); }); -app.controller("RecordCtrl", function($scope, Api){ - $scope.record = Api.record.get({recordId: record_id}); +app.controller("RecordCtrl", function($scope, Api, context){ + $scope.record = Api.record.get({recordId: context.record_id}); }); app.config(['$routeProvider', function($routeProvider) { diff -r f625ad551908 -r 945b144d68c1 src/p4l/templates/p4l/record_update_form.html --- a/src/p4l/templates/p4l/record_update_form.html Wed Sep 04 15:01:50 2013 +0200 +++ b/src/p4l/templates/p4l/record_update_form.html Wed Sep 04 15:18:22 2013 +0200 @@ -5,13 +5,18 @@ {% block page_title %}{% trans 'Record' %} {{ params.identifier }} - {% trans 'View' %}{% endblock %} {% block js_page %} - + {% endblock %} {% block content %} diff -r f625ad551908 -r 945b144d68c1 src/p4l/views.py --- a/src/p4l/views.py Wed Sep 04 15:01:50 2013 +0200 +++ b/src/p4l/views.py Wed Sep 04 15:18:22 2013 +0200 @@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 from django.utils.decorators import method_decorator -from django.views.generic import ListView, DetailView, TemplateView, UpdateView +from django.views.generic import ListView, DetailView, TemplateView from p4l.forms import RecordFilterForm from p4l.models import Record from p4l.utils import get_labels_for_uris @@ -108,14 +108,7 @@ return context - class RecordEditView(TemplateView): http_method_names = ['get'] template_name = 'p4l/record_update_form.html' -# class RecordEditView(UpdateView): -# model = Record -# template_name_suffix = '_update_form' -# slug_field = "identifier" -# slug_url_kwarg = "id" -