Customization of Display Templates
A server system enables users to configure user interfaces. A generic presentation string is stored at a data storage system. The generic presentation string is renderable to present an unfilled template that may include one or more slots. A template module is generated from the generic presentation string. The generic presentation string specifies a transformation operation. A template execution operation generates presentation strings renderable to present filled templates. In the filled templates, data based on objects belonging to a given type replace the slots of the unfilled template.
1 . A method for enabling users to configure user interfaces, the method comprising:
storing a first generic presentation string, the first generic presentation string being renderable to present a first unfilled template, the first unfilled template including one or more slots;
generating, at a server system, a first template module from the first generic presentation string, the first template module specifying a first template execution operation, the first template execution operation generating presentation strings for content resource objects belonging to a first content resource object type, the presentation strings for the content resource objects belonging to the first content resource object type being renderable to present filled templates,
wherein, in the filled templates, data based on the content resource objects belonging to the first content resource object type replace the one or more slots in the first unfilled template;
sending the first template module to a client application;
sending a dataset to the client application, the dataset including one or more collections of content resource objects belonging to the first content resource object type; and
sending a content generation script to the client application, performance of the content generation script causing the first template execution operation to be performed on the first content resource object.
2 . The method of claim 1 , further comprising: receiving the first generic presentation string from a WYSIWYG editor application.
3 . The method of claim 2 ,
wherein the first template module is a current version of the first template module and the first generic presentation string is a current version of the first generic presentation string; and
wherein the method further comprises:
sending an earlier version of the first generic presentation string to the WYSIWYG editor application prior to receiving the current version of the first generic presentation string from the WYSIWYG editor application, the earlier version of the first generic presentation string defining an earlier version of the first unfilled template; and
replacing an earlier version of the first template module with the current version of the first template module after generating the current version of the first template module.
4 . The method of claim 3 , wherein the earlier version of the first generic presentation string is renderable to produce an earlier version of the first unfilled template, the earlier version of the first unfilled template having a different set of slots than the current version of the first unfilled template.
5 . The method of claim 2 ,
wherein the first generic presentation string conforms to a Hypertext Markup Language (HTML); and
wherein the first template module specifies the first conversion operation as a set of JavaScript instructions.
6 . The method of claim 1 , further comprising:
receiving a request from the client application for a user interface; and
sending base resource data to the client application in response the request, the base resource data comprising the content generation script.
7 . The method of claim 6 , further comprising:
receiving a dataset request from the client application after sending the base resource data to the client application, the dataset request requesting the dataset;
sending the dataset to the client application in response to the dataset request;
receiving a template request from the client application after sending the dataset to the client application, the template request requesting the first template module; and
sending the first template module to the client application in response to the template request.
8 . The method of claim 7 , wherein the method further comprises:
prior to receiving the template request, sending a schema to the client application, the schema specifying allowable content resource object types in the dataset, the schema mapping at least some of the allowable content resource object types to template modules, the schema mapping the first content resource type to the first template module; and
wherein performance of the content generation script causes the first template module to be identified, based on the schema mapping the first content resource object type to the first template module, as corresponding to the first content resource object, performance of the content generation script further causing the first template module to be requested from the server system.
9 . The method of claim 1 , further comprising:
storing, at a data storage system, the first generic presentation string in a generic template file; and
storing, at the data storage system, the first template module in a template module file.
10 . The method of claim 9 ,
wherein the first template module is a current version of the first template module; and
wherein storing the template module file in the first template module comprises replacing an earlier version of the first template module with the current version of the first template module.
11 . The method of claim 1 , further comprising:
storing a second generic presentation string, the second generic presentation string being renderable to present a second unfilled template, the second unfilled template including one or more slots, the slots of the second unfilled template being different than the slots of the first unfilled template;
storing a second template module, the second template module specifying a second template execution operation, the second template execution operation generating presentation strings for content resource objects belonging to a second content resource object type, wherein in filled templates based on the second template module, data based on the content resource objects belonging to the second content resource object type replace the slots of the second unfilled template;
wherein the dataset includes a second content resource object, the second content resource object belonging to the second content resource object type; and
wherein performance of the content generation script causes the second template execution operation to be performed on the second content resource object.
12 . The method of claim 10 , wherein generating the first template module from the first generic presentation string comprises:
parsing the first generic presentation string to locate logical sections within the first generic presentation string;
invoking a transformation and output operation for each of logical section, the transformation and output operation generating an output string, the output operation generating the output string at least in part by transforming the content of the logical sections in the generic presentation string;
writing the output string to the first template module.
13 . The method of claim 1 ,
wherein the first generic presentation string defines sizes and positions of the slots in the first unfilled template, surrounding fixed text, and metadata and information about presentation and template module logic;
wherein the first unfilled template includes fixed text; and
wherein each of the filled templates based on the first template module include the fixed text and rendered data based on the template module logic.
14 . A computing device comprising:
a processing system that reads computer-executable instructions from one or more computer readable media and executes the computer-executable instructions, execution of the computer-executable instructions causing the computing device to:
store a generic presentation string, the generic presentation string conforming to a presentation language, the generic presentation string being renderable to present an unfilled template, the unfilled template including one or more slots;
generate a template module from the generic presentation string, the template module specifying a template execution operation, the template execution operation generating presentation strings for content resource objects belonging to a given content resource object type, the presentation strings generated by the template execution operation conforming to the presentation language, the presentation strings generated by the template execution operation being renderable to present filled templates,
wherein the one or more slots in the unfilled template are replaced in the filled templates with data based on the content resource objects belonging to the given content resource object type;
send base resource data to a client application in response to a resource request from the client application, the resource request comprising a request for a user interface, the base resource data comprising a content generation script; and
send a dataset to the client application, the dataset including a given content resource object, the given cent resource object belonging to the given content resource object type, performance of the content generation script causing the template execution operation to be performed on the given content resource object.
15 . The computing device of claim 14 , wherein the computing device sends the dataset to the client application in response to the resource request.
16 . The computing device of claim 14 ,
wherein execution of the computer-executable instructions by the processing system further causes the computing device to:
send an earlier generic presentation string to an editor application in response to a generic template request from the editor application, the generic template request requesting the generic presentation string, the earlier generic presentation string being an earlier version of the generic presentation string;
receive a save request from the editor application; and
store the current version of the generic presentation string to a data storage system in response to receiving the save request from the editor application.
17 . The computing device of claim 16 , wherein the editor application is a WYSIWYG editor application capable of rendering the generic presentation string to present the unfilled template and to edit the generic presentation string in response to edits to the unfilled template.
18 . The computing device of claim 16 , wherein the generic presentation string is renderable to present a current unfilled template and the earlier generic presentation string is renderable to present an earlier unfilled template, the current unfilled template including one or more slots not present in the earlier unfilled template.
19 . The computing device of claim 16 , wherein the generic presentation string is renderable to present a current unfilled template and the earlier generic presentation string is renderable to present an earlier unfilled template, the current unfilled template including text or an image not present in the earlier unfilled template.
20 . A computer storage medium that stores computer-executable instructions, the computer storage medium not consisting of transitory signals, execution of the computer-executable instructions by a processing system of a computing device causing the computing device to:
send a first version of a generic presentation string to an editor application in response to a request from the editor application for the generic presentation string, the first version of the generic presentation string being renderable by the editor application to present a first unfilled template, the first unfilled template including one or more slots;
receive a save request from the editor application;
store a second version of the generic presentation string to a data storage system in response to receiving the save request from the editor application, the second version of the generic presentation string being renderable to present a second unfilled template, the second unfilled template being different than the first unfilled template;
generate a template module from the second version of the generic presentation string, the template module specifying a template execution operation, the template execution operation generating presentation strings for content resource objects belonging to a given content resource object type, the presentation strings generated by the template execution operation being renderable to present filled templates,
wherein the one or more slots in the second unfilled template are replaced in the filled templates with data based on the content resource objects belonging to the given content resource object type;
send base resource data to a client application in response to a resource request from the client application, the resource request requesting a user interface, the base resource data comprising a content generation script; and
send a dataset to the client application, the dataset including a given content resource object, the given content resource object belonging to the given content resource object type, performance of the content generation script causing the template execution operation to be performed on the given content resource object, thereby generating a presentation string renderable by the client application to present a filled template to a user of the client application.