Is there an Elegant way to use Razor Blade to add TagToolbar()? - 2sxc

Am I missing something obvious? In a 2sxc CSharp View, how can I get the HtmlString output of Edit.TagToolbar(item) in to a Tag using RazorBlade?
#Tag.Div(item.Title).Attr(Edit.TagToolbar(item)) // is there a way to do this?

I'm pretty sure it will work. The docs kind of assume it does: https://razor-blade.net/api/ToSic.Razor.Markup.Tag-1.html#ToSic_Razor_Markup_Tag_1_Attr_System_Object_
...but you may need to ToString() it... try this
#Tag.Div(item.Title).Attr(Edit.TagToolbar(item).ToString())
If this was all that was missing, we'll probably see if we can enhance RazorBlade to make it unnecessary.

Related

Configuration Bundle on eZpublish 5x

I'm new on eZpublish 5x.
I would like change the default pagelayout demo.
It's possible to know how to change de default pagelayout demo and use my new bundle please.
I Have my new bundle, registered properly in kernel.
Thanks Lot
There are multiple way to achieve what you want, and it really depends on you actually. I suggest that you have a look at these ones:
-
https://doc.ezplatform.com/en/1.7/tutorials/platform_beginner/3_customizing_the_general_layout/
- https://symfony.fi/ez-platform-tip/setting-default-pagelayout-for-content-in-ez-platform
Pretty sure that you'll find what you want.
Hope this helps.

The Binding Only Updates After Clicking the Element, Though the String in the Controller Has Already Been Updated (Angular 1.5)

I have an ng-class attribute (that I didn't write on my own). It is bound to a string variable in the controller . It looks like: <some-tag ng-class="'indicator_' + $ctrl.stringValue"></some-tag>.
When the window first load - it contain the correct data, but after the string is updated in the controller - the value in the class attribute only updates after I'm clicking the element (the click will open a list, but I don't think it's relevant).
I've read that the first thing to check in these cases, is that the code is surrounded by a $scope.$apply. It is, cause when I try to add it - I get an error saying "$digest already in progress".
Looking for $ctrl and ng-class info, I read the AngularJS component doc and this site, that gave me some basic background about these subjects.
The thing is, I couldn't find any examples of ng-class with $ctrl. Maybe it's irrelevant, but maybe not :)
Example for an irrelevant question I found in the subject is: Angular ngClass is not updating my classes even though my condition change as expected.
In general, most of the examples I found include curly brackets, which I don't think are relevant in this case, since I'm binding a string (maybe I'm mistaking about it :) ).
I suspect it probably didn't bind it correctly, I just don't know why.
Edit:
After continuing to search the subject, I'm no longer sure it's related to the ng-class (so I edited the title as well). It looks more like a refresh problem.
I'm puzzled as to why the page doesn't refresh, since everywhere I read - they say that the Angular should call the digest function on its own, and I should not interfere.
Edit2:
I'm working with typeScript, and the stringValue is updated via an event from a service. But the string does update - so I'm not sure it is a relevant information to understand the problem, but worth mentioning :)
Problem solved!! :D
All I had to do, is to add $timeout(0) after updating the string in the controller!
The explanation: it was a digest problem, and the reason I couldn't use $scope.$apply(), is because I was trying to do it directly. I needed to do a safe apply, which means - first make sure there's no digest on that scope, and then run apply.
Turns out that an easy way to do it, is to use $timeout(0).
I prepared a plunker with Angular 1.5.7 with a demo of what you described. There doesn't seem to be any problem, or anything special you should do. (I used a different alias for the controller, which is the best practice, but $ctrl works fine as well.)
https://plnkr.co/edit/wCpBQ5?p=preview
const DemoComponent = {
controller: DemoController,
controllerAs: 'demoCtrl',
template: `
<h2 ng-class="'demo_' + demoCtrl.classSuffix">{{ demoCtrl.classSuffix }}</h2>
<button ng-click="demoCtrl.changeClass()">Change Class</button>
`
}
angular.module('myapp', [])
.component('demo', DemoComponent);
It will be very helpful if you can reproduce the issue in plunker and post the link.
Otherwise, I hope you find the answer in this plunker.

Minifying css classes and ids

I want to find some way of automatically minifying classes and ids in a .html-file. The file is created through a series of gulp commands. I've tried the command line application Munch, but it ruins the file since it removes doctype and important comments that I have. Does anyone have any tip on how to do this? The best option would of course be something like this:
.pipe(minifyClassesAndIds({ignoreclasses: ['.this', '.that']})
I hope you understand what I mean.
The only working tool I know is a HTML Muncher.
But, unfortunately now it doesn't work very well and have much of issues.
UPD. Don't sure about which munch you are talking about, is it the same as HTML Muncher?

Pretty dump variable/object in Symfony 2.*?

When developing stuff I need to output the state of some instance in order to inspect it.
While using CakePHP I always had a debug() function which does some kind of var_dump inside a <pre> html element, so the content is readable.
Is something similar in Symfony 2.x too?
exit(\Doctrine\Common\Util\Debug::dump($someVar));
use
\Doctrine\Common\Util\Debug::dump($user);
As of today, one of the best ways to debug in Symfony that I know of is the Ladybug Bundle. Its output is similar to xdebug's, but it has some nice features, like a collapsible tree structure for arays or automatically linking to documentation pages (supporting standard PHP, Doctrine and Symfony).
You can find some great examples of its use on the README.
Now there is a new function in Symfony - dump(), have a look at http://symfony.com/blog/new-in-symfony-2-6-vardumper-component

Source code not properly beautified

Being a new year and all, I thought that I'd start using nicer formatting for my blog on WordPress. I used the following syntax.
[sourcecode language="csharp"]
String controlledData = originalData.Substring(0, 200);
[/sourcecode]
However, the text is all in black. So, I'm hitting the right bb-code but still do something wrong. What?
I tried to follow the advice of this dude.
Try Syntax Highlighter plugin, I use "SyntaxHighlighter Evolved" and it's great and easy.
http://wordpress.org/extend/plugins/syntaxhighlighter/

Resources