public AwesomeHtmlConventions() { Profile(AwesomeConfiguration.TagProfile, tags => { tags.Editors.Always.Modify((request, tag) => tag.Attr("name", "Entity" + request.Accessor.FieldName)); tags.UseLabelAndFieldLayout <AwesomeFieldLayout>(); tags.Editors.If(a => AwesomeConfiguration.AwesomeEntities(a.Accessor.PropertyType)) .Modify(tag => tag.Data("seach", "data")); //generic way to wrap up an ID form line tags.Displays.If(AwesomeConfiguration.IdField) .BuildBy(hiddenLabel); tags.Labels.If(AwesomeConfiguration.IdField) .BuildBy(hiddenLabel); tags.Editors.If(AwesomeConfiguration.IdField) .Modify(tag => tag.Attr("type", "hidden")); tags.Labels.Always .Modify(tag => tag.TagName("span")); //id line }); }
public static string DeleteUrlFor(this IFubuPage page, object model) { var editType = typeof(RestfulDeleteRequest <>).MakeGenericType(model.GetType()); var request = Activator.CreateInstance(editType).As <IRequestById>(); request.Id = AwesomeConfiguration.GetIdValue(model); return(page.Urls.UrlFor(request)); }
public static string AwesomeUrlFor(this IFubuPage page, object model, bool isNew) { var editType = typeof(RestfulPatchRequest <>).MakeGenericType(model.GetType()); var request = Activator.CreateInstance(editType).As <IRequestById>(); request.Id = AwesomeConfiguration.GetIdValue(model); return(isNew ? page.Urls.UrlFor(typeof(RestfulCreateHandler <>).MakeGenericType(model.GetType())) : page.Urls.UrlFor(request)); }
public FubuContinuation Execute(RestfulPatchRequest <TEntity> request) { var collection = _session.GetCollection <TEntity>(); // var query = Query.EQ("_id", new BsonObjectId(request.Id)); // var entity = collection.FindOne(query); // // merge(entity, request.Entity); AwesomeConfiguration.SetIdValue(request.Entity, new ObjectId(request.Id)); collection.Save(request.Entity); return(FubuContinuation.RedirectTo(new RestfulIndexRequest <TEntity>())); }
public bool Matches(Type type, ConverterLibrary converter) { return(AwesomeConfiguration.AwesomeEntities(type)); }