qadmin 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ == 0.2.2 2009-03-22
2
+
3
+ * 2 minor enhancements:
4
+ * Fixed missing helpers
5
+ * Fixed some small changes in the default templates
6
+
1
7
  == 0.2.1 2009-03-22
2
8
 
3
9
  * 1 minor enhancement:
@@ -6,7 +6,7 @@ unless defined?(ActiveSupport)
6
6
  end
7
7
 
8
8
  module Qadmin
9
- VERSION = '0.2.1'
9
+ VERSION = '0.2.2'
10
10
  end
11
11
 
12
12
  %w{
@@ -1,14 +1,5 @@
1
1
  module Qadmin
2
2
  module Helper
3
-
4
- def fieldset(legend = nil, options = {}, &block)
5
- concat(content_tag(:fieldset, options) do
6
- html = ''
7
- html << content_tag(:legend, legend) if legend
8
- html << capture(&block)
9
- html
10
- end)
11
- end
12
3
 
13
4
  def admin_controls(name, options = {}, &block)
14
5
  return if respond_to?(:overlay?) && overlay?
@@ -127,6 +118,43 @@ module Qadmin
127
118
  def yes?(boolean)
128
119
  boolean ? 'Yes' : 'No'
129
120
  end
121
+
122
+ def li(content, *args)
123
+ content_tag :li, content, args
124
+ end
125
+
126
+ def simple_admin_menu(*controllers)
127
+ html = %{<div id="menu">
128
+ <ul>}
129
+ simple_menu(*controllers) do |name,controller|
130
+ li(link_to(name, :controller => controller))
131
+ end
132
+ html << %{</ul>
133
+ <div class="clear"></div>
134
+ </div>}
135
+ end
130
136
 
137
+ def simple_menu(*controllers, &block)
138
+ return unless controllers
139
+ html = ""
140
+ controllers.each do |controller_pair|
141
+ if controller_pair.is_a? Array
142
+ name, controller = controller_pair[0], controller_pair[1]
143
+ else
144
+ name, controller = controller_pair, controller_pair
145
+ end
146
+ html << yield(name,controller)
147
+ end
148
+ html
149
+ end
150
+
151
+ def fieldset(legend = nil, options = {}, &block)
152
+ concat(content_tag(:fieldset, options) do
153
+ html = ''
154
+ html << content_tag(:legend, legend) if legend
155
+ html << capture(&block)
156
+ html
157
+ end)
158
+ end
131
159
  end
132
160
  end
@@ -50,7 +50,7 @@ class QadminGenerator < Rails::Generator::NamedBase
50
50
 
51
51
  if !after_scaffold
52
52
  # Layout and stylesheet.
53
- m.template('layout.html.erb', File.join('app','views','layouts', "admin.erb"))
53
+ m.template('layout.html.erb', File.join('app','views','layouts', "admin.html.erb"))
54
54
  m.template('style.css', 'public/stylesheets/admin.css')
55
55
 
56
56
  m.template('controller.rb', File.join('app','controllers', controller_class_path, "#{controller_file_name}_controller.rb"))
@@ -9,7 +9,6 @@
9
9
 
10
10
  <%%= stylesheet_link_tag 'admin' %>
11
11
  <%%= javascript_include_tag :defaults %>
12
- <%%= javascript_include_tag 'file_browser' %>
13
12
  </head>
14
13
  <body>
15
14
  <div id="header">
@@ -17,10 +16,11 @@
17
16
  <div id="loginbox"><%% if logged_in? %>Welcome, <%%= current_user %> / <%%= link_to "Logout", '/logout' %><%% else %><%%= link_to "Login", '/login' %><%% end %></div>
18
17
  </div>
19
18
  <div id="main">
19
+ <% if logged_in? %>
20
20
  <div id="left_menu">
21
21
  <h3>Panels</h3>
22
22
  <ul class="menu">
23
- <%% simple_menu([]) do |name,controller| %>
23
+ <%% simple_menu() do |name,controller| %>
24
24
  <li><%%= link_to(name.titleize, {:controller => controller}, :class => (like_current_page?(:controller => controller) ? 'selected' : '')) %></li>
25
25
  <%% end %>
26
26
  </ul>
@@ -28,6 +28,7 @@
28
28
  <ul class="menu">
29
29
  </ul>
30
30
  </div>
31
+ <% end %>
31
32
  <div id="content">
32
33
  <%% if flash[:message] %>
33
34
  <div id="message_main" class="message">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Quint