Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

En picks/land more #226

Merged
merged 8 commits into from
Mar 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pootle/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"""This file contains the version of Pootle."""


build = 25202
build = 25203
sver = "2.5.2-alpha1"
ver = (2, 5, 2)
14 changes: 14 additions & 0 deletions pootle/apps/pootle_misc/upgrade/pootle.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,17 @@ def upgrade_to_25202():
from pootle.core.initdb import create_system_user

create_system_user()


def upgrade_to_25203():
"""Set `Submission` model's type to the new `SubmissionTypes.SYSTEM` for
submissions performed by the `system` user.
"""
from pootle_statistics.models import Submission, SubmissionTypes

Submission.objects.filter(
type=None,
submitter__user__username='system',
).update(
type=SubmissionTypes.SYSTEM,
)
1 change: 1 addition & 0 deletions pootle/apps/pootle_statistics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SubmissionTypes(object):
REVERT = 2 # Revert action on the web
SUGG_ACCEPT = 3 # Accepting a suggestion
UPLOAD = 4 # Uploading an offline file
SYSTEM = 5 # Batch actions performed offline


class SubmissionFields(object):
Expand Down
2 changes: 1 addition & 1 deletion pootle/apps/pootle_store/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ def update(self, update_structure=False, update_translation=False,
submitter=system,
unit=unit,
field=SubmissionFields.TARGET,
type=None,
type=SubmissionTypes.SYSTEM,
old_value=old_target_f,
new_value=unit.target_f
)
Expand Down
7 changes: 6 additions & 1 deletion pootle/apps/pootle_store/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,14 @@ def timeline(request, unit):
from pootle_store.fields import to_python

for key, values in groupby(timeline, key=lambda x: x.creation_time):
# Under Windows, the "nl_langinfo" method is not available
try:
time_str = key.strftime(locale.nl_langinfo(locale.D_T_FMT))
except NameError:
time_str = key
entry_group = {
'datetime': key,
'datetime_str': key.strftime(locale.nl_langinfo(locale.D_T_FMT)),
'datetime_str': time_str,
'entries': [],
}

Expand Down
5 changes: 5 additions & 0 deletions pootle/settings/90-dev-local.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG

# A list of strings representing the host/domain names that this Pootle server
# can serve. This is a Django's security measure. More details at
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['127.0.0.1', 'localhost']


#
# Backends
Expand Down
3 changes: 2 additions & 1 deletion pootle/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,8 @@ html[dir="rtl"] td.username

tr.even,
td.even,
li.even
li.even,
tr.view-row:nth-child(odd)
{
background: #f8f8f8;
}
Expand Down
26 changes: 7 additions & 19 deletions pootle/static/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,9 @@


/* Builds a single row */
buildRow: function (unit, cls) {
buildRow: function (unit) {
return [
'<tr id="row', unit.id, '" class="view-row ', cls ,'">',
'<tr id="row', unit.id, '" class="view-row">',
this.tmpl.vUnit({unit: unit.toJSON()}),
'</tr>'
].join('');
Expand All @@ -965,8 +965,6 @@
var unitGroups = this.getUnitGroups(),
groupSize = _.size(unitGroups),
currentUnit = this.units.getCurrent(),
cls = "even",
even = true,
rows = [],
i, unit;

Expand All @@ -986,11 +984,8 @@
if (unit.id === currentUnit.id) {
rows.push(this.getEditUnit());
} else {
rows.push(this.buildRow(unit, cls));
rows.push(this.buildRow(unit));
}

cls = even ? "odd" : "even";
even = !even;
}
}, this);

Expand All @@ -1002,22 +997,16 @@
buildCtxRows: function (units, extraCls) {
var i, unit,
currentUnit = this.units.getCurrent(),
cls = "even",
even = true,
rows = '';

for (i=0; i<units.length; i++) {
// FIXME: Please let's use proper models for context units
unit = units[i];
unit = $.extend({}, currentUnit.toJSON(), unit);

rows += '<tr id="ctx' + unit.id + '" class="ctx-row ' + extraCls +
' ' + cls + '">';
rows += '<tr id="ctx' + unit.id + '" class="ctx-row ' + extraCls + '">';
rows += this.tmpl.vUnit({unit: unit});
rows += '</tr>';

cls = even ? "odd" : "even";
even = !even;
}

return rows;
Expand Down Expand Up @@ -1725,9 +1714,11 @@
}

var uid = PTL.editor.units.getCurrent().id,
node = $("#extras-container"),
node = $(".translate-container"),
timelineUrl = l(['/xhr/units/', uid, '/timeline/'].join(''));

node.spin();

// Always abort previous requests so we only get results for the
// current unit
if (PTL.editor.timelineReq != null) {
Expand Down Expand Up @@ -1756,9 +1747,6 @@
$("#js-hide-timeline").show();
}
},
beforeSend: function () {
node.spin();
},
complete: function () {
node.spin(false);
},
Expand Down
7 changes: 5 additions & 2 deletions pootle/static/js/vendor/sorttable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/*
Modifications:
Copyright 2013 Evernote Corporation

***

SortTable
version 2
7th April 2007
Expand Down Expand Up @@ -50,8 +55,6 @@ sorttable = {
// Safari doesn't support table.tHead, sigh
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];

if (table.tHead.rows.length != 1) return; // can't cope with two header rows

// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
// "total" rows, for example). This is B&R, since what you're supposed
// to do is put them in a tfoot. So, if there are sortbottom rows,
Expand Down
6 changes: 5 additions & 1 deletion pootle/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@
$(function() {
$("[title], [original-title]").tipsy({
gravity: $.fn.tipsy.autoBounds(150, 'n'),
html: true, fade: true, delayIn: 750, live: true});
html: true,
fade: true,
delayIn: 750,
opacity: 1,
live: true});
$.ajaxSetup({ traditional: true });
$.ajaxPrefilter(function (options, originalOptions) {
if (options.type === 'post' || options.type === 'POST') {
Expand Down