I want to use the following syntax to define a property attribute in a camel context like this:
<aggregate prop:completionSize="my.property" completionTimeout="1500" strategyRef=MyAggregationStrategy">
....
</aggregate>
and I cannot find anymore the schema xmlns:prop="http://camel.apache.org/schema/placeholder
How can I solve this problem?
Related
I'm pretty new in CSHTML. But i would like to ask if it is possible to do following. I have some Sitecore field and in cshtml i am using it like
#Html.Sitecore.Field('field')
Then i am using something like this in same cshtml but it is angular
{{value}}
Point is that it may change positioning in sitecore (based on words) so we have something like this {0} that i need to replace with angular value then.
is it possible to do something like following ? :
#Html.Sitecore.Field('field').ToString().Replace('{0}',{{value}})
Thanks a lot
Actually it worked in this way :
#Html.Raw(#Html.Sitecore().Field("Field").ToString().Replace("{0}", "{{value}}"))
I needed to put it into #Html.Raw() and change it to string with ToString()
I've been looking over the Angular Schema Form documentation to be able to apply attributes to the elements generated at: https://github.com/Textalk/angular-schema-form/blob/development/docs/index.md
Have been looking up and down and have found nothing. I see through defining the schema that you can define custom HTML classes:
htmlClass: "street foobar", // CSS Class(es) to be added to the container div
fieldHtmlClass: "street" // CSS Class(es) to be added to field input (or similar)
labelHtmlClass: "street" // CSS Class(es) to be added to the label of the field (or similar)
But, haven't been able to find where I can apply attributes like the data attribute or an attribute specific to the element itself. Any resources in regards to this type of basic functionality you'd expect from form generation?
Any ideas?
Thanks!
I do not think this is possible to do purely through json schema definitions, you would have to extend Schema Form and provide your own HTML template with your custom attributes. I've had this problem myself and have had to do the very same.
I'm sure you've seen this but here's the docs on extending:
https://github.com/json-schema-form/angular-schema-form/blob/master/docs/extending.md
I tried to work with the camel's remove header which works for some and does not work for other patterns
It works for the below patterns
<removeHeaders pattern="*" />
<removeHeaders pattern="CamelFile*" />
It does not work for
<removeHeaders pattern="*File*" />
Is the above expected?
Also in the exclude pattern I observe that the wildcard patterns * is not recognised at all.
<setHeader headerName="firstCustomHeader">
<constant>firstCustomHeader</constant>
</setHeader>
<setHeader headerName="secondCustomHeader">
<constant>secondCustomHeader</constant>
</setHeader>
<setHeader headerName="thirdCustomHeader">
<constant>thirdCustomHeader</constant>
</setHeader>
<setHeader headerName="fourthCustomHeader">
<constant>fourthCustomHeader</constant>
</setHeader>
<removeHeaders pattern="*" excludePattern="fourth*|third*" />
the above removes all the header but does excludes the excludePattern value
How do I achieve the relevant above mentioned pattern?
Camel Version 2.13.1
You could accomplish the removeHeaders **File** using the following pattern:
pattern="\w+File\w+"
Similarly, your excludePattern can also be achieved using:
excludePattern="fourth\w+|third\w+"
These are basically regular expressions that can be tested here.
Yes either use a regular expression or use a single * in the end as
wildcard. So *File* is not valid, as it has two *, and therefore Camel assumes its a regular expression.
So you should do a regular expression
pattern=".*File.*"
Where as if you have only one * its a shorthand for matching wildcards, but the * must be only once and at the end of the line, such as
pattern="File*"
The syntax is documented here
http://camel.apache.org/intercept
I have created Joomla module and added a custom field type at the parameter configuration in the backend, using the .xml file like this:
<fields name="params">
<fieldset
addfieldpath="/modules/<module_name>/fields" name="basic">
<field name="articles" type="articles" label="label" />
.
.
.
</fields>
That is working pretty fine but there is on question left over: How can I access the module's id inside the custom field class, when invoked to create the fields html?
Thanks in ahead!
UPDATE
I digged a bit deeper in that found the JModuleHelper::getModule($type, $name) method, which returns either the first module of the given $type if no $name is specified, or the module of the given $type having the $name, but since it is possible to create Modules with the same name, this approach is kind of ugly.
The solution is hidden in the URL and in case of Joomla, in JInput. Complete and more verbose explanation is here (a the bottom), but in short:
URL of a modules edit screen:
index.php?option=com_modules&view=module&layout=edit&id=87
Would be too easy to just use this…
I have implemented a remote validation directive which queries a specified JSON API endpoint once an input is blurred. It expects the response { valid: true|false }.
I now have to extend it to allow for it to send a request involving multiple values from the parent scope.
My tag definition looks as follows:
<input remote-validate endpoint="/api/action/:value" ng-model="MyInput" />
where :value is substituted with a urlencoded value of $scope.MyInput.
This is working well.
What I require is given an endpoint like this /api/action/:value/:person/:thing, the :person and :thing substitutions are bound to the parent scope values.
My initial thought is to have a bindings attribute which maps the parent scope to the endpoint.
<input remote-validate endpoint="/api/action/:value/:person/:thing" bindings="{person: 'firstName', thing: 'thingName'}" ng-model="MyInput" />
(...)
<input ng-model="firstName" /> <input ng-model="thingName" />
given var bindings = scope.$eval(attrs.bindings); is there any way to loop through the bindings object and create a two way binding to the parent scope?
EDIT: A workaround may be to do this:
<input validate-remotely
endpoint="api/action/:value/:param1/:param2"
param1="person"
param2="thing" />
which obviously means I can only use the number of parameters I specify in the scope definition. Which is a good work around for me here. Would be nice to know if there was a way to create these bindings dynamically at compile/link time.
I can provide a fiddle but I don't have the time right now, so I'm hoping that someone will have a good idea if/how this is possible.
As I learned yesterday, you can use $parse on your 'binding' attributes. See this post. This is a good way to $watch an attribute for changes that come from parent or children
Example:
<div parse-test bindings="{person: 'firstName', thing: 'thingName'}"></div>
// in your directive link function:
scope.bindings = $parse(attrs.bindings)(scope);
scope.$watch('bindings', function(val){
for (i in scope.bindings){
scope[i] = scope.bindings[i];
}
}, true);
Experiment with this plunk
This is how I solved it in a not so ideal way.
See this plunker, which has a copy of the directive I use live and works well in my app but doesn't work in Plunker (I expect the randomly chosen plunker api endpoint to be called and fail, but it is not called due to some strange errors I don't care to debug).
The problem I had with the proposed workaround in the EDIT of this question is that it seems you cannot use scope and require in the same directive. I would love it if someone could elaborate on if this is the case and why.
The Workaround
I used a params attribute to specify additional data in object notation to be extended to go to the resource request. I used the handlebars syntax in the params attribute to dynamically change the object notation string.
<input ng-model="value2" ... />
<input validate-remotely
endpoint="/api/:value/?thing=:anotherValue"
params="{ anotherValue: '{{ value2 }}' }" ... />
Not so great :/ but it works.
Then on blur of the validated input, I re-$eval the object string (app.js:40 in the plunker) and extend the resources data to include this object, which using ngResources colon (:) notation, replaces the URL.
The validation has 3 states:
remoteValidityPending: field validation fails because it is still being checked - good for showing a spinner.
remoteValidityUnchecked: The field has changed since it has been checked but has not yet blurred - ensures that any `ng-disable="form.$invalid"' submit buttons stay disabled until we know that the backend has returned a response.
remoteValidity: If this passes, the fields endpoint has been called and '{valid: true}' has been returned from the server.
I'm almost certain there are better/different ways to solve this, and I'll be happy to change the answer if someone improves this directive. I hope this helps someone out there.