aureus 1.3.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -1
  3. data/Gemfile +9 -8
  4. data/Gemfile.lock +105 -104
  5. data/README.md +80 -0
  6. data/Rakefile +3 -16
  7. data/app/assets/javascripts/aureus/index.js +78 -20
  8. data/app/assets/stylesheets/aureus/index.scss +3 -35
  9. data/app/assets/stylesheets/aureus/skin/default.scss +52 -0
  10. data/app/assets/stylesheets/aureus/theme.scss +7 -0
  11. data/app/assets/stylesheets/aureus/theme/base.scss +19 -0
  12. data/app/assets/stylesheets/aureus/theme/content.scss +65 -0
  13. data/app/assets/stylesheets/aureus/{form.scss → theme/form.scss} +27 -27
  14. data/app/assets/stylesheets/aureus/theme/messages.scss +16 -0
  15. data/app/assets/stylesheets/aureus/theme/navigation.scss +42 -0
  16. data/app/assets/stylesheets/aureus/theme/table.scss +121 -0
  17. data/app/assets/stylesheets/aureus/theme/toolbar.scss +80 -0
  18. data/aureus.gemspec +21 -12
  19. data/config.ru +10 -0
  20. data/lib/aureus.rb +22 -18
  21. data/lib/aureus/components/box.rb +58 -0
  22. data/lib/aureus/components/content.rb +19 -0
  23. data/lib/aureus/components/data_table.rb +169 -0
  24. data/lib/aureus/components/listing.rb +43 -0
  25. data/lib/aureus/components/messages.rb +27 -0
  26. data/lib/aureus/components/navigation.rb +48 -0
  27. data/lib/aureus/components/row.rb +69 -0
  28. data/lib/aureus/components/simple_map.rb +21 -0
  29. data/lib/aureus/components/toolbar.rb +124 -0
  30. data/lib/aureus/engine.rb +8 -2
  31. data/lib/aureus/helper.rb +56 -55
  32. data/lib/aureus/renderable.rb +4 -12
  33. data/lib/aureus/version.rb +2 -2
  34. data/lib/generators/aureus/devise_i18n/devise_i18n_generator.rb +17 -12
  35. data/{config → lib/generators/aureus/devise_i18n}/locales/devise_base.de.yml +0 -0
  36. data/{config → lib/generators/aureus/devise_i18n}/locales/devise_base.en.yml +1 -1
  37. data/{config → lib/generators/aureus/devise_i18n}/locales/devise_mail.de.yml +1 -1
  38. data/{config → lib/generators/aureus/devise_i18n}/locales/devise_mail.en.yml +1 -1
  39. data/{config → lib/generators/aureus/devise_i18n}/locales/devise_ui.de.yml +0 -0
  40. data/{config → lib/generators/aureus/devise_i18n}/locales/devise_ui.en.yml +0 -0
  41. data/lib/generators/aureus/devise_invitable_i18n/devise_invitable_i18n_generator.rb +25 -0
  42. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.de.yml +11 -0
  43. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.en.yml +11 -0
  44. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.de.yml +9 -0
  45. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.en.yml +9 -0
  46. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.de.yml +12 -0
  47. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.en.yml +12 -0
  48. data/lib/generators/aureus/devise_invitable_views/devise_invitable_views_generator.rb +23 -0
  49. data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/edit.html.haml +9 -0
  50. data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/new.html.haml +8 -0
  51. data/lib/generators/aureus/devise_invitable_views/templates/devise/mailer/invitation_instructions.html.haml +5 -0
  52. data/lib/generators/aureus/devise_views/devise_views_generator.rb +17 -15
  53. data/lib/generators/aureus/devise_views/templates/devise/confirmations/new.html.haml +5 -5
  54. data/lib/generators/aureus/devise_views/templates/devise/mailer/confirmation_instructions.html.haml +3 -3
  55. data/lib/generators/aureus/devise_views/templates/devise/mailer/reset_password_instructions.html.haml +5 -5
  56. data/lib/generators/aureus/devise_views/templates/devise/mailer/unlock_instructions.html.haml +4 -4
  57. data/lib/generators/aureus/devise_views/templates/devise/passwords/edit.html.haml +7 -7
  58. data/lib/generators/aureus/devise_views/templates/devise/passwords/new.html.haml +5 -5
  59. data/lib/generators/aureus/devise_views/templates/devise/registrations/edit.html.haml +9 -9
  60. data/lib/generators/aureus/devise_views/templates/devise/registrations/new.html.haml +7 -7
  61. data/lib/generators/aureus/devise_views/templates/devise/sessions/new.html.haml +7 -7
  62. data/lib/generators/aureus/devise_views/templates/devise/shared/_links.html.haml +6 -6
  63. data/lib/generators/aureus/devise_views/templates/devise/unlocks/new.html.haml +5 -5
  64. data/lib/generators/aureus/layout/layout_generator.rb +10 -10
  65. data/lib/generators/aureus/layout/templates/layout.html.haml +8 -8
  66. data/lib/generators/aureus/views/templates/views/_form.html.haml +3 -3
  67. data/lib/generators/aureus/views/templates/views/_item.html.haml +2 -2
  68. data/lib/generators/aureus/views/templates/views/_list.html.haml +8 -8
  69. data/lib/generators/aureus/views/templates/views/edit.html.haml +4 -4
  70. data/lib/generators/aureus/views/templates/views/index.html.haml +3 -3
  71. data/lib/generators/aureus/views/templates/views/new.html.haml +4 -4
  72. data/lib/generators/aureus/views/templates/views/show.html.haml +4 -4
  73. data/lib/generators/aureus/views/views_generator.rb +70 -68
  74. data/spec/controllers/all_spec.rb +19 -0
  75. data/spec/internal/app/assets/javascripts/application.js +9 -0
  76. data/spec/internal/app/assets/stylesheets/application.scss +5 -0
  77. data/spec/internal/app/controllers/all_controller.rb +14 -0
  78. data/spec/internal/app/controllers/resources_controller.rb +2 -0
  79. data/spec/{lib/helper → internal/app/models}/resource.rb +0 -0
  80. data/spec/internal/app/views/all/centered.html.haml +5 -0
  81. data/spec/internal/app/views/all/index.html.haml +39 -0
  82. data/spec/internal/app/views/layouts/application.html.haml +24 -0
  83. data/spec/internal/app/views/layouts/naked.html.haml +10 -0
  84. data/spec/internal/config/database.yml +3 -0
  85. data/spec/internal/config/routes.rb +5 -0
  86. data/spec/internal/db/schema.rb +10 -0
  87. data/spec/internal/log/.gitignore +1 -0
  88. data/spec/internal/public/favicon.ico +0 -0
  89. data/spec/lib/generators/devise_i18n_spec.rb +19 -0
  90. data/spec/lib/generators/devise_invitable_i18n_spec.rb +19 -0
  91. data/spec/lib/generators/devise_invitable_views_spec.rb +19 -0
  92. data/spec/lib/generators/devise_views_spec.rb +25 -0
  93. data/spec/lib/generators/layout_spec.rb +17 -0
  94. data/spec/lib/generators/views_spec.rb +26 -0
  95. data/spec/requests/all_spec.rb +12 -0
  96. data/spec/spec_helper.rb +15 -0
  97. metadata +219 -78
  98. data/.rspec +0 -2
  99. data/Guardfile +0 -4
  100. data/Readme.md +0 -370
  101. data/TODO.md +0 -11
  102. data/app/assets/images/aureus/background.png +0 -0
  103. data/app/assets/images/aureus/topbar.png +0 -0
  104. data/app/assets/javascripts/aureus/defaults.js +0 -30
  105. data/app/assets/javascripts/aureus/extensions.js +0 -42
  106. data/app/assets/javascripts/aureus/functions.js +0 -67
  107. data/app/assets/javascripts/aureus/plugins/jquery-calendrical.js +0 -508
  108. data/app/assets/javascripts/aureus/plugins/jquery-datatables.js +0 -11838
  109. data/app/assets/javascripts/aureus/plugins/jquery-qtip.js +0 -15
  110. data/app/assets/stylesheets/aureus/base.scss +0 -48
  111. data/app/assets/stylesheets/aureus/content.scss +0 -100
  112. data/app/assets/stylesheets/aureus/mixins.scss +0 -43
  113. data/app/assets/stylesheets/aureus/navigation.scss +0 -43
  114. data/app/assets/stylesheets/aureus/reset.scss +0 -50
  115. data/app/assets/stylesheets/aureus/table.scss +0 -153
  116. data/app/assets/stylesheets/aureus/topbar.scss +0 -89
  117. data/app/assets/stylesheets/aureus/ui.scss +0 -98
  118. data/lib/aureus/box.rb +0 -54
  119. data/lib/aureus/content.rb +0 -15
  120. data/lib/aureus/data_table.rb +0 -148
  121. data/lib/aureus/listing.rb +0 -39
  122. data/lib/aureus/map.rb +0 -17
  123. data/lib/aureus/messages.rb +0 -23
  124. data/lib/aureus/navigation.rb +0 -42
  125. data/lib/aureus/row.rb +0 -65
  126. data/lib/aureus/toolbar.rb +0 -99
  127. data/spec/lib/helper/schema.rb +0 -6
  128. data/spec/lib/render_spec.rb +0 -16
  129. data/spec/lib/spec_helper.rb +0 -21
  130. data/spec/lib/views/box.haml +0 -14
  131. data/spec/lib/views/content.haml +0 -2
  132. data/spec/lib/views/datatable.haml +0 -11
  133. data/spec/lib/views/listing.haml +0 -5
  134. data/spec/lib/views/messages.haml +0 -2
  135. data/spec/lib/views/navigation.haml +0 -4
  136. data/spec/lib/views/row.haml +0 -28
  137. data/spec/lib/views/toolbar.haml +0 -11
@@ -0,0 +1,27 @@
1
+ module Aureus
2
+
3
+ module Components
4
+
5
+ class Messages < Renderable
6
+
7
+ def initialize flash
8
+ @flash = flash
9
+ end
10
+
11
+ def render
12
+ content_tag 'div', class: 'aureus-messages' do
13
+ out = Array.new
14
+ [:notice,:error,:alert].each do |i|
15
+ if @flash[i]
16
+ out << content_tag('p', @flash[i], class: i.to_s)
17
+ end
18
+ end
19
+ compact *out
20
+ end
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,48 @@
1
+ module Aureus
2
+
3
+ module Components
4
+
5
+ class Navigation < Renderable
6
+
7
+ def initialize
8
+ @title = ''
9
+ @buttons = Array.new
10
+ end
11
+
12
+ def title title
13
+ @title = title
14
+ end
15
+
16
+ def button content
17
+ @buttons << NavigationButton.new(content)
18
+ end
19
+
20
+ def submit_form_button resource, text
21
+ form_class = resource.is_a?(String) ? resource : resource.class.name.underscore
22
+ tag = content_tag 'a', text, onclick: "aureus_trigger_form('form.#{form_class}')", class: 'submit_form_button'
23
+ @buttons << NavigationButton.new(tag)
24
+ end
25
+
26
+ def render
27
+ content_tag 'div', class: 'aureus-navigation' do
28
+ compact content_tag('h2', content_tag('span',@title)), content_tag('ul', compact_render(*@buttons), id: 'quicklinks')
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ class NavigationButton < Renderable
35
+
36
+ def initialize content
37
+ @content = content
38
+ end
39
+
40
+ def render
41
+ content_tag 'li', @content
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,69 @@
1
+ module Aureus
2
+
3
+ module Components
4
+
5
+ class Row < Renderable
6
+
7
+ def initialize &block
8
+ init_haml_helpers
9
+ @columns = Array.new
10
+ @content = capture_haml self, &block
11
+ end
12
+
13
+ def column width, &block
14
+ @columns << RowColumn.new(width,capture_haml(&block))
15
+ end
16
+
17
+ def space width
18
+ @columns << RowColumn.new(width,'')
19
+ end
20
+
21
+ def divider
22
+ tag 'hr'
23
+ end
24
+
25
+ def render
26
+ if @columns.empty?
27
+ content_tag 'div', @content, class: 'row'
28
+ elsif @columns.length == 1
29
+ content_tag 'div', @columns.first.content, class: 'row'
30
+ else
31
+ total_width = @columns.inject 0 do |sum, n|
32
+ sum + n.width
33
+ end
34
+ out = String.new.html_safe
35
+ @columns.each_with_index do |c,i|
36
+ left = 0.5
37
+ right = 0.5
38
+ width = (100.0 / total_width * c.width).round
39
+ if i == 0
40
+ left = 0
41
+ width -= 0.5
42
+ elsif i == @columns.length-1
43
+ right = 0
44
+ width -= 0.5
45
+ else
46
+ width -= 1
47
+ end
48
+ out += content_tag 'div', c.render, class: :column, style: "width: #{width}%; margin-left: #{left}%; margin-right: #{right}%"
49
+ end
50
+ content_tag 'div', out, class: 'row'
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+ class RowColumn < Renderable
57
+
58
+ attr_reader :width, :content
59
+
60
+ def initialize width, content
61
+ @width = width
62
+ @content = content
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ end
@@ -0,0 +1,21 @@
1
+ module Aureus
2
+
3
+ module Components
4
+
5
+ class SimpleMap < Renderable
6
+
7
+ def initialize args
8
+ init args, { height: 300, zoom: 13 }
9
+ end
10
+
11
+ def render
12
+ if @options[:longitude] and @options[:latitude]
13
+ content_tag('div',nil, class: 'aureus-simple-map', data: @options )
14
+ end
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -0,0 +1,124 @@
1
+ module Aureus
2
+
3
+ module Components
4
+
5
+ class Toolbar < Renderable
6
+
7
+ def initialize title
8
+ @title = title
9
+ @left = ToolbarSection.new 'left'
10
+ @right = ToolbarSection.new 'right'
11
+ end
12
+
13
+ def left
14
+ yield @left
15
+ end
16
+
17
+ def right
18
+ yield @right
19
+ end
20
+
21
+ def render
22
+ content_tag 'div', { class: 'aureus-toolbar' } do
23
+ compact content_tag('h1',@title), @left.render, @right.render
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ class ToolbarSection < Renderable
30
+
31
+ def initialize position
32
+ @items = Array.new
33
+ @position = position
34
+ end
35
+
36
+ def link_to text, url, *args
37
+ @items << ToolbarButton.new(text,0,url,args)
38
+ end
39
+
40
+ def dropdown title
41
+ toolbar = ToolbarDropdown.new(title)
42
+ yield toolbar
43
+ @items << toolbar
44
+ end
45
+
46
+ def info text
47
+ @items << ToolbarInfo.new(text,0)
48
+ end
49
+
50
+ def render
51
+ content_tag 'ul', compact_render(*@items), class: @position
52
+ end
53
+
54
+ end
55
+
56
+ class ToolbarButton < Renderable
57
+
58
+ def initialize text, level, url, args
59
+ @text = text
60
+ @level = level
61
+ @url = url
62
+ @args = args
63
+ end
64
+
65
+ def render
66
+ content_tag 'li', link_to(@text,@url,*@args), class: "level-#{@level}"
67
+ end
68
+
69
+ end
70
+
71
+ class ToolbarInfo < Renderable
72
+
73
+ def initialize text, level
74
+ @text = text
75
+ @level = level
76
+ end
77
+
78
+ def render
79
+ content_tag 'li', content_tag('span', @text, class: :info), class: "level-#{@level}"
80
+ end
81
+
82
+ end
83
+
84
+ class ToolbarDivider < Renderable
85
+
86
+ def initialize
87
+ end
88
+
89
+ def render
90
+ content_tag 'div', '', class: :line
91
+ end
92
+
93
+ end
94
+
95
+ class ToolbarDropdown < Renderable
96
+
97
+ def initialize title
98
+ @title = title
99
+ @items = Array.new
100
+ end
101
+
102
+ def link_to text, url, *args
103
+ @items << ToolbarButton.new(text,1,url,args)
104
+ end
105
+
106
+ def info text
107
+ @items << ToolbarInfo.new(text,1)
108
+ end
109
+
110
+ def divider
111
+ @items << ToolbarDivider.new
112
+ end
113
+
114
+ def render
115
+ title = content_tag 'span', @title, class: 'dropdown-accessor'
116
+ list = content_tag 'ul', compact_render(*@items), class: 'dropdown-inner'
117
+ content_tag 'li', title+list, class: 'dropdown-outer'
118
+ end
119
+
120
+ end
121
+
122
+ end
123
+
124
+ end
data/lib/aureus/engine.rb CHANGED
@@ -1,7 +1,13 @@
1
1
  module Aureus
2
+
2
3
  class Engine < Rails::Engine
3
- ActiveSupport.on_load :action_view do
4
+ config.autoload_paths << File.expand_path('../../', __FILE__)
5
+ initializer 'aureus.configure_rails_initialization' do |app|
6
+ ActiveSupport.on_load :action_view do
4
7
  include Aureus::Helper
5
8
  end
9
+ end
10
+
6
11
  end
7
- end
12
+
13
+ end
data/lib/aureus/helper.rb CHANGED
@@ -1,61 +1,62 @@
1
1
  module Aureus
2
- module Helper
3
2
 
4
- def aureus_toolbar title
5
- toolbar = Toolbar.new title
3
+ module Helper
4
+
5
+ def aureus_toolbar title
6
+ toolbar = Components::Toolbar.new title
6
7
  yield toolbar
7
8
  toolbar.render
8
- end
9
-
10
- def aureus_navigation
11
- navigation = Navigation.new
12
- yield navigation
13
- navigation.render
14
- end
15
-
16
- def aureus_messages flash
17
- messages = Messages.new flash
18
- messages.render
19
- end
20
-
21
- def aureus_content html
22
- content = Content.new html
23
- content.render
24
- end
25
-
26
- def aureus_row &block
27
- row = Row.new &block
28
- row.render
29
- end
30
-
31
- def aureus_box title, *args, &block
32
- box = Box.new title, args, &block
33
- box.render
34
- end
35
-
36
- def aureus_datatable resource, *args
37
- table = DataTable.new resource, args
38
- yield table
39
- table.render
40
- end
41
-
42
- def aureus_form *args, &block
43
- semantic_form_for *args do |f|
44
- capture_haml f, &block
45
- end
46
- end
47
-
48
- def aureus_listing
49
- listing = Listing.new
50
- yield listing
51
- listing.render
52
- end
53
-
54
- def aureus_map *args
55
- map = Map.new args
56
- map.render
57
- end
58
-
59
- end
9
+ end
10
+
11
+ def aureus_navigation
12
+ navigation = Components::Navigation.new
13
+ yield navigation
14
+ navigation.render
15
+ end
16
+
17
+ def aureus_messages flash
18
+ messages = Components::Messages.new flash
19
+ messages.render
20
+ end
21
+
22
+ def aureus_content html
23
+ content = Components::Content.new html
24
+ content.render
25
+ end
26
+
27
+ def aureus_row &block
28
+ row = Components::Row.new &block
29
+ row.render
30
+ end
31
+
32
+ def aureus_box title, *args, &block
33
+ box = Components::Box.new title, args, &block
34
+ box.render
35
+ end
36
+
37
+ def aureus_datatable resource
38
+ table = Components::DataTable.new resource
39
+ yield table
40
+ table.render
41
+ end
42
+
43
+ def aureus_form args, &block
44
+ semantic_form_for args do |f|
45
+ capture_haml f, &block
46
+ end
47
+ end
48
+
49
+ def aureus_listing
50
+ listing = Components::Listing.new
51
+ yield listing
52
+ listing.render
53
+ end
54
+
55
+ def aureus_simple_map *args
56
+ map = Components::SimpleMap.new args
57
+ map.render
58
+ end
59
+
60
+ end
60
61
 
61
62
  end
@@ -12,7 +12,7 @@ module Aureus
12
12
  end
13
13
 
14
14
  def init args, *defaults
15
- @options = defaults.extract_options!.merge args.extract_options!
15
+ @options = defaults.extract_options!.merge(args.extract_options!)
16
16
  end
17
17
 
18
18
  def content_tag name, content_or_options_with_block = nil, options = nil, escape = false, &block
@@ -20,19 +20,11 @@ module Aureus
20
20
  end
21
21
 
22
22
  def compact *args
23
- out = String.new.html_safe
24
- args.each do |i|
25
- out += i
26
- end
27
- out
23
+ args.join.html_safe
28
24
  end
29
25
 
30
26
  def compact_render *args
31
- out = String.new.html_safe
32
- args.each do |i|
33
- out += i.render
34
- end
35
- out
27
+ args.map{ |e| e.render }.join.html_safe
36
28
  end
37
29
 
38
30
  def render
@@ -41,4 +33,4 @@ module Aureus
41
33
 
42
34
  end
43
35
 
44
- end
36
+ end