Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Data Urls and Previewing

$
0
0
Hi @RogroGengu

That's a really cool feature! We're working on the same direction at the moment, and the feature will be available in the next version of C1.
We will have a both ways data routing, so the system could get both data->url, and url->data. The console browser will be synchronized with the data tree in both ways -> clicking on a tree would update the browser view (both pages and data items), and otherwise -> clicking on a link in the browser view would also focus the necessary page/data item in the tree.

We recently added to our dev branch a dependency injection feature for function parameters, so that could be a quick way to both define a url scheme and give the function the necessary data to show (or to preview).
@using DifferentKeyTypes

@inherits RazorFunction

@functions {

    // Will map data url-s to be "<base page url>/{'Id' field}/{'Label' field}
    [FunctionParameter]
    public RoutedData.ByIdAndLabel<String4KeyType> DataModel { get; set; }
}


<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://www.composite.net/ns/function/1.0">
    <head>
    </head>
    <body>

        @if (DataModel.IsDetailView)
        {
            <h1>  @DataModel.Data.MyStringField </h1>
            <div> @DataModel.Data.MyIntField </div>
            <div>  @DataModel.Data.MyDateTimeField </div>
            <br/>
            <a href="@DataModel.ListUrl"> Back to list</a>
        }
        else
        {
            <h1> List of data items: </h1>

            foreach (var item in DataModel.List)
            {
                <div>
                    <a href="@DataModel.DataUrl(item)">
                        @item.MyStringField
                    </a>
                </div>
            }
        }
</body>
</html>
We have a few parameter types to begin with:

RoutedData.IdA<String4KeyType> // <pageUrl>/<Id>
RoutedData.ByLabel<String4KeyType> // <pageUrl>/<Label>
RoutedData.ByIdAndLabel<String4KeyType> // <pageUrl>/<Id>/<Label>

We also introducing support for a "random string" key field types, that will help producing youtube-like urls.

The DataPreview tag seem to be a really good idea.

Otherwise it is work in progress on our side, and don't yet have "~/data(id)" links, but it is also a direction we would like to go in.

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>