Added pad settings

before-bootstrap
Candid Dauth 2014-04-08 01:24:14 +02:00
rodzic f3e89bd799
commit 3a962e9dda
2 zmienionych plików z 32 dodań i 4 usunięć

Wyświetl plik

@ -58,8 +58,9 @@
$scope.saveViewName = null;
$scope.currentMarker = null;
$scope.messages = [ ];
$scope.padUrl = location.protocol + "//" + location.host + location.pathname;
socket.emit("setPadId", location.href.match(/[^\/]*$/)[0]);
socket.emit("setPadId", location.pathname.match(/[^\/]*$/)[0]);
bindSocketToScope($scope, socket);
@ -82,6 +83,17 @@
$scope.$watch("views", updateMenu);
$scope.savePadData = function() {
var padData = $.extend({ }, $scope.padData);
delete padData.defaultView;
socket.emit("editPad", padData, function(err) {
if(err)
$scope.dialogError = err;
else
$scope.closeDialog();
});
};
fp.onClickMarker = function(marker) {
$scope.$apply(function() {
$scope.currentMarker = marker;
@ -190,7 +202,7 @@
$scope.round = function(number, digits) {
var fac = Math.pow(10, digits);
return Math.round(number*fac)/fac;
}
};
});
function bindSocketToScope($scope, socket) {

Wyświetl plik

@ -20,8 +20,8 @@
<li><a href="#" ng-click="openDialog('save-view-dialog')">Save current view</a></li>
<li><a href="#" ng-click="openDialog('manage-views-dialog')">Manage views</a></li>
</ul></li>
<li><a href="#">Pad settings</a></li>
<li><a href="#">Layers</a></li>
<li><a href="#" ng-click="openDialog('pad-settings-dialog')">Pad settings</a></li>
<!--<li><a href="#">Layers</a></li>-->
</ul>
<div id="messages">
@ -77,5 +77,21 @@
</div>
</form>
</div>
<div id="pad-settings-dialog" title="Pad settings" fp-dialog>
<form>
<p class="error" ng-show="dialogError">{{dialogError}}</p>
<dl>
<dt>Link</dt>
<dd>{{padUrl}}</dd>
<dt><label for="pad-name-input">Pad name</label></dt>
<dd><input id="pad-name-input" value="{{padData.name}}" ng-model="padData.name" /></dd>
</dl>
<div>
<button ng-click="savePadData()">Save</button>
</div>
</form>
</div>
</body>
</html>