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

Temp8 Fix for #4011 #4560

Merged
merged 30 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
988be21
making the grid work in splitview
nielslyngsoe Feb 13, 2019
60fa931
Grid-RTE got a unique ID, which fixes TineMCE code, which is dependen…
nielslyngsoe Feb 13, 2019
13a326b
remove logs
nielslyngsoe Feb 18, 2019
2e40911
get uniq ID by using String.CreateGuid()
nielslyngsoe Feb 18, 2019
44b1a73
clean up css for grid
nielslyngsoe Feb 18, 2019
3f13baa
make Embed and Media work for Grid in SplitView when grid is not allo…
nielslyngsoe Feb 18, 2019
a20fa3d
Merge remote-tracking branch 'origin/temp8' into temp8-4011
bergmania Feb 18, 2019
9f2280d
Merge branch 'temp8' into temp8-4011
Shazwazza Feb 19, 2019
6f67318
corrected color variables
nielslyngsoe Feb 19, 2019
592d8db
removed comment
nielslyngsoe Feb 19, 2019
564117e
Grid editor to use $watch for values that needs to transform for pres…
nielslyngsoe Feb 19, 2019
89903a6
Merge branch 'dev-v8' into temp8-4011
Shazwazza Mar 12, 2019
2bfa81c
fixes 4627 + makes front-end validations appear as soon as they are i…
Shazwazza Mar 26, 2019
080ace9
Bugfix: https://github.com/umbraco/Umbraco-CMS/issues/4827 - Fixed Me…
Shazwazza Mar 26, 2019
4fcf2ce
Fixed issue when creating variant content templates, but the properti…
bergmania Mar 12, 2019
8a56b3d
Fix the "Language" dropdown in the "Culture and Hostnames" dialog
kjac Mar 17, 2019
a70cb51
NuCache: cleanup scoped objects
Feb 22, 2019
13a8548
NuCache: rename things
Feb 22, 2019
c56b886
NuCache: reorg some classes
Feb 22, 2019
7e413ed
NuCache: troubleshooting
Feb 22, 2019
851c844
NuCache: fix panic exception
Mar 14, 2019
dfe6f20
NuCache: better fixing, cleanup
Mar 14, 2019
1eb55a8
Merge branch 'patch-8.0.1' into v8/8.0
Mar 30, 2019
e73cf59
Merge remote-tracking branch 'origin/v8/8.0' into temp8-4011
Shazwazza Apr 1, 2019
043f4f3
Revert "Merge remote-tracking branch 'origin/v8/8.0' into temp8-4011"
Shazwazza Apr 1, 2019
d0d5d37
Merge remote-tracking branch 'origin/v8/dev' into temp8-4011
Shazwazza Apr 1, 2019
b4885f4
fixing bad merge problem
Shazwazza Apr 1, 2019
d58106d
Merge remote-tracking branch 'origin/v8/dev' into temp8-4011
bergmania Apr 2, 2019
76e2f2f
#4011 - Not using a unnecessary function call in views
bergmania Apr 2, 2019
a9f5d3c
#4011 - Use discreet word not disgrete
bergmania Apr 2, 2019
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 @@ -13,7 +13,12 @@ angular.module("umbraco.directives")
// TODO: A lot of the code below should be shared between the grid rte and the normal rte

var promises = [];


//To id the html textarea we need to use the datetime ticks because we can have multiple rte's per a single property alias
// because now we have to support having 2x (maybe more at some stage) content editors being displayed at once. This is because
// we have this mini content editor panel that can be launched with MNTP.
scope.textAreaHtmlId = scope.uniqueId + "_" + String.CreateGuid();

//queue file loading
if (typeof (tinymce) === "undefined") {
promises.push(assetsService.loadJs("lib/tinymce/tinymce.min.js", scope));
Expand All @@ -34,7 +39,7 @@ angular.module("umbraco.directives")
var tinyMceEditor = null;

promises.push(tinyMceService.getTinyMceEditorConfig({
htmlId: scope.uniqueId,
htmlId: scope.textAreaHtmlId,
stylesheets: editorConfig.stylesheets,
toolbar: editorConfig.toolbar,
mode: editorConfig.mode
Expand Down Expand Up @@ -145,17 +150,11 @@ angular.module("umbraco.directives")
}

});

//listen for formSubmitting event (the result is callback used to remove the event subscription)
var formSubmittingListener = scope.$on("formSubmitting", function () {
scope.value = tinyMceEditor ? tinyMceEditor.getContent() : null;
});


//when the element is disposed we need to unsubscribe!
// NOTE: this is very important otherwise if this is part of a modal, the listener still exists because the dom
// element might still be there even after the modal has been hidden.
scope.$on('$destroy', function () {
formSubmittingListener();
eventsService.unsubscribe(tabShownListener);
//ensure we unbind this in case the blur doesn't fire above
$('.umb-panel-body').off('scroll', pinToolbar);
Expand Down
74 changes: 21 additions & 53 deletions src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@
position: relative;
margin-bottom: 40px;
padding-top: 10px;
border: 1px solid @grayLighter;

&:hover {
background-color: @grayLighter;
border-color: @grayLight;
}

&[ng-click],
Expand Down Expand Up @@ -161,15 +162,16 @@
}

.umb-grid .umb-row .umb-cell-placeholder {
min-height: 130px;
background-color: @gray-10;
border-width: 2px;
min-height: 88px;
border-width: 1px;
border-style: dashed;
border-color: @gray-8;
border-color: @ui-action-disgrete-border;
Copy link
Contributor

Choose a reason for hiding this comment

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

This word disgrete is showing up again in quite a few places in this PR. This is also in the main repo too, see https://github.com/umbraco/Umbraco-CMS/search?q=disgrete&unscoped_q=disgrete

Can we fix this up to be discrete (assuming that's what it supposed to be?)

color: @ui-action-disgrete-type;
transition: border-color 100ms linear;

&:hover {
border-color: @blueMid;
border-color: @ui-action-disgrete-border-hover;
color: @ui-action-disgrete-type-hover;
cursor: pointer;
}
}
Expand Down Expand Up @@ -207,9 +209,9 @@
}

.umb-grid .cell-tools-add {
color: @ui-action-type;
color: @ui-action-disgrete-type;
&:focus, &:hover {
color: @ui-action-type-hover;
color: @ui-action-disgrete-type-hover;
text-decoration: none;
}
}
Expand All @@ -219,16 +221,18 @@
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: @ui-action-type;
color: @ui-action-disgrete-type;
}

.umb-grid .cell-tools-add.-bar {
display: block;
background: @gray-10;
text-align: center;
padding: 5px;
border: 1px dashed @gray-7;
border: 1px dashed @ui-action-disgrete-border;
nielslyngsoe marked this conversation as resolved.
Show resolved Hide resolved
margin: 10px;
&:focus, &:hover {
border-color: @ui-action-disgrete-border-hover;
}
}


Expand All @@ -249,7 +253,6 @@

.umb-grid .cell-tools-edit {
display: inline-block;
color: @white;
}

.umb-grid .drop-overlay {
Expand Down Expand Up @@ -412,59 +415,25 @@

// Row states
.umb-grid .umb-row.-active {
background-color: @ui-action-type;
border-color: @ui-action-type;

.umb-row-title-bar {
cursor: move;
}

.row-tool,
.umb-row-title {
color: @white;
}

.umb-grid-has-config {
color: fade(@white, 66);
}

.umb-cell {
.umb-grid-has-config {
color: fade(@black, 44);
}
}

.umb-cell .umb-cell-content {
border-color: transparent;
}
}


.umb-grid .umb-row.-active-child {
background-color: @gray-10;

.umb-row-title-bar {
cursor: inherit;
}

.umb-row-title {
color: @gray-3;
}

.row-tool {
color: fade(@black, 23);
}

.umb-grid-has-config {
color: fade(@black, 44);
}

.umb-cell-content.-placeholder {
border-color: @gray-8;

&:hover {
border-color: fade(@gray, 44);
}
}

}


Expand Down Expand Up @@ -573,14 +542,13 @@
display: inline-block;
cursor: pointer;
border-radius: 200px;
background: @gray-10;
border: 1px solid @gray-7;
border: 1px solid @ui-action-disgrete-border;
margin: 2px;

&:hover, &:hover * {
background: @ui-action-type-hover !important;
background: @ui-action-disgrete-type-hover !important;
color: @white !important;
border-color: @ui-action-type-hover !important;
border-color: @ui-action-disgrete-border-hover !important;
text-decoration: none;
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/Umbraco.Web.UI.Client/src/preview/preview.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,7 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
$scope.exitPreview = function () {

var culture = $location.search().culture || getParameterByName("culture");
var relativeUrl = "/" + $scope.pageId;

if(culture){
relativeUrl +='?culture='+ culture;
}

var relativeUrl = "/" + $scope.pageId +'?culture='+ culture;
window.top.location.href = "../preview/end?redir=" + encodeURIComponent(relativeUrl);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="umb-rte"
id="{{uniqueId}}">
id="{{textAreaHtmlId}}">
</div>
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Grid.EmbedController",
function ($scope, $timeout, $sce, editorService) {

function onInit() {
$scope.trustedValue = null;
$scope.trustedValue = $sce.trustAsHtml($scope.control.value);

if(!$scope.control.value) {
$timeout(function(){
if($scope.control.$initializing){
$scope.setEmbed();
}
}, 200);



function getEmbed() {
return $sce.trustAsHtml($scope.control.value);
}


$scope.embedHtml = getEmbed();
$scope.$watch('control.value', function(newValue, oldValue) {
if(angular.equals(newValue, oldValue)){
return; // simply skip that
}

$scope.embedHtml = getEmbed();
}, false);
$scope.hasEmbed = function() {
return $scope.control.value !== null;
}

$scope.setEmbed = function(){
$scope.setEmbed = function() {
var embed = {
submit: function(model) {
$scope.control.value = model.embed.preview;
$scope.trustedValue = $sce.trustAsHtml(model.embed.preview);
editorService.close();
},
close: function() {
Expand All @@ -28,6 +32,5 @@ angular.module("umbraco")
};
editorService.embed(embed);
};

onInit();

});
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div ng-controller="Umbraco.PropertyEditors.Grid.EmbedController">

<div class="umb-editor-placeholder" ng-click="setEmbed()" ng-if="trustedValue === null">
<div class="umb-editor-placeholder" ng-click="setEmbed()" ng-if="hasEmbed() === false">
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be a function call, it should be control.value !== null, function calls in views are expensive

Copy link
Member

Choose a reason for hiding this comment

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

Turns out, it has to be control.value === null. The hasEmbed is negated.

<i class="icon icon-movie-alt"></i>
<div class="help-text"><localize key="grid_clickToEmbed">Click to embed</localize></div>
</div>

<div ng-if="control.value" ng-bind-html="trustedValue"></div>
<div ng-if="control.value" ng-bind-html="embedHtml"></div>

</div>
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Grid.MediaController",
function ($scope, $timeout, userService, editorService) {



$scope.thumbnailUrl = getThumbnailUrl();


if (!$scope.model.config.startNodeId) {
userService.getCurrentUser().then(function (userData) {
$scope.model.config.startNodeId = userData.startMediaIds.length !== 1 ? -1 : userData.startMediaIds[0];
$scope.model.config.startNodeIsVirtual = userData.startMediaIds.length !== 1;
});
}

function onInit() {
if($scope.control.value){
$scope.setUrl();
}
}


$scope.setImage = function(){
var startNodeId = $scope.model.config && $scope.model.config.startNodeId ? $scope.model.config.startNodeId : undefined;
var startNodeIsVirtual = startNodeId ? $scope.model.config.startNodeIsVirtual : undefined;
Expand All @@ -34,10 +32,8 @@ angular.module("umbraco")
id: selectedImage.id,
udi: selectedImage.udi,
image: selectedImage.image,
altText: selectedImage.altText
};

$scope.setUrl();
caption: selectedImage.altText
};

editorService.close();
},
Expand All @@ -48,10 +44,18 @@ angular.module("umbraco")

editorService.mediaPicker(mediaPicker);
};

$scope.$watch('control.value', function(newValue, oldValue) {
if(angular.equals(newValue, oldValue)){
return; // simply skip that
}

$scope.thumbnailUrl = getThumbnailUrl();
}, true);

function getThumbnailUrl() {

$scope.setUrl = function(){

if($scope.control.value.image){
if($scope.control.value && $scope.control.value.image) {
var url = $scope.control.value.image;

if($scope.control.editor.config && $scope.control.editor.config.size){
Expand All @@ -70,10 +74,10 @@ angular.module("umbraco")
{
url += "?width=800&upscale=false&animationprocessmode=false"
}
$scope.url = url;
return url;
}

return null;
};

onInit();

});
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
<div ng-id="!control.$inserted" class="help-text"><localize key="grid_clickToInsertImage">Click to insert image</localize></div>
</div>

<div ng-if="control.value">
<div ng-if="thumbnailUrl !== null">
<img
ng-if="url"
ng-click="setImage()"
ng-src="{{url}}"
ng-src="{{thumbnailUrl}}"
class="fullSizeImage" />
<input type="text" class="caption" ng-model="control.value.caption" localize="placeholder" placeholder="@grid_placeholderImageCaption" />
</div>
Expand Down
Loading