commondream-control_center 0.99.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.markdown +143 -7
  3. metadata +1 -1
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008 [name of plugin creator]
1
+ Copyright (c) 2008-2009 Alan Johnson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -1,13 +1,149 @@
1
- ControlCenter
2
- =============
1
+ Control Center
2
+ ==============
3
3
 
4
- Introduction goes here.
4
+ Control Center is a Rails plugin for bootstrapping the interface side of an application very quickly. It provides an interface with tabs and subtabs, and with a few nice default styles. Control Center is can be installed through the rails script/plugin script, or as a RubyGem.
5
5
 
6
+ Installation As A Rails Plugin
7
+ ------------------------------
8
+ While we recommend installing as a RubyGem, installing as a Rails plugin is dead simple. From within the root of your Rails project do:
6
9
 
7
- Example
8
- =======
10
+ script/plugin install git://github.com/commondream/control_center.git
11
+ script/generate control_center
9
12
 
10
- Example goes here.
13
+ Installation As A RubyGem
14
+ -------------------------
15
+ Installation as a RubyGem ensures that you don't get any weirdness due to installing directly from the repository. Make sure you have GitHub in your gem sources before you try to do the install.
11
16
 
17
+ gem install commondream-control_center
12
18
 
13
- Copyright (c) 2008 [name of plugin creator], released under the MIT license
19
+ Now that you've got the gem installed, you'll need to configure your application to use control center. Add a line like the following to your environment.rb:
20
+
21
+ config.gem "commondream-control_center"
22
+
23
+ Now, from the root of your rails project, run the following command:
24
+
25
+ script/generate control_center
26
+
27
+ Post-Installation Configuration
28
+ -------------------------------
29
+ You'll want to look at environment/initializers/control_center.rb to customize the Control Center title and the color of the header. Also, you'll want to set your tabs up in app/views/layouts/_tabs.html.erb.
30
+
31
+ Tabs
32
+ ----
33
+ Tabs are defined by default in the app/views/layouts/_tabs.html.erb partial. You can override the tabs in any page with the tabs helper.
34
+
35
+ Tabs are defined as follows:
36
+
37
+ <%= tab "Title", "url" %>
38
+
39
+ You can create as many tabs as you would like, but be aware that at present the tabs will simply wrap to the next line if you include too many. We'll hopefully fix that in a future release, although you probably shouldn't use so many tabs that it would wrap anyway.
40
+
41
+ The tab method passes the url on to the Rails link_to helper, so the url can be a has or anything else that link_to accepts for its url parameter.
42
+
43
+ To select a tab, simply use the select_tab method in your view. select_tab chooses a tab based on the title given to the tab, so for example, with a tab definition like:
44
+
45
+ <%= tab "Tab 1", "/some_url" %>
46
+ <%= tab "Tab 2", "/some_other_url" %>
47
+
48
+ if you called:
49
+
50
+ <% select_tab "Tab 1" %>
51
+
52
+ in your view, the tab titled *Tab 1* would be selected.
53
+
54
+ Subtabs
55
+ -------
56
+ Subtabs will typically be defined in a partial that you create and included in the views that use that particular set of subtabs. Although that's typical,
57
+ it's not mandatory. The app/views/layouts/_tabs.html.erb partial is another
58
+ great spot to put subtabs if you want to do more of a per-app tab configuration,
59
+ but that's tricker to implement in many cases. Anyway, a set of subtabs will
60
+ look something like this in your view:
61
+
62
+ <% sub_tabs do %>
63
+ <%= sub_tab "Sub Tab", "/subtab" %>
64
+ <%= sub_tab "Sub Tab 2", "/subtab2" %>
65
+ <% end %>
66
+
67
+ You can select what tab to mark as the current one with the select_sub_tab helper:
68
+
69
+ <% select_sub_tab "Sub Tab" %>
70
+
71
+ The sub_tabs helper does not output the tabs, because the Control Center
72
+ layout has a specific place where it needs to put them. So, don't worry about
73
+ where you put the sub tab definition in your view... as long as its in your
74
+ view, they'll show up correctly.
75
+
76
+ Header Navigation
77
+ -----------------
78
+ The content at the very top right of Control Center is great for login/logout links, help links, etc. You can modify that content by editing the app/views/layouts/_header_links.html.erb partial.
79
+
80
+ Sidebars
81
+ --------
82
+ Control Center has two primary layouts at present, a single column display and a two column display. The two column display shows a sidebar to the right side of the screen. To generate content for the sidebar, simply put normal content, like p, div, ul tags into the sidebar helper in your view:
83
+
84
+ <% sidebar do %>
85
+ <h3>This is a sidebar!</h3>
86
+
87
+ <p>
88
+ Aw, yeah! This is a sidebar. Didn't think you'd be creating sidebars
89
+ today, did you? Well, you are!
90
+ </p>
91
+ <% end %>
92
+
93
+ Forms
94
+ -----
95
+ Forms in Control Center are fairly simple to implement. Control Center puts labels above fields and allows you to do either a single column of fields in your form or to do two columns.
96
+
97
+ The markup for a field should look something like the following:
98
+
99
+ <div>
100
+ <label for="username">Username</label>
101
+ <input type="text" name="username" id="username" />
102
+ </div>
103
+
104
+ Of course, if you used the Rails helpers, it might look more like:
105
+
106
+ <div>
107
+ <%= f.label :username %>
108
+ <%= f.text_field :username %>
109
+ </div>
110
+
111
+ If you would like a two column layout, use markup similar to the following:
112
+
113
+ <div>
114
+ <div class="col2">
115
+ [FIELD GOES HERE]
116
+ </div>
117
+ <div class="col2">
118
+ [FIELD GOES HERE]
119
+ </div>
120
+ </div>
121
+
122
+ Control Center includes styles for the error states of the Rails helpers, and for the error_messages helper, so that you won't have to create style rules yourself.
123
+
124
+ Where are the tests?
125
+ --------------------
126
+ I'm usually very good about testing my code, but I wasn't sure of the best way to test something that was so interface intensive, so tests simply aren't present for the 1.0 release. Tests are one of my biggest goals for the 1.1 release.
127
+
128
+ License
129
+ -------
130
+ Copyright (c) 2008-2009 Alan Johnson
131
+
132
+ Permission is hereby granted, free of charge, to any person obtaining
133
+ a copy of this software and associated documentation files (the
134
+ "Software"), to deal in the Software without restriction, including
135
+ without limitation the rights to use, copy, modify, merge, publish,
136
+ distribute, sublicense, and/or sell copies of the Software, and to
137
+ permit persons to whom the Software is furnished to do so, subject to
138
+ the following conditions:
139
+
140
+ The above copyright notice and this permission notice shall be
141
+ included in all copies or substantial portions of the Software.
142
+
143
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
144
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
145
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
146
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
147
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
148
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
149
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Johnson