Skip to content

Commit

Permalink
#63 | Add option to reset links in reset settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-null committed Nov 21, 2016
1 parent 59ea4dd commit 5bd97f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 14 additions & 2 deletions app/options/controllers/SettingsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,32 @@ module SitecoreExtensions.Options {

export class SettingsController extends BaseOptionsController {
constructor($scope: any, formlyVersion: string) {
super($scope, formlyVersion, 'General');
super($scope, formlyVersion, 'Settings');
$scope.vm.title = 'Settings';
$scope.vm.reset = this.reset;
}

getFields() {
return [];
return [
{
key: 'resetLinks',
type: 'checkbox',
defaultValue: true,
templateOptions: {
label: 'Reset links'
},
}
];
}

reset() {
let confirmation = confirm("Are you sure you want to reset all Sitecore Extensions options?");
if (confirmation) {
chrome.storage.local.clear();
}
if(this.model.resetLinks){
localStorage.clear();
}
}
}
}
6 changes: 4 additions & 2 deletions app/options/views/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<div class="col-lg-8 col-md-offset-2">
<div ng-controller="SettingsController as vm">
<h1>{{::vm.title}}</h1>

<h3>Reset settings to default:</h3>
<formly-form model="vm.model" fields="vm.fields" options="vm.options" form="vm.form"> </formly-form>
<br>
<span class="text-danger">After you click reset button, all your personal settings will be changed to default.</span>
<br></br>
</br>
</br>
<button ng-click="vm.reset()" class="btn btn-danger">Reset</button>
</div>
</div>
Expand Down

0 comments on commit 5bd97f1

Please sign in to comment.