Skip to content

Commit edf0c66

Browse files
author
Stefano Verna
committed
Tabs are red if contain errors
1 parent ae63b18 commit edf0c66

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

app/assets/javascripts/active_admin/active_admin_globalize3.js.coffee

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$ ->
22

33
translations = ->
4+
45
$(".activeadmin-translations > ul").each ->
56
$dom = $(this)
67
if !$dom.data("ready")
@@ -18,6 +19,12 @@ $ ->
1819

1920
$tabs.eq(0).click()
2021

22+
$tabs.each ->
23+
$tab = $(@)
24+
$content = $contents.filter($tab.attr("href"))
25+
containsErrors = $content.find(".input.error").length > 0
26+
$tab.toggleClass("error", containsErrors)
27+
2128
# this is to handle elements created with has_many
2229
$("a").bind "click", ->
2330
setTimeout(

app/assets/stylesheets/active_admin/active_admin_globalize3.css.sass

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@
2323
padding-bottom: 8px + 4px
2424
margin-bottom: 0
2525

26+
&.error
27+
color: #932419
28+
2629
&.active
2730
background: #f4f4f4
2831
+inset-shadow(0, 4px, 4px, #ddd)
2932
+border-top-radius(4px)
3033
margin-bottom: 0
3134
+gradient($secondary-gradient-stop, #f4f4f4)
3235
text-shadow: 0 1px 0 white
36+
color: #666 !important
3337

3438
&> fieldset.inputs
3539
margin-bottom: 0

0 commit comments

Comments
 (0)