Navigation Menu

Skip to content

Commit

Permalink
New homepage + optimize activities
Browse files Browse the repository at this point in the history
- activities better visibility on homepage
- links on a separate page
- 2 popups to explain what is the game and the site
- when logged in, our idol producer visible on top
  • Loading branch information
db0company committed Nov 14, 2015
1 parent 14425e0 commit 171a94d
Show file tree
Hide file tree
Showing 54 changed files with 604 additions and 447 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -65,3 +65,4 @@ web/static/events
/cardsinfo.json
web/static/css/style.css
schoolidolapi/local_settings.py
schoolidolapi/generated_settings.py
19 changes: 1 addition & 18 deletions web/links.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _

def get_links(current_en, current_jp):
return [
links = [
{
'name': _('Download'),
'link': 'download',
Expand Down Expand Up @@ -469,22 +468,6 @@ def get_links(current_en, current_jp):
'type': 'info',
'language': 'world',
},
{
'name': _('Latest Event English Version'),
'description': current_en.english_name,
'url': '/event/' + current_en.japanese_name + '/',
'size': 'big',
'type': 'info',
'language': 'english',
},
{
'name': _('Latest Event Japanese Version'),
'description': current_jp.japanese_name,
'url': '/event/' + current_jp.japanese_name + '/',
'size': 'big',
'type': 'info',
'language': 'japanese',
},
{
'name': _('Events Points Calculator'),
'url': 'https://yefta.com/llsif/',
Expand Down
Binary file added web/static/about.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/aboutschoolidoltomodachi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/background10.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/background11.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/background7.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/background8.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/background9.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/honokoto0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/honokoto1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/honokoto2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/honokoto3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/honokoto4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/honokoto5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/static/honokoto6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 28 additions & 77 deletions web/static/js/index.js
@@ -1,83 +1,34 @@

$("a[href^='#']").on('click', function(e) {
e.preventDefault();
var hash = this.hash;
if (hash != '' && hash.indexOf('Modal') < 0) {
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 300, function(){
window.location.hash = hash;
});
var avatar_size = 2;
var card_size = 133;

function loadActivities() {
var container, feed;
if ($('#myactivities').length > 0) {
container = $('#myactivities');
feed = true;
} else {
container = $('#activities');
feed = undefined;
}
});
container.find('.activities').html('<div class="loader">Loading...</div>');
$.get('/ajax/' + (typeof feed == 'undefined' ? 'activities' : 'feed')
+ '/?avatar_size=' + avatar_size + '&card_size=' + card_size, function(data) {
container.find('.activities').html(data);
$(window).scroll(
function () {
var button = $('a[href="#loadMoreActivities"]');
if (button.length > 0
&& button.find('.loader').length == 0
&& ($(window).scrollTop() + $(window).height())
>= ($(document).height() - button.height())) {
loadMoreActivitiesOnClick(button, container, undefined, feed, avatar_size, card_size);
}
});
});
}

$(document).ready(function() {
$('[data-toggle="popover"]').popover();

$(".link-details a[href^='#']").hide();
$(".link-stars a[href^='#']").hover(function(e) {
$(".link-details a[href^='#']").hide();
$(".link-details a[href=" + $(this).attr('href') + "]").show();
});

$('.link-stars-side a .name').hide();
$('.link-stars-side a .btn').hover(function() {
$('.link-stars-side a .name').hide();
$(this).parent().find('.name').show();
}, function() {
$(this).parent().find('.name').hide();
});

$('.mainhome').css('min-height', $(window).height() - $('.navbar-Smile').height());
$('.home-section').css('min-height', $(window).height());

$('.link-stars-side').hide();
$(window).scroll(
function () {
if (($(window).scrollTop() + $(window).height())
>= $("#home").height() + $('.bg-Rainbow-1').height() + $('.navbar-Smile').height()
&& ($(window).scrollTop() + $(window).height())
<= $("#home").height() + $('.navbar-Smile').height() + $('#links').height() + 100) {
$('.link-stars-side').show();
} else {
$('.link-stars-side').hide();
}
if ($('#activities .activities').html() == ''
&& ($(window).scrollTop() + $(window).height())
>= $("#home").height() + $('.navbar-Smile').height() + $('#links').height()) {
$('#activities .activities').text('Loading...');
$.get('/ajax/activities/', function(data) {
$('#activities .activities').html(data);
loadMoreActivities($('#activities .activities'), undefined, undefined , undefined);
});
if ($('#myactivities').length > 0) {
$('#myactivities .activities').text('Loading...');
$.get('/ajax/feed/', function(data) {
$('#myactivities .activities').html(data);
loadMoreActivities($('#myactivities .activities'), undefined, true, 1);
});
}
}
if (($(window).scrollTop() + $(window).height())
>= $(".mainhome").height() - $('.mainhome .events').height() + $('.navbar-Smile').height() && !$('.mainhome .events').hasClass('loaded')) {
$('.mainhome .events').addClass('loaded');
$.getJSON('http://schoolido.lu/contest/json/current', function(data) {
if (data['current'] == true) {
var event = $('.mainhome .events .event').first();
event.css('background-image', 'url(\'/static/currentcontest.png\')');
event.find('span').text(data['name']);
event.find('small').text(data['begin'] + ' ' + data['end']);
event.attr('href', '/contest/contest');
}
});
}
});
$('.navbar-fixed-top').on('activate.bs.scrollspy', function () {
var currentItem = $(".nav li.active > a").attr('href');
if (currentItem == '#page-top') {
$('.navbar-fixed-top').fadeOut();
} else {
$('.navbar-fixed-top').fadeIn();
}
})
loadActivities();
});
10 changes: 10 additions & 0 deletions web/static/js/links.js
@@ -0,0 +1,10 @@

$(document).ready(function() {
$('.link-stars-side a .name').hide();
$('.link-stars-side a .btn').hover(function() {
$('.link-stars-side a .name').hide();
$(this).parent().find('.name').show();
}, function() {
$(this).parent().find('.name').hide();
});
});
7 changes: 4 additions & 3 deletions web/static/js/loadactivities.js
Expand Up @@ -3,14 +3,15 @@ function getButton(parent) {
return parent.find('a[href="#loadMoreActivities"]');
}

function loadMoreActivitiesOnClick(button, parent, account, feed, avatar_size) {
function loadMoreActivitiesOnClick(button, parent, account, feed, avatar_size, card_size) {
var div = button.parent();
var page = div.attr('data-page');
div.html('<span class="loader">Loading...</span>');
$.get('/ajax/' + (typeof feed == 'undefined' ? 'activities' : 'feed')
+ '/?page=' + page
+ (typeof account == 'undefined' ? '' : ('&account=' + account))
+ (typeof avatar_size == 'undefined' ? '' : ('&avatar_size=' + avatar_size))
+ (typeof card_size == 'undefined' ? '' : ('&card_size=' + card_size))
,
function(data) {
div.replaceWith(data);
Expand All @@ -23,7 +24,7 @@ function loadMoreActivitiesOnClick(button, parent, account, feed, avatar_size) {
});
}

function loadMoreActivities(parent, account, feed, avatar_size) {
function loadMoreActivities(parent, account, feed, avatar_size, card_size) {
avatarStatus();
updateActivities();
// Reload disqus comments count
Expand All @@ -32,6 +33,6 @@ function loadMoreActivities(parent, account, feed, avatar_size) {
var button = getButton(parent);
button.click(function(e) {
e.preventDefault();
loadMoreActivitiesOnClick(button, parent, account, feed, avatar_size);
loadMoreActivitiesOnClick(button, parent, account, feed, avatar_size, card_size);
});
}
18 changes: 16 additions & 2 deletions web/static/js/main.js
Expand Up @@ -3,6 +3,14 @@ function getInterfaceColor() {
return $('body').attr('class').replace('interface-', '');
}

$('a.page-scroll').bind('click', function(event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500, 'easeInOutExpo');
event.preventDefault();
});

$("#togglebutton").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
Expand All @@ -21,7 +29,7 @@ function freeModal(title, body, buttons) {
$('#freeModal').modal('show');
}

function globalModal(hash) {
function globalModal(hash, modal_size) {
if (hash == 'donate') {
window.location.href = "/donate/";
return;
Expand All @@ -33,6 +41,11 @@ function globalModal(hash) {
$.get('/ajax/modal/' + hash +
'/?interfaceColor=' + getInterfaceColor(), function(data) {
$('#modal .modal-content').html(data);
$('#modal .modal-dialog').removeClass('modal-lg');
$('#modal .modal-dialog').removeClass('modal-sm');
if (typeof modal_size != 'undefined') {
$('#modal .modal-dialog').addClass('modal-' + modal_size);
}
$('#modal').modal('show');
modalHandler();
});
Expand Down Expand Up @@ -76,9 +89,10 @@ function avatarStatus() {
}

function modalHandler() {
$('[data-toggle=ajaxmodal]').unbind('click');
$('[data-toggle=ajaxmodal]').click(function(e) {
e.preventDefault();
globalModal($(this).attr('href').replace('#', '').replace('Modal', ''));
globalModal($(this).attr('href').replace('#', '').replace('Modal', ''), $(this).data('modal-size'));
});
}

Expand Down
1 change: 1 addition & 0 deletions web/static/less/mixins/circled_card.less
Expand Up @@ -74,5 +74,6 @@
.circled_card_50 { .circled_card(50px); }
.circled_card_70 { .circled_card(70px); }
.circled_card_100 { .circled_card(100px); }
.circled_card_133 { .circled_card(133px); }
.circled_card_150 { .circled_card(150px); }
.circled_card_200 { .circled_card(200px); }

0 comments on commit 171a94d

Please sign in to comment.