Skip to content

Commit

Permalink
convetert refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
withanage committed Dec 19, 2018
1 parent 736b2cb commit df2c1be
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 147 deletions.
4 changes: 4 additions & 0 deletions article/nodes/composite/composite_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ CompositeView.Prototype = function() {
// =============================
//

// Render Markup
// --------
//

this.render = function() {
NodeView.prototype.render.call(this);

Expand Down
2 changes: 1 addition & 1 deletion article/nodes/cover/cover_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var CoverView = function(node, viewFactory) {

CoverView.Prototype = function() {


// Render it
// --------
//
Expand Down Expand Up @@ -85,7 +86,6 @@ CoverView.Prototype = function() {

if (pubInfo) {
var pubDate = pubInfo.published_on;
console.log("pubDate",pubDate);
var articleType = pubInfo.article_type;
if (pubDate) {
var items = [articleUtil.formatDate(pubDate)];
Expand Down
10 changes: 10 additions & 0 deletions article/nodes/footnote/footnote.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ Footnotes

.lens-article .content-node.footnote .content .footnote-urls .url {
padding-right: 20px;
}

.lens-article .content-node.footnote .content .table {

border-collapse: collapse;
width: 100%;
}
.lens-article .content-node.footnote .content .table th, td {
padding: 1px;

}
6 changes: 3 additions & 3 deletions article/nodes/footnote/footnote_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var $$ = require("../../../substance/application").$$;
var NodeView = require("../node").View;
var ResourceView = require('../../resource_view');
var util = require("../../../substance/util");
var TableView = require('../table/table_view');



// Lens.Citation.View
Expand Down Expand Up @@ -93,9 +93,9 @@ CitationView.Prototype = function () {
if (children[0]) {
var table = document.createElement('table');
table.innerHTML =children[0].innerHTML;
div.appendChild(table);
table.className="table";
frag.appendChild(table);

//div.appendChild(children[0]);
}

}
Expand Down
84 changes: 84 additions & 0 deletions article/nodes/html_table/html_table.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
var _ = require('underscore');
var Document = require('../../../substance/document');

// Lens.HTMLTable
// -----------------
//

var HTMLTable = function(node, doc) {
Document.Node.call(this, node, doc);
};

// Type definition
// -----------------
//

HTMLTable.type = {
"id": "html_table",
"parent": "content",
"properties": {
"source_id": "string",
"label": "string",
"content": "string",
"footers": ["array", "string"],
"caption": "caption"
}
};

HTMLTable.config = {
"zoomable": true
};


// This is used for the auto-generated docs
// -----------------
//

HTMLTable.description = {
"name": "HTMLTable",
"remarks": [
"A table figure which is expressed in HTML notation"
],
"properties": {
"source_id": "string",
"label": "Label shown in the resource header.",
"title": "Full table title",
"content": "HTML data",
"footers": "HTMLTable footers expressed as an array strings",
"caption": "References a caption node, that has all the content"
}
};


// Example HTMLTable
// -----------------
//

HTMLTable.example = {
"id": "html_table_1",
"type": "html_table",
"label": "HTMLTable 1.",
"title": "Lorem ipsum table",
"content": "<table>...</table>",
"footers": [],
"caption": "caption_1"
};

HTMLTable.Prototype = function() {

this.getCaption = function() {
if (this.properties.caption) return this.document.get(this.properties.caption);
};

this.getHeader = function() {
return this.properties.label;
};
};

HTMLTable.Prototype.prototype = Document.Node.prototype;
HTMLTable.prototype = new HTMLTable.Prototype();
HTMLTable.prototype.constructor = HTMLTable;

Document.Node.defineProperties(HTMLTable);

module.exports = HTMLTable;
64 changes: 64 additions & 0 deletions article/nodes/html_table/html_table_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"use strict";

var _ = require("underscore");
var NodeView = require("../node").View;
var $$ = require("../../../substance/application").$$;
var ResourceView = require('../../resource_view');

// Substance.Paragraph.View
// ==========================================================================

var HTMLTableView = function(node, viewFactory, options) {
NodeView.call(this, node, viewFactory);

// Mix-in
ResourceView.call(this, options);

};

HTMLTableView.Prototype = function() {

// Mix-in
_.extend(this, ResourceView.prototype);

this.isZoomable = true;

this.renderBody = function() {

// The actual content
// --------
//

var tableWrapper = $$('.table-wrapper', {
html: this.node.content // HTML table content
});

this.content.appendChild(tableWrapper);

// Display footers (optional)
// --------
//

var footers = $$('.footers', {
children: _.map(this.node.footers, function(footer) {
return $$('.footer', { html: "<b>"+footer.label+"</b> " + footer.content });
})
});

// Display caption


if (this.node.caption) {
var captionView = this.createView(this.node.caption);
this.content.appendChild(captionView.render().el);
}

this.content.appendChild(footers);
};

};

HTMLTableView.Prototype.prototype = NodeView.prototype;
HTMLTableView.prototype = new HTMLTableView.Prototype();

module.exports = HTMLTableView;
6 changes: 6 additions & 0 deletions article/nodes/html_table/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";

module.exports = {
Model: require('./html_table'),
View: require('./html_table_view')
};
20 changes: 20 additions & 0 deletions article/nodes/paragraph/paragraph.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
margin-right: 2ex;
}

.content-node.paragraph.margin-left-2 {
margin-left: 4ex; }

.content-node.paragraph.margin-right-2 {
margin-right: 4ex; }

.content-node.paragraph.centered {
text-align: center;
}
Expand Down Expand Up @@ -214,3 +220,17 @@
display: block !important;
line-height: 28px !important;
}

/*** Abstand zw. zwei aufeinanderfolgenden Paragrafen im Fließtext sowie Unterdrückung dieses Abstands für <p> innerhalb von Tabellen und Zitaten 7.12.18 voe***/
.content-node.paragraph + .content-node.paragraph {
margin-top: 0.7em;
}

td > .content-node.paragraph + .content-node.paragraph {
margin-top: 0;
}
/*.quote > .content .content-node.paragraph + .quote > .content .content-node.paragraph*/
.quote > .content > .paragraph + .paragraph {
margin-top: 0 !important;
}

4 changes: 2 additions & 2 deletions article/nodes/quote/quote.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
}

.document .content-node.quote .content-node.paragraph {
padding: 10px 40px 10px 40px;
border-left: 3px solid #ccc;
padding: 0px 20px 0px 20px;
/*border-left: 3px solid #ccc; doppelte Ausgabe von Rändern bei Zitaten in Stille, Scholz ... 416/416-69-83162-1-10-20181203.xml*/
}

.surface.content .content-node.quote {
Expand Down
Loading

0 comments on commit df2c1be

Please sign in to comment.