Skip to content

Commit

Permalink
Changed Layout of the App
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawana93 committed Nov 29, 2017
1 parent 2ac4f94 commit e356170
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 38 deletions.
4 changes: 2 additions & 2 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
});

// Spotlights.
$('.spotlights > section')
/* $('.spotlights > section')
.scrollex({
mode: 'middle',
top: '-10vh',
Expand Down Expand Up @@ -182,7 +182,7 @@
// Hide <img>.
$img.hide();
});
}); */

// Features.
if (skel.canUse('transition'))
Expand Down
56 changes: 56 additions & 0 deletions assets/js/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
window.navigation = window.navigation || {},
function(n) {
navigation.menu = {
constants: {
sectionTemplate: '.section-template',
contentContainer: '#wrapper',
startSectionMenuItem: '#welcome-menu',
startSection: '#welcome'
},

importSectionsToDOM: function() {
const links = document.querySelectorAll('link[rel="import"]')
Array.prototype.forEach.call(links, function (link) {
let template = link.import.querySelector(navigation.menu.constants.sectionTemplate)
let clone = document.importNode(template.content, true)
document.querySelector(navigation.menu.constants.contentContainer).appendChild(clone)
})
},

setMenuOnClickEvent: function () {
document.body.addEventListener('click', function (event) {
if (event.target.dataset.section) {
navigation.menu.hideAllSections()
navigation.menu.showSection(event)
}
})
},

showSection: function(event) {
const sectionId = event.target.dataset.section
$('#' + sectionId).show()
$('#' + sectionId + ' section').show()
},

showStartSection: function() {
$(this.constants.startSectionMenuItem).click()
$(this.constants.startSection).show()
$(this.constants.startSection + ' section').show()
},

hideAllSections: function() {
$(this.constants.contentContainer + ' section').hide()
},

init: function() {
this.importSectionsToDOM()
this.setMenuOnClickEvent()
this.showStartSection()
}
};

n(function() {
navigation.menu.init()
})

}(jQuery);
32 changes: 19 additions & 13 deletions assets/js/translations.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
window.localization = window.localization || {},
function(n) {
localization.translate = {
localization.translate = {

menu: function() {
$('#save-changes').text(i18n.__('Save'));
$('#create-new-file').text(i18n.__('Save as'));
$('#select-file').text(i18n.__('Open'));
},
menu: function() {
$('#welcome-menu').text(i18n.__('Welcome'));
$('#editor-menu').text(i18n.__('Editor'));
},

init: function() {
this.button();
}
};
welcome: function() {
$('#welcome .inner h1').text(i18n.__('Welcome Header'));
$('#welcome .inner p').text(i18n.__('Welcome Text'));
},

n(function() {
localization.translate.init();
})
init: function() {
this.welcome();
this.menu();
this.editorFrame();
}
};

n(function() {
localization.translate.init();
});

}(jQuery);
6 changes: 6 additions & 0 deletions assets/sass/components/_section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@
margin-top: (_size(element-margin) * -0.3);
line-height: 1.5em;
}
}

#wrapper {
section {
display: none;
}
}
6 changes: 5 additions & 1 deletion assets/sass/layout/_intro.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/* Intro */

#intro {
.intro {
background-attachment: fixed;
background-image: url('images/intro.svg');
background-position: top right;
Expand All @@ -30,4 +30,8 @@
@include breakpoint(large) {
background-attachment: scroll;
}

.inner{
padding-top: 255px;
}
}
8 changes: 8 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
css_dir = "assets/css" # by Compass.app
sass_dir = "assets/sass" # by Compass.app
images_dir = "assets/css/images" # by Compass.app
output_style = :compressed # :expanded or :nested or :compact or :compressed
relative_assets = false # by Compass.app
line_comments = true # by Compass.app
sass_options = {:debug_info=>false} # by Compass.app
sourcemap = false # by Compass.app
49 changes: 49 additions & 0 deletions indexNewTest.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE HTML>
<!--
Hyperspace by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>The Novelist</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="import" href="./sections/welcome.html">
<link rel="import" href="./sections/editor.html">
</head>
<body>

<!-- Sidebar -->
<section id="sidebar">
<div class="inner">
<nav>
<ul>
<li><a id="welcome-menu" data-section="welcome" href="#">Welcome</a></li>
<li><a id="editor-menu" data-section="editorFrame" href="#">Editor</a></li>
</ul>
</nav>
</div>
</section>

<!-- Wrapper -->
<div id="wrapper">

</div>

<!-- Scripts -->

<script>window.$ = window.jQuery = require('./assets/js/jquery.min.js');</script>
<script>window.i18n = new(require('./translations/i18n'));</script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
<script>
require('./assets/js/menu');
require('./assets/js/translations');
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let aboutWindow;
app.on('ready', function() {
mainWindow = new BrowserWindow({titleBarStyle: 'hidden', show: false, width: 1281, height: 800, minWidth: 1281, minHeight: 800, icon: __dirname + '/assets/icons/win/icon.ico'});
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
pathname: path.join(__dirname, 'indexNewTest.html'),
protocol: 'file:',
slashes: true
}));
Expand Down
18 changes: 1 addition & 17 deletions menu/mainmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ const template = [
if (focusedWindow) focusedWindow.reload()
}
},
{
label: i18n.__('Toggle Developer Tools'),
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click (item, focusedWindow) {
if (focusedWindow) focusedWindow.webContents.toggleDevTools()
}
},
{
type: 'separator'
},
Expand All @@ -74,12 +67,6 @@ const template = [
},
{
role: 'zoomout', label: i18n.__('Zoom out')
},
{
type: 'separator'
},
{
role: 'togglefullscreen', label: i18n.__('Toggle fullscreen')
}
]
},
Expand All @@ -88,9 +75,6 @@ const template = [
submenu: [
{
role: 'minimize', label: i18n.__('Minimize'),
},
{
role: 'close', label: i18n.__('Close'),
}
]
},
Expand All @@ -99,7 +83,7 @@ const template = [
submenu: [
{
label: i18n.__('Learn more'),
click () { require('electron').shell.openExternal('http://electron.atom.io') }
click () { require('electron').shell.openExternal('https://github.com/Pawana93/the_novelist') }
}
]
}
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
"main": "main.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "npm install && electron .",
"start": "electron .",
"pack": "build --dir",
"dist": "build"
},
"build": {
"appId": "the.novelist",
"productName": "The Novelist",
"category": "Writing",
"dmg": {
"contents": [
{
Expand All @@ -34,7 +35,7 @@
]
},
"win": {
"target": "NSIS",
"target": "nsis",
"icon": "build/icon.ico"
}
},
Expand Down
23 changes: 23 additions & 0 deletions sections/editor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template class="section-template">
<section id="editorFrame">
<div class="inner">
<!-- Files Dialog (invisible) -->
<section id="files-dialog">
<div style="text-align:center;">
<input type="text" placeholder="Please select a file" id="actual-file" disabled="disabled" style="display: none; visibility: hidden;"/>
<input type="button" id="delete-file" value="Delete file" style="display: none; visibility: hidden;"/>
<input type="button" id="save-changes" value="Save"/>
<input type="button" value="Save as" id="create-new-file"/>
<input type="button" value="Open" id="select-file"/>
</div>
</br>
</section>

<!-- Editor -->
<section id="editor">
<textarea id="content-editor" rows="20" style="width: 99%"></textarea><br><br>
</section>
</div>
</section>
<script src='./js/fileDialogSaveLoadDelete.js'></script>
</template>
8 changes: 8 additions & 0 deletions sections/welcome.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template class="section-template">
<section id="welcome" class="wrapper style1 fullscreen intro">
<div class="inner">
<h1>Welcome to "The Novelist"</h1>
<p>Welcome to "The Novelist". This is the main page for the app.</p>
</div>
</section>
</template>
6 changes: 5 additions & 1 deletion translations/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@
"Reset Zoom": "Zoom zurücksetzen",
"Save": "Speichern",
"Save as": "Speichern unter",
"Open": "Öffnen"
"Open": "Öffnen",
"Welcome": "Wilkommen",
"Editor": "Texteditor",
"Welcome Text": "Wilkommen bei 'The Novelist'. Dies ist die Startseite der App.",
"Welcome Header": "Wilkommen bei 'The Novelist'"
}
6 changes: 5 additions & 1 deletion translations/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@
"Reset Zoom": "Reset Zoom",
"Save": "Save",
"Save as": "Save as",
"Open": "Open"
"Open": "Open",
"Welcome": "Welcome",
"Editor": "Editor",
"Welcome Text": "Welcome to 'The Novelist'. This is the main page for the app.",
"Welcome Header": "Welcome to 'The Novelist'"
}

0 comments on commit e356170

Please sign in to comment.