control_center 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.markdown +188 -0
  3. data/generators/control_center/control_center_generator.rb +26 -0
  4. data/generators/control_center/templates/control_center.rb +14 -0
  5. data/lib/control_center.rb +20 -0
  6. data/lib/control_center/engine.rb +18 -0
  7. data/lib/control_center/helpers/layout_helper.rb +65 -0
  8. data/lib/control_center/helpers/tab_builder.rb +14 -0
  9. data/lib/tasks/control_center_tasks.rake +4 -0
  10. data/rails/init.rb +7 -0
  11. data/test/rails/README +2 -0
  12. data/test/rails/Rakefile +10 -0
  13. data/test/rails/app/controllers/application.rb +15 -0
  14. data/test/rails/app/controllers/application_controller.rb +15 -0
  15. data/test/rails/app/controllers/test_controller.rb +3 -0
  16. data/test/rails/app/helpers/application_helper.rb +3 -0
  17. data/test/rails/app/helpers/test_helper.rb +2 -0
  18. data/test/rails/app/views/layouts/_header_links.html.erb +2 -0
  19. data/test/rails/app/views/layouts/_tabs.html.erb +3 -0
  20. data/test/rails/app/views/layouts/control_center.html.erb +64 -0
  21. data/test/rails/app/views/test/forms.html.erb +106 -0
  22. data/test/rails/app/views/test/index.html.erb +28 -0
  23. data/test/rails/app/views/test/no_sidebar.html.erb +17 -0
  24. data/test/rails/app/views/test/pagination.html.erb +4 -0
  25. data/test/rails/app/views/test/tab_override.html.erb +12 -0
  26. data/test/rails/app/views/test/table.html.erb +27 -0
  27. data/test/rails/config/boot.rb +110 -0
  28. data/test/rails/config/database.yml +22 -0
  29. data/test/rails/config/environment.rb +76 -0
  30. data/test/rails/config/environments/development.rb +17 -0
  31. data/test/rails/config/environments/production.rb +24 -0
  32. data/test/rails/config/environments/test.rb +22 -0
  33. data/test/rails/config/initializers/control_center.rb +14 -0
  34. data/test/rails/config/initializers/inflections.rb +10 -0
  35. data/test/rails/config/initializers/mime_types.rb +5 -0
  36. data/test/rails/config/initializers/new_rails_defaults.rb +17 -0
  37. data/test/rails/config/locales/en.yml +5 -0
  38. data/test/rails/config/routes.rb +43 -0
  39. data/test/rails/db/development.sqlite3 +0 -0
  40. data/test/rails/db/test.sqlite3 +0 -0
  41. data/test/rails/doc/README_FOR_APP +5 -0
  42. data/test/rails/lib/tasks/databaseless.rake +3 -0
  43. data/test/rails/log/development.log +251 -0
  44. data/test/rails/log/test.log +280 -0
  45. data/test/rails/public/404.html +30 -0
  46. data/test/rails/public/422.html +30 -0
  47. data/test/rails/public/500.html +33 -0
  48. data/test/rails/public/dispatch.cgi +10 -0
  49. data/test/rails/public/dispatch.fcgi +24 -0
  50. data/test/rails/public/dispatch.rb +10 -0
  51. data/test/rails/public/favicon.ico +0 -0
  52. data/test/rails/public/images/rails.png +0 -0
  53. data/test/rails/public/javascripts/application.js +2 -0
  54. data/test/rails/public/javascripts/controls.js +963 -0
  55. data/test/rails/public/javascripts/dragdrop.js +973 -0
  56. data/test/rails/public/javascripts/effects.js +1128 -0
  57. data/test/rails/public/javascripts/prototype.js +4320 -0
  58. data/test/rails/public/robots.txt +5 -0
  59. data/test/rails/public/stylesheets/control_center.css +289 -0
  60. data/test/rails/public/stylesheets/custom_css_1.css +0 -0
  61. data/test/rails/public/stylesheets/custom_css_2.css +0 -0
  62. data/test/rails/script/about +4 -0
  63. data/test/rails/script/console +3 -0
  64. data/test/rails/script/dbconsole +3 -0
  65. data/test/rails/script/destroy +3 -0
  66. data/test/rails/script/generate +3 -0
  67. data/test/rails/script/performance/benchmarker +3 -0
  68. data/test/rails/script/performance/profiler +3 -0
  69. data/test/rails/script/performance/request +3 -0
  70. data/test/rails/script/plugin +3 -0
  71. data/test/rails/script/process/inspector +3 -0
  72. data/test/rails/script/process/reaper +3 -0
  73. data/test/rails/script/process/spawner +3 -0
  74. data/test/rails/script/runner +3 -0
  75. data/test/rails/script/server +3 -0
  76. data/test/rails/test/functional/test_controller_test.rb +49 -0
  77. data/test/rails/test/performance/browsing_test.rb +9 -0
  78. data/test/rails/test/test_helper.rb +13 -0
  79. data/test/rails/update +6 -0
  80. metadata +145 -0
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,2 @@
1
+ module TestHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ <li><%= link_to "Some", "/some" %></li>
2
+ <li><%= link_to "Link", "/link" %></li>
@@ -0,0 +1,3 @@
1
+ <%= tab("Tab 1", "/") %>
2
+ <%= tab("Tab 2", "/tab2") %>
3
+ <%= tab("Tab 3", "/tab3") %>
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <title><%= ControlCenter::Config.app_title %> - <%= @control_center_title %></title>
6
+
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <meta http-equiv="Content-Language" content="en-us" />
9
+
10
+ <%= stylesheet_link_tag 'control_center' %>
11
+ <style type="text/css">
12
+ #header { background: <%= ControlCenter::Config.theme_color %>; }
13
+ #sub_tabs li {background-color: <%= ControlCenter::Config.theme_color %>; }
14
+ .pagination span.current { background: <%= ControlCenter::Config.theme_color %> };
15
+ </style>
16
+ <% ControlCenter::Config.custom_css.each do |key, value| %>
17
+ <%= stylesheet_link_tag key, value || {} %>
18
+ <% end %>
19
+ </head>
20
+ <body>
21
+ <div id="header">
22
+ <h1><%= ControlCenter::Config.app_title %></h1>
23
+ <ul id="header_links">
24
+ <%= render :partial => "layouts/header_links" %>
25
+ </ul>
26
+ </div>
27
+
28
+ <ul id="tabs">
29
+ <%= render :partial => "layouts/tabs" %>
30
+ </ul>
31
+
32
+ <% if flash[:message] %>
33
+ <div id="message"><%= flash[:message] %></div>
34
+ <% end %>
35
+
36
+ <% if flash[:error] %>
37
+ <div id="error"><%= flash[:error] %></div>
38
+ <% end %>
39
+
40
+ <ul id="sub_tabs" <%= "class=\"narrow\"" if sidebar? %>>
41
+ <%= yield :sub_tabs %>
42
+ </ul>
43
+
44
+ <div id="main">
45
+ <div id="content" <%= "class=\"narrow\"" if sidebar? %>>
46
+ <div id="content_inside">
47
+ <h2><%= @control_center_title %></h2>
48
+
49
+ <%= yield %>
50
+ </div>
51
+ </div>
52
+
53
+ <% if sidebar? %>
54
+ <div id="sidebar">
55
+ <div id="sidebar_inside">
56
+ <%= yield :sidebar %>
57
+ </div>
58
+ </div>
59
+ <% end %>
60
+ </div>
61
+
62
+ <%= javascript_include_tag ControlCenter::Config.include_javascript %>
63
+ </body>
64
+ </html>
@@ -0,0 +1,106 @@
1
+ <% title "Forms Sample" %>
2
+ <% select_tab "Tab 1" %>
3
+
4
+ <p>
5
+ This page gives an example of a form in Control Center.
6
+ </p>
7
+
8
+ <form>
9
+ <div class="errorExplanation" id="errorExplanation">
10
+ <h2>1 error prohibited this user from being saved</h2>
11
+
12
+ <p>There were problems with the following fields:</p>
13
+
14
+ <ul>
15
+ <li>First name can't be blank</li>
16
+ <li>Last name can't be blank</li>
17
+ </ul>
18
+ </div>
19
+
20
+ <div>
21
+ <label for="name">Name</label>
22
+ <input type="text" name="name" id="name" />
23
+ </div>
24
+
25
+ <div>
26
+ <label for="username">Username</label>
27
+ <input type="text" name="username" id="username" />
28
+ </div>
29
+
30
+ <div>
31
+ <label for="select">Select:</label>
32
+ <select name="select">
33
+ <option>Option 1</option>
34
+ <option>Option 2</option>
35
+ <option>Option 3</option>
36
+ <option>Option 4</option>
37
+ </select>
38
+ </div>
39
+
40
+ <div>
41
+ <div class="col2">
42
+ <label for="two">Two</label>
43
+ <input type="text" name="two" id="two" />
44
+ </div>
45
+ <div class="col2">
46
+ <label for="columns">Columns</label>
47
+ <input type="text" name="columns" id="columns" />
48
+ </div>
49
+ </div>
50
+
51
+ <fieldset>
52
+ <legend>Error Fields</legend>
53
+ <div>
54
+ <div class="fieldWithErrors">
55
+ <label for="text_field_w_errors">Text Field With Errors</label>
56
+ </div>
57
+ <div class="fieldWithErrors">
58
+ <input type="text" name="text_field_w_errors" id="text_field_w_errors" />
59
+ </div>
60
+ </div>
61
+
62
+ <div>
63
+ <div class="col2">
64
+ <div class="fieldWithErrors">
65
+ <label for="error_left">Error Left</label>
66
+ </div>
67
+ <div class="fieldWithErrors">
68
+ <input type="text" name="error_left" id="error_left" />
69
+ </div>
70
+ </div>
71
+ <div class="col2">
72
+ <div class="fieldWithErrors">
73
+ <label for="error_right">Error Right</label>
74
+ </div>
75
+ <div class="fieldWithErrors">
76
+ <select name="error_right">
77
+ <option>First Option</option>
78
+ </select>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </fieldset>
83
+
84
+ <div class="submit">
85
+ <input type="submit"> or <a href="#">Cancel</a>
86
+ </div>
87
+ </form>
88
+
89
+ <% sidebar do %>
90
+ <% sidebar do %>
91
+ <h3>Sidebar</h3>
92
+
93
+ <div class="sidebar_box">
94
+ <p>
95
+ This is a quick sample to show off how the sidebar looks.
96
+ </p>
97
+ </div>
98
+
99
+ <div class="sidebar_box">
100
+ <ul>
101
+ <li>Some</li>
102
+ <li>List</li>
103
+ </ul>
104
+ </div>
105
+ <% end %>
106
+ <% end %>
@@ -0,0 +1,28 @@
1
+ <% title "Test Page" %>
2
+ <% select_tab "Tab 1" %>
3
+ <% select_sub_tab "Sub Tab" %>
4
+
5
+ <% sub_tabs do %>
6
+ <%= sub_tab "Sub Tab", "/" %>
7
+ <%= sub_tab "Sub Tab 2", "/2" %>
8
+ <% end %>
9
+
10
+ <h3>Tab Override</h3>
11
+ <p>
12
+ This page overrides the main tabs with its own.
13
+ </p>
14
+ <p>
15
+ <%= link_to "Check It Out",
16
+ { :controller => "test", :action => "tab_override"}%>
17
+ </p>
18
+
19
+ <% sidebar do %>
20
+ <h3>Sidebar</h3>
21
+
22
+ <div class="sidebar_box">
23
+ <ul>
24
+ <li>Some</li>
25
+ <li>List</li>
26
+ </ul>
27
+ </div>
28
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <% title "Test Page" %>
2
+ <% select_tab "Tab 1" %>
3
+ <% select_sub_tab "Sub Tab" %>
4
+
5
+ <% sub_tabs do %>
6
+ <%= sub_tab "Sub Tab", "/" %>
7
+ <%= sub_tab "Sub Tab 2", "/2" %>
8
+ <% end %>
9
+
10
+ <h3>Tab Override</h3>
11
+ <p>
12
+ This page overrides the main tabs with its own.
13
+ </p>
14
+ <p>
15
+ <%= link_to "Check It Out",
16
+ { :controller => "test", :action => "tab_override"}%>
17
+ </p>
@@ -0,0 +1,4 @@
1
+ <% title "Pagination" %>
2
+ <% select_tab "Tab 2" %>
3
+
4
+ <div class="pagination"><span class="disabled prev_page">&laquo; Previous</span> <span class="current">1</span> <a href="/realms/2/orders?page=2" rel="next">2</a> <a href="/realms/2/orders?page=3">3</a> <a href="/realms/2/orders?page=4">4</a> <a href="/realms/2/orders?page=5">5</a> <a href="/realms/2/orders?page=6">6</a> <a href="/realms/2/orders?page=7">7</a> <a href="/realms/2/orders?page=8">8</a> <a href="/realms/2/orders?page=9">9</a> <span class="gap">&hellip;</span> <a href="/realms/2/orders?page=44">44</a> <a href="/realms/2/orders?page=45">45</a> <a href="/realms/2/orders?page=2" class="next_page" rel="next">Next &raquo;</a></div>
@@ -0,0 +1,12 @@
1
+ <% title "Tab Override" %>
2
+
3
+ <% tabs do %>
4
+ <%= tab "Testing", "/" %>
5
+ <%= tab "Override", "/override" %>
6
+ <% end %>
7
+
8
+ <p>
9
+ This page shows you how to override the tabs in the site with a new
10
+ set of tabs. This can be useful if you want to customize your tabs on
11
+ each page.
12
+ </p>
@@ -0,0 +1,27 @@
1
+ <% title "Table Sample" %>
2
+ <% select_tab "Tab 1" %>
3
+
4
+ <table>
5
+ <thead>
6
+ <tr>
7
+ <th>Name</th>
8
+ <th>Address</th>
9
+ <th>Awesomeness</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <tr>
14
+ <td>Alan Johnson</td>
15
+ <td>
16
+ 107 This Way<br />
17
+ Paris, France
18
+ </td>
19
+ <td>Super</td>
20
+ </tr>
21
+ <tr>
22
+ <td>John Doe<br/><em>Sysadmin</em></td>
23
+ <td>France St.</td>
24
+ <td>Somewhat</td>
25
+ </tr>
26
+ </tbody>
27
+ </table>
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,22 @@
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: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,76 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Uncomment below to force Rails into production mode when
4
+ # you don't control web/app server and can't set it the proper way
5
+ # ENV['RAILS_ENV'] ||= 'production'
6
+
7
+ # Specifies gem version of Rails to use when vendor/rails is not present
8
+ RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
9
+
10
+ # Bootstrap the Rails environment, frameworks, and default configuration
11
+ require File.join(File.dirname(__FILE__), 'boot')
12
+
13
+ Rails::Initializer.run do |config|
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+ # See Rails::Configuration for more options.
18
+
19
+ # Skip frameworks you're not going to use. To use Rails without a database
20
+ # you must remove the Active Record framework.
21
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
22
+
23
+ # Specify gems that this application depends on.
24
+ # They can then be installed with "rake gems:install" on new installations.
25
+ # You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3)
26
+ # config.gem "bj"
27
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
28
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
29
+ # config.gem "aws-s3", :lib => "aws/s3"
30
+ #config.gem "control_center"
31
+
32
+ # Only load the plugins named here, in the order given. By default, all plugins
33
+ # in vendor/plugins are loaded in alphabetical order.
34
+ # :all can be used as a placeholder for all plugins not explicitly named
35
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
36
+
37
+ # Add additional load paths for your own custom dirs
38
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
39
+
40
+ # Force all environments to use the same logger level
41
+ # (by default production uses :info, the others :debug)
42
+ # config.log_level = :debug
43
+
44
+ # Make Time.zone default to the specified zone, and make Active Record store time values
45
+ # in the database in UTC, and return them converted to the specified local zone.
46
+ # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
47
+ config.time_zone = 'UTC'
48
+
49
+ # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
50
+ # All files from config/locales/*.rb,yml are added automatically.
51
+ # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
52
+ # config.i18n.default_locale = :de
53
+
54
+ # Your secret key for verifying cookie session data integrity.
55
+ # If you change this key, all old sessions will become invalid!
56
+ # Make sure the secret is at least 30 characters and all random,
57
+ # no regular words or you'll be exposed to dictionary attacks.
58
+ config.action_controller.session = {
59
+ :session_key => '_sample_session',
60
+ :secret => '073989c1e65f1ac8ef0310b42b07e5a7559471488bfe6ceb613972e80bea98f24b4e9051e4142ad92204dbed5b3c69f9660ab60797192b5c14e4824305af2cfd'
61
+ }
62
+
63
+ # Use the database for sessions instead of the cookie-based default,
64
+ # which shouldn't be used to store highly confidential information
65
+ # (create the session table with "rake db:sessions:create")
66
+ # config.action_controller.session_store = :active_record_store
67
+
68
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
69
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
70
+ # like if you have constraints or database-specific column types
71
+ # config.active_record.schema_format = :sql
72
+
73
+ # Activate observers that should always be running
74
+ # Please note that observers generated using script/generate observer need to have an _observer suffix
75
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
76
+ end