GIT and Revisioning programs
After a quick look at gitlab and guides on git I immediately created the access credentials and,
once obtained the permissions for modifying the project, I created the key ssh terminal and I iniserita in my profile.
I'm pretty handy versioning systems but generally use CVS, this was an opportunity to start using GIT.
I started by setting credentials with terminal
git config –global user.name “myuser”
git config –global user.email “user@mail.com”
Then I created the project folder and moved in
mkdir FabAcademy
cd FabAcademy
Inside the folder i initialized the project to git and set the source of the files.
git init
git remote add origin "repository url"
git push -u origin master
git pull
updated my folder's files with repository's files I sent the first commit to try if everything was working
git add "filename" (use * to add all file in directory)
git commit -m ” descriptive commit message here”
git push
I initially had a permissions issue during the files pushing and found that in rare circumstances connect to git via ssh on Linux can generate the error "Agent admitted failure to sign using the key".
To solve the problem To solve it you have to upload your key constraint on the SSH agent with ssh-add.
eval "$(ssh-agent -s)"
ssh-add
Once you're comfortable with git I started working on the html.
HTML and asyncronous loading
I created a single html page that loads content dynamically accessing two json file, one linked to the exercises and one project-containing all the resources.
First of all load the json trough a ajax function
$.ajax({
url: "posizione del file json",
dataType: "json",
success: function(data) {
//generate html element with data
},
error: function () {
alert('an error occurred')
}
});
Once the json was loaded correctly it creates the html elements dynamically insert them into list.
The details of the lesson are loaded dinamcamente inside a modal every time the user presses the button
function openModalDetails(label, index) {
switch (label) {
case 'exercises':
var content = exercises[index];
break;
case 'project':
var content = project[index];
break;
}
//reset previous modal content
$('#details-modal .modal-title').text("");
$('#details-modal .modal-body .page').remove("");
//load new content
$('#details-modal .modal-title').text(content.title);
$('#details-modal .modal-body').load(content.page);
$('#details-modal').modal();
}
Loading content dynamically I had a problem of page caching.
When the broweser redeeming feature to cache the page I could not see the latest changes. I solved the problem by forcing the browser to reload the file versionig it.
For versioned a file you have to add a stri query to request in this way:
http://"url"?v="version number"
To avoid having to change the version number I used a JavaScript function to generate a number randomico, so changing my function
$('#details-modal .modal-body').load(content.page+"?v="+Math.random());
static site generator
Update 31/01/2017
During the confrontation with the other Italian FabLab pointed out to me that the site was not accessible without javascript and content loaded dynamically were not indexed by search engines.
to solve the problem I changed a bit the structure and have the pages even without javascript making static and made accessible
indexable by all search engines
On Tutors advice I started to use Jekyll to create the pages of the exercises and the project by not having to repeat the elements of the layout as navbar and footer on all pages.
to avoid having a page with only the contents and to upload content in modal I modified the load function of the pages like this:
$('#details-modal .modal-body').load(content.page+' "javascript selector");
in this way javascript recovers from the page loaded only the element with the selected selector
Jekill
Install Ruby on ubuntu
$ sudo apt-get install ruby-full
Install rubygems
$ sudo gem update
$ sudo gem install rubygems-update
$ sudo update_rubygems
Install Jekyll the Jekyll installation has created problems because the ruby's repository for debian are very old I found the solution in this StackOverflow answer
Install Jekill on debian/Ubuntu
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ curl -sSL https://get.rvm.io | bash
$ source /home/marco/.rvm/scripts/rvm
$ rvm get head
$ rvm install ruby
$ rvm use 2.2.1
$ gem install jekyll bundler
After Jekyll installation int the projet
$ jekyll new "nome progetto"I prefer to begin with a blank template rather than using a theme already created.
$ cd "nome progetto"
I found what I did to my case at this GIT page
the first thing I separated all the HTML elements that are repeated in the pages (navbar, footer, head).
Then I created two folders that contain the pages of the exercises and the project.
Once you have created the basic layout it just has to create the site.
once you created the pages I built everything directly into the fab academy folder with the following command
$ jekyll build --destination "nome cartella di destinazione"
Assemble
Update 02/17/2017
I decided to change the program for the generation of static sites.
I do not really like Jekyll manages some files, which is why I looked for a program that would make me the easiest to manage everything.
Among the various possibilities I chose Assemble, a program based on Nodejs and Grunt
Project managment
I have participated in several projects but nn I never had the task I manage them directly.
Usually, when I work alone, I organize the tasks writing it in a list of things to do.
Once I finish a task I struck out from the list, and step to the next.
So, when I saw Trello, it seemed the easiest way to switch between "hand-written" organization to a "digital."
I started creating on Trello and creating the project
Then i created three lists to divide the work: to do, doing ad completed
and I started to enter the first few sheets of things to do
I found Trello easy to use and very familiar, allows you to plan your work and share everything with your team im a fast and immediate way.
Once put aside Trello I looked at GANTT
Unlike Trello I found the GANTT much more complicated.
Right now I have difficulties to quantify the time required for some attivtà seen that I never made.
He gave me the idea to be a very interesting tool for those who have much more experience than I have me in this moment.