commondream-control_center 0.99 → 0.99.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ class ControlCenterGenerator < Rails::Generator::Base
2
+ def banner
3
+ "Usage #{$0} #{spec.name}"
4
+ end
5
+
6
+ def manifest
7
+ record do |m|
8
+ # set up the stylesheet
9
+ m.directory('public/stylesheets')
10
+ m.file('control_center.css',
11
+ 'public/stylesheets/control_center.css')
12
+
13
+ # copy the layouts over
14
+ layouts_path = 'app/views/layouts'
15
+ m.directory(layouts_path)
16
+ m.file('_tabs.html.erb',
17
+ File.join(layouts_path, "_tabs.html.erb"))
18
+ m.file('_header_links.html.erb',
19
+ File.join(layouts_path, "_header_links.html.erb"))
20
+ m.file('control_center.html.erb',
21
+ File.join(layouts_path, "control_center.html.erb"))
22
+
23
+ # copy the initializer over
24
+ m.file 'control_center.rb',
25
+ File.join("config", "initializers", "control_center.rb")
26
+ end
27
+ end
28
+ 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,273 @@
1
+ body {
2
+ background: #ddd;
3
+ font-family: arial, sans-serif;
4
+ margin: 0;
5
+ padding: 0;
6
+ font-size: small;
7
+ }
8
+ a img {
9
+ border: 0;
10
+ }
11
+
12
+ th {
13
+ text-align: left;
14
+ }
15
+
16
+ /* header styling */
17
+ #header {
18
+ background: #36393d;
19
+ color: #fff;
20
+ height: 70px;
21
+ }
22
+ #header h1 a {
23
+ text-decoration: none;
24
+ }
25
+ #header h1 {
26
+ font-size: 30px;
27
+ line-height: 70px;
28
+ margin: 0;
29
+ padding: 0 0 0 20px;
30
+ }
31
+ #header #header_links {
32
+ font-size: small;
33
+ margin: -65px 15px 0 0;
34
+ padding: 0;
35
+ list-style-type: none;
36
+ text-align: right;
37
+ float: right;
38
+ }
39
+ #header #header_links li {
40
+ float: left;
41
+ margin: 0 0 0 5px;
42
+ }
43
+ #header #header_links a {
44
+ color: white;
45
+ }
46
+ #header #header_links a:hover {
47
+ color: #36393d;
48
+ background: #fff;
49
+ text-decoration: none;
50
+ }
51
+
52
+ /* primary tabsigation styling */
53
+ #tabs {
54
+ clear: both;
55
+ float: right;
56
+ margin: -27px 5px 0 0;
57
+ list-style-type: none;
58
+ font-weight: bold;
59
+ font-size: small;
60
+ }
61
+ #tabs li {
62
+ float: left;
63
+ height: 27px;
64
+ line-height: 27px;
65
+ padding: 0 10px;
66
+ }
67
+ #tabs li.active {
68
+ background: #ddd;
69
+ }
70
+ #tabs li.active a {
71
+ color: #000;
72
+ }
73
+ #tabs a {
74
+ text-decoration: none;
75
+ padding: 3px;
76
+ color: #fff;
77
+ }
78
+ #tabs a:hover {
79
+ text-decoration: underline;
80
+ }
81
+ /* secondary tabsigation styling */
82
+ #sub_tabs {
83
+ clear: both;
84
+ float: left;
85
+ list-style-type: none;
86
+ font-weight: bold;
87
+ font-size: small;
88
+ margin: 13px 0 0 -15px;
89
+ }
90
+ #sub_tabs li {
91
+ float: left;
92
+ height: 27px;
93
+ line-height: 27px;
94
+ padding: 0 10px;
95
+ margin-right: 7px;
96
+ }
97
+ #sub_tabs li.active {
98
+ background: #fff;
99
+ }
100
+ #sub_tabs li.active a {
101
+ color: #000;
102
+ }
103
+ #sub_tabs a {
104
+ text-decoration: none;
105
+ padding: 3px;
106
+ color: #fff;
107
+ }
108
+ #sub_tabs a:hover {
109
+ text-decoration: underline;
110
+ }
111
+
112
+ /* main content styling */
113
+ h2 {
114
+ padding: 5px;
115
+ }
116
+ #main {
117
+ min-width: 800px;
118
+ }
119
+ #content {
120
+ clear: both;
121
+ }
122
+ #content_inside {
123
+ padding: 5px 10px 10px 10px;
124
+ margin: 0 10px;
125
+ background: #fff;
126
+ border-right: 2px solid #ccc;
127
+ border-bottom: 2px solid #ccc;
128
+ min-width: 800px;
129
+ }
130
+
131
+ #content.narrow {
132
+ float: left;
133
+ width: 70%;
134
+ }
135
+ #content.narrow #content_inside {
136
+ min-width: 560px;
137
+ }
138
+
139
+ #sidebar {
140
+ float: left;
141
+ width: 30%;
142
+ }
143
+ #sidebar_inside {
144
+ min-width: 240px;
145
+ margin: 0 10px 0 0;
146
+ }
147
+ .sidebar_box {
148
+ border-bottom: 2px solid #ccc;
149
+ }
150
+
151
+ /* style for forms */
152
+ form {
153
+ margin: 20px 0;
154
+ width: 500px;
155
+ }
156
+ form > div {
157
+ margin-bottom: 10px;
158
+ clear: both;
159
+ }
160
+ form > div div.col2 {
161
+ width: 200px;
162
+ float: left;
163
+ margin: 0 20px 10px 0;
164
+ }
165
+ label {
166
+ display: block;
167
+ }
168
+ fieldset {
169
+ border: 0;
170
+ border-top: 1px solid #ddd;
171
+ }
172
+ input[type="text"], input[type="password"] {
173
+ width: 200px;
174
+ }
175
+ textarea {
176
+ margin: 0;
177
+ }
178
+ input[type="submit"] {
179
+ margin-top: 20px;
180
+ }
181
+ form div.submit {
182
+ clear: both;
183
+ }
184
+
185
+ /* styling for errors */
186
+ .errorExplanation {
187
+ border: 2px solid #c00;
188
+ margin-bottom: 8px;
189
+ }
190
+ .errorExplanation h2 {
191
+ float: none;
192
+ background: #c00;
193
+ margin: 0;
194
+ color: #fff;
195
+ padding: 3px;
196
+ font-size: large;
197
+ }
198
+ .errorExplanation p {
199
+ padding: 3px;
200
+ margin: 3px 0;
201
+ }
202
+ .fieldWithErrors {
203
+ display: inline;
204
+ }
205
+ .fieldWithErrors input[type="text"], .fieldWithErrors input[type="password"] {
206
+ border: 2px solid #c00;
207
+ }
208
+ .fieldWithErrors label {
209
+ color: #c00;
210
+ }
211
+
212
+ /* style for tables that are used as reports */
213
+ table {
214
+ border-collapse: collapse;
215
+ margin-bottom: 30px;
216
+ }
217
+ table thead tr {
218
+ border-bottom: 1px solid #000;
219
+ }
220
+ table tbody td {
221
+ padding-right: 10px;
222
+ }
223
+
224
+ /* makes something 100% width */
225
+ .wide {
226
+ width: 100%;
227
+ }
228
+
229
+ /* style for pagination */
230
+ .pagination {
231
+ padding: 3px;
232
+ margin: 15px 3px 3px 3px;
233
+ }
234
+ .pagination a {
235
+ padding: 2px 5px 2px 5px;
236
+ margin: 2px;
237
+ border: 1px solid #aaaadd;
238
+ text-decoration: none;
239
+ color: #36393d;
240
+ }
241
+ .pagination a:hover, .pagination a:active {
242
+ border: 1px solid #36393d;
243
+ color: #000;
244
+ }
245
+ .pagination span.current {
246
+ padding: 2px 5px 2px 5px;
247
+ margin: 2px;
248
+ border: 1px solid #36393d;
249
+ font-weight: bold;
250
+ background-color: #36393d;
251
+ color: #FFF;
252
+ }
253
+ .pagination span.disabled {
254
+ padding: 2px 5px 2px 5px;
255
+ margin: 2px;
256
+ border: 1px solid #eee;
257
+ color: #ddd;
258
+ }
259
+
260
+ /* styles for flashed messages and errors */
261
+ #message {
262
+ background: #ff8;
263
+ font-weight: bold;
264
+ padding: 5px 20px;
265
+ margin-top: 10px;
266
+ }
267
+ #error {
268
+ background: #c00;
269
+ font-weight: bold;
270
+ color: #fff;
271
+ padding: 5px 20px;
272
+ margin-top: 10px;
273
+ }
@@ -0,0 +1,58 @@
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
+ </style>
15
+ </head>
16
+ <body>
17
+ <div id="header">
18
+ <h1><%= ControlCenter::Config.app_title %></h1>
19
+ <ul id="header_links">
20
+ <%= render :partial => "layouts/header_links" %>
21
+ </ul>
22
+ </div>
23
+
24
+ <ul id="tabs">
25
+ <%= render :partial => "layouts/tabs" %>
26
+ </ul>
27
+
28
+ <% if flash[:message] %>
29
+ <div id="message"><%= flash[:message] %></div>
30
+ <% end %>
31
+
32
+ <% if flash[:error] %>
33
+ <div id="error"><%= flash[:error] %></div>
34
+ <% end %>
35
+
36
+ <ul id="sub_tabs" <%= "class=\"narrow\"" if sidebar? %>>
37
+ <%= yield :sub_tabs %>
38
+ </ul>
39
+
40
+ <div id="main">
41
+ <div id="content" <%= "class=\"narrow\"" if sidebar? %>>
42
+ <div id="content_inside">
43
+ <h2><%= @control_center_title %></h2>
44
+
45
+ <%= yield %>
46
+ </div>
47
+ </div>
48
+
49
+ <% if sidebar? %>
50
+ <div id="sidebar">
51
+ <div id="sidebar_inside">
52
+ <%= yield :sidebar %>
53
+ </div>
54
+ </div>
55
+ <% end %>
56
+ </div>
57
+ </body>
58
+ </html>
@@ -0,0 +1,5 @@
1
+ # This is an initializer script for Control Center. Customize it to your
2
+ # preferences
3
+
4
+ ControlCenter::Config.app_title = "Control Center"
5
+ ControlCenter::Config.theme_color = "#0033CC"
@@ -0,0 +1,6 @@
1
+ module ControlCenter
2
+ class Config
3
+ cattr_accessor :app_title
4
+ cattr_accessor :theme_color
5
+ end
6
+ end
data/lib/generator.rb ADDED
@@ -0,0 +1,10 @@
1
+ class ControlCenterGenerator < Rails::Generator::Base
2
+
3
+ def manifest
4
+
5
+ end
6
+
7
+ def banner
8
+ "Usage: #{$0} #{spec.name} [app_name]"
9
+ end
10
+ end
data/lib/helpers.rb ADDED
@@ -0,0 +1,62 @@
1
+ require 'tab_builder'
2
+
3
+ # Helpers that control center uses
4
+ module ControlCenter::Helpers
5
+
6
+ def title(title)
7
+ @control_center_title = title
8
+ end
9
+
10
+ def select_tab(tab)
11
+ @cc_current_tab = tab
12
+ end
13
+ def current_tab
14
+ @cc_current_tab
15
+ end
16
+
17
+ def sub_tabs
18
+ if block_given?
19
+ content_for :sub_tabs do
20
+ yield
21
+ end
22
+ end
23
+ end
24
+
25
+ def select_sub_tab(tab)
26
+ @cc_current_sub_tab = tab
27
+ end
28
+ def current_sub_tab
29
+ @cc_current_sub_tab
30
+ end
31
+
32
+ # Sets up a sidebar in control center.
33
+ def sidebar(&block)
34
+ if block_given?
35
+ @sidebar_set = true
36
+ content_for :sidebar do
37
+ yield
38
+ end
39
+ end
40
+ end
41
+
42
+ def sidebar?
43
+ @sidebar_set ||= false
44
+ @sidebar_set
45
+ end
46
+
47
+ def tab(tab_name, tab_url)
48
+ options = {}
49
+ options[:class] = "active" if current_tab == tab_name
50
+ content_tag "li", options, true do
51
+ link_to tab_name, tab_url
52
+ end
53
+ end
54
+
55
+ def sub_tab(tab_name, tab_url)
56
+ options = {}
57
+ options[:class] = "active" if current_sub_tab == tab_name
58
+ content_tag "li", options, true do
59
+ link_to tab_name, tab_url
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,12 @@
1
+ module ControlCenter
2
+ class TabBuilder
3
+
4
+ def initialize(&block)
5
+ @block = block
6
+ end
7
+
8
+ def tab(tab_name, url)
9
+ @block.call(tab_name, url)
10
+ end
11
+ end
12
+ end
data/rails/init.rb ADDED
@@ -0,0 +1,6 @@
1
+ # Include hook code here
2
+ require File.join(File.dirname(__FILE__), "../lib/control_center.rb")
3
+ require File.join(File.dirname(__FILE__), "../lib/helpers.rb")
4
+
5
+ # Include the helpers we've written
6
+ ActionView::Base.send :include, ControlCenter::Helpers
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :control_center do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,8 @@
1
+ require 'test/unit'
2
+
3
+ class ControlCenterTest < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_this_plugin
6
+ flunk
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commondream-control_center
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.99"
4
+ version: 0.99.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Johnson
@@ -13,7 +13,7 @@ date: 2009-04-08 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description:
16
+ description: Control Center is a Rails plugin that helps in quickly developing interfaces for website administration and application prototyping.
17
17
  email: alan@commondream.net
18
18
  executables: []
19
19
 
@@ -22,6 +22,22 @@ extensions: []
22
22
  extra_rdoc_files: []
23
23
 
24
24
  files:
25
+ - lib/control_center.rb
26
+ - lib/generator.rb
27
+ - lib/helpers.rb
28
+ - lib/tab_builder.rb
29
+ - rails/init.rb
30
+ - generators/control_center
31
+ - generators/control_center/control_center_generator.rb
32
+ - generators/control_center/templates
33
+ - generators/control_center/templates/_header_links.html.erb
34
+ - generators/control_center/templates/_sub_tabs.html.erb
35
+ - generators/control_center/templates/_tabs.html.erb
36
+ - generators/control_center/templates/control_center.css
37
+ - generators/control_center/templates/control_center.html.erb
38
+ - generators/control_center/templates/control_center.rb
39
+ - tasks/control_center_tasks.rake
40
+ - test/control_center_test.rb
25
41
  - README.markdown
26
42
  - MIT-LICENSE
27
43
  has_rdoc: true
@@ -49,6 +65,6 @@ rubyforge_project:
49
65
  rubygems_version: 1.2.0
50
66
  signing_key:
51
67
  specification_version: 2
52
- summary: Control Center is a Rails plugin that helps in quickly developing interfaces for website administration and application prototyping.
68
+ summary: A Rails plugin that helps in quickly developing admin style interfaces.
53
69
  test_files: []
54
70