admin_data 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. data/README.md +25 -0
  2. data/app/controllers/admin_data/base_controller.rb +2 -7
  3. data/app/views/admin_data/main/edit.html.erb +1 -2
  4. data/app/views/admin_data/main/misc/_form.html.erb +9 -2
  5. data/app/views/admin_data/shared/_drop_down_klasses.html.erb +1 -1
  6. data/app/views/admin_data/shared/_powered_by.html.erb +3 -20
  7. data/lib/admin_data/helpers.rb +1 -1
  8. data/lib/admin_data/version.rb +1 -1
  9. data/lib/js/vendor/{code.jquery.com jquery-1.4.2.js → jquery-1.4.2.js} +0 -0
  10. metadata +9 -110
  11. data/README.textile +0 -21
  12. data/lib/js/vendor/jquery.lint.js +0 -604
  13. data/test/factories/article.rb +0 -9
  14. data/test/factories/car.rb +0 -4
  15. data/test/factories/city.rb +0 -4
  16. data/test/factories/comment.rb +0 -6
  17. data/test/factories/door.rb +0 -4
  18. data/test/factories/engine.rb +0 -4
  19. data/test/functional/base_controller_test.rb +0 -5
  20. data/test/functional/feed_controller_test.rb +0 -45
  21. data/test/functional/main_controller_authorization_test.rb +0 -91
  22. data/test/functional/main_controller_test.rb +0 -418
  23. data/test/functional/migration_controller_test.rb +0 -39
  24. data/test/functional/routes_test.rb +0 -59
  25. data/test/functional/search_controller_authorization_test.rb +0 -77
  26. data/test/functional/search_controller_test.rb +0 -811
  27. data/test/helper/view_helper_test.rb +0 -177
  28. data/test/misc_tests/date_validation_test.rb +0 -32
  29. data/test/misc_tests/settings_test.rb +0 -29
  30. data/test/misc_tests/util_test.rb +0 -83
  31. data/test/rails_root/Gemfile +0 -22
  32. data/test/rails_root/Gemfile.lock +0 -101
  33. data/test/rails_root/Rakefile +0 -7
  34. data/test/rails_root/app/controllers/application_controller.rb +0 -3
  35. data/test/rails_root/app/helpers/application_helper.rb +0 -2
  36. data/test/rails_root/app/models/article.rb +0 -25
  37. data/test/rails_root/app/models/city.rb +0 -15
  38. data/test/rails_root/app/models/comment.rb +0 -13
  39. data/test/rails_root/app/models/tech_magazine.rb +0 -2
  40. data/test/rails_root/app/models/vehicle/car.rb +0 -4
  41. data/test/rails_root/app/models/vehicle/door.rb +0 -3
  42. data/test/rails_root/app/models/vehicle/engine.rb +0 -3
  43. data/test/rails_root/app/views/layouts/application.html.erb +0 -14
  44. data/test/rails_root/config/application.rb +0 -42
  45. data/test/rails_root/config/boot.rb +0 -13
  46. data/test/rails_root/config/database.yml +0 -22
  47. data/test/rails_root/config/environment.rb +0 -5
  48. data/test/rails_root/config/environments/development.rb +0 -22
  49. data/test/rails_root/config/environments/production.rb +0 -49
  50. data/test/rails_root/config/environments/test.rb +0 -35
  51. data/test/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  52. data/test/rails_root/config/initializers/inflections.rb +0 -10
  53. data/test/rails_root/config/initializers/mime_types.rb +0 -5
  54. data/test/rails_root/config/initializers/secret_token.rb +0 -7
  55. data/test/rails_root/config/initializers/session_store.rb +0 -8
  56. data/test/rails_root/config/locales/en.yml +0 -5
  57. data/test/rails_root/config/routes.rb +0 -58
  58. data/test/rails_root/config.ru +0 -4
  59. data/test/rails_root/db/migrate/20090809061114_create_tables.rb +0 -70
  60. data/test/rails_root/db/schema.rb +0 -74
  61. data/test/rails_root/db/seeds.rb +0 -7
  62. data/test/rails_root/db/test.sqlite3 +0 -0
  63. data/test/rails_root/script/rails +0 -6
  64. data/test/rails_root/test/performance/browsing_test.rb +0 -0
  65. data/test/rails_root/test/test_helper.rb +0 -13
  66. data/test/support/assertions.rb +0 -20
  67. data/test/test_helper.rb +0 -76
@@ -1,49 +0,0 @@
1
- RailsRoot::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
3
-
4
- # The production environment is meant for finished, "live" apps.
5
- # Code is not reloaded between requests
6
- config.cache_classes = true
7
-
8
- # Full error reports are disabled and caching is turned on
9
- config.consider_all_requests_local = false
10
- config.action_controller.perform_caching = true
11
-
12
- # Specifies the header that your server uses for sending files
13
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
-
15
- # For nginx:
16
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
-
18
- # If you have no front-end server that supports something like X-Sendfile,
19
- # just comment this out and Rails will serve the files
20
-
21
- # See everything in the log (default is :info)
22
- # config.log_level = :debug
23
-
24
- # Use a different logger for distributed setups
25
- # config.logger = SyslogLogger.new
26
-
27
- # Use a different cache store in production
28
- # config.cache_store = :mem_cache_store
29
-
30
- # Disable Rails's static asset server
31
- # In production, Apache or nginx will already do this
32
- config.serve_static_assets = false
33
-
34
- # Enable serving of images, stylesheets, and javascripts from an asset server
35
- # config.action_controller.asset_host = "http://assets.example.com"
36
-
37
- # Disable delivery errors, bad email addresses will be ignored
38
- # config.action_mailer.raise_delivery_errors = false
39
-
40
- # Enable threaded mode
41
- # config.threadsafe!
42
-
43
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
- # the I18n.default_locale when a translation can not be found)
45
- config.i18n.fallbacks = true
46
-
47
- # Send deprecation notices to registered listeners
48
- config.active_support.deprecation = :notify
49
- end
@@ -1,35 +0,0 @@
1
- RailsRoot::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Log error messages when you accidentally call methods on nil.
11
- config.whiny_nils = true
12
-
13
- # Show full error reports and disable caching
14
- config.consider_all_requests_local = true
15
- config.action_controller.perform_caching = false
16
-
17
- # Raise exceptions instead of rendering exception templates
18
- config.action_dispatch.show_exceptions = false
19
-
20
- # Disable request forgery protection in test environment
21
- config.action_controller.allow_forgery_protection = false
22
-
23
- # Tell Action Mailer not to deliver emails to the real world.
24
- # The :test delivery method accumulates sent emails in the
25
- # ActionMailer::Base.deliveries array.
26
- config.action_mailer.delivery_method = :test
27
-
28
- # Use SQL instead of Active Record's schema dumper when creating the test database.
29
- # This is necessary if your schema can't be completely dumped by the schema dumper,
30
- # like if you have constraints or database-specific column types
31
- # config.active_record.schema_format = :sql
32
-
33
- # Print deprecation notices to the stderr
34
- config.active_support.deprecation = :stderr
35
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- RailsRoot::Application.config.secret_token = 'ab76a8ee90737593e7473282829403866a1ef28f036d5328b1bdb22fa310fa68925c65a4eb555461cd7beab16d900076bced546e50feca4128901c5f03c3fc55'
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- RailsRoot::Application.config.session_store :cookie_store, :key => '_rails_root_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rake db:sessions:create")
8
- # RailsRoot::Application.config.session_store :active_record_store
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,58 +0,0 @@
1
- RailsRoot::Application.routes.draw do
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
4
-
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
8
-
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
12
-
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
- # resources :products
15
-
16
- # Sample resource route with options:
17
- # resources :products do
18
- # member do
19
- # get :short
20
- # post :toggle
21
- # end
22
- #
23
- # collection do
24
- # get :sold
25
- # end
26
- # end
27
-
28
- # Sample resource route with sub-resources:
29
- # resources :products do
30
- # resources :comments, :sales
31
- # resource :seller
32
- # end
33
-
34
- # Sample resource route with more complex sub-resources
35
- # resources :products do
36
- # resources :comments
37
- # resources :sales do
38
- # get :recent, :on => :collection
39
- # end
40
- # end
41
-
42
- # Sample resource route within a namespace:
43
- # namespace :admin do
44
- # # Directs /admin/products/* to Admin::ProductsController
45
- # # (app/controllers/admin/products_controller.rb)
46
- # resources :products
47
- # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => "welcome#index"
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- # match ':controller(/:action(/:id(.:format)))'
58
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run RailsRoot::Application
@@ -1,70 +0,0 @@
1
- class CreateTables < ActiveRecord::Migration
2
- def self.up
3
-
4
- create_table(:articles, :primary_key => 'article_id') do |t|
5
- t.string :title , :null => false, :limit => 200
6
- t.text :body, :null => false
7
- t.text :body_html, :null => false
8
- t.text :short_desc
9
- t.string :status, :default => 'draft', :limit => 50
10
- t.datetime :published_at, :null => true
11
- t.boolean :approved
12
- t.integer :hits_count
13
- t.string :magazine_type
14
- t.timestamps
15
- t.integer :magazine_id # so that created_at and updated_at are not at the end
16
- t.text :data
17
- end
18
-
19
- create_table :tech_magazines do |t|
20
- t.timestamps
21
- end
22
-
23
- create_table :comments do |t|
24
- t.integer :article_id, :null => false
25
- t.text :body, :null => false
26
- t.text :body_html, :null => false
27
- t.string :author_name, :null => false
28
- t.string :author_website, :null => true
29
- t.boolean :posted_by_admin, :default => false
30
-
31
- t.timestamps
32
- end
33
-
34
- create_table :cars do |t|
35
- t.integer :year
36
- t.string :brand
37
- t.timestamps
38
- end
39
-
40
- create_table :doors do |t|
41
- t.string :color
42
- t.integer :car_id
43
- t.timestamps
44
- end
45
-
46
- create_table :cities do |t|
47
- t.string :name
48
- t.string :permanent_name
49
- t.timestamps
50
- end
51
-
52
- create_table :engines do |t|
53
- t.integer :cylinders
54
- t.integer :car_id
55
- t.timestamps
56
- end
57
-
58
- end
59
-
60
- def self.down
61
- drop_table :comments
62
- drop_table :tech_magaznines
63
- drop_table :articles
64
- drop_table :cars
65
- drop_table :doors
66
- drop_table :cities
67
- drop_table :engines
68
- end
69
-
70
- end
@@ -1,74 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead of editing this file,
2
- # please use the migrations feature of Active Record to incrementally modify your database, and
3
- # then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
- # to create the application database on another system, you should be using db:schema:load, not running
7
- # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
- # you'll amass, the slower it'll run and the greater likelihood for issues).
9
- #
10
- # It's strongly recommended to check this file into your version control system.
11
-
12
- ActiveRecord::Schema.define(:version => 20090809061114) do
13
-
14
- create_table "articles", :primary_key => "article_id", :force => true do |t|
15
- t.string "title", :null => false, :limit => 200
16
- t.text "body", :null => false
17
- t.text "body_html", :null => false
18
- t.text "short_desc"
19
- t.string "status", :default => "draft", :limit => 50
20
- t.datetime "published_at"
21
- t.boolean "approved"
22
- t.integer "hits_count"
23
- t.string "magazine_type"
24
- t.datetime "created_at"
25
- t.datetime "updated_at"
26
- t.integer "magazine_id"
27
- t.text "data"
28
- end
29
-
30
- create_table "cars", :force => true do |t|
31
- t.integer "year"
32
- t.string "brand"
33
- t.datetime "created_at"
34
- t.datetime "updated_at"
35
- end
36
-
37
- create_table "cities", :force => true do |t|
38
- t.string "name"
39
- t.string "permanent_name"
40
- t.datetime "created_at"
41
- t.datetime "updated_at"
42
- end
43
-
44
- create_table "comments", :force => true do |t|
45
- t.integer "article_id", :null => false
46
- t.text "body", :null => false
47
- t.text "body_html", :null => false
48
- t.string "author_name", :null => false
49
- t.string "author_website"
50
- t.boolean "posted_by_admin", :default => false
51
- t.datetime "created_at"
52
- t.datetime "updated_at"
53
- end
54
-
55
- create_table "doors", :force => true do |t|
56
- t.string "color"
57
- t.integer "car_id"
58
- t.datetime "created_at"
59
- t.datetime "updated_at"
60
- end
61
-
62
- create_table "engines", :force => true do |t|
63
- t.integer "cylinders"
64
- t.integer "car_id"
65
- t.datetime "created_at"
66
- t.datetime "updated_at"
67
- end
68
-
69
- create_table "tech_magazines", :force => true do |t|
70
- t.datetime "created_at"
71
- t.datetime "updated_at"
72
- end
73
-
74
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
- # Mayor.create(:name => 'Daley', :city => cities.first)
Binary file
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
File without changes
@@ -1,13 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
- # Add more helper methods to be used by all tests here...
13
- end
@@ -1,20 +0,0 @@
1
- require 'active_support/test_case'
2
-
3
- class ActiveSupport::TestCase
4
- def assert_not(assertion)
5
- assert !assertion
6
- end
7
-
8
- def assert_blank(assertion)
9
- assert assertion.blank?
10
- end
11
-
12
- def assert_not_blank(assertion)
13
- assert !assertion.blank?
14
- end
15
-
16
- def assert_equal_sql(sql1, sql2)
17
- assert_equal sql1.squeeze(" ").strip, sql2.squeeze(" ").strip
18
- end
19
-
20
- end
data/test/test_helper.rb DELETED
@@ -1,76 +0,0 @@
1
- test_dir = File.dirname(__FILE__)
2
-
3
- $:.unshift File.expand_path("../..", __FILE__)
4
- $:.unshift File.expand_path("../../lib", __FILE__)
5
- $:.unshift File.expand_path("../../app", __FILE__)
6
- $:.unshift File.expand_path("../../app/controllers", __FILE__)
7
- $:.unshift File.expand_path("../../app/controllers/admin_data", __FILE__)
8
-
9
- $:.unshift File.expand_path("../../test/support", __FILE__)
10
-
11
-
12
- ENV['RAILS_ENV'] = 'test'
13
-
14
- rails_root = File.join(test_dir , 'rails_root')
15
-
16
- # start rails
17
- require "#{rails_root}/config/environment.rb"
18
-
19
- require 'admin_data'
20
- AdminData::Config.initialize_defaults
21
- ActionView::Base.send :include, AdminData::Helpers
22
-
23
- Dir[File.join(test_dir, '..', 'app', 'controllers', 'admin_data', '*.rb')].each {|f| require f}
24
- require "#{rails_root}/../../config/routes.rb"
25
-
26
- require 'test/unit'
27
- require 'rails/test_help'
28
- silence_warnings { RAILS_ENV = ENV['RAILS_ENV'] }
29
-
30
- # Run the migrations
31
- ActiveRecord::Migration.verbose = false
32
- ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
33
-
34
- # for helper tests
35
- require 'action_view/test_case'
36
-
37
- Dir[File.join(test_dir, 'factories', '*.rb')].each { |f| require File.expand_path(f) }
38
-
39
- class ActiveSupport::TestCase
40
-
41
- def revoke_read_only_access_for_feed
42
- AdminData::Config.set = ({:is_allowed_to_view_feed => Proc.new { |controller| false } })
43
- end
44
-
45
- def grant_read_only_access_for_feed
46
- AdminData::Config.set = ({:is_allowed_to_view_feed => Proc.new { |controller| true } })
47
- end
48
-
49
- def revoke_read_only_access
50
- AdminData::Config.set = ({:is_allowed_to_view => Proc.new { |controller| false } })
51
- end
52
-
53
- def grant_read_only_access
54
- AdminData::Config.set = ({:is_allowed_to_view => Proc.new { |controller| true } })
55
- end
56
-
57
- def grant_update_access
58
- AdminData::Config.set = ({:is_allowed_to_update => Proc.new { |controller| true } })
59
- end
60
-
61
- def revoke_update_access
62
- AdminData::Config.set = ({:is_allowed_to_update => Proc.new { |controller| false } })
63
- end
64
-
65
- def show_response
66
- Dir.mkdir(File.join(Rails.root, 'tmp')) unless File.directory?(File.join(Rails.root, 'tmp'))
67
- response_html = File.join(Rails.root, 'tmp', 'response.html')
68
- File.open(response_html, 'w') { |f| f.write(@response.body) }
69
- system 'open ' + File.expand_path(response_html) rescue nil
70
- end
71
-
72
- end
73
-
74
- require 'assertions'
75
-
76
- AdminData::Config.set = { :adapter_name => ActiveRecord::Base.connection.adapter_name }