berwin9 avatar berwin9 committed 03686df

table creation now functional

Comments (0)

Files changed (15)

 });
 
 app.configure('production', function() {
-  app.use(express.errorHandler());
+  app.se(express.errorHandler());
 });
 
 // Routes
     "jade": ">= 0.0.1",
     "socket.io": ">= 0.8.7",
     "underscore": ">= 1.2.2",
-    "backbone": ">= 0.5.3"
+    "backbone": ">= 0.5.3",
+    "pdfkit": ">= 0.1"
   }
 }

public/css/bootstrap/patterns.less

  * Repeatable UI elements outside the base styles provided from the scaffolding
  * ---------------------------------------------------------------------------- */
 
-
 // TOPBAR
 // ------
 

public/css/bootstrap/scaffolding.less

   > .sidebar {
     float: left;
     width: 300px;
-    overflow: scroll;
-    min-height: 600px;
-    max-height: 600px;
+    overflow-x:hidden;
+    overflow-y: scroll;
+    min-height: 500px;
+    max-height: 500px;
     background-color: @wellColor;
     border-radius: 3px 3px 3px 3px;
     margin-bottom: 20px;
   }
   // TODO in v2: rename this and .popover .content to be more specific
   > .content {
-    margin-left: 360px;
-    min-height: 600px;
+    /*margin-left: 360px;*/
+    overflow-x:hidden;
+    overflow-y: scroll;
+    min-height: 500px;
+    max-height: 500px;
     background-color: @wellColor;
     /*border: red 1px dashed;*/
     border-radius: 3px 3px 3px 3px;

public/css/style.css

-body {
-  padding: 50px;
-  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
-}
 
-a {
-  color: #00B7FF;
-}

public/js/main.js

 require.config({
   paths: {
     order: 'libs/require/order.min',
-    //jquery: 'libs/jquery/jquery-1.7.1.min',
+    jquery: 'libs/jquery/jquery-1.7.1.min',
     //: firebug causes firefox to hang when using local jquery.min
     //: use jquery cdn instead during development
-    jquery: 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min',
+    //jquery: 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min',
     jqueryui: 'libs/jquery/jquery-ui-1.8.17.custom.min',
     underscore: 'libs/underscore/underscore.min',
     backbone: 'libs/backbone/backbone.min',

public/js/router.js

 
   var Router = Backbone.Router.extend({
     routes: {
-      '/': ''
+      '/documentizr' : 'editor',
+      '/print-preview': 'printPreview'
     },
 
     initialize: function() {
-      console.log('test');
-      app = new DocumentizrView({ el: 'div#documentizr' });
+      _.bindAll(this, 'editor', 'printPreview');
+      this.app = new DocumentizrView({ el: 'body#documentizr' });
+    },
+
+    editor: function() {
+      $(this.app.el).children().show();
+      $(this.app.print.el).hide();
+    },
+
+    printPreview: function() {
+      $(this.app.el).children().hide();
+      $(this.app.print.el).show();
     }
 
   });

public/js/views/DocumentizrView.js

   var SegmentsCollection = require('collections/SegmentsCollection');
   var ReportPanelView = require('views/ReportPanelView');
   var ControlPanelView = require('views/ControlPanelView');
+  var PrintView = require('views/PrintView');
 
   var DocumentizrView = Backbone.View.extend({
+    events: {
+      'click #start-app': 'render'
+    },
+
     initialize: function() {
       _.bindAll(this, 'render');
       this.segments = new SegmentsCollection();
       this.control = new ControlPanelView({
-        el: 'div#control-panel',
+        tagName: 'div',
+        id: 'control-panel',
+        className: 'sidebar',
         collection: this.segments
       });
       this.report = new ReportPanelView({
-        el: 'div#report-panel',
+        tagName: 'div',
+        id: 'report-panel',
+        className: 'content',
         collection: this.segments
       });
+      this.print = new PrintView({
+        taqName: 'div',
+        id: 'print-panel',
+        collection: this.report.reports
+      });
+      $(this.print.el).hide();
+      $(this.control.el).hide();
+      $(this.report.el).hide();
       this.segments.fetch({ success: this.control.render });
       this.report.render();
+      this.print.render();
     },
 
     render: function() {
-      return this;
+      $(this.el).append(this.print.el);
+      $(this.el).find('#div-start').remove();
+      $(this.el).children('#main-panel').before('<div class="well"><a href="/#/print-preview" class="btn primary">print preview</a></div>');
+      $(this.el).children('#main-panel').append($(this.control.el).show());
+      $(this.el).children('#main-panel').append($(this.report.el).show());
+      return this;    
     }
   });
   return DocumentizrView;

public/js/views/ElementReportView.js

   var Backbone = require('backbone');
 
   var ElementReportView = Backbone.View.extend({
+    tagName: 'tr',
     initialize: function(options) {
       _.bindAll(this, 'render');
+      $(this.el).attr('contentEditable', 'true');
     },
 
     render: function() {
-      $(this.el).append('<h5>' + this.model.get('segment') +
-                        this.model.get('ref') + '</h5>');
+      var elem = this.model.get('ref').length > 1 ?
+        this.model.get('ref') : '0' + this.model.get('ref');
+      $(this.el).append('<td>' + this.model.get('segment') + elem +
+        '</td><td>' + this.model.get('element_name') + 
+        '</td><td>' + this.model.get('elem_type') +
+        '</td><td>' + this.model.get('req_des') + '</td>');
       return this;
     }
 

public/js/views/ReportPanelView.js

   var Backbone = require('backbone');
 
   var SegmentReportView = require('views/SegmentReportView');
+  var PageView = require('views/PageView');
 
   var ReportPanelView = Backbone.View.extend({
     initialize: function(options) {

public/js/views/SegmentControlView.js

     },
 
     render: function() {
-      $(this.el).append('<h3 class="seg-name">' +
-                        this.model.get('segment') + '</h3>');
+      $(this.el).append(
+        '<h3 class="seg-name">' + this.model.get('segment') + 
+        ' <small>table: ' + this.model.get('doc_table') + 
+        ' pos: ' + this.model.get('pos_no') + '</small></h3>'
+      );
       return this;
-    },
-
-    renderReport: function() {
-
     }
   });
   return SegmentControlView;

public/js/views/SegmentReportView.js

   var ElementReportView = require('views/ElementReportView');
 
   var SegmentReportView = Backbone.View.extend({
+    className: 'segment row',
+    template: [
+      '<div class="span12">',
+      '<table class="condensed-table">',
+      '<tbody class="table-body"></tbody>',
+      '</table>',
+      '</div>'
+    ],
     initialize: function(options) {
       _.bindAll(this, 'render', 'addOne', 'addAll');
       this.elements = options.collection || new ElementsCollection();
-    },
-
-    render: function() {
+      $(this.el).attr('id', this.model.cid);
       this.elements.fetch({
         success: this.addAll,
         data: { name: this.model.get('segment') }
       });
+
+    },
+
+    render: function() {
+      $(this.el).empty();
+      $(this.el).append(this.template.join(''));
+      this.addAll();
       return this;
     },
 
     addOne: function(model) {
-      console.log(model);
       var view = new ElementReportView({ model: model });
       view.render();
-      $(this.el).append(view.el);
+      $(this.el).find('.table-body').append(view.el);
     },
 
     addAll: function() {
   });
 };
 
+exports.pdfier = function(req, res) {
+
+};
+
 exports.segments = function(req, res) {
   var db = pg.connect(process.env.DATABASE_URL || conString, function(err, client) {
     var query = client.query('SELECT * FROM "EDIDocDef"');
 exports.elements = function(req, res) {
   if (req.query.name) {
     var db = pg.connect(process.env.DATABASE_URL || conString, function(err, client) {
-      var query = client.query('SELECT * FROM "EDISegDef" WHERE segment = $1 ORDER BY ref', [req.query.name]);
+      var query = client.query('SELECT * FROM "SegElemDef" WHERE segment = $1 ORDER BY ref', [req.query.name]);
       var results = [];
 
       query.on('row', function(row) {
-body
+body#documentizr
   include header
-  div#documentizr.container-fluid
-    div#control-panel.sidebar
-    div#report-panel.content
+  div#div-start.actions
+    a#start-app.btn.large.primary(href='/#/documentizr') start app
+  div#main-panel.container-fluid
   block footer

views/layout.jade

     //HTML5 shim, for IE 6-8 support of HTML elements
     //if lt IE 9
       script(src="http://html5shim.googlecode.com/svn/trunk/html5.js")
-    link(rel="stylesheet/less", href="/css/bootstrap/bootstrap.less")
+    //- link(rel="stylesheet/less", href="/css/bootstrap/bootstrap.less")
+    link(rel="stylesheet", href="/css/bootstrap.css");
     block extra-css
     
-    script(type="text/javascript", src="/js/libs/less/less.min.js")
+    //- script(type="text/javascript", src="/js/libs/less/less.min.js")
     script(data-main="js/main", src="js/libs/require/require.min.js")
     
     body!= body
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.