radiant-fabulator_exhibit-extension 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.markdown +10 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/fabulator_exhibit_extension.rb +1 -1
- data/lib/tasks/fabulator_exhibit_extension.rb +30 -0
- data/public/javascripts/fabulator/exhibit/data.js +38 -10
- data/public/javascripts/fabulator/exhibit/facets.js +12 -5
- data/public/javascripts/fabulator/exhibit/views.js +22 -1
- data/public/stylesheets/fabulator/exhibit/exhibit.css +2 -1
- metadata +8 -7
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 0.0.3 2010-10-28
|
2
|
+
* 2 major enhancement
|
3
|
+
* Supports conditional parts in lenses (if-exists)
|
4
|
+
* Shows options in list facet that have no current matches (configurable)
|
5
|
+
|
1
6
|
=== 0.0.2 2010-10-26
|
2
7
|
* 1 major enhancement:
|
3
8
|
* Provides javascript/css for implementing Exhibit views in HTML
|
data/README.markdown
CHANGED
@@ -14,6 +14,16 @@ libraries:
|
|
14
14
|
|
15
15
|
* ruby-fabulator-exhibit gem
|
16
16
|
|
17
|
+
After installation, you will need to add the following to your site's
|
18
|
+
environment.rb:
|
19
|
+
|
20
|
+
config.gem 'radiant-fabulator_exhibit-extension'
|
21
|
+
|
22
|
+
and the following to your site's Rakefile:
|
23
|
+
|
24
|
+
require 'tasks/fabulator_exhibit_extension'
|
25
|
+
|
26
|
+
|
17
27
|
== LICENSE:
|
18
28
|
|
19
29
|
N.B.: The JavaScript libraries in this distribution are under a separate
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ begin
|
|
7
7
|
gem.email = "jgsmith@tamu.edu"
|
8
8
|
gem.homepage = "http://github.com/jgsmith/radiant-fabulator-exhibit"
|
9
9
|
gem.authors = ["James Smith"]
|
10
|
-
gem.add_dependency('radiant-fabulator-extension', '>= 0.0.
|
10
|
+
gem.add_dependency('radiant-fabulator-extension', '>= 0.0.7')
|
11
11
|
gem.add_dependency('fabulator-exhibit', '>= 0.0.4')
|
12
12
|
gem.add_dependency('json', '>= 1.4.3')
|
13
13
|
gem.add_dependency('uuid', '>= 2.3.1')
|
@@ -122,7 +122,7 @@ end
|
|
122
122
|
desc 'Generate documentation for the fabulator_rdf extension.'
|
123
123
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
124
124
|
rdoc.rdoc_dir = 'rdoc'
|
125
|
-
rdoc.title = '
|
125
|
+
rdoc.title = 'FabulatorExhibitExtension'
|
126
126
|
rdoc.options << '--line-numbers' << '--inline-source'
|
127
127
|
rdoc.rdoc_files.include('README')
|
128
128
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -0,0 +1,30 @@
|
|
1
|
+
namespace :radiant do
|
2
|
+
namespace :extensions do
|
3
|
+
namespace :fabulator_exhibit do
|
4
|
+
|
5
|
+
desc "Runs the migration for the Fabulator Exhibit extension"
|
6
|
+
task :migrate => :environment do
|
7
|
+
require 'radiant/extension_migrator'
|
8
|
+
if ENV["VERSION"]
|
9
|
+
FabulatorExhibitExtension.migrator.migrate(ENV["VERSION"].to_i)
|
10
|
+
Rake::Task['db:schema:dump'].invoke
|
11
|
+
else
|
12
|
+
FabulatorExhibitExtension.migrator.migrate
|
13
|
+
Rake::Task['db:schema:dump'].invoke
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Copies public assets of the Fabulator Exhibit extenion to the instance public/ directory."
|
18
|
+
task :update => :environment do
|
19
|
+
is_svn_or_dir = proc { |path| path =~ /\.svn/ || File.directory?(path) }
|
20
|
+
Dir[FabulatorExhibitExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
|
21
|
+
path = file.sub(FabulatorExhibitExtension.root, '')
|
22
|
+
directory = File.dirname(path)
|
23
|
+
puts "Copying #{path}..."
|
24
|
+
mkdir_p RAILS_ROOT + directory, :verbose => false
|
25
|
+
cp file, RAILS_ROOT + path, :verbose => false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -119,6 +119,20 @@ Fabulator.namespace('Exhibit');
|
|
119
119
|
}
|
120
120
|
else {
|
121
121
|
elmt = null;
|
122
|
+
|
123
|
+
if( templateNode.condition != null ) {
|
124
|
+
if( templateNode.condition.test == "if-exists" ) {
|
125
|
+
if( !templateNode.condition.expression.testExists(
|
126
|
+
{ "value": rootID },
|
127
|
+
{ "value": "item" },
|
128
|
+
"value",
|
129
|
+
that.dataSource
|
130
|
+
)) {
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
122
136
|
if( "tag" in templateNode ) {
|
123
137
|
tag = templateNode.tag;
|
124
138
|
if( parentElmt != null ) {
|
@@ -151,8 +165,10 @@ Fabulator.namespace('Exhibit');
|
|
151
165
|
if( attribute == "field" ) {
|
152
166
|
result[value] = elmt;
|
153
167
|
}
|
154
|
-
else if( attribute == "
|
155
|
-
|
168
|
+
else if( attribute == "class" ) {
|
169
|
+
$(value.split(/\s+/)).each(function(idx, n) {
|
170
|
+
$(elmt).addClass(n);
|
171
|
+
});
|
156
172
|
}
|
157
173
|
else if( attribute == "id" ) {
|
158
174
|
elmt.id = id;
|
@@ -163,12 +179,24 @@ Fabulator.namespace('Exhibit');
|
|
163
179
|
else if( attribute == "type" && elm.tagName == "input") {
|
164
180
|
// do nothing
|
165
181
|
}
|
166
|
-
else if( attribute == "
|
182
|
+
else if( attribute == "styles" ) {
|
167
183
|
for( n in value ) {
|
168
184
|
v = value[n];
|
169
185
|
elmt.style[n] = v;
|
170
186
|
}
|
171
187
|
}
|
188
|
+
else if( attribute == "attributes" ) {
|
189
|
+
$(value).each(function(idx, a) {
|
190
|
+
if( a.name == "class" ) {
|
191
|
+
$(a.value.split(/\s+/)).each(function(idx, v) {
|
192
|
+
$(elmt).addClass(v);
|
193
|
+
});
|
194
|
+
}
|
195
|
+
else {
|
196
|
+
$(elmt).attr(a.name, a.value);
|
197
|
+
}
|
198
|
+
});
|
199
|
+
}
|
172
200
|
else if( attribute == "content" ) {
|
173
201
|
if( value != null ) {
|
174
202
|
items = value.evaluateOneItem(rootID, that.dataSource);
|
@@ -206,8 +234,8 @@ Fabulator.namespace('Exhibit');
|
|
206
234
|
}
|
207
235
|
}
|
208
236
|
}
|
209
|
-
else if( attribute != "tag" && attribute != "elmt" ) {
|
210
|
-
elmt.
|
237
|
+
else if( attribute != "tag" && attribute != "elmt" && attribute != "condition" && typeof(value) == "string" ) {
|
238
|
+
$(elmt).attr(attribute, value);
|
211
239
|
}
|
212
240
|
}
|
213
241
|
return elmt;
|
@@ -462,7 +490,7 @@ Fabulator.namespace('Exhibit');
|
|
462
490
|
that.events.onAfterLoadingTypes.fire(that);
|
463
491
|
}
|
464
492
|
catch(e) {
|
465
|
-
|
493
|
+
Exhibit.debug("loadTypes failed:", e);
|
466
494
|
}
|
467
495
|
};
|
468
496
|
|
@@ -504,7 +532,7 @@ Fabulator.namespace('Exhibit');
|
|
504
532
|
that.events.onAfterLoadingProperties.fire(that);
|
505
533
|
}
|
506
534
|
catch(e) {
|
507
|
-
|
535
|
+
Exhibit.debug("loadProperties failed: ", e);
|
508
536
|
}
|
509
537
|
};
|
510
538
|
|
@@ -553,7 +581,7 @@ Fabulator.namespace('Exhibit');
|
|
553
581
|
that.events.onAfterLoadingItems.fire(that);
|
554
582
|
}
|
555
583
|
catch(e) {
|
556
|
-
|
584
|
+
Exhibit.debug("loadItems failed: ", e);
|
557
585
|
}
|
558
586
|
};
|
559
587
|
|
@@ -561,14 +589,14 @@ Fabulator.namespace('Exhibit');
|
|
561
589
|
var id, label, uri, type, isArray, p, i, n;
|
562
590
|
|
563
591
|
if(!("label" in item) && !("id" in item)) {
|
564
|
-
|
592
|
+
Exhibit.debug("Item entry has no label and no id: ", item);
|
565
593
|
return;
|
566
594
|
}
|
567
595
|
|
568
596
|
if(!("label" in item)) {
|
569
597
|
id = item.id;
|
570
598
|
if( !that.items.contains(id) ) {
|
571
|
-
|
599
|
+
Exhibit.debug("Cannot add new item containing no label: ", item);
|
572
600
|
}
|
573
601
|
}
|
574
602
|
else {
|
@@ -302,7 +302,7 @@ Fabulator.namespace('Exhibit');
|
|
302
302
|
}
|
303
303
|
}
|
304
304
|
catch(e) {
|
305
|
-
|
305
|
+
Exhibit.debug(e);
|
306
306
|
}
|
307
307
|
}
|
308
308
|
|
@@ -402,7 +402,7 @@ Fabulator.namespace('Exhibit');
|
|
402
402
|
facetValueResult = path.walkForward(items, "item", dataView.dataSource);
|
403
403
|
valueType = facetValueResult.valueType;
|
404
404
|
|
405
|
-
if( facetValueResult.size > 0 ) {
|
405
|
+
if( facetValueResult.size() > 0 ) {
|
406
406
|
facetValueResult.forEachValue(function(facetValue) {
|
407
407
|
var itemSubcollection;
|
408
408
|
if( filter.contains(facetValue) ) {
|
@@ -424,13 +424,20 @@ Fabulator.namespace('Exhibit');
|
|
424
424
|
entries = [ ];
|
425
425
|
|
426
426
|
path = options.facet.expression;
|
427
|
-
facetValueResult = path.walkForward(items, "item", dataView.dataSource);
|
427
|
+
facetValueResult = path.walkForward(dataView.dataSource.items(), "item", dataView.dataSource);
|
428
428
|
valueType = facetValueResult.valueType || "text";
|
429
429
|
|
430
|
+
|
430
431
|
if( facetValueResult.size() > 0 ) {
|
431
432
|
facetValueResult.forEachValue(function(facetValue) {
|
432
|
-
var itemSubcollection = path.evaluateBackward(facetValue, valueType, items, dataView.dataSource)
|
433
|
-
|
433
|
+
var itemSubcollection = path.evaluateBackward(facetValue, valueType, items, dataView.dataSource),
|
434
|
+
count = 0;
|
435
|
+
|
436
|
+
$(items).each(function(idx, id) {
|
437
|
+
count += (itemSubcollection.contains(id) ? 1 : 0);
|
438
|
+
});
|
439
|
+
|
440
|
+
entries.push({ value: facetValue, count: count, selectionLabel: facetValue, selected: valueSet.contains(facetValue) });
|
434
441
|
});
|
435
442
|
}
|
436
443
|
|
@@ -250,6 +250,9 @@
|
|
250
250
|
return fragments;
|
251
251
|
};
|
252
252
|
|
253
|
+
var processStyle = function(that, value) {
|
254
|
+
};
|
255
|
+
|
253
256
|
var processors = { };
|
254
257
|
|
255
258
|
processors.TemplateNode = function(node) {
|
@@ -352,7 +355,25 @@
|
|
352
355
|
else {
|
353
356
|
}
|
354
357
|
}
|
355
|
-
else
|
358
|
+
else {
|
359
|
+
if( name == "style") {
|
360
|
+
processStyle(that, value);
|
361
|
+
} else if( name != "id" ) {
|
362
|
+
if( name == "cellspacing" ) {
|
363
|
+
name = "cellSpacing";
|
364
|
+
}
|
365
|
+
else if( name == "cellpadding" ) {
|
366
|
+
name = "cellPadding";
|
367
|
+
}
|
368
|
+
else if( name == "bgcolor" ) {
|
369
|
+
name = "bgColor";
|
370
|
+
}
|
371
|
+
|
372
|
+
that.attributes.push({
|
373
|
+
name: name,
|
374
|
+
value: value
|
375
|
+
});
|
376
|
+
}
|
356
377
|
}
|
357
378
|
}
|
358
379
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-fabulator_exhibit-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Smith
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-29 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 17
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 0
|
33
|
-
-
|
34
|
-
version: 0.0.
|
33
|
+
- 7
|
34
|
+
version: 0.0.7
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- db/migrate/001_create_fabulator_exhibit_tables.rb
|
108
108
|
- fabulator_exhibit_extension.rb
|
109
109
|
- lib/radiant-fabulator_exhibit-extension.rb
|
110
|
+
- lib/tasks/fabulator_exhibit_extension.rb
|
110
111
|
- lib/tasks/fabulator_exhibit_extension_tasks.rake
|
111
112
|
- public/javascripts/fabulator/exhibit/data.js
|
112
113
|
- public/javascripts/fabulator/exhibit/exhibit.js
|