Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: activeadmin/activeadmin
...
head fork: activeadmin/activeadmin
  • 11 commits
  • 8 files changed
  • 0 commit comments
  • 5 contributors
4 README.rdoc
View
@@ -4,7 +4,7 @@ Active Admin is a framework for creating administration style interfaces. It
abstracts common business application patterns to make it simple for developers
to implement beautiful and elegant interfaces with very little effort.
-{<img src="https://secure.travis-ci.org/gregbell/active_admin.png?branch=master" />}[http://travis-ci.org/gregbell/active_admin]
+{<img src="https://secure.travis-ci.org/gregbell/active_admin.png?branch=master" />}[http://travis-ci.org/gregbell/active_admin] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/gregbell/active_admin]
== Documentation & Support
@@ -36,7 +36,7 @@ please submit a well tested pull request with the desired changes. If you're not
then the mailing list may be a good place to try to convince someone to help you out
with your cause.
-If you are going to submit a pull request, please read the contributing guide:
+If you are going to submit a pull request, please read the contributing guide:
https://github.com/gregbell/active_admin/blob/master/CONTRIBUTING.md
2  features/development_reloading.feature
View
@@ -10,7 +10,7 @@ Feature: Development Reloading
"""
ActiveAdmin.register Post
"""
- And I am logged in
+ And I am logged in with capybara
And I create a new post with the title ""
Then I should see a successful create flash
Given I add "validates_presence_of :title" to the "post" model
6 features/edit_page.feature
View
@@ -37,7 +37,7 @@ Feature: Edit Page
f.inputs "Publishing" do
f.input :published_at
end
- f.buttons
+ f.actions
end
end
"""
@@ -64,7 +64,7 @@ Feature: Edit Page
f.inputs "Publishing" do
f.input :published_at
end
- f.buttons
+ f.actions
end
end
"""
@@ -87,7 +87,7 @@ Feature: Edit Page
<% url = @post.new_record? ? admin_posts_path : admin_post_path(@post) %>
<%= active_admin_form_for @post, :url => url do |f|
f.inputs :title, :body
- f.buttons
+ f.actions
end %>
"""
Given a configuration of:
6 features/new_page.feature
View
@@ -37,7 +37,7 @@ Feature: New Page
f.inputs "Publishing" do
f.input :published_at
end
- f.buttons
+ f.actions
end
end
"""
@@ -57,7 +57,7 @@ Feature: New Page
<% url = @post.new_record? ? admin_posts_path : admin_post_path(@post) %>
<%= active_admin_form_for @post, :url => url do |f|
f.inputs :title, :body
- f.buttons
+ f.actions
end %>
"""
Given a configuration of:
@@ -89,7 +89,7 @@ Feature: New Page
f.inputs "Publishing" do
f.input :published_at
end
- f.buttons
+ f.actions
end
end
"""
19 features/step_definitions/user_steps.rb
View
@@ -5,11 +5,14 @@
end
Given /^I am logged in$/ do
- step 'an admin user "admin@example.com" exists'
+ create_admin_user_and_logout_if_needed
+ user = AdminUser.find_by_email "admin@example.com"
+ login_as(user)
+end
- if page.all(:css, "a", :text => "Logout").size > 0
- click_link "Logout"
- end
+# only for @requires-reloading scenario
+Given /^I am logged in with capybara$/ do
+ create_admin_user_and_logout_if_needed
visit new_admin_user_session_path
fill_in "Email", :with => "admin@example.com"
@@ -17,6 +20,14 @@
click_button "Login"
end
+def create_admin_user_and_logout_if_needed
+ step 'an admin user "admin@example.com" exists'
+
+ if page.all(:css, "a", :text => "Logout").size > 0
+ click_link "Logout"
+ end
+end
+
Given /^an admin user "([^"]*)" exists$/ do |admin_email|
user = AdminUser.find_or_create_by_email :email => admin_email,
:password => "password",
8 features/support/env.rb
View
@@ -94,3 +94,11 @@
ActiveAdmin.unload!
ActiveAdmin.load!
end
+
+# Warden helpers to speed up login
+# See https://github.com/plataformatec/devise/wiki/How-To:-Test-with-Capybara
+include Warden::Test::Helpers
+
+After do
+ Warden.test_reset!
+end
7 lib/active_admin/views/pages/show.rb
View
@@ -8,11 +8,8 @@ def config
end
def title
- case config[:title]
- when Symbol, Proc
- call_method_or_proc_on(resource, config[:title])
- when String
- config[:title]
+ if config[:title]
+ render_or_call_method_or_proc_on(resource, config[:title])
else
default_title
end
30 spec/unit/form_builder_spec.rb
View
@@ -36,16 +36,16 @@ def build_form(options = {}, &block)
active_admin_form_for Post.new, options, &block
end
- context "in general with buttons" do
+ context "in general with actions" do
let :body do
build_form do |f|
f.inputs do
f.input :title
f.input :body
end
- f.buttons do
- f.commit_button "Submit Me"
- f.commit_button "Another Button"
+ f.actions do
+ f.action :submit, :label => "Submit Me"
+ f.action :submit, :label => "Another Button"
end
end
end
@@ -60,7 +60,7 @@ def build_form(options = {}, &block)
it "should only generate the form once" do
body.scan(/Title/).size.should == 1
end
- it "should generate buttons" do
+ it "should generate actions" do
body.should have_tag("input", :attributes => { :type => "submit",
:value => "Submit Me" })
body.should have_tag("input", :attributes => { :type => "submit",
@@ -92,7 +92,7 @@ def build_form(options = {}, &block)
it "should only generate the form once" do
body.scan(/Title/).size.should == 1
end
- it "should generate buttons" do
+ it "should generate actions" do
body.should have_tag("input", :attributes => { :type => "submit",
:value => "Submit Me" })
body.should have_tag("input", :attributes => { :type => "submit",
@@ -111,11 +111,11 @@ def build_form(options = {}, &block)
end
end
- describe "passing in options with buttons" do
+ describe "passing in options with actions" do
let :body do
build_form :html => { :multipart => true } do |f|
f.inputs :title
- f.buttons
+ f.actions
end
end
it "should pass the options on to the form" do
@@ -136,28 +136,28 @@ def build_form(options = {}, &block)
end
- context "with buttons" do
+ context "with actions" do
it "should generate the form once" do
body = build_form do |f|
f.inputs do
f.input :title
end
- f.buttons
+ f.actions
end
body.scan(/id=\"post_title\"/).size.should == 1
end
it "should generate one button and a cancel link" do
body = build_form do |f|
- f.buttons
+ f.actions
end
body.scan(/type=\"submit\"/).size.should == 1
body.scan(/class=\"cancel\"/).size.should == 1
end
- it "should generate multiple buttons" do
+ it "should generate multiple actions" do
body = build_form do |f|
- f.buttons do
- f.commit_button "Create & Continue"
- f.commit_button "Create & Edit"
+ f.actions do
+ f.action :submit, :label => "Create & Continue"
+ f.action :submit, :label => "Create & Edit"
end
end
body.scan(/type=\"submit\"/).size.should == 2

No commit comments for this range

Something went wrong with that request. Please try again.