Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#394 User Guide (2) #396

Merged
merged 57 commits into from
Nov 30, 2020
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
8fd998d
Initial tips.html
OlivierGL Nov 29, 2020
23d56af
fixed bug
OlivierGL Nov 29, 2020
a457ffb
Set theme jekyll-theme-slate
OlivierGL Nov 29, 2020
980ebad
commit
OlivierGL Nov 29, 2020
b1390b7
Merge branch 'Integration_3_1b' of https://github.com/OlivierGL/JetUM…
OlivierGL Nov 29, 2020
dd389cb
updated tips.html:
OlivierGL Nov 29, 2020
4b5375e
converted tips.html to tips.md
OlivierGL Nov 29, 2020
8cbce09
updated tips.md
OlivierGL Nov 29, 2020
d716a68
updated tips.md
OlivierGL Nov 29, 2020
71a0447
updated tips.md
OlivierGL Nov 29, 2020
e039120
updated tips.md
OlivierGL Nov 29, 2020
e377085
updated tips.md
OlivierGL Nov 29, 2020
b454f8e
updated tips.md
OlivierGL Nov 29, 2020
01c9544
updated tips.md
OlivierGL Nov 29, 2020
4142292
updated tips.md sync
OlivierGL Nov 29, 2020
df0a0ab
updated tips.md
OlivierGL Nov 29, 2020
506c7d4
updated tips.md
OlivierGL Nov 29, 2020
dd35197
updated tips.md
OlivierGL Nov 29, 2020
4c231e1
updated tips.md
OlivierGL Nov 29, 2020
c9da00d
updated tips.md
OlivierGL Nov 29, 2020
f9858f6
updated tips.md
OlivierGL Nov 29, 2020
11faefb
updated tips.md
OlivierGL Nov 29, 2020
81d5c83
updated tips.md
OlivierGL Nov 29, 2020
eec5915
updated tips.md
OlivierGL Nov 29, 2020
8c5336e
updated tips.md
OlivierGL Nov 29, 2020
0c861b2
updated tips.md
OlivierGL Nov 30, 2020
f0d8cf6
updated tips.md
OlivierGL Nov 30, 2020
2f01433
updated tips.md
OlivierGL Nov 30, 2020
c8084ed
updated tips.md
OlivierGL Nov 30, 2020
e3e008b
updated tips.md
OlivierGL Nov 30, 2020
61d9aed
updated tips.md
OlivierGL Nov 30, 2020
c050df6
updated tips.md
OlivierGL Nov 30, 2020
698007c
updated tips.md
OlivierGL Nov 30, 2020
cdddc33
updated tips.md
OlivierGL Nov 30, 2020
caf08b6
updated tips.md
OlivierGL Nov 30, 2020
f353312
updated tips.md
OlivierGL Nov 30, 2020
c2c8e34
updated tips.md
OlivierGL Nov 30, 2020
0847ace
updated tips.md
OlivierGL Nov 30, 2020
160b3ef
updated tips.md
OlivierGL Nov 30, 2020
bfd572d
updated tips.md
OlivierGL Nov 30, 2020
bb7844f
updated tips.md
OlivierGL Nov 30, 2020
7806681
renamed tips.md into user_guide.md
OlivierGL Nov 30, 2020
78da8b9
renamed user_guide into UserGuide
OlivierGL Nov 30, 2020
5f42f66
renamed user_guide into UserGuide
OlivierGL Nov 30, 2020
22b66c7
updated user_guide
OlivierGL Nov 30, 2020
8927257
updated user_guide
OlivierGL Nov 30, 2020
36a98c3
updated user_guide
OlivierGL Nov 30, 2020
5b36926
updated color in user_guide
OlivierGL Nov 30, 2020
bbea243
updated color in user_guide
OlivierGL Nov 30, 2020
b4addf1
updated color in user_guide
OlivierGL Nov 30, 2020
fcd7bb6
updated user_guide colors
OlivierGL Nov 30, 2020
71df2e2
updated user_guide colors
OlivierGL Nov 30, 2020
fcbf3ee
Merge branch 'Integration_3_1b' of https://github.com/prmr/JetUML int…
OlivierGL Nov 30, 2020
23e513a
moved user_guide to docs
OlivierGL Nov 30, 2020
cdb2efc
added comments in user_guide.md
OlivierGL Nov 30, 2020
d3ebc77
Addressed PR feedback
OlivierGL Nov 30, 2020
f6692a2
removed jekyll config
OlivierGL Nov 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# User Guide

This page contains the complete list of "tips" available through JetUML's "Tip of the Day" dialog. Click on an entry to expand with details.

<div id=body></div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<style>

/* Snippet inspired from https://www.w3schools.com/howto/howto_js_collapsible.asp */
.collapsible
{
background-color: #DCDCDC;
color: black;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}

.active
{
background-color: #C0C0C0
}

.collapsible:hover
{
background-color: #AFDBF5;
}

.content
{
padding: 0 18px;
overflow: hidden;
background-color: #f1f1f1;
max-height: 0;
transition: max-height 0.2s ease-out;
}

.br
{
margin-top: 4px;
}

</style>


<script>

// fetching the properties to get the number of tips and adding tips to the DOM
jQuery.get('../src/ca/mcgill/cs/jetuml/JetUML.properties', data =>
{
var numTips = getNumTips(data);

for(var j = 1; j <= numTips; j++)
{
var tipFileName = "tip-" + j + ".json";
var tipPath = "../tipdata/tips/" + tipFileName;

// requesting the tip json for the j'th tip and adding it to
// the DOM with parseTip
$.ajax(
{
url: tipPath,
dataType: 'json',
data: data,
async: false,
success: parseTip
}
);
}
}
);

// function that takes in the JetUML properties file as data and
// extracts the tip quantity property
function getNumTips(data)
{
var numTips = 0;
var lines = data.split("\n");
for(var i = 0; i<lines.length; i++)
{
var line = lines[i];
if (line.includes("tips.quantity="))
{
numTips = line.split("tips.quantity=")[1];
break;
}
}
return numTips;
}

// function that takes in a tip json and parses it to add nodes containing the tip
// contents to the DOM
function parseTip(tipData)
{
// The div containing the contents of a given tip
var tipContentDiv = $('<div/>',
{
class: "content",
}
);

// the button that opens up the tip content
var collapsibleTip = $('<button/>',
{
text: tipData["title"],
class: 'collapsible',
}
);
//adding both to the body div
$("#body").append(collapsibleTip);
$("#body").append(tipContentDiv);

// adding handler for the button
collapsibleTip.on("click", function() //function snippet taken from
{ //https://www.w3schools.com/howto/howto_js_collapsible.asp
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight)
{
content.style.maxHeight = null;
}
else
{
content.style.maxHeight = content.scrollHeight + "px";
}
}
);

addTipToDiv(tipData, tipContentDiv);

// adding a <br> to separate the buttons
$("#body").append($('<br/>',
{
class: 'br',
}
));
}

// function that takes in the data of a tip json and the div to which the
// tip contents should be added to add the tip contents to the div
function addTipToDiv(tipData, tipContentDiv)
{
var content = tipData["content"];

// looping over the tip contents and adding the tip elements to tipContentDiv
for (var k = 0; k<content.length; k++)
{
var tipElement = content[k];
for(var type in tipElement)
{
if(type == "text")
{
//creating a <p> node with the text
var tipText = $('<p/>',
{
text: tipElement["text"],
}
);
tipContentDiv.append(tipText);
}
else if (type == "image")
{
//creating an <img> node with the image
var tipImage = $('<img/>',
{
src: "../tipdata/tip_images/" + tipElement["image"],
}
);
tipContentDiv.append(tipImage);
}
}
}
}

</script>