├── .gitignore ├── .rspec ├── .yardopts ├── Gemfile ├── LICENSE.mkd ├── README.mkd ├── Rakefile ├── app ├── controllers │ └── rails_admin │ │ ├── application_controller.rb │ │ ├── history_controller.rb │ │ └── main_controller.rb ├── helpers │ └── rails_admin │ │ ├── application_helper.rb │ │ └── main_helper.rb ├── models │ └── rails_admin │ │ ├── blank_history.rb │ │ └── history.rb └── views │ ├── layouts │ └── rails_admin │ │ ├── _flash.html.erb │ │ ├── dashboard.html.erb │ │ ├── delete.html.erb │ │ ├── form.html.erb │ │ └── list.html.erb │ └── rails_admin │ ├── history │ └── show.html.erb │ └── main │ ├── _belongs_to_association.html.erb │ ├── _boolean.html.erb │ ├── _date.html.erb │ ├── _datetime.html.erb │ ├── _delete_notice.html.erb │ ├── _edit_submit_buttons.html.erb │ ├── _field.html.erb │ ├── _float.html.erb │ ├── _form_section.html.erb │ ├── _has_and_belongs_to_many_association.html.erb │ ├── _has_many_association.html.erb │ ├── _has_one_association.html.erb │ ├── _history.html.erb │ ├── _integer.html.erb │ ├── _navigation.html.erb │ ├── _new_submit_buttons.html.erb │ ├── _paperclip_file.html.erb │ ├── _password.html.erb │ ├── _string.html.erb │ ├── _text.html.erb │ ├── _time.html.erb │ ├── _timestamp.html.erb │ ├── _user_info.html.erb │ ├── authentication_not_setup.html.erb │ ├── bulk_delete.html.erb │ ├── delete.html.erb │ ├── edit.html.erb │ ├── file_upload.html.erb │ ├── general_history.html.erb │ ├── history.html.erb │ ├── index.html.erb │ ├── list.html.erb │ └── new.html.erb ├── config ├── initializers │ └── devise_patch.rb ├── locales │ ├── devise.bg.yml │ ├── devise.de.yml │ ├── devise.en.yml │ ├── devise.es.yml │ ├── devise.fi.yml │ ├── devise.lt.yml │ ├── devise.pt-BR.yml │ ├── devise.pt-PT.yml │ ├── devise.ru.yml │ ├── devise.sv.yml │ ├── devise.tr.yml │ ├── devise.uk.yml │ ├── rails_admin.bg.yml │ ├── rails_admin.da.yml │ ├── rails_admin.de.yml │ ├── rails_admin.en.yml │ ├── rails_admin.es.yml │ ├── rails_admin.fi.yml │ ├── rails_admin.fr.yml │ ├── rails_admin.lt.yml │ ├── rails_admin.lv.yml │ ├── rails_admin.pl.yml │ ├── rails_admin.pt-BR.yml │ ├── rails_admin.pt-PT.yml │ ├── rails_admin.ru.yml │ ├── rails_admin.sv.yml │ ├── rails_admin.tr.yml │ └── rails_admin.uk.yml └── routes.rb ├── lib ├── generators │ └── rails_admin │ │ ├── USAGE │ │ ├── install_admin_generator.rb │ │ ├── install_migrations_generator.rb │ │ ├── rails_admin_generator.rb │ │ └── templates │ │ ├── migration.rb │ │ └── rename.rb ├── rails_admin.rb ├── rails_admin │ ├── abstract_history.rb │ ├── abstract_model.rb │ ├── abstract_object.rb │ ├── adapters │ │ └── active_record.rb │ ├── authorization_adapters │ │ └── cancan_adapter.rb │ ├── config.rb │ ├── config │ │ ├── base.rb │ │ ├── fields.rb │ │ ├── fields │ │ │ ├── association.rb │ │ │ ├── base.rb │ │ │ ├── factories │ │ │ │ ├── devise.rb │ │ │ │ ├── paperclip.rb │ │ │ │ └── password.rb │ │ │ ├── group.rb │ │ │ ├── groupable.rb │ │ │ ├── types.rb │ │ │ └── types │ │ │ │ ├── all.rb │ │ │ │ ├── belongs_to_association.rb │ │ │ │ ├── boolean.rb │ │ │ │ ├── date.rb │ │ │ │ ├── datetime.rb │ │ │ │ ├── decimal.rb │ │ │ │ ├── file_upload.rb │ │ │ │ ├── float.rb │ │ │ │ ├── has_and_belongs_to_many_association.rb │ │ │ │ ├── has_many_association.rb │ │ │ │ ├── has_one_association.rb │ │ │ │ ├── integer.rb │ │ │ │ ├── paperclip_file.rb │ │ │ │ ├── password.rb │ │ │ │ ├── string.rb │ │ │ │ ├── text.rb │ │ │ │ ├── time.rb │ │ │ │ ├── timestamp.rb │ │ │ │ └── virtual.rb │ │ ├── has_fields.rb │ │ ├── has_groups.rb │ │ ├── hideable.rb │ │ ├── labelable.rb │ │ ├── model.rb │ │ ├── proxy.rb │ │ ├── sections.rb │ │ └── sections │ │ │ ├── create.rb │ │ │ ├── list.rb │ │ │ ├── navigation.rb │ │ │ └── update.rb │ ├── engine.rb │ ├── generic_support.rb │ ├── railties │ │ ├── extratasks.rb │ │ └── tasks.rake │ └── version.rb └── tasks │ ├── .gitkeep │ └── download.rake ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico ├── images │ └── rails_admin │ │ ├── arrow_left.png │ │ ├── arrow_right.png │ │ ├── background.png │ │ ├── bullet_arrow_down.png │ │ ├── bullet_arrow_up.png │ │ ├── bullet_black.png │ │ ├── bullet_white.png │ │ ├── calendar.png │ │ ├── clock.png │ │ ├── colorpicker │ │ ├── hline.png │ │ ├── hue.png │ │ ├── pickerbg.png │ │ └── select.gif │ │ ├── cross.png │ │ ├── fast_btn.png │ │ ├── handler.png │ │ ├── logo.png │ │ ├── magnifier.png │ │ ├── menu_hover.png │ │ ├── navigation_more.png │ │ ├── selector-add.gif │ │ ├── selector-addall.gif │ │ ├── selector-remove.gif │ │ └── selector-removeall.gif ├── javascripts │ ├── ckeditor │ │ └── config.js │ └── rails_admin │ │ ├── application.js │ │ ├── associations.js │ │ ├── builder.js │ │ ├── colorpicker.js │ │ ├── controls.js │ │ ├── dashboard.js │ │ ├── datepicker.js │ │ ├── dragdrop.js │ │ ├── effects.js │ │ ├── prototype-base-extensions.js │ │ ├── prototype-date-extensions.js │ │ ├── prototype.js │ │ ├── rails.js │ │ ├── scriptaculous.js │ │ ├── slider.js │ │ ├── sound.js │ │ ├── unittest.js │ │ └── yahoo.color.js ├── robots.txt └── stylesheets │ └── rails_admin │ ├── base.css │ ├── colorpicker.css │ ├── create.css │ ├── dashboard.css │ ├── datepicker.css │ ├── delete.css │ └── list.css ├── rails_admin.gemspec ├── screenshots ├── edit.png └── list.png └── spec ├── database_helpers.rb ├── dummy_app ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── Rakefile ├── app │ ├── controllers │ │ └── application_controller.rb │ ├── helpers │ │ └── application_helper.rb │ ├── locales │ │ └── models.en.yml │ ├── models │ │ ├── division.rb │ │ ├── draft.rb │ │ ├── fan.rb │ │ ├── league.rb │ │ ├── player.rb │ │ ├── rel_test.rb │ │ ├── team.rb │ │ └── user.rb │ └── views │ │ └── layouts │ │ └── application.html.erb ├── config.ru ├── config │ ├── application.rb │ ├── boot.rb │ ├── database.yml │ ├── environment.rb │ ├── environments │ │ ├── development.rb │ │ ├── production.rb │ │ └── test.rb │ ├── initializers │ │ ├── backtrace_silencers.rb │ │ ├── devise.rb │ │ ├── inflections.rb │ │ ├── mime_types.rb │ │ ├── rails_admin.rb │ │ ├── secret_token.rb │ │ └── session_store.rb │ ├── locales │ └── routes.rb ├── db │ ├── migrate │ │ ├── 00000000000001_create_divisions_migration.rb │ │ ├── 00000000000002_create_drafts_migration.rb │ │ ├── 00000000000003_create_leagues_migration.rb │ │ ├── 00000000000004_create_players_migration.rb │ │ ├── 00000000000005_create_teams_migration.rb │ │ ├── 00000000000006_devise_create_users.rb │ │ ├── 00000000000007_create_histories_table.rb │ │ ├── 00000000000008_create_fans_migration.rb │ │ ├── 00000000000009_create_fans_teams_migration.rb │ │ ├── 00000000000010_add_revenue_to_team_migration.rb │ │ ├── 00000000000011_add_suspended_to_player_migration.rb │ │ ├── 00000000000012_add_avatar_columns_to_user.rb │ │ ├── 00000000000013_add_roles_to_user.rb │ │ ├── 00000000000014_add_color_to_team_migration.rb │ │ ├── 20101223222233_create_rel_tests.rb │ │ └── 20110123042530_rename_histories_to_rails_admin_histories.rb │ └── seeds.rb ├── public ├── script │ └── rails └── test │ ├── performance │ └── rendering_test.rb │ └── test_helper.rb ├── lib └── abstract_object_spec.rb ├── requests ├── authorization │ └── cancan_spec.rb ├── basic │ ├── bulk_delete │ │ └── rails_admin_basic_bulk_delete_spec.rb │ ├── bulk_destroy │ │ └── rails_admin_basic_bulk_destroy_spec.rb │ ├── create │ │ └── rails_admin_basic_create_spec.rb │ ├── delete │ │ └── rails_admin_basic_delete_spec.rb │ ├── destroy │ │ └── rails_admin_basic_destroy_spec.rb │ ├── edit │ │ └── rails_admin_basic_edit_spec.rb │ ├── list │ │ └── rails_admin_basic_list_spec.rb │ ├── new │ │ └── rails_admin_basic_new_spec.rb │ └── update │ │ └── rails_admin_basic_update_spec.rb ├── config │ ├── edit │ │ └── rails_admin_config_edit_spec.rb │ ├── list │ │ └── rails_admin_config_list_spec.rb │ ├── navigation │ │ └── rails_admin_config_navigation_spec.rb │ └── rails_admin_config_spec.rb ├── history │ └── rails_admin_history_spec.rb ├── rails_admin_spec.rb └── relation_spec.rb └── spec_helper.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.log 3 | *.rbc 4 | *.swp 5 | .DS_Store 6 | .bundle 7 | .rvmrc 8 | .yardoc 9 | Gemfile.lock 10 | coverage/* 11 | db/*.sqlite3 12 | db/*.sqlite3-journal 13 | doc/* 14 | log/*.log 15 | pkg/* 16 | spec/dummy_app/db/*.sqlite3 17 | spec/dummy_app/db/*.sqlite3-journal 18 | spec/dummy_app/db/schema.rb 19 | spec/dummy_app/log/*.log 20 | tmp/**/* 21 | /.emacs.desktop 22 | .idea/*.xml 23 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format=nested 3 | --backtrace 4 | --profile 5 | -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | --no-private 2 | --protected 3 | --markup markdown 4 | - 5 | LICENSE.mkd 6 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gemspec 4 | 5 | # Bundle gems for the local environment. Make sure to 6 | # put test-only gems in this group so their generators 7 | # and rake tasks are available in development mode: 8 | group :development, :test do 9 | if 'java' == RUBY_PLATFORM 10 | case ENV['CI_DB_ADAPTER'] 11 | when 'mysql' 12 | gem 'activerecord-jdbcmysql-adapter', '~> 1.1', :platform => :jruby 13 | gem 'jdbc-mysql', '~> 5.1', :platform => :jruby 14 | when 'postgresql' 15 | gem 'activerecord-jdbcpostgresql-adapter', '~> 1.1', :platform => :jruby 16 | gem 'jdbc-postgres', '~> 9.0', :platform => :jruby 17 | else 18 | gem 'activerecord-jdbcsqlite3-adapter', '~> 1.1', :platform => :jruby 19 | gem 'jdbc-sqlite3', '~> 3.6', :platform => :jruby 20 | end 21 | else 22 | case ENV['CI_DB_ADAPTER'] 23 | when 'mysql' 24 | gem 'mysql', '~> 2.8' 25 | when 'postgresql' 26 | gem 'pg', '~> 0.10' 27 | else 28 | gem 'sqlite3', '~> 1.3' 29 | end 30 | end 31 | gem "cancan" if ENV["AUTHORIZATION_ADAPTER"] == "cancan" 32 | end 33 | -------------------------------------------------------------------------------- /LICENSE.mkd: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Erik Michaels-Ober 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require 'bundler' 5 | Bundler::GemHelper.install_tasks 6 | 7 | require 'rspec/core' 8 | require 'rspec/core/rake_task' 9 | RSpec::Core::RakeTask.new(:spec) 10 | 11 | task :default => :spec 12 | 13 | namespace :doc do 14 | require 'yard' 15 | YARD::Rake::YardocTask.new do |task| 16 | task.files = ['LICENSE.mkd', 'lib/**/*.rb'] 17 | task.options = [ 18 | '--protected', 19 | '--output-dir', 'doc/yard', 20 | '--markup', 'markdown', 21 | ] 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/controllers/rails_admin/application_controller.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/abstract_model' 2 | 3 | module RailsAdmin 4 | class ApplicationController < ::ApplicationController 5 | before_filter :_authenticate! 6 | before_filter :_authorize! 7 | before_filter :set_plugin_name 8 | 9 | helper_method :_current_user 10 | 11 | def get_model 12 | model_name = to_model_name(params[:model_name]) 13 | @abstract_model = RailsAdmin::AbstractModel.new(model_name) 14 | @model_config = RailsAdmin.config(@abstract_model) 15 | not_found if @model_config.excluded? 16 | @properties = @abstract_model.properties 17 | end 18 | 19 | def to_model_name(param) 20 | parts = param.split("::") 21 | parts.map{|x| x == parts.last ? x.singularize.camelize : x.camelize}.join("::") 22 | end 23 | 24 | def get_object 25 | @object = @abstract_model.get(params[:id]) 26 | not_found unless @object 27 | end 28 | 29 | private 30 | 31 | def _authenticate! 32 | instance_eval &RailsAdmin.authenticate_with 33 | end 34 | 35 | def _authorize! 36 | instance_eval &RailsAdmin.authorize_with 37 | end 38 | 39 | def _current_user 40 | instance_eval &RailsAdmin.current_user_method 41 | end 42 | 43 | def set_plugin_name 44 | @plugin_name = "RailsAdmin" 45 | end 46 | 47 | def not_found 48 | render :file => Rails.root.join('public', '404.html'), :layout => false, :status => 404 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/controllers/rails_admin/history_controller.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | class HistoryController < RailsAdmin::ApplicationController 3 | before_filter :get_model, :except => [:list, :slider] 4 | before_filter :get_object, :except => [:list, :slider, :for_model] 5 | 6 | def list 7 | if params[:ref].nil? or params[:section].nil? 8 | not_found 9 | else 10 | @history, @current_month = AbstractHistory.history_for_month(params[:ref], params[:section]) 11 | render :template => 'rails_admin/main/history', :layout => false 12 | end 13 | end 14 | 15 | def slider 16 | ref = params[:ref].to_i 17 | 18 | if ref.nil? or ref > 0 19 | not_found 20 | else 21 | render :json => AbstractHistory.history_summaries(ref) 22 | end 23 | end 24 | 25 | def for_model 26 | @page_type = @abstract_model.pretty_name.downcase 27 | @page_name = t("admin.history.page_name", :name => @model_config.list.label) 28 | @general = true 29 | 30 | @page_count, @history = AbstractHistory.history_for_model @abstract_model, params[:query], params[:sort], params[:sort_reverse], params[:all], params[:page] 31 | 32 | render "show", :layout => request.xhr? ? false : 'rails_admin/list' 33 | end 34 | 35 | def for_object 36 | @page_type = @abstract_model.pretty_name.downcase 37 | @page_name = t("admin.history.page_name", :name => @model_config.list.with(:object => @object).object_label) 38 | @general = false 39 | 40 | @history = AbstractHistory.history_for_object @abstract_model, @object, params[:query], params[:sort], params[:sort_reverse] 41 | 42 | render "show", :layout => request.xhr? ? false : 'rails_admin/list' 43 | end 44 | 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /app/models/rails_admin/blank_history.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | class BlankHistory 3 | attr_accessor :number, :month, :year 4 | def initialize(month, year) 5 | @number = 0 6 | @month = month 7 | @year = year 8 | end 9 | 10 | # Make BlankHistory look like History when it gets JSON-serialized. 11 | def to_hash(*a) 12 | {"history" => {"number" => @number, "month" => @month, "year" => @year}} 13 | end 14 | 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/models/rails_admin/history.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | class History < ActiveRecord::Base 3 | set_table_name :rails_admin_histories 4 | 5 | IGNORED_ATTRS = Set[:id, :created_at, :created_on, :deleted_at, :updated_at, :updated_on, :deleted_on] 6 | 7 | scope :most_recent, lambda {|table| 8 | where("#{retrieve_connection.quote_column_name(:table)} = ?", table).order("updated_at") 9 | } 10 | 11 | def self.get_history_for_dates(mstart, mstop, ystart, ystop) 12 | sql_in = "" 13 | if mstart > mstop 14 | sql_in = (mstart + 1..12).to_a.join(", ") 15 | sql_in_two = (1..mstop).to_a.join(", ") 16 | 17 | results = History.find_by_sql("select count(*) as number, year, month from rails_admin_histories where month IN (#{sql_in}) and year = #{ystart} group by year, month") 18 | results_two = History.find_by_sql("select count(*) as number, year, month from rails_admin_histories where month IN (#{sql_in_two}) and year = #{ystop} group by year, month") 19 | 20 | results.concat(results_two) 21 | else 22 | sql_in = (mstart + 1..mstop).to_a.join(", ") 23 | 24 | results = History.find_by_sql("select count(*) as number, year, month from rails_admin_histories where month IN (#{sql_in}) and year = #{ystart} group by year, month") 25 | end 26 | 27 | results.each do |result| 28 | result.number = result.number.to_i 29 | end 30 | 31 | add_blank_results(results, mstart, ystart) 32 | end 33 | 34 | def self.add_blank_results(results, mstart, ystart) 35 | # fill in an array with BlankHistory 36 | blanks = Array.new(5) { |i| BlankHistory.new(((mstart+i) % 12)+1, ystart + ((mstart+i)/12)) } 37 | # replace BlankHistory array entries with the real History entries that were provided 38 | blanks.each_index do |i| 39 | if results[0] && results[0].year == blanks[i].year && results[0].month == blanks[i].month 40 | blanks[i] = results.delete_at 0 41 | end 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /app/views/layouts/rails_admin/_flash.html.erb: -------------------------------------------------------------------------------- 1 | <% if flash && flash[:error] %> 2 |
3 | <%= flash[:error] %> 4 |
5 | <% end %> 6 | <% if flash && flash[:notice] %> 7 |
8 | <%= flash[:notice] %> 9 |
10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/views/layouts/rails_admin/dashboard.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <%= @page_name %> | <%= @plugin_name %> 7 | <%= stylesheet_link_tag('rails_admin/base') %> 8 | <%= stylesheet_link_tag('rails_admin/list') %> 9 | <%= stylesheet_link_tag('rails_admin/dashboard') %> 10 | 11 | <%= javascript_include_tag('rails_admin/prototype.js') %> 12 | <%= javascript_include_tag('rails_admin/rails.js') %> 13 | 14 | <%= javascript_include_tag('rails_admin/scriptaculous.js') %> 15 | <%= javascript_include_tag('rails_admin/dashboard.js') %> 16 | 17 | <%= csrf_meta_tag %> 18 | 19 | 20 |
21 | 45 | 46 |
47 | 48 | <%= content_for(:layout) %> 49 |
50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /app/views/layouts/rails_admin/delete.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= @page_name %> | <%= @plugin_name %> 6 | <%= stylesheet_link_tag('rails_admin/base.css') %> 7 | <%= stylesheet_link_tag('rails_admin/delete.css') %> 8 | 9 | 10 |
11 | 43 |
44 | <%= yield %> 45 |
46 |
47 | 48 | 49 | -------------------------------------------------------------------------------- /app/views/layouts/rails_admin/list.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <%= @abstract_model.pretty_name %> | <%= @plugin_name %> 7 | <%= stylesheet_link_tag('rails_admin/base') %> 8 | <%= stylesheet_link_tag('rails_admin/list') %> 9 | <%= javascript_include_tag('rails_admin/prototype.js') %> 10 | <%= javascript_include_tag('rails_admin/rails.js') %> 11 | 12 | 28 | 29 | <%= csrf_meta_tag %> 30 | 31 | 32 |
33 | 71 |
72 | <%= content_for(:layout) %> 73 |
74 | 75 | 76 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_belongs_to_association.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | collection = field.associated_collection.sort_by{|object| object.first} 3 | selected = field.bindings[:object].send(field.child_key) 4 | 5 | if selected.nil? && params["associations"] 6 | selected = params["associations"][field.child_key.to_param.pluralize].to_i 7 | end 8 | 9 | model_name = field.abstract_model.to_param 10 | %> 11 | <%= label_tag "#{model_name}_#{field.name}", field.label %> 12 | <%= select model_name, field.child_key, collection, {:include_blank => true, :selected => selected}, :class => "selectField #{field.has_errors? ? "errorField" : nil}" %> -------------------------------------------------------------------------------- /app/views/rails_admin/main/_boolean.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= check_box field.abstract_model.to_param, field.name, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}", :checked => field.value ? true : false %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_date.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= text_field field.abstract_model.to_param, field.name, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}", :value => field.formatted_value %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_datetime.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= text_field field.abstract_model.to_param, field.name, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}", :value => field.formatted_value %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_delete_notice.html.erb: -------------------------------------------------------------------------------- 1 | <% object = delete_notice %> 2 | 3 | <% #Factor out to controller 4 | model_config = RailsAdmin.config(@abstract_model) 5 | %> 6 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_edit_submit_buttons.html.erb: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_field.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= field.render %> 3 | <% if @object.errors[field.name].size > 0 %> 4 | <%= "#{field.label } #{@object.errors[field.name]}" %> 5 | <% end %> 6 |

<%= field.help %>

7 |
8 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_float.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= text_field field.abstract_model.to_param, field.name, :maxlength => field.length, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}", :value => field.value %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_form_section.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | visible_fields = form_section.visible_fields 3 | %> 4 | <% if visible_fields.length > 0 %> 5 |

<%= form_section.label %>

6 |
7 | <%= render(:partial => 'field', :collection => visible_fields.map{|field| field.with(:object => @object, :view => self)}) -%> 8 |
9 | <% end %> 10 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_has_one_association.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | association_name = field.association[:name] 3 | child_key = field.association[:child_key].first 4 | collection = field.associated_collection.sort_by{|object| object.first} 5 | selected = field.value 6 | 7 | if selected.nil? && params["associations"] 8 | selected = params["associations"][child_key.to_param.pluralize].to_i 9 | end 10 | %> 11 | 12 | <%= select("associations", association_name, collection, {:id => association_name, :include_blank => true, :selected => selected}, :class => "#{field.has_errors? ? "errorField" : nil}") %> 13 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_history.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <% month_names = t("date.month_names", :locale => :en) if (month_names = t("date.month_names")) =~ /translation/ %> 3 | <%= month_names[month] %> <%= year %> <%= t("admin.history.name").downcase %>: 4 |

5 | <%= t("admin.history.no_activity") if history.empty? %> 6 | 11 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_integer.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= text_field field.abstract_model.to_param, field.name, :maxlength => field.length, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}", :value => field.value %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_navigation.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | max_visible_tabs = RailsAdmin::Config::Sections::Navigation.max_visible_tabs 3 | models = RailsAdmin::Config::Sections::Navigation.visible_models.select { |model| authorized?(:list, model.abstract_model) } 4 | %> 5 | 21 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_new_submit_buttons.html.erb: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_paperclip_file.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag("#{field.abstract_model.to_param}_#{field.name}", field.label) %> 2 |
3 | <% if field.bindings[:object].send(field.name).file? %> 4 |
5 | <%= image_tag(field.bindings[:object].send(field.name).url) %>
6 |
7 | <% end %> 8 |
9 | <%= file_field(field.abstract_model.to_param, field.name, :class => "fileUploadField #{field.has_errors? ? "errorField" : nil}") %> 10 |
11 |
12 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_password.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= password_field field.abstract_model.to_param, field.name, :size => [50, field.length].min, :maxlength => field.length, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}" %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_string.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= text_field field.abstract_model.to_param, field.name, :size => [50, field.length].min, :maxlength => field.length, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil} #{field.color ? 'color' : nil}", :value => field.value %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_text.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= text_area field.abstract_model.to_param, field.name, :cols => 80, :class => "#{field.css_class} 3 | #{field.has_errors? ? "errorField" : nil}", :value => field.value %> 4 | <% if field.ckeditor %> 5 | 13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_time.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= text_field field.abstract_model.to_param, field.name, :maxlength => field.length, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}", :value => field.formatted_value %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_timestamp.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.name}", field.label %> 2 | <%= text_field field.abstract_model.to_param, field.name, :maxlength => field.length, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}", :value => field.formatted_value %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/_user_info.html.erb: -------------------------------------------------------------------------------- 1 | <% if current_user = _current_user %> 2 |
3 | <%= image_tag "#{request.ssl? ? "https://secure" : "http://www"}.gravatar.com/avatar/#{Digest::MD5.hexdigest current_user.email}?s=30", :alt => "" %> 4 | 12 |
13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/authentication_not_setup.html.erb: -------------------------------------------------------------------------------- 1 |

Authentication Not Configured

2 | 3 |
4 | Please configure authentication to access this resource. 5 |
6 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/bulk_delete.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Delete confirmation

3 |
4 | <%= render(:partial => 'layouts/rails_admin/flash', :locals => {:flash => flash}) -%> 5 |
6 |

Are you sure you want to delete the following object along with all of the following related items will be deleted:

7 | <%= render :partial => "delete_notice", :collection => @bulk_objects %> 8 | <%= form_tag rails_admin_bulk_destroy_path(:model_name => @abstract_model.to_param, :bulk_ids => @bulk_ids) do %> 9 |
10 |
    11 |
  • 12 | <%= submit_tag t("admin.delete.confirmation"), :class => "button default" %> 13 |
  • 14 |
  • 15 | <%= submit_tag t("admin.new.cancel"), :class => "button", :name => "_continue", :id => "cancel_btn" %> 16 |
  • 17 |
18 |
19 | <% end =%> 20 |
21 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/delete.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Delete confirmation

3 |
4 | <%= render(:partial => 'layouts/rails_admin/flash', :locals => {:flash => flash}) -%> 5 |
6 |

Are you sure you want to delete the <%= @abstract_model.pretty_name.downcase %> “<%= @model_config.list.with(:object => @object).object_label %>”? All of the following related items will be deleted:

7 | <%= render :partial => "delete_notice", :object => @object %> 8 | <%= form_for(@object, :url => rails_admin_destroy_path(:model_name => @abstract_model.to_param, :id => @object.id), :html => {:method => "delete"}) do %> 9 |
10 |
    11 |
  • 12 | <%= submit_tag t("admin.delete.confirmation"), :class => "button default" %> 13 |
  • 14 |
  • 15 | <%= submit_tag t("admin.new.cancel"), :class => "button", :name => "_continue", :id => "cancel_btn" %> 16 |
  • 17 |
18 |
19 | <% end =%> 20 |
21 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

<%= @page_name %>

3 | <% if @object.errors[:base].size > 0 %> 4 | <%= @object.errors[:base] %> 5 | <% end %> 6 |
7 |
    8 | 9 |
  • 10 | <%= link_to(t("admin.history.name"), rails_admin_history_object_path(:id => params[:id]), :class => "addlink") %> 11 |
  • 12 |
13 | <% if authorized? :delete, @abstract_model, @object %> 14 | <%= image_tag "rails_admin/cross.png", :alt => "Delete" %><%= t("admin.list.delete_action") %> 15 | <% end %> 16 |
17 |
18 | <%= render(:partial => 'layouts/rails_admin/flash', :locals => {:flash => flash}) -%> 19 |
20 | <%= form_for(@object, :url => rails_admin_update_path(:model_name => @abstract_model.to_param, :id => @object.id), :html => { :method => "put", :multipart => true }) do %> 21 |
22 | <%= render(:partial => 'form_section', :collection => RailsAdmin::config(@object).edit.visible_groups) -%> 23 | <%= render :partial => 'edit_submit_buttons' %> 24 |
25 | <% end %> 26 |
27 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/file_upload.html.erb: -------------------------------------------------------------------------------- 1 | <%= label_tag "#{field.abstract_model.to_param}_#{field.name}", field.label %> 2 | <%= file_field field.abstract_model.to_param, field.name, :class => "#{field.css_class} #{field.has_errors? ? "errorField" : nil}" %> 3 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/general_history.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/app/views/rails_admin/main/general_history.html.erb -------------------------------------------------------------------------------- /app/views/rails_admin/main/history.html.erb: -------------------------------------------------------------------------------- 1 | <%= render(:partial => 'rails_admin/main/history', :locals => {:month => @current_month.month, :year => @current_month.year, :history => @history}) -%> 2 | -------------------------------------------------------------------------------- /app/views/rails_admin/main/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

<%= @page_name %>

3 |
4 | <%= render(:partial => 'layouts/rails_admin/flash', :locals => {:flash => flash}) -%> 5 |
6 | <%= form_tag(rails_admin_create_path(:model_name => @abstract_model.to_param), :multipart => true) do %> 7 |
8 | <%= render(:partial => 'form_section', :collection => RailsAdmin::config(@object).create.visible_groups) -%> 9 | <%= render :partial => 'new_submit_buttons' %> 10 |
11 | <% end %> 12 |
13 | -------------------------------------------------------------------------------- /config/initializers/devise_patch.rb: -------------------------------------------------------------------------------- 1 | if defined?(::Devise) 2 | module Devise 3 | class FailureApp 4 | def scope 5 | @scope ||= warden_options[:scope] || Devise.default_scope 6 | end 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/locales/devise.bg.yml: -------------------------------------------------------------------------------- 1 | bg: 2 | errors: 3 | messages: 4 | not_found: "не е намерен" 5 | already_confirmed: "е вече потвърден" 6 | not_locked: "не е бил заключен" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Трябва да влезнеш в акаунта си или да се регистрираш преди да продължиш.' 11 | unconfirmed: 'Трябва да потвърдиш регистрацията на акаунта си преди да продължиш.' 12 | locked: 'Твоят акаунт е заключен.' 13 | invalid: 'Невалиден мейл или парола.' 14 | invalid_token: 'Невалиден код за потвърждение.' 15 | timeout: 'Сесията е изтекла, моля влез наново в акаунта си преди да продължиш.' 16 | inactive: 'Твоят акаунт неактивен.' 17 | sessions: 18 | signed_in: 'Влезе успешно.' 19 | signed_out: 'Излезе успешно.' 20 | passwords: 21 | send_instructions: 'Ще получиш емейл с инструкции за смяна на твоята парола.' 22 | updated: 'Успешно смени паролата си.' 23 | confirmations: 24 | send_instructions: 'Ще получиш емейл с инструкции за потвърждение на твоята регистрация.' 25 | confirmed: 'Успешно потвърди регистрацията си.' 26 | registrations: 27 | signed_up: 'Регистрацията мина успешно. Ако е актививирано потвърждение по емейл, моля провери пощенската си кутия.' 28 | updated: 'Успешно обнови акаунта си.' 29 | destroyed: 'Твоят акаунт беше изтрит.' 30 | unlocks: 31 | send_instructions: 'Ще получиш емейл с инструкции за отключване на акаунта ти.' 32 | unlocked: 'Твоят акаунт беше успешно отключен.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Инструкции за потвърждаване на регистрация' 36 | reset_password_instructions: 37 | subject: 'Инструкции за смяна на парола' 38 | unlock_instructions: 39 | subject: 'Инструкции за отключване на акаунт' 40 | -------------------------------------------------------------------------------- /config/locales/devise.de.yml: -------------------------------------------------------------------------------- 1 | de: 2 | errors: 3 | messages: 4 | not_found: "nicht gefunden" 5 | already_confirmed: "wurde bereits bestätigt" 6 | not_locked: "war nicht gesperrt" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Sie müssen sich anmelden oder registrieren, bevor Sie fortfahren können.' 11 | unconfirmed: 'Sie müssen ihr Konto bestätigen bevor sie fortfahren können.' 12 | locked: 'Ihr Konto wurde gesperrt.' 13 | invalid: 'Ungültige E-Mail oder ungültiges Passwort.' 14 | invalid_token: 'Ungültige Authentifizierungs-Token.' 15 | timeout: 'Ihre Sitzung ist abgelaufen, bitte melden Sie sich erneut, um fortzufahren.' 16 | inactive: 'Ihr Konto wurde noch nicht aktiviert.' 17 | sessions: 18 | signed_in: 'Erfolgreich angemeldet.' 19 | signed_out: 'Erfolgreich abgemeldet.' 20 | passwords: 21 | send_instructions: 'Sie erhalten eine E-Mail mit Anweisungen, wie Sie Ihr Passwort in Kürze zurücksetzen können.' 22 | updated: 'Ihr Passwort wurde erfolgreich geändert. Sie sind jetzt angemeldet.' 23 | confirmations: 24 | send_instructions: 'Sie erhalten eine E-Mail mit Anweisungen, wie sie ihr Konto bestätigen können.' 25 | confirmed: 'Ihr Konto wurde erfolgreich bestätigt. Sie sind jetzt angemeldet.' 26 | registrations: 27 | signed_up: 'Sie haben sich erfolgreich angemeldet. Wenn aktiviert wurde eine Betätigung per E-Mail geschickt.' 28 | updated: 'Ihr Konto wurde erfolgreich aktiviert.' 29 | destroyed: 'Tschüss! Ihr Konto wurde erfolgreich gelöscht. Wir hoffen sie bald wieder zu sehen.' 30 | unlocks: 31 | send_instructions: 'Sie erhalten eine E-Mail mit Anweisungen, wie sie ihr Konto entsperren können.' 32 | unlocked: 'Ihr Konto wurde erfolgreich entsperrt. Sie sind jetzt angemeldet.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Bestätigungs-Anweisungen' 36 | reset_password_instructions: 37 | subject: 'Passwortrücksetz-Anweisungen' 38 | unlock_instructions: 39 | subject: 'Entsper-Anweisungen' 40 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | errors: 3 | messages: 4 | not_found: "not found" 5 | already_confirmed: "was already confirmed" 6 | not_locked: "was not locked" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'You need to sign in or sign up before continuing.' 11 | unconfirmed: 'You have to confirm your account before continuing.' 12 | locked: 'Your account is locked.' 13 | invalid: 'Invalid email or password.' 14 | invalid_token: 'Invalid authentication token.' 15 | timeout: 'Your session expired, please sign in again to continue.' 16 | inactive: 'Your account was not activated yet.' 17 | sessions: 18 | signed_in: 'Signed in successfully.' 19 | signed_out: 'Signed out successfully.' 20 | passwords: 21 | send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' 22 | updated: 'Your password was changed successfully. You are now signed in.' 23 | confirmations: 24 | send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' 25 | confirmed: 'Your account was successfully confirmed. You are now signed in.' 26 | registrations: 27 | signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.' 28 | updated: 'You updated your account successfully.' 29 | destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' 30 | unlocks: 31 | send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' 32 | unlocked: 'Your account was successfully unlocked. You are now signed in.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Confirmation instructions' 36 | reset_password_instructions: 37 | subject: 'Reset password instructions' 38 | unlock_instructions: 39 | subject: 'Unlock Instructions' 40 | -------------------------------------------------------------------------------- /config/locales/devise.es.yml: -------------------------------------------------------------------------------- 1 | es: 2 | errors: 3 | messages: 4 | not_found: "no encontrado" 5 | already_confirmed: "ya fue confirmado" 6 | not_locked: "no ha sido desbloqueado" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Necesita ingresar o registrarse para continuar.' 11 | unconfirmed: 'Necesita confirmar su cuenta antes de continuar.' 12 | locked: 'Su cuenta ha sido bloqueada.' 13 | invalid: "Email o Contraseña invalido." 14 | invalid_token: "Llave de Autenticación invalida." 15 | timeout: "Su sesión ha expirado, por favor ingrese nuevamente para continuar." 16 | inactive: 'Su cuenta aun no ha sido activada.' 17 | sessions: 18 | signed_in: "Ingreso de sesión exitosamente." 19 | signed_out: 'Sesión cerrada exitosamente.' 20 | passwords: 21 | send_instructions: "Usted recibirá un email con instrucciones sobre como re establecer su contraseña en unos minutos." 22 | updated: "Su contraseña ha sido cambiada exitosamente. Ahora usted puede ingresar." 23 | confirmations: 24 | send_instructions: 'Usted recibirá un email con instrucciones de como confirmar su cuenta en unos minutos.' 25 | confirmed: 'Su cuenta ha sido confirmada exitosamente. Ahora usted puede ingresar.' 26 | registrations: 27 | signed_up: "Se ha registrado con exito. Si está activado, la confirmación será enviada a su correo electrónico." 28 | updated: 'Ha actualizado su cuenta exitosamente.' 29 | destroyed: 'Adios! Su cuenta ha sido cancelada exitosamente. Esperamos verlo pronto.' 30 | unlocks: 31 | send_instructions: "Usted recibirá un email con instrucciones sobre como des bloquear su cuenta en unos minutos." 32 | unlocked: 'Su cuenta ha sido des bloqueada exitosamente. Ahora usted ingresar.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: "Instrucciones de Confirmación" 36 | reset_password_instructions: 37 | subject: "Instrucciones para re establecer contraseña" 38 | unlock_instructions: 39 | subject: 'Instrucciones para des bloquear' 40 | -------------------------------------------------------------------------------- /config/locales/devise.fi.yml: -------------------------------------------------------------------------------- 1 | fi: 2 | errors: 3 | messages: 4 | not_found: "ei löytynyt" 5 | already_confirmed: "oli jo vahvistettu" 6 | not_locked: "ei ollut lukittu" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Sinun täytyy kirjautua tai rekisteröityä ennen jatkamista.' 11 | unconfirmed: 'Sinun täytyy vahvistaa tilisi ennen jatkamista.' 12 | locked: 'Tilisi on lukittu.' 13 | invalid: 'Virheellinen sähköpostiosoite tai salasana.' 14 | invalid_token: 'Virheellinen valtuutusavain.' 15 | timeout: 'Istuntosi on vanhentunut, ole hyvä ja kirjaudu uudelleen jatkaaksesi.' 16 | inactive: 'Tiliäsi ei ole vielä aktivoitu.' 17 | sessions: 18 | signed_in: 'Sisäänkirjautuminen onnistui.' 19 | signed_out: 'Uloskirjautuminen onnistui.' 20 | passwords: 21 | send_instructions: 'Saat hetken kuluttua sähköpostin joka sisältää salasanan nollausohjeet.' 22 | updated: 'Salasanan vaihto onnistui. Olet nyt kirjautunut sisään.' 23 | confirmations: 24 | send_instructions: 'Saat hetken kuluttua sähköpostin joka sisältää tilin vahvistusohjeet.' 25 | confirmed: 'Tilin vahvistus onnistui. Olet nyt kirjautunut sisään.' 26 | registrations: 27 | signed_up: 'Rekisteröityminen onnistui. Vahvistussähköposti on lähetetty sinulle, mikäli kyseinen toiminto on päällä.' 28 | updated: 'Tilin päivitys onnistui.' 29 | destroyed: 'Tilin peruutus onnistui. Toivomme kuitenkin näkevämme sinut vielä uudestaan.' 30 | unlocks: 31 | send_instructions: 'Saat hetken kuluttua sähköpostin joka sisältää tilisi avausohjeet.' 32 | unlocked: 'Tilin avaus onnistui. Olet nyt kirjautunut sisään.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Vahvistusohjeet' 36 | reset_password_instructions: 37 | subject: 'Salasanan nollausohjeet' 38 | unlock_instructions: 39 | subject: 'Avausohjeet' 40 | -------------------------------------------------------------------------------- /config/locales/devise.lt.yml: -------------------------------------------------------------------------------- 1 | lt: 2 | errors: 3 | messages: 4 | not_found: "Nerastas" 5 | already_confirmed: "patvirtintas" 6 | not_locked: "ne užblokuotas" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Reikalinga registracija.' 11 | unconfirmed: 'Reikalingas registracijos patvirtinimas.' 12 | locked: 'Jūsų paskyra yra užblokuota.' 13 | invalid: 'KLAIDA: neteisingas naudotojo vardas arba slaptažodis.' 14 | invalid_token: 'Neteisingas atpažinimo žetonas.' 15 | timeout: 'Jus buvote automatiškai atjungti. Prašome vėl prisijungti.' 16 | inactive: 'Jūsų sąskaita nėra aktyvuota.' 17 | sessions: 18 | signed_in: 'Sėkmingai prisijungėte.' 19 | signed_out: 'Sėkmingai atsijungėte.' 20 | passwords: 21 | send_instructions: 'Nurodymus kaip pasikeisti jūsų slaptažodį netrukus gausite el. paštu..' 22 | updated: 'Jūsų slaptažodis buvo sėkmingai pakeistas. Galite prisijungti. ' 23 | confirmations: 24 | send_instructions: 'Nurodymus kaip patvirtinti jūsų sukurtą sąskaitą netrukus gausite el. paštu.' 25 | confirmed: 'Jūsų sąskaita yra sėkmingai patvirtinta. Galite prisijungti.' 26 | registrations: 27 | signed_up: 'Jus sėkmingai užsiregistravote.Patvirtintinimo laišką netrukus gausite el. paštu .' 28 | updated: 'Jūsų sąskaita yra sėkmingai atnaujinta.' 29 | destroyed: 'Jūsų sąskata yra panakinta. Sėkmės.' 30 | unlocks: 31 | send_instructions: 'Nurodymus kaip atblokuoti jūsų sąskaitą netrukus gausite el. paštu.' 32 | unlocked: 'Jųsū paskyra sėkmingai atblokuota. .' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Sąskaitos patvirtinimo nurodymai' 36 | reset_password_instructions: 37 | subject: 'Slaptažodio pakeitimas' 38 | unlock_instructions: 39 | subject: 'Sąskaitos atblokavimo nurodymai' 40 | -------------------------------------------------------------------------------- /config/locales/devise.pt-BR.yml: -------------------------------------------------------------------------------- 1 | pt-BR: 2 | errors: 3 | messages: 4 | not_found: "não encontrado" 5 | already_confirmed: "já foi confirmado" 6 | not_locked: "não foi bloqueado" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Para continuar, faça login ou registre-se.' 11 | unconfirmed: 'Antes de continuar, confirme a sua conta.' 12 | locked: 'A sua conta está bloqueada.' 13 | invalid: 'Email ou senha inválidos.' 14 | invalid_token: 'O token de autenticação não é válido.' 15 | timeout: 'A sua sessão expirou, por favor faça login novamente para poder continuar.' 16 | inactive: 'A sua conta ainda não foi ativada.' 17 | sessions: 18 | signed_in: 'Conectado com sucesso.' 19 | signed_out: 'Desconectado com sucesso.' 20 | passwords: 21 | send_instructions: 'Dentro de minutos, receberá um email com as instruções de reinicialização da senha.' 22 | updated: 'A sua senha foi alterada com sucesso. Agora está conectado.' 23 | confirmations: 24 | send_instructions: 'Dentro de minutos, receberá um email com as instruções de confirmação da sua conta.' 25 | confirmed: 'A sua conta foi confirmada com sucesso. Agora está conectado.' 26 | registrations: 27 | signed_up: 'Conectado com sucesso. Se não autorizado, a confirmação foi enviada por email.' 28 | updated: 'A sua conta foi atualizada com sucesso.' 29 | destroyed: 'Adeus! A sua conta foi cancelada com sucesso. Esperamos vê-lo novamente em breve.' 30 | unlocks: 31 | send_instructions: 'Dentro de minutos, receberá um email com as instruções como desbloquear a sua conta.' 32 | unlocked: 'A sua conta foi desbloqueada com sucesso. Agora está conectado.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Instruções de confirmação' 36 | reset_password_instructions: 37 | subject: 'Instruções de reinicialização de senha' 38 | unlock_instructions: 39 | subject: 'Instruções de desbloqueio' -------------------------------------------------------------------------------- /config/locales/devise.pt-PT.yml: -------------------------------------------------------------------------------- 1 | pt-PT: 2 | errors: 3 | messages: 4 | not_found: "não encontrado" 5 | already_confirmed: "já foi confirmado" 6 | not_locked: "não foi bloqueado" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Antes de continuar por favor inicie a sua sessão ou registe-se.' 11 | unconfirmed: 'Antes de continuar terá que confirmar a sua conta.' 12 | locked: 'A sua conta está bloqueada.' 13 | invalid: 'E-mail ou palavra-passe inválido.' 14 | invalid_token: 'Chave de autenticação inválida.' 15 | timeout: 'A sua sessão expirou, por favor volte a identificar-se para continuar.' 16 | inactive: 'A sua conta ainda não foi activada.' 17 | sessions: 18 | signed_in: 'Sessão iniciada com sucesso.' 19 | signed_out: 'Sessão terminada com sucesso.' 20 | passwords: 21 | send_instructions: 'Dentro de alguns minutos irá receber um e-mail com instruções sobre como redefinir a sua palavra-passe.' 22 | updated: 'Palavra-passe alterada com sucesso. A sua sessão foi iniciada.' 23 | confirmations: 24 | send_instructions: 'Dentro de alguns minutos irá receber um e-mail com instruções sobre como confirmar a sua conta.' 25 | confirmed: 'Conta confirmada com sucesso. A sua sessão foi iniciada.' 26 | registrations: 27 | signed_up: 'Conta criada com sucesso. A confirmação de registo foi enviada para o seu e-mail, caso tenha seleccionado essa opção.' 28 | updated: 'A sua conta foi actualizada com sucesso.' 29 | destroyed: 'Adeus! A sua conta foi cancelada com sucesso. Esperamos vê-lo em breve.' 30 | unlocks: 31 | send_instructions: 'Dentro de alguns minutos irá receber um e-mail com instruções sobre como desbloquear a sua conta.' 32 | unlocked: 'Conta desbloqueada com sucesso. A sua sessão foi iniciada.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Instruções de confirmação.' 36 | reset_password_instructions: 37 | subject: 'Instruções de redefinição da palavra-passe.' 38 | unlock_instructions: 39 | subject: 'Instruções de desbloqueamento.' 40 | -------------------------------------------------------------------------------- /config/locales/devise.ru.yml: -------------------------------------------------------------------------------- 1 | ru: 2 | errors: 3 | messages: 4 | not_found: "не найдено" 5 | already_confirmed: "уже было подтверждено" 6 | not_locked: "не было заблокировано" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Вам нужно войти или зарегистрироваться перед тем, как продолжить.' 11 | unconfirmed: 'Вам нужно подтвердить вашу учётную запись перед тем, как продолжить.' 12 | locked: 'Ваша учётная запись заблокирована.' 13 | invalid: 'Неверный адрес электронной почты или неверный пароль.' 14 | invalid_token: 'Ошибочный токен аутентификации.' 15 | timeout: 'Ваша рабочая сессия устарела, пожалуйста, войдите снова, чтобы продолжить.' 16 | inactive: 'Ваша учётная запись ещё не активирована.' 17 | sessions: 18 | signed_in: 'Успешно вошли.' 19 | signed_out: 'Успешно вышли.' 20 | passwords: 21 | send_instructions: 'Вы получите письмо по электронной почте с инструкциями, как сбросить ваш пароль, в течение ближайших нескольких минут.' 22 | updated: 'Ваш пароль был успешно изменён. Вы сейчас вошли.' 23 | confirmations: 24 | send_instructions: 'Вы получите письмо по электронной почте с инструкциями, как подтвердить вашу учётную запись, в течение ближайших нескольких минут.' 25 | confirmed: 'Ваша учётная запись успешно подтверждена. Вы сейчас вошли.' 26 | registrations: 27 | signed_up: 'Вы успешно зарегистрировались. Если настроено, подтверждение было выслано на ваш адрес электронной почты.' 28 | updated: 'Вы успешно обновили вашу учётную запись.' 29 | destroyed: 'Пока! Ваша учётная запись успешно прекратила своё существование. Мы будем рады увидеть вас снова позднее.' 30 | unlocks: 31 | send_instructions: 'Вы получите письмо по электронной почте с инструкциями, как разблокировать вашу учётную запись, в течение ближайших нескольких минут.' 32 | unlocked: 'Ваша учётная запись успешно разблокирована. Вы сейчас вошли.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Инструкции по подтверждению' 36 | reset_password_instructions: 37 | subject: 'Инструкции по сбросу пароля' 38 | unlock_instructions: 39 | subject: 'Инструкции по разблокировке' 40 | -------------------------------------------------------------------------------- /config/locales/devise.sv.yml: -------------------------------------------------------------------------------- 1 | sv: 2 | errors: 3 | messages: 4 | not_found: "kunde inte hittas" 5 | already_confirmed: "har redan blivit bekräftat" 6 | not_locked: "var inte låst" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Du måste logga in eller registrera dig innan du kan fortsätta.' 11 | unconfirmed: 'Du måste bekräfta ditt konto innan du kan fortsätta.' 12 | locked: 'Ditt konto är låst.' 13 | invalid: 'Ogiltig e-postadress eller lösenord.' 14 | invalid_token: 'Ogiltig autentiseringstecken.' 15 | timeout: 'Din session har utgått, vänligen logga in igen för att fortsätta.' 16 | inactive: 'Ditt konto har inte blivit aktiverat än.' 17 | sessions: 18 | signed_in: 'Inloggning lyckades.' 19 | signed_out: 'Utloggning lyckades.' 20 | passwords: 21 | send_instructions: 'Du kommer att få ett e-post med instruktioner om hur du återställer ditt lösenord inom några minuter.' 22 | updated: 'Ditt lösenord har ändrats. Du är nu inloggad.' 23 | confirmations: 24 | send_instructions: 'Du kommer att få ett e-post med instruktioner om hur du bekräftar ditt konto inom några minuter.' 25 | confirmed: 'Ditt konto har bekräftats. Du är nu inloggad.' 26 | registrations: 27 | signed_up: 'Du har registrerat dig. Om aktiverat, så har en bekräftelse skickats till din e-post.' 28 | updated: 'Ditt konto har blivit uppdaterat.' 29 | destroyed: 'Hejdå! Ditt konto var borttaget. Vi hoppas att få se dig snart igen.' 30 | unlocks: 31 | send_instructions: 'Du kommer att få ett e-post med instruktioner om hur du låser upp ditt konto inom några minuter.' 32 | unlocked: 'Ditt konto har blivit upplåst. Du är nu inloggad.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Instruktioner för bekräftelse' 36 | reset_password_instructions: 37 | subject: 'Instruktioner för återställning av lösenord' 38 | unlock_instructions: 39 | subject: 'Instruktioner för upplåsning' 40 | -------------------------------------------------------------------------------- /config/locales/devise.tr.yml: -------------------------------------------------------------------------------- 1 | tr: 2 | errors: 3 | messages: 4 | not_found: "bulunamadı" 5 | already_confirmed: "zaten onaylanmış." 6 | not_locked: "açılmamış." 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Devam etmeden önce giriş yapmanız ya da kayıt olmanız gerekiyor.' 11 | unconfirmed: 'Devam etmeden önce hesabınızı onaylamanız gerekiyor.' 12 | locked: 'Hesabınız kilitli.' 13 | invalid: 'Yanlış email ya da şifre.' 14 | invalid_token: 'Kimlik denetimi anahtarı yanlış.' 15 | timeout: 'Oturumunuzun süresi geçmiş. Devam etmek için lütfen giriş yapın.' 16 | inactive: 'Hesabınız daha etkileştirilmedi.' 17 | sessions: 18 | signed_in: 'Başarıyla giriş yapıldı.' 19 | signed_out: 'Başarıyla çıkış yapıldı.' 20 | passwords: 21 | send_instructions: 'Birkaç dakika içinde emailinize şifrenizi nasıl sıfırlayacağınız konusunda talimatlar gönderilecek.' 22 | updated: 'Şifreniz başarıyla değiştirildi. Şimdi giriş yaptınız.' 23 | confirmations: 24 | send_instructions: 'Birkaç dakika içinde emailinize hesabınızı nasıl onaylayacağınız konusunda talimatlar gönderilecek.' 25 | confirmed: 'Hesabınız başarıyla onaylandı. Şimdi giriş yaptınız.' 26 | registrations: 27 | signed_up: 'Başarıyla kayıt oldunuz. Eğer etkinleştirildiyse, bir onay emaili gönderilecek.' 28 | updated: 'Hesabınızı başarıyla güncellediniz.' 29 | destroyed: 'Güle güle! Hesabınız başarıyla iptal edildi. Umarız tekrar görüşürüz.' 30 | unlocks: 31 | send_instructions: 'Birkaç dakika içinde emailinize hesabınızın kilidini nasıl açacağınız konusunda talimatlar gönderilecek.' 32 | unlocked: 'Hesabınızın kilidi başarıyla çözüldü. Şimdi giriş yaptınız.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Onaylama talimatları' 36 | reset_password_instructions: 37 | subject: 'Şifre sıfırlama talimatları' 38 | unlock_instructions: 39 | subject: 'Kilit açma talimatları' 40 | -------------------------------------------------------------------------------- /config/locales/devise.uk.yml: -------------------------------------------------------------------------------- 1 | uk: 2 | errors: 3 | messages: 4 | not_found: "не знайдено" 5 | already_confirmed: "вже підтверджено" 6 | not_locked: "не було заблоковано" 7 | 8 | devise: 9 | failure: 10 | unauthenticated: 'Вам потрібно ввійти або зареєструватись для того, щоб продовжити.' 11 | unconfirmed: 'Вам потрібно підтвердити Ваш рахунок для того, щоб продовжити.' 12 | locked: 'Ваш рахунок заблоковано.' 13 | invalid: 'Невірна адреса електроної пошти або гасло.' 14 | invalid_token: 'Невірний автентифікаційний ключ.' 15 | timeout: 'Ваш сеанс більше недійсний, будь-ласка ввійдіть ще раз для того, щоб продовжити.' 16 | inactive: 'Ваш рахунок ще неактивований.' 17 | sessions: 18 | signed_in: 'Ви успішно ввійшли.' 19 | signed_out: 'Ви успішно вийшли.' 20 | passwords: 21 | send_instructions: 'За декілька хвилин Ви отримаєте лист із інструкціями, як змінити Ваше гасло.' 22 | updated: 'Ви успішно змінили Ваше гасло та ввійшли.' 23 | confirmations: 24 | send_instructions: 'За декілька хвилин Ви отримаєте лист із інструкціями, як підтвердити Ваш рахунок.' 25 | confirmed: 'Ви успішно підтвердили Ваш рахунок та ввійшли.' 26 | registrations: 27 | signed_up: 'Ви успішно створили рахунок. Якщо було потрібно, Вам надіслали лист для підтвердження.' 28 | updated: 'Ви успішно оновили дані рахунку.' 29 | destroyed: 'До зустрічі! Ви успішно закрили рахунок. Сподіваємось побачити Вас найближчим часом.' 30 | unlocks: 31 | send_instructions: 'За декілька хвилин Ви отримаєте лист із інструкціями, як розблокувати Ваш рахунок.' 32 | unlocked: 'Ви успішно розблокували Ваш рахунок та ввійшли.' 33 | mailer: 34 | confirmation_instructions: 35 | subject: 'Інструкції для підтвердження' 36 | reset_password_instructions: 37 | subject: 'Інструкції для зміни гасла' 38 | unlock_instructions: 39 | subject: 'Інструкції для розблокування' 40 | -------------------------------------------------------------------------------- /config/locales/rails_admin.bg.yml: -------------------------------------------------------------------------------- 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 | bg: 5 | home: 6 | name: "начало" 7 | admin: 8 | dashboard: 9 | pagename: "Администрация" 10 | name: "Табло" 11 | model_name: "Име на модел" 12 | last_used: "Последно използван" 13 | records: "Записи" 14 | modify: "Редактирай" 15 | add_new: "Добави нов" 16 | show: "Покажи" 17 | ago: "" 18 | history: 19 | name: "История" 20 | page_name: "История за %{name}" 21 | no_activity: "Липса на активност" 22 | credentials: 23 | log_out: "Изход" 24 | list: 25 | edit_action: "Редактирай" 26 | delete_action: "Изтрий" 27 | add_new: "Добави" 28 | search: "ТЪРСИ" 29 | select: "Избор на %{name} за редакция" 30 | show_all: "Покажи всички" 31 | new: 32 | basic_info: "Информация" 33 | required: "Задължително" 34 | optional: "Незадължително" 35 | one_char: "символ." 36 | many_chars: "символа." 37 | chosen: "Избрано %{name}" 38 | select_choice: "Избери и кликни" 39 | chose_all: "Избери всички" 40 | clear_all: "Изчисти всички" 41 | save: "Запамети" 42 | save_and_add_another: "Запамети и добави друг" 43 | save_and_edit: "Запамети и редактирай" 44 | cancel: "Откажи" 45 | delete: 46 | flash_confirmation: "%{name} е успешно изтрит" 47 | confirmation: "Да, сигурен съм" 48 | flash: 49 | successful: "%{name} е успешно %{action}" 50 | error: "%{name} се провали при %{action}" 51 | noaction: "Не са предприети действия" 52 | actions: 53 | create: "създай" 54 | created: "създаден" 55 | update: "редактирай" 56 | updated: "редактиран" 57 | delete: "изтрий" 58 | deleted: "изтрит" 59 | -------------------------------------------------------------------------------- /config/locales/rails_admin.da.yml: -------------------------------------------------------------------------------- 1 | da: 2 | home: 3 | name: "hjem" 4 | admin: 5 | dashboard: 6 | pagename: "Administration" 7 | name: "Oversigt" 8 | model_name: "Modelnavn" 9 | last_used: "Sidst brugt" 10 | records: "Antal" 11 | modify: "Rediger" 12 | add_new: "Tilføj ny" 13 | show: "Vis" 14 | ago: "siden" 15 | history: 16 | name: "Historik" 17 | page_name: "Historik for %{name}" 18 | no_activity: "Ingen aktivitet" 19 | credentials: 20 | log_out: "Log ud" 21 | list: 22 | edit_action: "Rediger" 23 | delete_action: "Slet" 24 | add_new: "Tilføj ny" 25 | search: "SØG" 26 | select: "Vælg %{name} der skal redigeres" 27 | show_all: "Vis alle" 28 | new: 29 | basic_info: "Grundlæggende informationer" 30 | required: "Påkrævet" 31 | optional: "Ikke påkrævet" 32 | one_char: "tegn." 33 | many_chars: "eller færre tegn." 34 | chosen: "Valgt %{name}" 35 | select_choice: "Vælg og klik" 36 | chose_all: "Vælg alle" 37 | clear_all: "Fravælg alle" 38 | save: "Gem" 39 | save_and_add_another: "Gem og tilføj ny" 40 | save_and_edit: "Gem og rediger" 41 | cancel: "Fortryd" 42 | delete: 43 | flash_confirmation: "%{name} er nu slettet" 44 | confirmation: "Ja, jeg er sikker" 45 | flash: 46 | successful: "%{name} er nu %{action}" 47 | error: "%{name} er nu ikke %{action} pga. en fejl" 48 | noaction: "Der er ikke foretaget noget" 49 | actions: 50 | create: "ny" 51 | created: "tilføjet" 52 | update: "opdater" 53 | updated: "opdateret" 54 | delete: "slet" 55 | deleted: "slettet" 56 | 57 | -------------------------------------------------------------------------------- /config/locales/rails_admin.de.yml: -------------------------------------------------------------------------------- 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 | de: 5 | home: 6 | name: "Home" 7 | admin: 8 | dashboard: 9 | pagename: "Administration" 10 | name: "Dashboard" 11 | model_name: "Modell Name" 12 | last_used: "Zuletzt verwendet" 13 | records: "Einträge" 14 | modify: "Ändern" 15 | add_new: "Neu hinzufügen" 16 | show: "Anzeigen" 17 | ago: "vor" 18 | history: 19 | name: "Verlauf" 20 | page_name: "Verlauf von %{name}" 21 | no_activity: "Keine Aktivität" 22 | credentials: 23 | log_out: "abmelden" 24 | list: 25 | edit_action: "Bearbeiten" 26 | delete_action: "Löschen" 27 | select_action: "Auswählen" 28 | delete_selected: "Auswahl löschen" 29 | add_new: "Neu hinzufügen" 30 | search: "Suchen" 31 | select: "Auswählen %{name} zum Bearbeiten" 32 | show_all: "Alle anzeigen" 33 | new: 34 | basic_info: "Grundlegende Informationen" 35 | required: "Erforderlich" 36 | optional: "Optional" 37 | one_char: "Zeichen." 38 | many_chars: "Zeichen oder weniger." 39 | chosen: "Ausgewählt %{name}" 40 | select_choice: "Treffen Sie Ihre Auswahl und klicken Sie" 41 | chose_all: "Alle auswählen" 42 | clear_all: "Alle zurücksetzen" 43 | save: "Speichern" 44 | save_and_add_another: "Speichern und einen weiteren hinzufügen" 45 | save_and_edit: "Speichern und bearbeiten" 46 | cancel: "Abbrechen" 47 | delete: 48 | flash_confirmation: "%{name} wurde erfolgreich entfernt" 49 | confirmation: "Ja, ich bin sicher" 50 | flash: 51 | successful: "%{name} wurde erfolgreich %{action}" 52 | error: "%{name} wurde nicht %{action}" 53 | noaction: "Keine Aktionen durchgeführt" 54 | actions: 55 | create: "erstellen" 56 | created: "erstellt" 57 | update: "aktualisieren" 58 | updated: "aktualisiert" 59 | delete: "löschen" 60 | deleted: "gelöscht" 61 | -------------------------------------------------------------------------------- /config/locales/rails_admin.en.yml: -------------------------------------------------------------------------------- 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 | home: 6 | name: "home" 7 | admin: 8 | dashboard: 9 | pagename: "Site administration" 10 | name: "Dashboard" 11 | model_name: "Model name" 12 | last_used: "Last used" 13 | records: "Records" 14 | modify: "Modify" 15 | add_new: "Add new" 16 | show: "Show" 17 | ago: "ago" 18 | history: 19 | name: "History" 20 | page_name: "History for %{name}" 21 | no_activity: "No Activity" 22 | credentials: 23 | log_out: "Log out" 24 | list: 25 | edit_action: "Edit" 26 | delete_action: "Delete" 27 | select_action: "Select" 28 | delete_selected: "Delete selected" 29 | add_new: "Add new" 30 | search: "Search" 31 | select: "Select %{name} to edit" 32 | show_all: "Show all" 33 | new: 34 | basic_info: "Basic info" 35 | required: "Required" 36 | optional: "Optional" 37 | one_char: "character." 38 | many_chars: "characters or fewer." 39 | chosen: "Chosen %{name}" 40 | select_choice: "Select your choice(s) and click" 41 | chose_all: "Choose all" 42 | clear_all: "Clear all" 43 | save: "Save" 44 | save_and_add_another: "Save and add another" 45 | save_and_edit: "Save and edit" 46 | cancel: "Cancel" 47 | delete: 48 | flash_confirmation: "%{name} was successfully destroyed" 49 | confirmation: "Yes, I'm sure" 50 | flash: 51 | successful: "%{name} was successfully %{action}" 52 | error: "%{name} failed to be %{action}" 53 | noaction: "No actions were taken" 54 | actions: 55 | create: "create" 56 | created: "created" 57 | update: "update" 58 | updated: "updated" 59 | delete: "delete" 60 | deleted: "deleted" -------------------------------------------------------------------------------- /config/locales/rails_admin.es.yml: -------------------------------------------------------------------------------- 1 | es: 2 | home: 3 | name: "inicio" 4 | admin: 5 | dashboard: 6 | pagename: "Administración del sitio" 7 | name: "Panel" 8 | model_name: "Nombre del modelo" 9 | last_used: "Último uso" 10 | records: "Registros" 11 | modify: "Modificar" 12 | add_new: "Agregar" 13 | show: "Mostrar" 14 | ago: "atrás" 15 | history: 16 | name: "Histórico" 17 | page_name: "Histórico de %{name}" 18 | no_activity: "No hubo actividad" 19 | credentials: 20 | log_out: "Cerrar sessión" 21 | list: 22 | edit_action: "Editar" 23 | delete_action: "Eliminar" 24 | add_new: "Agregar" 25 | search: "BUSCAR" 26 | select: "Seleccione %{name} para editar" 27 | show_all: "Mostrar todos" 28 | new: 29 | basic_info: "Información Básica" 30 | required: "Obligatorio" 31 | optional: "Opcional" 32 | one_char: "caracter." 33 | many_chars: "caracteres o menos." 34 | chosen: "Seleccionado %{name}" 35 | select_choice: "Seleccione su(s) elección(es) y haga clic" 36 | chose_all: "Elegir todos" 37 | clear_all: "Limpiar todos" 38 | save: "Guardar" 39 | save_and_add_another: "Guardar y agregar otro" 40 | save_and_edit: "Guardar y editar" 41 | cancel: "Cancelar" 42 | delete: 43 | flash_confirmation: "%{name} fue eliminado exitosamente" 44 | confirmation: "Sí, estoy seguro" 45 | flash: 46 | successful: "%{name} fue %{action} correctamente" 47 | error: "%{name} no se pudo %{action} correctamente" 48 | noaction: "No se realizó ninguna acción" 49 | actions: 50 | create: "crear" 51 | created: "creado" 52 | update: "actualizar" 53 | updated: "actualizado" 54 | delete: "borrar" 55 | deleted: "borrado" 56 | -------------------------------------------------------------------------------- /config/locales/rails_admin.fi.yml: -------------------------------------------------------------------------------- 1 | 2 | fi: 3 | home: 4 | name: "koti" 5 | admin: 6 | dashboard: 7 | pagename: "Ylläpito" 8 | name: "Hallintapaneeli" 9 | model_name: "Tietuetyyppi" 10 | last_used: "Muokattu viimeksi" 11 | records: "Tietueet" 12 | modify: "Muokkaa" 13 | add_new: "Lisää uusi" 14 | show: "Näytä" 15 | ago: "sitten" 16 | history: 17 | name: "Historia" 18 | page_name: "Historia kohteelle %{name}" 19 | no_activity: "Ei tapahtumia" 20 | credentials: 21 | log_out: "Kirjaudu ulos" 22 | list: 23 | edit_action: "Muokkaa" 24 | delete_action: "Poista" 25 | select_action: "Valitse" 26 | delete_selected: "Poista valitut" 27 | add_new: "Lisää uusi" 28 | search: "HAKU" 29 | select: "Valitse muokattava %{name}" 30 | show_all: "Näytä kaikki" 31 | new: 32 | basic_info: "Perustiedot" 33 | required: "Vaadittu" 34 | optional: "Vapaaehtoinen" 35 | one_char: "merkki." 36 | many_chars: "merkkiä tai vähemmän." 37 | chosen: "Valittu %{name}" 38 | select_choice: "Tee valinnat ja klikkaa" 39 | chose_all: "Valitse kaikki" 40 | clear_all: "Tyhjennä" 41 | save: "Tallenna" 42 | save_and_add_another: "Tallenna ja lisää uusi" 43 | save_and_edit: "Tallenna ja muokkaa" 44 | cancel: "Peruuta" 45 | delete: 46 | flash_confirmation: "%{name} poistettiin onnistuneesti" 47 | confirmation: "Kyllä, olen varma" 48 | flash: 49 | successful: "%{name} %{action} onnistuneesti" 50 | error: "Toimenpide epäonnistui eikä %{name} tyyppistä tietuetta %{action}" 51 | noaction: "Mitään ei tehty" 52 | actions: 53 | create: "luo" 54 | created: "luotu" 55 | update: "päivitä" 56 | updated: "päivitetty" 57 | delete: "poista" 58 | deleted: "poistettu" -------------------------------------------------------------------------------- /config/locales/rails_admin.fr.yml: -------------------------------------------------------------------------------- 1 | 2 | fr: 3 | home: 4 | name: "home" 5 | admin: 6 | dashboard: 7 | pagename: "Administration du site" 8 | name: "Tableau de bord" 9 | model_name: "Nom du modèle" 10 | last_used: "Utilisé" 11 | records: "Archives" 12 | modify: "Modifier" 13 | add_new: "Nouv" 14 | show: "Voir" 15 | ago: "ago" 16 | history: 17 | name: "Histoire" 18 | page_name: "Histoire de %{name}" 19 | credentials: 20 | log_out: "Déconnectez-vous" 21 | list: 22 | edit_action: "Éditer" 23 | delete_action: "Effacer" 24 | add_new: "Nouv" 25 | search: "RECHERCHE" 26 | select: "Sélectionner %{name} pour modifier" 27 | show_all: "Afficher tous" 28 | new: 29 | basic_info: "INFO DE BASE" 30 | required: "Obligatoire" 31 | optional: "Facultatif" 32 | one_char: "caractère." 33 | many_chars: "caractères ou moins." 34 | chosen: "%{name} choisi" 35 | select_choice: "Sélectionnez votre choix" 36 | chose_all: "Choisissez toutes" 37 | clear_all: "Effacer tout" 38 | save: "Enregistrer" 39 | save_and_add_another: "Enregistrer et ajouter une autre" 40 | save_and_edit: "Enregistrer et modifier" 41 | cancel: "Annuler" 42 | delete: 43 | flash_confirmation: "%{name} a été détruit avec succès" 44 | confirmation: "Oui, je suis sûr" 45 | flash: 46 | successful: "%{name} a été %{action} avec succès" 47 | error: "%{name} n'a pas pu être %{action}" 48 | noaction: "Aucune mesure où prendre!" 49 | actions: 50 | create: "create" 51 | created: "created" 52 | update: "update" 53 | updated: "updated" 54 | delete: "delete" 55 | deleted: "deleted" -------------------------------------------------------------------------------- /config/locales/rails_admin.lt.yml: -------------------------------------------------------------------------------- 1 | # Lithuanian 2 | 3 | lt: 4 | home: 5 | name: "Pradžia" 6 | admin: 7 | dashboard: 8 | pagename: "Nustatymai" 9 | name: "Nustatymų pasirinkimai" 10 | model_name: "Modelio pavadinimas" 11 | last_used: "Paskutinį kartą naudotas" 12 | records: "Įrašai" 13 | modify: "Keisti" 14 | add_new: "Pridėti" 15 | show: "Rodyti" 16 | ago: "prieš" 17 | history: 18 | name: "Archyvai" 19 | page_name: "%{name} pakeitimų istorija" 20 | no_activity: "Be pasikeitimų" 21 | credentials: 22 | log_out: "Atsijungti" 23 | list: 24 | edit_action: "Tvarkyti" 25 | delete_action: "Pašalinti" 26 | select_action: "Pasirinkti" 27 | delete_selected: "Pašalinti pasirinktus" 28 | add_new: "Pridėti" 29 | search: "IEŠKOTI" 30 | select: "Pasirinkti %{name} redagavimui" 31 | show_all: "Rodyti visus įrašus" 32 | new: 33 | basic_info: "Pagrindinė informacija" 34 | required: "Privalomas laukas" 35 | optional: "Nebūtinas" 36 | one_char: "simbolis." 37 | many_chars: "simbolių arba mažiau." 38 | chosen: "Pasirinktas %{name}" 39 | select_choice: "Pasirinkti reikalingus ir patvirtinti" 40 | chose_all: "Pasirinkti visus" 41 | clear_all: "Išvalyti" 42 | save: "Išsaugoti" 43 | save_and_add_another: "Išsaugoti ir pridėti naują" 44 | save_and_edit: "Išsaugoti ir tęsti redagavimą" 45 | cancel: "Atšaukti" 46 | delete: 47 | flash_confirmation: "%{name} ištrintas" 48 | confirmation: "Taip, aš sutinku" 49 | flash: 50 | successful: "%{name} buvo sėkmingai %{action}" 51 | error: "Nepavyko %{action} %{name}" 52 | noaction: "Pakeitimai nebuvo įvykdyti" 53 | actions: 54 | create: "sukurti" 55 | created: "sukurtas" 56 | update: "pakeisti" 57 | updated: "pakeistas" 58 | delete: "pašalinti" 59 | deleted: "pašalintas" 60 | -------------------------------------------------------------------------------- /config/locales/rails_admin.lv.yml: -------------------------------------------------------------------------------- 1 | lv: 2 | home: 3 | name: "sākums" 4 | admin: 5 | dashboard: 6 | pagename: "Saita administrēšana" 7 | name: "Vadības panelis" 8 | model_name: "Modeļa nosaukums" 9 | last_used: "Pēdējo reizi izmantots" 10 | records: "Ieraksti" 11 | modify: "Mainīt" 12 | add_new: "Pievienot jaunu" 13 | show: "Parādīt" 14 | ago: "pirms" 15 | history: 16 | name: "Vēsture" 17 | page_name: "%{name} vēsture" 18 | no_activity: "Nav Aktivitātes" 19 | credentials: 20 | log_out: "Iziet" 21 | list: 22 | edit_action: "Labot" 23 | delete_action: "Dzēst" 24 | add_new: "Pievienot jaunu" 25 | search: "MEKLĒT" 26 | select: "Izvēlieties %{name}, lai labotu" 27 | show_all: "Parādīt visu" 28 | new: 29 | basic_info: "Pamatinformācija" 30 | required: "Nepieciešams" 31 | optional: "Pēc izvēles" 32 | one_char: "simbols." 33 | many_chars: "simboli vai mazāk." 34 | chosen: "Izvēlēts %{name}" 35 | select_choice: "Izvēlieties nepieciešamo un spiediet" 36 | chose_all: "Izvēlēties visus" 37 | clear_all: "Notīrīt" 38 | save: "Saglabāt" 39 | save_and_add_another: "Saglabāt un pievienot jaunu" 40 | save_and_edit: "Saglabāt un labot" 41 | cancel: "Atcelt" 42 | delete: 43 | flash_confirmation: "%{name} veiksmīgi izdzēsts" 44 | confirmation: "Jā, esmu pārliecināts" 45 | flash: 46 | successful: "%{name} veiksmīgi %{action}" 47 | error: "%{name} netika %{action}" 48 | noaction: "Netika veiktas darbības" 49 | actions: 50 | create: "izveidot" 51 | created: "izveidots" 52 | update: "atjaunot" 53 | updated: "atjaunots" 54 | delete: "dzēst" 55 | deleted: "dzēsts" 56 | -------------------------------------------------------------------------------- /config/locales/rails_admin.pl.yml: -------------------------------------------------------------------------------- 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 | pl: 5 | home: 6 | name: "start" 7 | admin: 8 | dashboard: 9 | pagename: "Panel administracyjny" 10 | name: "Pulpit" 11 | model_name: "Model" 12 | last_used: "Data zmian" 13 | records: "Liczba rekordów" 14 | modify: "Akcja" 15 | add_new: "Dodaj nowy" 16 | show: "pokaż" 17 | ago: "temu" 18 | history: 19 | name: "Historia" 20 | page_name: "Historia zmian modelu %{name}" 21 | no_activity: "Brak zmian" 22 | credentials: 23 | log_out: "Wyloguj się" 24 | list: 25 | edit_action: "Edytuj" 26 | delete_action: "Usuń" 27 | add_new: "Dodaj" 28 | search: "SZUKAJ" 29 | select: "Wybierz %{name} do edycji" 30 | show_all: "Wybierz wszystkie" 31 | new: 32 | basic_info: "Atrybuty" 33 | required: "Wymagane" 34 | optional: "Opcjonalnie" 35 | one_char: "znak." 36 | many_chars: "znaków lub mniej." 37 | chosen: "Wybrane %{name}" 38 | select_choice: "Wybierz kilka i kliknij" 39 | chose_all: "Wybierz wszystkie" 40 | clear_all: "Wyczyść" 41 | save: "Zapisz" 42 | save_and_add_another: "Zapisz i dodaj kolejny" 43 | save_and_edit: "Zapisz i wróć do edycji" 44 | cancel: "Anuluj" 45 | delete: 46 | flash_confirmation: "%{name} zastał usunięty" 47 | confirmation: "Tak, jestem pewien." 48 | flash: 49 | successful: "%{name} został %{action}" 50 | error: "%{name} nie został %{action}" 51 | noaction: "Nie się nie stało" 52 | actions: 53 | create: "dodaj" 54 | created: "dodany" 55 | update: "zapisz" 56 | updated: "zapisany" 57 | delete: "usuń" 58 | deleted: "usunięty" -------------------------------------------------------------------------------- /config/locales/rails_admin.pt-BR.yml: -------------------------------------------------------------------------------- 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 | pt-BR: 5 | home: 6 | name: "início" 7 | admin: 8 | dashboard: 9 | pagename: "Administração do site" 10 | name: "Painel" 11 | model_name: "Nome do model" 12 | last_used: "Última utilização" 13 | records: "Registros" 14 | modify: "Modificar" 15 | add_new: "Adicionar" 16 | show: "Exibir" 17 | ago: "atrás" 18 | history: 19 | name: "Histórico" 20 | page_name: "Histórico de %{name}" 21 | no_activity: "Sem Atividade" 22 | credentials: 23 | log_out: "Desconectar" 24 | list: 25 | edit_action: "Alterar" 26 | delete_action: "Excluir" 27 | add_new: "Adicionar" 28 | search: "BUSCAR" 29 | select: "Selecione %{name} para alterar" 30 | show_all: "Exibir todos" 31 | select_action: "Selecionar" 32 | delete_selected: "Excluir selecionados" 33 | new: 34 | basic_info: "INFORMAÇÕES BÁSICAS" 35 | required: "Obrigatório" 36 | optional: "Opcional" 37 | one_char: "caracter." 38 | many_chars: "caracteres ou menos." 39 | chosen: "Selecionado %{name}" 40 | select_choice: "Selecione sua(s) escolha(s) e clique" 41 | chose_all: "Escolher todos" 42 | clear_all: "Limpar todos" 43 | save: "Gravar" 44 | save_and_add_another: "Gravar e adicionar outro" 45 | save_and_edit: "Gravar e alterar" 46 | cancel: "Cancelar" 47 | delete: 48 | flash_confirmation: "%{name} foi apagado com sucesso" 49 | confirmation: "Sim, com certeza." 50 | flash: 51 | successful: "%{name} foi %{action} com sucesso" 52 | error: "%{name} falhou em %{action}" 53 | noaction: "Não ocorreram ações." 54 | actions: 55 | create: "criar" 56 | created: "criado" 57 | update: "atualizar" 58 | updated: "atualizado" 59 | delete: "excluir" 60 | deleted: "excluído" 61 | -------------------------------------------------------------------------------- /config/locales/rails_admin.pt-PT.yml: -------------------------------------------------------------------------------- 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 | pt-PT: 5 | home: 6 | name: "home" 7 | admin: 8 | dashboard: 9 | pagename: "Administração do site" 10 | name: "Painel" 11 | model_name: "Nome do modelo" 12 | last_used: "Última utilização" 13 | records: "Registos" 14 | modify: "Modificar" 15 | add_new: "Adicionar" 16 | show: "Exibir" 17 | ago: "atrás" 18 | history: 19 | name: "Histórico" 20 | page_name: "Histórico de %{name}" 21 | credentials: 22 | log_out: "Terminar sessão" 23 | list: 24 | edit_action: "Editar" 25 | delete_action: "Remover" 26 | add_new: "Adicionar" 27 | search: "PROCURAR" 28 | select: "Selecione %{name} para editar" 29 | show_all: "Exibir todos" 30 | new: 31 | basic_info: "INFORMAÇÕES BÁSICAS" 32 | required: "Obrigatório" 33 | optional: "Opcional" 34 | one_char: "carácter." 35 | many_chars: "caracteres ou menos." 36 | chosen: "Selecionado %{name}" 37 | select_choice: "Selecione as sua(s) escolha(s) e clique" 38 | chose_all: "Escolher todos" 39 | clear_all: "Limpar todos" 40 | save: "Guardar" 41 | save_and_add_another: "Guardar e adicionar outro" 42 | save_and_edit: "Guardar e editar" 43 | cancel: "Cancelar" 44 | delete: 45 | flash_confirmation: "%{name} foi apagado com sucesso" 46 | confirmation: "Sim, com certeza." 47 | flash: 48 | successful: "Um registo de %{name}, foi %{action} com sucesso" 49 | error: "Um registo de %{name} falhou ao ser %{action}" 50 | noaction: "Nenhuma acção foi executada." 51 | actions: 52 | create: "criar" 53 | created: "criado" 54 | update: "actualizar" 55 | updated: "actualizado" 56 | delete: "remover" 57 | deleted: "removido" -------------------------------------------------------------------------------- /config/locales/rails_admin.ru.yml: -------------------------------------------------------------------------------- 1 | # Russian 2 | 3 | ru: 4 | home: 5 | name: "Главная" 6 | admin: 7 | dashboard: 8 | pagename: "Управление сайтом" 9 | name: "Контрольная панель" 10 | model_name: "Название модели" 11 | last_used: "Последнее раз использовалось" 12 | records: "Записи" 13 | modify: "Изменить" 14 | add_new: "Добавить" 15 | show: "Показать" 16 | ago: "назад" 17 | history: 18 | name: "История" 19 | page_name: "История для %{name}" 20 | no_activity: "Без изменений" 21 | credentials: 22 | log_out: "Выйти" 23 | list: 24 | edit_action: "Редактировать" 25 | delete_action: "Удалить" 26 | select_action: "Выбрать" 27 | delete_selected: "Удалить выбранные" 28 | add_new: "Добавить" 29 | search: "ПОИСК" 30 | select: "Выберите %{name} для редактирования" 31 | show_all: "Показать все" 32 | new: 33 | basic_info: "Основное" 34 | required: "Требуемое" 35 | optional: "Необязательное" 36 | one_char: "символ." 37 | many_chars: "символов или меньше." 38 | chosen: "Выбрано %{name}" 39 | select_choice: "Выберите нужное и кликните" 40 | chose_all: "Выбрать все" 41 | clear_all: "Очистить" 42 | save: "Сохранить" 43 | save_and_add_another: "Сохранить и добавить новый" 44 | save_and_edit: "Сохранить и продолжить редактирование" 45 | cancel: "Отмена" 46 | delete: 47 | flash_confirmation: "%{name} удалено" 48 | confirmation: "Да, я уверен" 49 | flash: 50 | successful: "%{name} был %{action}" 51 | error: "Не получилось %{action} %{name}" 52 | noaction: "Никаких изменений не выполнено" 53 | actions: 54 | create: "создать" 55 | created: "создан" 56 | update: "обновить" 57 | updated: "обновлен" 58 | delete: "удалить" 59 | deleted: "удален" 60 | -------------------------------------------------------------------------------- /config/locales/rails_admin.sv.yml: -------------------------------------------------------------------------------- 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 | sv: 5 | home: 6 | name: "hem" 7 | admin: 8 | dashboard: 9 | pagename: "Administration" 10 | name: "Instrumentpanel" 11 | model_name: "Modellnamn" 12 | last_used: "Senast använd" 13 | records: "Uppgifter" 14 | modify: "Ändra" 15 | add_new: "Lägg till ny" 16 | show: "Visa" 17 | ago: "sedan" 18 | history: 19 | name: "Historik" 20 | page_name: "Historik för %{name}" 21 | no_activity: "Ingen aktivitet" 22 | credentials: 23 | log_out: "Logga ut" 24 | list: 25 | edit_action: "Redigera" 26 | delete_action: "Ta bort" 27 | select_action: "Marker" 28 | delete_selected: "Ta bort markerade" 29 | add_new: "Lägg till ny" 30 | search: "SÖK" 31 | select: "Markera %{name} för att redigera" 32 | show_all: "Visa alla" 33 | new: 34 | basic_info: "Grundläggande information" 35 | required: "Obligatorisk" 36 | optional: "Frivillig" 37 | one_char: "tecken." 38 | many_chars: "tecken eller färre." 39 | chosen: "Valt %{name}" 40 | select_choice: "Välj dina val och klicka" 41 | chose_all: "Välja alla" 42 | clear_all: "Rensa alla" 43 | save: "Spara" 44 | save_and_add_another: "Spara och lägg till ny" 45 | save_and_edit: "Spara och redigera" 46 | cancel: "Avbryt" 47 | delete: 48 | flash_confirmation: "%{name} har förstörts" 49 | confirmation: "Ja, jag är säker" 50 | flash: 51 | successful: "%{name} är %{action}" 52 | error: "lyckades inte %{action} %{name}" 53 | noaction: "Inga åtgärder vidtogs" 54 | actions: 55 | create: "skapa" 56 | created: "skapad" 57 | update: "uppdatera" 58 | updated: "uppdaterad" 59 | delete: "ta bort" 60 | deleted: "borttagen" -------------------------------------------------------------------------------- /config/locales/rails_admin.tr.yml: -------------------------------------------------------------------------------- 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 | tr: 5 | home: 6 | name: "anasayfa" 7 | admin: 8 | dashboard: 9 | pagename: "Site Yönetimi" 10 | name: "Pano" 11 | model_name: "Model adı" 12 | last_used: "Son kullanım" 13 | records: "Kayıtlar" 14 | modify: "Değiştir" 15 | add_new: "Yeni ekle" 16 | show: "Göster" 17 | ago: "önce" 18 | history: 19 | name: "Geçmiş" 20 | page_name: "%{name} geçmişi" 21 | no_activity: "Aktivite yok" 22 | credentials: 23 | log_out: "Çıkış yap" 24 | list: 25 | edit_action: "Düzenle" 26 | delete_action: "Sil" 27 | add_new: "Yeni ekle" 28 | search: "ARA" 29 | select: "Düzenlemek için seçin: %{name}" 30 | show_all: "Hepsini göster" 31 | new: 32 | basic_info: "Kısa bilgi" 33 | required: "Gerekli" 34 | optional: "İsteğe bağlı" 35 | one_char: "karakter." 36 | many_chars: "karakter ya da daha az." 37 | chosen: "Seçilen: %{name}" 38 | select_choice: "Şık veya şıkları seçin ve tıklayın" 39 | chose_all: "Hepsini seç" 40 | clear_all: "Hepsini temizle" 41 | save: "Kaydet" 42 | save_and_add_another: "Kaydet ve başka ekle" 43 | save_and_edit: "Kaydet ve düzenle" 44 | cancel: "İptal et" 45 | delete: 46 | flash_confirmation: "%{name} başarıyla silindi" 47 | confirmation: "Evet, eminim" 48 | flash: 49 | successful: "%{name} başarıyla %{action}" 50 | error: "İşlem gerçekleştirilemedi" 51 | noaction: "Hiçbir işlem yapılmadı." 52 | actions: 53 | create: "yarat" 54 | created: "yaratıldı" 55 | update: "güncelle" 56 | updated: "güncellendi" 57 | delete: "sil" 58 | deleted: "silindi" 59 | -------------------------------------------------------------------------------- /config/locales/rails_admin.uk.yml: -------------------------------------------------------------------------------- 1 | uk: 2 | home: 3 | name: "Домівка" 4 | admin: 5 | dashboard: 6 | pagename: "Адміністрація" 7 | name: "Панель керування" 8 | model_name: "Ім'я моделі" 9 | last_used: "Останній раз використовувалось" 10 | records: "Записи" 11 | modify: "Змінити" 12 | add_new: "Створити" 13 | show: "Детально" 14 | ago: "тому" 15 | history: 16 | name: "Історія" 17 | page_name: "Історія для %{name}" 18 | no_activity: "Пусто" 19 | credentials: 20 | log_out: "Вийти" 21 | list: 22 | edit_action: "Редагувати" 23 | delete_action: "Видалити" 24 | add_new: "Створити" 25 | search: "ПОШУК" 26 | select: "Оберіть %{name} для редагування" 27 | show_all: "Показати все" 28 | new: 29 | basic_info: "Основна інформація" 30 | required: "Необхідно" 31 | optional: "Необов'язково" 32 | one_char: "літера." 33 | many_chars: "літер або менше." 34 | chosen: "Обрано %{name}" 35 | select_choice: "Оберіть один чи декілька і натисніть" 36 | chose_all: "Обрати все" 37 | clear_all: "Очистити все" 38 | save: "Зберегти" 39 | save_and_add_another: "Зберегти і добавити ще" 40 | save_and_edit: "Зберегти і поредагувати" 41 | cancel: "Скасувати" 42 | delete: 43 | flash_confirmation: "%{name} успішно видалено" 44 | confirmation: "Так, я впевнений" 45 | flash: 46 | successful: "%{name} успішно %{action}" 47 | error: "неможливо %{action} %{name}" 48 | noaction: "Нічого не відбувалось" 49 | actions: 50 | create: "створити" 51 | created: "створено" 52 | update: "оновити" 53 | updated: "оновлено" 54 | delete: "видалити" 55 | deleted: "видалено" -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | 3 | # Prefix route urls with "admin" and route names with "rails_admin_" 4 | scope "admin", :module => :rails_admin, :as => "rails_admin" do 5 | # Routes for rails_admin controller 6 | controller "main" do 7 | match "/", :to => :index, :as => "dashboard" 8 | get "/:model_name", :to => :list, :as => "list" 9 | get "/:model_name/new", :to => :new, :as => "new" 10 | match "/:model_name/get_pages", :to => :get_pages, :as => "get_pages" 11 | post "/:model_name", :to => :create, :as => "create" 12 | get "/:model_name/:id/edit", :to => :edit, :as => "edit" 13 | put "/:model_name/:id", :to => :update, :as => "update" 14 | get "/:model_name/:id/delete", :to => :delete, :as => "delete" 15 | delete "/:model_name/:id", :to => :destroy, :as => "destroy" 16 | get "/:model_name/bulk_delete", :to => :bulk_delete, :as => "bulk_delete" 17 | post "/:model_name/bulk_destroy", :to => :bulk_destroy, :as => "bulk_destroy" 18 | end 19 | scope "history", :as => "history" do 20 | controller "history" do 21 | match "/list", :to => :list, :as => "list" 22 | match "/slider", :to => :slider, :as => "slider" 23 | match "/:model_name", :to => :for_model, :as => "model" 24 | match "/:model_name/:id", :to => :for_object, :as => "object" 25 | end 26 | end 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /lib/generators/rails_admin/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Installs RailsAdmin. 3 | 4 | Examples: 5 | `rails generate rails_admin:install_admin` 6 | 7 | Creates locale and migration files: 8 | 9 | Locales: config/locales/rails_admin.XX.yml 10 | Migration: db/migrate/XXX_create_histories_table.rb 11 | 12 | `rails generate rails_admin:install_migrations` 13 | 14 | Only creates the migration file 15 | 16 | Migration: db/migrate/XXX_create_histories_table.rb 17 | 18 | -------------------------------------------------------------------------------- /lib/generators/rails_admin/install_migrations_generator.rb: -------------------------------------------------------------------------------- 1 | require 'rails/generators' 2 | require 'rails/generators/migration' 3 | 4 | module RailsAdmin 5 | class InstallMigrationsGenerator < Rails::Generators::Base 6 | include Rails::Generators::Migration 7 | source_root File.expand_path('../templates', __FILE__) 8 | 9 | def self.next_migration_number(dirname) 10 | if ActiveRecord::Base.timestamped_migrations 11 | migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i 12 | migration_number += 1 13 | migration_number.to_s 14 | else 15 | "%.3d" % (current_migration_number(dirname) + 1) 16 | end 17 | end 18 | 19 | def create_migration_file 20 | migration_template 'migration.rb', 'db/migrate/create_histories_table.rb' rescue p $!.message 21 | sleep 1 # ensure scripts have different timestamps 22 | migration_template 'rename.rb', 'db/migrate/rename_histories_to_rails_admin_histories.rb' 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/generators/rails_admin/rails_admin_generator.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | class RailsAdminGenerator < Rails::Generators::Base 3 | source_root File.expand_path('../templates', __FILE__) 4 | namespace "rails_admin" 5 | 6 | def print_instructions 7 | puts "RailsAdmin! 8 | 9 | Hello, to install rails_admin into your app you need to run: 10 | 11 | rails g rails_admin:install_admin 12 | 13 | By default RailsAdmin works with Devise to provide authentication. If you use 14 | Devise, but want use another model than the default 'user' you can provide the 15 | custom model name as an argument: 16 | 17 | rails g rails_admin:install_admin member 18 | 19 | " 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/generators/rails_admin/templates/migration.rb: -------------------------------------------------------------------------------- 1 | class CreateHistoriesTable < ActiveRecord::Migration 2 | def self.up 3 | create_table :histories do |t| 4 | t.string :message # title, name, or object_id 5 | t.string :username 6 | t.integer :item 7 | t.string :table 8 | t.integer :month, :limit => 2 9 | t.integer :year, :limit => 5 10 | t.timestamps 11 | end 12 | add_index(:histories, [:item, :table, :month, :year]) 13 | end 14 | 15 | def self.down 16 | drop_table :histories 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/generators/rails_admin/templates/rename.rb: -------------------------------------------------------------------------------- 1 | class RenameHistoriesToRailsAdminHistories < ActiveRecord::Migration 2 | def self.up 3 | rename_table :histories, :rails_admin_histories 4 | end 5 | 6 | def self.down 7 | rename_table :rails_admin_histories, :histories 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/rails_admin/abstract_object.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | class AbstractObject 3 | instance_methods.each { |m| undef_method m unless m =~ /(^__|^send$|^object_id$)/ } 4 | 5 | attr_accessor :object 6 | attr_accessor :associations 7 | 8 | def initialize(object) 9 | self.object = object 10 | end 11 | 12 | def attributes=(attributes) 13 | object.send :attributes=, attributes, false 14 | end 15 | 16 | def method_missing(name, *args, &block) 17 | self.object.send name, *args, &block 18 | end 19 | 20 | def save(options = { :validate => true }) 21 | object.save(options) and update_all_associations 22 | end 23 | 24 | protected 25 | 26 | def update_all_associations 27 | return true if associations.nil? 28 | 29 | abstract_model = AbstractModel.new(object.class) 30 | 31 | abstract_model.associations.each do |association| 32 | if associations.has_key?(association[:name]) 33 | ids = associations[association[:name]] 34 | begin 35 | case association[:type] 36 | when :has_one 37 | update_association(association, ids) 38 | when :has_many, :has_and_belongs_to_many 39 | update_associations(association, ids.to_a) 40 | end 41 | rescue Exception => e 42 | object.errors.add association[:name], e.to_s 43 | return false 44 | end 45 | end 46 | end 47 | end 48 | 49 | def update_associations(association, ids = []) 50 | associated_model = RailsAdmin::AbstractModel.new(association[:child_model]) 51 | object.send "#{association[:name]}=", ids.collect{|id| associated_model.get(id)}.compact 52 | object.save 53 | end 54 | 55 | def update_association(association, id = nil) 56 | associated_model = RailsAdmin::AbstractModel.new(association[:child_model]) 57 | if associated = associated_model.get(id) 58 | associated.update_attributes(association[:child_key].first => object.id) 59 | end 60 | end 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/association.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config' 2 | require 'rails_admin/config/fields/base' 3 | 4 | module RailsAdmin 5 | module Config 6 | module Fields 7 | class Association < RailsAdmin::Config::Fields::Base 8 | 9 | def self.inherited(klass) 10 | klass.instance_variable_set("@searchable", false) 11 | klass.instance_variable_set("@sortable", false) 12 | super(klass) 13 | end 14 | 15 | # Reader for the association information hash 16 | def association 17 | @properties 18 | end 19 | 20 | # Accessor whether association is visible or not. By default 21 | # association checks whether the child model is excluded in 22 | # configuration or not. 23 | register_instance_option(:visible?) do 24 | !associated_model_config.excluded? 25 | end 26 | 27 | # Reader for a collection of association's child models in an array of 28 | # [label, id] arrays. 29 | def associated_collection 30 | associated_model_config.abstract_model.all.map do |object| 31 | [associated_model_config.list.with(:object => object).object_label, object.id] 32 | end 33 | end 34 | 35 | # Reader for the association's child model's configuration 36 | def associated_model_config 37 | @associated_model_config ||= RailsAdmin.config(association[:child_model]) 38 | end 39 | 40 | # Reader for the association's child key 41 | def child_key 42 | association[:child_key].first 43 | end 44 | 45 | # Reader for the association's child key array 46 | def child_keys 47 | association[:child_key] 48 | end 49 | 50 | # Reader for validation errors of the bound object 51 | def errors 52 | bindings[:object].errors[child_key] 53 | end 54 | 55 | # Reader whether the bound object has validation errors 56 | def has_errors? 57 | !(bindings[:object].errors[child_key].nil? || bindings[:object].errors[child_key].empty?) 58 | end 59 | 60 | # Reader for the association's value unformatted 61 | def value 62 | bindings[:object].send(association[:name]) 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/factories/devise.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields' 2 | require 'rails_admin/config/fields/types' 3 | require 'rails_admin/config/fields/types/password' 4 | require 'rails_admin/config/sections/update' 5 | 6 | # Register a custom field factory for devise model if Devise is defined 7 | if defined?(::Devise) 8 | RailsAdmin::Config::Fields.register_factory do |parent, properties, fields| 9 | if :encrypted_password == properties[:name] 10 | fields << RailsAdmin::Config::Fields::Types.load(:password).new(parent, :password, properties) 11 | fields.last.label "Password" 12 | fields << RailsAdmin::Config::Fields::Types.load(:password).new(parent, :password_confirmation, properties) 13 | fields.last.instance_eval do 14 | label "Password confirmation" 15 | help "Retype password" 16 | end 17 | [:password_salt, :reset_password_token, :remember_token].each do |name| 18 | properties = parent.abstract_model.properties.find {|p| name == p[:name]} 19 | if properties 20 | RailsAdmin::Config::Fields.default_factory.call(parent, properties, fields) 21 | fields.last.hide 22 | end 23 | end 24 | if parent.kind_of?(RailsAdmin::Config::Sections::Update) 25 | [:remember_created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip].each do |name| 26 | properties = parent.abstract_model.properties.find {|p| name == p[:name]} 27 | if properties 28 | RailsAdmin::Config::Fields.default_factory.call(parent, properties, fields) 29 | fields.last.hide 30 | end 31 | end 32 | end 33 | true 34 | else 35 | false 36 | end 37 | end 38 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/factories/paperclip.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields' 2 | require 'rails_admin/config/fields/types' 3 | require 'rails_admin/config/fields/types/file_upload' 4 | 5 | # Register a custom field factory 6 | RailsAdmin::Config::Fields.register_factory do |parent, properties, fields| 7 | paperclip_columns = [:file_name, :content_type, :file_size, :updated_at] 8 | model = parent.abstract_model.model 9 | if defined?(::Paperclip) and model.kind_of?(Paperclip::ClassMethods) 10 | if part = paperclip_columns.detect {|it| properties[:name].to_s.strip =~ /^(.+)_#{it}$/ } 11 | attachment_name = properties[:name].to_s.scan(/^(.+)_#{part}$/).first.first.to_sym 12 | if model.attachment_definitions && model.attachment_definitions.has_key?(attachment_name) && fields.find{|f| attachment_name == f.name}.nil? 13 | paperclip_columns.each do |it| 14 | if props = parent.abstract_model.properties.find {|p| "#{attachment_name}_#{it}" == p[:name].to_s } 15 | RailsAdmin::Config::Fields.default_factory.call(parent, props, fields) 16 | fields.last.hide 17 | end 18 | end 19 | fields << RailsAdmin::Config::Fields::Types::PaperclipFile.new(parent, attachment_name, properties) 20 | true 21 | end 22 | end 23 | else 24 | false 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/factories/password.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields' 2 | require 'rails_admin/config/fields/types/password' 3 | 4 | # Register a custom field factory for properties named as password. More property 5 | # names can be registered in RailsAdmin::Config::Fields::Password.column_names 6 | # array. 7 | # 8 | # @see RailsAdmin::Config::Fields::Types::Password.column_names 9 | # @see RailsAdmin::Config::Fields.register_factory 10 | RailsAdmin::Config::Fields.register_factory do |parent, properties, fields| 11 | if RailsAdmin::Config::Fields::Types::Password.column_names.include?(properties[:name]) 12 | fields << RailsAdmin::Config::Fields::Types::Password.new(parent, properties[:name], properties) 13 | true 14 | else 15 | false 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/group.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/string/inflections' 2 | require 'rails_admin/config/hideable' 3 | 4 | module RailsAdmin 5 | module Config 6 | module Fields 7 | # A container for groups of fields in edit views 8 | class Group < RailsAdmin::Config::Base 9 | include RailsAdmin::Config::Hideable 10 | 11 | attr_reader :name 12 | 13 | def initialize(parent, name) 14 | super(parent) 15 | @name = name 16 | end 17 | 18 | # Defines a configuration for a field by proxying parent's field method 19 | # and setting the field's group as self 20 | # 21 | # @see RailsAdmin::Config::Fields.field 22 | def field(name, type = nil, &block) 23 | field = parent.field(name, type, &block) 24 | # Directly manipulate the variable instead of using the accessor 25 | # as group probably is not yet registered to the parent object. 26 | field.instance_variable_set("@group", self) 27 | field 28 | end 29 | 30 | # Reader for fields attached to this group 31 | def fields 32 | parent.fields.select {|f| self == f.group } 33 | end 34 | 35 | # Defines configuration for fields by their type 36 | # 37 | # @see RailsAdmin::Config::Fields.fields_of_type 38 | def fields_of_type(type, &block) 39 | selected = fields.select {|f| type == f.type } 40 | if block 41 | selected.each {|f| f.instance_eval &block } 42 | end 43 | selected 44 | end 45 | 46 | # Reader for fields that are marked as visible 47 | def visible_fields 48 | fields.select {|f| f.visible? } 49 | end 50 | 51 | # Configurable group label which by default is group's name humanized. 52 | register_instance_option(:label) do 53 | name.to_s.humanize 54 | end 55 | end 56 | end 57 | end 58 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/groupable.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/group' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Groupable 7 | # Register a group instance variable and accessor methods for objects 8 | # extending the has groups mixin. The extended objects must implement 9 | # reader for a parent object which includes this module. 10 | # 11 | # @see RailsAdmin::Config::HasGroups.group 12 | # @see RailsAdmin::Config::Fields::Group 13 | def self.extended(obj) 14 | obj.instance_variable_set("@group", obj.parent.group(:default)) 15 | class << obj 16 | def group(name = nil) 17 | @group = parent.group(name) unless name.nil? 18 | @group 19 | end 20 | end 21 | end 22 | end 23 | end 24 | end 25 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/string/inflections' 2 | require 'rails_admin/config/fields' 3 | 4 | module RailsAdmin 5 | module Config 6 | module Fields 7 | module Types 8 | @@registry = {} 9 | 10 | def self.load(type) 11 | @@registry[type.to_sym] or raise "Unsupported field datatype: #{type}" 12 | end 13 | 14 | def self.register(type, klass = nil) 15 | if klass == nil && type.kind_of?(Class) 16 | klass = type 17 | type = klass.name.to_s.demodulize.underscore 18 | end 19 | @@registry[type.to_sym] = klass 20 | end 21 | 22 | require 'rails_admin/config/fields/types/all' 23 | end 24 | end 25 | end 26 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/all.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/types/belongs_to_association' 2 | require 'rails_admin/config/fields/types/boolean' 3 | require 'rails_admin/config/fields/types/date' 4 | require 'rails_admin/config/fields/types/datetime' 5 | require 'rails_admin/config/fields/types/decimal' 6 | require 'rails_admin/config/fields/types/file_upload' 7 | require 'rails_admin/config/fields/types/paperclip_file' 8 | require 'rails_admin/config/fields/types/float' 9 | require 'rails_admin/config/fields/types/has_and_belongs_to_many_association' 10 | require 'rails_admin/config/fields/types/has_many_association' 11 | require 'rails_admin/config/fields/types/has_one_association' 12 | require 'rails_admin/config/fields/types/integer' 13 | require 'rails_admin/config/fields/types/password' 14 | require 'rails_admin/config/fields/types/string' 15 | require 'rails_admin/config/fields/types/text' 16 | require 'rails_admin/config/fields/types/time' 17 | require 'rails_admin/config/fields/types/timestamp' 18 | require 'rails_admin/config/fields/types/virtual' 19 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/belongs_to_association.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/association' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class BelongsToAssociation < RailsAdmin::Config::Fields::Association 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | attr_reader :association 12 | 13 | def initialize(parent, name, properties, association) 14 | super(parent, name, properties) 15 | @association = association 16 | end 17 | 18 | # Accessor for field's formatted value 19 | register_instance_option(:formatted_value) do 20 | object = bindings[:object].send(association[:name]) 21 | unless object.nil? 22 | RailsAdmin::Config.model(object).list.with(:object => object).object_label 23 | else 24 | nil 25 | end 26 | end 27 | 28 | def associated_collection 29 | associated_model_config.abstract_model.all.map do |object| 30 | [associated_model_config.list.with(:object => object).object_label, object.id] 31 | end 32 | end 33 | 34 | def associated_model_config 35 | @associated_model_config ||= RailsAdmin.config(association[:parent_model]) 36 | end 37 | 38 | # Reader for field's value 39 | def value 40 | bindings[:object].send(name) 41 | end 42 | end 43 | end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/boolean.rb: -------------------------------------------------------------------------------- 1 | require 'builder' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Boolean < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | register_instance_option(:formatted_value) do 12 | if value == true 13 | Builder::XmlMarkup.new.img(:src => bindings[:view].image_path("rails_admin/bullet_black.png"), :alt => "True").html_safe 14 | else 15 | Builder::XmlMarkup.new.img(:src => bindings[:view].image_path("rails_admin/bullet_white.png"), :alt => "False").html_safe 16 | end 17 | end 18 | 19 | # Accessor for field's help text displayed below input field. 20 | register_instance_option(:help) do 21 | "" 22 | end 23 | end 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/date.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/types/datetime' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Date < RailsAdmin::Config::Fields::Types::Datetime 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | end 11 | end 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/datetime.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Datetime < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | register_instance_option(:date_format) do 12 | :long 13 | end 14 | 15 | register_instance_option(:formatted_value) do 16 | unless (time = value).nil? 17 | unless format = strftime_format 18 | I18n.l(time, :format => date_format, :default => I18n.l(time, :format => date_format, :locale => :en)) 19 | else 20 | time.strftime(format) 21 | end 22 | else 23 | "".html_safe 24 | end 25 | end 26 | 27 | register_instance_option(:strftime_format) do 28 | false 29 | end 30 | end 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/decimal.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Decimal < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | register_instance_option(:partial) do 12 | "float" 13 | end 14 | end 15 | end 16 | end 17 | end 18 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/file_upload.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/types/string' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class FileUpload < RailsAdmin::Config::Fields::Types::String 8 | 9 | @searchable = true 10 | 11 | # Register field type for the type loader 12 | RailsAdmin::Config::Fields::Types::register(self) 13 | 14 | register_instance_option(:help) do 15 | required? ? I18n.translate("admin.new.required") : I18n.translate("admin.new.optional") 16 | end 17 | end 18 | end 19 | end 20 | end 21 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/float.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Float < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | end 11 | end 12 | end 13 | end 14 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/has_and_belongs_to_many_association.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/association' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class HasAndBelongsToManyAssociation < RailsAdmin::Config::Fields::Association 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | # Accessor for field's help text displayed below input field. 12 | register_instance_option(:help) do 13 | "" 14 | end 15 | end 16 | end 17 | end 18 | end 19 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/has_many_association.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/association' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class HasManyAssociation < RailsAdmin::Config::Fields::Association 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | # Accessor for field's help text displayed below input field. 12 | register_instance_option(:help) do 13 | "" 14 | end 15 | end 16 | end 17 | end 18 | end 19 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/has_one_association.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/association' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class HasOneAssociation < RailsAdmin::Config::Fields::Association 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | # Accessor for whether this is field is required. In this 12 | # case the field is "virtual" to this table - it actually 13 | # lives in the table on the "belongs_to" side of this 14 | # relation. 15 | # 16 | # @see RailsAdmin::AbstractModel.properties 17 | register_instance_option(:required?) do 18 | false 19 | end 20 | end 21 | end 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/integer.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Integer < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | register_instance_option(:css_class) do 12 | serial? ? "id" : "integer" 13 | end 14 | end 15 | end 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/paperclip_file.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | require 'rails_admin/config/fields/types/file_upload' 3 | 4 | module RailsAdmin 5 | module Config 6 | module Fields 7 | module Types 8 | # Field type that supports Paperclip file uploads 9 | class PaperclipFile < RailsAdmin::Config::Fields::Types::FileUpload 10 | RailsAdmin::Config::Fields::Types.register(self) 11 | end 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/password.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields' 2 | require 'rails_admin/config/sections/list' 3 | require 'rails_admin/config/fields/types/string' 4 | 5 | module RailsAdmin 6 | module Config 7 | module Fields 8 | module Types 9 | class Password < RailsAdmin::Config::Fields::Types::String 10 | # Register field type for the type loader 11 | RailsAdmin::Config::Fields::Types::register(self) 12 | 13 | @column_names = [:password] 14 | @sortable = false 15 | 16 | def self.column_names 17 | @column_names 18 | end 19 | 20 | def initialize(parent, name, properties) 21 | super(parent, name, properties) 22 | hide if parent.kind_of?(RailsAdmin::Config::Sections::List) 23 | end 24 | 25 | register_instance_option(:formatted_value) do 26 | "".html_safe 27 | end 28 | 29 | # Password field's value does not need to be read 30 | def value 31 | "" 32 | end 33 | end 34 | end 35 | end 36 | end 37 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/string.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class String < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | @searchable = true 12 | 13 | register_instance_option(:help) do 14 | text = required? ? I18n.translate("admin.new.required") : I18n.translate("admin.new.optional") 15 | text += " #{length} " 16 | text += length == 1 ? I18n.translate("admin.new.one_char") : I18n.translate("admin.new.many_chars") 17 | text 18 | end 19 | 20 | register_instance_option(:color) do 21 | false 22 | end 23 | end 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/text.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Text < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | @searchable = true 12 | 13 | # CKEditor is disabled by default 14 | register_instance_option(:ckeditor) do 15 | false 16 | end 17 | 18 | # If you want to have a different toolbar configuration for CKEditor 19 | # create your own custom config.js and override this configuration 20 | register_instance_option(:ckeditor_config_js) do 21 | "/javascripts/ckeditor/config.js" 22 | end 23 | end 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/time.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/base' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Time < RailsAdmin::Config::Fields::Base 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | 11 | register_instance_option(:formatted_value) do 12 | unless (time = value).nil? 13 | time.strftime(strftime_format) 14 | else 15 | "".html_safe 16 | end 17 | end 18 | 19 | register_instance_option(:strftime_format) do 20 | "%I:%M%p" 21 | end 22 | end 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/timestamp.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/types/datetime' 2 | 3 | module RailsAdmin 4 | module Config 5 | module Fields 6 | module Types 7 | class Timestamp < RailsAdmin::Config::Fields::Types::Datetime 8 | # Register field type for the type loader 9 | RailsAdmin::Config::Fields::Types::register(self) 10 | end 11 | end 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/rails_admin/config/fields/types/virtual.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/string/inflections' 2 | require 'rails_admin/config/fields/base' 3 | 4 | module RailsAdmin 5 | module Config 6 | module Fields 7 | module Types 8 | # Virtual field class provides behaviour for columns that are 9 | # calculated at runtime for example record object methods. 10 | class Virtual < RailsAdmin::Config::Fields::Base 11 | # Register field type for the type loader 12 | RailsAdmin::Config::Fields::Types::register(self) 13 | 14 | @sortable = false 15 | 16 | # Accessor for field's label. 17 | register_instance_option(:label) do 18 | name.to_s.humanize 19 | end 20 | 21 | # Accessor for field's maximum length. 22 | register_instance_option(:length) do 23 | 100 24 | end 25 | 26 | # Reader for whether this is field is mandatory. 27 | register_instance_option(:required?) do 28 | false 29 | end 30 | 31 | # Reader for whether this is a serial field (aka. primary key, identifier). 32 | register_instance_option(:serial?) do 33 | false 34 | end 35 | end 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/rails_admin/config/has_fields.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | module Config 3 | # Provides accessors and autoregistering of model's fields. 4 | module HasFields 5 | # Defines a configuration for a field. 6 | def field(name, type = nil, &block) 7 | field = @fields.find {|f| name == f.name } 8 | # Specify field as virtual if type is not specifically set and field was not 9 | # found in default stack 10 | if field.nil? && type.nil? 11 | field = (@fields << RailsAdmin::Config::Fields::Types.load(:virtual).new(self, name, {})).last 12 | # Register a custom field type if one is provided and it is different from 13 | # one found in default stack 14 | elsif !type.nil? && type != (field.nil? ? nil : field.type) 15 | @fields.delete(field) unless field.nil? 16 | properties = parent.abstract_model.properties.find {|p| name == p[:name] } 17 | field = (@fields << RailsAdmin::Config::Fields::Types.load(type).new(self, name, properties)).last 18 | end 19 | # If field has not been yet defined add some default properties 20 | unless field.defined 21 | field.defined = true 22 | field.order = @fields.select {|f| f.defined }.length 23 | # field.hide 24 | end 25 | # If a block has been given evaluate it and sort fields after that 26 | if block 27 | field.instance_eval &block 28 | @fields.sort! {|a, b| a.order <=> b.order } 29 | end 30 | field 31 | end 32 | 33 | # Returns all field configurations for the model configuration instance. If no fields 34 | # have been defined returns all fields. Defined fields are sorted to match their 35 | # order property. If order was not specified it will match the order in which fields 36 | # were defined. 37 | def fields 38 | defined = @fields.select {|f| f.defined } 39 | defined.sort! {|a, b| a.order <=> b.order } 40 | defined = @fields if defined.empty? 41 | defined 42 | end 43 | 44 | # Defines configuration for fields by their type. 45 | def fields_of_type(type, &block) 46 | selected = @fields.select {|f| type == f.type } 47 | if block 48 | selected.each {|f| f.instance_eval &block } 49 | end 50 | selected 51 | end 52 | 53 | # Get all fields defined as visible. 54 | def visible_fields 55 | fields.select {|f| f.visible? } 56 | end 57 | end 58 | end 59 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/has_groups.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/fields/group' 2 | 3 | module RailsAdmin 4 | module Config 5 | module HasGroups 6 | # Access fields by their group 7 | def fields_of_group(group, &block) 8 | selected = @fields.select {|f| group == f.group } 9 | if block 10 | selected.each {|f| f.instance_eval &block } 11 | end 12 | selected 13 | end 14 | 15 | # Accessor for a group 16 | # 17 | # If group with given name does not yet exist it will be created. If a 18 | # block is passed it will be evaluated in the context of the group 19 | def group(name, &block) 20 | group = @groups.find {|g| name == g.name } 21 | if group.nil? 22 | group = (@groups << RailsAdmin::Config::Fields::Group.new(self, name)).last 23 | end 24 | group.instance_eval &block if block 25 | group 26 | end 27 | 28 | # Reader for groups 29 | def groups 30 | @groups 31 | end 32 | 33 | # Reader for groups that are marked as visible 34 | def visible_groups 35 | groups.select {|g| g.visible? } 36 | end 37 | end 38 | end 39 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/hideable.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | module Config 3 | # Defines a visibility configuration 4 | module Hideable 5 | # Visibility defaults to true. 6 | def self.included(klass) 7 | klass.register_instance_option(:visible?) do 8 | !root.excluded? 9 | end 10 | end 11 | 12 | # Reader whether field is hidden. 13 | def hidden? 14 | not visible 15 | end 16 | 17 | # Writer to hide field. 18 | def hide(&block) 19 | visible block ? proc { false == (instance_eval &block) } : false 20 | end 21 | 22 | # Writer to show field. 23 | def show(&block) 24 | visible block || true 25 | end 26 | end 27 | end 28 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/labelable.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | module Config 3 | # Defines a generic label/name/title configuration 4 | module Labelable 5 | # Try to find a user-friendly label for an object, falling back 6 | # to its class and ID. 7 | def self.object_label(object) 8 | Config.label_methods.each {|l| label = (object.respond_to? l and object.send l) and return label} 9 | "#{object.class.to_s} ##{object.try :id}" 10 | end 11 | 12 | def self.included(klass) 13 | klass.register_instance_option(:label) do 14 | abstract_model.model.model_name.human(:default => abstract_model.model.model_name.titleize) 15 | end 16 | klass.register_instance_option(:object_label) {Labelable.object_label bindings[:object]} 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/rails_admin/config/model.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config' 2 | require 'rails_admin/config/base' 3 | require 'rails_admin/config/sections' 4 | 5 | module RailsAdmin 6 | module Config 7 | # Model specific configuration object. 8 | class Model < RailsAdmin::Config::Base 9 | include RailsAdmin::Config::Sections 10 | 11 | def initialize(entity) 12 | @abstract_model = begin 13 | if entity.kind_of?(RailsAdmin::AbstractModel) 14 | entity 15 | elsif entity.kind_of?(Class) || entity.kind_of?(String) || entity.kind_of?(Symbol) 16 | RailsAdmin::AbstractModel.new(entity) 17 | else 18 | RailsAdmin::AbstractModel.new(entity.class) 19 | end 20 | end 21 | @bindings = {} 22 | @parent = nil 23 | @root = self 24 | end 25 | 26 | def excluded? 27 | @excluded ||= !RailsAdmin::Config.excluded_models.find {|klass| klass.to_s == abstract_model.model.name }.nil? 28 | end 29 | 30 | # Configure create and update views as a bulk operation with given block 31 | # or get update view's configuration if no block is given 32 | def edit(&block) 33 | return send(:update) unless block_given? 34 | [:create, :update].each do |s| 35 | send(s, &block) 36 | end 37 | end 38 | 39 | # Act as a proxy for the section configurations that actually 40 | # store the configurations. 41 | def method_missing(m, *args, &block) 42 | responded_to = false 43 | [:create, :list, :navigation, :update].each do |s| 44 | section = send(s) 45 | if section.respond_to?(m) 46 | responded_to = true 47 | section.send(m, *args, &block) 48 | end 49 | end 50 | raise NoMethodError.new("#{self} has no method #{m}") unless responded_to 51 | end 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /lib/rails_admin/config/proxy.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | module Config 3 | class Proxy 4 | 5 | instance_methods.each {|m| undef_method m unless m =~ /^(__|instance_eval|object_id)/ } 6 | 7 | attr_reader :bindings 8 | 9 | def initialize(object, bindings = {}) 10 | @object = object 11 | @bindings = bindings 12 | end 13 | 14 | # Bind variables to be used by the configuration options 15 | def bind(key, value = nil) 16 | if key.kind_of?(Hash) 17 | @bindings = key 18 | else 19 | @bindings[key] = value 20 | end 21 | self 22 | end 23 | 24 | def method_missing(name, *args, &block) 25 | if @object.respond_to?(name) 26 | reset = @object.instance_variable_get("@bindings") 27 | begin 28 | @object.instance_variable_set("@bindings", @bindings) 29 | response = @object.__send__(name, *args, &block) 30 | ensure 31 | @object.instance_variable_set("@bindings", @reset) 32 | end 33 | response 34 | else 35 | super(name, *args, &block) 36 | end 37 | end 38 | end 39 | end 40 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/sections.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/string/inflections' 2 | require 'rails_admin/config/sections/create' 3 | require 'rails_admin/config/sections/list' 4 | require 'rails_admin/config/sections/navigation' 5 | require 'rails_admin/config/sections/update' 6 | 7 | module RailsAdmin 8 | module Config 9 | # Sections describe different views in the RailsAdmin engine. Configurable sections are 10 | # list and navigation. 11 | # 12 | # Each section's class object can store generic configuration about that section (such as the 13 | # number of visible tabs in the main navigation), while the instances (accessed via model 14 | # configuration objects) store model specific configuration (such as the label of the 15 | # model to be used as the title in the main navigation tabs). 16 | module Sections 17 | def self.included(klass) 18 | # Register accessors for all the sections in this namespace 19 | constants.each do |name| 20 | section = "RailsAdmin::Config::Sections::#{name}".constantize 21 | name = name.to_s.downcase.to_sym 22 | klass.send(:define_method, name) do |&block| 23 | @sections = {} unless @sections 24 | unless @sections[name] 25 | @sections[name] = section.new(self) 26 | end 27 | @sections[name].instance_eval &block if block 28 | @sections[name] 29 | end 30 | # Register a shortcut to define the model's label for each section. 31 | klass.send(:define_method, "label_for_#{name}") do |*args, &block| 32 | send(name).label(block ? block : args[0]) 33 | end 34 | # Register a shortcut to hide the model for each section. 35 | # NOTE: "hide_in_" is deprecated, use "hide_from_" instead. 36 | # FIXME: remove this after giving people an appropriate time 37 | # to change their code. 38 | klass.send(:define_method, "hide_in_#{name}") do |&block| 39 | send(name).visible(block ? proc { false == (instance_eval &block) } : false) 40 | end 41 | # Register a shortcut to hide the model for each section. 42 | klass.send(:define_method, "hide_from_#{name}") do |&block| 43 | send(name).visible(block ? proc { false == (instance_eval &block) } : false) 44 | end 45 | # Register a shortcut to show the model for each section. 46 | klass.send(:define_method, "show_in_#{name}") do |&block| 47 | send(name).visible(block || true) 48 | end 49 | end 50 | end 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /lib/rails_admin/config/sections/create.rb: -------------------------------------------------------------------------------- 1 | require "rails_admin/config/sections/update" 2 | 3 | module RailsAdmin 4 | module Config 5 | module Sections 6 | # Configuration of the edit view for a new object 7 | class Create < RailsAdmin::Config::Sections::Update 8 | end 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/sections/list.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/base' 2 | require 'rails_admin/config/hideable' 3 | require 'rails_admin/config/labelable' 4 | require 'rails_admin/config/fields' 5 | require 'rails_admin/config/has_fields' 6 | 7 | module RailsAdmin 8 | module Config 9 | module Sections 10 | # Configuration of the list view 11 | class List < RailsAdmin::Config::Base 12 | include RailsAdmin::Config::HasFields 13 | include RailsAdmin::Config::Hideable 14 | include RailsAdmin::Config::Labelable 15 | 16 | def initialize(parent) 17 | super(parent) 18 | # Populate @fields instance variable with model's properties 19 | @fields = RailsAdmin::Config::Fields.factory(self) 20 | @fields.each do |f| 21 | if f.association? && f.type != :belongs_to_association 22 | f.hide 23 | end 24 | end 25 | end 26 | 27 | # Default items per page value used if a model level option has not 28 | # been configured 29 | cattr_accessor :default_items_per_page 30 | @@default_items_per_page = 20 31 | 32 | # Number of items listed per page 33 | register_instance_option(:items_per_page) do 34 | RailsAdmin::Config::Sections::List.default_items_per_page 35 | end 36 | 37 | register_instance_option(:sort_by) do 38 | # TODO 39 | # Once composite-primary-keys branch is merged 40 | # we should use parent.abstract_model.primary_keys.first as the default 41 | :id 42 | end 43 | 44 | register_instance_option(:sort_reverse?) do 45 | true # By default show latest first 46 | end 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/rails_admin/config/sections/navigation.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/base' 2 | require 'rails_admin/config/hideable' 3 | require 'rails_admin/config/labelable' 4 | 5 | module RailsAdmin 6 | module Config 7 | module Sections 8 | # Configuration of the navigation view 9 | class Navigation < RailsAdmin::Config::Base 10 | include RailsAdmin::Config::Hideable 11 | include RailsAdmin::Config::Labelable 12 | 13 | # Defines the number of tabs to be renderer in the main navigation. 14 | # Rest of the links will be rendered to a drop down menu. 15 | register_class_option(:max_visible_tabs) do 16 | 5 17 | end 18 | 19 | # Get all models that are configured as visible sorted by their label. 20 | # 21 | # @see RailsAdmin::Config::Hideable 22 | def self.visible_models 23 | RailsAdmin::Config.models.select {|m| m.navigation.visible? }.sort do |a, b| 24 | a.navigation.label.downcase <=> b.navigation.label.downcase 25 | end 26 | end 27 | end 28 | end 29 | end 30 | end -------------------------------------------------------------------------------- /lib/rails_admin/config/sections/update.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/config/base' 2 | require 'rails_admin/config/hideable' 3 | require 'rails_admin/config/labelable' 4 | require 'rails_admin/config/fields' 5 | require 'rails_admin/config/has_fields' 6 | require 'rails_admin/config/has_groups' 7 | require 'rails_admin/config/fields/group' 8 | 9 | module RailsAdmin 10 | module Config 11 | module Sections 12 | # Configuration of the edit view for an existing object 13 | class Update < RailsAdmin::Config::Base 14 | include RailsAdmin::Config::HasFields 15 | include RailsAdmin::Config::HasGroups 16 | include RailsAdmin::Config::Hideable 17 | include RailsAdmin::Config::Labelable 18 | 19 | # Default items per page value used if a model level option has not 20 | # been configured 21 | cattr_accessor :default_hidden_fields 22 | @@default_hidden_fields = [:id, :created_at, :created_on, :deleted_at, :updated_at, :updated_on, :deleted_on] 23 | 24 | def initialize(parent) 25 | super(parent) 26 | # Populate @fields instance variable with model's properties 27 | @groups = [ RailsAdmin::Config::Fields::Group.new(self, :default) ] 28 | @groups.first.label do 29 | I18n.translate("admin.new.basic_info") 30 | end 31 | @fields = RailsAdmin::Config::Fields.factory(self) 32 | @fields.each do |f| 33 | if f.association? && f.type != :belongs_to_association 34 | f.group f.label.to_sym 35 | else 36 | f.group :default 37 | end 38 | if f.serial? || @@default_hidden_fields.include?(f.name) 39 | f.hide 40 | end 41 | end 42 | end 43 | end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /lib/rails_admin/engine.rb: -------------------------------------------------------------------------------- 1 | require "rails_admin" 2 | require "rails" 3 | 4 | module RailsAdmin 5 | class Engine < Rails::Engine 6 | initializer "static assets" do |app| 7 | if app.config.serve_static_assets 8 | app.middleware.insert 0, ::ActionDispatch::Static, "#{root}/public" 9 | end 10 | end 11 | 12 | rake_tasks do 13 | load "rails_admin/railties/tasks.rake" 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/rails_admin/generic_support.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/string/inflections' 2 | module RailsAdmin 3 | class AbstractModel 4 | module GenericSupport 5 | def to_param 6 | parts = model.to_s.split("::") 7 | parts.map{|x| x == parts.last ? x.underscore.pluralize : x.underscore}.join("::") 8 | end 9 | 10 | def pretty_name 11 | model.to_s 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/rails_admin/railties/extratasks.rb: -------------------------------------------------------------------------------- 1 | require 'rails_admin/abstract_model' 2 | require 'active_record' 3 | 4 | module RailsAdmin 5 | 6 | class ExtraTasks 7 | def self.populateDatabase 8 | self.require_model 9 | 10 | max_history_times = 20 11 | history_months = 24 12 | 13 | current_month = Time.now.month 14 | current_year = Time.now.year 15 | 16 | history_months.times do |t| 17 | history_entries = rand(max_history_times) 18 | 19 | computed_date = t.month.ago 20 | 21 | action_type = rand(3) + 1 22 | 23 | history_entries.times do |t| 24 | History.create(:action => action_type, 25 | :month => computed_date.month, 26 | :year => computed_date.year, 27 | :user_id => 1, :table => "Posts", :other => "something interesting!") 28 | end 29 | end 30 | 31 | end 32 | 33 | def self.require_model 34 | @models = [] 35 | model_path = __FILE__ 36 | model_path = model_path.split("/")[0..-5].join("/") 37 | model_path += "/app/models/history.rb" 38 | require model_path 39 | 40 | self.set_connection 41 | end 42 | 43 | def self.set_connection 44 | dbconfig = YAML::load(File.open(Rails.root.join("config/database.yml"))) 45 | ActiveRecord::Base.establish_connection(dbconfig["development"]) 46 | end 47 | 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/rails_admin/railties/tasks.rake: -------------------------------------------------------------------------------- 1 | require 'rails_admin/railties/extratasks' 2 | require 'pp' 3 | 4 | namespace :admin do 5 | desc "Populate history tabel with a year of data" 6 | task :populate_history do 7 | RailsAdmin::ExtraTasks.populateDatabase 8 | end 9 | 10 | desc "Populate history tabel with a year of data" 11 | task :populate_database do 12 | system("rails generate dummy:data --base-amount 60 --growth-ratio 1.5") 13 | Rake::Task["dummy:data:import"].reenable 14 | Rake::Task["dummy:data:import"].invoke 15 | end 16 | 17 | desc "Copy assets files - javascripts, stylesheets and images" 18 | task :copy_assets do 19 | require 'rails/generators/base' 20 | origin = File.join(RailsAdmin::Engine.root, "public") 21 | destination = File.join(Rails.root, "public") 22 | Rails::Generators::Base.source_root(origin) 23 | copier = Rails::Generators::Base.new 24 | %w( stylesheets images javascripts ).each do |directory| 25 | Dir[File.join(origin,directory,'rails_admin','**/*')].each do |file| 26 | relative = file.gsub(/^#{origin}\//, '') 27 | dest_file = File.join(destination, relative) 28 | dest_dir = File.dirname(dest_file) 29 | 30 | if !File.exist?(dest_dir) 31 | FileUtils.mkdir_p(dest_dir) 32 | end 33 | 34 | copier.copy_file(file, dest_file) unless File.directory?(file) 35 | end 36 | end 37 | end 38 | 39 | desc "Prepare Continuous Integration environment" 40 | task :prepare_ci_env do 41 | 42 | adapter = ENV["CI_DB_ADAPTER"] || "sqlite3" 43 | database = ENV["CI_DB_DATABASE"] || ("sqlite3" == adapter ? "db/development.sqlite3" : "ci_rails_admin") 44 | 45 | configuration = { 46 | "test" => { 47 | "adapter" => adapter, 48 | "database" => database, 49 | "username" => ENV["CI_DB_USERNAME"] || "rails_admin", 50 | "password" => ENV["CI_DB_PASSWORD"] || "rails_admin", 51 | "host" => ENV["CI_DB_HOST"] || "localhost", 52 | "encoding" => ENV["CI_DB_ENCODING"] || "utf8", 53 | "pool" => (ENV["CI_DB_POOL"] || 5).to_int, 54 | "timeout" => (ENV["CI_DB_TIMEOUT"] || 5000).to_int 55 | } 56 | } 57 | 58 | filename = Rails.root.join("config/database.yml") 59 | 60 | File.open(filename, "w") do |f| 61 | f.write(configuration.to_yaml) 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /lib/rails_admin/version.rb: -------------------------------------------------------------------------------- 1 | module RailsAdmin 2 | # FIXME: this needs to be manually kept in sync with the gemspec's 3 | # s.version until http://jira.codehaus.org/browse/JRUBY-5319 is 4 | # fixed 5 | VERSION = "0.0.1" 6 | end 7 | -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/download.rake: -------------------------------------------------------------------------------- 1 | namespace :admin do 2 | desc "Download CKEditor to your public javascript folder" 3 | task :ckeditor_download do 4 | require 'fileutils' 5 | ckeditor_url = "http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.5/ckeditor_3.5.tar.gz" 6 | ckeditor_file = "/tmp/ckeditor_3.5.tar.gz" 7 | destination_folder = File.join(FileUtils.pwd, 'public', 'javascripts') 8 | 9 | raise "CKEditor is already installed in your public." if File.exists? File.join(destination_folder, 'ckeditor', 'LICENSE.html') 10 | raise "Missing public/javascripts folder. Create it." unless File.exists?(destination_folder) 11 | 12 | puts "Downloading CKEditor (you need to have either wget or curl installed)" 13 | `curl #{ckeditor_url} -o '#{ckeditor_file}' || wget #{ckeditor_url} -O #{ckeditor_file}` 14 | puts "Deflating to your public javascript folder" 15 | `cd "#{destination_folder}" && tar xvfz #{ckeditor_file}` 16 | puts "Finished." 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

You may have mistyped the address or the page may have moved.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

Maybe you tried to change something you didn't have access to.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |

We've been notified about this issue and we'll take a look at it shortly.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/favicon.ico -------------------------------------------------------------------------------- /public/images/rails_admin/arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/arrow_left.png -------------------------------------------------------------------------------- /public/images/rails_admin/arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/arrow_right.png -------------------------------------------------------------------------------- /public/images/rails_admin/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/background.png -------------------------------------------------------------------------------- /public/images/rails_admin/bullet_arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/bullet_arrow_down.png -------------------------------------------------------------------------------- /public/images/rails_admin/bullet_arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/bullet_arrow_up.png -------------------------------------------------------------------------------- /public/images/rails_admin/bullet_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/bullet_black.png -------------------------------------------------------------------------------- /public/images/rails_admin/bullet_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/bullet_white.png -------------------------------------------------------------------------------- /public/images/rails_admin/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/calendar.png -------------------------------------------------------------------------------- /public/images/rails_admin/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/clock.png -------------------------------------------------------------------------------- /public/images/rails_admin/colorpicker/hline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/colorpicker/hline.png -------------------------------------------------------------------------------- /public/images/rails_admin/colorpicker/hue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/colorpicker/hue.png -------------------------------------------------------------------------------- /public/images/rails_admin/colorpicker/pickerbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/colorpicker/pickerbg.png -------------------------------------------------------------------------------- /public/images/rails_admin/colorpicker/select.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/colorpicker/select.gif -------------------------------------------------------------------------------- /public/images/rails_admin/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/cross.png -------------------------------------------------------------------------------- /public/images/rails_admin/fast_btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/fast_btn.png -------------------------------------------------------------------------------- /public/images/rails_admin/handler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/handler.png -------------------------------------------------------------------------------- /public/images/rails_admin/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/logo.png -------------------------------------------------------------------------------- /public/images/rails_admin/magnifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/magnifier.png -------------------------------------------------------------------------------- /public/images/rails_admin/menu_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/menu_hover.png -------------------------------------------------------------------------------- /public/images/rails_admin/navigation_more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/navigation_more.png -------------------------------------------------------------------------------- /public/images/rails_admin/selector-add.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/selector-add.gif -------------------------------------------------------------------------------- /public/images/rails_admin/selector-addall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/selector-addall.gif -------------------------------------------------------------------------------- /public/images/rails_admin/selector-remove.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/selector-remove.gif -------------------------------------------------------------------------------- /public/images/rails_admin/selector-removeall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/images/rails_admin/selector-removeall.gif -------------------------------------------------------------------------------- /public/javascripts/ckeditor/config.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 | For licensing, see LICENSE.html or http://ckeditor.com/license 4 | 5 | Custom configuration for Rails Admin, by Fabio Akita 6 | */ 7 | 8 | CKEDITOR.editorConfig = function( config ) 9 | { 10 | // Define changes to default configuration here. For example: 11 | // config.language = 'fr'; 12 | // config.uiColor = '#AADC6E'; 13 | config.toolbar = 14 | [ 15 | ['Source','-'], 16 | ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], 17 | ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], 18 | ['BidiLtr', 'BidiRtl'], 19 | '/', 20 | ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], 21 | ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], 22 | ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], 23 | ['Link','Unlink','Anchor'], 24 | ['Table','HorizontalRule','Smiley','SpecialChar','PageBreak'], 25 | '/', 26 | ['Styles','Format','Font','FontSize'], 27 | ['TextColor','BGColor'], 28 | ['Maximize', 'ShowBlocks','-','About'] 29 | ]; 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /public/javascripts/rails_admin/application.js: -------------------------------------------------------------------------------- 1 | // Place your application-specific JavaScript functions and classes here 2 | // This file is automatically included by javascript_include_tag :defaults 3 | 4 | -------------------------------------------------------------------------------- /public/javascripts/rails_admin/prototype-base-extensions.js: -------------------------------------------------------------------------------- 1 | Hash.prototype.without = function() { 2 | var values = $A(arguments); 3 | var retHash = $H(); 4 | this.each(function(entry) { 5 | if(!values.include(entry.key)) 6 | retHash.set(entry.key, entry.value); 7 | }); 8 | return retHash; 9 | } 10 | 11 | Element.insertAfter = function(insert, element) { 12 | if (element.nextSibling) element.parentNode.insertBefore(insert, element.nextSibling); 13 | else element.parentNode.appendChild(insert); 14 | } 15 | 16 | // Fix exceptions thrown thrown when removing an element with no parent 17 | Element._remove = Element.remove; 18 | Element.remove = function(element) { 19 | element = $(element); 20 | if (element.parentNode) 21 | return Element._remove(element); 22 | } 23 | -------------------------------------------------------------------------------- /public/javascripts/rails_admin/sound.js: -------------------------------------------------------------------------------- 1 | // script.aculo.us sound.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 2 | 3 | // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 4 | // 5 | // Based on code created by Jules Gravinese (http://www.webveteran.com/) 6 | // 7 | // script.aculo.us is freely distributable under the terms of an MIT-style license. 8 | // For details, see the script.aculo.us web site: http://script.aculo.us/ 9 | 10 | Sound = { 11 | tracks: {}, 12 | _enabled: true, 13 | template: 14 | new Template(''), 15 | enable: function(){ 16 | Sound._enabled = true; 17 | }, 18 | disable: function(){ 19 | Sound._enabled = false; 20 | }, 21 | play: function(url){ 22 | if(!Sound._enabled) return; 23 | var options = Object.extend({ 24 | track: 'global', url: url, replace: false 25 | }, arguments[1] || {}); 26 | 27 | if(options.replace && this.tracks[options.track]) { 28 | $R(0, this.tracks[options.track].id).each(function(id){ 29 | var sound = $('sound_'+options.track+'_'+id); 30 | sound.Stop && sound.Stop(); 31 | sound.remove(); 32 | }); 33 | this.tracks[options.track] = null; 34 | } 35 | 36 | if(!this.tracks[options.track]) 37 | this.tracks[options.track] = { id: 0 }; 38 | else 39 | this.tracks[options.track].id++; 40 | 41 | options.id = this.tracks[options.track].id; 42 | $$('body')[0].insert( 43 | Prototype.Browser.IE ? new Element('bgsound',{ 44 | id: 'sound_'+options.track+'_'+options.id, 45 | src: options.url, loop: 1, autostart: true 46 | }) : Sound.template.evaluate(options)); 47 | } 48 | }; 49 | 50 | if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){ 51 | if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 })) 52 | Sound.template = new Template(''); 53 | else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('Windows Media') != -1 })) 54 | Sound.template = new Template(''); 55 | else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('RealPlayer') != -1 })) 56 | Sound.template = new Template(''); 57 | else 58 | Sound.play = function(){}; 59 | } 60 | -------------------------------------------------------------------------------- /public/javascripts/rails_admin/yahoo.color.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/public/javascripts/rails_admin/yahoo.color.js -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /public/stylesheets/rails_admin/colorpicker.css: -------------------------------------------------------------------------------- 1 | 2 | /* Styles for ColorPicker popUp */ 3 | .color{ 4 | width: 50px !important 5 | } 6 | #colorpicker { 7 | position: absolute; 8 | width: 145px; 9 | height: 135px; 10 | overflow: hidden; 11 | background: #F9F9F9; 12 | border: 1px #C0C0C0 solid; 13 | border-radius: 3px; 14 | z-index: 1000; 15 | } 16 | 17 | #colorpicker-hue-container { 18 | position: absolute; 19 | top: 4px; 20 | left: 120px; 21 | width: 18px; 22 | height: 110px; 23 | } 24 | 25 | #colorpicker-hue-bg-img { 26 | width: 100%; 27 | height: 100%; 28 | } 29 | 30 | #colorpicker-hue-slider { 31 | position: absolute; 32 | top: 0; 33 | left: 0; 34 | width: 100%; 35 | height: 100%; 36 | } 37 | 38 | #colorpicker-hue-thumb { 39 | position: absolute; 40 | top: 0; 41 | left: 0; 42 | width: 18px; 43 | height: 18px; 44 | z-index: 1009; 45 | cursor: default; 46 | } 47 | 48 | #colorpicker-bar { 49 | text-align: right; 50 | padding-right: 10px; 51 | } 52 | 53 | #colorpicker-close { 54 | cursor: pointer; 55 | color: blue; 56 | font-size: 10px; 57 | font-family: Tahoma, Helvetica, Sans-Serif; 58 | font-weight: bold; 59 | } 60 | 61 | #colorpicker-div { 62 | position: absolute; 63 | top: 8px; 64 | left: 8px; 65 | width: 100px; 66 | height: 100px; 67 | border: 1px solid #666; 68 | } 69 | 70 | #colorpicker-bg, 71 | #colorpicker-bg-overlay { 72 | position: absolute; 73 | top: 0; 74 | left: 0; 75 | width: 100%; 76 | height: 100%; 77 | z-index: 1001; 78 | overflow: hidden; 79 | } 80 | #colorpicker-selector { 81 | position: absolute; 82 | top: 0px; 83 | left: 0px; 84 | width: 11px; 85 | height: 11px; 86 | z-index: 1009; 87 | margin-top: -6px; 88 | margin-left: -6px; 89 | cursor: default; 90 | } 91 | #colorpicker-selector img { 92 | position: absolute; 93 | left: 0; 94 | top: 0; 95 | } 96 | #colorpicker-footer { 97 | position: absolute; 98 | top: 114px; 99 | left: 10px; 100 | width: 127px; 101 | } 102 | 103 | #colorpicker-value { 104 | float: left; 105 | } 106 | 107 | #colorpicker-value, 108 | #colorpicker-value-input { 109 | font-size: 9px !important; 110 | font-family: Helvetica, Verdana, Sans-Serif; 111 | height: 10px; 112 | } 113 | 114 | #colorpicker-value-input { 115 | width: 40px; 116 | } 117 | #colorpicker-okbutton { 118 | float: right; 119 | padding: 0 10px; 120 | background: #0097CF; 121 | font-size: 10px; 122 | font-family: Tahoma, Helvetica, Sans-Serif; 123 | border: 1px solid #0076C3; 124 | color: #ffffff; 125 | } 126 | -------------------------------------------------------------------------------- /public/stylesheets/rails_admin/datepicker.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Styles for DatePicker 3 | */ 4 | 5 | .datepickerControl { 6 | border:1px solid #999999; 7 | background-color:#EEEEEE; 8 | padding:5px; 9 | } 10 | 11 | .datepickerControl td { 12 | text-align:center; 13 | font-family:sans-serif; 14 | font-size:11px; 15 | padding:1px; 16 | } 17 | 18 | .datepickerControl tr.monthLabel td { 19 | background-color:#FFFFFF; 20 | border:1px solid #999999; 21 | font-weight:bold; 22 | } 23 | 24 | .datepickerControl tr.navigation td { 25 | cursor:pointer; 26 | } 27 | 28 | .datepickerControl tr.navigation td:hover { 29 | text-decoration:underline; 30 | } 31 | 32 | .datepickerControl tr.dayLabel td { 33 | /* 34 | border:1px solid #C0D8EA; 35 | background-color:#C0D8EA; 36 | */ 37 | border:1px solid #003366; 38 | background-color:#003366; 39 | color:white; 40 | font-weight:bold; 41 | } 42 | 43 | .datepickerControl td.day, .datepickerControl td.dayothermonth { 44 | cursor:pointer; 45 | background-color:#FFFFFF; 46 | border:1px solid #EEEEEE; 47 | width:2em; 48 | } 49 | 50 | .datepickerControl td.dayothermonth { 51 | color:#999999; 52 | font-style:italic; 53 | } 54 | 55 | .datepickerControl td.day:hover { 56 | background-color:#EBE4C0; 57 | } 58 | 59 | .datepickerControl td.weekend { 60 | background-color:#CCCCCC; 61 | font-style:italic; 62 | } 63 | 64 | .datepickerControl td.today { 65 | font-weight:bold; 66 | } 67 | 68 | .datepickerControl td.hour { 69 | cursor:pointer; 70 | background-color:#FFFFFF; 71 | border:1px solid #EEEEEE; 72 | width:2em; 73 | } 74 | 75 | .datepickerControl td.minute { 76 | cursor:pointer; 77 | background-color:#FFFFFF; 78 | border:1px solid #EEEEEE; 79 | width:2em; 80 | } 81 | 82 | .datepickerControl td input, 83 | .datepickerControl td button { 84 | font-size:11px; 85 | padding:0; 86 | border:1px solid #999999; 87 | text-align:center; 88 | } 89 | 90 | .datepickerControl td.ampm { 91 | cursor:pointer; 92 | background-color:#CCCCCC; 93 | border:1px solid #EEEEEE; 94 | width:2em; 95 | } 96 | 97 | .datepickerControl td.current { 98 | font-weight:bold; 99 | background-color:#EBC2C0; 100 | } 101 | 102 | .datepickerControl input.current { 103 | background-color:#EBC2C0; 104 | } 105 | 106 | .datepickerControl td.current:hover { 107 | background-color:#EBC2C0; 108 | } 109 | -------------------------------------------------------------------------------- /public/stylesheets/rails_admin/delete.css: -------------------------------------------------------------------------------- 1 | #contentMainDelete{ 2 | padding:5px; 3 | } 4 | 5 | #contentMainDelete ul{ 6 | margin-left:14px; 7 | margin-top:4px; 8 | } 9 | 10 | #contentMainDelete ul li{ 11 | margin-bottom:3px; 12 | margin-left:5px; 13 | } 14 | 15 | #contentMainDelete ul li a{ 16 | color:#000; 17 | } 18 | 19 | #contentMainDelete ul li a:hover{ 20 | text-decoration:none; 21 | } 22 | 23 | #deleteConfirmation{ 24 | margin-top:5px; 25 | margin-left:-20px; 26 | } 27 | 28 | #submitArea{ 29 | display:block; 30 | list-style-type:none; 31 | margin-bottom:5px; 32 | } 33 | 34 | #submitArea li{ 35 | float:left; 36 | margin-right:2px; 37 | padding-bottom:5px; 38 | } 39 | 40 | .button:active{ 41 | background: #CCCCCC; 42 | background: -webkit-gradient(linear, left top, left bottom, from(#CCCCCC), to(#DDDDDD)); 43 | background: -moz-linear-gradient(top, #CCCCCC, #DDDDDD); 44 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#CCCCCC', endColorstr='#DDDDDD'); 45 | } 46 | 47 | .button{ 48 | display: inline-block; 49 | outline: none; 50 | cursor: pointer; 51 | text-align: center; 52 | text-decoration: none; 53 | font-size: 10px; 54 | padding:5px; 55 | padding-left:10px; 56 | padding-right:10px; 57 | -webkit-border-radius: 2px; 58 | -moz-border-radius: 2px; 59 | border-radius: 2px; 60 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.2); 61 | -moz-box-shadow: 0 1px 1px rgba(0,0,0,.2); 62 | box-shadow: 0 1px 2px rgba(0,0,0,.2); 63 | color: #000; 64 | border: solid 1px #CDCDCD; 65 | background: #DDDDDD; 66 | background: -webkit-gradient(linear, left top, left bottom, from(#DDDDDD), to(#CCCCCC)); 67 | background: -moz-linear-gradient(top, #DDDDDD, #CCCCCC); 68 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#DDDDDD', endColorstr='#CCCCCC'); 69 | } 70 | 71 | 72 | input.default{ 73 | color:#d9eef7; 74 | border: solid 1px #0076c3; 75 | background: #007ead; 76 | background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5)); 77 | background: -moz-linear-gradient(top, #00adee, #0078a5); 78 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5'); 79 | } 80 | 81 | input.default:active{ 82 | background: #00adee; 83 | background: -webkit-gradient(linear, left top, left bottom, from(#0078a5), to(#00adee)); 84 | background: -moz-linear-gradient(top, #0078a5, #00adee); 85 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0078a5', endColorstr='#00adee'); 86 | } 87 | -------------------------------------------------------------------------------- /rails_admin.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | 3 | Gem::Specification.new do |s| 4 | # If you add a development dependency, please maintain alphabetical order 5 | s.add_development_dependency('devise', '~> 1.1') 6 | s.add_development_dependency('dummy_data', '~> 0.9') 7 | s.add_development_dependency('maruku', '~> 0.6') 8 | s.add_development_dependency('paperclip', '~> 2.3') 9 | s.add_development_dependency('rspec-rails', '~> 2.5') 10 | s.add_development_dependency('simplecov', '~> 0.4') 11 | s.add_development_dependency('webrat', '~> 0.7') 12 | s.add_development_dependency('yard', '~> 0.6') 13 | s.add_development_dependency('ZenTest', '~> 4.5') 14 | # If you add a runtime dependency, please maintain alphabetical order 15 | s.add_runtime_dependency('builder', '~> 2.1.0') 16 | s.add_runtime_dependency('rails', '~> 3.0.3') 17 | s.authors = ["Erik Michaels-Ober", "Bogdan Gaza"] 18 | s.description = %q{RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data} 19 | s.email = ['sferik@gmail.com'] 20 | s.extra_rdoc_files = ['LICENSE.mkd', 'README.mkd'] 21 | s.files = Dir['Gemfile', 'LICENSE.mkd', 'README.mkd', 'Rakefile', 'app/**/*', 'config/**/*', 'lib/**/*', 'public/**/*'] 22 | s.homepage = 'http://rubygems.org/gems/rails_admin' 23 | s.name = 'rails_admin' 24 | s.platform = Gem::Platform::RUBY 25 | s.rdoc_options = ['--charset=UTF-8'] 26 | s.require_paths = ['lib'] 27 | s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version= 28 | s.rubyforge_project = 'rails_admin' 29 | s.summary = %q{Admin for Rails} 30 | s.test_files = Dir['spec/**/*'] 31 | # FIXME: this should reference RailsAdmin::VERSION but because of 32 | # http://jira.codehaus.org/browse/JRUBY-5319 we can't use "require" 33 | # in our gemspec 34 | s.version = '0.0.1' 35 | end 36 | -------------------------------------------------------------------------------- /screenshots/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/screenshots/edit.png -------------------------------------------------------------------------------- /screenshots/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanb/rails_admin/3c10d5632bf20b94180e9080db6d43ac69a5d917/screenshots/list.png -------------------------------------------------------------------------------- /spec/database_helpers.rb: -------------------------------------------------------------------------------- 1 | module DatabaseHelpers 2 | 3 | def migrate_database 4 | silence_stream(STDOUT) do 5 | ActiveRecord::Migrator.migrate File.expand_path('../dummy_app/db/migrate/', __FILE__) 6 | end 7 | end 8 | 9 | def drop_all_tables 10 | ActiveRecord::Base.connection.tables.each do |table| 11 | ActiveRecord::Base.connection.drop_table(table) 12 | end 13 | end 14 | 15 | end -------------------------------------------------------------------------------- /spec/dummy_app/.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | db/*.sqlite3 3 | log/*.log 4 | tmp/**/* 5 | -------------------------------------------------------------------------------- /spec/dummy_app/Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'rails', '~> 3.0.4' 4 | gem 'devise', '~> 1.1' 5 | gem 'paperclip', '~> 2.3' 6 | gem 'rails_admin', :path => '../../' 7 | 8 | # Bundle gems for the local environment. Make sure to 9 | # put test-only gems in this group so their generators 10 | # and rake tasks are available in development mode: 11 | group :development, :test do 12 | if 'java' == RUBY_PLATFORM 13 | case ENV['CI_DB_ADAPTER'] 14 | when 'mysql' 15 | gem 'activerecord-jdbcmysql-adapter', '~> 1.1', :platform => :jruby 16 | gem 'jdbc-mysql', '~> 5.1', :platform => :jruby 17 | when 'postgresql' 18 | gem 'activerecord-jdbcpostgresql-adapter', '~> 1.1', :platform => :jruby 19 | gem 'jdbc-postgres', '~> 9.0', :platform => :jruby 20 | else 21 | gem 'activerecord-jdbcsqlite3-adapter', '~> 1.1', :platform => :jruby 22 | gem 'jdbc-sqlite3', '~> 3.6', :platform => :jruby 23 | end 24 | else 25 | case ENV['CI_DB_ADAPTER'] 26 | when 'mysql' 27 | gem 'mysql', '~> 2.8' 28 | when 'postgresql' 29 | gem 'pg', '~> 0.10' 30 | else 31 | gem 'sqlite3', '~> 1.3' 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /spec/dummy_app/Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../../ 3 | specs: 4 | rails_admin (0.0.1) 5 | builder (~> 2.1.0) 6 | rails (~> 3.0.3) 7 | 8 | GEM 9 | remote: http://rubygems.org/ 10 | specs: 11 | abstract (1.0.0) 12 | actionmailer (3.0.5) 13 | actionpack (= 3.0.5) 14 | mail (~> 2.2.15) 15 | actionpack (3.0.5) 16 | activemodel (= 3.0.5) 17 | activesupport (= 3.0.5) 18 | builder (~> 2.1.2) 19 | erubis (~> 2.6.6) 20 | i18n (~> 0.4) 21 | rack (~> 1.2.1) 22 | rack-mount (~> 0.6.13) 23 | rack-test (~> 0.5.7) 24 | tzinfo (~> 0.3.23) 25 | activemodel (3.0.5) 26 | activesupport (= 3.0.5) 27 | builder (~> 2.1.2) 28 | i18n (~> 0.4) 29 | activerecord (3.0.5) 30 | activemodel (= 3.0.5) 31 | activesupport (= 3.0.5) 32 | arel (~> 2.0.2) 33 | tzinfo (~> 0.3.23) 34 | activeresource (3.0.5) 35 | activemodel (= 3.0.5) 36 | activesupport (= 3.0.5) 37 | activesupport (3.0.5) 38 | arel (2.0.9) 39 | bcrypt-ruby (2.1.4) 40 | bcrypt-ruby (2.1.4-java) 41 | builder (2.1.2) 42 | devise (1.1.7) 43 | bcrypt-ruby (~> 2.1.2) 44 | warden (~> 1.0.2) 45 | erubis (2.6.6) 46 | abstract (>= 1.0.0) 47 | i18n (0.5.0) 48 | mail (2.2.15) 49 | activesupport (>= 2.3.6) 50 | i18n (>= 0.4.0) 51 | mime-types (~> 1.16) 52 | treetop (~> 1.4.8) 53 | mime-types (1.16) 54 | paperclip (2.3.8) 55 | activerecord 56 | activesupport 57 | polyglot (0.3.1) 58 | rack (1.2.1) 59 | rack-mount (0.6.13) 60 | rack (>= 1.0.0) 61 | rack-test (0.5.7) 62 | rack (>= 1.0) 63 | rails (3.0.5) 64 | actionmailer (= 3.0.5) 65 | actionpack (= 3.0.5) 66 | activerecord (= 3.0.5) 67 | activeresource (= 3.0.5) 68 | activesupport (= 3.0.5) 69 | bundler (~> 1.0) 70 | railties (= 3.0.5) 71 | railties (3.0.5) 72 | actionpack (= 3.0.5) 73 | activesupport (= 3.0.5) 74 | rake (>= 0.8.7) 75 | thor (~> 0.14.4) 76 | rake (0.8.7) 77 | sqlite3 (1.3.3) 78 | thor (0.14.6) 79 | treetop (1.4.9) 80 | polyglot (>= 0.3.1) 81 | tzinfo (0.3.24) 82 | warden (1.0.3) 83 | rack (>= 1.0.0) 84 | 85 | PLATFORMS 86 | java 87 | ruby 88 | 89 | DEPENDENCIES 90 | devise (~> 1.1) 91 | paperclip (~> 2.3) 92 | rails (~> 3.0.4) 93 | rails_admin! 94 | sqlite3 (~> 1.3) 95 | -------------------------------------------------------------------------------- /spec/dummy_app/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | require 'rake' 6 | 7 | Dummy::Application.load_tasks 8 | -------------------------------------------------------------------------------- /spec/dummy_app/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /spec/dummy_app/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /spec/dummy_app/app/locales/models.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | activerecord: 3 | attributes: 4 | fan: 5 | name: His Name 6 | team: 7 | manager: Team Manager 8 | fans: Some Fans -------------------------------------------------------------------------------- /spec/dummy_app/app/models/division.rb: -------------------------------------------------------------------------------- 1 | class Division < ActiveRecord::Base 2 | validates_numericality_of(:league_id, :only_integer => true) 3 | validates_presence_of(:name) 4 | 5 | belongs_to(:league) 6 | has_many(:teams) 7 | end 8 | -------------------------------------------------------------------------------- /spec/dummy_app/app/models/draft.rb: -------------------------------------------------------------------------------- 1 | class Draft < ActiveRecord::Base 2 | validates_numericality_of(:player_id, :only_integer => true) 3 | validates_numericality_of(:team_id, :only_integer => true) 4 | validates_presence_of(:date) 5 | validates_numericality_of(:round, :only_integer => true) 6 | validates_numericality_of(:pick, :only_integer => true) 7 | validates_numericality_of(:overall, :only_integer => true) 8 | 9 | belongs_to(:team) 10 | belongs_to(:player) 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy_app/app/models/fan.rb: -------------------------------------------------------------------------------- 1 | class Fan < ActiveRecord::Base 2 | validates_presence_of(:name) 3 | belongs_to :fanable, :polymorphic => true 4 | has_and_belongs_to_many :teams 5 | end 6 | -------------------------------------------------------------------------------- /spec/dummy_app/app/models/league.rb: -------------------------------------------------------------------------------- 1 | class League < ActiveRecord::Base 2 | validates_presence_of(:name) 3 | 4 | has_many(:divisions) 5 | has_many(:teams) 6 | end 7 | -------------------------------------------------------------------------------- /spec/dummy_app/app/models/player.rb: -------------------------------------------------------------------------------- 1 | class Player < ActiveRecord::Base 2 | validates_presence_of(:name) 3 | validates_numericality_of(:number, :only_integer => true) 4 | validates_uniqueness_of(:number, :scope => :team_id, :message => "There is already a player with that number on this team") 5 | 6 | belongs_to(:team) 7 | has_one(:draft) 8 | 9 | attr_protected :suspended 10 | end 11 | -------------------------------------------------------------------------------- /spec/dummy_app/app/models/rel_test.rb: -------------------------------------------------------------------------------- 1 | class RelTest < ActiveRecord::Base 2 | validates_numericality_of(:player_id, :only_integer => true) 3 | belongs_to :league 4 | belongs_to :division 5 | belongs_to :player 6 | end 7 | -------------------------------------------------------------------------------- /spec/dummy_app/app/models/team.rb: -------------------------------------------------------------------------------- 1 | class Team < ActiveRecord::Base 2 | validates_numericality_of(:league_id, :only_integer => true) 3 | validates_numericality_of(:division_id, :only_integer => true) 4 | validates_presence_of(:manager) 5 | validates_numericality_of(:founded, :only_integer => true) 6 | validates_numericality_of(:wins, :only_integer => true) 7 | validates_numericality_of(:losses, :only_integer => true) 8 | validates_numericality_of(:win_percentage) 9 | validates_numericality_of(:revenue, :allow_nil => true) 10 | 11 | belongs_to(:league) 12 | belongs_to(:division) 13 | has_many(:players) 14 | has_and_belongs_to_many :fans 15 | 16 | def player_names_truncated 17 | players.map{|p| p.name}.join(", ")[0..32] 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/dummy_app/app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | # Include default devise modules. Others available are: 3 | # :token_authenticatable, :confirmable, :lockable and :timeoutable 4 | devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable 5 | 6 | # Setup accessible (or protected) attributes for your model 7 | attr_accessible :email, :password, :password_confirmation, :remember_me 8 | 9 | # Add Paperclip support for avatars 10 | has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" } 11 | 12 | serialize :roles, Array 13 | end 14 | -------------------------------------------------------------------------------- /spec/dummy_app/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Error 5 | 6 | 7 |

If you see this it means that there's a bug in rails_admin which is causing rails_admin's pages to be rendered with the application's layout.

8 | 9 | <%= yield %> 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/dummy_app/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Dummy::Application 5 | -------------------------------------------------------------------------------- /spec/dummy_app/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | require 'devise' 5 | require 'paperclip' 6 | 7 | # If you have a Gemfile, require the gems listed there, including any gems 8 | # you've limited to :test, :development, or :production. 9 | Bundler.require(:default, Rails.env) if defined?(Bundler) 10 | 11 | module Dummy 12 | class Application < Rails::Application 13 | # Settings in config/environments/* take precedence over those specified here. 14 | # Application configuration should go into files in config/initializers 15 | # -- all .rb files in that directory are automatically loaded. 16 | 17 | # Custom directories with classes and modules you want to be autoloadable. 18 | # config.autoload_paths += %W(#{config.root}/extras) 19 | 20 | # Only load the plugins named here, in the order given (default is alphabetical). 21 | # :all can be used as a placeholder for all plugins not explicitly named. 22 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 23 | 24 | # Activate observers that should always be running. 25 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 26 | 27 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 28 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 29 | # config.time_zone = 'Central Time (US & Canada)' 30 | 31 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 32 | config.i18n.load_path += Dir[Rails.root.join('app', 'locales', '*.{rb,yml}').to_s] 33 | # config.i18n.default_locale = :de 34 | 35 | # JavaScript files you want as :defaults (application.js is always included). 36 | # config.action_view.javascript_expansions[:defaults] = %w(jquery rails) 37 | 38 | # Configure the default encoding used in templates for Ruby 1.9. 39 | config.encoding = "utf-8" 40 | 41 | # Configure sensitive parameters which will be filtered from the log file. 42 | config.filter_parameters += [:password] 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /spec/dummy_app/config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | gemfile = File.expand_path('../../Gemfile', __FILE__) 5 | ENV['BUNDLE_GEMFILE'] = gemfile 6 | require 'bundler' 7 | Bundler.setup 8 | -------------------------------------------------------------------------------- /spec/dummy_app/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3-ruby (not necessary on OS X Leopard) 3 | development: 4 | adapter: sqlite3 5 | database: db/development.sqlite3 6 | pool: 5 7 | timeout: 5000 8 | 9 | # Warning: The database defined as "test" will be erased and 10 | # re-generated from your development database when you run "rake". 11 | # Do not set this db to the same as development or production. 12 | test: 13 | adapter: sqlite3 14 | database: ':memory:' 15 | pool: 5 16 | timeout: 5000 17 | 18 | production: 19 | adapter: sqlite3 20 | database: db/production.sqlite3 21 | pool: 5 22 | timeout: 5000 23 | -------------------------------------------------------------------------------- /spec/dummy_app/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Dummy::Application.initialize! 6 | -------------------------------------------------------------------------------- /spec/dummy_app/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.configure do 2 | # Settings specified here will take precedence over those in config/environment.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the webserver when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.consider_all_requests_local = true 14 | config.action_view.debug_rjs = true 15 | config.action_controller.perform_caching = false 16 | 17 | # Don't care if the mailer can't send 18 | config.action_mailer.raise_delivery_errors = false 19 | 20 | # Print deprecation notices to the Rails logger 21 | config.active_support.deprecation = :log 22 | 23 | # Only use best-standards-support built into browsers 24 | config.action_dispatch.best_standards_support = :builtin 25 | end 26 | 27 | -------------------------------------------------------------------------------- /spec/dummy_app/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Dummy::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 50 | -------------------------------------------------------------------------------- /spec/dummy_app/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Dummy::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 36 | -------------------------------------------------------------------------------- /spec/dummy_app/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 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! 8 | -------------------------------------------------------------------------------- /spec/dummy_app/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 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 11 | -------------------------------------------------------------------------------- /spec/dummy_app/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 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 6 | -------------------------------------------------------------------------------- /spec/dummy_app/config/initializers/rails_admin.rb: -------------------------------------------------------------------------------- 1 | RailsAdmin.config do |c| 2 | c.excluded_models << RelTest 3 | end 4 | -------------------------------------------------------------------------------- /spec/dummy_app/config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 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 | Dummy::Application.config.secret_token = '2e733773e594846c6bb87fe0d0bb8e70ea81d334fccdbceca5b05ede2e61f10ea98add53783bf333d8d5523e001f4d7045d71c57ab288e279626c49b18810f9e' 8 | -------------------------------------------------------------------------------- /spec/dummy_app/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Dummy::Application.config.session_store :cookie_store, :key => '_dummy_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 | # Dummy::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /spec/dummy_app/config/locales: -------------------------------------------------------------------------------- 1 | ../../../config/locales/ -------------------------------------------------------------------------------- /spec/dummy_app/config/routes.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.routes.draw do 2 | devise_for :users 3 | root :to => "rails_admin::Main#index" 4 | end 5 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000001_create_divisions_migration.rb: -------------------------------------------------------------------------------- 1 | class CreateDivisionsMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :divisions do |t| 4 | t.timestamps 5 | t.integer :league_id 6 | t.string :name, :limit => 50, :null => false 7 | end 8 | end 9 | 10 | def self.down 11 | drop_table(:divisions) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000002_create_drafts_migration.rb: -------------------------------------------------------------------------------- 1 | class CreateDraftsMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :drafts do |t| 4 | t.timestamps 5 | t.integer :player_id 6 | t.integer :team_id 7 | t.date :date 8 | t.integer :round 9 | t.integer :pick 10 | t.integer :overall 11 | t.string :college, :limit => 100 12 | t.text :notes 13 | end 14 | end 15 | 16 | def self.down 17 | drop_table :drafts 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000003_create_leagues_migration.rb: -------------------------------------------------------------------------------- 1 | class CreateLeaguesMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :leagues do |t| 4 | t.timestamps 5 | t.string :name, :limit => 50, :null => false 6 | end 7 | end 8 | 9 | def self.down 10 | drop_table :leagues 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000004_create_players_migration.rb: -------------------------------------------------------------------------------- 1 | class CreatePlayersMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :players do |t| 4 | t.timestamps 5 | t.datetime :deleted_at 6 | t.integer :team_id 7 | t.string :name, :limit => 100, :null => false 8 | t.string :position, :limit => 50 9 | t.integer :number, :null => false 10 | t.boolean :retired, :default => false 11 | t.boolean :injured, :default => false 12 | t.date :born_on 13 | t.text :notes 14 | end 15 | end 16 | 17 | def self.down 18 | drop_table :players 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000005_create_teams_migration.rb: -------------------------------------------------------------------------------- 1 | class CreateTeamsMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :teams do |t| 4 | t.timestamps 5 | t.integer :league_id 6 | t.integer :division_id 7 | t.string :name, :limit => 50 8 | t.string :logo_url, :limit => 255 9 | t.string :manager, :limit => 100, :null => false 10 | t.string :ballpark, :limit => 100 11 | t.string :mascot, :limit => 100 12 | t.integer :founded 13 | t.integer :wins 14 | t.integer :losses 15 | t.float :win_percentage 16 | end 17 | end 18 | 19 | def self.down 20 | drop_table :teams 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration 2 | def self.up 3 | create_table :users do |t| 4 | t.database_authenticatable :null => false 5 | t.recoverable 6 | t.rememberable 7 | t.trackable 8 | # t.confirmable 9 | # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both 10 | # t.token_authenticatable 11 | t.timestamps 12 | end 13 | 14 | add_index :users, :email, :unique => true 15 | add_index :users, :reset_password_token, :unique => true 16 | # add_index :users, :confirmation_token, :unique => true 17 | # add_index :users, :unlock_token, :unique => true 18 | end 19 | 20 | def self.down 21 | drop_table :users 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000007_create_histories_table.rb: -------------------------------------------------------------------------------- 1 | class CreateHistoriesTable < ActiveRecord::Migration 2 | def self.up 3 | create_table :histories do |t| 4 | t.string :message # title, name, or object_id 5 | t.string :username 6 | t.integer :item 7 | t.string :table 8 | t.integer :month, :limit => 2 9 | t.integer :year, :limit => 5 10 | t.timestamps 11 | end 12 | add_index(:histories, [:item, :table, :month, :year]) 13 | end 14 | 15 | def self.down 16 | drop_table :histories 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000008_create_fans_migration.rb: -------------------------------------------------------------------------------- 1 | class CreateFansMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :fans do |t| 4 | t.timestamps 5 | t.string :name, :limit => 100, :null => false 6 | end 7 | end 8 | 9 | def self.down 10 | drop_table :fans 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000009_create_fans_teams_migration.rb: -------------------------------------------------------------------------------- 1 | class CreateFansTeamsMigration < ActiveRecord::Migration 2 | def self.up 3 | create_table :fans_teams, :id => false do |t| 4 | t.integer :fan_id, :team_id 5 | end 6 | end 7 | 8 | def self.down 9 | drop_table :fans_teams 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000010_add_revenue_to_team_migration.rb: -------------------------------------------------------------------------------- 1 | class AddRevenueToTeamMigration < ActiveRecord::Migration 2 | def self.up 3 | add_column :teams, :revenue, :decimal, :precision => 18, :scale => 2 4 | end 5 | 6 | def self.down 7 | remove_column :teams, :revenue 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000011_add_suspended_to_player_migration.rb: -------------------------------------------------------------------------------- 1 | class AddSuspendedToPlayerMigration < ActiveRecord::Migration 2 | def self.up 3 | add_column :players, :suspended, :boolean, :default => false 4 | end 5 | 6 | def self.down 7 | remove_column :players, :suspended 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000012_add_avatar_columns_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddAvatarColumnsToUser < ActiveRecord::Migration 2 | def self.up 3 | add_column :users, :avatar_file_name, :string 4 | add_column :users, :avatar_content_type, :string 5 | add_column :users, :avatar_file_size, :integer 6 | add_column :users, :avatar_updated_at, :datetime 7 | end 8 | 9 | def self.down 10 | remove_column :users, :avatar_file_name 11 | remove_column :users, :avatar_content_type 12 | remove_column :users, :avatar_file_size 13 | remove_column :users, :avatar_updated_at 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000013_add_roles_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddRolesToUser < ActiveRecord::Migration 2 | def self.up 3 | add_column :users, :roles, :string 4 | end 5 | 6 | def self.down 7 | remove_column :users, :roles 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/00000000000014_add_color_to_team_migration.rb: -------------------------------------------------------------------------------- 1 | class AddColorToTeamMigration < ActiveRecord::Migration 2 | def self.up 3 | add_column :teams, :color, :string 4 | end 5 | 6 | def self.down 7 | remove_column :teams, :color 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/20101223222233_create_rel_tests.rb: -------------------------------------------------------------------------------- 1 | class CreateRelTests < ActiveRecord::Migration 2 | def self.up 3 | create_table :rel_tests do |t| 4 | t.integer :league_id 5 | t.integer :division_id, :null => false 6 | t.integer :player_id 7 | 8 | t.timestamps 9 | end 10 | end 11 | 12 | def self.down 13 | drop_table :rel_tests 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/dummy_app/db/migrate/20110123042530_rename_histories_to_rails_admin_histories.rb: -------------------------------------------------------------------------------- 1 | class RenameHistoriesToRailsAdminHistories < ActiveRecord::Migration 2 | def self.up 3 | rename_table :histories, :rails_admin_histories 4 | end 5 | 6 | def self.down 7 | rename_table :rails_admin_histories, :histories 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/dummy_app/db/seeds.rb: -------------------------------------------------------------------------------- 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) 8 | 9 | User.create(:email => 'test@test.com', :password => 'test1234', :password_confirmation => 'test1234') 10 | 11 | al = League.create!(:name => 'American') 12 | nl = League.create!(:name => 'National') 13 | 14 | east_al = Division.create!(:name => 'East', :league => al) 15 | east_nl = Division.create!(:name => 'East', :league => nl) 16 | 17 | west_al = Division.create!(:name => 'West', :league => al) 18 | west_nl = Division.create!(:name => 'West', :league => nl) 19 | 20 | Team.create!(:name => 'Red Sox', :manager => 'Jack Dempsey', :founded => 1900, :wins => 100, :losses => 0, :win_percentage => 100, :league => al, :division => east_al) 21 | Team.create!(:name => 'Yankees', :manager => 'Yogi Berra', :founded => 1900, :wins => 0, :losses => 100, :win_percentage => 0, :league => al, :division => east_al) 22 | -------------------------------------------------------------------------------- /spec/dummy_app/public: -------------------------------------------------------------------------------- 1 | ../../public -------------------------------------------------------------------------------- /spec/dummy_app/script/rails: -------------------------------------------------------------------------------- 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' 7 | -------------------------------------------------------------------------------- /spec/dummy_app/test/performance/rendering_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | require 'rails/performance_test_help' 3 | 4 | # These are some generic page rendering tests that should provide a 5 | # birds eye view on applications performance. 6 | # 7 | # To run these tests use test:profile rake task (bundle exec rake test:profile) 8 | # within dummy_app (rails_admin/spec/dummy_app) 9 | # 10 | # Currently performance testing doesn't seem to work on ruby 1.9.2 for 11 | # some reason. 12 | class RenderingTest < ActionDispatch::PerformanceTest 13 | 14 | include Warden::Test::Helpers 15 | 16 | def setup 17 | user = RailsAdmin::AbstractModel.new("User").create( 18 | :email => "test@test.com", 19 | :password => "test1234" 20 | ) 21 | 22 | login_as user 23 | end 24 | 25 | def test_render_list_view 26 | get rails_admin_list_path(:model_name => "player") 27 | end 28 | 29 | def test_render_create_view 30 | get rails_admin_new_path(:model_name => "player") 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /spec/dummy_app/test/test_helper.rb: -------------------------------------------------------------------------------- 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 14 | -------------------------------------------------------------------------------- /spec/requests/basic/bulk_delete/rails_admin_basic_bulk_delete_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "RailsAdmin Basic Bulk Delete" do 4 | describe "bulk_delete" do 5 | before(:each) do 6 | players = [] 7 | players << RailsAdmin::AbstractModel.new("Player").create(:team_id => rand(99999), :number => 1, :name => "Player 1") 8 | players << RailsAdmin::AbstractModel.new("Player").create(:team_id => rand(99999), :number => 23, :name => "Player 2") 9 | 10 | get rails_admin_bulk_delete_path(:model_name => "player", :bulk_ids => players.map(&:id)) 11 | end 12 | 13 | it "should respond successfully" do 14 | response.should be_successful 15 | end 16 | 17 | it 'should show names of to-be-deleted players' do 18 | response.body.should contain("Player 1") 19 | response.body.should contain("Player 2") 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/requests/basic/delete/rails_admin_basic_delete_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "RailsAdmin Basic Delete" do 4 | 5 | describe "delete" do 6 | before(:each) do 7 | @player = RailsAdmin::AbstractModel.new("Player").create(:team_id => rand(99999), :number => 1, :name => "Player 1") 8 | get rails_admin_delete_path(:model_name => "player", :id => @player.id) 9 | end 10 | 11 | it "should respond successfully" do 12 | response.should be_successful 13 | end 14 | 15 | it "should show \"Delete model\"" do 16 | response.body.should contain("Delete player") 17 | end 18 | end 19 | 20 | describe "delete with missing object" do 21 | before(:each) do 22 | get rails_admin_delete_path(:model_name => "player", :id => 1) 23 | end 24 | 25 | it "should raise NotFound" do 26 | @response.status.should equal(404) 27 | end 28 | end 29 | 30 | describe "delete with missing label" do 31 | before(:each) do 32 | @league = RailsAdmin::AbstractModel.new("League").create(:name => "League 1") 33 | @team = RailsAdmin::AbstractModel.new("Team").create(:league_id => @league.id, :division_id => rand(99999), :manager => "Manager 1", :founded => 1869 + rand(130), :wins => (wins = rand(163)), :losses => 162 - wins, :win_percentage => ("%.3f" % (wins.to_f / 162)).to_f) 34 | 35 | get rails_admin_delete_path(:model_name => "league", :id => @league.id) 36 | end 37 | 38 | it "should respond successfully" do 39 | @response.should be_successful 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /spec/requests/basic/destroy/rails_admin_basic_destroy_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "RailsAdmin Basic Destroy" do 4 | 5 | describe "destroy" do 6 | before(:each) do 7 | @player = RailsAdmin::AbstractModel.new("Player").create(:team_id => rand(99999), :number => 1, :name => "Player 1") 8 | 9 | get rails_admin_delete_path(:model_name => "player", :id => @player.id) 10 | 11 | @req = click_button "Yes, I'm sure" 12 | @player = RailsAdmin::AbstractModel.new("Player").first 13 | end 14 | 15 | it "should be successful" do 16 | @req.should be_successful 17 | end 18 | 19 | it "should destroy an object" do 20 | @player.should be_nil 21 | end 22 | end 23 | 24 | describe "destroy" do 25 | before(:each) do 26 | @player = RailsAdmin::AbstractModel.new("Player").create(:team_id => rand(99999), :number => 1, :name => "Player 1") 27 | 28 | get rails_admin_delete_path(:model_name => "player", :id => @player.id) 29 | 30 | @req = click_button "Cancel" 31 | @player = RailsAdmin::AbstractModel.new("Player").first 32 | end 33 | 34 | it "should be successful" do 35 | @req.should be_successful 36 | end 37 | 38 | it "should not destroy an object" do 39 | @player.should be 40 | end 41 | end 42 | 43 | describe "destroy with missing object" do 44 | before(:each) do 45 | @req = visit(rails_admin_destroy_path(:model_name => "player", :id => 1), :delete) 46 | end 47 | 48 | it "should raise NotFound" do 49 | @req.status.should equal(404) 50 | end 51 | end 52 | 53 | end 54 | -------------------------------------------------------------------------------- /spec/requests/config/rails_admin_config_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "RailsAdmin Config DSL" do 4 | 5 | describe "excluded models" do 6 | excluded_models = [Division, Draft, Fan] 7 | 8 | before(:all) do 9 | RailsAdmin::Config.excluded_models = excluded_models 10 | end 11 | 12 | after(:all) do 13 | RailsAdmin::Config.excluded_models = [] 14 | RailsAdmin::AbstractModel.instance_variable_get("@models").clear 15 | RailsAdmin::Config.reset 16 | end 17 | 18 | it "should be hidden from navigation" do 19 | # Make query in team's edit view to make sure loading 20 | # the related division model config will not mess the navigation 21 | get rails_admin_new_path(:model_name => "team") 22 | excluded_models.each do |model| 23 | response.should have_tag("#nav") do |navigation| 24 | navigation.should_not have_tag("li a", :content => model.to_s) 25 | end 26 | end 27 | end 28 | 29 | it "should raise NotFound for the list view" do 30 | get rails_admin_list_path(:model_name => "fan") 31 | response.status.should equal(404) 32 | end 33 | 34 | it "should raise NotFound for the create view" do 35 | get rails_admin_new_path(:model_name => "fan") 36 | response.status.should equal(404) 37 | end 38 | 39 | it "should be hidden from other models relations in the edit view" do 40 | get rails_admin_new_path(:model_name => "team") 41 | response.should_not have_tag("#team_division_id") 42 | response.should_not have_tag("input#team_fans") 43 | end 44 | 45 | it "should raise NoMethodError when an unknown method is called" do 46 | begin 47 | RailsAdmin::Config.model Team do 48 | method_that_doesnt_exist 49 | fail "calling an unknown method should have failed" 50 | end 51 | rescue NoMethodError 52 | # this is what we want to happen 53 | end 54 | end 55 | end 56 | 57 | describe "model store does not exist" do 58 | before(:each) { drop_all_tables } 59 | after(:all) { migrate_database } 60 | 61 | it "should not raise an error when the model tables do not exists" do 62 | config_setup = lambda do 63 | RailsAdmin.config Team do 64 | edit do 65 | field :name 66 | end 67 | end 68 | end 69 | 70 | config_setup.should_not raise_error 71 | end 72 | end 73 | 74 | end 75 | -------------------------------------------------------------------------------- /spec/requests/rails_admin_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe "RailsAdmin" do 4 | 5 | describe "authentication" do 6 | it "should be disableable" do 7 | logout 8 | RailsAdmin.authenticate_with {} 9 | get rails_admin_dashboard_path 10 | response.should be_successful 11 | end 12 | end 13 | 14 | # A common mistake for translators is to forget to change the YAML file's 15 | # root key from en to their own locale (as people tend to use the English 16 | # file as template for a new translation). 17 | describe "localization" do 18 | it "should default to English" do 19 | get rails_admin_dashboard_path 20 | 21 | response.should contain("Site administration") 22 | response.should contain("Dashboard") 23 | end 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /spec/requests/relation_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'table relations' do 4 | before :each do 5 | @fields = RailsAdmin.config(RelTest).create.fields 6 | end 7 | 8 | describe 'column with nullable fk and no model validations' do 9 | it 'should be optional' do 10 | @fields.find{ |f| f.name == :league_id }.required?.should == false 11 | end 12 | end 13 | 14 | describe 'column with non-nullable fk and no model validations' do 15 | it 'should be required' do 16 | @fields.find{ |f| f.name == :division_id }.required?.should == true 17 | end 18 | end 19 | 20 | describe 'column with nullable fk and a numericality model validation' do 21 | it 'should be required' do 22 | @fields.find{ |f| f.name == :player_id }.required?.should == true 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # Configure Rails Envinronment 2 | ENV["RAILS_ENV"] = "test" 3 | 4 | require 'simplecov' 5 | SimpleCov.start do 6 | add_filter '/config/' 7 | add_group 'Controllers', 'app/controllers' 8 | add_group 'Models', 'app/models' 9 | add_group 'Helpers', 'app/helpers' 10 | add_group 'Libraries', 'lib' 11 | add_group 'Specs', 'spec' 12 | end 13 | 14 | require File.expand_path('../dummy_app/config/environment', __FILE__) 15 | require "rails/test_help" 16 | require "rspec/rails" 17 | require "database_helpers" 18 | 19 | ActionMailer::Base.delivery_method = :test 20 | ActionMailer::Base.perform_deliveries = true 21 | ActionMailer::Base.default_url_options[:host] = "test.com" 22 | 23 | Rails.backtrace_cleaner.remove_silencers! 24 | 25 | include DatabaseHelpers 26 | # Run any available migration 27 | puts 'Setting up database...' 28 | drop_all_tables 29 | migrate_database 30 | 31 | # Load support files 32 | Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each{|f| require f} 33 | 34 | Webrat.configure do |config| 35 | config.mode = :rails 36 | end 37 | 38 | RSpec.configure do |config| 39 | # Remove this line if you don't want RSpec's should and should_not 40 | # methods or matchers 41 | require 'rspec/expectations' 42 | 43 | config.include RSpec::Matchers 44 | config.include Webrat::Matchers 45 | config.include Webrat::HaveTagMatcher 46 | config.include DatabaseHelpers 47 | 48 | # == Mock Framework 49 | config.mock_with :rspec 50 | 51 | config.include Warden::Test::Helpers 52 | 53 | config.before(:each) do 54 | RailsAdmin::AbstractModel.new("Division").destroy_all! 55 | RailsAdmin::AbstractModel.new("Draft").destroy_all! 56 | RailsAdmin::AbstractModel.new("Fan").destroy_all! 57 | RailsAdmin::AbstractModel.new("League").destroy_all! 58 | RailsAdmin::AbstractModel.new("Player").destroy_all! 59 | RailsAdmin::AbstractModel.new("Team").destroy_all! 60 | RailsAdmin::AbstractModel.new("User").destroy_all! 61 | 62 | user = RailsAdmin::AbstractModel.new("User").create( 63 | :email => "test@test.com", 64 | :password => "test1234" 65 | ) 66 | 67 | login_as user 68 | end 69 | 70 | config.after(:each) do 71 | Warden.test_reset! 72 | end 73 | end 74 | --------------------------------------------------------------------------------