active-list 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,128 @@
1
+ /* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; coding: utf-8 -*- */
2
+ /*jslint browser: true */
3
+ /* List Javascript Inobtrusive Support for jQuery */
4
+
5
+ (function ($) {
6
+ "use strict";
7
+
8
+ $.ActiveList = {};
9
+
10
+ // Main function which reload table with specified data parameters
11
+ $.ActiveList.refresh = function (element, new_parameters) {
12
+ var source, parameters, url;
13
+ // element = $(element);
14
+ source = element.closest('div[data-list-source]');
15
+ parameters = {
16
+ sort: source.data("list-sort-by"),
17
+ dir: source.data("list-sort-dir"),
18
+ page: source.data("list-current-page"),
19
+ per_page: source.data("list-page-size")
20
+ };
21
+ $.extend(parameters, new_parameters);
22
+ url = source.data('list-source');
23
+ $.ajax(url, {
24
+ data: parameters,
25
+ dataType: "html",
26
+ success: function (data, status, request) {
27
+ source.replaceWith(data);
28
+ return true;
29
+ }
30
+ });
31
+ return false;
32
+ };
33
+
34
+
35
+ $.ActiveList.moveToPage = function (element, page) {
36
+ var page_attr;
37
+ // element = $(element);
38
+ if (page === undefined || page === null || page === '') {
39
+ page = element.data('list-move-to-page');
40
+ }
41
+ if (page === undefined || page === null || page === '') {
42
+ alert("Cannot define which page to load: "+page);
43
+ }
44
+ if (isNaN(page)) {
45
+ page_attr = page;
46
+ page = element.attr(page_attr);
47
+ if (isNaN(page)) {
48
+ alert("Cannot define which page to load with attribute " + page_attr + ": "+page);
49
+ }
50
+ }
51
+ $.ActiveList.refresh(element, {page: page});
52
+ return false;
53
+ };
54
+
55
+
56
+ // Sort by one column
57
+ $(document).on('click', 'div[data-list-source] th[data-list-column][data-list-column-sort]', function(event) {
58
+ var element = $(this);
59
+ $.ActiveList.refresh(element, {
60
+ sort: element.data('list-column'),
61
+ dir: element.data('list-column-sort')
62
+ });
63
+ return false;
64
+ });
65
+
66
+
67
+ // Change number of item per page
68
+ $(document).on('click', 'div[data-list-source] li[data-list-change-page-size]', function(event) {
69
+ var element = $(this), per_page=element.data('list-change-page-size');
70
+ if (isNaN(per_page)) {
71
+ alert("@list-change-page-size attribute is not a number: "+per_page);
72
+ } else {
73
+ $.ActiveList.refresh(element, {per_page: per_page});
74
+ }
75
+ return false;
76
+ });
77
+
78
+
79
+ // Toggle visibility of a column
80
+ $(document).on('click', 'div[data-list-source] li[data-list-toggle-column]', function(event) {
81
+ var element = $(this), columnId, column, className, search, visibility = '', url, source;
82
+ columnId = element.data('list-toggle-column');
83
+ source = element.closest('div[data-list-source]');
84
+ column = source.find('th[data-list-column="'+columnId+'"]');
85
+ //$('#'+columnId);
86
+ className = column.data("list-column-cells");
87
+ if (className === null) {
88
+ className = columnId;
89
+ }
90
+ search = '.'+className;
91
+ if (column.hasClass("hidden")) {
92
+ $(search).removeClass("hidden");
93
+ column.removeClass("hidden");
94
+ element.removeClass("unchecked");
95
+ element.addClass("checked");
96
+ visibility = 'shown';
97
+ } else {
98
+ $(search).addClass("hidden");
99
+ column.addClass("hidden");
100
+ element.removeClass("checked");
101
+ element.addClass("unchecked");
102
+ visibility = 'hidden';
103
+ }
104
+ url = source.data('list-source');
105
+ $.ajax(url, {
106
+ dataType: "html",
107
+ data: {
108
+ visibility: visibility,
109
+ column: columnId
110
+ }
111
+ });
112
+ return false;
113
+ });
114
+
115
+ // Change page of table on link clicks
116
+ $(document).on('click', 'div[data-list-source] a[data-list-move-to-page]', function(event) {
117
+ $.ActiveList.moveToPage($(this));
118
+ return false;
119
+ });
120
+
121
+ // Change page of table on input changes
122
+ $(document).on('change', 'div[data-list-source] input[data-list-move-to-page]', function(event) {
123
+ $.ActiveList.moveToPage($(this));
124
+ return false;
125
+ });
126
+
127
+
128
+ })(jQuery);
@@ -0,0 +1,7 @@
1
+ @import "active-list/minimal";
2
+ @import "active-list/background";
3
+ @import "active-list/theme";
4
+
5
+ .active-list {
6
+ @include active-list-theme;
7
+ }
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active-list
3
+ version: !ruby/object:Gem::Version
4
+ version: !binary |-
5
+ NC4wLjA=
6
+ prerelease:
7
+ platform: ruby
8
+ authors:
9
+ - Brice Texier
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-06-26 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '3.1'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '3.1'
31
+ - !ruby/object:Gem::Dependency
32
+ name: compass-rails
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '1'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '1'
47
+ - !ruby/object:Gem::Dependency
48
+ name: fastercsv
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '1.5'
63
+ - !ruby/object:Gem::Dependency
64
+ name: i18n-complements
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: sqlite3
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ description: Generates action methods to provide clean tables.
96
+ email: burisu@oneiros.fr
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files:
100
+ - LICENSE
101
+ - README.rdoc
102
+ files:
103
+ - LICENSE
104
+ - README.rdoc
105
+ - VERSION
106
+ - lib/active-list.rb
107
+ - lib/active-list/action_pack.rb
108
+ - lib/active-list/columns/action_column.rb
109
+ - lib/active-list/columns/data_column.rb
110
+ - lib/active-list/columns/field_column.rb
111
+ - lib/active-list/compass/stylesheets/_active-list.scss
112
+ - lib/active-list/compass/stylesheets/active-list/_background.scss
113
+ - lib/active-list/compass/stylesheets/active-list/_minimal.scss
114
+ - lib/active-list/compass/stylesheets/active-list/_theme.scss
115
+ - lib/active-list/definition.rb
116
+ - lib/active-list/exporters.rb
117
+ - lib/active-list/exporters/csv_exporter.rb
118
+ - lib/active-list/exporters/excel_csv_exporter.rb
119
+ - lib/active-list/exporters/open_document_spreadsheet_exporter.rb
120
+ - lib/active-list/finder.rb
121
+ - lib/active-list/generator.rb
122
+ - lib/active-list/rails/engine.rb
123
+ - lib/active-list/renderers.rb
124
+ - lib/active-list/renderers/simple_renderer.rb
125
+ - lib/assets/images/active-list.png
126
+ - lib/assets/javascripts/active-list.jquery.js
127
+ - lib/assets/stylesheets/active-list.css.scss
128
+ homepage: http://github.com/burisu/active-list
129
+ licenses:
130
+ - MIT
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ segments:
142
+ - 0
143
+ hash: -1481556699660811266
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 1.8.24
153
+ signing_key:
154
+ specification_version: 3
155
+ summary: Easy tables in Rails app
156
+ test_files: []