update view simplification. Baby step towards complete form.
--- a/src/p4l/static/p4l/js/p4l.js Wed Sep 04 10:02:22 2013 +0200
+++ b/src/p4l/static/p4l/js/p4l.js Wed Sep 04 10:46:53 2013 +0200
@@ -8,10 +8,11 @@
});
app.controller("RecordCtrl", function($scope, Api){
- $scope.record = Api.record.get();
+ $scope.record = Api.record.get({recordId: record_id});
});
app.config(['$routeProvider', function($routeProvider) {
// $routeProvider.when('/', {controller: 'RecordCtrl', templateUrl: 'partials/record.html'});
// $routeProvider.otherwise({redirectTo: '/'});
}]);
+
--- a/src/p4l/templates/p4l/record_update_form.html Wed Sep 04 10:02:22 2013 +0200
+++ b/src/p4l/templates/p4l/record_update_form.html Wed Sep 04 10:46:53 2013 +0200
@@ -2,11 +2,12 @@
{% load static %}
{% load i18n %}
-{% block page_title %}{% trans 'Record' %} {{ record.identifier }} - {% trans 'View' %}{% endblock %}
+{% block page_title %}{% trans 'Record' %} {{ params.identifier }} - {% trans 'View' %}{% endblock %}
{% block js_page %}
<script type="text/javascript">
- var record_api_url = "{% url 'record-detail' identifier=record.identifier %}";
+ var record_id = "{{id}}";
+ var record_api_url = "{% url 'record-detail' identifier=':recordId' %}".replace("\%3A",":");
</script>
<script type="text/javascript" src="{% static 'p4l/lib/angular/angular.min.js' %}"></script>
<script type="text/javascript" src="{% static 'p4l/lib/angular/angular-resource.min.js' %}"></script>
@@ -14,12 +15,6 @@
{% endblock %}
{% block content %}
-<form action="" method="post">{% csrf_token %}
-<table class="table record-table">
-{{ form.as_table }}
-</table>
-<input type="submit" value="Update" />
-</form>
<div ng-app="recordApp" ng-controller="RecordCtrl">
{% verbatim %}
<p>identifier <input name="identifier" ng-model="record.identifier"/></p>