Grails Form Select Options - forms

The "select" form component in grails can have the form:
<g:select name="user.age" from="${0..59}" value="${age}" noSelection="['':'-All-']"/>
But if I need to add other options aside from the numbers, how would I do that (example options are: 0..59, All, "/5", "/10", etc,...)
Thanks

<g:select from="${(0..59) + [ "All", "/5", "/10"]}" ... />
how about this?

Related

how can I add phone "tel" link in shortcode

Im challanged with adding a "tel" link in a shortcode. I have tried several ways and I have not succeeded.
Here is a sample of the current code:
[vc_custom_heading text="(123) 456-7890" font_container="tag:p|font_size:22px|text_align:left|color:#326496|line_height:26px" use_theme_fonts="yes" font_weight="600" link="url:tel:1234567890|title:Phone Number" el_class="ms-0 ms-lg-4 mr-md-0 ps-3 ps-md-1 mb-0 d-none d-md-block"]
Thank You,
Gary
Solved. See code below.
[porto_info_box pos="top" icon_type="porto" read_more="box" icon_size="55" icon_border_radius="500" title="Phone Number" subtitle="(123) 456-7890" title_font_style="700" subtitle_font_style="300" icon_porto="porto-icon-tablet" icon_color="#3296c8" title_font_size="1.5em" title_font_color="#ffffff" subtitle_font_size="1.2em" subtitle_font_color="rgba(255,255,255,0.5)" icon_margin_bottom="16px" title_margin_bottom="1px" sub_title_margin_bottom="0px" el_class="p-b-lg mb-5" link="url:tel%3A1234567890"]

HTL AEM conditional OR operator issue

I want to be able to use the "||" OR operator in this context
inside a schema, i have two dates I need to pull from the JCR content if the value in the field has not been the author
<script type="application/ld+json" >
"datePublished": "${properties.datePublishedArticle #context="html" ||'yyyy-MM-dd' # format=currentPage.lastModified }",
"dateModified": "${properties.dateModifiedArticle # context="html" || 'yyyy-MM-dd' # format=currentPage.lastModified}"
</script>
org.apache.sling.api.scripting.ScriptEvaluationException:
mismatched input '#' expecting {'}', '.', 'in', '&&', '||', ',', '['} in line 67 where datepublished is located.
In order words, if author has not authored a value, it will take the value from the jcr content. They work fine when done separately.
Do not understand the error that is indicating.
Have you tried to use it like this:
<script type="application/ld+json" >
"datePublished": "${properties.datePublishedArticle ||'yyyy-MM-dd' # context="html", format = currentPage.lastModified }",
"dateModified": "${properties.dateModifiedArticle || 'yyyy-MM-dd' # context="html", format = currentPage.lastModified}"
</script>
I would think that the error is happening because you shouldn't be repeating the '#' block in the same HTL statement.
Although #atgar's solution does not throw an error, I think it does not do what the author asked for: output either the authored date or the JCR (lastModified) date.
Something like this would be closer to what he needs:
<script type="application/ld+json" >
"datePublished": "${'yyyy-MM-dd' # context='html', format = (properties.datePublishedArticle ? properties.datePublishedArticle : currentPage.lastModified) }",
"dateModified": "${'yyyy-MM-dd' # context='html', format = (properties.dateModifiedArticle ? properties.dateModifiedArticle : currentPage.lastModified)}"
</script>
Please note, when using HTL date formatting, the actual values should be in the format option.

Any way to set PrimaryHeader from codebehind in ShieldUi BarChart

I am using the asp.net version of shieldui for charts and have a barchart and would like to set the primaryHeader or secondaryHeader with data from the database. I searched the documentation page of shieldui website and could not find anything.
What I tried is something like this:
<shield:ShieldChart ID="ShieldChart1" Width="100%" Height="200px" runat="server"
OnTakeDataSource="ShieldChart1_TakeDataSource"
CssClass="chart">
<PrimaryHeader Text=" ">
<Style Bold="true" FontSize="30px" />
</PrimaryHeader>
<SecondaryHeader Text="<asp:Label id="CardInvoiced" runat="server"/> ">
</SecondaryHeader>
<ExportOptions AllowExportToImage="false" AllowPrint="false" />
<Axes>
<shield:ChartAxisX
CategoricalValuesField="Area">
</shield:ChartAxisX>
<shield:ChartAxisY>
</shield:ChartAxisY>
</Axes>
<DataSeries>
<shield:ChartBarSeries DataFieldY="Sales" CollectionAlias="signups">
</shield:ChartBarSeries>
<shield:ChartBarSeries DataFieldY="Starts" CollectionAlias="starts">
</shield:ChartBarSeries>
<shield:ChartBarSeries DataFieldY="bis" CollectionAlias="bis">
</shield:ChartBarSeries>
<shield:ChartBarSeries DataFieldY="comps" CollectionAlias="comps">
</shield:ChartBarSeries>
</DataSeries>
</shield:ShieldChart>
ShieldUI error is:
Type 'Shield.Web.UI.ShieldChart' does not have a public property named 'Label'.
Any suggestion on how to accomplish this?
I solved this and here is how you set both PrimaryHeader and SecondaryHeader in ShieldUi graphs:
ShieldChartFSS7R.PrimaryHeader.Text = "Test Primary Header";
ShieldChartFSS7R.SecondaryHeader.Text = "Test Secondary Header";
Which shows the headers like this:

Protractor css locator for md-select

I'm new to protractor and need to know how can i get the text i.e. Connections in the below code block. I need to click this "Connections". Anyhelp would be really appreciated. Thanks in advance
<md-option ng-repeat="worksite in vmSplashController.worksites track by $index" id="option_worksite_TRANSFER" ng-value="worksite" tabindex="0" class="ng-scope" role="option" aria-selected="false" value="[object Object]">
<div class="md-text ng-binding">
Connections
</div>
</md-option>
Full code
<md-dialog ng-cloak aria-span="" id="splashDialog" class="asui-popup-container splashContainer">
<form name="splash">
<md-dialog-content class="agentDetails" flex>
</md-dialog-content>
<md-dialog-content class="agentOptions" flex layout="row">
<md-input-container class="md-input-has-placeholder" id="nav_worksite" ng-if="vmSplashController.worksites.length >= 1" flex="50" layout="column">
<label class="select-lable">Worksite</label>
<md-select md-no-ink name="nav_worksite" required ng-model="vmSplashController.worksites.selected" ng-model-options="{trackBy: '$value.locationCode'}" aria-label="Select Worksite" md-container-class="md-select-custom nav-worksite-selectbox" ng-change="vmSplashController.onWorksiteChange(vmSplashController.worksites.selected)">
<md-option ng-repeat="worksite in vmSplashController.worksites track by $index" id="option_worksite_{{worksite.locationCode}}" ng-value="worksite">
{{**Here that Div is being created i.e. Connections along with other two options**}}
</md-option>
</md-select>
</md-input-container>
</md-dialog-content>
<md-dialog-actions layout="row">
<md-button md-no-ink class="md-primary nobg-btn" ng-click="vmSplashController.onConfirm()" ng-disabled="splash.$invalid">
CONFIRM
</md-button>
</md-dialog-actions>
</form>
</md-dialog>
I treid this
element(by.cssContainingText('.option_worksite_TRANSFER > div.md-text', 'Connections')).click();
but getting the below error.
Message:
Failed: No element found using locator: by.cssContainingText(".option_worksite_TRANSFER > div.md-text", "Connections")
First - I'm a bit confused. In example you are trying to select class option_worksite_TRANSFER, but in error message it has an id.
If you are trying to select value from dropdown, try this solution:
https://stackoverflow.com/a/39047319/6331748
Try this using xpath:
element(by.xpath("//div[text()='Connections']")).click();
Try using the below code:
element(by.cssContainingText('[id^="option_worksite"] > div.md-text', 'Connections')).click();
Adding waits:
var EC = protractor.ExpectedConditions;
var ele = element(by.cssContainingText('[id^="option_worksite"] > div.md-text', 'Connections'));
browser.wait(EC.visibilityOf(ele), 5000).then(function(){
ele.click();
});

Selecting a field in Protractor

<hs-details-item>
<hs-label>Location</hs-label>
<hs-value-block>
<hs>
<hs-text-box ng-class="{'disabled': isAmenityPosting }" class="required" input-control="{title:'Location', okCallback:setJobSite, value:jobSiteName,
autocomplete:{ values:getJobSiteList, reload: true }, ss:'location'}">
<i class="icon-room"></i><span hs-placeholder="Select Location" class="ng-binding"></span>
</hs-text-box>
</hs>
<hs>
<!-- ngIf: isBarcodeShow() --><hs-button ng-class="{'disabled': soCreating }" class="barcode-special-btn smaller ng-scope" ng-if="isBarcodeShow()" hs-gesture="{handler:startScan, param: onBarcodeScanCompleted}"><i class="icon-br-code"></i></hs-button><!-- end ngIf: isBarcodeShow() -->
</hs>
</hs-value-block>
</hs-details-item>
Scenario: click on “Location” field...
What would be the best way to come up with a command in Protractor to select "location" field from the above Snippet Code?
Can it be done by not using Xpath?
Multiple options here. A sort of a non-welcomed, but short and readable way, would be to use an XPath expression and check the preceding label:
var locationTextBox = element(by.xpath("//hs-label[. = 'Location']/following::hs-text-box"));
locationTextBox.click();