I have a module in which I created a custom page with controller and some logic. Works fine. I need that page to function as home page for my site. I found some topics about implementing IHomePageProvider, but that seems to be impossible because I can't find the definition of IHomePageProvider in the Orchard core. So I know there are some topics on this subject, but I didn't manage to find a solution that way, so therefore this question.
That is because it was removed at the same time as the routable part. This is now done using Alias.
When working with Orchard Core (Orchard 2) there is setting with Home Route, which you can specify.
You can set it in your recipe.json file:
{
"name": "settings",
"HomeRoute": {
"Action": "Index",
"Controller": "ControllerName",
"Area": "AreaName"
}
}
or probablly later:
RouteValueDictionary newHomeRouteValue = ...;
var site = await _siteService.GetSiteSettingsAsync();
site.HomeRoute = newHomeRouteValue;
await _siteService.UpdateSiteSettingsAsync(site);
You can define a home Route and Controller associated with this route. Take a look how it's accomplished in the CulturePicker module: HomeRoutes and LocalizableHomeController
Related
I am using swagger-ui-express and swagger-jsdoc for API Documentation of my node app. The point here is that I have two versions of API in my App and I want to document both of them. I have seen that in .NET Core there is an option available to define the specs and choose one from a dropdown in top bar. I am looking for a similar solution
As a dropdown can be seen in top bar I want similar via swagger-ui-express. Is it possible or if anybody has implemented the same for API Versioning?
Looking forward to your responses.
The solution I propose is not specific to API versioning, but you can have a dropdown of URLs the end-user can choose from. According to the docs, you would need to pass a swaggerOptions object:
const swaggerOptions = {
explorer: true,
swaggerOptions: {
urls: [
{
url: 'https://v1/swagger.json',
name: 'v1'
},
{
url: 'https://v2/swagger.json',
name: 'v2'
}
]
}
}
I'm trying to implement an extension that can auto fill all fields in an application website. Currently it works great in main frame, but doesn't work if the fields are in a iframe.
I'm allowing users to either use content script to auto inject JS or click a button to inject JS manually.
The problem I have is my JS is not injecting into iframe even I set allFrames to true, but content script work.
"content_scripts" : [
{
"matches" : ["https://*/my_url/*"],
"js" : ["/auto_fill.js"],
"all_frames": true
}
]
This content scripts work fine, JS is being injected. However,
my_button.addEventListener('click', () => {
chrome.tabs.executeScript(null, {
file : "/auto_fill.js",
allFrames : true
})
});
This executeScript doesn't work, nothing happen.
The iframe I'm trying to work with is kinda a dynamic iframe (where I have to click few buttons to load and navigate to the application site I want)
Do I have to find out the iframe id or tab id in order for this to work, please provide some hints.
Please let me know if I'm not making myself clear.
Thank you so much for your time.
As the comments revealed, the extension is using the activeTab permission without host URL patterns (just as the documentation suggests), but this permission only grants access to the tab's main URL. When an iframe points to a different URL origin, it won't be granted by activeTab, which is an intentional restriction enforced since Chrome 45, see https://crbug.com/826433.
I am developing shopify public app. I just want to know that can I get store home page content for upadte and add new content there.
I am getting all pages details and it contents by using shopify admin API for get page,create page,update page and delete page
like here we use following path for update particular page with page_id
PUT /admin/api/2019-04/pages/#{page_id}.json
{
"page": {
"id": 131092082,
"body_html": "<p>Returns accepted if we receive the items 14 days after purchase.</p>"
}
}
I had details of all static pages but i don't know how to update home page details like this
Can any one please help me that how I can get home page content and update that content using API or refer me any admin API to get this. Thank you
The smart way to do this is as follows. In the theme itself, you can tell when you are on the index page since Shopify renders index.liquid. In there, you can make a callback to your App using the App Proxy. The App then provides custom data as JSON or perhaps even Liquid. So the index page can now render with your App being part of the cycle.
That is probably the best pattern for you to work with for your specifics.
Finally got the solution to update index.liquid page of shopify store as follow
First you have to get themes by following
GET https://shop_domain/admin/api/2019-04/themes.json
This API give you thmes.json which contains all themes details used in this store.
Now you have to get theme_id from theme.json for update particular page by theme_id.
Update asset API for update content of index page
URL for update assets by theme_id
PUT https://shop_domain/admin/api/2019-04/themes/#{theme_id}/assets.json
require body for update API
{
"asset": {
"key": "templates/index.liquid",
"value": "add your content"
}
}
And this will update index page content with your content . It work successfully for me Thank you
How do you use redirection on Acumatica mobile xml or msdl to redirect to an external link?
All I could find is If an action on an Acumatica ERP form provides redirection to an external URL, you can map the action to use it in the mobile app. To do this, you need no additional attributes in the action object. However, the redirect attribute of the tag must be set to True, as shown in the following example.
Thanks
There may be other ways, but from the new T410 course for MSDL in 2018R2, you need to do a couple of steps. (Got this at Acumatica Summit 2018 Web Services course - Lesson 6 in the training guide which should be available soon if not already.)
First, define a new toolbar button on the form for your external link
(This example is for the SO303000 screen)
public PXAction<AR.ARInvoice> TestURL;
[PXButton(CommitChanges=true)]
[PXUIField(DisplayName = "TestURL")]
protected void testURL(){
throw new PXRedirectToUrlException(
"http://www.acumatica.com",
"Redirect:http://www.acumatica.com"
)
}
After publishing your project, go back to the Customization Project in the Mobile Application section to map the button. Add this to the commands section of the page as shown in the following example.
add container "InvoiceSummary" {
add field …
add recordAction "TestURL" {
behavior = Void
redirect = True
}
}
Not sure if this answered your question as you pretty much had the MSDL code listed, so maybe it is a matter of where you placed your code within the mobile definition? In the training class, we placed it inside the container where we wanted the link which then appears on the menu on the mobile app when viewing that container.
thought i was having an error with the folder structure but i think my deployed mvc app isn't picking up the web pages because of the extension.
When I type in the root directory it loads up the index page without the .cshtml.
When i try to use one of the links from that page the url loads without the .cshtml and says
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
if i append it to have .cshtml at the end i get
Server Error in '/' Application.
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /Employee/_ViewEmpDetails.cshtml
Is there some setting i have missed? never deployed one of these before!
EDIT
have tried running
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
but no joy.
EDIT2
my route config in case it has something to do with this:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Treeview", action = "Index", id = UrlParameter.Optional }
);
}
}
The default search paths when MVC looks for a view are these:
~/Areas/AreaName/Views/ControllerName/ViewName.aspx
~/Areas/AreaName/Views/ControllerName/ViewName.ascx
~/Areas/AreaName/Views/Shared/ViewName.aspx
~/Areas/AreaName/Views/Shared/ViewName.ascx
~/Views/ControllerName/ViewName.aspx
~/Views/ControllerName/ViewName.ascx
~/Views/Shared/ViewName.aspx
~/Views/Shared/ViewName.ascx
~/Areas/AreaName/Views/ControllerName/ViewName.cshtml
~/Areas/AreaName/Views/ControllerName/ViewName.vbhtml
~/Areas/AreaName/Views/Shared/ViewName.cshtml
~/Areas/AreaName/Views/Shared/ViewName.vbhtml
~/Views/ControllerName/ViewName.cshtml
~/Views/ControllerName/ViewName.vbhtml
~/Views/Shared/ViewName.cshtml
~/Views/Shared/ViewName.vbhtml
If these will not work for you, you can customize them by extending the WebFormViewEngine and registering it in Global.asax.