Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9260248543 | ||
|
|
c4a348db67 |
@@ -2,20 +2,13 @@ angular.module('syncthing.core')
|
||||
.directive('notification', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: true,
|
||||
scope: {},
|
||||
transclude: true,
|
||||
template: '<div class="row" ng-if="visible()"><div class="col-md-12" ng-transclude></div></div>',
|
||||
link: function (scope, elm, attrs) {
|
||||
scope.visible = function () {
|
||||
return scope.config.options.unackedNotificationIDs.indexOf(attrs.id) > -1;
|
||||
}
|
||||
scope.dismiss = function () {
|
||||
var idx = scope.config.options.unackedNotificationIDs.indexOf(attrs.id);
|
||||
if (idx > -1) {
|
||||
scope.config.options.unackedNotificationIDs.splice(idx, 1);
|
||||
scope.saveConfig();
|
||||
}
|
||||
}
|
||||
return scope.$parent.config.options.unackedNotificationIDs.indexOf(attrs.id) > -1;
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<p translate>This is an example notification. ID of the notification should be appended to Options.UnackedNotificationIDs of the config.</p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="dismiss()">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="dismissNotification('exampleNotification')">
|
||||
<span class="fa fa-check"></span> <span translate>OK</span>
|
||||
</button>
|
||||
<div class="clearfix"></div>
|
||||
@@ -31,10 +31,10 @@
|
||||
<p><a href="https://docs.syncthing.net/users/releases.html"><span class="fa fa-fw fa-book"></span> <span translate>Learn more</span></a></p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="editSettings()">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="editSettings(); dismissNotification('channelNotification')">
|
||||
<span class="fa fa-cog"></span> <span translate>Settings</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-default" ng-click="dismiss()">
|
||||
<button type="button" class="btn btn-sm btn-default" ng-click="dismissNotification('channelNotification')">
|
||||
<span class="fa fa-check"></span> <span translate>OK</span>
|
||||
</button>
|
||||
<div class="clearfix"></div>
|
||||
@@ -58,10 +58,10 @@
|
||||
</div>
|
||||
<div class="panel-footer clearfix">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-primary btn-sm" ng-click="activateAllFsWatchers(); dismiss()">
|
||||
<button type="button" class="btn btn-primary btn-sm" ng-click="activateAllFsWatchers(); dismissNotification('fsWatcherNotification')">
|
||||
<span class="fa fa-check"></span> <span translate>Yes</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" ng-click="dismiss()">
|
||||
<button type="button" class="btn btn-default btn-sm" ng-click="dismissNotification('fsWatcherNotification')">
|
||||
<span class="fa fa-times"></span> <span translate>No</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -2247,4 +2247,12 @@ angular.module('syncthing.core')
|
||||
$scope.sizeOf = function (dict) {
|
||||
return Object.keys(dict).length;
|
||||
};
|
||||
|
||||
$scope.dismissNotification = function (id) {
|
||||
var idx = $scope.config.options.unackedNotificationIDs.indexOf(id);
|
||||
if (idx > -1) {
|
||||
$scope.config.options.unackedNotificationIDs.splice(idx, 1);
|
||||
$scope.saveConfig();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<td ng-if="!changeEvent.data.modifiedBy"><span translate>Unknown</span></td>
|
||||
<td>{{changeEvent.data.action}}</td>
|
||||
<td>{{changeEvent.data.type}}</td>
|
||||
<td class="no-overflow-ellipse">{{changeEvent.data.label}}</td>
|
||||
<td class="no-overflow-ellipse">{{folderLabel(changeEvent.data.folder)}}</td>
|
||||
<td class="no-overflow-ellipse">{{changeEvent.data.path}}</td>
|
||||
<td class="no-overflow-ellipse">{{changeEvent.time | date:"yyyy-MM-dd HH:mm:ss"}}</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user