aureus 2.1.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +39 -40
- data/README.md +56 -64
- data/app/assets/javascripts/aureus/index.js +0 -41
- data/app/assets/javascripts/aureus/layout.js.erb +9 -0
- data/{spec/internal/app/assets/stylesheets/application.scss → app/assets/stylesheets/aureus/layout.scss.erb} +1 -1
- data/app/assets/stylesheets/aureus/skin/default.scss +0 -4
- data/app/assets/stylesheets/aureus/theme/content.scss +0 -4
- data/app/assets/stylesheets/aureus/theme/table.scss +1 -16
- data/app/assets/stylesheets/aureus/theme.scss +8 -0
- data/app/controllers/aureus/resources_controller.rb +52 -0
- data/app/controllers/aureus_controller.rb +2 -0
- data/app/views/aureus/resources/_form.html.haml +8 -0
- data/app/views/aureus/resources/_item.html.haml +7 -0
- data/app/views/aureus/resources/_navigation.html.haml +5 -0
- data/app/views/aureus/resources/_table.html.haml +11 -0
- data/app/views/aureus/resources/edit.html.haml +2 -0
- data/app/views/aureus/resources/index.html.haml +2 -0
- data/app/views/aureus/resources/new.html.haml +2 -0
- data/app/views/aureus/resources/show.html.haml +2 -0
- data/app/views/layouts/aureus.html.haml +14 -0
- data/aureus.gemspec +0 -1
- data/config.ru +1 -1
- data/lib/aureus/components/box.rb +8 -26
- data/lib/aureus/components/data_table.rb +15 -49
- data/lib/aureus/components/listing.rb +7 -14
- data/lib/aureus/components/messages.rb +2 -8
- data/lib/aureus/components/navigation.rb +5 -18
- data/lib/aureus/components/row.rb +4 -11
- data/lib/aureus/components/simple_map.rb +2 -8
- data/lib/aureus/components/toolbar.rb +14 -29
- data/lib/aureus/engine.rb +0 -3
- data/lib/aureus/helper.rb +18 -41
- data/lib/aureus/renderable.rb +6 -9
- data/lib/aureus/version.rb +1 -1
- data/lib/aureus.rb +10 -2
- data/lib/generators/aureus/copy/copy_generator.rb +13 -0
- data/lib/generators/aureus/setup/setup_generator.rb +12 -0
- data/spec/internal/app/controllers/all_controller.rb +0 -2
- data/spec/internal/app/controllers/application_controller.rb +2 -0
- data/spec/internal/app/controllers/resources_controller.rb +50 -1
- data/spec/internal/app/views/layouts/application.html.haml +6 -4
- data/spec/internal/app/views/layouts/naked.html.haml +4 -4
- data/spec/internal/config/initializers/aureus.rb +7 -0
- data/spec/internal/config/routes.rb +1 -1
- data/spec/lib/generators/copy_spec.rb +17 -0
- data/spec/lib/generators/setup_spec.rb +16 -0
- data/spec/requests/all_spec.rb +4 -3
- data/spec/requests/resources_spec.rb +23 -0
- metadata +27 -82
- data/app/assets/images/aureus/icon-sort-abc-asc.png +0 -0
- data/app/assets/images/aureus/icon-sort-abc-desc.png +0 -0
- data/app/assets/images/aureus/icon-sort.png +0 -0
- data/config/locales/aureus.de.yml +0 -9
- data/config/locales/aureus.en.yml +0 -9
- data/lib/aureus/components/content.rb +0 -19
- data/lib/generators/aureus/devise_i18n/devise_i18n_generator.rb +0 -25
- data/lib/generators/aureus/devise_i18n/locales/devise_base.de.yml +0 -55
- data/lib/generators/aureus/devise_i18n/locales/devise_base.en.yml +0 -55
- data/lib/generators/aureus/devise_i18n/locales/devise_mail.de.yml +0 -18
- data/lib/generators/aureus/devise_i18n/locales/devise_mail.en.yml +0 -18
- data/lib/generators/aureus/devise_i18n/locales/devise_ui.de.yml +0 -54
- data/lib/generators/aureus/devise_i18n/locales/devise_ui.en.yml +0 -54
- data/lib/generators/aureus/devise_invitable_i18n/devise_invitable_i18n_generator.rb +0 -25
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.de.yml +0 -11
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.en.yml +0 -11
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.de.yml +0 -9
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.en.yml +0 -9
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.de.yml +0 -12
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.en.yml +0 -12
- data/lib/generators/aureus/devise_invitable_views/devise_invitable_views_generator.rb +0 -23
- data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/edit.html.haml +0 -9
- data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/new.html.haml +0 -8
- data/lib/generators/aureus/devise_invitable_views/templates/devise/mailer/invitation_instructions.html.haml +0 -5
- data/lib/generators/aureus/devise_views/devise_views_generator.rb +0 -25
- data/lib/generators/aureus/devise_views/templates/devise/confirmations/new.html.haml +0 -7
- data/lib/generators/aureus/devise_views/templates/devise/mailer/confirmation_instructions.html.haml +0 -3
- data/lib/generators/aureus/devise_views/templates/devise/mailer/reset_password_instructions.html.haml +0 -5
- data/lib/generators/aureus/devise_views/templates/devise/mailer/unlock_instructions.html.haml +0 -4
- data/lib/generators/aureus/devise_views/templates/devise/passwords/edit.html.haml +0 -9
- data/lib/generators/aureus/devise_views/templates/devise/passwords/new.html.haml +0 -7
- data/lib/generators/aureus/devise_views/templates/devise/registrations/edit.html.haml +0 -11
- data/lib/generators/aureus/devise_views/templates/devise/registrations/new.html.haml +0 -9
- data/lib/generators/aureus/devise_views/templates/devise/sessions/new.html.haml +0 -9
- data/lib/generators/aureus/devise_views/templates/devise/shared/_links.html.haml +0 -19
- data/lib/generators/aureus/devise_views/templates/devise/unlocks/new.html.haml +0 -7
- data/lib/generators/aureus/layout/layout_generator.rb +0 -19
- data/lib/generators/aureus/layout/templates/layout.html.haml +0 -17
- data/lib/generators/aureus/views/templates/views/_form.html.haml +0 -6
- data/lib/generators/aureus/views/templates/views/_item.html.haml +0 -6
- data/lib/generators/aureus/views/templates/views/_list.html.haml +0 -10
- data/lib/generators/aureus/views/templates/views/edit.html.haml +0 -7
- data/lib/generators/aureus/views/templates/views/index.html.haml +0 -6
- data/lib/generators/aureus/views/templates/views/new.html.haml +0 -7
- data/lib/generators/aureus/views/templates/views/show.html.haml +0 -7
- data/lib/generators/aureus/views/views_generator.rb +0 -81
- data/spec/controllers/all_spec.rb +0 -19
- data/spec/internal/app/assets/javascripts/application.js +0 -9
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/lib/generators/devise_i18n_spec.rb +0 -19
- data/spec/lib/generators/devise_invitable_i18n_spec.rb +0 -19
- data/spec/lib/generators/devise_invitable_views_spec.rb +0 -19
- data/spec/lib/generators/devise_views_spec.rb +0 -25
- data/spec/lib/generators/layout_spec.rb +0 -17
- data/spec/lib/generators/views_spec.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da714510bbeed3441c14f68e61c96a5d8bd12a9a
|
4
|
+
data.tar.gz: f688df1e2ff0f3bde65eb69da161f43b1ade6666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63c0589fec2132e80681de09684e2f4161a75d1e391a2ad358f642676867bb37fef90089e345cacd0a5e684ccad77c0cff049b1c1a05032167c3357973417cf0
|
7
|
+
data.tar.gz: dd50c6309dced03e90e89e87d950330cf5b97d55c1a23cd1ecf64750ac12673d1a33c188bbd5c022b43e1f11055f43b4e575e0280445f6a364d76a084b487783
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
aureus (
|
4
|
+
aureus (3.0.0)
|
5
5
|
formtastic (= 2.3.0.rc3)
|
6
6
|
haml-rails (~> 0.5)
|
7
|
-
jquery-datatables-rails (~> 1.12)
|
8
7
|
jquery-rails (~> 3.0)
|
9
8
|
jquery-ui-rails (~> 4.0)
|
10
9
|
leaflet-rails (~> 0.7)
|
@@ -15,30 +14,30 @@ PATH
|
|
15
14
|
GEM
|
16
15
|
remote: http://rubygems.org/
|
17
16
|
specs:
|
18
|
-
actionpack (4.
|
19
|
-
|
20
|
-
|
21
|
-
erubis (~> 2.7.0)
|
17
|
+
actionpack (4.1.1)
|
18
|
+
actionview (= 4.1.1)
|
19
|
+
activesupport (= 4.1.1)
|
22
20
|
rack (~> 1.5.2)
|
23
21
|
rack-test (~> 0.6.2)
|
24
|
-
|
25
|
-
activesupport (= 4.
|
26
|
-
builder (~> 3.1
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
22
|
+
actionview (4.1.1)
|
23
|
+
activesupport (= 4.1.1)
|
24
|
+
builder (~> 3.1)
|
25
|
+
erubis (~> 2.7.0)
|
26
|
+
activemodel (4.1.1)
|
27
|
+
activesupport (= 4.1.1)
|
28
|
+
builder (~> 3.1)
|
29
|
+
activerecord (4.1.1)
|
30
|
+
activemodel (= 4.1.1)
|
31
|
+
activesupport (= 4.1.1)
|
32
|
+
arel (~> 5.0.0)
|
33
|
+
activesupport (4.1.1)
|
34
|
+
i18n (~> 0.6, >= 0.6.9)
|
35
|
+
json (~> 1.7, >= 1.7.7)
|
36
|
+
minitest (~> 5.1)
|
37
37
|
thread_safe (~> 0.1)
|
38
|
-
tzinfo (~>
|
39
|
-
arel (
|
40
|
-
|
41
|
-
builder (3.1.4)
|
38
|
+
tzinfo (~> 1.1)
|
39
|
+
arel (5.0.1.20140414130214)
|
40
|
+
builder (3.2.2)
|
42
41
|
combustion (0.5.1)
|
43
42
|
activesupport (>= 3.0.0)
|
44
43
|
railties (>= 3.0.0)
|
@@ -59,32 +58,31 @@ GEM
|
|
59
58
|
railties (>= 4.0.1)
|
60
59
|
hike (1.2.3)
|
61
60
|
i18n (0.6.9)
|
62
|
-
jquery-datatables-rails (1.12.2)
|
63
|
-
jquery-rails
|
64
61
|
jquery-rails (3.1.0)
|
65
62
|
railties (>= 3.0, < 5.0)
|
66
63
|
thor (>= 0.14, < 2.0)
|
67
64
|
jquery-ui-rails (4.2.1)
|
68
65
|
railties (>= 3.2.16)
|
69
|
-
|
66
|
+
json (1.8.1)
|
67
|
+
leaflet-rails (0.7.3)
|
70
68
|
mapbox-rails (1.6.1.1)
|
71
|
-
minitest (
|
72
|
-
multi_json (1.
|
69
|
+
minitest (5.3.4)
|
70
|
+
multi_json (1.10.1)
|
73
71
|
normalize-rails (3.0.1)
|
74
72
|
rack (1.5.2)
|
75
73
|
rack-test (0.6.2)
|
76
74
|
rack (>= 1.0)
|
77
|
-
railties (4.
|
78
|
-
actionpack (= 4.
|
79
|
-
activesupport (= 4.
|
75
|
+
railties (4.1.1)
|
76
|
+
actionpack (= 4.1.1)
|
77
|
+
activesupport (= 4.1.1)
|
80
78
|
rake (>= 0.8.7)
|
81
79
|
thor (>= 0.18.1, < 2.0)
|
82
|
-
rake (10.
|
80
|
+
rake (10.3.2)
|
83
81
|
rspec-core (2.14.8)
|
84
82
|
rspec-expectations (2.14.5)
|
85
83
|
diff-lcs (>= 1.1.3, < 2.0)
|
86
84
|
rspec-mocks (2.14.6)
|
87
|
-
rspec-rails (2.14.
|
85
|
+
rspec-rails (2.14.2)
|
88
86
|
actionpack (>= 3.0)
|
89
87
|
activemodel (>= 3.0)
|
90
88
|
activesupport (>= 3.0)
|
@@ -98,7 +96,7 @@ GEM
|
|
98
96
|
sass (~> 3.2.0)
|
99
97
|
sprockets (~> 2.8, <= 2.11.0)
|
100
98
|
sprockets-rails (~> 2.0)
|
101
|
-
sprockets (2.
|
99
|
+
sprockets (2.11.0)
|
102
100
|
hike (~> 1.2)
|
103
101
|
multi_json (~> 1.0)
|
104
102
|
rack (~> 1.0)
|
@@ -107,12 +105,12 @@ GEM
|
|
107
105
|
actionpack (>= 3.0)
|
108
106
|
activesupport (>= 3.0)
|
109
107
|
sprockets (~> 2.8)
|
110
|
-
sqlite3 (1.3.
|
111
|
-
thor (0.
|
112
|
-
thread_safe (0.
|
113
|
-
atomic
|
108
|
+
sqlite3 (1.3.9)
|
109
|
+
thor (0.19.1)
|
110
|
+
thread_safe (0.3.4)
|
114
111
|
tilt (1.4.1)
|
115
|
-
tzinfo (
|
112
|
+
tzinfo (1.2.1)
|
113
|
+
thread_safe (~> 0.1)
|
116
114
|
|
117
115
|
PLATFORMS
|
118
116
|
ruby
|
@@ -123,6 +121,7 @@ DEPENDENCIES
|
|
123
121
|
aureus!
|
124
122
|
combustion
|
125
123
|
generator_spec
|
126
|
-
|
124
|
+
rake
|
125
|
+
rspec-rails (~> 2.14)
|
127
126
|
sprockets
|
128
127
|
sqlite3
|
data/README.md
CHANGED
@@ -5,76 +5,68 @@
|
|
5
5
|
Aureus is a tool to quickly generate admin interfaces for a rails app.
|
6
6
|
It's between scaffolding and tools like ActiveAdmin.
|
7
7
|
|
8
|
-
##
|
9
|
-
|
10
|
-
The idea behind aureus is to abstract as much as possible of GUI rendering by still giving enough freedom for customization.
|
11
|
-
A typical aureus driven view would look like this:
|
12
|
-
|
13
|
-
```haml
|
14
|
-
= aureus_row do |r|
|
15
|
-
= aureus_box 'Datatable' do
|
16
|
-
= aureus_datatable Resource.all do |t|
|
17
|
-
- t.head do |h|
|
18
|
-
- h.text 'Title'
|
19
|
-
- h.text 'Text'
|
20
|
-
- t.row do |r,res|
|
21
|
-
- r.identifier res.id
|
22
|
-
- r.cell res.title
|
23
|
-
- r.cell res.text
|
24
|
-
- r.button :show, 'url'
|
25
|
-
- r.button :edit, 'url'
|
26
|
-
- r.button :destroy, 'url', confirm: 'Delete user?'
|
27
|
-
```
|
28
|
-
|
29
|
-
## Installation
|
8
|
+
## Sample Controller
|
30
9
|
|
31
|
-
|
10
|
+
The following Controller will render a finished interface:
|
32
11
|
|
33
12
|
```ruby
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
13
|
+
class ResourcesController < Aureus::ResourcesController
|
14
|
+
before_filter :prepare_aureus
|
15
|
+
|
16
|
+
def index
|
17
|
+
@resources = Resource.all
|
18
|
+
end
|
19
|
+
|
20
|
+
def new
|
21
|
+
@resource = Resource.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
Resource.create!(permitted_params[:resource])
|
26
|
+
redirect_to resources_url
|
27
|
+
end
|
28
|
+
|
29
|
+
def show
|
30
|
+
@resource = Resource.find(params[:id])
|
31
|
+
end
|
32
|
+
|
33
|
+
def edit
|
34
|
+
@resource = Resource.find(params[:id])
|
35
|
+
end
|
36
|
+
|
37
|
+
def update
|
38
|
+
resource = Resource.find(params[:id])
|
39
|
+
resource.update!(permitted_params[:resource])
|
40
|
+
redirect_to resource_url(resource)
|
41
|
+
end
|
42
|
+
|
43
|
+
def destroy
|
44
|
+
resource = Resource.find(params[:id])
|
45
|
+
resource.destroy!
|
46
|
+
redirect_to resources_url
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def prepare_aureus
|
52
|
+
aureus({
|
53
|
+
actions: [:index, :new, :create, :show, :edit, :update, :destroy],
|
54
|
+
table_fields: [:id, :title, :text],
|
55
|
+
form_fields: [:title, :text],
|
56
|
+
item_fields: [:title, :text]
|
57
|
+
})
|
58
|
+
end
|
59
|
+
|
60
|
+
def permitted_params
|
61
|
+
params.permit(resource: [:title, :text])
|
62
|
+
end
|
63
|
+
end
|
49
64
|
```
|
50
65
|
|
51
|
-
Change your `application.js` to match the following:
|
52
|
-
|
53
|
-
```javascript
|
54
|
-
//= require aureus
|
55
|
-
//= require_self
|
56
|
-
|
57
|
-
$(function(){
|
58
|
-
aureus({
|
59
|
-
remove_messages_after: 2
|
60
|
-
});
|
61
|
-
});
|
62
|
-
```
|
63
|
-
|
64
|
-
You can now use the aureus framework to rapidly build awesome interfaces!
|
65
|
-
|
66
66
|
## Generators
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
### Layout & Views
|
71
|
-
|
72
|
-
* Run `rails g aureus:layout application` to generate a typical aureus layout.
|
73
|
-
* Run `rails g aureus:views Resource ResourcesController` to generate aureus views for a model and controller.
|
68
|
+
The following generators are available:
|
74
69
|
|
75
|
-
|
70
|
+
* Run `rails g aureus:setup` to create the initializer.
|
71
|
+
* Run `rails g aureus:copy` to copy the views and layout.
|
76
72
|
|
77
|
-
* Run `rails g aureus:devise_views devise` to generate views using aureus helpers.
|
78
|
-
* Run `rails g aureus:devise_i18n devise` to generate the i18n file used by the views.
|
79
|
-
* Run `rails g aureus:devise_invitable_views devise` to generate views using aureus helpers.
|
80
|
-
* Run `rails g aureus:devise_invitable_i18n devise` to generate the i18n file used by the views.
|
@@ -2,7 +2,6 @@
|
|
2
2
|
//= require jquery_ujs
|
3
3
|
//= require leaflet
|
4
4
|
//= require mapbox
|
5
|
-
//= require dataTables/jquery.dataTables
|
6
5
|
|
7
6
|
var aureus_default_options = {
|
8
7
|
mapbox_id: 'the_id'
|
@@ -11,56 +10,16 @@ var aureus_default_options = {
|
|
11
10
|
function aureus(options) {
|
12
11
|
window.__aureus = { options: jQuery.extend({}, aureus_default_options, options || {}) };
|
13
12
|
_aureus_remove_messages_after(window.__aureus.options.remove_messages_after);
|
14
|
-
_aureus_datatables_decorate();
|
15
13
|
_aureus_simple_map();
|
16
14
|
_aureus_dropdown();
|
17
15
|
}
|
18
16
|
|
19
|
-
function aureus_trigger_form(selector) {
|
20
|
-
$(selector).submit();
|
21
|
-
}
|
22
|
-
|
23
17
|
function _aureus_remove_messages_after(seconds) {
|
24
18
|
setTimeout(function() {
|
25
19
|
$('.aureus-messages p').fadeOut();
|
26
20
|
}, seconds*1000);
|
27
21
|
}
|
28
22
|
|
29
|
-
function _aureus_datatables_decorate() {
|
30
|
-
$.fn.dataTableExt.oStdClasses.sWrapper = 'datatable-wrapper';
|
31
|
-
$('.datatable').each(function(){
|
32
|
-
$(this).dataTable({
|
33
|
-
sDom: 't',
|
34
|
-
oLanguage: _aureus_datatable_translation($(this)),
|
35
|
-
bPaginate: false,
|
36
|
-
aoColumns: _aureus_datatables_column_configurator($(this))
|
37
|
-
});
|
38
|
-
});
|
39
|
-
}
|
40
|
-
|
41
|
-
function _aureus_datatable_translation(table) {
|
42
|
-
return {
|
43
|
-
sSearch : table.data('i18n_sSearch'),
|
44
|
-
sLengthMenu: table.data('i18n_sLengthMenu'),
|
45
|
-
sZeroRecords: table.data('i18n_sZeroRecords'),
|
46
|
-
sInfo: table.data('i18n_sInfo'),
|
47
|
-
sInfoEmpty: table.data('i18n_sInfoEmpty'),
|
48
|
-
sInfoFiltered: table.data('i18n_sInfoFiltere')
|
49
|
-
};
|
50
|
-
}
|
51
|
-
|
52
|
-
function _aureus_datatables_column_configurator(table) {
|
53
|
-
var ret = [];
|
54
|
-
table.find('thead tr th').each(function(){
|
55
|
-
if($(this).hasClass('no-sorting')) {
|
56
|
-
ret.push({ bSortable: false });
|
57
|
-
} else {
|
58
|
-
ret.push(null);
|
59
|
-
}
|
60
|
-
});
|
61
|
-
return ret;
|
62
|
-
}
|
63
|
-
|
64
23
|
function _aureus_simple_map() {
|
65
24
|
$('.aureus-simple-map').each(function(){
|
66
25
|
var el = $(this);
|
@@ -41,10 +41,6 @@ $color-toolbar-info: #59483c;
|
|
41
41
|
$color-toolbar-link: #fff;
|
42
42
|
$color-toolbar-link-hover: #c6b78d;
|
43
43
|
|
44
|
-
$icon-sort: image-path("aureus/icon-sort.png");
|
45
|
-
$icon-sort_abc_asc: image-path("aureus/icon-sort-abc-asc.png");
|
46
|
-
$icon-sort_abc_desc: image-path("aureus/icon-sort-abc-desc.png");
|
47
|
-
|
48
44
|
$icon-pencil: image-path("aureus/icon-pencil.png");
|
49
45
|
$icon-cross: image-path("aureus/icon-cross.png");
|
50
46
|
$icon-eye: image-path("aureus/icon-eye.png");
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.datatable, .simple-table {
|
1
|
+
.aureus-datatable, .aureus-simple-table {
|
2
2
|
width: 100%;
|
3
3
|
border-spacing: 0;
|
4
4
|
thead {
|
@@ -22,21 +22,6 @@
|
|
22
22
|
th:first-child {
|
23
23
|
border-left: 0;
|
24
24
|
}
|
25
|
-
th.sorting {
|
26
|
-
background-image: url($icon-sort);
|
27
|
-
background-repeat: no-repeat;
|
28
|
-
background-position: center right;
|
29
|
-
}
|
30
|
-
th.sorting_asc {
|
31
|
-
background-image: url($icon-sort_abc_asc);
|
32
|
-
background-repeat: no-repeat;
|
33
|
-
background-position: center right;
|
34
|
-
}
|
35
|
-
th.sorting_desc {
|
36
|
-
background-image: url($icon-sort_abc_desc);
|
37
|
-
background-repeat: no-repeat;
|
38
|
-
background-position: center right;
|
39
|
-
}
|
40
25
|
th.center {
|
41
26
|
text-align: center;
|
42
27
|
}
|
@@ -1,3 +1,11 @@
|
|
1
|
+
//= depend_on aureus/theme/base
|
2
|
+
//= depend_on aureus/theme/messages
|
3
|
+
//= depend_on aureus/theme/toolbar
|
4
|
+
//= depend_on aureus/theme/navigation
|
5
|
+
//= depend_on aureus/theme/content
|
6
|
+
//= depend_on aureus/theme/table
|
7
|
+
//= depend_on aureus/theme/form
|
8
|
+
|
1
9
|
@import 'aureus/theme/base';
|
2
10
|
@import 'aureus/theme/messages';
|
3
11
|
@import 'aureus/theme/toolbar';
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Aureus
|
2
|
+
class ResourcesController < AureusController
|
3
|
+
protected
|
4
|
+
|
5
|
+
def aureus(options)
|
6
|
+
@aureus ||= {}
|
7
|
+
@aureus[:box_title] = 'Attributes'
|
8
|
+
@aureus[:form_inputs] = (options[:form_fields] || []).map{|f| [f] }
|
9
|
+
|
10
|
+
model_name = params[:controller].split('/').last.singularize
|
11
|
+
|
12
|
+
@aureus[:resource] = lambda{ instance_variable_get(:"@#{model_name}") }
|
13
|
+
@aureus[:resources] = lambda{ instance_variable_get(:"@#{model_name.pluralize}") }
|
14
|
+
|
15
|
+
case params[:action]
|
16
|
+
when 'index'
|
17
|
+
@aureus[:title] = "All #{model_name.pluralize.titleize}"
|
18
|
+
@aureus[:box_title] = 'List'
|
19
|
+
if options[:actions].include?(:new)
|
20
|
+
@aureus[:navigation_buttons] = [["New #{model_name.titleize}", path_for(:new)]]
|
21
|
+
end
|
22
|
+
@aureus[:table_cells] = (options[:table_fields] || []).map{|f| [f.to_s.titleize, lambda{|r| r.send(f) }] }
|
23
|
+
@aureus[:row_actions] = []
|
24
|
+
if options[:actions].include?(:show)
|
25
|
+
@aureus[:row_actions] << lambda{|r| [:show, path_for(:show, r.id)] }
|
26
|
+
end
|
27
|
+
if options[:actions].include?(:edit)
|
28
|
+
@aureus[:row_actions] << lambda{|r| [:edit, path_for(:edit, r.id)] }
|
29
|
+
end
|
30
|
+
if options[:actions].include?(:destroy)
|
31
|
+
@aureus[:row_actions] << lambda{|r| [:destroy, path_for(:destroy, r.id), confirm: 'Really?'] }
|
32
|
+
end
|
33
|
+
when 'new'
|
34
|
+
@aureus[:title] = "New #{model_name.titleize}"
|
35
|
+
@aureus[:navigation_buttons] = [['Cancel', path_for(:index)]]
|
36
|
+
when 'show'
|
37
|
+
@aureus[:title] = "View #{model_name.titleize}"
|
38
|
+
@aureus[:navigation_buttons] = [['Back', path_for(:index)]]
|
39
|
+
@aureus[:item_entries] = (options[:item_fields] || []).map{|f| [f.to_s.titleize, lambda{|r| r.send(f) }] }
|
40
|
+
when 'edit'
|
41
|
+
@aureus[:title] = "Edit #{model_name.titleize}"
|
42
|
+
@aureus[:navigation_buttons] = [['Cancel', path_for(:index)]]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def path_for(action, id=nil)
|
49
|
+
url_for(action: action, id: id, only_path: true)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= aureus_row do
|
2
|
+
= aureus_box @aureus[:box_title] do
|
3
|
+
= aureus_datatable @aureus[:resources].call do |t|
|
4
|
+
- t.head do |h|
|
5
|
+
- (@aureus[:table_cells] || []).each do |cell|
|
6
|
+
- h.text cell[0]
|
7
|
+
- t.row do |r, resource|
|
8
|
+
- (@aureus[:table_cells] || []).each do |cell|
|
9
|
+
- r.cell cell[1].call(resource)
|
10
|
+
- (@aureus[:row_actions] || []).each do |action|
|
11
|
+
- r.button *action.call(resource)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{ charset: 'utf-8' }
|
5
|
+
%title= Aureus.site_title
|
6
|
+
= stylesheet_link_tag 'aureus/layout', media: 'all', 'data-turbolinks-track' => true
|
7
|
+
= javascript_include_tag 'aureus/layout', 'data-turbolinks-track' => true
|
8
|
+
= csrf_meta_tag
|
9
|
+
%body
|
10
|
+
= aureus_toolbar (Aureus.toolbar_title || 'Aureus') do |t|
|
11
|
+
- instance_exec(t, &Aureus.toolbar_builder)
|
12
|
+
= yield(:navigation)
|
13
|
+
= aureus_messages flash
|
14
|
+
.aureus-content= yield
|
data/aureus.gemspec
CHANGED
data/config.ru
CHANGED
@@ -1,31 +1,28 @@
|
|
1
1
|
module Aureus
|
2
|
-
|
3
2
|
module Components
|
4
|
-
|
5
3
|
class Box < Renderable
|
6
|
-
|
7
|
-
def initialize title, options, &block
|
4
|
+
def initialize(title, options, &block)
|
8
5
|
init options, for: :text, centered: false
|
9
6
|
init_haml_helpers
|
10
7
|
@title = title
|
11
8
|
@buttons = Array.new
|
12
|
-
@content = capture_haml
|
9
|
+
@content = capture_haml(self, &block)
|
13
10
|
end
|
14
11
|
|
15
|
-
def content
|
16
|
-
@new_content = capture_haml
|
12
|
+
def content(&block)
|
13
|
+
@new_content = capture_haml(&block)
|
17
14
|
end
|
18
15
|
|
19
|
-
def foot
|
16
|
+
def foot(&block)
|
20
17
|
@foot = capture_haml &block
|
21
18
|
end
|
22
19
|
|
23
|
-
def button
|
24
|
-
@buttons <<
|
20
|
+
def button(content)
|
21
|
+
@buttons << content
|
25
22
|
end
|
26
23
|
|
27
24
|
def render
|
28
|
-
title = content_tag('h3',compact(content_tag('span', @title),
|
25
|
+
title = content_tag('h3', compact(content_tag('span', @title), @buttons.join))
|
29
26
|
classes = ['box']
|
30
27
|
classes << 'centered' if @options[:centered]
|
31
28
|
@content = @new_content if !@new_content.nil?
|
@@ -38,21 +35,6 @@ module Aureus
|
|
38
35
|
compact title, content_tag('div', @content), footer
|
39
36
|
end
|
40
37
|
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
class BoxButton < Renderable
|
45
|
-
|
46
|
-
def initialize content
|
47
|
-
@content = content
|
48
|
-
end
|
49
|
-
|
50
|
-
def render
|
51
|
-
@content
|
52
|
-
end
|
53
|
-
|
54
38
|
end
|
55
|
-
|
56
39
|
end
|
57
|
-
|
58
40
|
end
|