Permalink
Browse files

RailsApp

  • Loading branch information...
1 parent b88c0b9 commit af06ccf2e04274aa5f6526d2e10b5862485a5220 @fesplugas fesplugas committed Aug 23, 2011
Showing with 2,509 additions and 0 deletions.
  1. +10 −0 test/fixtures/rails_app/.gitignore
  2. +8 −0 test/fixtures/rails_app/.pushand
  3. +63 −0 test/fixtures/rails_app/Gemfile
  4. +55 −0 test/fixtures/rails_app/README.md
  5. +7 −0 test/fixtures/rails_app/Rakefile
  6. +2 −0 test/fixtures/rails_app/app/controllers/admin/admin_users_controller.rb
  7. +2 −0 test/fixtures/rails_app/app/controllers/admin/animals_controller.rb
  8. +2 −0 test/fixtures/rails_app/app/controllers/admin/article/entries_controller.rb
  9. +2 −0 test/fixtures/rails_app/app/controllers/admin/assets_controller.rb
  10. +2 −0 test/fixtures/rails_app/app/controllers/admin/birds_controller.rb
  11. +2 −0 test/fixtures/rails_app/app/controllers/admin/cases_controller.rb
  12. +5 −0 test/fixtures/rails_app/app/controllers/admin/categories_controller.rb
  13. +2 −0 test/fixtures/rails_app/app/controllers/admin/comments_controller.rb
  14. +2 −0 test/fixtures/rails_app/app/controllers/admin/devise_users_controller.rb
  15. +2 −0 test/fixtures/rails_app/app/controllers/admin/dogs_controller.rb
  16. +2 −0 test/fixtures/rails_app/app/controllers/admin/entries_controller.rb
  17. +5 −0 test/fixtures/rails_app/app/controllers/admin/entry_bulks_controller.rb
  18. +2 −0 test/fixtures/rails_app/app/controllers/admin/entry_defaults_controller.rb
  19. +5 −0 test/fixtures/rails_app/app/controllers/admin/entry_trashes_controller.rb
  20. +37 −0 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb
  21. +2 −0 test/fixtures/rails_app/app/controllers/admin/image_holders_controller.rb
  22. +2 −0 test/fixtures/rails_app/app/controllers/admin/invoices_controller.rb
  23. +2 −0 test/fixtures/rails_app/app/controllers/admin/orders_controller.rb
  24. +7 −0 test/fixtures/rails_app/app/controllers/admin/pages_controller.rb
  25. +2 −0 test/fixtures/rails_app/app/controllers/admin/posts_controller.rb
  26. +2 −0 test/fixtures/rails_app/app/controllers/admin/project_collaborators_controller.rb
  27. +2 −0 test/fixtures/rails_app/app/controllers/admin/projects_controller.rb
  28. +27 −0 test/fixtures/rails_app/app/controllers/admin/settings_controller.rb
  29. +2 −0 test/fixtures/rails_app/app/controllers/admin/status_controller.rb
  30. +2 −0 test/fixtures/rails_app/app/controllers/admin/typus_users_controller.rb
  31. +2 −0 test/fixtures/rails_app/app/controllers/admin/users_controller.rb
  32. +8 −0 test/fixtures/rails_app/app/controllers/admin/views_controller.rb
  33. +2 −0 test/fixtures/rails_app/app/controllers/admin/watch_dog_controller.rb
  34. +3 −0 test/fixtures/rails_app/app/controllers/application_controller.rb
  35. +2 −0 test/fixtures/rails_app/app/helpers/application_helper.rb
  36. +3 −0 test/fixtures/rails_app/app/helpers/form_helper.rb
  37. +24 −0 test/fixtures/rails_app/app/models/admin/setting.rb
  38. +7 −0 test/fixtures/rails_app/app/models/admin_user.rb
  39. +21 −0 test/fixtures/rails_app/app/models/animal.rb
  40. +10 −0 test/fixtures/rails_app/app/models/article.rb
  41. +2 −0 test/fixtures/rails_app/app/models/article/entry.rb
  42. +45 −0 test/fixtures/rails_app/app/models/asset.rb
  43. +2 −0 test/fixtures/rails_app/app/models/bird.rb
  44. +2 −0 test/fixtures/rails_app/app/models/case.rb
  45. +31 −0 test/fixtures/rails_app/app/models/category.rb
  46. +17 −0 test/fixtures/rails_app/app/models/comment.rb
  47. +5 −0 test/fixtures/rails_app/app/models/delayed/task.rb
  48. +16 −0 test/fixtures/rails_app/app/models/devise_user.rb
  49. +2 −0 test/fixtures/rails_app/app/models/dog.rb
  50. +36 −0 test/fixtures/rails_app/app/models/entry.rb
  51. +2 −0 test/fixtures/rails_app/app/models/entry_bulk.rb
  52. +2 −0 test/fixtures/rails_app/app/models/entry_default.rb
  53. +2 −0 test/fixtures/rails_app/app/models/entry_trash.rb
  54. +27 −0 test/fixtures/rails_app/app/models/hit.rb
  55. +21 −0 test/fixtures/rails_app/app/models/image_holder.rb
  56. +10 −0 test/fixtures/rails_app/app/models/invoice.rb
  57. +9 −0 test/fixtures/rails_app/app/models/order.rb
  58. +24 −0 test/fixtures/rails_app/app/models/page.rb
  59. +40 −0 test/fixtures/rails_app/app/models/post.rb
  60. +17 −0 test/fixtures/rails_app/app/models/project.rb
  61. +16 −0 test/fixtures/rails_app/app/models/project_collaborator.rb
  62. +16 −0 test/fixtures/rails_app/app/models/site.rb
  63. +28 −0 test/fixtures/rails_app/app/models/typus_user.rb
  64. +16 −0 test/fixtures/rails_app/app/models/user.rb
  65. +19 −0 test/fixtures/rails_app/app/models/view.rb
  66. +3 −0 test/fixtures/rails_app/app/views/admin/article/entries/_index.html.erb
  67. +26 −0 test/fixtures/rails_app/app/views/admin/assets/_edit.html.erb
  68. +3 −0 test/fixtures/rails_app/app/views/admin/assets/_index.html.erb
  69. +3 −0 test/fixtures/rails_app/app/views/admin/cases/_index.html.erb
  70. +3 −0 test/fixtures/rails_app/app/views/admin/categories/_index.html.erb
  71. +19 −0 test/fixtures/rails_app/app/views/admin/dashboard/_sidebar.html.erb
  72. +3 −0 test/fixtures/rails_app/app/views/admin/entries/_index.html.erb
  73. +3 −0 test/fixtures/rails_app/app/views/admin/entry_bulks/_index.html.erb
  74. +3 −0 test/fixtures/rails_app/app/views/admin/entry_trashes/_index.html.erb
  75. +7 −0 test/fixtures/rails_app/app/views/admin/hits/_edit.html.erb
  76. +3 −0 test/fixtures/rails_app/app/views/admin/hits/_index.html.erb
  77. +38 −0 test/fixtures/rails_app/app/views/admin/hits/index.html.erb
  78. +3 −0 test/fixtures/rails_app/app/views/admin/pages/_index.html.erb
  79. +1 −0 test/fixtures/rails_app/app/views/admin/posts/_edit.html.erb
  80. +5 −0 test/fixtures/rails_app/app/views/admin/posts/_index.html.erb
  81. +1 −0 test/fixtures/rails_app/app/views/admin/posts/_new.html.erb
  82. +1 −0 test/fixtures/rails_app/app/views/admin/posts/_show.html.erb
  83. +1 −0 test/fixtures/rails_app/app/views/admin/resources/_sidebar.html.erb
  84. +29 −0 test/fixtures/rails_app/app/views/admin/settings/index.html.erb
  85. +9 −0 test/fixtures/rails_app/app/views/admin/status/index.html.erb
  86. +6 −0 test/fixtures/rails_app/app/views/admin/templates/_datepicker.html.erb
  87. +9 −0 test/fixtures/rails_app/app/views/admin/watch_dog/index.html.erb
  88. +4 −0 test/fixtures/rails_app/config.ru
  89. +42 −0 test/fixtures/rails_app/config/application.rb
  90. +5 −0 test/fixtures/rails_app/config/boot.rb
  91. +32 −0 test/fixtures/rails_app/config/database.yml
  92. +5 −0 test/fixtures/rails_app/config/environment.rb
  93. +45 −0 test/fixtures/rails_app/config/environments/development.rb
  94. +56 −0 test/fixtures/rails_app/config/environments/production.rb
  95. +46 −0 test/fixtures/rails_app/config/environments/test.rb
  96. +7 −0 test/fixtures/rails_app/config/initializers/backtrace_silencers.rb
  97. +204 −0 test/fixtures/rails_app/config/initializers/devise.rb
  98. +1 −0 test/fixtures/rails_app/config/initializers/dragonfly.rb
  99. +11 −0 test/fixtures/rails_app/config/initializers/inflections.rb
  100. +5 −0 test/fixtures/rails_app/config/initializers/mime_types.rb
  101. +7 −0 test/fixtures/rails_app/config/initializers/secret_token.rb
  102. +8 −0 test/fixtures/rails_app/config/initializers/session_store.rb
  103. +14 −0 test/fixtures/rails_app/config/initializers/wrap_parameters.rb
  104. +53 −0 test/fixtures/rails_app/config/locales/devise.en.yml
  105. +5 −0 test/fixtures/rails_app/config/locales/en.yml
  106. +19 −0 test/fixtures/rails_app/config/mongoid.yml
  107. +68 −0 test/fixtures/rails_app/config/routes.rb
  108. +67 −0 test/fixtures/rails_app/config/typus/README
  109. +22 −0 test/fixtures/rails_app/config/typus/admin.yml
  110. +4 −0 test/fixtures/rails_app/config/typus/admin_roles.yml
  111. +10 −0 test/fixtures/rails_app/config/typus/crud_basic.yml
  112. +2 −0 test/fixtures/rails_app/config/typus/crud_basic_roles.yml
  113. +79 −0 test/fixtures/rails_app/config/typus/crud_extended.yml
  114. +17 −0 test/fixtures/rails_app/config/typus/crud_extended_roles.yml
  115. +7 −0 test/fixtures/rails_app/config/typus/defaults.yml
  116. +2 −0 test/fixtures/rails_app/config/typus/defaults_roles.yml
  117. +29 −0 test/fixtures/rails_app/config/typus/extensions.yml
  118. +4 −0 test/fixtures/rails_app/config/typus/extensions_roles.yml
  119. 0 test/fixtures/rails_app/config/typus/has_many.yml
  120. 0 test/fixtures/rails_app/config/typus/has_many_roles.yml
  121. +23 −0 test/fixtures/rails_app/config/typus/has_many_through.yml
  122. +4 −0 test/fixtures/rails_app/config/typus/has_many_through_roles.yml
  123. +12 −0 test/fixtures/rails_app/config/typus/has_one.yml
  124. +3 −0 test/fixtures/rails_app/config/typus/has_one_roles.yml
  125. +4 −0 test/fixtures/rails_app/config/typus/mongo_db.yml
  126. +2 −0 test/fixtures/rails_app/config/typus/mongo_db_roles.yml
  127. +17 −0 test/fixtures/rails_app/config/typus/polymorphic.yml
  128. +5 −0 test/fixtures/rails_app/config/typus/polymorphic_roles.yml
  129. +7 −0 test/fixtures/rails_app/config/typus/resource_roles.yml
  130. +3 −0 test/fixtures/rails_app/config/typus/unknown.yml
  131. +5 −0 test/fixtures/rails_app/config/typus/unknown_roles.yml
  132. 0 test/fixtures/rails_app/db/.gitkeep
  133. +13 −0 test/fixtures/rails_app/db/migrate/20110711152844_create_admin_settings.rb
  134. +28 −0 test/fixtures/rails_app/db/migrate/20110717084839_devise_create_devise_users.rb
  135. +238 −0 test/fixtures/rails_app/db/schema.rb
  136. +56 −0 test/fixtures/rails_app/db/seeds.rb
  137. BIN test/fixtures/rails_app/db/seeds/assets/000.jpg
  138. BIN test/fixtures/rails_app/db/seeds/assets/001.jpg
  139. BIN test/fixtures/rails_app/db/seeds/assets/002.jpg
  140. BIN test/fixtures/rails_app/db/seeds/assets/003.jpg
  141. BIN test/fixtures/rails_app/db/seeds/assets/004.jpg
  142. +18 −0 test/fixtures/rails_app/lib/my_fake_user.rb
  143. +26 −0 test/fixtures/rails_app/public/404.html
  144. +26 −0 test/fixtures/rails_app/public/422.html
  145. +26 −0 test/fixtures/rails_app/public/500.html
  146. 0 test/fixtures/rails_app/public/favicon.ico
  147. BIN test/fixtures/rails_app/public/images/rails.png
  148. +5 −0 test/fixtures/rails_app/public/robots.txt
  149. +6 −0 test/fixtures/rails_app/script/rails
  150. +149 −0 test/fixtures/rails_app/test/factories.rb
  151. +11 −0 test/fixtures/rails_app/test/fixtures/admin/settings.yml
  152. +7 −0 test/fixtures/rails_app/test/unit/admin/setting_test.rb
@@ -0,0 +1,10 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+
+public/system
+tmp/*
+
+# I know I shouldn't ignore the Gemfile.lock
+Gemfile.lock
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+rm -f Gemfile.lock
+rm -rf .bundle/config
+bundle install --path .bundle/gems
+# bundle exec rake db:setup RAILS_ENV=production
+# bundle exec rake db:migrate RAILS_ENV=production
+touch tmp/restart.txt
@@ -0,0 +1,63 @@
+source 'http://rubygems.org'
+
+# Minimun requirements
+gem "rails", "~> 3.1.0.rc6"
+
+# This is provided by the Gem but for some reason is not loaded.
+gem "kaminari"
+gem "jquery-rails"
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', "~> 3.1.0.rc"
+ gem 'coffee-rails', "~> 3.1.0.rc"
+ gem 'uglifier'
+end
+
+# Database adapters
+platforms :jruby do
+ gem 'activerecord-jdbcmysql-adapter'
+ gem 'activerecord-jdbcpostgresql-adapter'
+ gem 'activerecord-jdbcsqlite3-adapter'
+
+ gem 'jruby-openssl' # JRuby limited openssl loaded. http://jruby.org/openssl
+end
+
+platforms :ruby do
+ gem 'mysql2'
+ gem 'pg'
+ gem 'sqlite3'
+end
+
+# And this stuff needed for the demo application.
+gem "acts_as_list"
+gem "acts_as_tree"
+gem "factory_girl_rails"
+gem "rails-trash", "~> 1.1.2"
+
+# Rich Text Editor
+gem "ckeditor-rails", "0.0.2"
+
+# Alternative authentication
+gem "devise", "~> 1.4.2"
+
+# Asset Management with Dragonfly
+gem "dragonfly", "~> 0.9"
+gem "rack-cache", :require => "rack/cache"
+
+# Asset Management with Paperclip
+gem "paperclip", "~> 2.3.16"
+
+# MongoDB
+gem "mongoid", "~> 2.1"
+gem "bson_ext", "~> 1.3"
+
+group :test do
+ gem "shoulda-context", "~> 1.0.0.beta1"
+ gem "mocha" # Make sure mocha is loaded at the end ...
+end
+
+gem "typus", "~> 3.1.0.rc18"
+# gem "typus", :path => "../../../"
+# gem "typus", :git => "git://github.com/typus/typus.git"
@@ -0,0 +1,55 @@
+# Typus Demo
+
+This is the Rails application used to test **Typus** and to demo it.
+
+You can see it working at <http://demo.typuscms.com/>.
+
+## Installation
+
+Clone the repository:
+
+ $ git clone git://github.com/typus/demo.git typus-demo
+ $ cd typus-demo
+
+Edit the file `config/mongoid.yml` to set your **MongoDB** settings.
+
+ $ bundle install
+ $ bundle exec rake db:setup
+ $ bundle rails server
+
+Open your browser and go to <http://localhost:3000/>.
+
+## Deploying the Demo (only for Typus developers)
+
+Add the `git` endpoint:
+
+ $ git remote add pushand deploy@demo.typuscms.com:demo.typuscms.com
+
+Now you can deploy using `git`:
+
+ $ git push pushand
+
+**Note:** The `.pushand` file is executed after the source is pushed to the
+server.
+
+**MongoDB** is configured using environment variables. All these variables are
+set the shell script `ruby_with_env`:
+
+ #!/bin/sh
+
+ export MONGOID_HOST=staff.mongohq.com
+ export MONGOID_PORT=10051
+ export MONGOID_USERNAME=typus
+ export MONGOID_PASSWORD=YOUR_PASSWORD_HERE
+ export MONGOID_DATABASE=demo_typuscms_com
+
+ exec "/usr/local/rvm/wrappers/ruby-1.9.2-p180/ruby" "$@"
+
+And then the `passenger_ruby` points to this script.
+
+ # passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p180/ruby;
+ passenger_ruby /opt/nginx/sbin/ruby_with_env;
+
+Remember to make the script executable:
+
+ $ chmod +x /opt/nginx/sbin/ruby_with_env
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Dummy::Application.load_tasks
@@ -0,0 +1,2 @@
+class Admin::AdminUsersController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::AnimalsController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::Article::EntriesController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::AssetsController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::BirdsController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::CasesController < Admin::ResourcesController
+end
@@ -0,0 +1,5 @@
+class Admin::CategoriesController < Admin::ResourcesController
+
+ include Typus::Controller::ActsAsList
+
+end
@@ -0,0 +1,2 @@
+class Admin::CommentsController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::DeviseUsersController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::DogsController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::EntriesController < Admin::ResourcesController
+end
@@ -0,0 +1,5 @@
+class Admin::EntryBulksController < Admin::ResourcesController
+
+ include Typus::Controller::Bulk
+
+end
@@ -0,0 +1,2 @@
+class Admin::EntryDefaultsController < Admin::ResourcesController
+end
@@ -0,0 +1,5 @@
+class Admin::EntryTrashesController < Admin::ResourcesController
+
+ include Typus::Controller::Trash
+
+end
@@ -0,0 +1,37 @@
+class Admin::HitsController < Admin::ResourcesController
+
+ def index
+ @items = Hit.page(params[:page]).per(25)
+ add_resource_action("Edit", {:action => 'edit'}, {})
+ add_resource_action("Trash", {:action => "destroy"}, {:confirm => "#{Typus::I18n.t("Trash")}?", :method => 'delete'})
+ end
+
+ def new
+ @item = Hit.new
+ end
+
+ def create
+ @item = Hit.new(params[:hit])
+ if @item.save
+ flash[:notice] = Typus::I18n::t("Hit was successfully created.")
+ redirect_to :action => 'edit', :id => @item.id
+ else
+ render :action => 'new'
+ end
+ end
+
+ def edit
+ @item = Hit.find(params[:id])
+ end
+
+ def update
+ @item = Hit.find(params[:id])
+ if @item.update_attributes(params[:entry])
+ flash[:notice] = Typus::I18n::t("Hit was successfully updated.")
+ redirect_to :action => 'edit', :id => @item.id
+ else
+ render :action => "edit"
+ end
+ end
+
+end
@@ -0,0 +1,2 @@
+class Admin::ImageHoldersController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::InvoicesController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::OrdersController < Admin::ResourcesController
+end
@@ -0,0 +1,7 @@
+class Admin::PagesController < Admin::ResourcesController
+
+ def rebuild_all
+ redirect_to :back, :notice => "Entries have been rebuilt."
+ end
+
+end
@@ -0,0 +1,2 @@
+class Admin::PostsController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::ProjectCollaboratorsController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::ProjectsController < Admin::ResourcesController
+end
@@ -0,0 +1,27 @@
+class Admin::SettingsController < Admin::BaseController
+
+ before_filter :verify_role
+
+ def index
+ end
+
+ def update
+ params[:settings].each do |key, value|
+ if setting = Admin::Setting.find_by_key(key)
+ setting.update_attributes :value => value
+ else
+ Admin::Setting.create(:key => key, :value => value)
+ end
+ end
+
+ flash[:notice] = Typus::I18n.t("Settings successfully updated.")
+ redirect_to :action => "index"
+ end
+
+ private
+
+ def verify_role
+ redirect_to admin_dashboard_path if admin_user.is_not_root?
+ end
+
+end
@@ -0,0 +1,2 @@
+class Admin::StatusController < Admin::ResourceController
+end
@@ -0,0 +1,2 @@
+class Admin::TypusUsersController < Admin::ResourcesController
+end
@@ -0,0 +1,2 @@
+class Admin::UsersController < Admin::ResourcesController
+end
@@ -0,0 +1,8 @@
+class Admin::ViewsController < Admin::ResourcesController
+
+ def set_context
+ @resource = Site.find_by_domain(request.host).send(@object_name.pluralize)
+ end
+ private :set_context
+
+end
@@ -0,0 +1,2 @@
+class Admin::WatchDogController < Admin::ResourceController
+end
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
@@ -0,0 +1,3 @@
+# Leave this here to make sure we do not use application FormHelper in Typus.
+module FormHelper
+end
@@ -0,0 +1,24 @@
+class Admin::Setting < ActiveRecord::Base
+
+ ##
+ # Validations
+ #
+
+ validates :key, :presence => true, :uniqueness => true
+
+ ##
+ # Class Methods
+ #
+
+ def self.table_name_prefix
+ 'admin_'
+ end
+
+ def self.admin_title
+ setting = where(:key => "admin_title").first
+ if setting && setting.value.present?
+ setting.value
+ end
+ end
+
+end
@@ -0,0 +1,7 @@
+##
+# Here we test the new version of Typus Authenticated users. This is stuff
+# will change so you might prefer using the other mixin.
+#
+class AdminUser < ActiveRecord::Base
+ has_admin
+end
@@ -0,0 +1,21 @@
+=begin
+
+ This model is used to test polymorphic associations.
+
+=end
+
+class Animal < ActiveRecord::Base
+
+ ##
+ # Validations
+ #
+
+ validates :name, :presence => true
+
+ ##
+ # Associations
+ #
+
+ has_many :image_holders, :as => :imageable
+
+end
@@ -0,0 +1,10 @@
+=begin
+
+ This model is not enabled in typus but is used to test things things like:
+
+ - Article.read_model_config
+
+=end
+
+class Article < ActiveRecord::Base
+end
@@ -0,0 +1,2 @@
+class Article::Entry < Entry
+end
Oops, something went wrong.

0 comments on commit af06ccf

Please sign in to comment.