How do I add the "View Website" action to a timeline card? - google-mirror-api

As of firmware update XE7, Glass adds a "View Website" action to search results. How do I add this action to my own timeline cards, such that it will open the Glass Browser with an arbitrary URL?

Add the OPEN_URI built-in menu item to your timeline item and the URL to menuItem.payload. The JSON for a timeline item might look like this:
{
"text" : "Hello World!",
"menuItems" : [{
"action" : "OPEN_URI",
"payload" : "http://example.com"
}]
}
You can read more about built-in menu items on the official documentation for this feature.

Related

How to render custom icons (not Office UI Fabric Icons) in INavLink in react application

Am using Nav from office-ui-fabric-react and rendering a Nav bar with icons like here https://learn.microsoft.com/en-us/javascript/api/office-ui-fabric-react/inavlink?view=office-ui-fabric-react-latest#icon. My requirement is to render some custom icon in the Nav bar. The icon property expects a string and am only able to use the icons from here https://uifabricicons.azurewebsites.net/ with thier friendly names,
//Doesn't render icon
{
name: "App details",
url: "http://msn.com",
key: "key1",
target: "_blank"
icon : "SomeURL"(Some custom icon from the project)
}
//renders icon
{
name: "App details",
url: "http://msn.com",
key: "key1",
target: "_blank"
icon : "Documentation"(Any Friendly Name from above list of icons)
}
Requirement : Need to display an icon which is not part of list here https://uifabricicons.azurewebsites.net/
You can try customize how your link looks like using the onRenderLink method
https://developer.microsoft.com/en-us/fluentui#/controls/web/nav

Access individual JSON array item and use for blog post dynamically

I'm building a simple Nuxt JS blog with a blog.json file containing an array of blog posts which contains:
Title (String)
Body (HTML markup)
Creation (Date)
I will attach the format of this shortly. I know how to iterate over each array item and display it on the page, and I also have a basic understanding and some basic experience with dynamic routing in Nuxt JS.
The problem I'm currently facing is I need to be able to access individual array items and use them as blog posts, e.g: pages/blog/_slug where _slug would be the title of a blog post, with hyphens + all lowercase automatically.
I'm wondering how I would access for instance the Winter blog post in my example and be able to go to mysite.com/blog/winter-blog-post using the following JSON format:
{
"blogs": [
{
"title": "Summer blog post",
"body": "<div class=\"post\">My blog content</div>",
"created": "2019-03-14 10:08:00"
}
{
"title": "Winter blog post",
"body": "<div class=\"post\">My blog content</div>",
"created": "2019-03-15 10:08:00"
},
{
"title": "Spring blog post",
"body": "<div class=\"post\">My blog content</div>",
"created": "2019-03-16 10:08:00"
}
]
}
I essentially want to be able to go to mysite.com/blog/winter-blog-post and have it use the content from that particular array item.
I'll assume you have your pages set up correctly and you can reach /blog/_slug, so it really is just a matter of passing the required params and converting them as needed. In blog.vue you would have a list of your posts and a click on something would navigate to the full article. That click event would trigger a method where you can manipulate the title and use it as a param. So if you have a 'Read More...' button you would assign #click="readMore(blog.title)" to that button.
Then in your methods you take the passed 'title' parameter, change it as you want, and trigger the route change.
methods: {
readeMore(title) {
let passedTitle = title.toLowerCase()
passedTitle = passedTitle.replace(" ", "-")
this.$router.push('/blog/' + passedTitle)
}
}
Then in your _slug.vue you take the passed param, change it back and use that to find your article.
export default {
asyncData({params, $axios }) {
let title = params.passedTitle.replace("-", " ")
let oldTitle = title.charAt(0).toUpperCase() + title.slice(1)
// make your query however you do, if with axios...
$axios.get('/posts', {
params: {
title: oldTitle
}
})
//or if its a vuex state item...
//let post = this.$store.state.posts.find((p) => p.title === oldTitle)
return post
},
}

How do I deliver a nested JSON array for content reference with export view display?

I created a product content type with content reference to article(one product to many articles). Then I added field "Content: ID" "Content: Title" and "(field_article: Content) Content: Title" to a new REST export View. "(field_article: Content) Content: Title" come from the relationship "Content referenced from field_article" I added in advance.
I have been working on drupal8.
The output is:
[
{
"nid":"3",
"title":"Product1 title",
"article_title":"Article1 title"
},
{
"nid":"3",
"title":"Product1 title",
"article_title":"Article2 title"
}
]
What I would like to achieve is something like this:
[
{
"nid":"3",[enter image description here][1]
"title":"Product1 title",
"articles":
[
{
"title":"Article1 title"
},
{
"title":"Article2 title"
}
]
}]
From the same question on Drupal Answers.
I've created a very simple module REST Export Nested to support nested JSON using Views Field Views.
After installing "REST Export Nested":
Install and enable Views Field
Views
Create view display of referenced content (Articles in your case) of type "REST export" or "REST export nested"
Add a relationship to the parent entity and contextual filter of parent entity ID
Create a view display of the parent entity of type "REST export
nested"
Add required fields (e.g. "nid", "title")
Add a field of type "Views field" (e.g. "articles"), configure with
the correct View and display and pass "nid" as the contextual filter
The module doesn't depend on Views Field View and may work with other fields which produce a JSON string.

ionic how to display a dropdown of choices on button click

I am just starting with ionic framework, trying to redo an existing bootstrap / angular application to mobile as a hybrid app.
Is there an idiomatic way to do a dropdown menu in ionic? I have searched the ionic website/forums and also googled but no luck. Like bootstrap single button dropdown. I am OK with JavaScript but HTML/CSS is not my cup of tea.
Will appreciate your help.
--EDIT
Thanks TechMa9iac. I am trying to follow that line.
I am trying to make a 2-level dropdown using angular? I have modeled my data like in the ngSelect doc.
$scope.currSel = null;
$scope.metadata = [
{ proc: "Proc-1", board: "Alloc" },
{ proc: "Proc-1", board: "Manager" },
{ proc: "Proc-1", board: "Ops" },
{ proc: "Proc-2", board: "Alloc" },
{ proc: "Proc-2", board: "Manager" },
{ proc: "Proc-3", board: "Alloc" },
{ proc: "Proc-3", board: "Manager" }
];
HTML
<span>{{item.proc}}
<select ng-model="currSel"
ng-options="item.board group by item.proc
for item in metadata">
</select>
I show the proc value separately in html because the select text area shows only board value (the label in select).
when the ng-model in an ng-options is an object, it must be an object reference to one of the value array / dict elements. It cannot be an angular.copy.
Updated plunker

ExtJS Gridpanel

I want to dispaly 'Report' hyperlink on Gridpanel paging toolbar (or Title bar)
how can i do it (click on Report link display window with grid data)
Plz help me
Thanks in advance
How about something very simple like this. (The default object for Toolbar's add method is Button. Have a look at ExtJS API documentation if you want something more fancy.)
gridPanel.getTopToolbar().add({
text:'Visit Stackoverflow.com'
});
Providing a link in the ExtJS GridPanel Titlebar.
I will be creating a button in tools config of the gridpanel, and set its ui config to plain,
also you can write the handler according to your requirements.
Ext.create('Ext.grid.Panel',{
title: 'Demo Grid Panel'
tools: [
{ ui: 'plain',text: 'Open Window', handler : function(){ //link handler}}
]
});

Resources