-
Notifications
You must be signed in to change notification settings - Fork 69
[NZ changes] reset password fixes, translatable terms, Inquiry -> Request, max hours in transfers removed #678
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
Changes from all commits
c7c52ea
09e7338
796675a
1fc4a93
6be0b67
433c53e
88d8900
efaf165
fe85595
d405b50
b0c8154
9716380
1193176
af02e24
a95d982
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module ActiveAdminHelper | ||
def render_translations(attribute, joiner = " | ") | ||
attribute.map do |locale, translation| | ||
tag.strong("#{I18n.t("locales.#{locale}", locale: locale)}: ") + | ||
tag.span(translation) | ||
end.join(joiner).html_safe | ||
end | ||
end |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class MakeTermsTranslatable < ActiveRecord::Migration[6.1] | ||
def up | ||
add_column :documents, :title_translations, :jsonb, default: {}, null: false | ||
add_column :documents, :content_translations, :jsonb, default: {}, null: false | ||
Document.find_each do |doc| | ||
doc.update_columns(title_translations: { es: doc[:title] }, content_translations: { es: doc[:content] }) | ||
end | ||
remove_column :documents, :title | ||
remove_column :documents, :content | ||
end | ||
|
||
def down | ||
add_column :documents, :title, :text | ||
add_column :documents, :content, :text | ||
Document.find_each do |doc| | ||
doc.update_columns(title: doc.title_translations["es"], content: doc.content_translations["es"]) | ||
end | ||
remove_column :documents, :title_translations | ||
remove_column :documents, :content_translations | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
RSpec.describe ActiveAdminHelper do | ||
describe '#render_translations' do | ||
it 'renders hash to HTML' do | ||
attr_with_translations = { en: 'hi', es: 'hola' } | ||
expect(helper.render_translations(attr_with_translations)).to eq("<strong>English: </strong><span>hi</span> | <strong>Español: </strong><span>hola</span>") | ||
end | ||
end | ||
end |
Uh oh!
There was an error while loading. Please reload this page.