Skip to content

Commit

Permalink
Merge pull request activeadmin#267 from mattvague/master
Browse files Browse the repository at this point in the history
Lightened up flash messages a bit, and added translation for dashboard
  • Loading branch information
gregbell committed Jul 8, 2011
2 parents 97f2f90 + 5e692bf commit 89f45a4
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 15 deletions.
21 changes: 17 additions & 4 deletions app/assets/stylesheets/active_admin/_forms.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,29 @@ $sidebar-inner-content-width: $sidebar-width - ($section-padding * 2);

// -------------------------------------- Filter Forms

$date-range-filter-seperator-width: 12px;
$filter-field-seperator-width: 12px;

$side-by-side-filter-input-width: ($sidebar-inner-content-width / 2) - ($text-input-horizontal-padding * 2) - $filter-field-seperator-width;
$side-by-side-filter-select-width: ($sidebar-inner-content-width / 2) - $filter-field-seperator-width;

$date-range-filter-input-right-padding: 27px;
$date-range-filter-input-horizontal-padding: $date-range-filter-input-right-padding + $text-input-horizontal-padding;
$date-range-filter-input-width: ($sidebar-inner-content-width / 2) - $filter-field-seperator-width - $date-range-filter-input-horizontal-padding;

form.filter_form {
.filter_form_field {
margin-bottom: 10px;
clear: both;

&.filter_numeric { input[type=text] { width: 80px; margin-left: 5px; } }
&.filter_numeric {
input[type=text] {
margin-left: $filter-field-seperator-width + 4;
width: $side-by-side-filter-input-width;
}
select {
width: $side-by-side-filter-select-width;
}
}

&.filter_check_boxes {
label { margin-bottom: 3px; }
Expand All @@ -228,13 +241,13 @@ form.filter_form {
.seperator {
display: inline-block;
text-align: center;
width: $date-range-filter-seperator-width;
width: $filter-field-seperator-width;
}

input[type=text] {
background: #fff url(active_admin_image_path('datepicker/datepicker-input-icon.png')) no-repeat 100% 7px;
padding-right: $date-range-filter-input-right-padding;
width: ($sidebar-inner-content-width / 2) - $date-range-filter-seperator-width - $date-range-filter-input-horizontal-padding;
width: $date-range-filter-input-width;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
body.logged_in {
.flash {
@include primary-gradient;
@include shadow;
@include text-shadow(#222);
@include text-shadow(#fafafa);
background-color: #a24a42;
border: none;
border-bottom: 1px solid #44484B;
color: #fff;
font-weight: bold;
font-size: 1.1em;
line-height: 1.0em;
margin-bottom: 10px;
padding: 12px 30px;
padding: 13px 30px 11px;

&.flash_notice { @include gradient(#7d9582, #667d6a); }
&.flash_error { @include gradient(#a8716d, #955c59); }
&.flash_notice {
@include gradient(#dce9dd, #ccdfcd);
border-bottom: 1px solid #adcbaf;
color: #416347;
}
&.flash_error {
@include gradient(#f5e4e4, #f1dcdc);
border-bottom: 1px solid #e0c2c0;
color: #b33c33;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/active_admin/dashboards/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def index
protected

def set_current_tab
@current_tab = "Dashboard"
@current_tab = I18n.t("active_admin.dashboard")
end

def find_sections
Expand Down
1 change: 1 addition & 0 deletions lib/active_admin/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
en:
active_admin:
dashboard: Dashboard
dashboard_welcome:
welcome: "Welcome to Active Admin. This is the default dashboard page."
call_to_action: "To add dashboard sections, checkout 'app/admin/dashboards.rb'"
Expand Down
2 changes: 1 addition & 1 deletion lib/active_admin/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def generate_dashboard_controller
# Adds the dashboard to the menu
def register_dashboard
dashboard_path = root? ? :dashboard_path : "#{name}_dashboard_path".to_sym
menu.add("Dashboard", dashboard_path, 1) unless menu["Dashboard"]
menu.add(I18n.t("active_admin.dashboard"), dashboard_path, 1) unless menu[I18n.t("active_admin.dashboard")]
end

# Does all the work of registernig a config with the menu system
Expand Down
2 changes: 1 addition & 1 deletion lib/active_admin/views/pages/dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def main_content
def build_sidebar; end

def title
"Dashboard"
I18n.t("active_admin.dashboard")
end

def render_sections(sections)
Expand Down
2 changes: 1 addition & 1 deletion spec/support/rails_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Generate some test models
generate :model, "post title:string body:text published_at:datetime author_id:integer category_id:integer"
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"
generate :model, "user type:string first_name:string last_name:string username:string"
generate :model, "user type:string first_name:string last_name:string username:string age:integer"
inject_into_file 'app/models/user.rb', " has_many :posts, :foreign_key => 'author_id'\n", :after => "class User < ActiveRecord::Base\n"
generate :model, "publisher --migration=false --parent=User"
generate :model, 'category name:string description:text'
Expand Down
3 changes: 2 additions & 1 deletion spec/support/rails_template_with_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
first, last = name.split(" ")
User.create! :first_name => first,
:last_name => last,
:username => [first,last].join('-').downcase
:username => [first,last].join('-').downcase,
:age => rand(80)
end
categories = ["Rock", "Pop Rock", "Alt-Country", "Blues", "Dub-Step"].collect do |name|
Expand Down

0 comments on commit 89f45a4

Please sign in to comment.