presenting 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/app/assets/javascripts/{grid.js → presenting/grid.js} +0 -0
  2. data/app/assets/javascripts/{search.js → presenting/search.js} +0 -0
  3. data/app/assets/stylesheets/{details-color.css → presenting/details-color.css} +0 -0
  4. data/app/assets/stylesheets/{details.css → presenting/details.css} +0 -0
  5. data/app/assets/stylesheets/{form.css → presenting/form.css} +0 -0
  6. data/app/assets/stylesheets/{grid-color.css → presenting/grid-color.css} +0 -0
  7. data/app/assets/stylesheets/{grid.css → presenting/grid.css} +0 -0
  8. data/app/assets/stylesheets/{search-color.css → presenting/search-color.css} +0 -0
  9. data/app/assets/stylesheets/{search.css → presenting/search.css} +0 -0
  10. data/lib/presenting.rb +1 -1
  11. data/lib/presenting/engine.rb +1 -1
  12. data/lib/presenting/helpers.rb +13 -25
  13. data/test/r3/Gemfile +1 -1
  14. data/test/r3/Gemfile.lock +1 -1
  15. data/test/r3/log/test.log +68 -0
  16. data/test/r3/public/javascripts/presenting/grid.js +0 -0
  17. data/test/r3/public/javascripts/presenting/search.js +0 -0
  18. data/test/r3/public/stylesheets/presenting/details-color.css +0 -0
  19. data/test/r3/public/stylesheets/presenting/details.css +0 -0
  20. data/test/r3/public/stylesheets/presenting/form.css +0 -0
  21. data/test/r3/public/stylesheets/presenting/grid-color.css +0 -0
  22. data/test/r3/public/stylesheets/presenting/grid.css +0 -0
  23. data/test/r3/public/stylesheets/presenting/search-color.css +0 -0
  24. data/test/r3/public/stylesheets/presenting/search.css +0 -0
  25. data/test/r4/Gemfile.lock +1 -1
  26. data/test/r4/log/test.log +39 -0
  27. data/test/r4/public/javascripts/presenting/grid.js +0 -0
  28. data/test/r4/public/javascripts/presenting/search.js +13 -0
  29. data/test/r4/public/stylesheets/presenting/details-color.css +7 -0
  30. data/test/r4/public/stylesheets/presenting/details.css +10 -0
  31. data/test/r4/public/stylesheets/presenting/form.css +1 -0
  32. data/test/r4/public/stylesheets/presenting/grid-color.css +71 -0
  33. data/test/r4/public/stylesheets/presenting/grid.css +64 -0
  34. data/test/r4/public/stylesheets/presenting/search-color.css +16 -0
  35. data/test/r4/public/stylesheets/presenting/search.css +45 -0
  36. data/test/test_helper.rb +4 -4
  37. metadata +47 -23
  38. checksums.yaml +0 -7
  39. data/app/controllers/presentation/assets_controller.rb +0 -48
  40. data/config/routes.rb +0 -8
  41. data/test/assets_test.rb +0 -56
@@ -19,7 +19,7 @@ module Presenting
19
19
  def self.precache!
20
20
  presenting_dir = File.join(File.dirname(__FILE__), '../') # gross
21
21
  %w(stylesheets javascripts).each do |asset_type|
22
- source_dir = File.join(presenting_dir, 'app', 'assets', asset_type)
22
+ source_dir = File.join(presenting_dir, 'app', 'assets', asset_type, 'presenting')
23
23
  target_dir = File.join(Rails.application.paths["public/#{asset_type}"].first, 'presenting')
24
24
  FileUtils.mkdir_p(target_dir)
25
25
 
@@ -1,7 +1,7 @@
1
1
  module Presenting
2
2
  class Engine < Rails::Engine
3
3
  initializer "presenting.precache" do |app|
4
- Presenting.precache!
4
+ Presenting.precache! unless Rails.configuration.assets.enabled
5
5
  end
6
6
  end
7
7
  end
@@ -1,20 +1,8 @@
1
1
  module Presenting
2
2
  module Helpers
3
- def presentation_stylesheets(*args)
4
- warn "[DEPRECATION] presentation_stylesheets is deprecated. Please use the stylesheets" <<
5
- "that are copied to public/stylesheets/presenting/* on boot."
6
- stylesheet_link_tag presentation_stylesheet_path(args.sort.join(','), :format => 'css')
7
- end
8
-
9
- def presentation_javascript(*args)
10
- warn "[DEPRECATION] presentation_javascript is deprecated. Please use the javascripts" <<
11
- "that are copied to public/javascripts/presenting/* on boot."
12
- javascript_include_tag presentation_javascript_path(args.sort.join(','), :format => 'js')
13
- end
14
-
15
3
  def present(*args, &block)
16
4
  options = args.length > 1 ? args.extract_options! : {}
17
-
5
+
18
6
  if args.first.is_a? Symbol
19
7
  object, presentation = nil, args.first
20
8
  else
@@ -28,7 +16,7 @@ module Presenting
28
16
  instance.presentable = object
29
17
  instance.controller = controller
30
18
  instance.render
31
- elsif respond_to?(method_name = "present_#{presentation}")
19
+ elsif respond_to?(method_name = "present_#{presentation}", true)
32
20
  send(method_name, object, options)
33
21
  else
34
22
  raise ArgumentError, "unknown presentation `#{presentation}'"
@@ -39,27 +27,27 @@ module Presenting
39
27
  present_by_class(object, options)
40
28
  end
41
29
  end
42
-
30
+
43
31
  # presents a text search widget for the given field (a Presentation::FieldSearch::Field, probably)
44
32
  def present_text_search(field, options = {})
45
33
  current_value = (params[:search][field.param][:value] rescue nil)
46
34
  text_field_tag options[:name], h(current_value)
47
35
  end
48
-
36
+
49
37
  # presents a checkbox search widget for the given field (a Presentation::FieldSearch::Field, probably)
50
38
  def present_checkbox_search(field, options = {})
51
39
  current_value = (params[:search][field.param][:value] rescue nil)
52
40
  check_box_tag options[:name], '1', current_value.to_s == '1'
53
41
  end
54
-
42
+
55
43
  # presents a dropdown/select search widget for the given field (a Presentation::FieldSearch::Field, probably)
56
44
  def present_dropdown_search(field, options = {})
57
45
  current_value = (params[:search][field.param][:value] rescue nil)
58
46
  select_tag options[:name], options_for_select(normalize_dropdown_options_to_strings(field.options), current_value)
59
47
  end
60
-
48
+
61
49
  protected
62
-
50
+
63
51
  # We want to normalize the value elements of the dropdown options to strings so that
64
52
  # they will match against params[:search].
65
53
  #
@@ -81,7 +69,7 @@ module Presenting
81
69
  def present_association(object, options = {})
82
70
  present_by_class(object, options)
83
71
  end
84
-
72
+
85
73
  def present_by_class(object, options = {})
86
74
  case object
87
75
  when Array
@@ -90,7 +78,7 @@ module Presenting
90
78
  content_tag "li", present(i, options)
91
79
  end.join.html_safe
92
80
  end
93
-
81
+
94
82
  when Hash
95
83
  # sort by keys
96
84
  content_tag "dl" do
@@ -99,16 +87,16 @@ module Presenting
99
87
  content_tag("dd", present(object[k], options))
100
88
  end.join.html_safe
101
89
  end
102
-
90
+
103
91
  when TrueClass, FalseClass
104
92
  object ? "True" : "False"
105
-
93
+
106
94
  when Date, Time, DateTime
107
95
  l(object, :format => :default)
108
-
96
+
109
97
  else
110
98
  options[:raw] ? object.to_s.html_safe : object.to_s
111
- end
99
+ end
112
100
  end
113
101
  end
114
102
  end
@@ -8,4 +8,4 @@ gem 'will_paginate', '~>3.0.4'
8
8
 
9
9
  group :test do
10
10
  gem 'mocha', :require => nil
11
- end
11
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/cainlevy/Code/presenting
3
3
  specs:
4
- presenting (2.0.3)
4
+ presenting (3.0.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -0,0 +1,68 @@
1
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_details.erb (3.1ms)
2
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_details.erb (0.2ms)
3
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_details.erb (0.1ms)
4
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (2.6ms)
5
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
6
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
7
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
8
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.2ms)
9
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
10
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
11
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (2.5ms)
12
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.0ms)
13
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.4ms)
14
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
15
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
16
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
17
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.1ms)
18
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
19
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.5ms)
20
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
21
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.0ms)
22
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
23
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
24
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (2.1ms)
25
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
26
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
27
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.5ms)
28
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
29
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
30
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.9ms)
31
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.8ms)
32
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
33
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
34
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
35
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (11.7ms)
36
+ Connecting to database specified by database.yml
37
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.2ms)
38
+  (0.3ms) begin transaction
39
+  (0.0ms) rollback transaction
40
+  (0.0ms) begin transaction
41
+  (0.1ms) rollback transaction
42
+  (0.0ms) begin transaction
43
+  (0.0ms) rollback transaction
44
+  (0.0ms) begin transaction
45
+  (0.0ms) rollback transaction
46
+  (0.0ms) begin transaction
47
+  (0.0ms) rollback transaction
48
+  (0.0ms) begin transaction
49
+  (0.0ms) rollback transaction
50
+  (0.0ms) begin transaction
51
+  (0.0ms) rollback transaction
52
+  (0.0ms) begin transaction
53
+  (0.0ms) rollback transaction
54
+  (0.0ms) begin transaction
55
+  (0.0ms) rollback transaction
56
+  (0.0ms) begin transaction
57
+  (0.0ms) rollback transaction
58
+  (0.0ms) begin transaction
59
+  (0.0ms) rollback transaction
60
+  (0.0ms) begin transaction
61
+  (0.0ms) rollback transaction
62
+  (0.0ms) begin transaction
63
+  (0.0ms) rollback transaction
64
+  (0.0ms) begin transaction
65
+  (0.0ms) rollback transaction
66
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_search.erb (0.9ms)
67
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_search.erb (0.3ms)
68
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_search.erb (0.2ms)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/cainlevy/Code/presenting
3
3
  specs:
4
- presenting (2.0.3)
4
+ presenting (3.0.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -0,0 +1,39 @@
1
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_details.erb (2.4ms)
2
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_details.erb (0.1ms)
3
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_details.erb (0.1ms)
4
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (1.5ms)
5
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
6
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
7
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
8
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.2ms)
9
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.8ms)
10
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_field_search.erb (0.7ms)
11
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (6.9ms)
12
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
13
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (2.8ms)
14
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.7ms)
15
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.8ms)
16
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.9ms)
17
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (2.4ms)
18
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.8ms)
19
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.8ms)
20
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.8ms)
21
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (0.9ms)
22
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (2.1ms)
23
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_form.erb (1.5ms)
24
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (3.1ms)
25
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.8ms)
26
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.8ms)
27
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.5ms)
28
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.8ms)
29
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.7ms)
30
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (1.1ms)
31
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.8ms)
32
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.8ms)
33
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.8ms)
34
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.4ms)
35
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (53.3ms)
36
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_grid.erb (0.2ms)
37
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_search.erb (0.8ms)
38
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_search.erb (0.2ms)
39
+ Rendered /Users/cainlevy/Code/presenting/app/views/presentations/_search.erb (0.2ms)
@@ -0,0 +1,13 @@
1
+ $('.presentation-search .compact fieldset label').livequery(function() {
2
+ var label = $(this);
3
+ var field = label.siblings('input');
4
+ if (!field[0] || field.attr('type') == 'checkbox') return;
5
+
6
+ label.addClass('overlabel');
7
+
8
+ var hide_label = function() { label.css('text-indent', '-1000px') };
9
+ var show_label = function() { this.value || label.css('text-indent', '0px') };
10
+
11
+ $(field).focus(hide_label).blur(show_label).each(hide_label).each(show_label);
12
+ $(label).click(function() {field.focus()});
13
+ });
@@ -0,0 +1,7 @@
1
+ .presentation-details dt {
2
+ color: #444;
3
+ }
4
+
5
+ .presentation-details dd {
6
+ border-color: #888;
7
+ }
@@ -0,0 +1,10 @@
1
+ .presentation-details dt {
2
+ font-weight: bold;
3
+ }
4
+
5
+ .presentation-details dd {
6
+ margin-left: 0;
7
+ padding-bottom: 0.5em;
8
+ border-bottom: 1px dotted;
9
+ margin-bottom: 0.5em;
10
+ }
@@ -0,0 +1 @@
1
+ .presentation-form {}
@@ -0,0 +1,71 @@
1
+ .presentation-grid a {
2
+ color: #06c;
3
+ }
4
+
5
+ .presentation-grid {
6
+ font-family: sans-serif;
7
+ background-color: #fff;
8
+ }
9
+
10
+ .presentation-grid caption {
11
+ background-color: transparent;
12
+ }
13
+
14
+ .presentation-grid thead {
15
+ background-color: transparent;
16
+ }
17
+
18
+ .presentation-grid thead th {
19
+ border-bottom: 2px solid #aaa;
20
+ font-weight: normal;
21
+ color: #666;
22
+ background-color: transparent;
23
+ }
24
+
25
+ .presentation-grid tbody tr.even {
26
+ background-color: #e6f2ff;
27
+ border-bottom: 1px solid #c5dbf7;
28
+ border-top: 1px solid #c5dbf7;
29
+ }
30
+
31
+ .presentation-grid tbody td.sorted {
32
+ background-color: #f5f5f5;
33
+ }
34
+
35
+ .presentation-grid tbody tr.even td.sorted {
36
+ background-color: #c5dbf7;
37
+ }
38
+
39
+ .presentation-grid tfoot .pagination {
40
+ margin-top: 0.5em;
41
+ }
42
+
43
+ .presentation-grid tfoot .pagination a {
44
+ text-decoration: none;
45
+ }
46
+
47
+ .presentation-grid tfoot .pagination .prev_page,
48
+ .presentation-grid tfoot .pagination .next_page {
49
+ padding: 0.1em 0.5em;
50
+ background-color: #eee;
51
+ border: 1px solid #e5e5e5;
52
+ }
53
+
54
+ .presentation-grid tfoot .pagination a.prev_page:hover,
55
+ .presentation-grid tfoot .pagination a.next_page:hover {
56
+ background-color: #e6f2ff;
57
+ border-color: #c5dbf7;
58
+ }
59
+
60
+ .presentation-grid tfoot .pagination .prev_page {
61
+ margin-right: 0.7em;
62
+ }
63
+
64
+ .presentation-grid tfoot .pagination .next_page {
65
+ margin-left: 0.7em;
66
+ }
67
+
68
+ .presentation-grid tfoot .pagination .current {
69
+ padding: 0.1em 0.5em;
70
+ border: 1px solid #e5e5e5;
71
+ }
@@ -0,0 +1,64 @@
1
+ /** cellspacing **/
2
+ .presentation-grid table,
3
+ .presentation-grid td,
4
+ .presentation-grid th {
5
+ border: 0;
6
+ border-collapse: collapse;
7
+ }
8
+
9
+ .presentation-grid table {
10
+ width: 100%;
11
+ }
12
+
13
+ .presentation-grid caption {
14
+ text-align: left;
15
+ font-weight: bold;
16
+ padding-left: 0.2em;
17
+ }
18
+
19
+ .presentation-grid th {
20
+ padding: 0.2em 0.5em 0em 0.2em;
21
+ text-align: left;
22
+ vertical-align: bottom;
23
+ }
24
+
25
+ .presentation-grid th a {
26
+ text-decoration: none;
27
+ }
28
+
29
+ .presentation-grid td {
30
+ padding: 0.4em 0.5em 0.4em 0.2em;
31
+ vertical-align: top;
32
+ }
33
+
34
+ .presentation-grid ul.actions {
35
+ overflow: auto;
36
+ zoom: 1;
37
+ float: right;
38
+ list-style: none;
39
+ margin: 0;
40
+ padding: 0;
41
+ }
42
+
43
+ .presentation-grid ul.actions li {
44
+ float: left;
45
+ }
46
+
47
+ .presentation-grid ul.actions li a {
48
+ font-weight: normal;
49
+ display: block;
50
+ padding: 0em 0.3em;
51
+ text-decoration: none;
52
+ }
53
+
54
+ .presentation-grid ul.actions li a:hover {
55
+ text-decoration: underline;
56
+ }
57
+
58
+ .presentation-grid ul.actions li a {
59
+ outline: none;
60
+ }
61
+
62
+ .presentation-grid caption ul.actions {
63
+ margin-right: 0.5em;
64
+ }
@@ -0,0 +1,16 @@
1
+ .presentation-search label {
2
+ color: #666;
3
+ }
4
+
5
+ .presentation-search fieldset {
6
+ border: 1px solid #c5dbf7;
7
+ background-color: #e6f2ff;
8
+ padding: 2px;
9
+ }
10
+
11
+ .presentation-search fieldset.submit {
12
+ border: 0px;
13
+ padding: 0px;
14
+ background-color: transparent;
15
+ }
16
+
@@ -0,0 +1,45 @@
1
+ .presentation-search {
2
+ overflow: hidden;
3
+ zoom: 1;
4
+ }
5
+
6
+ .presentation-search fieldset {
7
+ border: 0;
8
+ margin: 0 0.5em 1em 0;
9
+ padding: 0;
10
+ float: left;
11
+ width: 145px;
12
+ }
13
+
14
+ .presentation-search fieldset label {
15
+ font-weight: normal;
16
+ margin: 0;
17
+ padding: 0;
18
+ text-transform: none;
19
+ }
20
+
21
+ .presentation-search fieldset input,
22
+ .presentation-search fieldset select {
23
+ padding: 0px;
24
+ margin: 0px;
25
+ }
26
+
27
+ /* for overlabels (requires javascript) */
28
+
29
+ .presentation-search .compact label {
30
+ display: inline;
31
+ }
32
+
33
+ .presentation-search .compact fieldset {
34
+ position: relative;
35
+ width: auto;
36
+ }
37
+
38
+ .presentation-search .compact fieldset label.overlabel {
39
+ display: block;
40
+ position: absolute;
41
+ top: 0.2em;
42
+ left: 0.5em;
43
+ z-index: 1;
44
+ cursor: text;
45
+ }
@@ -1,7 +1,7 @@
1
1
  # load the test app, which will load gems
2
2
  ENV['RAILS_ENV'] = 'test'
3
3
 
4
- if ENV['RAILS_VERSION'] = '4'
4
+ if ENV['RAILS_VERSION'] == '4'
5
5
  require File.join(File.dirname(__FILE__), 'r4', 'config', 'environment.rb')
6
6
  else
7
7
  require File.join(File.dirname(__FILE__), 'r3', 'config', 'environment.rb')
@@ -23,15 +23,15 @@ class Presentation::RenderTest < Presenting::Test
23
23
  include ActionDispatch::Assertions::SelectorAssertions
24
24
 
25
25
  protected
26
-
26
+
27
27
  def render
28
28
  @render ||= @presentation.render
29
29
  end
30
-
30
+
31
31
  def response_from_page_or_rjs
32
32
  html_document.root
33
33
  end
34
-
34
+
35
35
  def html_document
36
36
  HTML::Document.new(render)
37
37
  end
metadata CHANGED
@@ -1,27 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presenting
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Lance Ivy
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-07-15 00:00:00.000000000 Z
12
+ date: 2013-09-24 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: mocha
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  description: Provides view components to quickly render tables, forms, etc., typically
@@ -49,16 +52,15 @@ files:
49
52
  - lib/presenting/sorting.rb
50
53
  - lib/presenting/view.rb
51
54
  - lib/presenting.rb
52
- - app/assets/javascripts/grid.js
53
- - app/assets/javascripts/search.js
54
- - app/assets/stylesheets/details-color.css
55
- - app/assets/stylesheets/details.css
56
- - app/assets/stylesheets/form.css
57
- - app/assets/stylesheets/grid-color.css
58
- - app/assets/stylesheets/grid.css
59
- - app/assets/stylesheets/search-color.css
60
- - app/assets/stylesheets/search.css
61
- - app/controllers/presentation/assets_controller.rb
55
+ - app/assets/javascripts/presenting/grid.js
56
+ - app/assets/javascripts/presenting/search.js
57
+ - app/assets/stylesheets/presenting/details-color.css
58
+ - app/assets/stylesheets/presenting/details.css
59
+ - app/assets/stylesheets/presenting/form.css
60
+ - app/assets/stylesheets/presenting/grid-color.css
61
+ - app/assets/stylesheets/presenting/grid.css
62
+ - app/assets/stylesheets/presenting/search-color.css
63
+ - app/assets/stylesheets/presenting/search.css
62
64
  - app/views/presentations/_details.erb
63
65
  - app/views/presentations/_field_search.erb
64
66
  - app/views/presentations/_form.erb
@@ -67,8 +69,6 @@ files:
67
69
  - LICENSE
68
70
  - README
69
71
  - Rakefile
70
- - config/routes.rb
71
- - test/assets_test.rb
72
72
  - test/attribute_test.rb
73
73
  - test/configurable_test.rb
74
74
  - test/details_test.rb
@@ -88,6 +88,7 @@ files:
88
88
  - test/r3/Gemfile
89
89
  - test/r3/Gemfile.lock
90
90
  - test/r3/log/development.log
91
+ - test/r3/log/test.log
91
92
  - test/r3/public/javascripts/presenting/grid.js
92
93
  - test/r3/public/javascripts/presenting/search.js
93
94
  - test/r3/public/stylesheets/presenting/details-color.css
@@ -105,36 +106,47 @@ files:
105
106
  - test/r4/config.ru
106
107
  - test/r4/Gemfile
107
108
  - test/r4/Gemfile.lock
109
+ - test/r4/log/test.log
110
+ - test/r4/public/javascripts/presenting/grid.js
111
+ - test/r4/public/javascripts/presenting/search.js
112
+ - test/r4/public/stylesheets/presenting/details-color.css
113
+ - test/r4/public/stylesheets/presenting/details.css
114
+ - test/r4/public/stylesheets/presenting/form.css
115
+ - test/r4/public/stylesheets/presenting/grid-color.css
116
+ - test/r4/public/stylesheets/presenting/grid.css
117
+ - test/r4/public/stylesheets/presenting/search-color.css
118
+ - test/r4/public/stylesheets/presenting/search.css
108
119
  - test/sanitize_test.rb
109
120
  - test/search_conditions_test.rb
110
121
  - test/search_test.rb
111
122
  - test/sorting_test.rb
112
123
  - test/test_helper.rb
113
124
  homepage: http://github.com/cainlevy/presenting
114
- licenses: []
115
- metadata: {}
125
+ licenses:
126
+ - MIT
116
127
  post_install_message:
117
128
  rdoc_options: []
118
129
  require_paths:
119
130
  - lib
120
131
  required_ruby_version: !ruby/object:Gem::Requirement
132
+ none: false
121
133
  requirements:
122
- - - '>='
134
+ - - ! '>='
123
135
  - !ruby/object:Gem::Version
124
136
  version: '0'
125
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
126
139
  requirements:
127
- - - '>='
140
+ - - ! '>='
128
141
  - !ruby/object:Gem::Version
129
142
  version: '0'
130
143
  requirements: []
131
144
  rubyforge_project:
132
- rubygems_version: 2.0.0
145
+ rubygems_version: 1.8.23
133
146
  signing_key:
134
- specification_version: 4
147
+ specification_version: 3
135
148
  summary: component-style scaffolding helpers
136
149
  test_files:
137
- - test/assets_test.rb
138
150
  - test/attribute_test.rb
139
151
  - test/configurable_test.rb
140
152
  - test/details_test.rb
@@ -154,6 +166,7 @@ test_files:
154
166
  - test/r3/Gemfile
155
167
  - test/r3/Gemfile.lock
156
168
  - test/r3/log/development.log
169
+ - test/r3/log/test.log
157
170
  - test/r3/public/javascripts/presenting/grid.js
158
171
  - test/r3/public/javascripts/presenting/search.js
159
172
  - test/r3/public/stylesheets/presenting/details-color.css
@@ -171,8 +184,19 @@ test_files:
171
184
  - test/r4/config.ru
172
185
  - test/r4/Gemfile
173
186
  - test/r4/Gemfile.lock
187
+ - test/r4/log/test.log
188
+ - test/r4/public/javascripts/presenting/grid.js
189
+ - test/r4/public/javascripts/presenting/search.js
190
+ - test/r4/public/stylesheets/presenting/details-color.css
191
+ - test/r4/public/stylesheets/presenting/details.css
192
+ - test/r4/public/stylesheets/presenting/form.css
193
+ - test/r4/public/stylesheets/presenting/grid-color.css
194
+ - test/r4/public/stylesheets/presenting/grid.css
195
+ - test/r4/public/stylesheets/presenting/search-color.css
196
+ - test/r4/public/stylesheets/presenting/search.css
174
197
  - test/sanitize_test.rb
175
198
  - test/search_conditions_test.rb
176
199
  - test/search_test.rb
177
200
  - test/sorting_test.rb
178
201
  - test/test_helper.rb
202
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 479f2f07c59e5ba846053771fc69d48bd703961b
4
- data.tar.gz: 41bfb8bd7c763ebcc784f175ae2d0dac1e99262e
5
- SHA512:
6
- metadata.gz: 51d98fb4a952f3cec277647493498f0cc892689fccc09e69da679fc0914dd43690a7eaa5c4a905ca4da7229692fbf1e8143be828a25f70449348e0ba31b2f4f0
7
- data.tar.gz: b046c92f6adfc65d30f9dad6e2eddce0b9ec45591050264d41f9aa1f1fcf283910a0707d64251bdaf2a5f84751b4d6ccdad14bca19376194860cfcc41d69288e
@@ -1,48 +0,0 @@
1
- class Presentation::AssetsController < ActionController::Base
2
- # TODO: this is a hack b/c of load order in the extracted Rails 4 gems, read
3
- # more in this pull request: https://github.com/rails/rails-observers/pull/8
4
- if Rails.version >= '4.0.0'
5
- include ActionController::Caching::Pages
6
- end
7
-
8
- # TODO: consider packaging a minifier so we get the perfect solution: a cached, minified bundle of assets
9
- caches_page :stylesheet, :javascript
10
-
11
- def stylesheet
12
- dir = asset_path(:stylesheets)
13
- sheet = params[:id].split(',').collect{ |id| File.read("#{dir}/#{id}.css") }.join("\n")
14
-
15
- respond_to do |type|
16
- type.css {render :text => sheet}
17
- end
18
- end
19
-
20
- # TODO: bundle unobtrusive javascripts that can add behavior.
21
- # - jquery vs prototype (i'll develop jquery, and wait for prototype contributions)
22
- # - ajax links with html response
23
- # - - inline
24
- # - - modal dialog
25
- # - ajax links with js response
26
- # - ajax links with no response
27
- # - inline editing
28
- # - "dirty" form awareness
29
- # - tabbed forms
30
- # - tooltips for extended information (e.g. column description or truncated field text)
31
- # - basic form validation
32
- # - - required fields
33
- # TODO: tests for ujs
34
- def javascript
35
- dir = asset_path(:javascripts)
36
- script = params[:id].split(',').collect{ |id| File.read("#{dir}/#{id}.js") }.join("\n")
37
-
38
- respond_to do |type|
39
- type.js {render :text => script}
40
- end
41
- end
42
-
43
- protected
44
-
45
- def asset_path(type)
46
- File.join(File.dirname(__FILE__), '..', '..', 'assets', type.to_s)
47
- end
48
- end
@@ -1,8 +0,0 @@
1
- Rails.application.routes.draw do
2
- namespace :presentation do
3
- controller 'assets' do
4
- match 'stylesheets/:id.:format', :as => 'stylesheet', :action => 'stylesheet', :via => [:get], :constraints => {:format => 'css'}
5
- match 'javascript/:id.:format', :as => 'javascript', :action => 'javascript', :via => [:get], :constraints => {:format => 'js'}
6
- end
7
- end
8
- end
@@ -1,56 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class Presentation::AssetsControllerTest < ActionController::TestCase
4
-
5
- def setup
6
- ActionController::Base.perform_caching = false
7
- end
8
-
9
- # stylesheet
10
-
11
- def test_stylesheet_routing_recognition
12
- assert_recognizes({:controller => "presentation/assets", :action => "stylesheet", :id => "foo", :format => "css"}, "/presentation/stylesheets/foo.css")
13
- end
14
-
15
- def test_stylesheet_routing_generation
16
- assert_generates "/presentation/stylesheets/foo.css", {:controller => "presentation/assets", :action => "stylesheet", :id => "foo", :format => "css"}
17
- end
18
-
19
- def test_named_stylesheet_routes
20
- assert_equal "/presentation/stylesheets/foo.css", presentation_stylesheet_path("foo", :format => 'css')
21
- end
22
-
23
- def test_retrieving_a_named_stylesheet
24
- get :stylesheet, :id => 'grid', :format => 'css'
25
- assert_response :success
26
- assert_equal @response.body, File.read(File.join('app', 'assets', 'stylesheets', 'grid.css'))
27
- end
28
-
29
- def test_retrieving_multiple_named_stylesheets
30
- get :stylesheet, :id => 'grid,form', :format => 'css'
31
- assert_response :success
32
- assert @response.body.include?(File.read(File.join('app', 'assets', 'stylesheets', 'grid.css')))
33
- assert @response.body.include?(File.read(File.join('app', 'assets', 'stylesheets', 'form.css')))
34
- end
35
-
36
- # javascript
37
-
38
- def test_javascript_routing_recognition
39
- assert_recognizes({:controller => "presentation/assets", :action => "javascript", :id => "foo", :format => "js"}, "/presentation/javascript/foo.js")
40
- end
41
-
42
- def test_javascript_routing_generation
43
- assert_generates "/presentation/javascript/foo.js", {:controller => "presentation/assets", :action => "javascript", :id => "foo", :format => "js"}
44
- end
45
-
46
- def test_named_javascript_routes
47
- assert_equal "/presentation/javascript/foo.js", presentation_javascript_path("foo", :format => 'js')
48
- end
49
-
50
- def test_retrieving_multiple_named_javascripts
51
- get :javascript, :id => 'grid,search', :format => 'js'
52
- assert_response :success
53
- assert @response.body.include?(File.read(File.join('app', 'assets', 'javascripts', 'grid.js')))
54
- assert @response.body.include?(File.read(File.join('app', 'assets', 'javascripts', 'search.js')))
55
- end
56
- end