예제 #1
0
        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
            });
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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>()));
        }
예제 #5
0
 public bool Matches(Type type, ConverterLibrary converter)
 {
     return(AwesomeConfiguration.AwesomeEntities(type));
 }