Skip to content

Commit

Permalink
#954 Add a type of presentation and create presentation from Markdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
koda-masaru committed Nov 14, 2017
1 parent 27f674b commit cefed4c
Show file tree
Hide file tree
Showing 17 changed files with 239 additions and 21 deletions.
7 changes: 4 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
"diff2html": "2.3.0",
"jsdiff": "3.2.0",
"chart.js": "2.6.0",
"vue": "2.4.2"
"vue": "2.4.2",
"html2canvas": "0.4.1",
"jspdf": "1.3.2"
},
"devDependencies": {},
"resolutions": {
"jquery": "2.2.3",
"jspdf": "1.3.2",
"jspdf-autotable": "2.0.17"
"jspdf": "1.3.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.support.project.knowledge.deploy.v1_11_0.Migrate_1_11_3;
import org.support.project.knowledge.deploy.v1_11_0.Migrate_1_11_4;
import org.support.project.knowledge.deploy.v1_12.Migrate_1_12_0;
import org.support.project.knowledge.deploy.v1_12.Migrate_1_12_1;
import org.support.project.knowledge.deploy.v1_1_0pre1.Migrate_1_1_0pre1;
import org.support.project.knowledge.deploy.v1_4_0.Migrate_1_4_0;
import org.support.project.knowledge.deploy.v1_5_0.Migrate_1_5_0;
Expand All @@ -53,7 +54,7 @@ public class InitDB {
private static final Map<String, Migrate> MAP = new LinkedHashMap<>();

private static final Migrate INIT = InitializeSystem.get();
public static final String CURRENT = "1.12.0";
public static final String CURRENT = "1.12.1";

public InitDB() {
super();
Expand Down Expand Up @@ -89,6 +90,7 @@ public InitDB() {
MAP.put("1.11.3", Migrate_1_11_3.get());
MAP.put("1.11.4", Migrate_1_11_4.get());
MAP.put("1.12.0", Migrate_1_12_0.get());
MAP.put("1.12.1", Migrate_1_12_1.get());
}

public static void main(String[] args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.support.project.knowledge.deploy.v1_12;

import org.support.project.knowledge.deploy.Migrate;
import org.support.project.ormapping.tool.dao.InitializeDao;

public class Migrate_1_12_1 implements Migrate {

public static Migrate_1_12_1 get() {
return org.support.project.di.Container.getComp(Migrate_1_12_1.class);
}

@Override
public boolean doMigrate() throws Exception {
InitializeDao initializeDao = InitializeDao.get();
String[] sqlpaths = {
"/org/support/project/knowledge/deploy/v1_12/migrate_v1_12_1.sql",
};
initializeDao.initializeDatabase(sqlpaths);
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ VALUES (-99,0,'URL',0,0,'2015-09-09 00:00:00',null,null,0);
INSERT INTO TEMPLATE_MASTERS ( TYPE_ID, TYPE_NAME, TYPE_ICON, DESCRIPTION, INSERT_USER, INSERT_DATETIME, UPDATE_USER, UPDATE_DATETIME, DELETE_FLAG )
VALUES (-101,'event', 'fa-calendar', 'Share information about a event',0,'2017-02-16 00:00:00',null,null,0);

INSERT INTO TEMPLATE_MASTERS ( TYPE_ID, TYPE_NAME, TYPE_ICON, DESCRIPTION, INSERT_USER, INSERT_DATETIME, UPDATE_USER, UPDATE_DATETIME, DELETE_FLAG )
VALUES (-102,'presentation', 'fa-television', 'It is presentation by Markdown',0,'2017-12-01 00:00:00',null,null,0);

INSERT INTO TEMPLATE_ITEMS ( TYPE_ID, ITEM_NO, ITEM_NAME, ITEM_TYPE, INSERT_USER, INSERT_DATETIME, UPDATE_USER, UPDATE_DATETIME, DELETE_FLAG )
VALUES (-101,0,'Date',20,0,'2017-02-16 00:00:00',null,null,0);
INSERT INTO TEMPLATE_ITEMS ( TYPE_ID, ITEM_NO, ITEM_NAME, ITEM_TYPE, INSERT_USER, INSERT_DATETIME, UPDATE_USER, UPDATE_DATETIME, DELETE_FLAG )
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DELETE FROM TEMPLATE_MASTERS WHERE TYPE_ID = -102;
DELETE FROM TEMPLATE_ITEMS WHERE TYPE_ID = -102;

INSERT INTO TEMPLATE_MASTERS ( TYPE_ID, TYPE_NAME, TYPE_ICON, DESCRIPTION, INSERT_USER, INSERT_DATETIME, UPDATE_USER, UPDATE_DATETIME, DELETE_FLAG )
VALUES (-102,'presentation', 'fa-television', 'It is presentation by Markdown',0,'2017-12-01 00:00:00',null,null,0);

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<div style="word-break: normal; display: none;" id="template_items_area" class="markdown">
<span id="template_view_items"></span>
</div>
<%-- プレゼンテーション --%>
<div id="presentationArea" class="slideshow"></div>
<%-- ナレッジコンテンツ --%>
<div style="word-break: normal;" id="content" class="markdown viewarea">
<%=jspUtil.out("content", JspUtil.ESCAPE_NONE)%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ MathJax.Hub.Config({

<script type="text/javascript" src="<%= request.getContextPath() %>/js/template-item-input.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/knowledge-view-survey.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/presentation.js"></script>

<!-- endbuild -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
<link rel="stylesheet" href="<%= request.getContextPath() %>/css/knowledge-view.css" />
<link rel="stylesheet" href="<%= request.getContextPath() %>/css/markdown.css" />
<link rel="stylesheet" href="<%= request.getContextPath() %>/css/slide.css" />

<!-- endbuild -->

<link rel="stylesheet" href="<%= request.getContextPath() %>/css/presentation-thema/default.css" />
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
</div>

<div class="tab-pane preview markdown" id="previewTab">
<%-- プレゼンテーション --%>
<div class="row">
<span id="presentationArea" class="slideshow"></span>
</div>
<div class="row">
<span id="preview"></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ MathJax.Hub.Config({

<script type="text/javascript" src="<%= request.getContextPath() %>/js/template-item-input.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/knowledge-template.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/presentation.js"></script>

<!-- endbuild -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<link rel="stylesheet" href="<%= request.getContextPath() %>/css/slide.css" />
<!-- endbuild -->

<link rel="stylesheet" href="<%= request.getContextPath() %>/css/presentation-thema/default.css" />

<style>
<%-- width の上書き --%>
.picedit_box {
Expand Down
65 changes: 65 additions & 0 deletions src/main/webapp/css/presentation-thema/default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.markdownSlide div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
font-weight: normal;
}

.markdownSlide {
background-color: white;
overflow: hidden;
font-size: 3vh;
padding: 3vh;
}

.markdownSlide ul, ol {
padding-left: 3vh;
padding-top: 2vh;
}


.markdownSlide p,
.markdownSlide h1,
.markdownSlide h2,
.markdownSlide h3,
.markdownSlide h4 {
margin: 0px;
}
.markdownSlide p {
font-size: 3vh;
line-height: 4vh;
}
.markdownSlide h1 {
font-size: 5vh;
line-height: 6vh;
border-bottom: 0.2vh solid gray;
}
.markdownSlide h2 {
font-size: 4vh;
line-height: 5vh;
border-bottom: 0.2vh dotted gray;
}
.markdownSlide h3 {
font-size: 3vh;
line-height: 4vh;
}
.markdownSlide h4 {
font-size: 3vh;
line-height: 4vh;
}

2 changes: 1 addition & 1 deletion src/main/webapp/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ $(document).on('drop dragover', function (e) {
});

function logging(str, level) {
// console.log(str);
console.log(str);
if (_LOGGING_NOTIFY_DESKTOP) {
if (!level) {
level = 'info';
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/js/knowledge-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ var preview = function() {
'#preview'
).then(function() {
return processMathJax('#preview');
}).then(function() {
if ($('#typeId').val() === '-102') {
// プレゼンテーションのタイプであった場合に、プレゼンテーションを生成する
return createPresentation('#preview');
}
});
};

Expand Down
7 changes: 6 additions & 1 deletion src/main/webapp/js/knowledge-view-markdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
$(document).ready(function() {
processDecoration('#content');
processDecoration('#content').then(function() {
if ($('#typeId').val() === '-102') {
// プレゼンテーションのタイプであった場合に、プレゼンテーションを生成する
createPresentation('#content');
}
});
processDecoration('.arrow_answer');
processDecoration('.arrow_question');
});
Expand Down
98 changes: 98 additions & 0 deletions src/main/webapp/js/presentation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
var setHeight = function() {
var width = $('#presentation').width();
var height = width * 9 / 16;
logging(width + ':' + height);
$('.markdownSlide').height(height);
if ($('#presentation').innerWidth() > 1024) {
// 全画面表示と判定
$('.markdownSlide').css('padding', '6vh');
$('.markdownSlide').css('font-size', '5vh');
$('.markdownSlide p').css('font-size', '5vh');
$('.markdownSlide h1').css('font-size', '10vh');
$('.markdownSlide h2').css('font-size', '8vh');
$('.markdownSlide h3').css('font-size', '6vh');
$('.markdownSlide h4').css('font-size', '5vh');
$('.markdownSlide p').css('line-height', '6vh');
$('.markdownSlide h1').css('line-height', '12vh');
$('.markdownSlide h2').css('line-height', '10vh');
$('.markdownSlide h3').css('line-height', '6vh');
$('.markdownSlide h4').css('line-height', '6vh');
} else {
$('.markdownSlide').css('padding', '3vh');
$('.markdownSlide').css('font-size', '3vh');
$('.markdownSlide p').css('font-size', '3vh');
$('.markdownSlide h1').css('font-size', '5vh');
$('.markdownSlide h2').css('font-size', '4vh');
$('.markdownSlide h3').css('font-size', '3vh');
$('.markdownSlide h4').css('font-size', '3vh');
$('.markdownSlide p').css('line-height', '4vh');
$('.markdownSlide h1').css('line-height', '6vh');
$('.markdownSlide h2').css('line-height', '5vh');
$('.markdownSlide h3').css('line-height', '4vh');
$('.markdownSlide h4').css('line-height', '4vh');
}
};

var createPresentation = function(targetId) {
return Promise.try(function() {
$(window).resize(function(){
setHeight();
});

logging('createPresentation');
var presentationArea = $('#presentationArea');

var slideLength = 2;
var slideId = 'presentation';

indexMap[slideId] = 1;
var slidehtml = '<div class="slideshow-area" id="' + slideId + '">';
slidehtml += '<div class="slideshow-container" id="sheets"></div>';
slidehtml += '<br/>';
slidehtml += '<div class="slideshow-control">';
slidehtml += '<a class="prev" onclick="plusSlides(-1, \'' + slideId + '\')">&#10094; prev</a>';
slidehtml += '<a class="next" onclick="plusSlides(1, \'' + slideId + '\')">next &#10095;</a>';
slidehtml += '<div style="text-align:center">';
slidehtml += '<div class="numbertext"><span class="current">1</span> / ' + slideLength;

slidehtml += '&nbsp;&nbsp;&nbsp;<a onclick="requestFullscreen(\'' + slideId + '\');">';

slidehtml += '<i class="full fa fa-television fa-2x" aria-hidden="true"></i></a></div>';
if (slideLength < 60) {
slidehtml += '<div class="dotArea">';
for (var i = 0; i < slideLength; i++) {
slidehtml += '<span class="dot" onclick="currentSlide(' + (i+1) + ', \'' + slideId + '\')"></span> ';
}
slidehtml += '</div>';
}
slidehtml += '</div></div></div>';
presentationArea.html(slidehtml);

var sections = [];
var section = $('<div class="mySlides markdownSlide slide-fade in"></div>');
var add = false;
$(targetId).children().each(function(i, elem) {
if (elem.tagName.toLowerCase() == 'hr') {
sections.push(section);
section = $('<div class="mySlides markdownSlide slide-fade in"></div>');
add = false;
} else {
section.append($(elem).clone());
add = true;
}
});
if (add) {
sections.push(section);
}
sections.forEach(function(s) {
$('#sheets').append(s);
});

logging(presentationArea.html());
showSlides(indexMap[slideId], slideId);
setHeight();
});


};

30 changes: 15 additions & 15 deletions src/main/webapp/js/slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,21 @@ function showSlides(n, slideId) {
}

$(document).on({
'mouseenter': function () {
var id = $(this).attr('id');
$(window).on('keydown', function (e) {
e.preventDefault();
'mouseenter': function () {
var id = $(this).attr('id');
$(window).on('keydown', function (e) {
e.preventDefault();

if (37 == e.keyCode) {
plusSlides(-1, id);
}
if (37 == e.keyCode) {
plusSlides(-1, id);
}

if (39 == e.keyCode) {
plusSlides(1, id);
}
});
},
'mouseleave': function () {
$(window).off('keydown');
}
if (39 == e.keyCode) {
plusSlides(1, id);
}
});
},
'mouseleave': function () {
$(window).off('keydown');
}
}, '.slideshow-area');

0 comments on commit cefed4c

Please sign in to comment.