Skip to content

Commit

Permalink
2.82.1550
Browse files Browse the repository at this point in the history
  • Loading branch information
toconnell committed Jun 8, 2018
1 parent a58253f commit c7d076a
Show file tree
Hide file tree
Showing 13 changed files with 442 additions and 313 deletions.
9 changes: 9 additions & 0 deletions v1/js/settlementSheet.js
Expand Up @@ -54,6 +54,15 @@ app.controller("abandonSettlementController", function($scope) {
};
});

app.controller("removeSettlementController", function($scope) {
$scope.removeSettlement = function() {
if ($scope.scratch.confirmRemove === 'DELETE') {
showFullPageLoader();
$scope.postJSONtoAPI('settlement','remove',{},false,false,false)
};
};
});

app.controller("lanternResearchController", function($scope) {
$scope.setLanternResearch = function() {
js_obj = {value: $scope.settlement.sheet.lantern_research_level};
Expand Down
6 changes: 6 additions & 0 deletions v1/js/survivorSheet.js
Expand Up @@ -640,6 +640,12 @@ app.controller("controlsOfDeath", function($scope) {
});


app.controller("removeSurvivorController", function($scope) {
$scope.removeSurvivor = function() {
$scope.postJSONtoAPI('survivor', 'remove', {}, false,false,false);
};

});


app.controller("theConstellationsController", function($scope) {
Expand Down
2 changes: 1 addition & 1 deletion v1/media/color.css
Expand Up @@ -67,7 +67,7 @@
.special_showdown {color: #DC2426; }
.special_showdown_button,
.kd_special_showdown,
.kd_red {color: #fff; background-color: #DC2426; background: radial-gradient(#ED3537, DC2426); }
.kd_red {color: #fff; background-color: #DC2426; background: radial-gradient(#ED3537, #DC2426); }

/* attributes */
.Movement, .mov_token {background-color: #9A6D84; color: #fff; }
Expand Down
24 changes: 20 additions & 4 deletions v1/media/style.css
Expand Up @@ -963,7 +963,13 @@ div.principles_container {display: flex; flex-direction: column; align-items: ba
div.unset_principle_container {margin-bottom: 20%; margin-top: -7%; margin-left: 3.5%; }


button.permanently_delete {margin-top: -1%; margin-bottom: 5%; }
/* remove settlement - mobile */
button.permanently_delete {margin-bottom: 5%; }
.rm_asset_confirm_container {border-radius: 5px; width: 90%; margin: 3% auto; border: 0.2em solid #fff; padding: 2%; }
.rm_asset_confirm_container p {font-family: 'Metrophobic'; }
.rm_asset_confirm_container button {border: 0.2em solid #fff; }
input.confirm_remove {margin: 0 auto; border: 0.2em solid #fff; display: block; text-align: center; background: radial-gradient(#fff,#fff,#eee)}


.settlement_sheet_settlement_name {font-family: Silverado; font-size: 75pt; font-weight: bold; text-align: center; margin: 2%; margin-bottom: 3%; }

Expand Down Expand Up @@ -2238,10 +2244,15 @@ span.survivor_search_retired_survivors_warning {color: #999; font-style:italic;

label.public_survivor_toggle {font-size: 20px; }

button.permanently_delete {margin-top: 1%; }
.inventory_repeater_detail div.rules {font-size: 9pt;}


.inventory_repeater_detail div.rules {font-size: 9pt;}

/* rm remove settlement - tablet */
button.permanently_delete {margin-top: 1%; }
.rm_asset_confirm_container {width: 70%; }
input.confirm_remove {height: auto; padding: 1%; margin-top: 10%; }


/* tablet width: burger queen */
div#mySidenav {max-width: 50%;}
Expand Down Expand Up @@ -2461,7 +2472,7 @@ span.survivor_search_retired_survivors_warning {color: #999; font-style:italic;
/* expansion modal - wide */
.expansion_toggle_container {font-size: 15pt; padding: 1%; margin-bottom: 1%; border-width: 2px; }
.expansion_toggle_subtitle {font-size: 10pt; }
.expansions_controls_container button {width: 75%; display: block; margin-top: 5%; margin-bottom: 5%; }
.expansions_controls_container button {width: 75%; display: block; margin-top: 3%; margin-bottom: 5%; padding: 2%; }
.expansion_management_form {width: 100%; margin-top: 3%; }

/* asset creation styles - wide */
Expand Down Expand Up @@ -2927,7 +2938,12 @@ span.survivor_search_retired_survivors_warning {color: #999; font-style:italic;
div.survivor_sheet_parents_container {padding-bottom: 3%; }

label.public_survivor_toggle {width: 100%; font-size: 11pt; margin-top: 2%; margin-left: 5%; }

/*remove settlement / survivor */
div.permanently_delete_survivor {margin-left: 4%; }
.rm_asset_confirm_container {width: 600px; }
input.confirm_remove {margin-bottom: 3%; }
.rm_asset_confirm_container button {display: block; margin: 5% auto; width: 60%; }

button#modalCustomAIButton {width: auto; margin: 10px; margin-top: 20px; }
div.custom_AI_preview {font-size: 14pt; text-align: left; }
Expand Down
22 changes: 4 additions & 18 deletions v1/session.py
Expand Up @@ -474,27 +474,13 @@ def process_params(self, user_action=None):
if p in self.params:
user_action = self.change_current_view_to_asset(p)

# these are our two asset removal methods: this is as DRY as I think we
# can get with this stuff, since both require unique handling
# remove settlement; deprecated 2018-06-08
if "remove_settlement" in self.params:
s_id = ObjectId(self.params["remove_settlement"].value)
self.set_current_settlement(s_id)
S = assets.Settlement(settlement_id=s_id, session_object=self)
S.remove()
user_action = "removed settlement %s" % S
self.change_current_view("dashboard")
self.logger.error("Removing settlements is no longer supported by the legacy webapp!")

# remove survivor; deprecated 2018-06-08
if "remove_survivor" in self.params:
# we actually have to get the survivor from the MDB to set the
# current settlement before we can initialize the survivor and
# use its remove() method.
s_id = ObjectId(self.params["remove_survivor"].value)
s_doc = mdb.survivors.find_one({"_id": s_id})
self.set_current_settlement(s_doc["settlement"])
S = assets.Survivor(survivor_id=s_id, session_object=self)
S.remove()
user_action = "removed survivor %s from %s" % (S, S.Settlement)
self.change_current_view("view_campaign", asset_id=S.survivor["settlement"])
self.logger.error("Removing survivors is no longer supported by the legacy webapp!")


#
Expand Down
2 changes: 1 addition & 1 deletion v1/settings.cfg
Expand Up @@ -2,7 +2,7 @@
title = Interactive campaign manager for Kingdom Death: Monster.
admin_email = toconnell@tyrannybelle.com
debug = True
version = 2.81.1540
version = 2.82.1550
tld = https://kdm-manager.com
static_url = https://media.kdm-manager.com
validate_email = False
Expand Down
108 changes: 60 additions & 48 deletions v1/templates/settlement_sheet.html
Expand Up @@ -1053,64 +1053,76 @@ <h2>Milestone Story Events</h2>
</div> <!-- lost_settlement_controls_container -->


<!-- ABANDON -->
<div
class="settlement_sheet_block_group"
ng-controller="abandonSettlementController"
ng-if="settlement.sheet.abandoned == undefined"
>
<!-- ABANDON -->
<div
class="settlement_sheet_block_group"
ng-controller="abandonSettlementController"
ng-if="settlement.sheet.abandoned == undefined"
>

<h3>Abandon Settlement</h3>
<p>Mark a settlement as "Abandoned" to prevent it from showing up in your active campaigns without removing it from the system.</p>
<p class="maroon_text">&nbsp; <b>This cannot be undone.</b></p>
<h3>Abandon Settlement</h3>
<p class="metrophobic">Use the button below to mark <b>{{settlement.sheet.name}}</b> as "Abandoned" to prevent it from showing up on your KDM-Manager dashboard. Abandoning a settlement <i>does not</i> remove it from the system.</p>
<p class="maroon_text metrophobic">&nbsp; <b>This cannot be undone.</b></p>

<button
class="kd_alert_no_exclaim red_glow"
ng-click="abandonSettlement()"
>
Abandon Settlement
</button>
</div> <!-- abandon controls -->
<button
class="kd_alert_no_exclaim red_glow"
ng-click="abandonSettlement()"
>
Abandon Settlement
</button>
</div> <!-- abandon controls -->

<!-- remove settlement button -->
<!-- REMOVE -->
<div
ng-if="user.user.preferences.show_remove_button == true"
class="settlement_sheet_block_group"
>
<h3>Permanently Remove Settlement</h3>
<form
action="#"
method="POST"
onsubmit="return confirm('Press OK to permanently delete this settlement AND ALL SURVIVORS WHO BELONG TO THIS SETTLEMENT forever. \\r\\rPlease note that this CANNOT BE UNDONE and is not the same as marking a settlement Abandoned.\\r\\rPlease consider abandoning old settlements rather than removing them, as this allows data about the settlement to be used in general kdm-manager stats.\\r\\r');"
<h3>Delete Settlement</h3>
<p class="metrophobic">
Use the button below to permanently delete <b>{{settlement.sheet.name}}</b>.
</p>
<p class="maroon_text metrophobic">&nbsp; <b>This will permanently delete all survivors associated with this settlement.</b></p>
<p class="maroon_text metrophobic">&nbsp; <b>This cannot be undone.</b></p>
<button
class="kd_alert_no_exclaim red_glow permanently_delete"
ng-click="showHide('removeSettlementConfirmation')"
>
<input type="hidden" name="remove_settlement" ng-value="settlement.sheet._id.$oid"/>
<p>
Use the button below to permanently delete <b>{{settlement.sheet.name}}</b>.
Please note that <b>this cannot be undone</b> and that this will
also permanently remove all survivors associated with this
settlement.
</p>
<button class="kd_alert_no_exclaim red_glow permanently_delete">
Permanently Delete Settlement
Delete Settlement
</button>
</div>
<div
id="removeSettlementConfirmation"
class="modal-black hidden"
ng-controller="removeSettlementController"
>
<div class="rm_asset_confirm_container kd_red">
<h3>DELETE SETTLEMENT</h3>
<p>This CANNOT BE UNDONE and is not the same as marking a settlement "abandoned".</p>
<p>Please consider abandoning old settlements rather than deleting them. This allows data about the settlement to be used in general https://kdm-manager.com stats that all users see on their dashboards.</p>
<p>If you still want to permanently delete <b>{{settlement.sheet.name}}</b>, type "DELETE" (without the quotes) in the box below and then click the "DELETE" button that appears to permanently delete this settlement AND ALL SURVIVORS WHO BELONG TO THIS SETTLEMENT forever.</p>
<input type="text" class="confirm_remove" ng-model="scratch.confirmRemove" placeholder="DELETE"/>
<button
class="kd_alert_no_exclaim ng_fade"
ng-if="scratch.confirmRemove === 'DELETE'"
onClick="showFullPageLoader()"
ng-click="
showHide('removeSettlementConfirmation');
removeSettlement();
postForm('change_view','dashboard');
"
>
Delete Settlement
</button>
<button
class="ng_fade"
ng-if="scratch.confirmRemove !== 'DELETE'"
ng-click="showHide('removeSettlementConfirmation')"
>
Close
</button>
</form>
</div><!-- rm_settlement_confirm_container -->
</div>


</div> <!-- right pane -->


<!--
This is the fold! Anything below here is below the fold!
This should only be modals, heavy angularjs stuff, etc. that is
still within the settlementSheetApp, but that doesn't need to
load right away.
-->

<form id="settlementSheetReload" method="POST" action="/"><button class="hidden" />SUBMIT</button></form>



</div> <!-- settlementSheetApp -->

0 comments on commit c7d076a

Please sign in to comment.