[#1477] port settings modals to jade, implemented restore

This commit is contained in:
Tyler Renelle
2013-09-08 13:23:37 -04:00
parent d471688c54
commit 5e51148f8e
5 changed files with 80 additions and 74 deletions

View File

@@ -49,5 +49,21 @@ habitrpg.controller('SettingsCtrl',
});
}
$scope.restore = function(){
var stats = User.user.stats,
items = User.user.items;
User.setMultiple({
"stats.hp": stats.hp,
"stats.exp": stats.exp,
"stats.gp": stats.gp,
"stats.lvl": stats.lvl,
"items.weapon": items.weapon,
"items.armor": items.armor,
"items.head": items.head,
"items.shield": items.shield
});
$rootScope.modals.restore = false;
}
}
]);

View File

@@ -24,11 +24,11 @@
input(type='password', placeholder='Confirm New Password', ng-model='changePass.confirmNewPassword', required)
input.btn(type='submit', value='Submit')
hr
hr
h4 Danger Zone
a.btn.btn-danger(ng-click='notPorted()', data-target='#reset-modal', data-toggle='modal', tooltip='Resets your entire account (dangerous).') Reset
a.btn.btn-danger(ng-click='notPorted()', data-target='#restore-modal', data-toggle='modal', tooltip='Restores attributes to your character.') Restore
a.btn.btn-danger(ng-click='notPorted()', data-target='#delete-modal', data-toggle='modal', tooltip='Delete your account.') Delete
a.btn.btn-danger(ng-click='modals.reset = true', tooltip='Resets your entire account (dangerous).') Reset
a.btn.btn-danger(ng-click='modals.restore = true', tooltip='Restores attributes to your character.') Restore
a.btn.btn-danger(ng-click='modals.delete = true', tooltip='Delete your account.') Delete
.span6
h2 API
small Copy these for use in third party applications.

View File

@@ -5,4 +5,5 @@ include ./death
include ./new-stuff
include ./why-ads
include ./more-gems
include ./members
include ./members
include ./settings

View File

@@ -1,69 +0,0 @@
<modals:>
{{#if _loggedIn}}
<app:modals:modal modalId="reset-modal" header="Reset">
<p>This resets your entire account - your tasks will be deleted and your character will start over.</p>
<p>This is highly discouraged because you'll lose historical data, which is useful for graphing your progress over time. However, some people find it useful in the beginning after playing with the app for a while.</p>
<@footer>
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button data-dismiss="modal" x-bind=click:reset class="btn btn-danger">Reset</button>
</@footer>
</app:modals:modal>
<app:modals:modal modalId="restore-modal" header="Restore">
<p>HabitRPG is quite Beta-quality at present, and many find they need to restore character attributes as a result. Enter your numbers here and it will be applied automatically to your character. This will be removed once Habit is more stable.</p>
{#with _user}
<form id='restore-form' class="form-horizontal restore-options">
<h3>Stats</h3>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='stats.hp' value="{{.stats.hp}}">
<span class="input-suffix">HP</span>
</div>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='stats.exp' value="{{.stats.exp}}">
<span class="input-suffix">Exp</span>
</div>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='stats.gp' value="{{.stats.gp}}">
<span class="input-suffix">GP</span>
</div>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='stats.lvl' value="{{.stats.lvl}}">
<span class="input-suffix">Level</span>
</div>
<h3>Items</h3>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='items.weapon' value="{{.items.weapon}}">
<span class="input-suffix">Weapon</span>
</div>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='items.armor' value="{{.items.armor}}">
<span class="input-suffix">Armor</span>
</div>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='items.head' value="{{.items.head}}">
<span class="input-suffix">Helm</span>
</div>
<div class="option-group option-medium">
<input class="option-content" type="number" data-for='items.shield' value="{{.items.shield}}">
<span class="input-suffix">Shield</span>
</div>
</form>
{/}
<@footer>
<button class="btn" x-bind="click:restoreSave" data-dismiss="modal" aria-hidden="true">Save & Close</button>
</@footer>
</app:modals:modal>
<app:modals:modal modalId="delete-modal" header="Delete Account">
<p>Woa woa woa! Are you sure? This will seriously delete your account forever, and it can never be restored. If you're absolutely certain, type <strong>DELETE</strong> into the text-box below.</p>
<p><input type="text" value="{_deleteAccount}" /></p>
<@footer>
<button class="btn btn-large" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button data-dismiss="modal" x-bind="click:deleteAccount" class="btn btn-danger btn-small {#unless equal(_deleteAccount,'DELETE')}disabled{/}">Delete Account</button>
</@footer>
</app:modals:modal>
{{/}}

View File

@@ -0,0 +1,58 @@
div(ng-controller='SettingsCtrl')
div(modal='modals.reset')
.modal-header
h3 Reset
.modal-body
p This resets your entire account - your tasks will be deleted and your character will start over.
p This is highly discouraged because you'll lose historical data, which is useful for graphing your progress over time. However, some people find it useful in the beginning after playing with the app for a while.
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.reset = false') Close
button.btn.btn-danger(data-dismiss='modal', ng-click='notPorted()') Reset
div(modal='modals.restore')
.modal-header
h3 Restore
.modal-body
p HabitRPG is quite Beta-quality at present, and many find they need to restore character attributes as a result. Enter your numbers here and it will be applied automatically to your character. This will be removed once Habit is more stable.
div.restore-options
form#restore-form.form-horizontal
h3 Stats
.option-group.option-medium
input.option-content(type='number', data-for='stats.hp', ng-model='user.stats.hp')
span.input-suffix HP
.option-group.option-medium
input.option-content(type='number', data-for='stats.exp', ng-model='user.stats.exp')
span.input-suffix Exp
.option-group.option-medium
input.option-content(type='number', data-for='stats.gp', ng-model='user.stats.gp')
span.input-suffix GP
.option-group.option-medium
input.option-content(type='number', data-for='stats.lvl', ng-model='user.stats.lvl')
span.input-suffix Level
h3 Items
.option-group.option-medium
input.option-content(type='number', data-for='items.weapon', ng-model='user.items.weapon')
span.input-suffix Weapon
.option-group.option-medium
input.option-content(type='number', data-for='items.armor', ng-model='user.items.armor')
span.input-suffix Armor
.option-group.option-medium
input.option-content(type='number', data-for='items.head', ng-model='user.items.head')
span.input-suffix Helm
.option-group.option-medium
input.option-content(type='number', data-for='items.shield', ng-model='user.items.shield')
span.input-suffix Shield
.modal-footer
button.btn.btn-primary(ng-click='restore()') Save & Close
div(modal='modals.delete')
.modal-header
h3 Delete Account
.modal-body
p.
Woa woa woa! Are you sure? This will seriously delete your account forever, and it can never be restored. If you're absolutely certain, type <strong>DELETE</strong> into the text-box below.
p
input(type='text', ng-model='_deleteAccount')
footer
button.btn.btn-default(ng-click='modals.delete = false') Cancel
button.btn.btn-danger.btn-small(ng-disabled='_deleteAccount != "DELETE"', data-dismiss='modal', ng-click='notPorted()') Delete Account