Skip to content

Commit 89f45a4

Browse files
committed
Merge pull request activeadmin#267 from mattvague/master
Lightened up flash messages a bit, and added translation for dashboard
2 parents 97f2f90 + 5e692bf commit 89f45a4

File tree

8 files changed

+37
-15
lines changed

8 files changed

+37
-15
lines changed

app/assets/stylesheets/active_admin/_forms.css.scss

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,29 @@ $sidebar-inner-content-width: $sidebar-width - ($section-padding * 2);
202202

203203
// -------------------------------------- Filter Forms
204204

205-
$date-range-filter-seperator-width: 12px;
205+
$filter-field-seperator-width: 12px;
206+
207+
$side-by-side-filter-input-width: ($sidebar-inner-content-width / 2) - ($text-input-horizontal-padding * 2) - $filter-field-seperator-width;
208+
$side-by-side-filter-select-width: ($sidebar-inner-content-width / 2) - $filter-field-seperator-width;
209+
206210
$date-range-filter-input-right-padding: 27px;
207211
$date-range-filter-input-horizontal-padding: $date-range-filter-input-right-padding + $text-input-horizontal-padding;
212+
$date-range-filter-input-width: ($sidebar-inner-content-width / 2) - $filter-field-seperator-width - $date-range-filter-input-horizontal-padding;
208213

209214
form.filter_form {
210215
.filter_form_field {
211216
margin-bottom: 10px;
212217
clear: both;
213218

214-
&.filter_numeric { input[type=text] { width: 80px; margin-left: 5px; } }
219+
&.filter_numeric {
220+
input[type=text] {
221+
margin-left: $filter-field-seperator-width + 4;
222+
width: $side-by-side-filter-input-width;
223+
}
224+
select {
225+
width: $side-by-side-filter-select-width;
226+
}
227+
}
215228

216229
&.filter_check_boxes {
217230
label { margin-bottom: 3px; }
@@ -228,13 +241,13 @@ form.filter_form {
228241
.seperator {
229242
display: inline-block;
230243
text-align: center;
231-
width: $date-range-filter-seperator-width;
244+
width: $filter-field-seperator-width;
232245
}
233246

234247
input[type=text] {
235248
background: #fff url(active_admin_image_path('datepicker/datepicker-input-icon.png')) no-repeat 100% 7px;
236249
padding-right: $date-range-filter-input-right-padding;
237-
width: ($sidebar-inner-content-width / 2) - $date-range-filter-seperator-width - $date-range-filter-input-horizontal-padding;
250+
width: $date-range-filter-input-width;
238251
}
239252
}
240253
}

app/assets/stylesheets/active_admin/components/_flash_messages.css.scss

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
body.logged_in {
22
.flash {
33
@include primary-gradient;
4-
@include shadow;
5-
@include text-shadow(#222);
4+
@include text-shadow(#fafafa);
65
background-color: #a24a42;
76
border: none;
8-
border-bottom: 1px solid #44484B;
97
color: #fff;
108
font-weight: bold;
9+
font-size: 1.1em;
1110
line-height: 1.0em;
1211
margin-bottom: 10px;
13-
padding: 12px 30px;
12+
padding: 13px 30px 11px;
1413

15-
&.flash_notice { @include gradient(#7d9582, #667d6a); }
16-
&.flash_error { @include gradient(#a8716d, #955c59); }
14+
&.flash_notice {
15+
@include gradient(#dce9dd, #ccdfcd);
16+
border-bottom: 1px solid #adcbaf;
17+
color: #416347;
18+
}
19+
&.flash_error {
20+
@include gradient(#f5e4e4, #f1dcdc);
21+
border-bottom: 1px solid #e0c2c0;
22+
color: #b33c33;
23+
}
1724
}
1825
}
1926

lib/active_admin/dashboards/dashboard_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def index
1212
protected
1313

1414
def set_current_tab
15-
@current_tab = "Dashboard"
15+
@current_tab = I18n.t("active_admin.dashboard")
1616
end
1717

1818
def find_sections

lib/active_admin/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
en:
22
active_admin:
3+
dashboard: Dashboard
34
dashboard_welcome:
45
welcome: "Welcome to Active Admin. This is the default dashboard page."
56
call_to_action: "To add dashboard sections, checkout 'app/admin/dashboards.rb'"

lib/active_admin/namespace.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def generate_dashboard_controller
171171
# Adds the dashboard to the menu
172172
def register_dashboard
173173
dashboard_path = root? ? :dashboard_path : "#{name}_dashboard_path".to_sym
174-
menu.add("Dashboard", dashboard_path, 1) unless menu["Dashboard"]
174+
menu.add(I18n.t("active_admin.dashboard"), dashboard_path, 1) unless menu[I18n.t("active_admin.dashboard")]
175175
end
176176

177177
# Does all the work of registernig a config with the menu system

lib/active_admin/views/pages/dashboard.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def main_content
1717
def build_sidebar; end
1818

1919
def title
20-
"Dashboard"
20+
I18n.t("active_admin.dashboard")
2121
end
2222

2323
def render_sections(sections)

spec/support/rails_template.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Generate some test models
99
generate :model, "post title:string body:text published_at:datetime author_id:integer category_id:integer"
1010
inject_into_file 'app/models/post.rb', " belongs_to :author, :class_name => 'User'\n belongs_to :category\n accepts_nested_attributes_for :author\n", :after => "class Post < ActiveRecord::Base\n"
11-
generate :model, "user type:string first_name:string last_name:string username:string"
11+
generate :model, "user type:string first_name:string last_name:string username:string age:integer"
1212
inject_into_file 'app/models/user.rb', " has_many :posts, :foreign_key => 'author_id'\n", :after => "class User < ActiveRecord::Base\n"
1313
generate :model, "publisher --migration=false --parent=User"
1414
generate :model, 'category name:string description:text'

spec/support/rails_template_with_data.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
first, last = name.split(" ")
1313
User.create! :first_name => first,
1414
:last_name => last,
15-
:username => [first,last].join('-').downcase
15+
:username => [first,last].join('-').downcase,
16+
:age => rand(80)
1617
end
1718
1819
categories = ["Rock", "Pop Rock", "Alt-Country", "Blues", "Dub-Step"].collect do |name|

0 commit comments

Comments
 (0)