Save indicator
authorymh <ymh.work@gmail.com>
Thu, 12 Sep 2013 00:33:37 +0200
changeset 71 abd73d06615e
parent 70 2ee11f57e318
child 73 d1b176885515
Save indicator
src/p4l/static/p4l/css/img/ajax-loader.gif
src/p4l/static/p4l/css/p4l.css
src/p4l/static/p4l/js/p4l.js
src/p4l/templates/p4l/record_update_form.html
Binary file src/p4l/static/p4l/css/img/ajax-loader.gif has changed
--- a/src/p4l/static/p4l/css/p4l.css	Wed Sep 11 13:41:47 2013 +0200
+++ b/src/p4l/static/p4l/css/p4l.css	Thu Sep 12 00:33:37 2013 +0200
@@ -34,6 +34,16 @@
     padding-top: 5px;
 }
 
+.spinner {
+    width: 14px;
+    height: 14px;
+    float: left;
+	background:url(./img/ajax-loader.gif) no-repeat center center;
+	border-radius: 50%;
+	opacity: .7;
+	margin-right: 4px;
+}
+
 /* Flags */
 
 .flag {
--- a/src/p4l/static/p4l/js/p4l.js	Wed Sep 11 13:41:47 2013 +0200
+++ b/src/p4l/static/p4l/js/p4l.js	Thu Sep 12 00:33:37 2013 +0200
@@ -235,10 +235,13 @@
 app.controller("RecordCtrl", function($scope, RecordModel, context){
     
     $scope.record = RecordModel.record;
-    $scope.uriLabels = RecordModel.uriLabels;    
+    $scope.uriLabels = RecordModel.uriLabels;
+    
+    $scope.saving = false;
         
     $scope.submitRecord = function() {
-        $scope.record.$save({recordId: context.record_id});
+        $scope.saving = true;
+        $scope.record.$save({recordId: context.record_id}).then(function(response) { $scope.saving=false;});
     }
     
     
--- a/src/p4l/templates/p4l/record_update_form.html	Wed Sep 11 13:41:47 2013 +0200
+++ b/src/p4l/templates/p4l/record_update_form.html	Thu Sep 12 00:33:37 2013 +0200
@@ -178,7 +178,10 @@
     </tr>
   </tbody>
 </table>
-<button ng-click="submitRecord()">{{ 'Save' | translate }}</button>
+<button type="button" class="btn btn-primary" ng-click="submitRecord()" id="record-submit">
+    <span ng-class="['glyphicon', saving?'spinner':'glyphicon-save']"></span>
+    <span>{{ 'Save' | translate }}</span>
+</button>
 </div>
 {% endverbatim %}
 {% endblock %}
\ No newline at end of file