polygallery 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/polygallery/galleries/_fields_for.html.haml +2 -2
- data/app/views/polygallery/galleries/_simple_fields_for.html.haml +9 -7
- data/app/views/polygallery/photos/_simple_fields_for.html.haml +7 -7
- data/lib/polygallery.rb +1 -1
- data/lib/polygallery/simple_form_helper.rb +10 -2
- data/lib/polygallery/version.rb +1 -1
- data/lib/polygallery/view_helpers.rb +3 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dee9c9d0bf44f68e1cc707295d0638826ee6884
|
4
|
+
data.tar.gz: ee7a7264e8d8bb90a9183ead4f8a21ae365c7fd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 174326ff6c8045018740f033347dcf20671cb9425ed6acfe6692971ba66f8bbc7dc8707abe861b803bf8610dbf91f352d02e726c370c802cdd9f1d3cc023c977
|
7
|
+
data.tar.gz: a2c34fccea0d228992037ef4b65895c6875a735876b21b1b1fa3d645425407b09b9c59d7eb8e4abd4ab44dc8581ead8751d0016d60730f35a48d28e5ff816fa6
|
@@ -1,5 +1,5 @@
|
|
1
1
|
= fields_for gallery.title.to_sym do |ff|
|
2
|
-
= ff.hidden_field :title, :
|
2
|
+
= ff.hidden_field :title, value: gallery.title.to_s
|
3
3
|
|
4
4
|
-#= fields_for_polygallery_photo
|
5
|
-
-#= ff.cktext_area :content, options.merge(name.is_a?(String) ? {:
|
5
|
+
-#= ff.cktext_area :content, options.merge(name.is_a?(String) ? {value: pb.content} : {})
|
@@ -1,18 +1,20 @@
|
|
1
1
|
- photo_association_name = f.object.polygallery_settings[:association_names][:photos]
|
2
|
-
= f.input_field :title, :
|
3
|
-
= f.input_field :galleryable_id, :
|
4
|
-
= f.input_field :galleryable_type, :
|
2
|
+
= f.input_field :title, as: :hidden, value: f.object.title
|
3
|
+
= f.input_field :galleryable_id, as: :hidden
|
4
|
+
= f.input_field :galleryable_type, as: :hidden
|
5
|
+
- add_settings = settings[:add_btn].except(:text)
|
6
|
+
- add_settings[:render_options] = { locals: { settings: settings } }
|
5
7
|
|
6
8
|
%h3.lead
|
7
|
-
= link_to_add_association
|
9
|
+
= link_to_add_association settings[:add_btn][:text], f, :photos, add_settings
|
8
10
|
= settings[:label] || f.object.title.titleize
|
9
|
-
.polygallery-cocoon-table{:
|
11
|
+
.polygallery-cocoon-table{id: photo_association_name.to_s}
|
10
12
|
%table.table.table-bordered.table-striped.table-condensed.polygallery-photos-table
|
11
13
|
%thead
|
12
14
|
%tr
|
13
|
-
%th.text-center{:
|
15
|
+
%th.text-center{style: 'width:85px;'} Photo
|
14
16
|
%th File
|
15
17
|
%th.text-center Actions
|
16
18
|
%tbody.photo-receptacle
|
17
19
|
= f.simple_fields_for :photos do |pf| # photo_association_name do |pf|
|
18
|
-
= render 'polygallery/photos/simple_fields_for', f: pf
|
20
|
+
= render 'polygallery/photos/simple_fields_for', f: pf, settings: settings
|
@@ -1,14 +1,14 @@
|
|
1
1
|
%tr{class: "nested-fields #{f.object.new_record? ? 'new-polyphoto' : ''}",
|
2
2
|
data: { new: f.object.new_record? }}
|
3
3
|
%td.text-center
|
4
|
-
= f.input_field :gallery_title, :
|
5
|
-
= f.input_field :gallery_id, :
|
6
|
-
= f.input_field :galleryable_id, :
|
7
|
-
= f.input_field :galleryable_type, :
|
4
|
+
= f.input_field :gallery_title, as: :hidden
|
5
|
+
= f.input_field :gallery_id, as: :hidden
|
6
|
+
= f.input_field :galleryable_id, as: :hidden
|
7
|
+
= f.input_field :galleryable_type, as: :hidden
|
8
8
|
= image_tag f.object.photo.file? ? f.object.photo.url(:thumb) : 'polygallery/thumbnail-missing.jpg', class: 'img-responsive'
|
9
9
|
%td
|
10
10
|
= f.input_field :photo
|
11
|
-
= f.input_field :caption, :
|
12
|
-
%td.text-center{:
|
13
|
-
= link_to_remove_association f, :
|
11
|
+
= f.input_field :caption, placeholder: 'Caption... (optional)', style: 'margin-top:5px;', as: :string
|
12
|
+
%td.text-center{style: 'width:51px;'}
|
13
|
+
= link_to_remove_association f, settings[:remove_btn] do
|
14
14
|
%span.glyphicon.glyphicon-trash
|
data/lib/polygallery.rb
CHANGED
@@ -8,9 +8,17 @@ module Polygallery
|
|
8
8
|
fb.simple_fields_for(title, *args, &block) << '</div>' ).html_safe
|
9
9
|
end
|
10
10
|
def simple_fields_for_polygallery(fb, title=:gallery, *args, &block)
|
11
|
-
defaults = {
|
11
|
+
defaults = {
|
12
|
+
label: nil,
|
13
|
+
add_btn: {
|
14
|
+
text: 'Add Photo',
|
15
|
+
partial: 'polygallery/photos/simple_fields_for',
|
16
|
+
class: 'btn btn-default btn-sm pull-right',
|
17
|
+
data: { association_insertion_method: 'append',
|
18
|
+
association_insertion_node: "##{fb.object.send(title).polygallery_settings[:association_names][:photos]} .photo-receptacle" }},
|
19
|
+
remove_btn: { class: 'btn btn-default btn-sm' }}
|
12
20
|
settings = if (options = args.find{|a| a.is_a? Hash }).nil? then defaults
|
13
|
-
else defaults.
|
21
|
+
else defaults.deep_merge options end
|
14
22
|
new_block = block_given? ? block : ->(fb2) {
|
15
23
|
render partial: 'polygallery/galleries/simple_fields_for',
|
16
24
|
locals: { f: fb2, settings: settings } }
|
data/lib/polygallery/version.rb
CHANGED
@@ -2,10 +2,11 @@ module Polygallery
|
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
4
|
def fields_for_polygallery(title, f, options={})
|
5
|
-
settings = { label: nil }.merge(options)
|
5
|
+
settings = { label: nil, button: nil }.merge(options)
|
6
6
|
raise "Polygallery #{title} not found for #{f.object.class.name}" unless f.object.class.has_polygallery?(title)
|
7
7
|
gallery = f.object.send(title)
|
8
|
-
render partial: 'polygallery/galleries/fields_for',
|
8
|
+
render partial: 'polygallery/galleries/fields_for',
|
9
|
+
locals: { f: f, gallery: gallery, settings: settings }
|
9
10
|
end
|
10
11
|
|
11
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polygallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MacKinley Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -290,6 +290,20 @@ dependencies:
|
|
290
290
|
- - ">="
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '0'
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: deep_merge
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - ">="
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: '0'
|
300
|
+
type: :runtime
|
301
|
+
prerelease: false
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - ">="
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: '0'
|
293
307
|
description: Polymorphic galleries made simple.
|
294
308
|
email:
|
295
309
|
- smit1625@msu.edu
|