polygallery 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/polygallery/capybara_helpers.rb +25 -16
- data/lib/polygallery/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74d1166bebf3c13f615c587b375d373d4cafde1c
|
4
|
+
data.tar.gz: de5dc955a7c4adcc1a21adc0a22ae5b0acfd964f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a99f2e27857b890a161b0eb7184e2519a37573826691e54658507f7aa0aebbd3e138acb351b071c770f1072cc90ae683b9414315a7fec1764bf0e9e6e1b13808
|
7
|
+
data.tar.gz: ce8354f4fdc4cf7e4825c4fd158542f0f55e6f04cf231382f5429c45821092f7445918201f4f0083eeb9095ff10145f2f900a6dd972e5b235fd99762e098961f
|
@@ -1,20 +1,27 @@
|
|
1
1
|
require 'polygallery/factories'
|
2
2
|
module Polygallery
|
3
3
|
module CapybaraHelpers
|
4
|
+
def polyphoto_tr_selector(table_id='photos')
|
5
|
+
".polygallery-cocoon-table##{table_id} tbody tr" end
|
6
|
+
def polyphoto_trs(table_id='photos')
|
7
|
+
all polyphoto_tr_selector(table_id) end
|
4
8
|
def select_polyphoto_tr(i=0, table_id='photos')
|
5
|
-
|
9
|
+
if i.is_a? String
|
10
|
+
table_id = i; i = 0 end
|
11
|
+
polyphoto_trs(table_id).to_a[i]
|
12
|
+
end
|
13
|
+
def add_polyphoto_btn_selector(table_id='photos')
|
14
|
+
'.add_fields[data-association-insertion-node="#' << table_id <<
|
15
|
+
' .photo-receptacle"]' end
|
6
16
|
|
7
|
-
def
|
17
|
+
def add_polyphoto_to_form(table_id='photos', attrs=nil)
|
8
18
|
unless table_id.is_a? String
|
9
19
|
attrs = table_id; table_id = 'photos' end
|
10
20
|
attrs ||= build :polygallery_photo
|
11
|
-
|
12
|
-
trs = all(tr_selector); last_tr = trs.last
|
21
|
+
trs = polyphoto_trs(table_id); last_tr = trs.last
|
13
22
|
unless trs.length == 1 && last_tr.find('input[id$="_photo"]').value.blank?
|
14
|
-
page.execute_script
|
15
|
-
|
16
|
-
SCRIPT
|
17
|
-
last_tr = all(tr_selector).last
|
23
|
+
page.execute_script "$('#{add_polyphoto_btn_selector table_id}').click();"
|
24
|
+
last_tr = polyphoto_trs(table_id).last
|
18
25
|
end
|
19
26
|
within last_tr do
|
20
27
|
find('input[id$="_photo"]').set get_random_photo
|
@@ -23,7 +30,7 @@ module Polygallery
|
|
23
30
|
end
|
24
31
|
end
|
25
32
|
|
26
|
-
def
|
33
|
+
def change_polyphoto_in_form(photo_index=0, table_id='photos', file_to_use=nil)
|
27
34
|
if photo_index.is_a? File
|
28
35
|
file_to_use = photo_index; photo_index = 0 end
|
29
36
|
if table_id.is_a? File
|
@@ -31,20 +38,22 @@ module Polygallery
|
|
31
38
|
if photo_index.is_a? String
|
32
39
|
table_id = photo_index; photo_index = 0 end
|
33
40
|
file_to_use ||= get_random_photo
|
34
|
-
within select_polyphoto_tr(photo_index, table_id) do
|
35
|
-
|
36
|
-
|
37
|
-
yield(tr) if block_given?
|
41
|
+
within select_polyphoto_tr(photo_index, table_id) do
|
42
|
+
find('input[id$="_photo"]').set file_to_use
|
43
|
+
yield if block_given?
|
38
44
|
end
|
39
45
|
end
|
40
46
|
|
41
|
-
def
|
47
|
+
def remove_polyphoto_from_form(photo_index=0, table_id='photos')
|
42
48
|
if photo_index.is_a? String
|
43
49
|
table_id = photo_index; photo_index = 0 end
|
44
|
-
tr_selector =
|
50
|
+
tr_selector = polyphoto_tr_selector(table_id) + ':visible'
|
45
51
|
page.execute_script <<-SCRIPT
|
46
|
-
|
52
|
+
setTimeout(function(){
|
53
|
+
$($('#{tr_selector}')[#{photo_index}]).find('.remove_fields').click();
|
54
|
+
}, 1);
|
47
55
|
SCRIPT
|
56
|
+
sleep 0.005
|
48
57
|
end
|
49
58
|
|
50
59
|
end
|
data/lib/polygallery/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polygallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MacKinley Smith
|
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
342
|
version: '0'
|
343
343
|
requirements: []
|
344
344
|
rubyforge_project:
|
345
|
-
rubygems_version: 2.
|
345
|
+
rubygems_version: 2.4.8
|
346
346
|
signing_key:
|
347
347
|
specification_version: 4
|
348
348
|
summary: Polymorphic galleries made simple.
|