Skip to content

Commit

Permalink
fixing behaviour for empty values.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlitwiniuk committed Jun 12, 2013
1 parent faf1dbb commit ce614d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/lit/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui
// require jquery-ui
//= require bootstrap
//= require_tree .

Expand Down
5 changes: 2 additions & 3 deletions app/views/lit/localization_keys/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
<tr>
<%- localization = lk.localizations.where(:locale_id=>Lit.init.cache.find_locale(locale).id).first %>
<% unless localization %>
<%- lk.interpolated_key = lk.localization_key.split('.').last.humanize %>
<%- lk.clone_localizations %>
<% Lit.init.cache.refresh_key("#{locale}.#{lk.localization_key}") %>
<%- localization = lk.localizations.where(:locale_id=>Lit.init.cache.find_locale(locale).id).first %>
<% end %>
<td class="localization_row" data-id="<%= localization.id%>" data-edit="<%= edit_localization_key_localization_path(lk, localization) %>" data-editing=0 data-content="<%= ejs(Lit.init.cache["#{locale}.#{lk.localization_key}"])%>">
<%= Lit.init.cache["#{locale}.#{lk.localization_key}"] || localization.get_value %>
<%= Lit.init.cache["#{locale}.#{lk.localization_key}"] %>
</td>
<td class="locale_row">
<%= image_tag "lit/famfamfam_flags/#{locale[0,2]}.png" %>
Expand Down
4 changes: 2 additions & 2 deletions lib/lit/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def find_localization(locale, key_without_locale, value=nil)
if value.is_a?(Array)
new_value = nil
value_clone = value.dup
while (v = value_clone.pop) && v.present?
while (v = value_clone.shift) && v.present?
pv = parse_value(v, locale)
new_value = pv unless pv.nil?
end
Expand Down Expand Up @@ -176,7 +176,7 @@ def find_localization(locale, key_without_locale, value=nil)
## hashes are converted do string (for now)
def parse_value(v, locale)
new_value = nil
case v.class
case v
when Symbol then
lk = Lit::LocalizationKey.where(:localization_key=>v.to_s).first
if lk
Expand Down

0 comments on commit ce614d7

Please sign in to comment.