Skip to content

Commit

Permalink
Merge pull request #27 from davidbgk/26-improve-performances
Browse files Browse the repository at this point in the history
Improve performances (CPU, cache, memory)
  • Loading branch information
noirbizarre committed May 26, 2015
2 parents d988b5d + fc01c80 commit 8d7c43a
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 42 deletions.
4 changes: 1 addition & 3 deletions udata/static/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
define(['logger', 'jquery'], function(Logger, $) {
return {
start: function() {
$('.carousel').carousel({
interval: 5000
});
$('.carousel').carousel();
Logger.debug('Home page started');
}
};
Expand Down
1 change: 0 additions & 1 deletion udata/static/js/topic/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ define(['jquery', 'dotdotdot'], function($) {
$(function() {
// Handle ellipsis and more button
$('.topic-excerpt').dotdotdot({
watch: true,
callback: function( isTruncated, $content ) {
var $more = $('.more');
if (isTruncated) {
Expand Down
29 changes: 12 additions & 17 deletions udata/static/js/utils/ellipsis.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
define(['jquery', 'bootstrap', 'dotdotdot'], function($) {

$(function() {
$('.ellipsis-dot').dotdotdot();

$(function() {
// Set simple ellipsis
$('.ellipsis-dot').dotdotdot({
watch: true
});

$('.ellipsis-tooltip').dotdotdot({
watch: true,
callback: function( isTruncated, orgContent ) {
if (isTruncated) {
$(this).tooltip({
title: orgContent.text()
});
}
}
});
});
$('.ellipsis-tooltip').dotdotdot({
callback: function( isTruncated, orgContent ) {
if (isTruncated) {
$(this).tooltip({
title: orgContent.text()
});
}
}
});
});

});
3 changes: 2 additions & 1 deletion udata/templates/api/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
{% for client in clients %}
<tr class="oauth-client" data-id="{{ client.id }}">
<td class="text-center">
<img src="{{ client.image(20)|placeholder }}" width="20px" height="20px">
<img src="{{ client.image(20)|placeholder }}"
width="20" height="20">
</td>
<td>{{ client.name }}</td>
<td class="maintainer">
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/dataset/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{% if dataset.organization %}
<a class="card-logo" href="{{ dataset_url }}">
<img alt="{{ dataset.organization.name }}"
src="{{ dataset.organization.logo(70)|placeholder('organization') }}">
src="{{ dataset.organization.logo(70)|placeholder('organization') }}"
width="70" height="70">
</a>
{% if dataset.organization.public_service %}
<img src="{{ theme_static('img/certified-stamp.png') }}" alt="certified"
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/dataset/search-result.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{% if dataset.organization %}
<div class="result-logo pull-left">
<img alt="{{ dataset.organization.title }}"
src="{{ dataset.organization.logo(70)|placeholder('organization') }}">
src="{{ dataset.organization.logo(70)|placeholder('organization') }}"
width="70" height="70">
</div>
{% if dataset.organization.public_service %}
<img src="{{theme_static('img/certified-stamp.png')}}" alt="certified"
Expand Down
13 changes: 9 additions & 4 deletions udata/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
{% if current_user.is_authenticated() %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="{{ current_user|avatar_url(20) }}" width="20" height="20" />
<img src="{{ current_user|avatar_url(20) }}"
width="20" height="20" />
{{ current_user.fullname }} <b class="caret"></b>
</a>
<ul class="dropdown-menu">
Expand All @@ -49,7 +50,8 @@
{% for org in current_user.organizations %}
<li>
<a href="{{ url_for('organizations.show', org=org) }}">
<img src="{{ org.logo|placeholder('organization') }}" width="20px" height="20px"/>
<img src="{{ org.logo|placeholder('organization') }}"
width="20" height="20"/>
{{ org.name }}
</a>
</li>
Expand Down Expand Up @@ -77,14 +79,17 @@
<button class="btn btn-link dropdown-toggle" data-toggle="dropdown">
</button> #}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="{{ theme_static('img/flags/{0}.png'.format(g.lang_code)) }}" alt="Current locale flag" />
<img src="{{ theme_static('img/flags/{0}.png'.format(g.lang_code)) }}"
alt="Current locale flag"
width="16" height="16" />
</a>
<ul class="dropdown-menu">
{% for code, name in config['LANGUAGES'].items() %}
<li>
<a href="{{ request.url.replace('/{0}/'.format(g.lang_code),'/{0}/'.format(code)) }}">
<img src="{{ theme_static('img/flags/{0}.png'.format(code)) }}"
alt="{{name}} flag" />
alt="{{name}} flag"
width="16" height="16" />
{{name}}
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion udata/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'keywords': [_('home')],
} %}

{% block extra_head %}
{% block extra_css %}
{% assets "home-css" %}
<link href="{{ ASSET_URL }}" rel="stylesheet">
{% endassets %}
Expand Down
2 changes: 1 addition & 1 deletion udata/templates/layouts/form.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends theme('layouts/1-column.html') %}
{% set section_class = 'form' %}

{% block extra_head %}
{% block extra_css %}
{% assets "forms-css" %}
<link href="{{ ASSET_URL }}" rel="stylesheet">
{% endassets %}
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/organization/card.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="card organization-card">
<a class="card-logo" href="{{ url_for('organizations.show', org=organization) }}">
<img alt="{{ organization.title }}"
src="{{ organization.logo(60)|placeholder('organization') }}">
src="{{ organization.logo(60)|placeholder('organization') }}"
width="60" height="60">
</a>
{% if organization.public_service %}
<img src="{{ theme_static('img/certified-stamp.png') }}" alt="certified"
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/organization/search-result.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<a href="{{ url_for('organizations.show', org=organization) }}" title="{{ organization.name }}">
<div class="result-logo pull-left">
<img alt="{{ organization.title }}"
src="{{ organization.logo(70)|placeholder('organization') }}">
src="{{ organization.logo(70)|placeholder('organization') }}"
width="70" height="70">
</div>
{% if organization.public_service %}
<img src="{{static('img/certified-stamp.png')}}" alt="certified"
Expand Down
3 changes: 1 addition & 2 deletions udata/templates/raw.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{% assets site_css_bundle %}
<link href="{{ ASSET_URL }}" rel="stylesheet">
{% endassets %}
{% block extra_css %}{% endblock %}

<link rel="theme-static-root" href="{{ theme_static('') }}" />
<link rel="static-root" href="{{ static('') }}" />
Expand Down Expand Up @@ -59,8 +60,6 @@

{{ i18n_alternate_links() }}



{% set base_url = static('js/' if config.ASSETS_DEBUG else 'js-built') %}
<script>var require = {baseUrl: "{{ base_url }}"};</script>
{% assets "require-js" %}
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/reuse/card.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="card reuse-card">
<a class="card-logo" href="{{ url_for('reuses.show', reuse=reuse) }}">
<img alt="{{ reuse.title }}"
src="{{ reuse.image(86)|placeholder('reuse') }}">
src="{{ reuse.image(86)|placeholder('reuse') }}"
width="86" height="86">
</a>

<div class="card-body">
Expand Down
6 changes: 4 additions & 2 deletions udata/templates/reuse/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ <h3 class="text-left">{{ _('Producer') }}</h3>
<a href="{{ url_for('organizations.show', org=reuse.organization) }}"
title="{{ reuse.organization.name }}">
<img src="{{ reuse.organization.logo(150)|placeholder('organization') }}"
alt="{{ reuse.organization.name }}" class="organization-logo producer" />
alt="{{ reuse.organization.name }}" class="organization-logo producer"
width="150" height="150"/>
</a>
<div class="caption text-left">
{% if reuse.organization.description %}
Expand Down Expand Up @@ -198,7 +199,8 @@ <h3 class="text-left">{{ _('Author') }}</h3>
<a href="{{ url_for('users.show', user=reuse.owner) }}"
title="{{ reuse.owner.fullname }}">
<img src="{{ reuse.owner.avatar(150)|placeholder('user') }}"
alt="{{ reuse.owner.fullname }}" class="scalable"/>
alt="{{ reuse.owner.fullname }}" class="scalable"
width="150" height="150"/>
</a>
<h4 class="text-center">{{ reuse.owner.fullname }}</h4>
<div class="caption text-left">
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/reuse/search-result.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<a href="{{ url_for('reuses.show', reuse=reuse) }}" title="{{ reuse.title }}">
<div class="result-logo pull-left">
<img alt="{{ reuse.title }}"
src="{{ reuse.image(70)|placeholder('reuse') }}">
src="{{ reuse.image(70)|placeholder('reuse') }}"
width="70" height="70">
</div>
<div class="result-body ellipsis-dot">
<h4 class="result-title">{{ reuse.title }}</h4>
Expand Down
2 changes: 1 addition & 1 deletion udata/templates/topic/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h3>{{ _('Best reuse cases') }}</h3>
<div class="row">
{# Carousel #}
<div class="col-md-8">
<div id="home-carousel" class="carousel slide" data-ride="carousel" data-interval="4000">
<div id="home-carousel" class="carousel slide" data-ride="carousel" data-interval="6000">
<!-- Wrapper for slides -->
<div class="carousel-inner">
{% for reuse in featured_reuses %}
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/user/card.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% set user_url = url_for('users.show', user=user) %}
<div class="card">
<a class="card-logo" href="{{ user_url }}">
<img src="{{ user|avatar_url(48) }}" alt="{{ user.fullname }}">
<img src="{{ user|avatar_url(48) }}" alt="{{ user.fullname }}"
width="48" height="48">
</a>

<div class="card-body">
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/user/edit_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<a href="{{ url_for('users.show', user=user) }}"
title="{{ user.fullname }}">
<img src="{{ user.avatar(150)|placeholder('user') }}"
alt="{{ user.fullname }}" class="scalable" itemprop="image"/>
alt="{{ user.fullname }}" class="scalable" itemprop="image"
width="150" height="150"/>
</a>
<h3>{{ user.fullname }}</h3>
{% if user.about %}
Expand Down
3 changes: 2 additions & 1 deletion udata/templates/user/search-result.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<a href="{{ url_for('users.show', user=user) }}" title="{{ user.fullname }}">
<div class="result-logo pull-left">
<img alt="{{ user.fullname }}"
src="{{ user.avatar(70)|placeholder('user') }}">
src="{{ user.avatar(70)|placeholder('user') }}"
width="70" height="70">
</div>
<div class="result-body ellipsis-dot">
<h4 class="result-title">{{ user.fullname }}</h4>
Expand Down

0 comments on commit 8d7c43a

Please sign in to comment.