Skip to content

Commit

Permalink
Redesign manager "Add page" to reuse same modal as when inserting page.
Browse files Browse the repository at this point in the history
Fixes #1748
  • Loading branch information
tidyui committed Oct 27, 2021
1 parent b6f5be7 commit 77dd5b1
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 38 deletions.
13 changes: 4 additions & 9 deletions core/Piranha.Manager/Areas/Manager/Pages/PageList.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,10 @@
<span v-else class="title">{{ site.title }} <small style="display:none">(<code>{{ site.slug }}</code>)</small></span>
</div>
<div>
<div v-if="piranha.permissions.pages.add" class="btn-group" role="group">
<button id="pageGroup" type="button" class="btn btn-sm btn-primary btn-labeled dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-plus"></i>
@Localizer.Page["Add page"]
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="pageGroup">
<a class="dropdown-item" :href="piranha.baseUrl + type.addUrl + site.id + '/' + type.id" v-for="type in pageTypes">{{ type.title }}</a>
</div>
</div>
<button v-if="piranha.permissions.pages.add" id="pageGroup" type="button" v-on:click.prevent="piranha.pagelist.add(site.id, null, false)" class="btn btn-sm btn-primary btn-labeled">
<i class="fas fa-plus"></i>
@Localizer.Page["Add page"]
</button>
</div>
</div>
<div class="sitemap sitemap-container dd" data-id="{ site.id }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
<table class="table">
<tbody>
<tr v-for="(type) in pageTypes">
<td><a :href="piranha.baseUrl + 'manager/page/addrelative/' + addPageId + '/' + type.id + '/' + addAfter">{{ type.title }}</a></td>
<td>
<a v-if="addPageId !== null" :href="piranha.baseUrl + 'manager/page/addrelative/' + addPageId + '/' + type.id + '/' + addAfter">{{ type.title }}</a>
<a v-else :href="piranha.baseUrl + type.addUrl + addSiteId + '/' + type.id">{{ type.title }}</a>
<span v-if="type.description !== null" class="d-block dimmed">{{ type.description }}</span>
</td>
</tr>
</tbody>
</table>
Expand Down
44 changes: 25 additions & 19 deletions core/Piranha.Manager/Areas/Manager/Shared/Partial/_SiteModal.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@inject IAuthorizationService Auth
@inject ManagerLocalizer Localizer

<div id="siteedit" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div id="siteedit" class="modal modal-panel" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<!-- Header -->
<div class="modal-header border-bottom-0">
Expand Down Expand Up @@ -37,18 +37,12 @@
</div>
</div>
</div>
<div class="col">
<div class="form-group">
<label>@Localizer.General["Internal id"]</label>
<input v-model="internalId" type="text" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label>@Localizer.Site["Hostnames"]</label>
<input v-model="hostnames" type="text" class="form-control">
<label>@Localizer.General["Internal id"]</label>
<input v-model="internalId" type="text" class="form-control">
</div>
</div>
<div class="col">
Expand All @@ -71,13 +65,32 @@
</div>
</div>
<div class="row">
<div v-if="siteTypes.length > 0" class="col">
<div class="form-group">
<label>@Localizer.General["Content type"]</label>
<select v-model="typeId" class="form-control">
<option></option>
<option :value="siteType.id" v-for="siteType in siteTypes">{{ siteType.title }}</option>
</select>
</div>
</div>
<div class="col">
<div class="form-group">
<label>@Localizer.Site["Logo"]</label>
<image-field v-bind:uid="'site_logo_' + id" v-bind:meta="{ placeholder: null }" v-bind:model="logo"></image-field>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label>@Localizer.Site["Hostnames"]</label>
<input v-model="hostnames" type="text" class="form-control">
</div>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="col">
<div class="form-group">
Expand All @@ -86,6 +99,8 @@
</div>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="col">
<div class="form-group">
Expand All @@ -96,15 +111,6 @@
</div>
</div>
</div>
<div v-if="siteTypes.length > 0" class="col">
<div class="form-group">
<label>@Localizer.General["Content type"]</label>
<select v-model="typeId" class="form-control">
<option></option>
<option :value="siteType.id" v-for="siteType in siteTypes">{{ siteType.title }}</option>
</select>
</div>
</div>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions core/Piranha.Manager/assets/dist/css/full.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions core/Piranha.Manager/assets/dist/css/slim.min.css

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion core/Piranha.Manager/assets/dist/js/piranha.siteedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ piranha.siteedit = new Vue({
fetch(piranha.baseUrl + "manager/api/site/content/" + id)
.then(function (response) { return response.json(); })
.then(function (result) {
self.regions = result.regions;
if (result.status !== 404) {
console.log("Setting regions");
self.regions = result.regions;
} else {
console.log("Setting regions to empty array");
self.regions = [];
}
})
.catch(function (error) { console.log("error:", error ); });
},
Expand Down Expand Up @@ -130,6 +136,9 @@ piranha.siteedit = new Vue({
console.log("error:", error );
});
} else {
// Push status to notification hub
piranha.notifications.push(result);

$("#siteedit").modal("hide");
if (self.callback)
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion core/Piranha.Manager/assets/src/js/piranha.siteedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ piranha.siteedit = new Vue({
fetch(piranha.baseUrl + "manager/api/site/content/" + id)
.then(function (response) { return response.json(); })
.then(function (result) {
self.regions = result.regions;
if (result.status !== 404) {
console.log("Setting regions");
self.regions = result.regions;
} else {
console.log("Setting regions to empty array");
self.regions = [];
}
})
.catch(function (error) { console.log("error:", error ); });
},
Expand Down Expand Up @@ -130,6 +136,9 @@ piranha.siteedit = new Vue({
console.log("error:", error );
});
} else {
// Push status to notification hub
piranha.notifications.push(result);

$("#siteedit").modal("hide");
if (self.callback)
{
Expand Down
5 changes: 4 additions & 1 deletion core/Piranha.Manager/assets/src/scss/inc/_fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@
padding: .4rem 1rem;
margin-right: 1rem;
border: solid 1px $gray-400;

white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

span {
display: block;
white-space: nowrap;
Expand Down
6 changes: 5 additions & 1 deletion core/Piranha.Manager/assets/src/scss/inc/_general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ div.pre-release {
text-transform: uppercase;
font-weight: bold;
font-size: .8rem;
}
}

.dimmed {
opacity: .6;
}

0 comments on commit 77dd5b1

Please sign in to comment.