Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for SVN to JSON metafile, frontend and URL parser

  • Loading branch information...
commit 0411d42398bf882ea2ab5e7188e380ca88df133e 1 parent ad3dfe7
@mathjazz authored
View
1  hooks/php/test/testpilot/pontoon.json
@@ -11,6 +11,7 @@
"audience": "Include the types of individuals and/or users your campaign targeting, the way that you want to engage or impact these individuals or groups, and the length of commitment (time) or level of engagement that you want to achieve. E.g. some projects will short or low levels of engagement, other will be more encompassing.",
"metrics": "Describe what success looks like and what measurement you will be using. Examples: Page views, Participants, Social Media mentions, Downloads."
},
+ "svn": "https://svn.mozilla.org/projects/l10n-misc/trunk/testpilot/",
"transifex": {
"project": "testpilot",
"resource": "index"
View
7 pontoon/base/static/js/app/main.js
@@ -714,6 +714,7 @@ var Pontoon = (function () {
Pontoon.project.info = value.info
Pontoon.project.pages = value.pages;
Pontoon.project.hooks = value.hooks;
+ Pontoon.project.svn = value.svn;
Pontoon.transifex.project = value.name;
Pontoon.transifex.resource = value.resource;
Pontoon.attachHandlers();
@@ -721,6 +722,9 @@ var Pontoon = (function () {
if (!Pontoon.transifex.project) {
$('#profile-menu .transifex').parent().remove();
}
+ if (!Pontoon.project.svn) {
+ $('#profile-menu .svn').parent().remove();
+ }
$("#spinner").fadeOut(function() {
$("#main > header > .container").fadeIn();
});
@@ -798,8 +802,7 @@ var Pontoon = (function () {
// Activate project code: pontoon.js (iframe cross-domain policy solution)
self.common.postMessage("INITIALIZE", {
locale: self.locale,
- path: self.app.path,
- transifex: self.transifex
+ path: self.app.path
});
// Wait for project code messages
View
18 pontoon/base/static/pontoon.js
@@ -12,7 +12,8 @@
info: null,
entities: [],
pages: {},
- hooks: false
+ hooks: false,
+ svn: ""
},
locale: {
code: "",
@@ -64,6 +65,7 @@
info: Pontoon.project.info,
pages: Pontoon.project.pages,
hooks: Pontoon.project.hooks,
+ svn: Pontoon.project.svn,
name: Pontoon.transifex.project,
resource: Pontoon.transifex.resource
});
@@ -216,7 +218,7 @@
/**
- * Load data from Transifex: original string, translation, comment, suggestions...
+ * Load data from DB: original string, translation, comment, suggestions...
* Match with each string in the document, which is prepended with l10n comment nodes
* Example: <!--l10n-->Hello World
*
@@ -242,7 +244,7 @@
parent = $(this).parent();
$(this).remove();
- // Match strings in the document with Transifex data
+ // Match strings in the document with DB data
$(data).each(function() {
// Renedered text could be different than source
parent.after('<div id="pontoon-string" style="display: none">' + this.key + '</div>');
@@ -272,7 +274,7 @@
}
});
- // Prepare unmatched Transifex entities to be displayed in Advanced mode
+ // Prepare unmatched DB entities to be displayed in Advanced mode
$(data).each(function() {
if(!this.pontoon) {
var entity = {};
@@ -511,8 +513,11 @@
$.getJSON(meta.data('meta')).success(function (data) {
Pontoon.project.pages = data.pages; // Pages URLs
Pontoon.project.info = data.info; // Campaign info
- Pontoon.transifex.project = data.transifex.project; // Transifex project
- Pontoon.transifex.resource = data.transifex.resource; // Transifex resource
+ Pontoon.project.svn = data.svn; // Project SVN repository
+ if (data.transifex) {
+ Pontoon.transifex.project = data.transifex.project; // Transifex project
+ Pontoon.transifex.resource = data.transifex.resource; // Transifex resource
+ }
Pontoon.project.title = document.title.split("-->")[1];
Pontoon.project.hooks = true;
loadEntities();
@@ -567,7 +572,6 @@
if (message.type === "INITIALIZE") {
Pontoon.locale = message.value.locale; // Set locale
Pontoon.app.path = message.value.path; // Set domain
- Pontoon.transifex = message.value.transifex; // Set Transifex credentials
loadJquery();
window.removeEventListener("message", initizalize, false);
}
View
1  pontoon/base/templates/translate.html
@@ -91,6 +91,7 @@
</div>
<ul id="profile-menu" class="menu">
<li><a class="sign-out" href="{{ url('logout') }}">{{ _('Sign out') }}</a></li>
+ <li><a class="svn" href="{{ url('pontoon.svn') }}">{{ _('Commit to SVN') }}</a></li>
<li><a class="transifex" href="{{ url('pontoon.transifex') }}">{{ _('Save to Transifex') }}</a></li>
<li><a class="html" href="{{ url('pontoon.download') }}">{{ _('Download as HTML') }}</a></li>
<li><a class="json" href="{{ url('pontoon.download') }}">{{ _('Download as JSON') }}</a></li>
View
3  pontoon/base/urls.py
@@ -11,5 +11,6 @@
url(r'^save/', views.save_translation, name='pontoon.save'),
url(r'^load/', views.load_entities, name='pontoon.load'),
url(r'^download/', views.download, name='pontoon.download'),
- url(r'^transifex/', views.transifex_save, name='pontoon.transifex'),
+ url(r'^transifex/', views.save_to_transifex, name='pontoon.transifex'),
+ url(r'^svn/', views.commit_to_svn, name='pontoon.svn'),
)
View
9 pontoon/base/views.py
@@ -386,7 +386,7 @@ def download(request, template=None):
return response
@login_required(redirect_field_name='', login_url='/404')
-def transifex_save(request, template=None):
+def save_to_transifex(request, template=None):
"""Save translations to Transifex."""
log.debug("Save to Transifex.")
@@ -427,6 +427,13 @@ def transifex_save(request, template=None):
except AttributeError:
return HttpResponse(response)
+@login_required(redirect_field_name='', login_url='/404')
+def commit_to_svn(request, template=None):
+ """Commit translations to SVN."""
+ log.debug("Commit translations to SVN.")
+
+ return HttpResponse("TODO")
+
def verify(request, template=None):
"""Verify BrowserID assertion, and return whether a user is registered."""
log.debug("Verify BrowserID assertion.")
Please sign in to comment.
Something went wrong with that request. Please try again.