diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd258b..4e28f37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ActiveAdmin Translate Changelog +## 0.3.1 - June 19, 2014 + +- Various fix for recent versions of ActiveAdmin +- Improve css for tabs + ## 0.2.2 - November 16, 2012 - Include SCSS mixins. diff --git a/app/assets/stylesheets/active_admin/translate.css.scss b/app/assets/stylesheets/active_admin/translate.css.scss index c65ecab..f4bbb75 100644 --- a/app/assets/stylesheets/active_admin/translate.css.scss +++ b/app/assets/stylesheets/active_admin/translate.css.scss @@ -5,6 +5,7 @@ .activeadmin-translate .locales { overflow: auto; margin-right: 10px; + margin-bottom: -1px; li { @include section-header; @@ -12,10 +13,30 @@ border-top-left-radius: 10px; border-top-right-radius: 10px; - float: right !important; + float: left; + + margin-bottom: 0; + padding-left: 0; + padding-right: 0; + + a { + padding: .5em 1em; + text-decoration: none; + + &:hover,&:active { + text-decoration: underline; + } + } &.ui-state-active { background: white; + border-bottom-color: white; + + a { + color: $section-header-text-color; + cursor: default; + text-decoration: none; + } } } } @@ -32,52 +53,13 @@ display: none !important; } - .ui-tabs { - position: relative; - padding: .2em; - zoom: 1; - } - - .ui-tabs .ui-tabs-nav { - margin: 0; - padding: .2em .2em 0; - } - - .ui-tabs .ui-tabs-nav li { - list-style: none; - float: left; - position: relative; - top: 0; - margin: 1px .2em 0 0; - border-bottom: 0; - padding: 0; - white-space: nowrap; - } - - .ui-tabs .ui-tabs-nav li a { - float: left; - padding: .5em 1em; - text-decoration: none; - } - - .ui-tabs .ui-tabs-nav li.ui-tabs-active { - margin-bottom: -1px; - padding-bottom: 1px; - } - - .ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { - cursor: text; - } - - .ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { - cursor: pointer; - } + // locales nested in another fieldset + .inputs .activeadmin-translate { + margin-left: 10px; + margin-right: 10px; - .ui-tabs .ui-tabs-panel { - display: block; - border-width: 0; - padding: 1em 1.4em; - background: none; + .locale { + border-bottom: 1px solid #ddd; + } } - } diff --git a/lib/active_admin/translate/version.rb b/lib/active_admin/translate/version.rb index e5344fc..248a093 100644 --- a/lib/active_admin/translate/version.rb +++ b/lib/active_admin/translate/version.rb @@ -1,6 +1,6 @@ module ActiveAdmin module Translate # The current released version - VERSION = '0.2.2' + VERSION = '0.3.1' end end diff --git a/lib/active_admin/views/translate_attributes_table.rb b/lib/active_admin/views/translate_attributes_table.rb index 3aaa7cc..0ccf3d6 100644 --- a/lib/active_admin/views/translate_attributes_table.rb +++ b/lib/active_admin/views/translate_attributes_table.rb @@ -2,24 +2,35 @@ module ActiveAdmin module Translate # Adds a builder method `translate_attributes_table_for` to build a - # table with translations for a model that has been localized with - # Globalize3. + # table with translations for a model that has been localized. # class TranslateAttributesTable < ::ActiveAdmin::Views::AttributesTable builder_method :translate_attributes_table_for - def row(attr, &block) + def row(*args, &block) + title = args[0] + options = args.extract_options! + classes = [:row] + if options[:class] + classes << options[:class] + elsif title.present? + classes << "row-#{title.to_s.parameterize('_')}" + end + options[:class] = classes.join(' ') + ::I18n.available_locales.each_with_index do |locale, index| - @table << tr do + @table << tr(options) do if index == 0 th :rowspan => ::I18n.available_locales.length do - header_content_for(attr) + header_content_for(title) end end - td do - ::I18n.with_locale locale do - content_for(block || attr) + @collection.each do |record| + td do + ::I18n.with_locale locale do + content_for(record, block || title) + end end end end