Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing publish descendants dialog #8601

Merged
merged 2 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@
view: "views/content/overlays/unpublish.html",
variants: $scope.content.variants, //set a model property for the dialog
skipFormValidation: true, //when submitting the overlay form, skip any client side validation
includeUnpublished: false,
submitButtonLabelKey: "content_unpublish",
submitButtonStyle: "warning",
submit: function (model) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@

var vm = this;

vm.includeUnpublished = false;
vm.includeUnpublished = $scope.model.includeUnpublished || false;

vm.changeSelection = changeSelection;
vm.toggleIncludeUnpublished = toggleIncludeUnpublished;


function onInit() {

vm.variants = $scope.model.variants;
vm.displayVariants = vm.variants.slice(0);// shallow copy, we dont want to share the array-object(because we will be performing a sort method) but each entry should be shared (because we need validation and notifications).
vm.displayVariants = vm.variants.slice(0); // shallow copy, we don't want to share the array-object (because we will be performing a sort method) but each entry should be shared (because we need validation and notifications).
vm.labels = {};

// get localized texts for use in directives
if (!$scope.model.title) {
localizationService.localize("buttons_publishDescendants").then(function (value) {
$scope.model.title = value;
});
}
if (!vm.labels.includeUnpublished) {
localizationService.localize("content_includeUnpublished").then(function (value) {
vm.labels.includeUnpublished = value;
});
}

_.each(vm.variants, function (variant) {
variant.isMandatory = isMandatoryFilter(variant);
Expand Down Expand Up @@ -72,8 +77,9 @@
}

function toggleIncludeUnpublished() {
console.log("toggleIncludeUnpublished")
vm.includeUnpublished = !vm.includeUnpublished;
// make sure this value is pushed back to the scope
$scope.model.includeUnpublished = vm.includeUnpublished;
}

/** Returns true if publishing is possible based on if there are un-published mandatory languages */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
</div>

<div class="flex mb3">
<umb-toggle
checked="vm.includeUnpublished"
on-click="vm.toggleIncludeUnpublished()"
class="mr2"
/>
<localize key="content_includeUnpublished"></localize>

<umb-toggle checked="vm.includeUnpublished"
on-click="vm.toggleIncludeUnpublished()"
class="mr2"
label-on="{{vm.labels.includeUnpublished}}"
label-off="{{vm.labels.includeUnpublished}}"
label-position="right"
show-labels="true"/>

Copy link
Contributor

@bjarnef bjarnef Aug 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clausjensen notice angular directives/components can't be void elements (self-closing), so it needs a end-closing </umb-toggle>.

There is a great explanation of it here: https://stackoverflow.com/a/25012451/1693918

Also here is an example of what can happen when a component/directive is self-closed. Of course native HTML5 elements can still be self-closed like <img />, <br /> etc.
#8478

Here is a PR updating this for <umb-checkbox> and <umb-radiobutton>:
#8547

and this for <umb-toggle> #8605
However if merging this PR and including end-closing </umb-toggle>, then #8605 can just be closed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've merged your PR as it might be good just for history .. and the whitespace change is fine. Merging this afterwards will overwrite some things in yours which is fine.

</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
<key alias="addTextBox">Tilføj en ny tekstboks</key>
<key alias="removeTextBox">Fjern denne tekstboks</key>
<key alias="contentRoot">Indholdsrod</key>
<key alias="includeUnpublished">Medtag udkast: udgiv også ikke-publicerede sider.</key>
<key alias="includeUnpublished">Inkluder ikke-udgivet indhold.</key>
<key alias="isSensitiveValue">Denne værdi er skjult.Hvis du har brug for adgang til at se denne værdi, bedes du kontakte din web-administrator.</key>
<key alias="isSensitiveValue_short">Denne værdi er skjult.</key>
<key alias="languagesToPublishForFirstTime">Hvilke sprog vil du gerne udgive? Alle sprog med indhold gemmes!</key>
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
<key alias="addTextBox">Add another text box</key>
<key alias="removeTextBox">Remove this text box</key>
<key alias="contentRoot">Content root</key>
<key alias="includeUnpublished">Include drafts and unpublished content items.</key>
<key alias="includeUnpublished">Include unpublished content items.</key>
<key alias="isSensitiveValue">This value is hidden. If you need access to view this value please contact your website administrator.</key>
<key alias="isSensitiveValue_short">This value is hidden.</key>
<key alias="languagesToPublishForFirstTime">What languages would you like to publish? All languages with content are saved!</key>
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
<key alias="addTextBox">Add another text box</key>
<key alias="removeTextBox">Remove this text box</key>
<key alias="contentRoot">Content root</key>
<key alias="includeUnpublished">Include drafts and unpublished content items.</key>
<key alias="includeUnpublished">Include unpublished content items.</key>
<key alias="isSensitiveValue">This value is hidden. If you need access to view this value please contact your website administrator.</key>
<key alias="isSensitiveValue_short">This value is hidden.</key>
<key alias="languagesToPublishForFirstTime">What languages would you like to publish? All languages with content are saved!</key>
Expand Down