merb-ui 0.4.2 → 0.4.3

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.
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ spec = Gem::Specification.new do |s|
14
14
  s.name = 'merb-ui'
15
15
  s.rubyforge_project = 'uipoet'
16
16
  s.summary = 'User Interface Components for Merb'
17
- s.version = '0.4.2'
17
+ s.version = '0.4.3'
18
18
  end
19
19
 
20
20
  Rake::GemPackageTask.new(spec) do |pkg|
@@ -0,0 +1,7 @@
1
+ class MerbUi::Messages < MerbUi::Application
2
+
3
+ def index
4
+ render :layout => false
5
+ end
6
+
7
+ end
@@ -28,18 +28,11 @@ module Merb::GlobalHelpers
28
28
  end
29
29
 
30
30
  def mui_body(options = {}, &block)
31
- attributes={}
31
+ attributes = {}
32
32
  attributes[:class] = 'mui_desktop'
33
33
  attributes[:class] << ' mui_gallery' if controller_name == 'merb_photos/photos'
34
- output = ''
35
- if message = session[:mui_message]
36
- message_content = mui_button(:title => '&#215;', :message => 'close')
37
- message_content << message[:title] if message[:title]
38
- message_content << message[:body] if message[:body]
39
- output << tag(:div, message_content, :class => "mui_message mui_message_#{message[:tone]}")
40
- session.delete(:mui_message)
41
- end
42
- output << capture(&block)
34
+ body = ''
35
+ body << capture(&block)
43
36
  copyright_now = Time.now.year
44
37
  copyright_then = MerbUi[:year] || copyright_now
45
38
  if copyright_now == copyright_then
@@ -50,13 +43,22 @@ module Merb::GlobalHelpers
50
43
  copyright_owner = " #{MerbUi[:owner]}" if MerbUi[:owner]
51
44
  copyright_text = "Copyright &copy; #{copyright_years}#{copyright_owner}. All rights reserved."
52
45
  copyright = tag(:div, copyright_text, :class => 'mui_copyright')
53
- output << tag(:div, catch_content(:for_layout) + copyright, attributes)
54
- output << tag(:div, :class => 'mui_window_target')
46
+ body << tag(:div, catch_content(:for_layout) + copyright, attributes)
47
+ body << tag(:div, :class => 'mui_window_target')
48
+ body << tag(:div, :class => 'mui_message_target')
55
49
  if session[:mui_window]
56
- output << tag(:script, "windowOpen('#{session[:mui_window]}');", :type => 'text/javascript')
50
+ script_window = "muiWindowOpen('#{session[:mui_window]}');"
57
51
  session.delete(:mui_window)
58
52
  end
59
- output
53
+ if session[:mui_message]
54
+ script_message = "muiMessageOpen('#{session[:mui_message]}');"
55
+ session.delete(:mui_message)
56
+ end
57
+ script = ''
58
+ if script_window || script_message
59
+ script << tag(:script, "$(document).ready(function(){#{script_window}#{script_message}});", :type => 'text/javascript')
60
+ end
61
+ tag(:div, body, :class => 'mui') + script
60
62
  end
61
63
 
62
64
  def mui_browser
@@ -75,7 +77,7 @@ module Merb::GlobalHelpers
75
77
  def mui_button(options = {}, &block)
76
78
  attributes = {}
77
79
  attributes[:class] = 'mui_button'
78
- attributes[:class] << " mui_button_tone_#{options[:tone] || 'neutral'}"
80
+ attributes[:class] << " mui_button_#{options[:tone]}" if options[:tone]
79
81
  attributes[:class] << ' mui_click'
80
82
  attributes[:class] << "_message_#{options[:message]}" if options[:message]
81
83
  attributes[:class] << "_window_#{options[:window]}" if options[:window]
@@ -138,7 +140,7 @@ module Merb::GlobalHelpers
138
140
 
139
141
  def mui_delete(options = {})
140
142
  attributes = {}
141
- attributes[:class] = 'mui_button mui_button_tone_negative'
143
+ attributes[:class] = 'mui_button mui_button_negative'
142
144
  attributes[:style] = "width:#{options[:width]};" if options[:width]
143
145
  delete_button(options[:url], options[:title], attributes)
144
146
  end
@@ -171,14 +173,14 @@ module Merb::GlobalHelpers
171
173
  def mui_head
172
174
  jquery = tag(:script, '', :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js', :type => 'text/javascript')
173
175
  jquery_ui = tag(:script, '', :src => 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.5/jquery-ui.min.js', :type => 'text/javascript')
174
- require_css('master', 'mui')
175
- require_js("#{mui_path :javascript}/dimensions", "#{mui_path :javascript}/keybinder", "#{mui_path :javascript}/main")
176
+ require_css 'mui'
177
+ require_js("#{mui_path :javascript}/keybinder", "#{mui_path :javascript}/main")
176
178
  jquery + jquery_ui + include_required_js + include_required_css + catch_content(:feeds)
177
179
  end
178
180
 
179
- def mui_hyper_text(name, options = {})
181
+ def mui_textarea(name, options = {})
180
182
  attributes = {}
181
- attributes[:class] = 'mui_hyper_text'
183
+ attributes[:class] = 'mui_textarea'
182
184
  attributes[:class] << ' mui_focus' if options[:focus] == true
183
185
  attributes[:label] = options[:title]
184
186
  text_area(name, attributes)
@@ -227,13 +229,25 @@ module Merb::GlobalHelpers
227
229
  tag(:ul, children, :class => 'mui_list')
228
230
  end
229
231
 
232
+ def mui_message(options = {}, &block)
233
+ bar_content = ''
234
+ bar_content << tag(:td, options[:title], :class => 'mui_message_title') if options[:title]
235
+ bar_content << tag(:td, mui_button(:title => '&#215;', :message => 'close'), :class => 'mui_message_bar_end')
236
+ bar = tag(:tr, tag(:td, tag(:table, tag(:tr, bar_content), :class => 'mui_message_bar')))
237
+ content = tag(:tr, tag(:td, capture(&block), :class => 'mui_message_content'))
238
+ message_attributes = {}
239
+ message_attributes[:class] = 'mui_message'
240
+ message_attributes[:class] << " mui_message_#{options[:tone]}" if options[:tone]
241
+ tag(:div, tag(:table, bar + content), message_attributes)
242
+ end
243
+
230
244
  def mui_paragraph(options={}, &block)
231
245
  tag(:p, (capture(&block) if block_given?), :class => 'mui_paragraph')
232
246
  end
233
247
 
234
248
  def mui_password(name, options = {})
235
249
  attributes = {}
236
- attributes[:class] = 'mui_password'
250
+ attributes[:class] = 'mui_input'
237
251
  attributes[:class] << ' mui_focus' if options[:focus] == true
238
252
  attributes[:label] = options[:title]
239
253
  password_field(name, attributes)
@@ -245,7 +259,7 @@ module Merb::GlobalHelpers
245
259
 
246
260
  def mui_search(options = {})
247
261
  attributes = {}
248
- attributes[:class] = 'mui_search'
262
+ attributes[:class] = 'mui_input mui_search'
249
263
  attributes[:name] = :q
250
264
  attributes[:style] = "width:#{options[:width]};" if options[:width]
251
265
  attributes[:type] = :text
@@ -295,7 +309,7 @@ module Merb::GlobalHelpers
295
309
 
296
310
  def mui_text(name, options = {})
297
311
  attributes = {}
298
- attributes[:class] = 'mui_text'
312
+ attributes[:class] = 'mui_input'
299
313
  attributes[:class] << ' mui_focus' if options[:focus] == true
300
314
  attributes[:label] = options[:title]
301
315
  attributes[:maxlength] = options[:length] || 50
@@ -343,14 +357,13 @@ module Merb::GlobalHelpers
343
357
  end
344
358
 
345
359
  def mui_window(options = {}, &block)
346
- script = js_include_tag("#{mui_path :javascript}/window")
347
360
  bar_content = ''
348
361
  bar_content << tag(:td, options[:buttons], :class => 'mui_bar_buttons') if options[:buttons]
349
362
  bar_content << tag(:td, options[:title], :class => 'mui_window_title') if options[:title]
350
363
  bar_content << tag(:td, mui_button(:title => '&#215;', :window => 'close'), :class => 'mui_window_bar_end')
351
364
  bar = tag(:tr, tag(:td, tag(:table, tag(:tr, bar_content), :class => 'mui_window_bar')))
352
365
  content = tag(:tr, tag(:td, capture(&block), :class => 'mui_window_content'))
353
- script + tag(:table, bar + content, :class => 'mui_window')
366
+ tag(:table, bar + content, :class => 'mui_window')
354
367
  end
355
368
 
356
369
  def mui_window_redirect
@@ -0,0 +1,3 @@
1
+ <%= mui_message(:title => params[:title], :tone => params[:tone]) do %>
2
+ <%= params[:body] %>
3
+ <% end =%>
@@ -1,67 +1,57 @@
1
1
  <%= @browser -%>
2
- * {
3
- font-family: "Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", sans-serif;
4
- font-size: 1em;
2
+ body {
5
3
  margin: 0;
6
- padding: 0;
7
4
  }
8
- body {
9
- font-size: 13px;
5
+ .mui {
6
+ font-size: 12px;
10
7
  }
11
- code, code em, pre {
12
- font-family: 'Bitstream Vera Sans Mono', 'Monaco', 'Lucida Console' monospace;
8
+ .mui * {
9
+ font-family: 'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode', sans-serif;
10
+ font-size: 1em;
11
+ margin: 0;
12
+ padding: 0;
13
13
  }
14
- code, pre {
15
- font-size: 0.85em;
14
+ .mui code, .mui pre, .mui_textarea {
15
+ font: 0.9em 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
16
16
  }
17
- code {
18
- background-color: <%= color(0.1, 0.1, 0.1) %>;
17
+ .mui code {
18
+ background: <%= color(0.1, 0.1, 0.1) %>;
19
19
  color: <%= color(1, 1, 1) %>;
20
20
  display: block;
21
21
  overflow: auto;
22
22
  padding: 1em;
23
23
  white-space: pre;
24
24
  }
25
- code em {
25
+ .mui code em {
26
26
  color: <%= color(0, 1, 0) %>;
27
- font-style: normal;
28
- font-weight: normal;
27
+ font: normal normal;
29
28
  }
30
- kbd {
31
- background-color: <%= color(0.9, 0.9, 0.9) %>;
32
- border-color: <%= color(0.8, 0.8, 0.8) %>;
33
- border-style: solid;
34
- border-width: 1px;
29
+ .mui kbd {
30
+ background: <%= color(0.9, 0.9, 0.9) %>;
31
+ border: 1px solid <%= color(0.8, 0.8, 0.8) %>;
35
32
  padding: 0 0.5em 0.2em 0.5em;
36
33
  <%= round %>
37
34
  }
38
- label, .mui_title {
35
+ .mui label, .mui_title {
39
36
  font-weight: bold;
40
37
  }
41
- label {
38
+ .mui label {
42
39
  display: block;
43
- font-size: 0.85em;
40
+ font-size: 0.9em;
44
41
  }
45
- select.date {
42
+ .mui select.date {
46
43
  margin-top: 0.25em;
47
44
  }
48
- select.month, select.day {
45
+ .mui select.month, .mui select.day {
49
46
  margin-right: 0.25em;
50
47
  }
51
48
 
52
49
  /* bar */
53
50
 
54
51
  .mui_bar {
55
- background-color: <%= color(0.2, 0.2, 0.2) %>;
56
- background-image: url('<%= mui_path :image %>/rubber.png');
57
- background-position: center center;
58
- background-repeat: repeat-x;
59
- border-bottom-color: <%= color(0, 0, 0) %>;
60
- border-bottom-style: solid;
61
- border-bottom-width: 1px;
62
- border-top-color: <%= color(0.2, 0.2, 0.2) %>;
63
- border-top-style: solid;
64
- border-top-width: 1px;
52
+ background: <%= color(0.2, 0.2, 0.2) %> url('<%= mui_path :image %>/rubber.png') repeat-x center;
53
+ border-bottom: 1px solid <%= color(0, 0, 0) %>;
54
+ border-top: 1px solid <%= color(0.2, 0.2, 0.2) %>;
65
55
  color: <%= color(1, 1, 1) %>;
66
56
  padding: 0.5em 1.5em 0.5em 1.5em;
67
57
  }
@@ -76,9 +66,7 @@ select.month, select.day {
76
66
  }
77
67
  .mui_block_status {
78
68
  background-image: url('<%= mui_path :image %>/glass.png');
79
- border-color: <%= color(0, 0, 0) %>;
80
- border-style: solid;
81
- border-width: 1px;
69
+ border: 1px solid <%= color(0, 0, 0) %>;
82
70
  color: <%= color(0.5, 0.5, 0.5) %>;
83
71
  padding: 0.5em;
84
72
  position: absolute;
@@ -97,50 +85,42 @@ span.mui_block {
97
85
  /* button */
98
86
 
99
87
  .mui_button {
100
- background-image: url('<%= mui_path :image %>/plastic.png');
101
- background-position: center center;
102
- background-repeat: repeat-x;
103
- border-style: solid;
104
- border-width: 1px;
88
+ background: <%= color(0.1, 0.1, 0.1) %> url('<%= mui_path :image %>/plastic.png') repeat-x center;
89
+ border: 1px outset <%= color(0.1, 0.1, 0.1) %>;
105
90
  color: <%= color(1, 1, 1) %>;
106
- line-height: 1.5em;
107
- min-height: 1.5em;
91
+ line-height: 1.7em;
92
+ min-height: 1.7em;
108
93
  padding: 0 1em 0 1em;
109
94
  text-align: center;
110
95
  <%= round %>
111
96
  }
112
- .mui_button_tone_neutral {
113
- background-color: <%= color(0.1, 0.1, 0.1) %>;
114
- border-color: <%= color(0.1, 0.1, 0.1) %>;
115
- }
116
- .mui_button_tone_neutral:hover {
97
+ .mui_button:hover {
117
98
  background-color: <%= color(0.2, 0.2, 0.2) %>;
99
+ border-color: <%= color(0.2, 0.2, 0.2) %>;
118
100
  }
119
- .mui_button_tone_positive {
120
- background-color: <%= color(0.1, 0.5, 0.1) %>;
121
- border-color: <%= color(0.1, 0.5, 0.1) %>;
122
- }
123
- .mui_button_tone_positive:hover {
124
- background-color: <%= color(0.2, 0.6, 0.2) %>;
125
- }
126
- .mui_button_tone_negative {
101
+ .mui_button_negative {
127
102
  background-color: <%= color(0.6, 0, 0) %>;
128
103
  border-color: <%= color(0.6, 0, 0) %>;
129
104
  }
130
- .mui_button_tone_negative:hover {
105
+ .mui_button_negative:hover {
131
106
  background-color: <%= color(0.7, 0.1, 0.1) %>;
107
+ border-color: <%= color(0.7, 0.1, 0.1) %>;
108
+ }
109
+ .mui_button_positive {
110
+ background-color: <%= color(0.1, 0.5, 0.1) %>;
111
+ border-color: <%= color(0.1, 0.5, 0.1) %>;
112
+ }
113
+ .mui_button_positive:hover {
114
+ background-color: <%= color(0.2, 0.6, 0.2) %>;
115
+ border-color: <%= color(0.2, 0.6, 0.2) %>;
132
116
  }
133
117
  button.mui_button {
134
118
  padding: 0.5em;
135
119
  text-align: left;
136
120
  }
137
121
  button.mui_button img {
138
- border-bottom-color: <%= color(0.3, 0.3, 0.3) %>;
139
- border-left-color: <%= color(0.3, 0.3, 0.3) %>;
140
- border-right-color: <%= color(0.3, 0.3, 0.3) %>;
141
- border-top-color: <%= color(0.4, 0.4, 0.4) %>;
142
- border-style: solid;
143
- border-width: 1px;
122
+ border: 1px solid <%= color(0.3, 0.3, 0.3) %>;
123
+ border: 1px inset <%= color(0.4, 0.4, 0.4) %>;
144
124
  <%= round %>
145
125
  }
146
126
  button.mui_button table {
@@ -150,19 +130,18 @@ button.mui_button td {
150
130
  padding-right: 1em;
151
131
  }
152
132
 
153
- /* checkbox */
133
+ /* check */
154
134
 
155
- .mui_checkbox {
156
- vertical-align: middle;
135
+ .mui_check {
136
+ margin-right: 0.5em;
157
137
  }
158
138
 
159
139
  /* copyright */
160
140
 
161
141
  .mui_copyright {
162
142
  color: <%= color(0.5, 0.5, 0.5) %>;
163
- font-size: 0.85em;
164
- padding-bottom: 2em;
165
- padding-top: 4em;
143
+ font-size: 0.9em;
144
+ padding: 4em 0 2em 0;
166
145
  text-align: center;
167
146
  }
168
147
 
@@ -170,15 +149,13 @@ button.mui_button td {
170
149
 
171
150
  .mui_date {
172
151
  color: <%= color(0.5, 0.5, 0.5) %>;
173
- font-size: 0.85em;
152
+ font-size: 0.9em;
174
153
  }
175
154
 
176
155
  /* desktop */
177
156
 
178
157
  .mui_desktop {
179
- padding-left: 1.5em;
180
- padding-right: 1.5em;
181
- padding-top: 1.5em;
158
+ padding: 1.5em 1.5em 0 1.5em;
182
159
  }
183
160
 
184
161
  /* divider */
@@ -187,42 +164,7 @@ button.mui_button td {
187
164
  background: <%= color(0.85, 0.85, 0.85) %>;
188
165
  border: none;
189
166
  height: 1px;
190
- margin-bottom: 1em;
191
- margin-left: 0.5em;
192
- margin-right: 0.5em;
193
- margin-top: 2em;
194
- }
195
-
196
- /* form */
197
-
198
- .mui_check {
199
- margin-right: 0.5em;
200
- }
201
- .mui_hyper_text, .mui_menu, .mui_password, .mui_search, .mui_text {
202
- background-color: <%= color(1, 1, 1) %>;
203
- border-bottom-color: <%= color(0.75, 0.75, 0.75) %>;
204
- border-left-color: <%= color(0.65, 0.65, 0.65) %>;
205
- border-right-color: <%= color(0.65, 0.65, 0.65) %>;
206
- border-style: solid;
207
- border-top-color: <%= color(0.55, 0.55, 0.55) %>;
208
- border-width: 1px;
209
- color: <%= color(0, 0, 0) %>;
210
- display: inline-block;
211
- line-height: 1.5em;
212
- min-height: 1.5em;
213
- padding: 0 0.25em 0 0.25em;
214
- <%= round %>
215
- }
216
- .mui_search {
217
- margin-right: 0.5em;
218
- }
219
- .mui_menu {
220
- height: 20em;
221
- }
222
- .mui_hyper_text {
223
- font-family: 'Bitstream Vera Sans Mono', 'Monaco', 'Lucida Console' monospace;
224
- height: 20em;
225
- width: 40em;
167
+ margin: 2em 0.5em 1em 0.5em;
226
168
  }
227
169
 
228
170
  /* gallery */
@@ -255,26 +197,34 @@ button.mui_button td {
255
197
  border-width: 1px;
256
198
  }
257
199
 
200
+ /* input */
201
+
202
+ .mui_input {
203
+ background: <%= color(0.9, 0.9, 0.9) %> url('<%= mui_path :image %>/bezel.png') repeat-x;
204
+ border: 1px inset <%= color(0.9, 0.9, 0.9) %>;
205
+ display: inline-block;
206
+ font-weight: bold;
207
+ line-height: 1.7em;
208
+ min-height: 1.7em;
209
+ padding: 0 0.4em 0 0.4em;
210
+ <%= round %>
211
+ }
212
+
258
213
  /* link */
259
214
 
260
- .mui_link {
215
+ .mui_link:link {
261
216
  color: <%= color(0, 0.2, 1) %>;
262
217
  text-decoration: none;
263
218
  }
264
219
  .mui_link:visited {
265
220
  color: <%= color(0.5, 0.25, 0.5) %>;
266
221
  }
267
- .mui_link:active {
268
- color: <%= color(0.1, 0.6, 1) %>;
269
- outline: 0;
222
+ .mui_link:hover {
270
223
  text-decoration: underline;
271
224
  }
272
- .mui_link:focus {
273
- color: <%= color(0.1, 0.6, 1) %>;
225
+ .mui_link:active, .mui_link:focus {
274
226
  outline: 0;
275
- }
276
- .mui_link:hover {
277
- text-decoration: underline;
227
+ text-decoration: none;
278
228
  }
279
229
 
280
230
  /* list */
@@ -290,6 +240,7 @@ button.mui_button td {
290
240
  /* menu */
291
241
 
292
242
  .mui_menu {
243
+ height: 20em;
293
244
  padding-left: 2px;
294
245
  padding-right: 2px;
295
246
  }
@@ -298,33 +249,35 @@ button.mui_button td {
298
249
 
299
250
  .mui_message {
300
251
  background-image: url('<%= mui_path :image %>/glass.png');
301
- border-style: solid;
302
- border-bottom-width: 1px;
303
- border-left-width: 1px;
304
- border-right-width: 1px;
252
+ border: 1px solid <%= color(0, 0, 0) %>;
305
253
  border-top-width: 0;
306
- color: <%= color(1, 1, 1) %>;
307
- display: none;
308
- line-height: 2em;
309
- max-width: 60%;
310
- min-width: 40%;
311
254
  padding: 1em;
312
- white-space: nowrap;
313
255
  <%= round(:bottom_left => true, :bottom_right => true) %>
314
256
  }
315
- .mui_message input.mui_button {
316
- position: absolute;
317
- right: 1em;
318
- top: 1em;
257
+ .mui_message table {
258
+ border-collapse: collapse;
259
+ }
260
+ .mui_message_bar {
261
+ color: <%= color(1, 1, 1) %>;
262
+ height: 2em;
263
+ width: 100%;
264
+ }
265
+ .mui_message_bar_end {
266
+ padding: 0 0 0 1em;
267
+ text-align: right;
268
+ }
269
+ .mui_message_content {
270
+ color: <%= color(1, 1, 1) %>;
271
+ line-height: 2em;
319
272
  }
320
- .mui_message_positive {
273
+ .mui_message_positive{
321
274
  border-color: <%= color(0, 0.6, 0) %>;
322
275
  }
323
- .mui_message_negative {
276
+ .mui_message_negative{
324
277
  border-color: <%= color(0.6, 0, 0) %>;
325
278
  }
326
- .mui_message_neutral {
327
- border-color: <%= color(0, 0, 0) %>;
279
+ .mui_message_target {
280
+ display: none;
328
281
  }
329
282
 
330
283
  /* paragraph */
@@ -341,7 +294,7 @@ p.mui_paragraph+p.mui_paragraph {
341
294
  /* quote */
342
295
 
343
296
  .mui_quote {
344
- background-color: #e5e5e5;
297
+ background-color: <%= color(0.95, 0.95, 0.95) %>;
345
298
  }
346
299
 
347
300
  /* scroll */
@@ -350,13 +303,21 @@ p.mui_paragraph+p.mui_paragraph {
350
303
  overflow: auto;
351
304
  }
352
305
 
306
+ /* search */
307
+
308
+ .mui_search {
309
+ background-color: <%= color(0.2, 0.2, 0.2) %>;
310
+ border-color: <%= color(0.3, 0.3, 0.3) %>;
311
+ color: <%= color(1, 1, 1) %>;
312
+ font-weight: normal;
313
+ margin-right: 0.5em;
314
+ }
315
+
353
316
  /* status */
354
317
 
355
318
  .mui_status {
356
- background-image: url('<%= mui_path :image %>/glass.png');
357
- border-color: <%= color(0, 0, 0) %>;
358
- border-style: solid;
359
- border-width: 1px;
319
+ background: url('<%= mui_path :image %>/glass.png');
320
+ border: 1px solid <%= color(0, 0, 0) %>;
360
321
  color: <%= color(0.5, 0.5, 0.5) %>;
361
322
  padding: 0.5em;
362
323
  position: absolute;
@@ -369,7 +330,7 @@ p.mui_paragraph+p.mui_paragraph {
369
330
 
370
331
  .mui_subtle {
371
332
  color: <%= color(0.25, 0.25, 0.25) %>;
372
- font-size: 0.85em;
333
+ font-size: 0.9em;
373
334
  }
374
335
  .mui_subtle b {
375
336
  color: <%= color(0, 0, 0) %>;
@@ -378,23 +339,15 @@ p.mui_paragraph+p.mui_paragraph {
378
339
  /* tab */
379
340
 
380
341
  .mui_tab {
381
- background-color: <%= color(0.1, 0.1, 0.1) %>;
382
- background-image: url('<%= mui_path :image %>/plastic.png');
383
- background-position: center center;
384
- background-repeat: repeat-x;
385
- border-color: <%= color(0.1, 0.1, 0.1) %>;
386
- border-style: solid;
387
- border-width: 1px;
388
- border-left-style: none;
389
- color: <%= color(1, 1, 1) %>;
342
+ background: <%= color(0.1, 0.1, 0.1) %> url('<%= mui_path :image %>/plastic.png') repeat-x center;
343
+ border: 1px outset <%= color(0.1, 0.1, 0.1) %>;
390
344
  color: <%= color(1, 1, 1) %>;
391
- line-height: 1.5em;
392
- min-height: 1.5em;
345
+ line-height: 1.7em;
346
+ min-height: 1.7em;
393
347
  padding: 0 1em 0 1em;
394
348
  text-align: center;
395
349
  }
396
350
  .mui_tab:first-child {
397
- border-left-style: solid;
398
351
  <%= round(:bottom_left => true, :top_left => true) %>
399
352
  }
400
353
  .mui_tab:last-child {
@@ -405,6 +358,7 @@ p.mui_paragraph+p.mui_paragraph {
405
358
  }
406
359
  .mui_tab:active, .mui_button:active, .mui_selected {
407
360
  background-color: <%= color(0, 0.3, 0.9) %> !important;
361
+ border-color: <%= color(0, 0.3, 0.9) %> !important;
408
362
  }
409
363
 
410
364
  /* tab group */
@@ -415,6 +369,20 @@ p.mui_paragraph+p.mui_paragraph {
415
369
  white-space: nowrap;
416
370
  }
417
371
 
372
+ /* textarea */
373
+
374
+ .mui_textarea {
375
+ background: <%= color(1, 1, 1) %> url('<%= mui_path :image %>/bezel.png') repeat-x;
376
+ border: 1px inset <%= color(0.9, 0.9, 0.9) %>;
377
+ display: inline-block;
378
+ height: 20em;
379
+ margin-right: 0.5em;
380
+ line-height: 1.7em;
381
+ padding: 0 0.4em 0 0.4em;
382
+ width: 40em;
383
+ <%= round %>
384
+ }
385
+
418
386
  /* title */
419
387
 
420
388
  .mui_title {
@@ -425,16 +393,10 @@ p.mui_paragraph+p.mui_paragraph {
425
393
  /* tray */
426
394
 
427
395
  .mui_tray {
428
- background-image: url('<%= mui_path :image %>/bezel.png');
429
- background-color: <%= color(1, 1, 1) %>;
430
- background-position: top center;
431
- background-repeat: repeat-x;
432
- border-bottom-color: <%= color(0.9, 0.9, 0.9) %>;
396
+ background: <%= color(1, 1, 1) %> url('<%= mui_path :image %>/bezel.png') repeat-x;
397
+ border: 1px solid <%= color(0.9, 0.9, 0.9) %>;
433
398
  border-left-color: <%= color(0.8, 0.8, 0.8) %>;
434
- border-right-color: <%= color(0.8, 0.8, 0.8) %>;
435
- border-style: solid;
436
- border-top-color: <%= color(0.6, 0.6, 0.6) %>;
437
- border-width: 1px;
399
+ border-top-color: <%= color(0.8, 0.8, 0.8) %>;
438
400
  margin: 0.5em;
439
401
  padding: 0 0 0.5em; 0;
440
402
  <%= round %>
@@ -459,25 +421,14 @@ span.mui_tray {
459
421
  vertical-align: top;
460
422
  }
461
423
  .mui_tray_title {
462
- background-color: <%= color(0.95, 0.95, 0.95) %>;
463
- background-image: url('<%= mui_path :image %>/bezel.png');
464
- background-position: top center;
465
- background-repeat: repeat-x;
466
- border-bottom-color: <%= color(1, 1, 1) %>;
467
- border-bottom-style: solid;
468
- border-bottom-width: 1px;
424
+ border-bottom: 1px solid <%= color(1, 1, 1) %>;
469
425
  font-size: 1.125em;
470
426
  padding: 0.25em 1em 0.25em 1em;
471
427
  white-space: nowrap;
472
- <%= round(:top_left => true, :top_right => true) %>
473
428
  }
474
429
  a.mui_tray_title {
475
430
  display: block;
476
431
  }
477
- a.mui_tray_title:hover {
478
- background-color: <%= color(1, 1, 1) %>;
479
- cursor: pointer;
480
- }
481
432
 
482
433
  /* truncate */
483
434
 
@@ -489,26 +440,22 @@ a.mui_tray_title:hover {
489
440
 
490
441
  /* window */
491
442
 
492
- table.mui_window {
443
+ .mui_window {
493
444
  border-collapse: collapse;
494
445
  }
495
- table.mui_window_bar {
496
- background-color: <%= color(0.1, 0.1, 0.1) %>;
497
- background-image: url('<%= mui_path :image %>/plastic.png');
498
- background-position: center center;
499
- background-repeat: repeat-x;
446
+ .mui_window_bar {
447
+ background: <%= color(0.1, 0.1, 0.1) %> url('<%= mui_path :image %>/plastic.png') repeat-x center;
500
448
  color: <%= color(1, 1, 1) %>;
501
449
  height: 2em;
502
- padding-left: 0.75em;
503
- padding-right: 0.75em;
450
+ padding: 0 0.75em 0 0.75em;
504
451
  width: 100%;
505
452
  <%= round(:top_left => true, :top_right => true) %>
506
453
  }
507
- td.mui_window_bar_end {
454
+ .mui_window_bar_end {
508
455
  text-align: right;
509
456
  }
510
- td.mui_window_content {
511
- background-image: url('<%= mui_path :image %>/glass.png');
457
+ .mui_window_content {
458
+ background: url('<%= mui_path :image %>/glass.png');
512
459
  color: <%= color(1, 1, 1) %>;
513
460
  padding: 0.5em;
514
461
  <%= round(:bottom_left => true, :bottom_right => true) %>
data/lib/merb-ui.rb CHANGED
@@ -13,6 +13,7 @@ if defined?(Merb::Plugins)
13
13
  module MerbUi
14
14
 
15
15
  def self.setup_router(scope)
16
+ scope.match('/message').to(:controller => 'messages', :action => 'index').name(:message)
16
17
  scope.match('/stylesheets/mui.css').to(:controller => 'styles', :action => 'index')
17
18
  end
18
19
 
@@ -1,79 +1,87 @@
1
- // Set the status of the window. 0 == closed, 1 == opened
2
- var windowStatus = 0;
1
+ var windowHeight = $(window).height();
2
+ var windowWidth = $(window).width();
3
3
 
4
- // Position message at top center.
5
- function messagePosition(){
6
- var browserWidth = $(window).width();
7
- var messageWidth = $('.mui_message').width();
8
- $('.mui_message').css({position:'fixed', left:(browserWidth/2)+(messageWidth/2)*(-1), top:0}).slideDown('fast');
4
+ // Message
5
+ function muiMessageClose(){
6
+ $('.mui_message_target:visible').slideUp('fast');
9
7
  }
10
-
11
- // Close window.
12
- function windowClose(url){
13
- $('.mui_window_target').fadeOut(function(){
14
- windowStatus = 0;
15
- });
8
+ function muiMessageOpen(url){
9
+ $('.mui_message_target').hide().load(url, function(){
10
+ var muiMessageWidth = $('.mui_message_target').width();
11
+ if (muiMessageWidth > windowWidth){
12
+ $('.mui_message_target').css({position:'absolute', left:'1em', top:0});
13
+ }
14
+ else{
15
+ $('.mui_message_target').css({position:'fixed', left:(windowWidth-muiMessageWidth)/2, top:0});
16
+ }
17
+ $('.mui_click_message_close').click(function(){
18
+ muiMessageClose();
19
+ });
20
+ $('.mui_message_target').slideDown('fast');
21
+ });
16
22
  }
17
23
 
18
- // Open window and give the first input with class of mui_focus focus, if one exists.
19
- function windowOpen(url){
20
- var target = $('.mui_window_target')
21
- target.load(url, function(){
22
- if(windowStatus == 0){
23
- target.fadeIn();
24
+ // Window
25
+ function muiWindowClose(){
26
+ $('.mui_window_target:visible').fadeOut();
27
+ }
28
+ function muiWindowOpen(url){
29
+ $('.mui_window_target').load(url, function(){
30
+ if ($('.mui_window_target').is(':hidden')){
31
+ var muiWindowHeight = $('.mui_window_target').height();
32
+ var muiWindowWidth = $('.mui_window_target').width();
33
+ if (muiWindowWidth > windowWidth){
34
+ $('.mui_window_target').css({position:'absolute', left:'1em'});
35
+ }
36
+ else{
37
+ $('.mui_window_target').css({position:'fixed', left:(windowWidth-muiWindowWidth)/2});
38
+ }
39
+ if (muiWindowHeight > windowHeight){
40
+ $('.mui_window_target').css({position:'absolute', top:'1em'});
41
+ }
42
+ else{
43
+ $('.mui_window_target').css({position:'fixed', top:(windowHeight-muiWindowHeight)/2});
44
+ }
45
+ $('.mui_window_target').fadeIn();
24
46
  }
25
47
  $('.mui_focus:first').focus();
26
- windowStatus = 1;
27
- });
48
+ $('.mui_click_window_close').click(function(){
49
+ muiWindowClose(this.id);
50
+ });
51
+ $('.mui_click_window_redirect').click(function(){
52
+ muiWindowOpen(this.id);
53
+ });
54
+ $('.mui_window_target').draggable({
55
+ 'containment': 'window',
56
+ 'handle': '.mui_window_bar'
57
+ });
58
+ });
28
59
  }
29
60
 
30
- // Position window at middle center.
31
- function windowPosition(){
32
- if(windowStatus == 0){
33
- var browserWidth = $(window).width();
34
- var browserHeight = $(window).height();
35
- var windowWidth = $('.mui_window_target').width();
36
- var windowHeight = $('.mui_window_target').height();
37
- if (windowWidth > browserWidth){
38
- $('.mui_window_target').css({position:'absolute', left:'1em'});
39
- }
40
- else{
41
- $('.mui_window_target').css({position:'fixed', left:(browserWidth/2)+(windowWidth/2)*(-1)});
42
- }
43
- if (windowHeight > browserHeight){
44
- $('.mui_window_target').css({position:'absolute', top:'1em'});
45
- }
46
- else{
47
- $('.mui_window_target').css({position:'fixed', top:(browserHeight/2)+(windowHeight/2)*(-1)});
48
- }
49
- }
50
- }
61
+ $(document).ready(function(){
51
62
 
52
- // Bind buttons.
53
- $(function(){
63
+ // Buttons
54
64
  $('.mui_click').click(function(){
55
65
  window.location = this.id;
56
66
  });
57
67
  $('.mui_click_window_open').click(function(){
58
- windowOpen(this.id);
59
- });
60
- $('.mui_click_message_close').click(function(){
61
- $('.mui_message').slideUp('fast', function(){
62
- $('.mui_message').remove();
63
- });
68
+ muiWindowOpen(this.id);
64
69
  });
65
- messagePosition();
70
+
71
+ // Focus
72
+ $('.mui_focus:first').focus();
73
+
66
74
  });
67
75
 
68
- // Bind keyboard shortcuts.
76
+ // Keys
69
77
  $(document).keybind('ctrl+shift+P', function(){
70
- windowOpen('/password/read');
78
+ muiWindowOpen('/password/read');
71
79
  });
72
80
  $(document).keybind('ctrl+shift+esc', function(){
73
81
  window.location = '/password/exit';
74
82
  });
75
83
  $(document).keybind('esc', function(){
76
- if ($('.mui_message').length > 0){
84
+ if ($('.mui_message_target').is(':visible')){
77
85
  $('.mui_click_message_close').click();
78
86
  }
79
87
  else{
@@ -86,3 +94,4 @@ $(document).keybind('left', function(){
86
94
  $(document).keybind('right', function(){
87
95
  $('[name=next]').click();
88
96
  });
97
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - UiPoet
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-17 00:00:00 -08:00
12
+ date: 2008-12-22 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -43,12 +43,15 @@ extra_rdoc_files: []
43
43
  files:
44
44
  - app/controllers
45
45
  - app/controllers/application.rb
46
+ - app/controllers/messages.rb
46
47
  - app/controllers/styles.rb
47
48
  - app/helpers
48
49
  - app/helpers/global_helpers.rb
49
50
  - app/helpers/merb_helpers.rb
50
51
  - app/helpers/styles_helper.rb
51
52
  - app/views
53
+ - app/views/messages
54
+ - app/views/messages/index.html.erb
52
55
  - app/views/styles
53
56
  - app/views/styles/index.css.erb
54
57
  - lib/merb-ui
@@ -64,11 +67,8 @@ files:
64
67
  - public/images/plastic.png
65
68
  - public/images/rubber.png
66
69
  - public/javascripts
67
- - public/javascripts/dimensions.js
68
70
  - public/javascripts/keybinder.js
69
71
  - public/javascripts/main.js
70
- - public/javascripts/message.js
71
- - public/javascripts/window.js
72
72
  - LICENSE
73
73
  - Rakefile
74
74
  - README
@@ -1,12 +0,0 @@
1
- /* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
2
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
4
- *
5
- * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
6
- * $Rev: 4257 $
7
- *
8
- * Version: 1.2
9
- *
10
- * Requires: jQuery 1.2+
11
- */
12
- eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{}))
@@ -1,5 +0,0 @@
1
- $(document).ready(function(){
2
- $('.mui_click_message_close').click(function(){
3
- $('.mui_message').slide().empty();
4
- });
5
- });
@@ -1,13 +0,0 @@
1
- $(document).ready(function(){
2
- windowPosition();
3
- $('.mui_click_window_close').click(function(){
4
- windowClose(this.id);
5
- });
6
- $('.mui_click_window_redirect').click(function(){
7
- windowOpen(this.id);
8
- });
9
- $('.mui_window_target').draggable({
10
- 'containment': 'window',
11
- 'handle': '.mui_window_bar'
12
- });
13
- });