Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
added bablerc and jshint
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiantheblind committed Nov 13, 2015
1 parent 5b97f63 commit 7b2b7e8
Show file tree
Hide file tree
Showing 14 changed files with 597 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
4 changes: 4 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"esversion": 6,
"esnext": true
}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ Init the project by running:
nvm install 4.2.2
[email protected]:sebastian-meier/frontal.git && cd frontal
nvm use
npm install --global babel-cli
npm install

## execute

npm start

## development

To write nice ES2015 style we use babel. Therefore we need to watch the whole `src` and compiel it to `app`. Run it like this in the root of the directory:

babel src --watch --out-dir app

@Todo: Add gulp build and watch process for restarting the app as well.
34 changes: 17 additions & 17 deletions app/controller/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
'use strict';

/*
This file contains all the functionality specific to the index.html (start page of the application)
*/

var remote = require('remote'),
dialog = remote.require('dialog');
dialog = remote.require('dialog');

var openFolder = remote.getGlobal('openFolder');
var setThemeFolder = remote.getGlobal('setThemeFolder');
var goTo = remote.getGlobal('goTo');

window.onload = function() {
window.onload = function () {

//Folder Drop Functionality for IntroScreen
var holder = document.getElementById('drop-area');

holder.ondragover = function () {
return false;
};
Expand All @@ -32,32 +32,32 @@ window.onload = function() {
};

//Apparently sometimes when you drop stuff on the window it will load the dropped element instead of handling the drop event
document.addEventListener('dragover',function(event){
document.addEventListener('dragover', function (event) {
event.preventDefault();
return false;
},false);
}, false);

document.addEventListener('drop',function(event){
document.addEventListener('drop', function (event) {
event.preventDefault();
return false;
},false);
}, false);

//Traditional select folder functionality
document.getElementById('frontal-button').onclick = function (){
openFolder(dialog.showOpenDialog({ properties: [ 'openDirectory' ]}));
}
document.getElementById('frontal-button').onclick = function () {
openFolder(dialog.showOpenDialog({ properties: ['openDirectory'] }));
};

var settings = remote.getGlobal('settings');

//Change the Theme-Folder
document.getElementById('theme-location-button').innerHTML = settings.template_directory;
document.getElementById('theme-location-button').onclick = function (){
setThemeFolder(dialog.showOpenDialog({ properties: [ 'openDirectory' ]}));
}
document.getElementById('theme-location-button').onclick = function () {
setThemeFolder(dialog.showOpenDialog({ properties: ['openDirectory'] }));
};

//GoTo Theme page
document.getElementById('theme-button').innerHTML = settings.last_template;
document.getElementById('theme-button').onclick = function (){
document.getElementById('theme-button').onclick = function () {
goTo('themes');
}
};
};
1 change: 1 addition & 0 deletions app/controller/parser.json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";
3 changes: 2 additions & 1 deletion app/controller/parser.md.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ var parser_md = function(){
return parser;
};
*/
*/
"use strict";
24 changes: 13 additions & 11 deletions app/controller/themes.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
'use strict';

/*
This file contains all the functionality specific to the index.html (start page of the application)
*/

var remote = require('remote'),
dialog = remote.require('dialog');
dialog = remote.require('dialog');

var getThemes = remote.getGlobal('getThemes');
var setTheme = remote.getGlobal('setTheme');
var goTo = remote.getGlobal('goTo');
var error = remote.getGlobal('error');

window.onload = function() {
window.onload = function () {

//GoTo Theme page
document.getElementById('back').onclick = function (){
document.getElementById('back').onclick = function () {
goTo('index');
}
};

//Build Theme Page
var container = document.getElementById('themes');
var themes = getThemes();
themes.forEach(function(theme){
var theme_str = '<div class="theme" id="'+theme.folder+'"';
if(theme.hasImage){
theme_str += ' style="background-image:url(\''+theme.path+'/preview.png\');"';
themes.forEach(function (theme) {
var theme_str = '<div class="theme" id="' + theme.folder + '"';
if (theme.hasImage) {
theme_str += ' style="background-image:url(\'' + theme.path + '/preview.png\');"';
}
theme_str += '><span class="name" id="'+theme.folder+'">'+theme.name+'</span><span class="version" id="'+theme.folder+'">'+theme.version+'</span><a id="'+theme.folder+'">use this theme &raquo;</a></div>';
theme_str += '><span class="name" id="' + theme.folder + '">' + theme.name + '</span><span class="version" id="' + theme.folder + '">' + theme.version + '</span><a id="' + theme.folder + '">use this theme &raquo;</a></div>';
container.innerHTML += theme_str;
});

container.onclick = function(event){
if(event.target.id !== 'themes'){
container.onclick = function (event) {
if (event.target.id !== 'themes') {
setTheme(event.target.id);
goTo('index');
}
Expand Down
Loading

0 comments on commit 7b2b7e8

Please sign in to comment.