This commit is contained in:
Godwin
2014-07-11 19:48:44 -06:00
parent 623445411a
commit db621f244b
21 changed files with 541 additions and 145 deletions
+2 -1
View File
@@ -4,4 +4,5 @@
= tabs!
%h2=('About '+@conference.title)
%p=@conference.info.html_safe
%div{data: {editable: true}}
%p=@conference.info.html_safe
+4 -2
View File
@@ -4,6 +4,7 @@
%meta{ charset: 'utf-8' }
%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' }
%title= yield_or_default :title, controller.action_name.titlecase
%meta{ name: 'description', content: (yield_or_default :description, 'Bike!Bike! is an international annual gathering organized by and for community bicycle projects') }
= csrf_meta_tags
= yield :head
/ Le HTML5 shim, for IE6-8 support of HTML elements
@@ -25,8 +26,9 @@
\==================================================
/ Placed at the top of the document 'cause of turbolinks
=# javascript_include_tag '//use.typekit.net/iqv7hcg.js'
= javascript_include_tag 'application'
= javascript_include_tag 'nested_form'
= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'
=# javascript_include_tag 'application'
=# javascript_include_tag 'nested_form'
%body{ class: (yield_or_default :page_style) }
:javascript
+73
View File
@@ -0,0 +1,73 @@
- content_for :dom_ready
$('table#translations td.value').click(function() {
var $this = $(this);
if(!$this.find('.translation-form').length()) {
startTranslating($this);
}
});
if ($('table#translations').length()) {
$(document).click(function(event) {
$target = $(event.target);
if ($target.closest('table#translations').length() < 1 && !$target.hasClass('auto-translate')) {
stopTranslating();
}
$('.auto-translate').click (function(event) {
event.preventDefault();
$td = $(this).parent();
saveTranslation($td, null, true);
});
}
- content_for :scripts
function saveTranslation($td, $move_to, auto_translate) {
var val = '';
var do_auto_translate = true;
if (typeof auto_translate == "undefined" || !auto_translate) {
val = $td.find('textarea').val();
do_auto_translate = false;
}
var key = $td.parent().data().key;
var params = {
translationkey: key,
translationvalue: val,
translationlang: window.location.href.replace(/^.*\/(\w+)\/$/, '$1')
};
if (do_auto_translate) {
params['auto_translate'] = true;
}
$.post('/translate/', params, function(json) {
$td.html(json.translation);
if ($td.parent().hasClass('not-exists')) {
$td.parent().removeClass('not-exists');
$td.parent().addClass('exists');
}
$('.translation-form').remove();
if (typeof $move_to != "undefined" && $move_to) {
startTranslating($move_to);
}
});
}
function stopTranslating() {
$('.translation-form').remove();
}
function startTranslating($td) {
stopTranslating();
var value = $td.parent().hasClass('not-exists') ? '' : $td.html().trim();
var $tr = $td.parent();
var key = $tr.data().key;
$td.append('<div class="translation-form"><textarea>' + value + '</textarea><button class="small" data-key="' + key + '">Save</textarea>');
var $textarea = $td.find('textarea');
$textarea.select();
$td.find('.translation-form button').click(function() { saveTranslation($td); });
$textarea.keydown(function(event) {
if (event.keyCode == 9) {
event.preventDefault();
var $new_tr = event.shiftKey ? $tr.prev() : $tr.next();
saveTranslation($td, $new_tr.find('.value'));
} else if (event.keyCode == 27) {
stopTranslating();
}
});
}
+4 -1
View File
@@ -3,7 +3,7 @@
.row
%h1
= _ 'language_translations', vars: {:language => (_ ('languages.' + @lang))}
%table.columns#translations
%table.columns#translations{data: {token: form_authenticity_token}}
%thead
%tr
%th.key=_'translations.Key'
@@ -41,3 +41,6 @@
= translation_hint ? (_ "languages.#{I18n.locale.to_s}") + " = \"#{translation_hint}\"" : 'Nil'
- unless current_translation
%a{:href => '#', :class => 'auto-translate button small'}='Auto'
-# content_for :footer_scripts
= javascript_include_tag 'translations'
+11 -2
View File
@@ -1,6 +1,15 @@
%footer
%footer.row
.columns.medium-8.medium-push-1.large-6.large-push-3.text-center
%a{href: '/conferences/'}='Conferences'
\/
%a{href: '/conferences/'}='Organizations'
\/
%a{href: '/conferences/'}='Zine'
.columns.medium-3.large-3.text-right
&copy;2014 Bike!Bike!
:javascript
#{yield :scripts}
$(function(){
#{yield :dom_ready}
});
});
= yield :footer_scripts
+4 -3
View File
@@ -4,9 +4,10 @@
=# image_tag('logo-text.png', class: 'logo-text')
= icon('logo', {:class => 'logo'})
= icon('logo-text', {:class => 'logo-text'})
= link_to (_'Conferences'), :conferences, {:class => ['button', 'conference']}
= link_to (_'Organizations'), {:controller => :organizations}, {:class => ['button', 'organization']}
= link_to (_'Zine'), 'http://zinezine.bikebike.org', :class => ['button', 'article']
.buttons
= link_to (_'Conferences'), :conferences, {:class => ['button', 'conference']}
= link_to (_'Organizations'), {:controller => :organizations}, {:class => ['button', 'organization']}
= link_to (_'Zine'), 'http://zinezine.bikebike.org', :class => ['button', 'article']
- if is_this_the_front_page?
%p
Bike!Bike! is an international annual gathering organized by and for community bicycle projects. The conference is a space for participants from shops and related advocacy groups to converge in a different city each year over a 4 day period to have workshops and strengthen our social network.