In this presentation, I will use NodeJS, Express, Jade, coffee-script, and Twitter's Bootstrap to construct a simple list report generator that page breaks on every item. We will pretend that the SharePoint 2010 data is a custom list with three required columns and two optional columns that may not contain data: Title (string), Content (rich text), and Feedback (rich text), TextArea1, TextArea2. The last two are obviously the optional columns.
Imagine that this custom list contains a lot of text in each column. Viewing this in SharePoint would show it as a grid, with each associated property listed horizontally (think spreadsheet). There would be much scrolling or resizing of the browser. Why cant we view this data like a book or a white paper? That is what I intend to accomplish in this presentation.
First of all, you'll need to pick up all the tools. I am using Node 0.8.3 with the following modules: Express (3.0.0beta7), Jade (0.27.0), coffee-script (1.3.3), and request (2.9.203). All of the modules are on npm. See here for instructions on running coffee-script from the command line.
Next, pick up the latest bootstrap and its javascript plugins. Finally go get jQuery.
$ mkdir reportGenerator
$ cd reportGenerator
$ mkdir public routes views
Now that we have our public folder, lets put the client side stuff in there.
$ mv ~/Downloads/bootstrap ./public
$ mv ~/Downloads/jQuery.min.js ./public/bootstrap/js
Lets setup our web server.
$ vim app.coffee
Now we need to create the route app.coffee depends on.
$ vim ./routes/index.coffee
Cool. So this route renders a Jade template. Lets make the layout and index templates.
$ vim ./views/layout.jade
$ vim ./views/index.jade
Now that the templates are done, we are ready to rock. Start it up
$ coffee app.coffee
Print to PDF. Look at that! A nice report generated with page breaks on each main topic (item) based on SharePoint 2010 data in a simple yet expressive way.
No comments:
Post a Comment