aureus 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile CHANGED
@@ -2,8 +2,10 @@ source "http://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  group :test do
5
+ gem "guard-rspec"
6
+ gem "rb-fsevent", "~> 0.9.1"
5
7
  gem "highline"
6
8
  gem "rails"
7
- gem "activerecord"
8
9
  gem "sqlite3"
10
+ gem "haml"
9
11
  end
data/Gemfile.lock CHANGED
@@ -1,10 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aureus (1.1.2)
5
- formtastic
6
- haml
7
- jquery-rails
4
+ aureus (1.2.0)
8
5
 
9
6
  GEM
10
7
  remote: http://rubygems.org/
@@ -38,25 +35,37 @@ GEM
38
35
  multi_json (~> 1.0)
39
36
  arel (3.0.2)
40
37
  builder (3.0.4)
38
+ coderay (1.0.8)
39
+ diff-lcs (1.1.3)
41
40
  erubis (2.7.0)
42
- formtastic (2.2.1)
43
- actionpack (>= 3.0)
41
+ guard (1.5.4)
42
+ listen (>= 0.4.2)
43
+ lumberjack (>= 1.0.2)
44
+ pry (>= 0.9.10)
45
+ thor (>= 0.14.6)
46
+ guard-rspec (2.1.2)
47
+ guard (>= 1.1)
48
+ rspec (~> 2.11)
44
49
  haml (3.1.7)
45
50
  highline (1.6.15)
46
51
  hike (1.2.1)
47
52
  i18n (0.6.1)
48
53
  journey (1.0.4)
49
- jquery-rails (2.1.3)
50
- railties (>= 3.1.0, < 5.0)
51
- thor (~> 0.14)
52
54
  json (1.7.5)
55
+ listen (0.5.3)
56
+ lumberjack (1.0.2)
53
57
  mail (2.4.4)
54
58
  i18n (>= 0.4.0)
55
59
  mime-types (~> 1.16)
56
60
  treetop (~> 1.4.8)
61
+ method_source (0.8.1)
57
62
  mime-types (1.19)
58
63
  multi_json (1.3.7)
59
64
  polyglot (0.3.3)
65
+ pry (0.9.10)
66
+ coderay (~> 1.0.5)
67
+ method_source (~> 0.8)
68
+ slop (~> 3.3.1)
60
69
  rack (1.4.1)
61
70
  rack-cache (1.2)
62
71
  rack (>= 0.4)
@@ -80,8 +89,18 @@ GEM
80
89
  rdoc (~> 3.4)
81
90
  thor (>= 0.14.6, < 2.0)
82
91
  rake (10.0.2)
92
+ rb-fsevent (0.9.2)
83
93
  rdoc (3.12)
84
94
  json (~> 1.4)
95
+ rspec (2.12.0)
96
+ rspec-core (~> 2.12.0)
97
+ rspec-expectations (~> 2.12.0)
98
+ rspec-mocks (~> 2.12.0)
99
+ rspec-core (2.12.0)
100
+ rspec-expectations (2.12.0)
101
+ diff-lcs (~> 1.1.3)
102
+ rspec-mocks (2.12.0)
103
+ slop (3.3.3)
85
104
  sprockets (2.2.1)
86
105
  hike (~> 1.2)
87
106
  multi_json (~> 1.0)
@@ -99,8 +118,10 @@ PLATFORMS
99
118
  ruby
100
119
 
101
120
  DEPENDENCIES
102
- activerecord
103
121
  aureus!
122
+ guard-rspec
123
+ haml
104
124
  highline
105
125
  rails
126
+ rb-fsevent (~> 0.9.1)
106
127
  sqlite3
data/Guardfile ADDED
@@ -0,0 +1,4 @@
1
+ guard "rspec" do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch("spec/lib/spec_helper.rb") { "spec" }
4
+ end
data/Rakefile CHANGED
@@ -1,8 +1,5 @@
1
1
  require "rubygems"
2
-
3
2
  gem "highline"
4
- gem "activerecord"
5
- gem "sqlite3"
6
3
 
7
4
  desc "build and publish"
8
5
  task :build do
@@ -17,22 +14,4 @@ task :build do
17
14
  end
18
15
  puts "remove gem..."
19
16
  `rm *.gem`
20
- end
21
-
22
- task :check do
23
- require "rails"
24
- require "active_support"
25
- require "action_view"
26
- require "active_record"
27
- require "aureus"
28
- require "haml"
29
- require "aureus/test/resource"
30
- include Aureus::Helper
31
- ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
32
- load "lib/aureus/test/schema.rb"
33
- @resource = Resource.new
34
- @resource.title = "the title"
35
- @resource.text = "Some longer text"
36
- @resources = [@resource,@resource]
37
- puts Haml::Engine.new(File.read("test/html.haml")).render(self)
38
- end
17
+ end
data/Readme.md CHANGED
@@ -8,75 +8,70 @@ Aureus is a tool to quickly generate admin interfaces for a rails app. It's betw
8
8
 
9
9
  To use **aureus** simply require the gem:
10
10
 
11
- ````ruby
11
+ ```ruby
12
12
  gem "aureus"
13
13
  ```
14
14
 
15
- The rails engine will automatically load the following dependencies:
16
-
17
- * formtastic
18
- * haml
19
- * jquery-rails
15
+ Please activate the following dependencies in your Gemfile:
20
16
 
21
- But you have to ensure that these gems are available:
17
+ ```ruby
18
+ gem "formtastic"
19
+ gem "haml"
20
+ gem "jquery-rails"
21
+ gem "sass-rails"
22
+ ```
23
+
24
+ And optionally activate:
22
25
 
23
- * sass-rails
24
- * coffee-rails
26
+ ```ruby
27
+ gem "i18n-js", :git => "git://github.com/fnando/i18n-js.git", :branch => "rewrite" # for js translations
28
+ ```
25
29
 
26
- ## Asset Pipeline
30
+ ### Asset Pipeline
27
31
 
28
32
  Aureus uses the rails asset pipeline to load and override the style and behavior.
29
33
 
30
34
  This is the basic application.scss setup:
31
35
 
32
- ````scss
36
+ ```scss
33
37
  /*
34
38
  *= require_self
35
39
  *= depend_on aureus
40
+ *= require_tree .
36
41
  */
37
42
 
38
- $color_main: #0f0; // the color used for highlights
39
- $color_warn: #f00; // the color used for warning (should be red)
43
+ $color_main: #0f0;
44
+ $color_warn: #f00;
40
45
 
41
46
  @import "aureus";
42
-
43
- // your styles here ...
44
47
  ```
45
48
 
46
- Configure the scripts in application.js:
49
+ Setup application.js to match the given order:
47
50
 
48
- ````js
51
+ ```javascript
52
+ //= require jquery
53
+ //= require jquery_ujs
54
+ //= require jquery-ui
55
+ //= require i18n/translations
49
56
  //= require_self
50
57
  //= 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: "&rarr;",
56
- prevText: "&larr;",
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
- }
58
+ //= require_tree .
59
+
60
+ $(document).ready(function(){
61
+ aureus_remove_messages_after(2);
62
+ aureus_setup_i18n("<%= I18n.default_locale %>","<%= I18n.locale %>");
63
+ aureus_datatables_translate();
64
+ aureus_datatables_decorate();
65
+ });
73
66
  ```
74
67
 
68
+ You can now start using the aureus framework to rapidly build awesome interfaces!
69
+
75
70
  ## Helpers
76
71
 
77
72
  There are several helper methods available to generate the interface:
78
73
 
79
- ````haml
74
+ ```haml
80
75
  // Toolbar
81
76
  = aureus_toolbar "A nice title" do |t|
82
77
  - t.left do |l|
@@ -158,17 +153,35 @@ There are several helper methods available to generate the interface:
158
153
 
159
154
  // Maps (Google Maps iFrame)
160
155
  = aureus_map :longitude => 12, :latitude => 6
161
- ````
156
+ ```
157
+
158
+ ## Javascript Helpers
159
+
160
+ There are several Javascript helpers for certain actions:
161
+
162
+ ```javascript
163
+ // remove flash messages automatically after 3 seconds
164
+ aureus_remove_messages_after(3);
165
+
166
+ // setup i18n for js
167
+ aureus_setup_i18n("<%= I18n.default_locale %>","<%= I18n.locale %>");
168
+
169
+ // translate datatables with i18n
170
+ aureus_datatables_translate();
171
+
172
+ // transform datatables in given actual document
173
+ aureus_datatables_decorate();
174
+ ```
162
175
 
163
176
  ## Generators
164
177
 
165
- Aureus has a bunch of generators builtin to easily generate a complete interface including i18n.
178
+ Aureus has a bunch of generators builtin to easily generate a complete interface.
166
179
 
167
180
  ### Layout
168
181
 
169
182
  To generate a base layout issue `rails g aureus:layout layout_name` which produces:
170
183
 
171
- ````haml
184
+ ```haml
172
185
  !!! 5
173
186
  %html
174
187
  %head
@@ -190,24 +203,30 @@ To generate a base layout issue `rails g aureus:layout layout_name` which produc
190
203
 
191
204
  Add the I18n keys to your en.yml.
192
205
 
206
+ ---
207
+
208
+ refactoring
209
+
210
+ ---
211
+
193
212
  ### Views
194
213
 
195
214
  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
215
 
197
216
  #### app/views/resources/index.html.haml
198
217
 
199
- ````haml
218
+ ```haml
200
219
  - content_for :navigation do
201
220
  = aureus_navigation do |n|
202
221
  - n.title t(".title")
203
222
  - n.button link_to(t(".button_new"), new_resource_url) if can? :create, Resource
204
223
 
205
224
  = render "list"
206
- ````
225
+ ```
207
226
 
208
227
  #### app/views/resources/show.html.haml
209
228
 
210
- ````haml
229
+ ```haml
211
230
  - content_for :navigation do
212
231
  = aureus_navigation do |n|
213
232
  - n.title t(".title")
@@ -215,11 +234,11 @@ The awesome thing about aureus is the following generator `rails g aureus:views
215
234
  - n.button link_to(t(".button_back"),resources_url) if can? :index, Resource
216
235
 
217
236
  = render "item"
218
- ````
237
+ ```
219
238
 
220
239
  #### app/views/resources/new.html.haml
221
240
 
222
- ````haml
241
+ ```haml
223
242
  - content_for :navigation do
224
243
  = aureus_navigation do |n|
225
244
  - n.title t(".title")
@@ -227,11 +246,11 @@ The awesome thing about aureus is the following generator `rails g aureus:views
227
246
  - n.submit_form_button @resource, t(".button_save") if can? :create, Resource
228
247
 
229
248
  = render "form"
230
- ````
249
+ ```
231
250
 
232
251
  #### app/views/resources/edit.html.haml
233
252
 
234
- ````haml
253
+ ```haml
235
254
  - content_for :navigation do
236
255
  = aureus_navigation do |n|
237
256
  - n.title t(".title")
@@ -239,11 +258,11 @@ The awesome thing about aureus is the following generator `rails g aureus:views
239
258
  - n.submit_form_button @resource, t(".button_save") if can? :update, Resource
240
259
 
241
260
  = render "form"
242
- ````
261
+ ```
243
262
 
244
263
  #### app/views/resources/_list.html.haml
245
264
 
246
- ````haml
265
+ ```haml
247
266
  = aureus_row do
248
267
  = aureus_box t(".box_title") do
249
268
  = aureus_datatable @resources do |t|
@@ -264,11 +283,11 @@ The awesome thing about aureus is the following generator `rails g aureus:views
264
283
  - r.button :show, resource_url(resource) if can? :show, Resource
265
284
  - r.button :edit, edit_resource_url(resource) if can? :edit, Resource
266
285
  - r.button :destroy, resource_url(resource), :confirm => t(".destroy_confirm") if can? :destroy, Resource
267
- ````
286
+ ```
268
287
 
269
288
  #### app/views/resources/_form.html.haml
270
289
 
271
- ````haml
290
+ ```haml
272
291
  = aureus_form [@resource] do |f|
273
292
  = aureus_row do |r|
274
293
  - r.column 25 do
@@ -277,11 +296,11 @@ The awesome thing about aureus is the following generator `rails g aureus:views
277
296
  = f.input :body, :label => t(".field_body")
278
297
  = f.input :description, :label => t(".field_description")
279
298
  - r.space 75
280
- ````
299
+ ```
281
300
 
282
301
  #### app/views/resources/_item.html.haml
283
302
 
284
- ````haml
303
+ ```haml
285
304
  = aureus_row do |r|
286
305
  - r.column 25 do
287
306
  = aureus_box t(".box_title") do
@@ -293,11 +312,11 @@ The awesome thing about aureus is the following generator `rails g aureus:views
293
312
  - l.entry t(".entry_created_at"), @resource.created_at
294
313
  - l.entry t(".entry_updated_at"), @resource.updated_at
295
314
  - r.space 75
296
- ````
315
+ ```
297
316
 
298
317
  #### config/locales/resources.en.yml
299
318
 
300
- ````yml
319
+ ```yml
301
320
  en:
302
321
  resources:
303
322
  index:
@@ -340,7 +359,7 @@ en:
340
359
  entry_description: Description
341
360
  entry_created_at: Created At
342
361
  entry_updated_at: Updated At
343
- ````
362
+ ```
344
363
 
345
364
  ### Devise
346
365
 
data/TODO.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # ToDo
2
2
 
3
- * datatable improvements
4
- * datatable i18n
3
+ * test generators
4
+
5
+ * datatable proper date and time support
6
+ * datatable custom field support (like text fields)
5
7
  * proper namespace css and clean up
6
- * update javascripts
8
+ * update javascripts
9
+ * dropdown in top bar
10
+ * nesting in boxes?
11
+ * paginate helpers?
@@ -0,0 +1,30 @@
1
+ var aureus_datatable_language_config = {
2
+ sSearch : "Search:",
3
+ sLengthMenu: "Show _MENU_ entries per page",
4
+ sZeroRecords: "No data found",
5
+ sInfo: "Show _START_-_END_ from _TOTAL_ entries",
6
+ sInfoEmpty: "Show 0 entries",
7
+ sInfoFiltered: "(total _MAX entries)"
8
+ };
9
+
10
+ // var aureus_datepicker_config = {
11
+ // dayNamesMin: ["So","Mo","Di","Mi","Do","Fr","Sa"],
12
+ // monthNames: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","December"],
13
+ // nextText: "&rarr;",
14
+ // prevText: "&larr;",
15
+ // dateFormat: "yy-mm-dd",
16
+ // firstDay: 1,
17
+ // }
18
+
19
+ // var aureus_timepicker_config = {
20
+ // isoTime: true,
21
+ // minTime: { hour: 6, minute: 0 },
22
+ // maxTime: { hour: 22, minute: 0 },
23
+ // timInterval: 30
24
+ // }
25
+
26
+ // var aureus_tooltip_config = {
27
+ // background: "none",
28
+ // color: "black",
29
+ // border: "none"
30
+ // }
@@ -1,5 +1,58 @@
1
- // Column Configurator for Datatables
2
- function datatablesColumnConf(table) {
1
+ function aureus_remove_messages_after(seconds) {
2
+ setTimeout(function() {
3
+ $("#messages p").fadeOut();
4
+ }, seconds*1000);
5
+ }
6
+
7
+ function aureus_setup_i18n(default_locale, current_locale) {
8
+ I18n.defaultLocale = default_locale;
9
+ I18n.locale = current_locale;
10
+ }
11
+
12
+ function aureus_datatables_decorate() {
13
+ $.fn.dataTableExt.oStdClasses.sWrapper = "datatable-wrapper";
14
+ $.fn.dataTableExt.oStdClasses.sLength = "datatable-length";
15
+ $.fn.dataTableExt.oStdClasses.sFilter = "datatable-filter";
16
+ $.fn.dataTableExt.oStdClasses.sInfo = "datatable-info";
17
+ $.fn.dataTableExt.oStdClasses.sPaging = "datatable-paging";
18
+
19
+ $(".datatable").each(function(){
20
+ $(this).dataTable({
21
+ sDom: "<'toolbar'fi>t",
22
+ oLanguage: aureus_datatable_language_config,
23
+ bPaginate: false,
24
+ aoColumns: aureus_datatables_column_configurator($(this))
25
+ });
26
+ });
27
+
28
+ $(".datatable-no-toolbar").each(function(){
29
+ $(this).dataTable({
30
+ sDom: "t",
31
+ oLanguage: aureus_datatable_language_config,
32
+ bPaginate: false,
33
+ aoColumns: aureus_datatables_column_configurator($(this))
34
+ });
35
+ });
36
+ }
37
+
38
+ function aureus_trigger_form(selector) {
39
+ $(selector).submit();
40
+ }
41
+
42
+ function aureus_datatables_translate() {
43
+ aureus_datatable_language_config = {
44
+ sSearch : I18n.t("aureus.datatables.search"),
45
+ sLengthMenu: I18n.t("aureus.datatables.lenght_menu"),
46
+ sZeroRecords: I18n.t("aureus.datatables.zero_records"),
47
+ sInfo: I18n.t("aureus.datatables.info"),
48
+ sInfoEmpty: I18n.t("aureus.datatables.info_empty"),
49
+ sInfoFiltered: I18n.t("aureus.datatables.info_filtered")
50
+ };
51
+ }
52
+
53
+ /* private */
54
+
55
+ function aureus_datatables_column_configurator(table) {
3
56
  var ret = Array();
4
57
  table.children("thead").children("tr").children("th").each(function(){
5
58
  if($(this).hasClass("no-sorting")) {
@@ -11,8 +64,4 @@ function datatablesColumnConf(table) {
11
64
  }
12
65
  });
13
66
  return ret;
14
- }
15
-
16
- function triggerForm(selector) {
17
- $(selector).submit();
18
67
  }
@@ -1,55 +1,20 @@
1
- //= require jquery
2
- //= require jquery_ujs
3
- //= require jquery-ui
4
1
  //= require_directory ./plugins
5
- //= require ./functions
6
2
  //= require ./extensions
3
+ //= require ./defaults
4
+ //= require ./functions
7
5
  //= require_self
8
6
 
9
- var datatablesLanguageConfig = {
10
- sSearch : "Suchen:",
11
- sLengthMenu: "Zeige _MENU_ Einträge pro Seite",
12
- sZeroRecords: "Keine Daten gefunden",
13
- sInfo: "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
14
- sInfoEmpty: "Zeige 0 Einträge",
15
- sInfoFiltered: "(Total _MAX_ Einträge)"
16
- };
17
-
18
7
  $(document).ready(function(){
19
8
 
20
9
  $("td.buttons a").wrapInner("<span/>");
21
10
 
22
- $.fn.dataTableExt.oStdClasses.sWrapper = "datatable-wrapper";
23
- $.fn.dataTableExt.oStdClasses.sLength = "datatable-length";
24
- $.fn.dataTableExt.oStdClasses.sFilter = "datatable-filter";
25
- $.fn.dataTableExt.oStdClasses.sInfo = "datatable-info";
26
- $.fn.dataTableExt.oStdClasses.sPaging = "datatable-paging";
27
-
28
- $('.datatable').each(function(){
29
- $(this).dataTable({
30
- sDom: '<"toolbar"fi>t',
31
- oLanguage: datatablesLanguageConfig,
32
- bPaginate: false,
33
- aoColumns: datatablesColumnConf($(this))
34
- });
35
- });
36
-
37
- $('.datatable-no-toolbar').each(function(){
38
- $(this).dataTable({
39
- sDom: 't',
40
- oLanguage: datatablesLanguageConfig,
41
- bPaginate: false,
42
- aoColumns: datatablesColumnConf($(this))
43
- });
44
- });
45
-
46
- $(".datepicker").datepicker(datepickerConfiguration);
11
+ //$(".datepicker").datepicker(datepickerConfiguration);
47
12
 
48
13
  // Prevent Bug
49
- $("div.ui-datepicker").hide();
14
+ //$("div.ui-datepicker").hide();
50
15
 
51
- $(".timepicker").calendricalTime(timepickerConfiguration);
16
+ //$(".timepicker").calendricalTime(timepickerConfiguration);
52
17
 
53
- $.fn.qtip.styles.single = tooltipConfiguration;
18
+ //$.fn.qtip.styles.single = tooltipConfiguration;
54
19
 
55
20
  });
@@ -8,23 +8,19 @@
8
8
  //= depend_on form
9
9
  //= depend_on ui
10
10
 
11
- // backgrounds
12
11
  $asset_app_background: image-path('aureus/background.png');
13
12
  $asset_topbar_background: image-path('aureus/topbar.png');
14
13
 
15
- // tabel toolbar icons
16
14
  $asset_icon_sort: image-path('aureus/icon-sort.png');
17
15
  $asset_icon_sort_abc_asc: image-path('aureus/icon-sort-abc-asc.png');
18
16
  $asset_icon_sort_abc_desc: image-path('aureus/icon-sort-abc-desc.png');
19
17
 
20
- // button icons
21
18
  $asset_icon_pencil: image-path("aureus/icon-pencil.png");
22
19
  $asset_icon_cross: image-path("aureus/icon-cross.png");
23
20
  $asset_icon_eye: image-path("aureus/icon-eye.png");
24
21
  $asset_icon_refresh: image-path("aureus/icon-refresh.png");
25
22
  $asset_icon_print: image-path("aureus/icon-print.png");
26
23
 
27
- // colors
28
24
  $color_main_dark: darken($color_main,15);
29
25
  $color_warn_dark: darken($color_warn,15);
30
26
 
data/aureus.gemspec CHANGED
@@ -4,25 +4,17 @@ require "aureus/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
 
7
- # Main Info
8
7
  s.name = "aureus"
9
8
  s.version = Aureus::VERSION
10
9
  s.summary = "a nice looking framework for your rails admin interfaces"
11
10
  s.description = "Aureus is a tool to quickly generate admin interfaces for a rails app. It's between scaffolding an tools like ActiveAdmin."
12
11
  s.license = "MIT"
13
12
 
14
- # Additional Info
15
13
  s.author = "Joël Gähhwiler"
16
14
  s.email = "joel.gaehwiler@bluewin.ch"
17
15
  s.homepage = "https://github.com/256dpi/aureus"
18
16
 
19
- # Files
20
17
  s.files = `git ls-files`.split("\n")
21
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
19
 
23
- # Dependencies
24
- s.add_dependency "formtastic"
25
- s.add_dependency "jquery-rails"
26
- s.add_dependency "haml"
27
-
28
20
  end
@@ -0,0 +1,9 @@
1
+ en:
2
+ aureus:
3
+ datatables:
4
+ search: "Search:"
5
+ length_menu: "Show _MENU_ entries per page"
6
+ zero_records: "No data found"
7
+ info: "Show _START_-_END_ from _TOTAL_ entries"
8
+ info_empty: "Show 0 entries"
9
+ info_filtered: "(total _MAX entries)"
data/lib/aureus.rb CHANGED
@@ -1,63 +1,22 @@
1
1
  require "aureus/version"
2
2
  require "aureus/engine"
3
3
 
4
- require "formtastic"
5
4
  require "haml"
6
5
 
7
6
  module Aureus
8
- extend ActiveSupport::Autoload
9
-
10
- autoload :Helper
11
- autoload :Toolbar
12
- autoload :Navigation
13
- autoload :Messages
14
- autoload :Content
15
- autoload :Row
16
- autoload :Box
17
- autoload :DataTable
18
- autoload :Form
19
- autoload :Listing
20
- autoload :Map
21
-
22
- class Renderable
23
- include ActionView::Context
24
- include ActionView::Helpers::TagHelper
25
- include ActionView::Helpers::CaptureHelper
26
- include ActionView::Helpers::UrlHelper
27
- include Haml::Helpers
28
-
29
- def initialize content
30
- @content = content
31
- end
32
-
33
- def init args, *defaults
34
- @options = defaults.extract_options!.merge args.extract_options!
35
- end
36
-
37
- def content_tag name, content_or_options_with_block = nil, options = nil, escape = false, &block
38
- super name, content_or_options_with_block, options, escape, &block
39
- end
40
-
41
- def compact *args
42
- out = String.new.html_safe
43
- args.each do |i|
44
- out += i
45
- end
46
- out
47
- end
48
-
49
- def compact_render *args
50
- out = String.new.html_safe
51
- args.each do |i|
52
- out += i.render
53
- end
54
- out
55
- end
56
-
57
- def render
58
- @content
59
- end
60
-
61
- end
7
+ extend ActiveSupport::Autoload
8
+
9
+ autoload :Renderable
10
+ autoload :Helper
11
+ autoload :Toolbar
12
+ autoload :Navigation
13
+ autoload :Messages
14
+ autoload :Content
15
+ autoload :Row
16
+ autoload :Box
17
+ autoload :DataTable
18
+ autoload :Form
19
+ autoload :Listing
20
+ autoload :Map
62
21
 
63
22
  end
@@ -0,0 +1,44 @@
1
+ module Aureus
2
+
3
+ class Renderable
4
+ include ActionView::Context
5
+ include ActionView::Helpers::TagHelper
6
+ include ActionView::Helpers::CaptureHelper
7
+ include ActionView::Helpers::UrlHelper
8
+ include Haml::Helpers
9
+
10
+ def initialize content
11
+ @content = content
12
+ end
13
+
14
+ def init args, *defaults
15
+ @options = defaults.extract_options!.merge args.extract_options!
16
+ end
17
+
18
+ def content_tag name, content_or_options_with_block = nil, options = nil, escape = false, &block
19
+ super name, content_or_options_with_block, options, escape, &block
20
+ end
21
+
22
+ def compact *args
23
+ out = String.new.html_safe
24
+ args.each do |i|
25
+ out += i
26
+ end
27
+ out
28
+ end
29
+
30
+ def compact_render *args
31
+ out = String.new.html_safe
32
+ args.each do |i|
33
+ out += i.render
34
+ end
35
+ out
36
+ end
37
+
38
+ def render
39
+ @content
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -1,3 +1,3 @@
1
1
  module Aureus
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -1,3 +1,2 @@
1
1
  class Resource < ActiveRecord::Base
2
-
3
- end
2
+ end
@@ -1,8 +1,6 @@
1
- ActiveRecord::Schema.define(:version => 20120717133935) do
2
-
1
+ ActiveRecord::Schema.define :version => 20120717133935 do
3
2
  create_table "resources", :force => true do |t|
4
3
  t.string "title"
5
4
  t.string "text"
6
5
  end
7
-
8
6
  end
@@ -0,0 +1,16 @@
1
+ require_relative "spec_helper"
2
+
3
+ describe Aureus do
4
+
5
+ before do
6
+ @resource = Resource.create! title: "the title", text: "some long text"
7
+ @resources = [@resource,@resource,@resource]
8
+ end
9
+
10
+ Dir["spec/lib/views/*.haml"].each do |file|
11
+ it "should render #{file}" do
12
+ Haml::Engine.new(File.read(file)).render(self)
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,21 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+
4
+ require "rails/all"
5
+ require "aureus"
6
+ require "haml"
7
+
8
+ Bundler.require :default, :test
9
+
10
+ include Aureus::Helper
11
+
12
+ ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
13
+ load "spec/lib/helper/schema.rb"
14
+ load "spec/lib/helper/resource.rb"
15
+
16
+ RSpec.configure do |config|
17
+ config.treat_symbols_as_metadata_keys_with_true_values = true
18
+ config.run_all_when_everything_filtered = true
19
+ config.filter_run :focus
20
+ config.order = "random"
21
+ end
@@ -0,0 +1,14 @@
1
+ .first
2
+ = aureus_box "first_box" do
3
+ %strong content
4
+
5
+ .second
6
+ = aureus_box "a title", :centered => true, :for => :form do
7
+ %li a entry
8
+
9
+ .third
10
+ = aureus_box "a title" do |b|
11
+ - b.content do
12
+ %strong the content
13
+ - b.foot do
14
+ %strong the footer
@@ -0,0 +1,2 @@
1
+ .first
2
+ = aureus_content "content"
@@ -0,0 +1,11 @@
1
+ .first
2
+ = aureus_datatable @resources do |t|
3
+ - t.head do |h|
4
+ - h.text "Title"
5
+ - h.text "Text"
6
+ - t.row do |r,res|
7
+ - r.cell res.title
8
+ - r.cell res.text
9
+ - r.button :show, "url"
10
+ - r.button :edit, "url"
11
+ - r.button :destroy, "url", :confirm => "Delete user?"
@@ -0,0 +1,5 @@
1
+ .first
2
+ = aureus_listing do |l|
3
+ - l.entry "head", "body"
4
+ - l.entry "head2" do
5
+ %strong body2
@@ -0,0 +1,2 @@
1
+ .first
2
+ = aureus_messages :notice => "notice", :error => "error", :alert => "alert"
@@ -0,0 +1,4 @@
1
+ .first
2
+ = aureus_navigation do |n|
3
+ - n.title "the title"
4
+ - n.button "quicklinks"
@@ -0,0 +1,28 @@
1
+ .first
2
+ = aureus_row do
3
+ = aureus_box "a box title" do
4
+ %strong hello
5
+
6
+ .second
7
+ = aureus_row do
8
+ %strong only wrapper
9
+
10
+ .third
11
+ = aureus_row do |r|
12
+ - r.column 100 do
13
+ .one-column
14
+
15
+ .fourth
16
+ = aureus_row do |r|
17
+ - r.column 2 do
18
+ .first
19
+ - r.space 2
20
+
21
+ .fifth
22
+ = aureus_row do |r|
23
+ - r.column 25 do
24
+ .first
25
+ - r.column 25 do
26
+ .second
27
+ - r.column 50 do
28
+ .third
@@ -0,0 +1,8 @@
1
+ .first
2
+ = aureus_toolbar "A nice title" do |t|
3
+ - t.left do |l|
4
+ - l.link_to "an anchor", "http://www.example.com"
5
+ - l.link_to "an anchor", "http://www.example.com"
6
+ - t.right do |r|
7
+ - r.info "some info"
8
+ - r.link_to "an anchor", "http://www.example.com"
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.1.2
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,56 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-25 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: formtastic
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: jquery-rails
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: haml
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
+ dependencies: []
62
14
  description: Aureus is a tool to quickly generate admin interfaces for a rails app.
63
15
  It's between scaffolding an tools like ActiveAdmin.
64
16
  email: joel.gaehwiler@bluewin.ch
@@ -67,8 +19,10 @@ extensions: []
67
19
  extra_rdoc_files: []
68
20
  files:
69
21
  - .gitignore
22
+ - .rspec
70
23
  - Gemfile
71
24
  - Gemfile.lock
25
+ - Guardfile
72
26
  - Rakefile
73
27
  - Readme.md
74
28
  - TODO.md
@@ -82,6 +36,7 @@ files:
82
36
  - app/assets/images/aureus/icon-sort-abc-desc.png
83
37
  - app/assets/images/aureus/icon-sort.png
84
38
  - app/assets/images/aureus/topbar.png
39
+ - app/assets/javascripts/aureus/defaults.js
85
40
  - app/assets/javascripts/aureus/extensions.js
86
41
  - app/assets/javascripts/aureus/functions.js
87
42
  - app/assets/javascripts/aureus/index.js
@@ -99,7 +54,10 @@ files:
99
54
  - app/assets/stylesheets/aureus/topbar.scss
100
55
  - app/assets/stylesheets/aureus/ui.scss
101
56
  - aureus.gemspec
102
- - config/initializers/formtastic.rb
57
+ - config/locales/aureus.en.yml
58
+ - config/locales/devise_base.en.yml
59
+ - config/locales/devise_mail.en.yml
60
+ - config/locales/devise_ui.en.yml
103
61
  - lib/aureus.rb
104
62
  - lib/aureus/box.rb
105
63
  - lib/aureus/content.rb
@@ -110,16 +68,12 @@ files:
110
68
  - lib/aureus/map.rb
111
69
  - lib/aureus/messages.rb
112
70
  - lib/aureus/navigation.rb
71
+ - lib/aureus/renderable.rb
113
72
  - lib/aureus/row.rb
114
- - lib/aureus/test/resource.rb
115
- - lib/aureus/test/schema.rb
116
73
  - lib/aureus/toolbar.rb
117
74
  - lib/aureus/version.rb
118
75
  - lib/generators/aureus/.DS_Store
119
76
  - lib/generators/aureus/devise_i18n/devise_i18n_generator.rb
120
- - lib/generators/aureus/devise_i18n/templates/devise_base.en.yml
121
- - lib/generators/aureus/devise_i18n/templates/devise_mail.en.yml
122
- - lib/generators/aureus/devise_i18n/templates/devise_ui.en.yml
123
77
  - lib/generators/aureus/devise_views/devise_views_generator.rb
124
78
  - lib/generators/aureus/devise_views/templates/devise/confirmations/new.html.haml
125
79
  - lib/generators/aureus/devise_views/templates/devise/mailer/confirmation_instructions.html.haml
@@ -142,8 +96,18 @@ files:
142
96
  - lib/generators/aureus/views/templates/views/new.html.haml
143
97
  - lib/generators/aureus/views/templates/views/show.html.haml
144
98
  - lib/generators/aureus/views/views_generator.rb
145
- - test/html.haml
146
- - test/model.rb
99
+ - spec/lib/helper/resource.rb
100
+ - spec/lib/helper/schema.rb
101
+ - spec/lib/render_spec.rb
102
+ - spec/lib/spec_helper.rb
103
+ - spec/lib/views/box.haml
104
+ - spec/lib/views/content.haml
105
+ - spec/lib/views/datatable.haml
106
+ - spec/lib/views/listing.haml
107
+ - spec/lib/views/messages.haml
108
+ - spec/lib/views/navigation.haml
109
+ - spec/lib/views/row.haml
110
+ - spec/lib/views/toolbar.haml
147
111
  homepage: https://github.com/256dpi/aureus
148
112
  licenses:
149
113
  - MIT
@@ -157,12 +121,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
121
  - - ! '>='
158
122
  - !ruby/object:Gem::Version
159
123
  version: '0'
124
+ segments:
125
+ - 0
126
+ hash: 3122223363716287929
160
127
  required_rubygems_version: !ruby/object:Gem::Requirement
161
128
  none: false
162
129
  requirements:
163
130
  - - ! '>='
164
131
  - !ruby/object:Gem::Version
165
132
  version: '0'
133
+ segments:
134
+ - 0
135
+ hash: 3122223363716287929
166
136
  requirements: []
167
137
  rubyforge_project:
168
138
  rubygems_version: 1.8.24
@@ -170,5 +140,15 @@ signing_key:
170
140
  specification_version: 3
171
141
  summary: a nice looking framework for your rails admin interfaces
172
142
  test_files:
173
- - test/html.haml
174
- - test/model.rb
143
+ - spec/lib/helper/resource.rb
144
+ - spec/lib/helper/schema.rb
145
+ - spec/lib/render_spec.rb
146
+ - spec/lib/spec_helper.rb
147
+ - spec/lib/views/box.haml
148
+ - spec/lib/views/content.haml
149
+ - spec/lib/views/datatable.haml
150
+ - spec/lib/views/listing.haml
151
+ - spec/lib/views/messages.haml
152
+ - spec/lib/views/navigation.haml
153
+ - spec/lib/views/row.haml
154
+ - spec/lib/views/toolbar.haml
@@ -1,82 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # Set the default text field size when input is a string. Default is nil.
4
- # Formtastic::FormBuilder.default_text_field_size = 50
5
-
6
- # Set the default text area height when input is a text. Default is 20.
7
- # Formtastic::FormBuilder.default_text_area_height = 5
8
-
9
- # Set the default text area width when input is a text. Default is nil.
10
- # Formtastic::FormBuilder.default_text_area_width = 50
11
-
12
- # Should all fields be considered "required" by default?
13
- # Defaults to true.
14
- # Formtastic::FormBuilder.all_fields_required_by_default = true
15
-
16
- # Should select fields have a blank option/prompt by default?
17
- # Defaults to true.
18
- # Formtastic::FormBuilder.include_blank_for_select_by_default = true
19
-
20
- # Set the string that will be appended to the labels/fieldsets which are required
21
- # It accepts string or procs and the default is a localized version of
22
- # '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
23
- # in your locale, it will replace the abbr title properly. But if you don't want to use
24
- # abbr tag, you can simply give a string as below
25
- # Formtastic::FormBuilder.required_string = "(required)"
26
-
27
- # Set the string that will be appended to the labels/fieldsets which are optional
28
- # Defaults to an empty string ("") and also accepts procs (see required_string above)
29
- # Formtastic::FormBuilder.optional_string = "(optional)"
30
-
31
- # Set the way inline errors will be displayed.
32
- # Defaults to :sentence, valid options are :sentence, :list, :first and :none
33
- # Formtastic::FormBuilder.inline_errors = :sentence
34
- # Formtastic uses the following classes as default for hints, inline_errors and error list
35
-
36
- # If you override the class here, please ensure to override it in your stylesheets as well
37
- # Formtastic::FormBuilder.default_hint_class = "inline-hints"
38
- # Formtastic::FormBuilder.default_inline_error_class = "inline-errors"
39
- # Formtastic::FormBuilder.default_error_list_class = "errors"
40
-
41
- # Set the method to call on label text to transform or format it for human-friendly
42
- # reading when formtastic is used without object. Defaults to :humanize.
43
- # Formtastic::FormBuilder.label_str_method = :humanize
44
-
45
- # Set the array of methods to try calling on parent objects in :select and :radio inputs
46
- # for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
47
- # that is found on the object will be used.
48
- # Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
49
- # Formtastic::FormBuilder.collection_label_methods = [
50
- # "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
51
-
52
- # Additionally, you can customize the order for specific types of inputs.
53
- # This is configured on a type basis and if a type is not found it will
54
- # fall back to the default order as defined by #inline_order
55
- # Formtastic::FormBuilder.custom_inline_order[:checkbox] = [:errors, :hints, :input]
56
- # Formtastic::FormBuilder.custom_inline_order[:select] = [:hints, :input, :errors]
57
-
58
- # Specifies if labels/hints for input fields automatically be looked up using I18n.
59
- # Default value: true. Overridden for specific fields by setting value to true,
60
- # i.e. :label => true, or :hint => true (or opposite depending on initialized value)
61
- # Formtastic::FormBuilder.i18n_lookups_by_default = false
62
-
63
- # Specifies if I18n lookups of the default I18n Localizer should be cached to improve performance.
64
- # Defaults to false.
65
- # Formtastic::FormBuilder.i18n_cache_lookups = true
66
-
67
- # Specifies the class to use for localization lookups. You can create your own
68
- # class and use it instead by subclassing Formtastic::Localizer (which is the default).
69
- # Formtastic::FormBuilder.i18n_localizer = MyOwnLocalizer
70
-
71
- # You can add custom inputs or override parts of Formtastic by subclassing Formtastic::FormBuilder and
72
- # specifying that class here. Defaults to Formtastic::FormBuilder.
73
- # Formtastic::Helpers::FormHelper.builder = MyCustomBuilder
74
-
75
- # You can opt-in to Formtastic's use of the HTML5 `required` attribute on `<input>`, `<select>`
76
- # and `<textarea>` tags by setting this to false (defaults to true).
77
- #Formtastic::FormBuilder.use_required_attribute = true
78
-
79
- # You can opt-in to new HTML5 browser validations (for things like email and url inputs) by setting
80
- # this to false. Doing so will add a `novalidate` attribute to the `<form>` tag.
81
- # See http://diveintohtml5.org/forms.html#validation for more info.
82
- #Formtastic::FormBuilder.perform_browser_validations = true
data/test/html.haml DELETED
@@ -1,64 +0,0 @@
1
- = aureus_toolbar "A nice title" do |t|
2
- - t.left do |l|
3
- - l.link_to "an anchor", "http://www.example.com"
4
- - l.link_to "an anchor", "http://www.example.com"
5
- - t.right do |r|
6
- - r.info "some info"
7
- - r.link_to "an anchor", "http://www.example.com"
8
-
9
- = aureus_navigation do |n|
10
- - n.title "the title"
11
- - n.button "quicklinks"
12
-
13
- = aureus_messages :notice => "notice", :error => "error", :alert => "alert"
14
-
15
- = aureus_content "content"
16
-
17
- = aureus_row do
18
- = aureus_box "a box title" do
19
- %strong hello
20
-
21
- = aureus_row do
22
- %strong only wrapper
23
-
24
- = aureus_row do |r|
25
- - r.column 100 do
26
- .one-column
27
-
28
- = aureus_row do |r|
29
- - r.column 2 do
30
- .first
31
- - r.space 2
32
-
33
- = aureus_row do |r|
34
- - r.column 25 do
35
- .first
36
- - r.column 25 do
37
- .second
38
- - r.column 50 do
39
- .third
40
-
41
- = aureus_box "a title", :centered => true, :for => :form do
42
- %li a entry
43
-
44
- = aureus_box "a title" do |b|
45
- - b.content do
46
- %strong the content
47
- - b.foot do
48
- %strong the footer
49
-
50
- = aureus_datatable @resources do |t|
51
- - t.head do |h|
52
- - h.text "Title"
53
- - h.text "Text"
54
- - t.row do |r,res|
55
- - r.cell res.title
56
- - r.cell res.text
57
- - r.button :show, "url"
58
- - r.button :edit, "url"
59
- - r.button :destroy, "url", :confirm => "Delete user?"
60
-
61
- = aureus_listing do |l|
62
- - l.entry "head", "body"
63
- - l.entry "head2" do
64
- %strong body2
data/test/model.rb DELETED
@@ -1,3 +0,0 @@
1
- class Resource < ActiveRecord::Base
2
-
3
- end