aureus 1.3.1 → 2.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +4 -1
- data/Gemfile +9 -8
- data/Gemfile.lock +105 -104
- data/README.md +80 -0
- data/Rakefile +3 -16
- data/app/assets/javascripts/aureus/index.js +78 -20
- data/app/assets/stylesheets/aureus/index.scss +3 -35
- data/app/assets/stylesheets/aureus/skin/default.scss +52 -0
- data/app/assets/stylesheets/aureus/theme.scss +7 -0
- data/app/assets/stylesheets/aureus/theme/base.scss +19 -0
- data/app/assets/stylesheets/aureus/theme/content.scss +65 -0
- data/app/assets/stylesheets/aureus/{form.scss → theme/form.scss} +27 -27
- data/app/assets/stylesheets/aureus/theme/messages.scss +16 -0
- data/app/assets/stylesheets/aureus/theme/navigation.scss +42 -0
- data/app/assets/stylesheets/aureus/theme/table.scss +121 -0
- data/app/assets/stylesheets/aureus/theme/toolbar.scss +80 -0
- data/aureus.gemspec +21 -12
- data/config.ru +10 -0
- data/lib/aureus.rb +22 -18
- data/lib/aureus/components/box.rb +58 -0
- data/lib/aureus/components/content.rb +19 -0
- data/lib/aureus/components/data_table.rb +169 -0
- data/lib/aureus/components/listing.rb +43 -0
- data/lib/aureus/components/messages.rb +27 -0
- data/lib/aureus/components/navigation.rb +48 -0
- data/lib/aureus/components/row.rb +69 -0
- data/lib/aureus/components/simple_map.rb +21 -0
- data/lib/aureus/components/toolbar.rb +124 -0
- data/lib/aureus/engine.rb +8 -2
- data/lib/aureus/helper.rb +56 -55
- data/lib/aureus/renderable.rb +4 -12
- data/lib/aureus/version.rb +2 -2
- data/lib/generators/aureus/devise_i18n/devise_i18n_generator.rb +17 -12
- data/{config → lib/generators/aureus/devise_i18n}/locales/devise_base.de.yml +0 -0
- data/{config → lib/generators/aureus/devise_i18n}/locales/devise_base.en.yml +1 -1
- data/{config → lib/generators/aureus/devise_i18n}/locales/devise_mail.de.yml +1 -1
- data/{config → lib/generators/aureus/devise_i18n}/locales/devise_mail.en.yml +1 -1
- data/{config → lib/generators/aureus/devise_i18n}/locales/devise_ui.de.yml +0 -0
- data/{config → lib/generators/aureus/devise_i18n}/locales/devise_ui.en.yml +0 -0
- data/lib/generators/aureus/devise_invitable_i18n/devise_invitable_i18n_generator.rb +25 -0
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.de.yml +11 -0
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.en.yml +11 -0
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.de.yml +9 -0
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.en.yml +9 -0
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.de.yml +12 -0
- data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.en.yml +12 -0
- data/lib/generators/aureus/devise_invitable_views/devise_invitable_views_generator.rb +23 -0
- data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/edit.html.haml +9 -0
- data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/new.html.haml +8 -0
- data/lib/generators/aureus/devise_invitable_views/templates/devise/mailer/invitation_instructions.html.haml +5 -0
- data/lib/generators/aureus/devise_views/devise_views_generator.rb +17 -15
- data/lib/generators/aureus/devise_views/templates/devise/confirmations/new.html.haml +5 -5
- data/lib/generators/aureus/devise_views/templates/devise/mailer/confirmation_instructions.html.haml +3 -3
- data/lib/generators/aureus/devise_views/templates/devise/mailer/reset_password_instructions.html.haml +5 -5
- data/lib/generators/aureus/devise_views/templates/devise/mailer/unlock_instructions.html.haml +4 -4
- data/lib/generators/aureus/devise_views/templates/devise/passwords/edit.html.haml +7 -7
- data/lib/generators/aureus/devise_views/templates/devise/passwords/new.html.haml +5 -5
- data/lib/generators/aureus/devise_views/templates/devise/registrations/edit.html.haml +9 -9
- data/lib/generators/aureus/devise_views/templates/devise/registrations/new.html.haml +7 -7
- data/lib/generators/aureus/devise_views/templates/devise/sessions/new.html.haml +7 -7
- data/lib/generators/aureus/devise_views/templates/devise/shared/_links.html.haml +6 -6
- data/lib/generators/aureus/devise_views/templates/devise/unlocks/new.html.haml +5 -5
- data/lib/generators/aureus/layout/layout_generator.rb +10 -10
- data/lib/generators/aureus/layout/templates/layout.html.haml +8 -8
- data/lib/generators/aureus/views/templates/views/_form.html.haml +3 -3
- data/lib/generators/aureus/views/templates/views/_item.html.haml +2 -2
- data/lib/generators/aureus/views/templates/views/_list.html.haml +8 -8
- data/lib/generators/aureus/views/templates/views/edit.html.haml +4 -4
- data/lib/generators/aureus/views/templates/views/index.html.haml +3 -3
- data/lib/generators/aureus/views/templates/views/new.html.haml +4 -4
- data/lib/generators/aureus/views/templates/views/show.html.haml +4 -4
- data/lib/generators/aureus/views/views_generator.rb +70 -68
- data/spec/controllers/all_spec.rb +19 -0
- data/spec/internal/app/assets/javascripts/application.js +9 -0
- data/spec/internal/app/assets/stylesheets/application.scss +5 -0
- data/spec/internal/app/controllers/all_controller.rb +14 -0
- data/spec/internal/app/controllers/resources_controller.rb +2 -0
- data/spec/{lib/helper → internal/app/models}/resource.rb +0 -0
- data/spec/internal/app/views/all/centered.html.haml +5 -0
- data/spec/internal/app/views/all/index.html.haml +39 -0
- data/spec/internal/app/views/layouts/application.html.haml +24 -0
- data/spec/internal/app/views/layouts/naked.html.haml +10 -0
- data/spec/internal/config/database.yml +3 -0
- data/spec/internal/config/routes.rb +5 -0
- data/spec/internal/db/schema.rb +10 -0
- data/spec/internal/log/.gitignore +1 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/lib/generators/devise_i18n_spec.rb +19 -0
- data/spec/lib/generators/devise_invitable_i18n_spec.rb +19 -0
- data/spec/lib/generators/devise_invitable_views_spec.rb +19 -0
- data/spec/lib/generators/devise_views_spec.rb +25 -0
- data/spec/lib/generators/layout_spec.rb +17 -0
- data/spec/lib/generators/views_spec.rb +26 -0
- data/spec/requests/all_spec.rb +12 -0
- data/spec/spec_helper.rb +15 -0
- metadata +219 -78
- data/.rspec +0 -2
- data/Guardfile +0 -4
- data/Readme.md +0 -370
- data/TODO.md +0 -11
- data/app/assets/images/aureus/background.png +0 -0
- data/app/assets/images/aureus/topbar.png +0 -0
- data/app/assets/javascripts/aureus/defaults.js +0 -30
- data/app/assets/javascripts/aureus/extensions.js +0 -42
- data/app/assets/javascripts/aureus/functions.js +0 -67
- data/app/assets/javascripts/aureus/plugins/jquery-calendrical.js +0 -508
- data/app/assets/javascripts/aureus/plugins/jquery-datatables.js +0 -11838
- data/app/assets/javascripts/aureus/plugins/jquery-qtip.js +0 -15
- data/app/assets/stylesheets/aureus/base.scss +0 -48
- data/app/assets/stylesheets/aureus/content.scss +0 -100
- data/app/assets/stylesheets/aureus/mixins.scss +0 -43
- data/app/assets/stylesheets/aureus/navigation.scss +0 -43
- data/app/assets/stylesheets/aureus/reset.scss +0 -50
- data/app/assets/stylesheets/aureus/table.scss +0 -153
- data/app/assets/stylesheets/aureus/topbar.scss +0 -89
- data/app/assets/stylesheets/aureus/ui.scss +0 -98
- data/lib/aureus/box.rb +0 -54
- data/lib/aureus/content.rb +0 -15
- data/lib/aureus/data_table.rb +0 -148
- data/lib/aureus/listing.rb +0 -39
- data/lib/aureus/map.rb +0 -17
- data/lib/aureus/messages.rb +0 -23
- data/lib/aureus/navigation.rb +0 -42
- data/lib/aureus/row.rb +0 -65
- data/lib/aureus/toolbar.rb +0 -99
- data/spec/lib/helper/schema.rb +0 -6
- data/spec/lib/render_spec.rb +0 -16
- data/spec/lib/spec_helper.rb +0 -21
- data/spec/lib/views/box.haml +0 -14
- data/spec/lib/views/content.haml +0 -2
- data/spec/lib/views/datatable.haml +0 -11
- data/spec/lib/views/listing.haml +0 -5
- data/spec/lib/views/messages.haml +0 -2
- data/spec/lib/views/navigation.haml +0 -4
- data/spec/lib/views/row.haml +0 -28
- data/spec/lib/views/toolbar.haml +0 -11
@@ -0,0 +1,80 @@
|
|
1
|
+
.aureus-toolbar {
|
2
|
+
padding: 12px 40px;
|
3
|
+
height: 18px;
|
4
|
+
background-color: $color-toolbar;
|
5
|
+
h1 {
|
6
|
+
color: $color-toolbar-title;
|
7
|
+
margin: 1px 0px;
|
8
|
+
font-size: 14px;
|
9
|
+
font-weight: normal;
|
10
|
+
float: left;
|
11
|
+
text-transform: uppercase;
|
12
|
+
}
|
13
|
+
ul {
|
14
|
+
padding: 0;
|
15
|
+
margin: 0;
|
16
|
+
&.left {
|
17
|
+
float: left;
|
18
|
+
margin-left: 20px;
|
19
|
+
}
|
20
|
+
&.right {
|
21
|
+
float: right;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
li.level-0, li.dropdown-outer {
|
25
|
+
display: inline-block;
|
26
|
+
position: relative;
|
27
|
+
a, .dropdown-accessor {
|
28
|
+
font-size: 14px;
|
29
|
+
text-decoration: none;
|
30
|
+
padding: 0 10px;
|
31
|
+
}
|
32
|
+
.info {
|
33
|
+
color: $color-toolbar-info;
|
34
|
+
padding: 0 10px;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
li.level-0:hover, li.dropdown-outer:hover {
|
38
|
+
> a, .dropdown-accessor {
|
39
|
+
color: $color-toolbar-link-hover;
|
40
|
+
cursor: pointer;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
li.dropdown-outer {
|
44
|
+
ul.dropdown-inner {
|
45
|
+
display: none;
|
46
|
+
background-color: $color-toolbar;
|
47
|
+
padding: 10px;
|
48
|
+
padding-top: 15px;
|
49
|
+
margin-left: -10px;
|
50
|
+
li {
|
51
|
+
display: block;
|
52
|
+
padding: 4px 0px;
|
53
|
+
a {
|
54
|
+
white-space: nowrap;
|
55
|
+
}
|
56
|
+
.info {
|
57
|
+
white-space: nowrap;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
.line {
|
61
|
+
margin: 8px 0;
|
62
|
+
border-top: 1px solid $color-toolbar-link;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
li.dropdown-outer:hover, li.dropdown-outer.active {
|
67
|
+
ul.dropdown-inner {
|
68
|
+
z-index: 3;
|
69
|
+
display: block;
|
70
|
+
position: absolute;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
ul.dropdown-inner {
|
74
|
+
li:hover {
|
75
|
+
a {
|
76
|
+
color: $color-toolbar-link-hover;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
data/aureus.gemspec
CHANGED
@@ -1,20 +1,29 @@
|
|
1
|
-
#
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "aureus/version"
|
1
|
+
# encoding: utf-8
|
4
2
|
|
5
|
-
|
3
|
+
$:.push File.expand_path('../lib', __FILE__)
|
4
|
+
require 'aureus/version'
|
6
5
|
|
7
|
-
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'aureus'
|
8
8
|
s.version = Aureus::VERSION
|
9
|
-
s.summary =
|
10
|
-
s.description =
|
11
|
-
s.license =
|
9
|
+
s.summary = 'a nice looking framework for your rails admin interfaces'
|
10
|
+
s.description = 'Aureus is a tool to quickly generate admin interfaces for a rails app. Its between scaffolding and tools like ActiveAdmin.'
|
11
|
+
s.license = 'MIT'
|
12
12
|
|
13
|
-
s.author =
|
14
|
-
s.email =
|
15
|
-
s.homepage =
|
13
|
+
s.author = 'Joël Gähhwiler'
|
14
|
+
s.email = 'joel.gaehwiler@bluewin.ch'
|
15
|
+
s.homepage = 'https://github.com/256dpi/aureus'
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
|
20
|
-
|
20
|
+
s.add_runtime_dependency 'sass-rails', '~> 0'
|
21
|
+
s.add_runtime_dependency 'jquery-rails', '~> 0'
|
22
|
+
s.add_runtime_dependency 'jquery-ui-rails', '~> 0'
|
23
|
+
s.add_runtime_dependency 'haml-rails', '~> 0'
|
24
|
+
s.add_runtime_dependency 'leaflet-rails', '~> 0'
|
25
|
+
s.add_runtime_dependency 'formtastic', '2.3.0.rc2'
|
26
|
+
s.add_runtime_dependency 'normalize-rails', '~> 0'
|
27
|
+
s.add_runtime_dependency 'mapbox-rails', '~> 0'
|
28
|
+
s.add_runtime_dependency 'jquery-datatables-rails', '~> 0'
|
29
|
+
end
|
data/config.ru
ADDED
data/lib/aureus.rb
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require 'aureus/version'
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'formtastic'
|
4
|
+
require 'haml'
|
5
|
+
require 'jquery-rails'
|
6
|
+
require 'leaflet-rails'
|
7
|
+
require 'normalize-rails'
|
8
|
+
require 'mapbox-rails'
|
9
|
+
require 'jquery-datatables-rails'
|
4
10
|
|
5
11
|
module Aureus
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
autoload :Form
|
18
|
-
autoload :Listing
|
19
|
-
autoload :Map
|
20
|
-
|
12
|
+
module Components
|
13
|
+
autoload :Box, 'aureus/components/box'
|
14
|
+
autoload :Content, 'aureus/components/content'
|
15
|
+
autoload :DataTable, 'aureus/components/data_table'
|
16
|
+
autoload :Listing, 'aureus/components/listing'
|
17
|
+
autoload :Messages, 'aureus/components/messages'
|
18
|
+
autoload :Navigation, 'aureus/components/navigation'
|
19
|
+
autoload :Row, 'aureus/components/row'
|
20
|
+
autoload :SimpleMap, 'aureus/components/simple_map'
|
21
|
+
autoload :Toolbar, 'aureus/components/toolbar'
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
|
-
require
|
25
|
+
require 'aureus/renderable'
|
26
|
+
require 'aureus/helper'
|
27
|
+
require 'aureus/engine'
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Aureus
|
2
|
+
|
3
|
+
module Components
|
4
|
+
|
5
|
+
class Box < Renderable
|
6
|
+
|
7
|
+
def initialize title, options, &block
|
8
|
+
init options, for: :text, centered: false
|
9
|
+
init_haml_helpers
|
10
|
+
@title = title
|
11
|
+
@buttons = Array.new
|
12
|
+
@content = capture_haml self, &block
|
13
|
+
end
|
14
|
+
|
15
|
+
def content &block
|
16
|
+
@new_content = capture_haml &block
|
17
|
+
end
|
18
|
+
|
19
|
+
def foot &block
|
20
|
+
@foot = capture_haml &block
|
21
|
+
end
|
22
|
+
|
23
|
+
def button content
|
24
|
+
@buttons << BoxButton.new(content)
|
25
|
+
end
|
26
|
+
|
27
|
+
def render
|
28
|
+
title = content_tag('h3',compact(content_tag('span', @title),compact_render(*@buttons)))
|
29
|
+
classes = ['box']
|
30
|
+
classes << 'centered' if @options[:centered]
|
31
|
+
@content = @new_content if !@new_content.nil?
|
32
|
+
content_tag 'div', class: classes.join(' ') do
|
33
|
+
case @options[:for]
|
34
|
+
when :form
|
35
|
+
@content = content_tag('ul', @content, class: 'content')
|
36
|
+
end
|
37
|
+
footer = @foot.nil? ? '' : content_tag('div', @foot, class: 'foot')
|
38
|
+
compact title, content_tag('div', @content), footer
|
39
|
+
end
|
40
|
+
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
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
module Aureus
|
2
|
+
|
3
|
+
module Components
|
4
|
+
|
5
|
+
class DataTable < Renderable
|
6
|
+
include ActionView::Helpers::JavaScriptHelper
|
7
|
+
|
8
|
+
def initialize resource
|
9
|
+
@resource = resource
|
10
|
+
@head = DataTableHead.new
|
11
|
+
@rows = Array.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def head
|
15
|
+
yield @head
|
16
|
+
end
|
17
|
+
|
18
|
+
def row
|
19
|
+
@resource.each do |r|
|
20
|
+
row = DataTableRow.new
|
21
|
+
yield row, r
|
22
|
+
@rows << row
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def data
|
27
|
+
{
|
28
|
+
i18n_sSearch: I18n.t('aureus.datatables.search'),
|
29
|
+
i18n_sLengthMenu: I18n.t('aureus.datatables.length_menu'),
|
30
|
+
i18n_sZeroRecords: I18n.t('aureus.datatables.zero_records'),
|
31
|
+
i18n_sInfo: I18n.t('aureus.datatables.info'),
|
32
|
+
i18n_sInfoEmpty: I18n.t('aureus.datatables.info_empty'),
|
33
|
+
i18n_sInfoFiltered: I18n.t('aureus.datatables.info_filtered')
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def render
|
38
|
+
content_tag 'table', id: @resource.class.name.downcase, class: 'datatable', data: data do
|
39
|
+
compact @head.render, content_tag('tbody',compact_render(*@rows))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
class DataTableHead < Renderable
|
46
|
+
|
47
|
+
def initialize
|
48
|
+
@columns = Array.new
|
49
|
+
end
|
50
|
+
|
51
|
+
def text name
|
52
|
+
@columns << DataTableHeadColumn.new(name,'text-sorting')
|
53
|
+
end
|
54
|
+
|
55
|
+
def date name
|
56
|
+
@columns << DataTableHeadColumn.new(name,'date-sorting')
|
57
|
+
end
|
58
|
+
|
59
|
+
def raw name
|
60
|
+
@columns << DataTableHeadColumn.new(name,'no-sorting')
|
61
|
+
end
|
62
|
+
|
63
|
+
def render
|
64
|
+
raw ''
|
65
|
+
content_tag 'thead' do
|
66
|
+
content_tag 'tr', compact_render(*@columns)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
class DataTableHeadColumn < Renderable
|
73
|
+
|
74
|
+
def initialize name, sorting
|
75
|
+
@name = name
|
76
|
+
@sorting = sorting
|
77
|
+
end
|
78
|
+
|
79
|
+
def render
|
80
|
+
content_tag 'th', @name, class: @sorting
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
class DataTableRow < Renderable
|
86
|
+
|
87
|
+
def initialize
|
88
|
+
init_haml_helpers
|
89
|
+
@cells = Array.new
|
90
|
+
@buttons = Array.new
|
91
|
+
@identifier = ''
|
92
|
+
end
|
93
|
+
|
94
|
+
def identifier value
|
95
|
+
@identifier = value
|
96
|
+
end
|
97
|
+
|
98
|
+
def cell data='', &block
|
99
|
+
if block_given?
|
100
|
+
@cells << DataTableRowCell.new(capture_haml(&block))
|
101
|
+
else
|
102
|
+
@cells << DataTableRowCell.new(data)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def button type_or_title, url, *args
|
107
|
+
if type_or_title.is_a? Symbol
|
108
|
+
@buttons << DataTableRowButton.new(type_or_title,type_or_title.to_s,url,args)
|
109
|
+
else
|
110
|
+
@buttons << DataTableRowButton.new(:text,type_or_title.to_s,url,args)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def button_raw content
|
115
|
+
@buttons << Renderable.new(content)
|
116
|
+
end
|
117
|
+
|
118
|
+
def render
|
119
|
+
content_tag 'tr', compact_render(*@cells)+content_tag('td',compact_render(*@buttons),class: 'buttons'), id: @identifier
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
class DataTableRowCell < Renderable
|
125
|
+
|
126
|
+
def initialize data
|
127
|
+
@data = data
|
128
|
+
end
|
129
|
+
|
130
|
+
def render
|
131
|
+
content_tag 'td', @data
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
class DataTableRowButton < Renderable
|
137
|
+
|
138
|
+
def initialize type, text, url, options
|
139
|
+
init options, remote: true, confirm: 'Delete resource?'
|
140
|
+
@type = type
|
141
|
+
@text = text
|
142
|
+
@url = url
|
143
|
+
end
|
144
|
+
|
145
|
+
def render
|
146
|
+
@text = ' ' unless @type == :text
|
147
|
+
case @type
|
148
|
+
when :text
|
149
|
+
link_to @text, @url
|
150
|
+
when :print
|
151
|
+
link_to @text, @url, class: :print
|
152
|
+
when :show
|
153
|
+
link_to @text, @url, class: :show
|
154
|
+
when :edit
|
155
|
+
link_to @text, @url, class: :edit
|
156
|
+
when :destroy
|
157
|
+
if @options[:remote]
|
158
|
+
link_to @text, @url, class: :destroy, method: :delete, data: { confirm: @options[:confirm] }
|
159
|
+
else
|
160
|
+
link_to @text, @url, class: :destroy
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Aureus
|
2
|
+
|
3
|
+
module Components
|
4
|
+
|
5
|
+
class Listing < Renderable
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@entries = Array.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def entry head, body = nil, &block
|
12
|
+
init_haml_helpers
|
13
|
+
if block_given?
|
14
|
+
@entries << ListingEntry.new(head,capture_haml(&block))
|
15
|
+
else
|
16
|
+
@entries << ListingEntry.new(head,body)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def render
|
21
|
+
content_tag 'table', compact_render(*@entries), class: 'simple-table'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
class ListingEntry < Renderable
|
27
|
+
|
28
|
+
def initialize head, body
|
29
|
+
@head = head
|
30
|
+
@body = body
|
31
|
+
end
|
32
|
+
|
33
|
+
def render
|
34
|
+
content_tag 'tr' do
|
35
|
+
compact content_tag('th',@head), content_tag('td',@body)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|