Skip to content

Commit

Permalink
Reorganize start WB
Browse files Browse the repository at this point in the history
  • Loading branch information
kkremitzki authored and yorikvanhavre committed Mar 11, 2017
1 parent a437517 commit ea2ed34
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 21 deletions.
12 changes: 11 additions & 1 deletion src/Mod/Start/StartPage/StartPage.css
Expand Up @@ -52,12 +52,22 @@ ul {
}

.block {
background: #windowcolor;
background: #windowcolor !important;
border-radius: 5px;
padding: 8px;
margin-bottom: 10px;
color: #windowtextcolor;
width: auto;
clear: left;
}

.half-block {
background: #windowcolor !important;
border-radius: 5px;
padding: 8px;
margin-bottom: 10px;
color: #windowtextcolor;
width: 47% !important;
}

.options {
Expand Down
42 changes: 23 additions & 19 deletions src/Mod/Start/StartPage/StartPage.html
Expand Up @@ -10,7 +10,11 @@ <h1><img src="images/FreeCAD.png">&nbsp;text01<div id=versionbox>&nbsp</div></h1
&nbsp;
</div>
<div id="column">
<div class="block">
<div id="files" class="block">
<h2>text03</h2>
recentfiles
</div>
<div id="newproject" class="half-block" style="float: left; display: inline-block; height: 145px;">
<h2>text02</h2>
<ul>
<li><img src="images/blank.png">&nbsp;
Expand Down Expand Up @@ -48,23 +52,7 @@ <h2>text02</h2>
</li>
</ul>
</div>
<div class="block">
<h2>text09</h2>
<ul>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadSchenkel.py">text10</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadPartDesignExample.py">text11</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadDrawingExample.py">text12</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadRobotExample.py">text13</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadArchExample.py">text55</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadFemExample2D.py">text64</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadFemExample3D.py">text60</a></li>
</ul>
</div>
<div class="block">
<h2>text03</h2>
recentfiles
</div>
<div class="block">
<div id="ontheweb" class="half-block" style="float: right; display: inline-block; height: 145px;">
<h2>text06</h2>
<ul>
<li><img src="images/web.png">&nbsp;
Expand All @@ -91,7 +79,23 @@ <h2>text06</h2>
onMouseOver="show('<p>text62</p>')"
onMouseOut="show('')">text61</a></li>
</ul>
</div>
</div>
<div id="examples" class="half-block" style="float: left; display: inline-block;">
<h2>text09</h2>
<ul>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadSchenkel.py">text10</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadPartDesignExample.py">text11</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadDrawingExample.py">text12</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadRobotExample.py">text13</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadArchExample.py">text55</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadFemExample2D.py">text64</a></li>
<li><img src="images/FreeCAD.png" style="width: 16px">&nbsp;<a href="LoadFemExample3D.py">text60</a></li>
</ul>
</div>
<div id="commits" class="half-block" style="float: right; display: inline-block;">
<h2>text05</h2>
<div id="news">news feed</div>
</div>
customblocks
</div>
</body>
Expand Down
26 changes: 25 additions & 1 deletion src/Mod/Start/StartPage/StartPage.js
Expand Up @@ -55,10 +55,19 @@ function checkVersion(data) {
}

function load() {
// load latest news
ddiv = document.getElementById("news");
ddiv.innerHTML = "Connecting...";
var tobj=new JSONscriptRequest('https://api.github.com/repos/FreeCAD/FreeCAD/commits?callback=showTweets');
tobj.buildScriptTag(); // Build the script tag
tobj.addScriptTag(); // Execute (add) the script tag
ddiv.innerHTML = "Downloading latest news...";

// load version
var script = document.createElement('script');
script.src = 'http://www.freecadweb.org/version.php?callback=checkVersion';
document.body.appendChild(script);

}

function stripTags(text) {
Expand All @@ -79,7 +88,7 @@ function showTweets(data) {
ddiv = document.getElementById('news');
ddiv.innerHTML = "Received";
var html = ['<ul>'];
for (var i = 0; i < 15; i++) {
for (var i = 0; i < 5; i++) {
html.push('<li><img src="images/web.png">&nbsp;<a href="ext', data.data[i].commit.url, '" onMouseOver="showDescr(', i+1, ')" onMouseOut="showDescr()">', data.data[i].commit.message, '</a></li>');
if ("message" in data.data[i].commit) {
linkDescriptions.push(stripTags(data.data[i].commit.message)+'<br/>'+data.data[i].commit.author.name+'<br/>'+data.data[i].commit.author.date);
Expand All @@ -91,6 +100,21 @@ function showTweets(data) {
html.push('</ul>');
html.push('<a href="exthttp://github.com/FreeCAD/FreeCAD/commits/master">text63<a/>');
ddiv.innerHTML = html.join('');
var commits = document.getElementById("commits");
var examples = document.getElementById("examples");
var files = document.getElementById("files");
var description = document.getElementById("description");

var commitsHeight = commits.offsetHeight;
var examplesHeight = examples.offsetHeight;
var filesHeight = files.offsetHeight;

var biggerHeight = commitsHeight > examplesHeight ? commitsHeight : examplesHeight;

var totalHeight = biggerHeight + filesHeight + 145 + 36;
commits.style.height = biggerHeight + 'px';
examples.style.height = biggerHeight + 'px';
description.style.height = totalHeight + 'px';
}

function showDescr(d) {
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Start/StartPage/StartPage.py
Expand Up @@ -301,6 +301,9 @@ def handle():
html = replace_html_text(html)
# fetches system colors
html = setColors(html)
f = open(os.path.expanduser("~")+os.sep+"freecad-startpage.html","wb")
f.write(html)
f.close()
return html

def exportTestFile():
Expand Down

0 comments on commit ea2ed34

Please sign in to comment.