aureus 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/Readme.md +326 -7
- data/TODO.md +2 -2
- data/app/assets/stylesheets/aureus/table.scss +2 -2
- data/aureus.gemspec +4 -4
- data/lib/aureus/box.rb +18 -1
- data/lib/aureus/data_table.rb +14 -5
- data/lib/aureus/helper.rb +7 -2
- data/lib/aureus/map.rb +17 -0
- data/lib/aureus/row.rb +6 -6
- data/lib/aureus/version.rb +1 -1
- data/lib/aureus.rb +9 -0
- data/lib/generators/aureus/layout/layout_generator.rb +19 -0
- data/lib/generators/aureus/layout/templates/layout.html.haml +17 -0
- data/lib/generators/aureus/views/templates/views/_form.html.haml +1 -1
- data/lib/generators/aureus/views/views_generator.rb +3 -2
- metadata +11 -6
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.DS_Store
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
# Aureus
|
1
|
+
# Aureus
|
2
2
|
|
3
|
-
**a nice looking
|
3
|
+
**a nice looking framework for your rails admin interfaces**
|
4
|
+
|
5
|
+
Aureus is a tool to quickly generate admin interfaces for a rails app. It's between scaffolding and tools like ActiveAdmin.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
To use **aureus** simply require the gem:
|
8
10
|
|
9
|
-
````ruby
|
11
|
+
````ruby
|
10
12
|
gem "aureus"
|
11
|
-
|
13
|
+
```
|
12
14
|
|
13
15
|
The rails engine will automatically load the following dependencies:
|
14
16
|
|
@@ -21,10 +23,327 @@ But you have to ensure that these gems are available:
|
|
21
23
|
* sass-rails
|
22
24
|
* coffee-rails
|
23
25
|
|
24
|
-
##
|
26
|
+
## Asset Pipeline
|
27
|
+
|
28
|
+
Aureus uses the rails asset pipeline to load and override the style and behavior.
|
29
|
+
|
30
|
+
This is the basic application.scss setup:
|
31
|
+
|
32
|
+
````scss
|
33
|
+
/*
|
34
|
+
*= require_self
|
35
|
+
*= depend_on aureus
|
36
|
+
*/
|
37
|
+
|
38
|
+
$color_main: #0f0; // the color used for highlights
|
39
|
+
$color_warn: #f00; // the color used for warning (should be red)
|
40
|
+
|
41
|
+
@import "aureus";
|
42
|
+
|
43
|
+
// your styles here ...
|
44
|
+
```
|
45
|
+
|
46
|
+
Configure the scripts in application.js:
|
47
|
+
|
48
|
+
````js
|
49
|
+
//= require_self
|
50
|
+
//= require aureus
|
51
|
+
|
52
|
+
var datepickerConfiguration = {
|
53
|
+
dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
|
54
|
+
monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','December'],
|
55
|
+
nextText: "→",
|
56
|
+
prevText: "←",
|
57
|
+
dateFormat: "yy-mm-dd",
|
58
|
+
firstDay: 1,
|
59
|
+
}
|
60
|
+
|
61
|
+
var timepickerConfiguration = {
|
62
|
+
isoTime: true,
|
63
|
+
minTime: {hour:6,minute:0},
|
64
|
+
maxTime: {hour:22,minute:0},
|
65
|
+
timInterval: 30
|
66
|
+
}
|
67
|
+
|
68
|
+
var tooltipConfiguration = {
|
69
|
+
background: "none",
|
70
|
+
color: 'black',
|
71
|
+
border: "none"
|
72
|
+
}
|
73
|
+
```
|
74
|
+
|
75
|
+
## Helpers
|
76
|
+
|
77
|
+
There are several helper methods available to generate the interface:
|
78
|
+
|
79
|
+
````haml
|
80
|
+
// Toolbar
|
81
|
+
= aureus_toolbar "A nice title" do |t|
|
82
|
+
- t.left do |l|
|
83
|
+
- l.link_to "root", root_url
|
84
|
+
- l.link_to "an anchor", an_anchor_url
|
85
|
+
- l.info "cool"
|
86
|
+
- t.right do |r|
|
87
|
+
- r.info "some info"
|
88
|
+
- r.link_to "an anchor", some_other_controller_url
|
89
|
+
|
90
|
+
// Navigation
|
91
|
+
= aureus_navigation do |n|
|
92
|
+
- n.title "the title"
|
93
|
+
- n.button link_to("target name",some_cool_url) if can? :read, Stuff
|
94
|
+
- n.submit_form_button @post, "save"
|
95
|
+
|
96
|
+
// Flash messages
|
97
|
+
= aureus_messages flash
|
98
|
+
|
99
|
+
// Content wrapper for layout
|
100
|
+
= aureus_content yield
|
101
|
+
|
102
|
+
// Grid system (with automatic proportion calculation)
|
103
|
+
= aureus_row do
|
104
|
+
%strong only wrapper
|
105
|
+
= aureus_row do |r|
|
106
|
+
- r.column 100 do
|
107
|
+
.one-column
|
108
|
+
= aureus_row do |r|
|
109
|
+
- r.column 2 do # two '2 width' colums are the same like 50 / 50
|
110
|
+
.first
|
111
|
+
- r.space 2
|
112
|
+
= aureus_row do |r|
|
113
|
+
- r.column 25 do
|
114
|
+
.first
|
115
|
+
- r.column 25 do
|
116
|
+
.second
|
117
|
+
- r.column 50 do
|
118
|
+
.third
|
119
|
+
|
120
|
+
// Boxes
|
121
|
+
= aureus_box "a title" do
|
122
|
+
%strong content
|
123
|
+
= aureus_box "a title", :centered => true, :for => :form do
|
124
|
+
%li a entry
|
125
|
+
= aureus_box "a title" do |b|
|
126
|
+
- b.button link_to("a button",cool_controller_url)
|
127
|
+
- b.content do
|
128
|
+
%strong the content
|
129
|
+
- b.foot do
|
130
|
+
%strong the footer
|
131
|
+
|
132
|
+
// Datatables
|
133
|
+
= aureus_datatable @resources do |t|
|
134
|
+
- t.head do |h|
|
135
|
+
- h.text "Title"
|
136
|
+
- h.text "Text"
|
137
|
+
- h.date "Date"
|
138
|
+
- h.raw "Raw"
|
139
|
+
- t.row do |r,res|
|
140
|
+
- r.cell res.title
|
141
|
+
- r.cell res.text
|
142
|
+
- r.cell res.date
|
143
|
+
- r.cell res.unsortable_data
|
144
|
+
- r.button :show, "url" if can? :show, Resource
|
145
|
+
- r.button :edit, "url"
|
146
|
+
- r.button :destroy, "url", :confirm => "Delete user?"
|
147
|
+
- r.button_raw link_to("a action",the_action_url, :class => ["icon","my-icon"])
|
148
|
+
|
149
|
+
// Forms
|
150
|
+
= aureus_form [@parent,@resource] do |f|
|
151
|
+
= f.input :name # formtastic is here
|
152
|
+
|
153
|
+
// Listings
|
154
|
+
= aureus_listing do |l|
|
155
|
+
- l.entry "head", "body"
|
156
|
+
- l.entry "head2" do
|
157
|
+
%strong body2
|
158
|
+
|
159
|
+
// Maps (Google Maps iFrame)
|
160
|
+
= aureus_map :longitude => 12, :latitude => 6
|
161
|
+
````
|
162
|
+
|
163
|
+
## Generators
|
164
|
+
|
165
|
+
Aureus has a bunch of generators builtin to easily generate a complete interface including i18n.
|
166
|
+
|
167
|
+
### Layout
|
168
|
+
|
169
|
+
To generate a base layout issue `rails g aureus:layout layout_name` which produces:
|
170
|
+
|
171
|
+
````haml
|
172
|
+
!!! 5
|
173
|
+
%html
|
174
|
+
%head
|
175
|
+
%meta{ :charset => "utf-8" }/
|
176
|
+
%title= t(".title")
|
177
|
+
= stylesheet_link_tag "application"
|
178
|
+
= javascript_include_tag "application"
|
179
|
+
= csrf_meta_tag
|
180
|
+
%body
|
181
|
+
= aureus_toolbar t(".title") do |t|
|
182
|
+
- t.left do |l|
|
183
|
+
- l.link_to t(".root"), root_url
|
184
|
+
- t.right do |r|
|
185
|
+
- r.info "info"
|
186
|
+
= yield :navigation
|
187
|
+
= aureus_messages flash
|
188
|
+
= aureus_content yield
|
189
|
+
```
|
25
190
|
|
191
|
+
Add the I18n keys to your en.yml.
|
192
|
+
|
193
|
+
### Views
|
194
|
+
|
195
|
+
The awesome thing about aureus is the following generator `rails g aureus:views Resource ResourcesController` which generates all views and i18n files for you. It uses your ActiveRecord model to determine all attributes and uses the controller name for proper folders. The above command will generate:
|
196
|
+
|
197
|
+
#### app/views/resources/index.html.haml
|
198
|
+
|
199
|
+
````haml
|
200
|
+
- content_for :navigation do
|
201
|
+
= aureus_navigation do |n|
|
202
|
+
- n.title t(".title")
|
203
|
+
- n.button link_to(t(".button_new"), new_resource_url) if can? :create, Resource
|
204
|
+
|
205
|
+
= render "list"
|
206
|
+
````
|
207
|
+
|
208
|
+
#### app/views/resources/show.html.haml
|
209
|
+
|
210
|
+
````haml
|
211
|
+
- content_for :navigation do
|
212
|
+
= aureus_navigation do |n|
|
213
|
+
- n.title t(".title")
|
214
|
+
- n.button link_to(t(".button_edit"), edit_resource_url(@resource)) if can? :update, Resource
|
215
|
+
- n.button link_to(t(".button_back"),resources_url) if can? :index, Resource
|
216
|
+
|
217
|
+
= render "item"
|
218
|
+
````
|
219
|
+
|
220
|
+
#### app/views/resources/new.html.haml
|
221
|
+
|
222
|
+
````haml
|
223
|
+
- content_for :navigation do
|
224
|
+
= aureus_navigation do |n|
|
225
|
+
- n.title t(".title")
|
226
|
+
- n.button link_to(t(".button_cancel"), resources_url) if can? :index, Resource
|
227
|
+
- n.submit_form_button @resource, t(".button_save") if can? :create, Resource
|
228
|
+
|
229
|
+
= render "form"
|
230
|
+
````
|
231
|
+
|
232
|
+
#### app/views/resources/edit.html.haml
|
233
|
+
|
234
|
+
````haml
|
235
|
+
- content_for :navigation do
|
236
|
+
= aureus_navigation do |n|
|
237
|
+
- n.title t(".title")
|
238
|
+
- n.button link_to t(".button_cancel"), resources_url if can? :show, Resource
|
239
|
+
- n.submit_form_button @resource, t(".button_save") if can? :update, Resource
|
240
|
+
|
241
|
+
= render "form"
|
242
|
+
````
|
243
|
+
|
244
|
+
#### app/views/resources/_list.html.haml
|
245
|
+
|
246
|
+
````haml
|
247
|
+
= aureus_row do
|
248
|
+
= aureus_box t(".box_title") do
|
249
|
+
= aureus_datatable @resources do |t|
|
250
|
+
- t.head do |h|
|
251
|
+
- h.text t(".column_id")
|
252
|
+
- h.text t(".column_name")
|
253
|
+
- h.text t(".column_body")
|
254
|
+
- h.text t(".column_description")
|
255
|
+
- h.text t(".column_created_at")
|
256
|
+
- h.text t(".column_updated_at")
|
257
|
+
- t.row do |r,resource|
|
258
|
+
- r.cell resource.id
|
259
|
+
- r.cell resource.name
|
260
|
+
- r.cell resource.body
|
261
|
+
- r.cell resource.description
|
262
|
+
- r.cell resource.created_at
|
263
|
+
- r.cell resource.updated_at
|
264
|
+
- r.button :show, resource_url(resource) if can? :show, Resource
|
265
|
+
- r.button :edit, edit_resource_url(resource) if can? :edit, Resource
|
266
|
+
- r.button :destroy, resource_url(resource), :confirm => t(".destroy_confirm") if can? :destroy, Resource
|
267
|
+
````
|
268
|
+
|
269
|
+
#### app/views/resources/_form.html.haml
|
270
|
+
|
271
|
+
````haml
|
272
|
+
= aureus_form [@resource] do |f|
|
273
|
+
= aureus_row do |r|
|
274
|
+
- r.column 25 do
|
275
|
+
= aureus_box t(".box_title"), :for => :form do
|
276
|
+
= f.input :name, :label => t(".field_name")
|
277
|
+
= f.input :body, :label => t(".field_body")
|
278
|
+
= f.input :description, :label => t(".field_description")
|
279
|
+
- r.space 75
|
280
|
+
````
|
281
|
+
|
282
|
+
#### app/views/resources/_item.html.haml
|
283
|
+
|
284
|
+
````haml
|
285
|
+
= aureus_row do |r|
|
286
|
+
- r.column 25 do
|
287
|
+
= aureus_box t(".box_title") do
|
288
|
+
= aureus_listing do |l|
|
289
|
+
- l.entry t(".entry_id"), @resource.id
|
290
|
+
- l.entry t(".entry_name"), @resource.name
|
291
|
+
- l.entry t(".entry_body"), @resource.body
|
292
|
+
- l.entry t(".entry_description"), @resource.description
|
293
|
+
- l.entry t(".entry_created_at"), @resource.created_at
|
294
|
+
- l.entry t(".entry_updated_at"), @resource.updated_at
|
295
|
+
- r.space 75
|
296
|
+
````
|
297
|
+
|
298
|
+
#### config/locales/resources.en.yml
|
299
|
+
|
300
|
+
````yml
|
301
|
+
en:
|
302
|
+
resources:
|
303
|
+
index:
|
304
|
+
title: Resources
|
305
|
+
button_new: Add Resource
|
306
|
+
new:
|
307
|
+
title: New Resource
|
308
|
+
button_cancel: Cancel
|
309
|
+
button_save: Save
|
310
|
+
edit:
|
311
|
+
title: Edit Resource
|
312
|
+
button_cancel: Cancel
|
313
|
+
button_save: Save
|
314
|
+
form:
|
315
|
+
box_title: Details
|
316
|
+
field_id: Id
|
317
|
+
field_name: Name
|
318
|
+
field_body: Body
|
319
|
+
field_description: Description
|
320
|
+
field_created_at: Created At
|
321
|
+
field_updated_at: Updated At
|
322
|
+
list:
|
323
|
+
box_title: Resources Listing
|
324
|
+
destroy_confirm: Really want to delete the Resource?
|
325
|
+
column_id: Id
|
326
|
+
column_name: Name
|
327
|
+
column_body: Body
|
328
|
+
column_description: Description
|
329
|
+
column_created_at: Created At
|
330
|
+
column_updated_at: Updated At
|
331
|
+
show:
|
332
|
+
title: Resource
|
333
|
+
button_edit: Edit Resource
|
334
|
+
button_back: Back
|
335
|
+
item:
|
336
|
+
box_title: Details
|
337
|
+
entry_id: Id
|
338
|
+
entry_name: Name
|
339
|
+
entry_body: Body
|
340
|
+
entry_description: Description
|
341
|
+
entry_created_at: Created At
|
342
|
+
entry_updated_at: Updated At
|
343
|
+
````
|
26
344
|
|
345
|
+
### Devise
|
27
346
|
|
28
|
-
|
347
|
+
Therer are serveral generators to nicely integrate devise with aureus.
|
29
348
|
|
30
|
-
|
349
|
+
Use `rails g aureus:devise_views folder` where folder is basically devise or namespace/devise, to generate aureus compatible devise views. These views are all set with I18n keys so you need to generate them too: `rails g aureus:devise_i18n` which generates 3 files with all keys set in english. Remove your devise.en.yml to have no duplication.
|
data/TODO.md
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
@include border-radius(30px);
|
80
80
|
@include gradient(#eee,#ccc);
|
81
81
|
border: 1px solid #999;
|
82
|
-
margin: 0
|
82
|
+
margin: 0 2px;
|
83
83
|
span {
|
84
84
|
color: #555;
|
85
85
|
text-decoration: none;
|
@@ -88,7 +88,7 @@
|
|
88
88
|
text-shadow: 1px 1px 0 #eee;
|
89
89
|
}
|
90
90
|
}
|
91
|
-
a.edit, a.destroy, a.show, a.recover, a.print {
|
91
|
+
a.edit, a.destroy, a.show, a.recover, a.print, a.icon {
|
92
92
|
width: 16px;
|
93
93
|
height: 16px;
|
94
94
|
display: inline-block;
|
data/aureus.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
# Main Info
|
8
8
|
s.name = "aureus"
|
9
9
|
s.version = Aureus::VERSION
|
10
|
-
s.summary = "
|
11
|
-
s.description = "Aureus
|
10
|
+
s.summary = "a nice looking framework for your rails admin interfaces"
|
11
|
+
s.description = "Aureus is a tool to quickly generate admin interfaces for a rails app. It's between scaffolding an tools like ActiveAdmin."
|
12
12
|
s.license = "MIT"
|
13
13
|
|
14
14
|
# Additional Info
|
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.homepage = "https://github.com/256dpi/aureus"
|
18
18
|
|
19
19
|
# Files
|
20
|
-
s.files
|
21
|
-
s.test_files
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
22
|
|
23
23
|
# Dependencies
|
24
24
|
s.add_dependency "formtastic"
|
data/lib/aureus/box.rb
CHANGED
@@ -6,6 +6,7 @@ module Aureus
|
|
6
6
|
init options, :for => :text, :centered => false
|
7
7
|
init_haml_helpers
|
8
8
|
@title = title
|
9
|
+
@buttons = Array.new
|
9
10
|
@content = capture_haml self, &block
|
10
11
|
end
|
11
12
|
|
@@ -17,8 +18,12 @@ module Aureus
|
|
17
18
|
@foot = capture_haml &block
|
18
19
|
end
|
19
20
|
|
21
|
+
def button content
|
22
|
+
@buttons << BoxButton.new(content)
|
23
|
+
end
|
24
|
+
|
20
25
|
def render
|
21
|
-
title = content_tag("h3",@title)
|
26
|
+
title = content_tag("h3",compact(content_tag("span",@title),compact_render(*@buttons)))
|
22
27
|
classes = ["box"]
|
23
28
|
classes << "centered" if @options[:centered]
|
24
29
|
@content = @new_content if not @new_content.nil?
|
@@ -34,4 +39,16 @@ module Aureus
|
|
34
39
|
|
35
40
|
end
|
36
41
|
|
42
|
+
class BoxButton < Renderable
|
43
|
+
|
44
|
+
def initialize content
|
45
|
+
@content = content
|
46
|
+
end
|
47
|
+
|
48
|
+
def render
|
49
|
+
@content
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
37
54
|
end
|
data/lib/aureus/data_table.rb
CHANGED
@@ -2,9 +2,9 @@ module Aureus
|
|
2
2
|
|
3
3
|
class DataTable < Renderable
|
4
4
|
|
5
|
-
def initialize resource,
|
5
|
+
def initialize resource, args
|
6
|
+
init args, { :toolbar => true }
|
6
7
|
@resource = resource
|
7
|
-
@toolbar = toolbar
|
8
8
|
@head = DataTableHead.new
|
9
9
|
@rows = Array.new
|
10
10
|
end
|
@@ -22,7 +22,7 @@ module Aureus
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def render
|
25
|
-
content_tag "table", :id => @resource.class.name.downcase, :class => (@toolbar?"datatable":"datatable-no-toolbar") do
|
25
|
+
content_tag "table", :id => @resource.class.name.downcase, :class => (@options[:toolbar] ? "datatable":"datatable-no-toolbar") do
|
26
26
|
compact @head.render, content_tag("tbody",compact_render(*@rows))
|
27
27
|
end
|
28
28
|
end
|
@@ -72,12 +72,17 @@ module Aureus
|
|
72
72
|
class DataTableRow < Renderable
|
73
73
|
|
74
74
|
def initialize
|
75
|
+
init_haml_helpers
|
75
76
|
@cells = Array.new
|
76
77
|
@buttons = Array.new
|
77
78
|
end
|
78
79
|
|
79
|
-
def cell data
|
80
|
-
|
80
|
+
def cell data="", &block
|
81
|
+
if block_given?
|
82
|
+
@cells << DataTableRowCell.new(capture_haml(&block))
|
83
|
+
else
|
84
|
+
@cells << DataTableRowCell.new(data)
|
85
|
+
end
|
81
86
|
end
|
82
87
|
|
83
88
|
def button type_or_title, url, *args
|
@@ -88,6 +93,10 @@ module Aureus
|
|
88
93
|
end
|
89
94
|
end
|
90
95
|
|
96
|
+
def button_raw content
|
97
|
+
@buttons << Renderable.new(content)
|
98
|
+
end
|
99
|
+
|
91
100
|
def render
|
92
101
|
content_tag "tr", compact_render(*@cells)+content_tag("td",compact_render(*@buttons),:class => "buttons")
|
93
102
|
end
|
data/lib/aureus/helper.rb
CHANGED
@@ -33,8 +33,8 @@ module Aureus
|
|
33
33
|
box.render
|
34
34
|
end
|
35
35
|
|
36
|
-
def aureus_datatable resource
|
37
|
-
table = DataTable.new resource
|
36
|
+
def aureus_datatable resource, *args
|
37
|
+
table = DataTable.new resource, args
|
38
38
|
yield table
|
39
39
|
table.render
|
40
40
|
end
|
@@ -51,6 +51,11 @@ module Aureus
|
|
51
51
|
listing.render
|
52
52
|
end
|
53
53
|
|
54
|
+
def aureus_map *args
|
55
|
+
map = Map.new args
|
56
|
+
map.render
|
57
|
+
end
|
58
|
+
|
54
59
|
end
|
55
60
|
|
56
61
|
end
|
data/lib/aureus/map.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Aureus
|
2
|
+
|
3
|
+
class Map < Renderable
|
4
|
+
|
5
|
+
def initialize args
|
6
|
+
init args, {}
|
7
|
+
end
|
8
|
+
|
9
|
+
def render
|
10
|
+
if @options[:longitude] and @options[:latitude]
|
11
|
+
content_tag("iframe","",:src => "https://maps.google.ch/maps?q="+@options[:latitude].to_s+","+@options[:longitude].to_s+"&ie=UTF8&z=15&output=embed", :width => @options[:width], :height => @options[:height])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/lib/aureus/row.rb
CHANGED
@@ -27,19 +27,19 @@ module Aureus
|
|
27
27
|
end
|
28
28
|
out = String.new.html_safe
|
29
29
|
@columns.each_with_index do |c,i|
|
30
|
-
left =
|
31
|
-
right =
|
30
|
+
left = 0.5
|
31
|
+
right = 0.5
|
32
32
|
width = (100.0 / total_width * c.width).round
|
33
33
|
if i == 0
|
34
34
|
left = 0
|
35
|
-
width -=
|
35
|
+
width -= 0.5
|
36
36
|
elsif i == @columns.length-1
|
37
37
|
right = 0
|
38
|
-
width -=
|
38
|
+
width -= 0.5
|
39
39
|
else
|
40
|
-
width -=
|
40
|
+
width -= 1
|
41
41
|
end
|
42
|
-
out += content_tag "div", c.content, :style => "width: #{width}%;
|
42
|
+
out += content_tag "div", c.content, :class => :column, :style => "width: #{width}%; margin-left: #{left}%; margin-right: #{right}%"
|
43
43
|
end
|
44
44
|
content_tag "div", out, :class => "row"
|
45
45
|
end
|
data/lib/aureus/version.rb
CHANGED
data/lib/aureus.rb
CHANGED
@@ -17,6 +17,7 @@ module Aureus
|
|
17
17
|
autoload :DataTable
|
18
18
|
autoload :Form
|
19
19
|
autoload :Listing
|
20
|
+
autoload :Map
|
20
21
|
|
21
22
|
class Renderable
|
22
23
|
include ActionView::Context
|
@@ -25,6 +26,10 @@ module Aureus
|
|
25
26
|
include ActionView::Helpers::UrlHelper
|
26
27
|
include Haml::Helpers
|
27
28
|
|
29
|
+
def initialize content
|
30
|
+
@content = content
|
31
|
+
end
|
32
|
+
|
28
33
|
def init args, *defaults
|
29
34
|
@options = defaults.extract_options!.merge args.extract_options!
|
30
35
|
end
|
@@ -49,6 +54,10 @@ module Aureus
|
|
49
54
|
out
|
50
55
|
end
|
51
56
|
|
57
|
+
def render
|
58
|
+
@content
|
59
|
+
end
|
60
|
+
|
52
61
|
end
|
53
62
|
|
54
63
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Aureus
|
2
|
+
|
3
|
+
module Generators
|
4
|
+
|
5
|
+
class LayoutGenerator < Rails::Generators::Base
|
6
|
+
|
7
|
+
desc "generate an aureus layout file"
|
8
|
+
source_root File.expand_path("../templates", __FILE__)
|
9
|
+
argument :name, :required => true
|
10
|
+
|
11
|
+
def generate
|
12
|
+
copy_file "layout.html.haml", "app/views/layouts/"+name+".html.haml"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{ :charset => "utf-8" }/
|
5
|
+
%title= t(".title")
|
6
|
+
= stylesheet_link_tag "application"
|
7
|
+
= javascript_include_tag "application"
|
8
|
+
= csrf_meta_tag
|
9
|
+
%body
|
10
|
+
= aureus_toolbar t(".title") do |t|
|
11
|
+
- t.left do |l|
|
12
|
+
- l.link_to t(".root"), root_url
|
13
|
+
- t.right do |r|
|
14
|
+
- r.info "info"
|
15
|
+
= yield :navigation
|
16
|
+
= aureus_messages flash
|
17
|
+
= aureus_content yield
|
@@ -16,6 +16,7 @@ module Aureus
|
|
16
16
|
target = ["app/views",folder].join "/"
|
17
17
|
namespace = folder.split("/").slice(0...-1)
|
18
18
|
model = model_name.constantize
|
19
|
+
controller_test = controller.constantize
|
19
20
|
columns = model.column_names
|
20
21
|
columns2 = columns - ["id","created_at","updated_at"]
|
21
22
|
real_name = model_name.demodulize
|
@@ -33,7 +34,7 @@ module Aureus
|
|
33
34
|
"TABLE_CELLS" => columns.collect{ |c| ' - r.cell '+real_name.downcase+'.'+c }.join("\n"),
|
34
35
|
"ENTRIES" => columns.collect{ |c| ' - l.entry t(".entry_'+c+'"), @'+real_name.downcase+'.'+c }.join("\n"),
|
35
36
|
"INPUTS" => columns2.collect{ |c| ' = f.input :'+c+', :label => t(".field_'+c+'")' }.join("\n"),
|
36
|
-
"FORM_PATH" => namespace.collect{ |n| '"'+n+'"' }.join(",")
|
37
|
+
"FORM_PATH" => namespace.collect{ |n| '"'+n+'"' }.push("@"+real_name.downcase).join(",")
|
37
38
|
}
|
38
39
|
Dir[target+"/*.haml"].each do |file|
|
39
40
|
replacements.each do |key,value|
|
@@ -52,7 +53,7 @@ module Aureus
|
|
52
53
|
"new" => { "title" => "New "+singular, "button_cancel" => "Cancel", "button_save" => "Save" },
|
53
54
|
"edit" => { "title" => "Edit "+singular, "button_cancel" => "Cancel", "button_save" => "Save" },
|
54
55
|
"form" => { "box_title" => "Details" },
|
55
|
-
"list" => { "box_title" => plural+" Listing" },
|
56
|
+
"list" => { "box_title" => plural+" Listing", "destroy_confirm" => "Really want to delete the "+singular+"?" },
|
56
57
|
"show" => { "title" => singular, "button_edit" => "Edit "+singular, "button_back" => "Back" },
|
57
58
|
"item" => { "box_title" => "Details" }
|
58
59
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aureus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: formtastic
|
@@ -59,12 +59,14 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
description: Aureus
|
62
|
+
description: Aureus is a tool to quickly generate admin interfaces for a rails app.
|
63
|
+
It's between scaffolding an tools like ActiveAdmin.
|
63
64
|
email: joel.gaehwiler@bluewin.ch
|
64
65
|
executables: []
|
65
66
|
extensions: []
|
66
67
|
extra_rdoc_files: []
|
67
68
|
files:
|
69
|
+
- .gitignore
|
68
70
|
- Gemfile
|
69
71
|
- Gemfile.lock
|
70
72
|
- Rakefile
|
@@ -106,6 +108,7 @@ files:
|
|
106
108
|
- lib/aureus/engine.rb
|
107
109
|
- lib/aureus/helper.rb
|
108
110
|
- lib/aureus/listing.rb
|
111
|
+
- lib/aureus/map.rb
|
109
112
|
- lib/aureus/messages.rb
|
110
113
|
- lib/aureus/navigation.rb
|
111
114
|
- lib/aureus/row.rb
|
@@ -130,6 +133,8 @@ files:
|
|
130
133
|
- lib/generators/aureus/devise_views/templates/devise/sessions/new.html.haml
|
131
134
|
- lib/generators/aureus/devise_views/templates/devise/shared/_links.html.haml
|
132
135
|
- lib/generators/aureus/devise_views/templates/devise/unlocks/new.html.haml
|
136
|
+
- lib/generators/aureus/layout/layout_generator.rb
|
137
|
+
- lib/generators/aureus/layout/templates/layout.html.haml
|
133
138
|
- lib/generators/aureus/views/templates/views/_form.html.haml
|
134
139
|
- lib/generators/aureus/views/templates/views/_item.html.haml
|
135
140
|
- lib/generators/aureus/views/templates/views/_list.html.haml
|
@@ -155,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
160
|
version: '0'
|
156
161
|
segments:
|
157
162
|
- 0
|
158
|
-
hash:
|
163
|
+
hash: -3013022047789676668
|
159
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
165
|
none: false
|
161
166
|
requirements:
|
@@ -164,13 +169,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
169
|
version: '0'
|
165
170
|
segments:
|
166
171
|
- 0
|
167
|
-
hash:
|
172
|
+
hash: -3013022047789676668
|
168
173
|
requirements: []
|
169
174
|
rubyforge_project:
|
170
175
|
rubygems_version: 1.8.24
|
171
176
|
signing_key:
|
172
177
|
specification_version: 3
|
173
|
-
summary:
|
178
|
+
summary: a nice looking framework for your rails admin interfaces
|
174
179
|
test_files:
|
175
180
|
- test/html.haml
|
176
181
|
- test/model.rb
|