bowtie 0.2.5 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/bowtie.gemspec +1 -1
- data/lib/bowtie/core_extensions.rb +1 -1
- data/lib/bowtie/public/css/bowtie.css +64 -18
- data/lib/bowtie/views/field.erb +1 -1
- data/lib/bowtie/views/form.erb +1 -1
- data/lib/bowtie/views/index.erb +2 -2
- data/lib/bowtie/views/row.erb +3 -3
- data/lib/bowtie/views/search.erb +1 -1
- data/lib/bowtie/views/show.erb +1 -1
- metadata +2 -3
data/README.rdoc
CHANGED
@@ -10,6 +10,10 @@ Reads the information on your models and creates a nice panel in which you can v
|
|
10
10
|
|
11
11
|
$ sudo gem install bowtie
|
12
12
|
|
13
|
+
= Important
|
14
|
+
|
15
|
+
From version 0.3, Bowtie is meant to be used from DataMapper 1.0.0 on. For previous versions please install with -v=0.2.5.
|
16
|
+
|
13
17
|
= Configuration
|
14
18
|
|
15
19
|
Mount Bowtie wherever you want by editing your config.ru file, optionally including the admin/pass combination for the panel.
|
data/bowtie.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
CSS for Bowtie
|
2
|
+
CSS for Bowtie Datamapper Admin
|
3
3
|
By Tomas Pollak - Fork Limited
|
4
4
|
http://usefork.com
|
5
5
|
----------------------------------------- */
|
@@ -54,11 +54,38 @@ h2 { margin:10px 0; font-size:130%;}
|
|
54
54
|
/* header, navigation
|
55
55
|
-------------------------------------------------------------*/
|
56
56
|
|
57
|
-
#header {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
#header {
|
58
|
+
background:#000;
|
59
|
+
padding: 8px 5% 0 5%;
|
60
|
+
border-bottom:1px solid #444;
|
61
|
+
border-bottom:5px solid #528e00;
|
62
|
+
}
|
63
|
+
#header h1 {
|
64
|
+
color:#333;
|
65
|
+
font-size: 3em;
|
66
|
+
font-weight:bold;
|
67
|
+
margin: 10px 0;
|
68
|
+
}
|
69
|
+
#header h1 a{
|
70
|
+
color: #fff;
|
71
|
+
text-decoration: none
|
72
|
+
}
|
73
|
+
#header ul li {
|
74
|
+
display:inline;
|
75
|
+
}
|
76
|
+
|
77
|
+
#header ul li a {
|
78
|
+
color:#fff;
|
79
|
+
text-decoration:none;
|
80
|
+
margin-right:10px;
|
81
|
+
display:inline-block;
|
82
|
+
padding:8px;
|
83
|
+
-webkit-border-top-right-radius:6px;
|
84
|
+
-webkit-border-top-left-radius:6px;
|
85
|
+
-moz-border-top-right-radius: 6px;
|
86
|
+
-moz-border-top-left-radius: 6px;
|
87
|
+
}
|
88
|
+
|
62
89
|
#header ul li a:hover { background:#333;}
|
63
90
|
#header ul li.current a { background: #528e00; font-weight:bold; color:#fff;}
|
64
91
|
|
@@ -141,8 +168,13 @@ table td{
|
|
141
168
|
|
142
169
|
}
|
143
170
|
|
144
|
-
table tr td.no-data {
|
145
|
-
|
171
|
+
table tr td.no-data {
|
172
|
+
text-align:center;
|
173
|
+
padding:40px 0;
|
174
|
+
color:#999;
|
175
|
+
font-style:italic;
|
176
|
+
font-size:130%;
|
177
|
+
}
|
146
178
|
|
147
179
|
table .center{
|
148
180
|
text-align: center;
|
@@ -155,15 +187,20 @@ table .check-column{
|
|
155
187
|
text-align: center;
|
156
188
|
}
|
157
189
|
|
158
|
-
table .good{
|
159
|
-
|
190
|
+
table tr.good{
|
191
|
+
/* background: green;*/
|
160
192
|
}
|
161
193
|
|
162
|
-
table .bad, table .error{
|
163
|
-
color: #
|
194
|
+
table tr.bad td, table .error{
|
195
|
+
/* background-color: #fbf5dc;*/
|
196
|
+
background-color: #FFEFEF;
|
164
197
|
}
|
165
198
|
|
166
|
-
table
|
199
|
+
table th.rel{
|
200
|
+
background: #999;
|
201
|
+
color: #fff
|
202
|
+
}
|
203
|
+
table td.rel {
|
167
204
|
background: #fafafa;
|
168
205
|
}
|
169
206
|
|
@@ -182,13 +219,21 @@ input:focus{
|
|
182
219
|
}
|
183
220
|
|
184
221
|
form.destroy button{
|
185
|
-
font-size: 1em;
|
186
222
|
color: #666;
|
187
223
|
padding: 2px 5px;
|
224
|
+
}
|
225
|
+
|
226
|
+
.big.destroy button{
|
227
|
+
font-size: 1em;
|
188
228
|
margin-bottom: 20px;
|
189
229
|
color: #a00;
|
190
230
|
}
|
191
231
|
|
232
|
+
.destroy button:hover{
|
233
|
+
cursor: pointer;
|
234
|
+
color: #000;
|
235
|
+
}
|
236
|
+
|
192
237
|
form.resource small{
|
193
238
|
color: #ccc;
|
194
239
|
}
|
@@ -240,10 +285,6 @@ form .submit input{
|
|
240
285
|
.pager .disabled{
|
241
286
|
display: none;
|
242
287
|
}
|
243
|
-
.pager .current{
|
244
|
-
color: #666;
|
245
|
-
margin: 0 3px;
|
246
|
-
}
|
247
288
|
.pager a{
|
248
289
|
border: 1px solid;
|
249
290
|
padding: 3px 5px;
|
@@ -256,6 +297,11 @@ form .submit input{
|
|
256
297
|
.pager a:hover{
|
257
298
|
color: #000;
|
258
299
|
}
|
300
|
+
.pager .active a{
|
301
|
+
color: #fff;
|
302
|
+
background: #528e00;
|
303
|
+
border-color: #528e00;
|
304
|
+
}
|
259
305
|
|
260
306
|
|
261
307
|
/* footer
|
data/lib/bowtie/views/field.erb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
name = @p.name.to_s
|
5
5
|
value = @resource.send(@p.name).to_s
|
6
6
|
|
7
|
-
case @p.
|
7
|
+
case @p.class.to_s.gsub("DataMapper::Property::",'')
|
8
8
|
when "Array", /Class/ # weird how datamapper names enum classes
|
9
9
|
html += '<select class="array" name="resource['+name+']">'
|
10
10
|
@resource.model.options_for_subtype(name.to_sym).each do |option|
|
data/lib/bowtie/views/form.erb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
<% unless [:created_at, :id].include?(p.name) %>
|
9
9
|
<% @p = p %>
|
10
10
|
<tr>
|
11
|
-
<td class="left-col"><%= p.name.to_s.titleize %> <small>(<%= p.
|
11
|
+
<td class="left-col"><%= p.name.to_s.titleize %> <small>(<%= p.class.name.to_s.gsub("DataMapper::Property::",'') %>)</small></td>
|
12
12
|
<td class="right-col"><%= partial(:field) %></td>
|
13
13
|
</tr>
|
14
14
|
<% end %>
|
data/lib/bowtie/views/index.erb
CHANGED
@@ -7,11 +7,11 @@
|
|
7
7
|
|
8
8
|
<% if @resources.any? %>
|
9
9
|
|
10
|
-
<%= @resources.pager.to_html(@env['REQUEST_URI']
|
10
|
+
<%= @resources.pager.to_html(@env['REQUEST_URI']) if @resources.respond_to?(:pager) %>
|
11
11
|
|
12
12
|
<%= partial(:table) %>
|
13
13
|
|
14
|
-
<%= @resources.pager.to_html(@env['REQUEST_URI']
|
14
|
+
<%= @resources.pager.to_html(@env['REQUEST_URI']) if @resources.respond_to?(:pager) %>
|
15
15
|
|
16
16
|
<% else %>
|
17
17
|
|
data/lib/bowtie/views/row.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<tr id="resource-<%= @r.key.first.to_s %>" class="<%= @r.ok? ? 'good' : 'bad' if @r.respond_to?
|
1
|
+
<tr id="resource-<%= @r.key.first.to_s %>" class="<%= @r.ok? ? 'good' : 'bad' if @r.respond_to?('ok?') %>">
|
2
2
|
<td class="<%= @model.key.first.name.to_s %>-col"><a href="<%= url_for(@r) %>"><%= @r.key.first.to_s %></a></td>
|
3
3
|
<% @r.attributes.each do |a| %>
|
4
4
|
<% next if a[0] == @model.key.first.name %>
|
@@ -15,9 +15,9 @@
|
|
15
15
|
<% end %>
|
16
16
|
<% end %>
|
17
17
|
<% end %>
|
18
|
-
<td><a href="<%= url_for(@r) %>">
|
18
|
+
<td><a href="<%= url_for(@r) %>">View</a></td>
|
19
19
|
<td>
|
20
|
-
<form method="post" action="<%= model_path(@r.model) %>/<%= @r.id %>" onsubmit="return confirm('Are you sure?');">
|
20
|
+
<form class="destroy" method="post" action="<%= model_path(@r.model) %>/<%= @r.id %>" onsubmit="return confirm('Are you sure?');">
|
21
21
|
<input type="hidden" name="_method" value="delete" />
|
22
22
|
<button type="submit">Destroy</button>
|
23
23
|
</form>
|
data/lib/bowtie/views/search.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<% model = params[:model] %>
|
2
2
|
<form id="search" action="<%= base_path %>/search" method="get">
|
3
3
|
<% params.each do |k, v| %>
|
4
|
-
<% next if ['splat', 'q'].include?(k) or v.blank? %>
|
4
|
+
<% next if ['splat', 'q', 'page'].include?(k) or v.blank? %>
|
5
5
|
<input type="hidden" name="<%= k %>" value="<%= v %>" />
|
6
6
|
<% end %>
|
7
7
|
<input type="text" name="q" value="Find <%= model %>:" onfocus="if(this.value=='Find <%= model %>:')this.value='';" onblur="if(this.value=='')this.value='Find <%= model %>:';"/>
|
data/lib/bowtie/views/show.erb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1><%= @title || @model.name + ':' + @resource.id.to_s %></h1>
|
2
2
|
|
3
|
-
<form class="destroy" method="post" action="<%= model_path(@resource.model) %>/<%= @resource.id %>" onsubmit="return confirm('Are you sure?');">
|
3
|
+
<form class="big destroy" method="post" action="<%= model_path(@resource.model) %>/<%= @resource.id %>" onsubmit="return confirm('Are you sure?');">
|
4
4
|
<input type="hidden" name="_method" value="delete" />
|
5
5
|
<button type="submit">Destroy</button>
|
6
6
|
</form>
|