Skip to content

I may be missing it but is there any code to load a saved reusable ? #429

@hayden-t

Description

@hayden-t

It seems save.php saves it as a file, but i cant see any code to load it, but maybe im missing it,

I tested save.php (though i dont use it) and it saved a html file several levels above my webroot without name or type in the filename.

Here is my ajax code , inspired by existing builder code to load in from database/cms previously saved reusables:

$.get(loadReusablesUrl, function(response){

	if(typeof response === 'object' && response !== null){
		$.each(response, function(key, item){
			
			if(item.type == 'section'){
			
				Vvveb.Sections.add("reusable/"+item.name, {
					name: item.name,
					image: Vvveb.themeBaseUrl + "img/logo.png",
					html: item.html
				});
				
				
				if (Vvveb.SectionsGroup["Reusable"] === undefined) {
					Vvveb.SectionsGroup["Reusable"] = [];
				}
				
				Vvveb.SectionsGroup["Reusable"].push('reusable/'+ item.name);
				Vvveb.Builder.loadSectionGroups();
			
			}else{
			
				Vvveb.Blocks.add("reusable/"+item.name, {
					name: item.name,
					image: Vvveb.themeBaseUrl + "img/logo.png",
					html: item.html
				});
				
				
				if (Vvveb.BlocksGroup["Reusable"] === undefined) {
					Vvveb.BlocksGroup["Reusable"] = [];
				}
				
				Vvveb.BlocksGroup["Reusable"].push('reusable/'+ item.name);
				Vvveb.Builder.loadBlockGroups();
					
			}
		})
	}

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions