administer 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -4
- data/app/controllers/administer/application_controller.rb +12 -0
- data/app/controllers/administer/entities_controller.rb +76 -0
- data/app/helpers/administer/dashboard_helper.rb +1 -1
- data/app/helpers/administer/entities_helper.rb +2 -0
- data/app/views/administer/dashboard/index.html.haml +1 -1
- data/app/views/administer/entities/_form.haml +9 -0
- data/app/views/administer/entities/edit.html.haml +9 -0
- data/app/views/administer/entities/index.html.haml +21 -0
- data/app/views/administer/entities/new.haml +9 -0
- data/app/views/administer/fields/_belongs_to.html.haml +2 -0
- data/app/views/administer/fields/_date_select.html.haml +2 -0
- data/app/views/administer/fields/_has_many.html.haml +4 -0
- data/app/views/administer/fields/_has_one.html.haml +2 -0
- data/app/views/administer/fields/_text_area.html.haml +2 -0
- data/app/views/administer/fields/_text_field.html.haml +2 -0
- data/app/views/administer/shared/_errors.html.haml +6 -0
- data/app/views/layouts/administer.html.haml +21 -0
- data/config/routes.rb +4 -4
- data/lib/administer.rb +1 -0
- data/lib/administer/active_record.rb +22 -0
- data/lib/administer/config.rb +37 -0
- data/lib/administer/config/controller_config.rb +24 -0
- data/lib/administer/config/model_config.rb +23 -0
- data/lib/administer/engine.rb +5 -0
- data/lib/administer/fields.rb +34 -0
- data/lib/administer/fields/association.rb +21 -0
- data/lib/administer/fields/base.rb +15 -0
- data/lib/administer/fields/belongs_to.rb +12 -0
- data/lib/administer/fields/date_select.rb +6 -0
- data/lib/administer/fields/field_builder.rb +25 -0
- data/lib/administer/fields/has_many.rb +22 -0
- data/lib/administer/fields/has_one.rb +24 -0
- data/lib/administer/fields/text_area.rb +6 -0
- data/lib/administer/fields/text_field.rb +6 -0
- data/lib/administer/model.rb +40 -13
- data/spec/controllers/administer/entities_controller_spec.rb +23 -0
- data/spec/{rails_root/spec/controllers → controllers}/posts_controller_spec.rb +1 -1
- data/spec/factories/categories.rb +3 -0
- data/spec/factories/comments.rb +3 -0
- data/spec/{rails_root/spec/factories → factories}/posts.rb +0 -0
- data/spec/lib/config/model_config_spec.rb +35 -0
- data/spec/lib/config_spec.rb +29 -0
- data/spec/lib/fields/field_builder_spec.rb +10 -0
- data/spec/{rails_root/spec/models/administer → lib}/model_spec.rb +5 -4
- data/spec/models/comment_spec.rb +5 -0
- data/spec/rails_root/Gemfile +2 -0
- data/spec/rails_root/Gemfile.lock +150 -0
- data/spec/rails_root/README +256 -0
- data/spec/rails_root/Rakefile +7 -0
- data/spec/rails_root/app/controllers/application_controller.rb +4 -0
- data/spec/rails_root/app/models/attachment.rb +3 -0
- data/spec/rails_root/app/models/category.rb +1 -0
- data/spec/rails_root/app/models/comment.rb +3 -0
- data/spec/rails_root/app/models/post.rb +8 -0
- data/spec/rails_root/app/views/layouts/application.html.erb +14 -0
- data/spec/rails_root/app/views/posts/_form.html.haml +19 -0
- data/spec/rails_root/app/views/posts/edit.html.haml +5 -0
- data/spec/rails_root/app/views/posts/index.html.haml +10 -0
- data/spec/rails_root/app/views/posts/new.html.haml +3 -0
- data/spec/rails_root/app/views/posts/show.html.haml +10 -0
- data/spec/rails_root/config.ru +4 -0
- data/spec/rails_root/config/cucumber.yml +8 -0
- data/spec/rails_root/config/database.yml +25 -0
- data/spec/rails_root/config/initializers/administer.rb +23 -0
- data/spec/rails_root/config/locales/en.yml +5 -0
- data/spec/rails_root/db/development.sqlite3 +0 -0
- data/spec/rails_root/db/migrate/20110104100347_add_publish_on_to_post.rb +9 -0
- data/spec/rails_root/db/migrate/20110214190645_add_category_to_post.rb +9 -0
- data/spec/rails_root/db/migrate/20110609184125_create_comments.rb +13 -0
- data/spec/rails_root/db/migrate/20110628215407_create_attachments.rb +13 -0
- data/spec/rails_root/db/schema.rb +44 -0
- data/spec/rails_root/db/test.sqlite3 +0 -0
- data/spec/rails_root/features/administer/dashboard.feature +15 -0
- data/spec/rails_root/features/administer/posts.feature +72 -0
- data/spec/rails_root/features/listing_posts.feature +15 -0
- data/spec/rails_root/features/managing_posts.feature +70 -0
- data/spec/rails_root/features/step_definitions/categories_steps.rb +6 -0
- data/spec/rails_root/features/step_definitions/comments_steps.rb +6 -0
- data/spec/rails_root/features/step_definitions/post_steps.rb +21 -0
- data/spec/rails_root/features/step_definitions/web_steps.rb +5 -2
- data/spec/rails_root/features/support/env.rb +32 -46
- data/spec/rails_root/features/support/factory_girl.rb +2 -0
- data/spec/rails_root/features/support/matchers.rb +55 -0
- data/spec/rails_root/features/support/paths.rb +2 -0
- data/spec/rails_root/features/support/selectors.rb +39 -0
- data/spec/rails_root/lib/tasks/cucumber.rake +65 -0
- data/spec/rails_root/log/development.log +19507 -0
- data/spec/rails_root/log/test.log +45042 -0
- data/spec/rails_root/public/404.html +26 -0
- data/spec/rails_root/public/422.html +26 -0
- data/spec/rails_root/public/500.html +26 -0
- data/spec/rails_root/public/favicon.ico +0 -0
- data/spec/rails_root/public/images/rails.png +0 -0
- data/spec/rails_root/public/javascripts/application.js +2 -0
- data/spec/rails_root/public/javascripts/controls.js +965 -0
- data/spec/rails_root/public/javascripts/dragdrop.js +974 -0
- data/spec/rails_root/public/javascripts/effects.js +1123 -0
- data/spec/rails_root/public/javascripts/prototype.js +6001 -0
- data/spec/rails_root/public/javascripts/rails.js +175 -0
- data/spec/rails_root/public/robots.txt +5 -0
- data/spec/rails_root/public/stylesheets/scaffold.css +60 -0
- data/spec/rails_root/script/cucumber +10 -0
- data/spec/rails_root/script/rails +6 -0
- data/spec/rails_root/spec/models/attachment_spec.rb +5 -0
- data/spec/rails_root/tmp/capybara/capybara-20101221001337.html +43 -0
- data/spec/rails_root/tmp/capybara/capybara-20101221001509.html +47 -0
- data/spec/rails_root/tmp/capybara/capybara-20110104162405.html +110 -0
- data/spec/rails_root/tmp/capybara/capybara-20110214224604.html +51 -0
- data/spec/rails_root/tmp/capybara/capybara-20110214225336.html +51 -0
- data/spec/rails_root/tmp/capybara/capybara-20110214225545.html +51 -0
- data/spec/{rails_root/spec/routing → routing}/posts_routing_spec.rb +1 -1
- data/spec/{rails_root/spec/spec_helper.rb → spec_helper.rb} +6 -4
- data/spec/{rails_root/spec/views → views}/posts/edit.html.haml_spec.rb +1 -1
- data/spec/{rails_root/spec/views → views}/posts/new.html.haml_spec.rb +1 -1
- data/spec/{rails_root/spec/views → views}/posts/show.html.haml_spec.rb +1 -1
- metadata +306 -46
- data/app/controllers/administer/models_controller.rb +0 -16
- data/app/views/administer/models/index.html.haml +0 -14
- data/spec/rails_root/spec/controllers/administer/models_controller_spec.rb +0 -19
@@ -1,16 +0,0 @@
|
|
1
|
-
module Administer
|
2
|
-
class Administer::ModelsController < ApplicationController
|
3
|
-
unloadable
|
4
|
-
before_filter :collection, :only => :index
|
5
|
-
|
6
|
-
protected
|
7
|
-
def model_class
|
8
|
-
Administer::Model.lookup(params[:model_name])
|
9
|
-
end
|
10
|
-
helper_method :model_class
|
11
|
-
|
12
|
-
def collection
|
13
|
-
@collection = model_class.all
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
%ul.actions
|
2
|
-
%li= link_to('back', administer_dashboard_index_path)
|
3
|
-
%h1= model_class.model_name.human.pluralize
|
4
|
-
%table.items_list
|
5
|
-
%thead
|
6
|
-
%tr
|
7
|
-
- model_class.column_names.each do |column_name|
|
8
|
-
%th= column_name
|
9
|
-
|
10
|
-
%tbody
|
11
|
-
- @collection.each do |object|
|
12
|
-
%tr{:class => cycle('odd', 'even')}
|
13
|
-
- model_class.column_names.each do |column_name|
|
14
|
-
%td= object.send(column_name).to_s
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Administer::ModelsController do
|
4
|
-
describe "GET /index" do
|
5
|
-
it "should lookup for proper collection" do
|
6
|
-
controller.should_receive(:model_class).and_return(Post)
|
7
|
-
posts = mock_model(Post)
|
8
|
-
Post.should_receive(:all).and_return(posts)
|
9
|
-
get :index, :model_name => 'post'
|
10
|
-
assigns[:collection].should == posts
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it "model_class should lookup for proper model" do
|
15
|
-
controller.should_receive(:params).and_return({:model_name => 'Post'})
|
16
|
-
Administer::Model.should_receive(:lookup).with('Post').and_return(Post)
|
17
|
-
controller.send(:model_class).should == Post
|
18
|
-
end
|
19
|
-
end
|