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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e53abf70dea958b1911dffc06743aae8a92948b
4
- data.tar.gz: 0fa8fa8287038e637bd081ef22f1f8d59c2d0c00
3
+ metadata.gz: 5dee9c9d0bf44f68e1cc707295d0638826ee6884
4
+ data.tar.gz: ee7a7264e8d8bb90a9183ead4f8a21ae365c7fd0
5
5
  SHA512:
6
- metadata.gz: 99f20772f457715d3fb8bebf7c59a9e771efc7c1e14d905abd2bb7f19df390d4f6f123066bfe993b293d4f128c49f2b42a462df218ba781ef5b8dea3e7f666f1
7
- data.tar.gz: a313adf8bda7f3cc1087e2bb2da79f1c89aa83544eca49ae83f8e075608f6adaded514dc1c1ff4ce26b81cdbdb404572b74ba2c79b2fe47609a99f49da5f10ce
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, :value => gallery.title.to_s
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) ? {:value => pb.content} : {})
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, :as => :hidden, :value => f.object.title
3
- = f.input_field :galleryable_id, :as => :hidden
4
- = f.input_field :galleryable_type, :as => :hidden
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 'Add Photo', f, :photos, partial: 'polygallery/photos/simple_fields_for', class: 'btn btn-default btn-sm pull-right', data: {association_insertion_node: "##{photo_association_name} .photo-receptacle", association_insertion_method: 'append'}
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{:id => photo_association_name.to_s}
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{:style => 'width:85px;'} Photo
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, :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
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, :placeholder => "Caption... (optional)", :style => "margin-top:5px;", :as => :string
12
- %td.text-center{:style => "width:51px;"}
13
- = link_to_remove_association f, :class => 'btn btn-default btn-sm' do
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
@@ -1,5 +1,5 @@
1
1
  require 'polygallery/engine'
2
- require 'polygallery/paperclip_integration' # <-- Try removing this monstrosity
2
+ require 'polygallery/paperclip_integration'
3
3
  # require 'polygallery/railtie' if defined? Rails
4
4
 
5
5
  module Polygallery
@@ -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 = { label: nil }
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.merge options end
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 } }
@@ -1,3 +1,3 @@
1
1
  module Polygallery
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  end
@@ -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', locals: {f: f, gallery: gallery, settings: settings}
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.5
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-09-30 00:00:00.000000000 Z
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