This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Umbraco.Core | |
@using uComponents.DataTypes.UrlPicker.Dto | |
@{ | |
//var items = Model.resourceLinks.Items as List<UrlPickerState>; | |
var items = new List<UrlPickerState> | |
{ | |
new UrlPickerState { Title = "Link1" }, | |
new UrlPickerState { Title = "Link2" }, | |
new UrlPickerState { Title = "Link3" }, | |
new UrlPickerState { Title = "Link4" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SearchTable : ApplicationEventHandler | |
{ | |
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | |
{ | |
base.ApplicationStarted(umbracoApplication, applicationContext); | |
Umbraco.Core.Services.ContentService.Published += (sender, args) => | |
{ | |
foreach (var content in args.PublishedEntities) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyApplication : Umbraco.Web.UmbracoApplication | |
{ | |
protected override void OnApplicationStarted(object sender, EventArgs e) | |
{ | |
umbracoPage.Init += (p, args) => | |
{ | |
var page = p as umbracoPage; | |
if (page == null) | |
return; | |
var request = page.Page.Request; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Global : UmbracoApplication | |
{ | |
protected override void OnApplicationStarting(object sender, EventArgs e) | |
{ | |
base.OnApplicationStarting(sender, e); | |
DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(ListingPageController)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* From web.config or some other config place */ | |
<add key="CreateContentSortOrder" value="Content page,Section page,some other page type name" /> | |
/* In /umbraco/create/content.ascx - put the code in the bottom */ | |
<% | |
var createContentSortOrder = ConfigurationManager.AppSettings["CreateContentSortOrder"]; | |
if (!String.IsNullOrWhiteSpace(createContentSortOrder)) | |
{ %> | |
<script type="text/javascript"> | |
$(function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Typed | |
var ids = Model.Content.GetPropertyValue<string>("mNTP", true, "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries); | |
var items = Umbraco.TypedContent(ids); | |
// Dynamic | |
@if (CurrentPage.HasValue("mNTP", true)) | |
{ | |
var ids = CurrentPage._mNTP.Split(','); | |
var items = Umbraco.Content(ids); | |
foreach (var item in items) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It's properly more correct to search on NodeTypeAlias (or DocumentTypeAlias as it's called in the new API) | |
var criteria = ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria().NodeTypeAlias("Testimonial").Compile(); | |
var testimonials = Model.Content.AncestorOrSelf(1) | |
.Sibling("Repository") | |
.Search(criteria); | |
// Or perhaps even just this, no traversing is need, performance should be the same, as nodes in Lucene aren't hierarchically stored | |
var criteria = ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria().NodeTypeAlias("Testimonial").Compile(); | |
var testimonials = Model.Content.Search(criteria); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
var root = Model.Content.AncestorOrSelf(1); | |
var repository = root.Sibling("Repository"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IBaseItem | |
{ | |
int Id { get; set; } | |
string Name { get; set; } | |
} | |
public class ItemsIndex : AbstractIndexCreationTask<IBaseItem> | |
{ | |
public ItemsIndex() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private HttpContext _context; | |
public void ProcessRequest(HttpContext context) | |
{ | |
_context = context; | |
context.Response.ContentType = "text/plain"; | |
context.Response.Buffer = false; | |
foreach (var d in Document.GetRootDocuments()) |