Orchard CMS parameterized snippet manifest file - orchardcms

When I add this snippet manifest JumbotronSnippet.txt for my JumbotronSnippet.cshtml
DisplayName: Jumbotron
ToolboxIcon: \uf10c
Description: A configurable jumbotron
Category: Bootstrap
Fields:
- Name: Caption
DisplayName: Caption
Description: The caption to display
Type: Text
- Name: Body
DisplayName: Body
Description: The body text to display
Type: Text
Orchard Layout Part does not appear in dashboard.
My JumbotronSnippet.cshtml has this code:
<div class="jumbotron">
<h2>#Model.Caption</h2>
#Html.Raw(Model.Body)
</div>
Am I doing something wrong?

Check snippets feature is enabled
Have you enabled the Layouts Snippets feature in the Modules menu?
It's caught me out a few times because there is a Snippets category for the Shape element but that doesn't mean that Snippets is enabled.
Check you are running the right version
Which version of Orchard are you running? Sipke implemented the first version of the manifest file in 1.10.1 release (current).
I came along and added code to support all the extra fields that you are using but it looks like they haven't graduated to a released version yet, they are in the 1.10.x and dev branches though.
If you're already running 1.10.1 and want these features then you can just drop this file into your project - the only changes made to it are all contained in that file and they will just expand the number of fields supported in the manifest file parser.
Check your manifest formatting
Here is an example one that I'm using in a client project
DisplayName: Facebook Panel
ToolboxIcon: \uf230
Category: Social
Description: Configurable element to display a link to a Facebook page
Fields:
- Name: SocialUrl
Type: Text
DisplayName: Facebook URL
Description: The URL to your Facebook page.
Straight off I am seeing its space space dash space but you have more indentation. I don't recall if the exact number of spaces will break things but the indentation is important.

Related

How can I add a png or svg icon to the navbar of a website?

I'm trying to learn how to create and update a basic website using R-Markdown following this guide: https://www.andreashandel.com/posts/2021-01-11-simple-github-website/index.html#starter-files
By now I've been able to create the HTML documents that I'd need and I've added the connexions between HTML in the navbar (.yml) of my website. In the case of some links, like GitHub or LinkedIn I've been able to add their icons this way:
- icon: fa-github fa-lg
ref: https://github.com/username
The problem is that for some webs there's no fa-lg icon available, so I've downloaded the icon as .png and .svg to add them to the navbar, but it creates an error.
This is the code line I've tried, but I can't get to do it:
- icon: ![](path/to/icon.png)
href: https://orcid.org/
##OR
- image: ![](path/to/icon.png)
href: https://orcid.org/
AND whatching other examples from How to add svg icon to a button with a text
- icon: "https://upload.wikimedia.org/wikipedia/commons/0/06/ORCID_iD.svg"
href: https://orcid.org/
I've recently started to learn R, so this may be a simple thing, but if someone can help me I'd be so grateful.
UPDATE
Following this question's recommendations: How to add a browser tab icon (favicon) for a website?
I've converted my .svg archive to a 32x32 pixels .ico archive, but I still can't insert it into my navbar.

How do you specify Mermaid configuration within Gitlab Markdown?

In Gitlab, I've been able to render an Entity Relationship Diagram with Mermaid in a Markdown file as specified here.
This is the Markdown I used:
```mermaid
erDiagram
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
CUSTOMER ||--o{ ORDER : places
CUSTOMER ||--o{ INVOICE : "liable for"
DELIVERY-ADDRESS ||--o{ ORDER : receives
INVOICE ||--|{ ORDER : covers
ORDER ||--|{ ORDER-ITEM : includes
PRODUCT-CATEGORY ||--|{ PRODUCT : contains
PRODUCT ||--o{ ORDER-ITEM : "ordered in"
```
The mermaid interactive editor provides an example of configuration:
{
"theme": "default"
}
But I don't know where to locate that configuration information. I've tried putting it in the same directory, in a file called config.json or mermaid-config.json, but neither of those have worked. I also tried including it in the Markdown which defined the diagram, which only caused it to render incorrectly. Is there a way to specify the theme or other CSS elements for Gitlab?
Just tried it out and it worked
```mermaid
%%{init: { 'theme':'dark', 'sequence': {'useMaxWidth':false} } }%%
sequenceDiagram
alice ->> mark: Sent a flower
```
Edit: If you are using a recent enough version of GitLab (possibly 13.9.0 from February, 2021, which changes the shipped version of Mermaid from 8.5.2 to 8.9.0) you can use directives, as mentioned in the other answers:
```mermaid
%%{init: { 'logLevel': 'debug', 'theme': 'dark' } }%%
graph LR
%%{config: { 'fontFamily': 'Menlo', 'fontSize': 18, 'fontWeight': 400} }%%
A-->B
```
Note that Mermaid seems to be sensitive to newlines here. If I add a blank line between graph LR and the following %%{config line I get a syntax error.
Original answer for older versions of GitLab:
I don't believe you can, unless you want to self-host and modify the GitLab source code.
The Mermaid.js configuration in GitLab is largely hard-coded. It looks like it uses the neutral theme by default and switches to the dark theme if
the user is using dark or solarizedDark as their web IDE theme, and
if the user is on the IDE web page.
Unfortunately current GitLab uses mermaidjs version 8.5.2 as per merge request
From mermaid 8.6 onward you should be able to use directives to set the theme and/or other settings without touching the hard coded css. For example:
%%{init: { 'theme': 'forest' } }%%
erDiagram
...
I'm afraid we have to wait a little longer, until GitLab updates to this version. You can check in the meantime mermaids doc on the matter. You can includes this already in your markdown, as the %% is interpreted as comments and will not show up in the rendering. But when GitLab makes the move, your pages should immediately update.

Using the Alexa Skills node SDK to display a full screen image on Echo Show

I'm using the Alexa Node SDK to build my application which is hosted on AWS Lambda. When using an Echo Show (or any display-enabled device), I'd like the screen to update with a full-screen image when Alexa responds with audio.
I'm able to do this with the "Standard Card" -- but the image is very small and appears to the right of the spoken text.
Is there any way to remove the text and display the image full screen?
Sample code:
return handlerInput.responseBuilder
.speak('my text')
.withStandardCard('my title', 'my text', 'https://myimage-sm.jpg', 'https://myimage-lg.jpg')
.reprompt('my title', 'my text')
.addElicitSlotDirective('slotname')
.getResponse();
To be clear, I've also tried adding a template with addRenderTemplateDirective, but this throws an error, as Alexa allows only one directive per slot.
No other directives are allowed to be specified with a Dialog directive. The following Dialog Directives were returned: [Display.RenderTemplate]
You can try my project here which uses APL behind the curtains to render the card wit a full background. BTW, the limitation is not one directive per slot, the limitation is that you can't use any dialog related directive with other directives, for example render template directives or APL directives. So if you're going to do dialog management forget about sending display rendering directives for the time being.

Remove teaser from pages

I'm making a website with Hakyll. I successfully created a RSS feed showing showing for each post the teaser section delimited by <!--more-->.
My problem is that this teaser section is shown in the full (templated) pages of these posts. And I would like only that is after <!--more--> and not before.
---
title: My Post
author: JeanJouX
date: 2016-09-06
tags: Haskell
---
The teaser of my post to be shown in the RSS feed. Not in the full page.
<!--more-->
The rest of the post to be shown in the full page of my website
Is it possible to do that with Hakyll?
I don't believe there is a method to do that built into Hakyll.
As I see it you have two options:
write a pass that strips the teaser from the document before rendering it on its own page
keep the teaser in the actual page, but use CSS to hide it
The first option is probably better, but requires mussing about with string manipulation and Hakyll compilers. If you want a place to start, take a look at the implementation of teaserFieldWithSeparator which uses the needlePrefix function from Hakyll.Core.Util.String to extract the teaser from the document body. You'll have to do the opposite: extract everything but the teaser.
If you do take this approach, you could contribute it back into Hakyll, saving the effort for people who want to do the same thing in the future.
The other option is hackier but easier. You can wrap all your teasers in a div with some CSS class:
<div class="teaser">
Some text.
</div>
<!--more-->
Then, in your page template, add a CSS rule that hides the teaser paragraph:
.teaser {
display : none;
}
The text is still in the page's HTML so this is not an ideal solution, but you can make it work without needing to write any Hakyll code.
Maybe it could be easier if you just put this teaser text in a separate metadata field? Like
---
title: My Post
author: JeanJouX
date: 2016-09-06
tags: Haskell
description: The teaser of my post to be shown in the RSS feed. Not in the full page.
---
The rest of the post to be shown in the full page of my website
Then you don't need to make that teaserField any more. You already have all you need in $description$, which you can use in rss, in html meta tags, anywhere.

IBM Connections 4.0 iWidget title attribute not working

I have added a new tab in my profile page of IBM Connections 4.0 by registering it in widgets-config.xml file the tab is successfully added and is working fine but the problem is i want to give some custom name to the tab like "Hello World" i tried adding title attribute to the iWidget xml file but its not working, the server is always picking the defId used in the widgets-config.xml as tab name instead of the title attribute,i also tried adding the name in widgets-config.xml file itself but the space is causing the problem. Any help in this regard is greatly appreciated.below is how the iWidget xml file looks like.
<iw:iwidget name="helloWorld" title="Hello World" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"
iScope="HelloWorldWidgetClass" supportedModes="view">
<iw:resource uri="helloworld.js" />
<iw:content mode="view">
<![CDATA[
<div id="frameHolder" style="width:678px;height:606px;">
<iframe id="testFrame" style="width:inherit;height:inherit;border:none;"></iframe>
</div>
]]>
</iw:content>
Thanks,
Vinay
The wording used in iWidgets 2.1 spec document suggests that the use of the title attribute is not mandatory by the container:
title: This attribute suggests a title that could be used in any decoration (e.g. titlebar) around the iWidget. This item can be set in both the iWidget definition and the microformat placing an iWidget instance on a page.
I suggest opening an IBM Connections PMR to bring this issue to the attention of the development team.
In Connections, the title and descriptions for iwidget are both defined in widget-config.xml by "defId" and "description". You could add NLV support for these 2 string by add "Customizing product strings" to Connections.
Here is a brief steps to do that:
in widget-config.xml
in LotusConnections-config.xml
put your strings file in
/strings/com.xxx.myWidget.properties
/strings/com.xxx.myWidget_en.properties
...
/strings/com.xxx.myWidget_zh.properties
in each of the property file:
myWidget=My widget title
myWidget.desc=My widget description
The detailed steps could be found in Connections product document, but the idea is same, to provide customize string support for 3rd party iwidget.

Resources