active-list 4.2.4 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/VERSION +1 -1
  3. data/{lib → app}/assets/images/active-list.png +0 -0
  4. data/app/assets/images/active-list.svg +415 -0
  5. data/{lib/assets/javascripts/active-list.jquery.js → app/assets/javascripts/active_list.jquery.js} +2 -2
  6. data/app/assets/stylesheets/active_list.css.scss +7 -0
  7. data/{lib/active-list/compass/stylesheets/active-list/_background.scss → app/assets/stylesheets/active_list/background.scss} +10 -8
  8. data/{lib/active-list/compass/stylesheets/active-list/_minimal.scss → app/assets/stylesheets/active_list/minimal.scss} +16 -16
  9. data/{lib/active-list/compass/stylesheets/active-list/_theme.scss → app/assets/stylesheets/active_list/theme.scss} +37 -37
  10. data/lib/active-list.rb +1 -37
  11. data/lib/active_list.rb +43 -0
  12. data/lib/active_list/action_pack.rb +46 -0
  13. data/lib/active_list/definition.rb +17 -0
  14. data/lib/active_list/definition/abstract_column.rb +54 -0
  15. data/lib/active_list/definition/action_column.rb +76 -0
  16. data/lib/active_list/definition/association_column.rb +80 -0
  17. data/lib/active_list/definition/attribute_column.rb +58 -0
  18. data/lib/active_list/definition/check_box_column.rb +17 -0
  19. data/lib/active_list/definition/data_column.rb +88 -0
  20. data/lib/active_list/definition/empty_column.rb +10 -0
  21. data/lib/active_list/definition/field_column.rb +20 -0
  22. data/lib/active_list/definition/status_column.rb +10 -0
  23. data/lib/active_list/definition/table.rb +159 -0
  24. data/lib/active_list/definition/text_field_column.rb +10 -0
  25. data/lib/active_list/exporters.rb +28 -0
  26. data/lib/active_list/exporters/abstract_exporter.rb +55 -0
  27. data/lib/active_list/exporters/csv_exporter.rb +32 -0
  28. data/lib/active_list/exporters/excel_csv_exporter.rb +38 -0
  29. data/lib/active_list/exporters/open_document_spreadsheet_exporter.rb +82 -0
  30. data/lib/active_list/generator.rb +122 -0
  31. data/lib/active_list/generator/finder.rb +150 -0
  32. data/lib/active_list/helpers.rb +33 -0
  33. data/lib/{active-list → active_list}/rails/engine.rb +3 -2
  34. data/lib/active_list/renderers.rb +25 -0
  35. data/lib/active_list/renderers/abstract_renderer.rb +29 -0
  36. data/lib/active_list/renderers/simple_renderer.rb +356 -0
  37. metadata +74 -55
  38. data/lib/active-list/action_pack.rb +0 -48
  39. data/lib/active-list/columns/action_column.rb +0 -83
  40. data/lib/active-list/columns/data_column.rb +0 -151
  41. data/lib/active-list/columns/field_column.rb +0 -29
  42. data/lib/active-list/compass/stylesheets/_active-list.scss +0 -7
  43. data/lib/active-list/definition.rb +0 -103
  44. data/lib/active-list/exporters.rb +0 -71
  45. data/lib/active-list/exporters/csv_exporter.rb +0 -30
  46. data/lib/active-list/exporters/excel_csv_exporter.rb +0 -36
  47. data/lib/active-list/exporters/open_document_spreadsheet_exporter.rb +0 -81
  48. data/lib/active-list/finder.rb +0 -134
  49. data/lib/active-list/generator.rb +0 -88
  50. data/lib/active-list/renderers.rb +0 -28
  51. data/lib/active-list/renderers/simple_renderer.rb +0 -335
  52. data/lib/assets/stylesheets/active-list.css.scss +0 -7
@@ -11,21 +11,23 @@
11
11
  @return merge-color(merge-color(merge-color(merge-color(merge-color(merge-color(merge-color(merge-color(merge-color(merge-color($color, $color-1), $color-2), $color-3), $color-4), $color-5), $color-6), $color-7), $color-8), $color-9), $color-10);
12
12
  }
13
13
 
14
- $list-line-backgrounds: ("" rgba(255, 255, 255, 0)) (".odd" rgba(255, 255, 255, 0.5)) (".even" rgba(255, 255, 255, 0.5));
15
- $list-column-backgrounds: ("" rgba(255, 255, 255, 0)) (".act" rgba(255, 134, 0, 0)) (".sor" rgba(0, 18, 132, 0.05));
16
- $list-hover-backgrounds: ("" rgba(255, 255, 255, 0)) (":hover" rgba(209, 218, 255, 0.3));
14
+ $list-line-backgrounds: ("&" rgba(#FFF, 0)) ("&.error, &.undone" rgba(red, 0.12)) ("&.warning, &.in_progress" rgba(orange, 0.12));
15
+ $list-column-backgrounds: ("&" rgba(#FFF, 0)) ("&.act" rgba(#F90, 0.01)) ("&.sor" rgba(#05A, 0.05));
16
+ $list-hover-backgrounds: ("&" rgba(#FFF, 0)) ("&:hover" rgba(blue, 0.05));
17
17
 
18
18
  @mixin list-colors($bgcolor: #000000, $selector: '&') {
19
19
  tr {
20
20
  #{$selector} {
21
21
  @each $line-background in $list-line-backgrounds {
22
- &#{nth($line-background, 1)} {
22
+ #{nth($line-background, 1)} {
23
23
  @each $hover-background in $list-hover-backgrounds {
24
- &#{nth($hover-background, 1)} {
24
+ #{nth($hover-background, 1)} {
25
25
  @each $col-background in $list-column-backgrounds {
26
- td#{nth($col-background, 1)} {
27
- background-color: merge-colors($bgcolor, nth($line-background, 2), nth($col-background, 2), nth($hover-background, 2));
28
- }
26
+ td {
27
+ #{nth($col-background, 1)} {
28
+ background-color: merge-colors($bgcolor, nth($line-background, 2), nth($col-background, 2), nth($hover-background, 2));
29
+ }
30
+ }
29
31
  }
30
32
  }
31
33
  }
@@ -2,10 +2,10 @@
2
2
 
3
3
  div[data-list-source] {
4
4
  table.list {
5
- thead {
5
+ thead {
6
6
  tr {
7
- th {
8
- &[data-list-column-sort] {
7
+ th {
8
+ &[data-list-column-sort] {
9
9
  cursor: pointer;
10
10
  }
11
11
 
@@ -29,10 +29,10 @@ div[data-list-source] {
29
29
  top: 20px;
30
30
  padding: 1px;
31
31
  margin:0;
32
- & { right: -1px;}
33
- html[dir="rtl"] & { left: -1px;}
32
+ & { right: 0px;}
33
+ html[dir="rtl"] & { left: 0px;}
34
34
  li {
35
- &[data-list-change-page-size], &[data-list-toggle-column] {
35
+ &[data-list-change-page-size], &[data-list-toggle-column] {
36
36
  cursor: pointer;
37
37
  display: block;
38
38
  }
@@ -45,7 +45,7 @@ div[data-list-source] {
45
45
  ul {
46
46
  display: none;
47
47
  position: absolute;
48
- top: -2px;
48
+ top: -2px;
49
49
  & { right: 25ex; }
50
50
  html[dir="rtl"] & { left: 25ex; }
51
51
  &:hover { display:block; }
@@ -56,32 +56,32 @@ div[data-list-source] {
56
56
  }
57
57
  }
58
58
 
59
- &.hidden {
59
+ &.hidden {
60
60
  display: none;
61
61
  }
62
62
 
63
63
  }
64
64
  }
65
65
  }
66
-
67
- tbody {
66
+
67
+ tbody {
68
68
  tr {
69
- td.hidden {
69
+ td.hidden {
70
70
  display: none;
71
71
  }
72
72
  }
73
73
  }
74
-
74
+
75
75
  }
76
76
 
77
- div.extras {
77
+ div.extras {
78
78
  .pagination {
79
- a[data-list-move-to-page] {
79
+ a[data-list-move-to-page] {
80
80
  cursor: pointer;
81
81
  }
82
- a[data-list-move-to-page][disabled] {
82
+ a[data-list-move-to-page][disabled] {
83
83
  cursor: default;
84
84
  }
85
85
  }
86
86
  }
87
- }
87
+ }
@@ -11,8 +11,8 @@
11
11
  height: $size;
12
12
  width: $size;
13
13
  $i: 0;
14
- @each $icon in menu check columns export pages first-page previous-page previous-line next-line next-page last-page sort sort-down sort-up true false {
15
- @if $icon == $name {
14
+ @each $icon in menu check columns export pages first-page previous-page previous-line next-line next-page last-page sort sort-down sort-up true false {
15
+ @if $icon == $name {
16
16
  background-position: (-$i * $size) 0;
17
17
  }
18
18
  $i: $i + 1;
@@ -20,40 +20,40 @@
20
20
  }
21
21
 
22
22
 
23
- @mixin active-list-theme($theme-color: #777777) {
23
+ @mixin active-list-theme($theme-color: #777777) {
24
24
  $default-border-color: mix($theme-color, #FFF, 30%);
25
25
  $menu-width: 250px;
26
- table.list {
26
+ table.list {
27
27
  border-collapse: collapse;
28
28
  width: 100%;
29
29
  border: 1px solid $default-border-color;
30
30
  z-index: 2;
31
31
  @include box-shadow(0 0 7px rgba(0, 0, 0, 0.15));
32
- thead {
33
- th {
32
+ thead {
33
+ th {
34
34
  border: 1px solid $default-border-color;
35
35
  padding: 2px 3px;
36
36
  @include background($theme-color linear-gradient(top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8)));
37
- &[data-list-column-sort] {
38
- .icon {
39
- @include active-list-sprite(sort);
37
+ &[data-list-column-sort] {
38
+ .icon {
39
+ @include active-list-sprite(sort);
40
40
  @include inline-block;
41
41
  margin: 0 2px;
42
42
  }
43
- &.sor[data-list-column-sort="desc"] .icon {
43
+ &.sor[data-list-column-sort="desc"] .icon {
44
44
  @include active-list-sprite(sort-down); }
45
- &.sor[data-list-column-sort="asc"] .icon {
45
+ &.sor[data-list-column-sort="asc"] .icon {
46
46
  @include active-list-sprite(sort-up); }
47
47
  }
48
48
  & { text-align: left; }
49
49
  html[dir="rtl"] & { text-align: right; }
50
- &.spe {
50
+ &.spe {
51
51
  width: 16px;
52
52
  height: 16px;
53
- .list-menu {
53
+ .list-menu {
54
54
  position: relative;
55
55
  background: none;
56
- .list-menu-start {
56
+ .list-menu-start {
57
57
  padding: 2px;
58
58
  width: 16px;
59
59
  height: 16px;
@@ -61,20 +61,20 @@
61
61
  .text { display: none; }
62
62
  }
63
63
  &:hover {
64
- .list-menu-start {
65
- background-color: white;
66
- z-index:5000;
64
+ .list-menu-start {
65
+ background-color: white;
66
+ z-index:5000;
67
67
  }
68
68
  }
69
- ul {
70
- width: $menu-width;
69
+ ul {
70
+ width: $menu-width;
71
71
  border: 1px solid $default-border-color;
72
72
  background: #FFF;
73
73
  @include box-shadow(0 0 5px rgba(0, 0, 0, 0.3));
74
- li {
75
- width: $menu-width;
74
+ li {
75
+ width: $menu-width;
76
76
  padding: 0;
77
- ul {
77
+ ul {
78
78
  & { right: $menu-width; }
79
79
  html[dir="rtl"] & { left: $menu-width; }
80
80
  }
@@ -83,10 +83,10 @@
83
83
  & > ul {
84
84
  top: 19px;
85
85
  }
86
- li {
86
+ li {
87
87
  padding: 0;
88
88
  display: block;
89
- a {
89
+ a {
90
90
  display: block;
91
91
  padding: 2px;
92
92
  .icon {
@@ -96,15 +96,15 @@
96
96
  & { margin-right: 4px; }
97
97
  html[dir="rtl"] & { margin-left: 4px; }
98
98
  }
99
- .text {
99
+ .text {
100
100
  @include inline-block;
101
101
  width: $menu-width - 24px;
102
102
  line-height: 18px;
103
103
  font-weight: normal;
104
104
  }
105
- & * {
105
+ & * {
106
106
  vertical-align: middle;
107
- }
107
+ }
108
108
  &.pages .icon { @include active-list-sprite(pages); }
109
109
  &.columns .icon { @include active-list-sprite(columns); }
110
110
  }
@@ -112,11 +112,11 @@
112
112
  &.check .icon { @include active-list-sprite(check); }
113
113
  &.checked .icon { @include active-list-sprite(true); }
114
114
  &.unchecked .icon { @include active-list-sprite(false); }
115
- &:hover {
115
+ &:hover {
116
116
  text-decoration: none;
117
117
  background: mix($theme-color, #FFF, 10%);
118
118
  }
119
- &.separator {
119
+ &.separator {
120
120
  padding: 0;
121
121
  height: 1px;
122
122
  width: $menu-width - 6px;
@@ -129,23 +129,23 @@
129
129
  }
130
130
  }
131
131
  }
132
- tbody {
132
+ tbody {
133
133
  tr {
134
- td {
134
+ td {
135
135
  padding: 2px 3px;
136
136
  border-top: 1px solid mix($theme-color, #FFF, 10%);
137
137
  border-bottom: none;
138
138
  border-left: none;
139
139
  border-right: none;
140
140
  &.chk,&.act, &.dld, &.bln, &.dat, &.web { text-align:center }
141
- &.dec, &.flt, &.int {
141
+ &.dec, &.flt, &.int {
142
142
  & { text-align: right; }
143
143
  html[dir="rtl"] & { text-align: left; }
144
144
  }
145
145
  &.country { white-space: nowrap; }
146
146
  &.color { color: white; text-shadow: 0 0 2px #000; width: 6ex; text-align: center; }
147
147
  }
148
- &:first-child td {
148
+ &:first-child td {
149
149
  border-top: none;
150
150
  }
151
151
  }
@@ -153,13 +153,13 @@
153
153
 
154
154
  @include list-colors(#FFFFFF);
155
155
  }
156
- .extras {
156
+ .extras {
157
157
  z-index: 0;
158
158
  @include background(transparentize(mix($theme-color, #FFF, 40%), 0.7));
159
- .pagination {
159
+ .pagination {
160
160
  & { text-align: left; }
161
161
  html[dir="rtl"] & { text-align: right; }
162
- & > * {
162
+ & > * {
163
163
  margin: 0 2px;
164
164
  }
165
165
  .first-page, .previous-page, .next-page, .last-page {
@@ -178,7 +178,7 @@
178
178
  html[dir="rtl"] & .previous-page, & .next-page {
179
179
  @include active-list-sprite(next-page);
180
180
  }
181
- .separator {
181
+ .separator {
182
182
  @include inline-block;
183
183
  width: 2px;
184
184
  height: 1.2em;
@@ -1,37 +1 @@
1
- require 'fastercsv'
2
- require 'csv'
3
- require 'action_dispatch'
4
- require 'rails'
5
- require 'compass'
6
-
7
- module ActiveList #:nodoc:
8
-
9
-
10
- CSV = (::CSV.const_defined?(:Reader) ? ::FasterCSV : ::CSV).freeze
11
-
12
- def self.version
13
- v = nil
14
- File.open(File.join(File.dirname(__FILE__), "..", "VERSION")) {|f| v = f.read.strip}
15
- return v
16
- end
17
- VERSION = self.version.freeze
18
-
19
- def self.assets_path
20
- File.join(File.dirname(__FILE__), "assets", "images")
21
- end
22
-
23
- def self.compass_extension_path
24
- File.join(File.dirname(__FILE__), "active-list", "compass")
25
- end
26
-
27
- end
28
-
29
- # Compass registration
30
- Compass::Frameworks.register('active-list', :path => ActiveList.compass_extension_path)
31
-
32
- require "active-list/definition"
33
- require "active-list/generator"
34
- require "active-list/action_pack"
35
- require "active-list/rails/engine"
36
-
37
-
1
+ require 'active_list'
@@ -0,0 +1,43 @@
1
+ require 'csv'
2
+ require 'action_dispatch'
3
+ require 'rails'
4
+ require 'compass-rails'
5
+
6
+ module ActiveList
7
+
8
+ CSV = ::CSV
9
+
10
+ # Build and returns a short UID
11
+ def self.new_uid
12
+ @@last_uid ||= 0
13
+ uid = @@last_uid.to_s(36).to_sym
14
+ @@last_uid += 1
15
+ return uid
16
+ end
17
+
18
+ def self.version
19
+ v = nil
20
+ File.open(File.join(File.dirname(__FILE__), "..", "VERSION")) {|f| v = f.read.strip}
21
+ return v
22
+ end
23
+
24
+ VERSION = self.version.freeze
25
+
26
+ autoload :Helpers, 'active_list/helpers'
27
+ autoload :Definition, 'active_list/definition'
28
+ autoload :Renderers, 'active_list/renderers'
29
+ autoload :Exporters, 'active_list/exporters'
30
+ autoload :Generator, 'active_list/generator'
31
+ autoload :ActionPack, 'active_list/action_pack'
32
+ end
33
+
34
+ unless "".respond_to? :dig
35
+ class ::String
36
+ def dig(depth = 1)
37
+ return self.strip.gsub(/^/, ' ' * depth) + "\n"
38
+ end
39
+ end
40
+ end
41
+
42
+
43
+ require 'active_list/rails/engine'
@@ -0,0 +1,46 @@
1
+ module ActiveList
2
+
3
+ module ActionPack
4
+
5
+ module ActionController
6
+
7
+ def self.included(base) #:nodoc:
8
+ base.extend(ClassMethods)
9
+ end
10
+
11
+ module ClassMethods
12
+
13
+ # Permits to define and generate methods to manage dynamic
14
+ # table ActiveList
15
+ def list(*args, &block)
16
+ options = args.extract_options!
17
+ options[:controller] = self
18
+ args << options
19
+ generator = ActiveList::Generator.new(*args, &block)
20
+ class_eval(generator.controller_method_code, __FILE__, __LINE__)
21
+ ActionView::Base.send(:class_eval, generator.view_method_code, __FILE__, __LINE__)
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ module ViewsHelper
29
+
30
+ # Calls the generated view helper
31
+ def list(*args, &block)
32
+ options = args.extract_options!
33
+ name = args.shift
34
+ kontroller = self.controller.class
35
+ begin
36
+ helper_method = "_#{kontroller.controller_name}_#{__method__}_#{name || kontroller.controller_name}_tag".to_sym
37
+ kontroller = kontroller.superclass
38
+ end until self.respond_to?(helper_method)
39
+ return self.send(helper_method, &block)
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -0,0 +1,17 @@
1
+ module ActiveList
2
+
3
+ module Definition
4
+ autoload :AbstractColumn, 'active_list/definition/abstract_column'
5
+ autoload :ActionColumn, 'active_list/definition/action_column'
6
+ autoload :AssociationColumn, 'active_list/definition/association_column'
7
+ autoload :AttributeColumn, 'active_list/definition/attribute_column'
8
+ autoload :CheckBoxColumn, 'active_list/definition/check_box_column'
9
+ autoload :DataColumn, 'active_list/definition/data_column'
10
+ autoload :EmptyColumn, 'active_list/definition/empty_column'
11
+ autoload :FieldColumn, 'active_list/definition/field_column'
12
+ autoload :StatusColumn, 'active_list/definition/status_column'
13
+ autoload :Table, 'active_list/definition/table'
14
+ autoload :TextFieldColumn, 'active_list/definition/text_field_column'
15
+ end
16
+
17
+ end