Skip to content

Commit

Permalink
Localized labels for image block aspect
Browse files Browse the repository at this point in the history
  • Loading branch information
tidyui committed May 25, 2020
1 parent c6a4946 commit 79dbe2c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/Piranha.Manager/assets/dist/js/piranha.contentedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ Vue.component("image-block", {
}
};
},
template: "\n<div class=\"block-body has-media-picker rounded\" :class=\"{ empty: isEmpty }\">\n <img class=\"rounded\" :src=\"mediaUrl\">\n <div class=\"media-picker\">\n <div class=\"btn-group float-right\">\n <button :id=\"uid + '-aspect'\" class=\"btn btn-info btn-aspect text-center\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n <i v-if=\"model.aspect.value === 0\" class=\"fas fa-cog\"></i>\n <img v-else :src=\"iconUrl\">\n </button>\n <div class=\"dropdown-menu aspect-menu\" :aria-labelledby=\"uid + '-aspect'\">\n <label class=\"mb-0\">Preferred Aspect</label>\n <div class=\"dropdown-divider\"></div>\n <a v-on:click.prevent=\"selectAspect(0)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(0) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-original.svg')\">Original\n </a>\n <a v-on:click.prevent=\"selectAspect(1)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(1) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')\">Landscape\n </a>\n <a v-on:click.prevent=\"selectAspect(2)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(2) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-portrait.svg')\">Portrait\n </a>\n <a v-on:click.prevent=\"selectAspect(3)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(3) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')\">Widescreen\n </a>\n <a v-on:click.prevent=\"selectAspect(4)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(4) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-square.svg')\">Square\n </a>\n </div>\n <button v-on:click.prevent=\"select\" class=\"btn btn-primary text-center\">\n <i class=\"fas fa-plus\"></i>\n </button>\n <button v-on:click.prevent=\"remove\" class=\"btn btn-danger text-center\">\n <i class=\"fas fa-times\"></i>\n </button>\n </div>\n <div class=\"card text-left\">\n <div class=\"card-body\" v-if=\"isEmpty\">\n &nbsp;\n </div>\n <div class=\"card-body\" v-else>\n {{ model.body.media.filename }}\n </div>\n </div>\n </div>\n</div>\n"
template: "\n<div class=\"block-body has-media-picker rounded\" :class=\"{ empty: isEmpty }\">\n <img class=\"rounded\" :src=\"mediaUrl\">\n <div class=\"media-picker\">\n <div class=\"btn-group float-right\">\n <button :id=\"uid + '-aspect'\" class=\"btn btn-info btn-aspect text-center\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n <i v-if=\"model.aspect.value === 0\" class=\"fas fa-cog\"></i>\n <img v-else :src=\"iconUrl\">\n </button>\n <div class=\"dropdown-menu aspect-menu\" :aria-labelledby=\"uid + '-aspect'\">\n <label class=\"mb-0\">{{ piranha.resources.texts.aspectLabel }}</label>\n <div class=\"dropdown-divider\"></div>\n <a v-on:click.prevent=\"selectAspect(0)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(0) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-original.svg')\"><span>{{ piranha.resources.texts.aspectOriginal }}</span>\n </a>\n <a v-on:click.prevent=\"selectAspect(1)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(1) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')\"><span>{{ piranha.resources.texts.aspectLandscape }}</span>\n </a>\n <a v-on:click.prevent=\"selectAspect(2)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(2) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-portrait.svg')\"><span>{{ piranha.resources.texts.aspectPortrait }}</span>\n </a>\n <a v-on:click.prevent=\"selectAspect(3)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(3) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')\"><span>{{ piranha.resources.texts.aspectWidescreen }}</span>\n </a>\n <a v-on:click.prevent=\"selectAspect(4)\" class=\"dropdown-item\" :class=\"{ active: isAspectSelected(4) }\" href=\"#\">\n <img :src=\"piranha.utils.formatUrl('~/manager/assets/img/icons/img-square.svg')\"><span>{{ piranha.resources.texts.aspectSquare }}</span>\n </a>\n </div>\n <button v-on:click.prevent=\"select\" class=\"btn btn-primary text-center\">\n <i class=\"fas fa-plus\"></i>\n </button>\n <button v-on:click.prevent=\"remove\" class=\"btn btn-danger text-center\">\n <i class=\"fas fa-times\"></i>\n </button>\n </div>\n <div class=\"card text-left\">\n <div class=\"card-body\" v-if=\"isEmpty\">\n &nbsp;\n </div>\n <div class=\"card-body\" v-else>\n {{ model.body.media.filename }}\n </div>\n </div>\n </div>\n</div>\n"
});
Vue.component("missing-block", {
props: ["model"],
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
<img v-else :src="iconUrl">
</button>
<div class="dropdown-menu aspect-menu" :aria-labelledby="uid + '-aspect'">
<label class="mb-0">Preferred Aspect</label>
<label class="mb-0">{{ piranha.resources.texts.aspectLabel }}</label>
<div class="dropdown-divider"></div>
<a v-on:click.prevent="selectAspect(0)" class="dropdown-item" :class="{ active: isAspectSelected(0) }" href="#">
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-original.svg')">Original
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-original.svg')"><span>{{ piranha.resources.texts.aspectOriginal }}</span>
</a>
<a v-on:click.prevent="selectAspect(1)" class="dropdown-item" :class="{ active: isAspectSelected(1) }" href="#">
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')">Landscape
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')"><span>{{ piranha.resources.texts.aspectLandscape }}</span>
</a>
<a v-on:click.prevent="selectAspect(2)" class="dropdown-item" :class="{ active: isAspectSelected(2) }" href="#">
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-portrait.svg')">Portrait
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-portrait.svg')"><span>{{ piranha.resources.texts.aspectPortrait }}</span>
</a>
<a v-on:click.prevent="selectAspect(3)" class="dropdown-item" :class="{ active: isAspectSelected(3) }" href="#">
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')">Widescreen
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-landscape.svg')"><span>{{ piranha.resources.texts.aspectWidescreen }}</span>
</a>
<a v-on:click.prevent="selectAspect(4)" class="dropdown-item" :class="{ active: isAspectSelected(4) }" href="#">
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-square.svg')">Square
<img :src="piranha.utils.formatUrl('~/manager/assets/img/icons/img-square.svg')"><span>{{ piranha.resources.texts.aspectSquare }}</span>
</a>
</div>
<button v-on:click.prevent="select" class="btn btn-primary text-center">
Expand Down
2 changes: 1 addition & 1 deletion examples/RazorWeb/Pages/DisplayTemplates/ImageBlock.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@model Piranha.Extend.Blocks.ImageBlock

<div class="block image-block">
<img src="@Url.Content(Model.Body)" alt="@Model.Body.Media.AltText" title="@Model.Body.Media.Title">
<img src="@Url.Content(WebApp.Media.ResizeImage(Model, 920))" alt="@Model.Body.Media.AltText" title="@Model.Body.Media.Title">
</div>

0 comments on commit 79dbe2c

Please sign in to comment.