spina 0.7.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of spina might be problematic. Click here for more details.

Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spina/admin/application.js +3 -1
  3. data/app/assets/javascripts/spina/admin/spina.infinite_scroll.coffee +20 -0
  4. data/app/assets/javascripts/spina/admin/spina.scaffold.coffee +15 -0
  5. data/app/assets/javascripts/spina/admin/spina.trix.js.coffee +2 -0
  6. data/app/controllers/spina/admin/photos_controller.rb +26 -6
  7. data/app/controllers/spina/application_controller.rb +2 -4
  8. data/app/controllers/spina/inquiries_controller.rb +2 -2
  9. data/app/controllers/spina/pages_controller.rb +2 -2
  10. data/app/controllers/spina/sitemaps_controller.rb +1 -1
  11. data/app/models/spina/account.rb +4 -4
  12. data/app/models/spina/page.rb +0 -10
  13. data/app/models/spina/photo.rb +5 -0
  14. data/app/presenters/spina/pages/menu_presenter.rb +7 -6
  15. data/app/uploaders/spina/photo_uploader.rb +1 -1
  16. data/app/views/spina/admin/inquiries/inbox.html.haml +1 -1
  17. data/app/views/spina/admin/inquiries/show.html.haml +1 -1
  18. data/app/views/spina/admin/photos/_photo.html.haml +4 -6
  19. data/app/views/spina/admin/photos/_photo_collection_select.html.haml +16 -15
  20. data/app/views/spina/admin/photos/_photo_multi_picker.html.haml +3 -0
  21. data/app/views/spina/admin/photos/_photo_select.html.haml +5 -14
  22. data/app/views/spina/admin/photos/_photo_single_picker.html.haml +3 -0
  23. data/app/views/spina/admin/photos/_photo_uploaded.html.haml +4 -0
  24. data/app/views/spina/admin/photos/_wysihtml5_select.html.haml +5 -12
  25. data/app/views/spina/admin/photos/create.js.erb +3 -1
  26. data/app/views/spina/admin/photos/index.html.haml +10 -6
  27. data/app/views/spina/admin/photos/index.js.erb +5 -0
  28. data/app/views/spina/admin/photos/multi_picker_infinite_scroll.js.erb +6 -0
  29. data/app/views/spina/admin/photos/photo_collection_select.js.erb +1 -0
  30. data/app/views/spina/admin/photos/photo_select.js.erb +1 -0
  31. data/app/views/spina/admin/photos/single_picker_infinite_scroll.js.erb +6 -0
  32. data/app/views/spina/admin/photos/wysihtml5_infinite_scroll.js.erb +6 -0
  33. data/app/views/spina/admin/photos/wysihtml5_select.js.erb +1 -0
  34. data/app/views/spina/admin/shared/_rich_text_field.html.haml +24 -23
  35. data/config/locales/en.yml +2 -1
  36. data/db/seeds.rb +19 -9
  37. data/lib/generators/spina/install_generator.rb +14 -12
  38. data/lib/generators/spina/templates/app/assets/stylesheets/default/application.css.sass +66 -0
  39. data/lib/generators/spina/templates/app/views/default/pages/demo.html.haml +30 -0
  40. data/lib/generators/spina/templates/app/views/default/pages/homepage.html.haml +2 -0
  41. data/lib/generators/spina/templates/app/views/default/pages/show.html.haml +3 -0
  42. data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +5 -0
  43. data/lib/generators/spina/templates/app/views/layouts/default/application.html.haml +11 -0
  44. data/lib/generators/spina/templates/{spina.rb → config/initializers/spina.rb} +3 -2
  45. data/lib/generators/spina/templates/config/initializers/themes/default.rb +96 -0
  46. data/lib/spina/engine.rb +1 -0
  47. data/lib/spina/version.rb +1 -1
  48. data/test/dummy/app/assets/stylesheets/default/application.css.sass +66 -0
  49. data/test/dummy/app/views/default/pages/demo.html.haml +41 -0
  50. data/test/dummy/app/views/default/pages/homepage.html.haml +2 -0
  51. data/test/dummy/app/views/default/pages/show.html.haml +3 -0
  52. data/test/dummy/app/views/default/shared/_navigation.html.haml +5 -0
  53. data/test/dummy/app/views/layouts/default/application.html.haml +11 -0
  54. data/test/dummy/config/application.rb +1 -1
  55. data/test/dummy/config/initializers/spina.rb +26 -0
  56. data/test/dummy/config/initializers/themes/default.rb +65 -33
  57. data/test/dummy/db/migrate/20160114085213_create_spina_tables.spina.rb +167 -0
  58. metadata +40 -13
  59. data/app/views/spina/admin/photos/enhance.js +0 -0
  60. data/lib/generators/spina/templates/application.html.erb +0 -16
  61. data/lib/generators/spina/templates/homepage.html.erb +0 -3
  62. data/lib/generators/spina/templates/show.html.erb +0 -3
  63. data/lib/generators/spina/templates/theme.rb +0 -42
  64. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  65. data/test/dummy/app/views/default/pages/homepage.html.erb +0 -3
  66. data/test/dummy/app/views/default/pages/show.html.erb +0 -3
  67. data/test/dummy/app/views/layouts/default/application.html.erb +0 -16
  68. data/test/dummy/tmp/restart.txt +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18550031d6f530e50c842bd6d5b6f892040439d4
4
- data.tar.gz: 4eb48f489fcbc4b805629953e09903107f12d459
3
+ metadata.gz: 7f6490ad94233191e21aa0c5b2046015e13506e2
4
+ data.tar.gz: 476f5f09ef0b432217f44f8dc962496fde5f1850
5
5
  SHA512:
6
- metadata.gz: 488a30be0435ac0fb60a84a70669f725f892ea9c0d16d3fe04d185c70f414c79229e92a217d998a4f0c9aae43b259a04ca0b156027ac09d85b652b4ec541f0cc
7
- data.tar.gz: 330492cb94e6fbe7cef0be0529bb42856e04afe4b55968560cec153eee3de99efa9a74ffecf7acc73110fff5743ae29a0fddc83e22e45389a8ce46fda0a45e80
6
+ metadata.gz: 550674f6bb65a39444201cc739c82f6623e00f0d1582420347e249aaff95e00e76681f49afa07ada5e93eae90f209305343ecbbdc2afb79f5774408c4141e4fe
7
+ data.tar.gz: e55c2700c2e32a2521d383eddc2857770204f9bfdbc90d673c1960bb325c96a4e787c9ea7f5f9ad9aa83a785250c96759c04c8336b4093852e60172a000effe0
@@ -3,7 +3,9 @@
3
3
  //= require turbolinks
4
4
  //= require spina
5
5
  //= require ./aviary
6
- //= require ./pages
7
6
  //= require ./account
8
7
  //= require ./confirm_delete
8
+ //= require ./pages
9
9
  //= require ./spina.trix
10
+ //= require ./spina.infinite_scroll
11
+ //= require ./spina.scaffold
@@ -0,0 +1,20 @@
1
+ class Spina.InfiniteScroll
2
+ @init: (link) ->
3
+ $(window).off('scroll.infiniteScroll')
4
+
5
+ $link = $(link)
6
+ if (url = $link.find('a').attr('href'))
7
+ $(window).on 'scroll.infiniteScroll', => @loadNextPage($link)
8
+ $(window).scroll()
9
+
10
+ @loadNextPage: ($link) ->
11
+ if ($(window).scrollTop() > $link.offset().top - $(window).height() - 500)
12
+ $(window).off('scroll.infiniteScroll')
13
+ $.rails.disableElement($link.find('a'))
14
+ $.getScript($link.find('a').attr('href'))
15
+
16
+ $.fn.infiniteScroll = () ->
17
+ Spina.InfiniteScroll.init(this)
18
+
19
+ $(document).on 'page:change', ->
20
+ $(window).off('scroll.infiniteScroll')
@@ -0,0 +1,15 @@
1
+ class Spina.Scaffold
2
+
3
+ @init = ->
4
+ $(document).enhance()
5
+
6
+ @enhance = (el) ->
7
+ $el = $(el)
8
+
9
+ $el.find('.infinite-pagination').infiniteScroll()
10
+
11
+ $.fn.enhance = () ->
12
+ Spina.Scaffold.enhance(this)
13
+
14
+ $(document).on 'page:change', ->
15
+ Spina.Scaffold.init()
@@ -1,6 +1,8 @@
1
1
  window.Spina = {}
2
2
 
3
3
  Trix.config.blockAttributes = $.extend Trix.config.blockAttributes, {
4
+ default:
5
+ tagName: 'p'
4
6
  h1:
5
7
  tagName: 'h1'
6
8
  singleLine: true
@@ -9,7 +9,7 @@ module Spina
9
9
 
10
10
  def index
11
11
  add_breadcrumb I18n.t('spina.website.photos'), spina.admin_photos_path
12
- @photos = Photo.sorted
12
+ @photos = Photo.sorted.page(params[:page])
13
13
  @photo = Photo.new
14
14
  end
15
15
 
@@ -40,15 +40,29 @@ module Spina
40
40
  end
41
41
 
42
42
  def photo_select
43
- @photos = Photo.sorted
43
+ selected = params[:selected_photo_id] || Array.new
44
+ @photos = Photo.order_by_ids(selected).sorted.page(params[:page])
45
+ @selected_photo = Photo.find(selected)
44
46
  @photo = Photo.new
45
- @selected_photo = Photo.find(params[:selected_photo_id]) if params[:selected_photo_id]
47
+
48
+ if params[:page].present?
49
+ render :single_picker_infinite_scroll
50
+ else
51
+ render :photo_select
52
+ end
46
53
  end
47
54
 
48
55
  def photo_collection_select
49
- @photos = Photo.sorted
56
+ selected = params[:selected_photo_ids] || Array.new
57
+ @photos = Photo.order_by_ids(selected).sorted.page(params[:page])
58
+ @selected_photos = Photo.where(id: selected)
50
59
  @photo = Photo.new
51
- @selected_photos = params[:selected_photo_ids] ? Photo.where(id: params[:selected_photo_ids]) : Photo.none
60
+
61
+ if params[:page].present?
62
+ render :multi_picker_infinite_scroll
63
+ else
64
+ render :photo_collection_select
65
+ end
52
66
  end
53
67
 
54
68
  def insert_photo
@@ -64,8 +78,14 @@ module Spina
64
78
  end
65
79
 
66
80
  def wysihtml5_select
67
- @photos = Photo.sorted
81
+ @photos = Photo.sorted.page(params[:page])
68
82
  @photo = Photo.new
83
+
84
+ if params[:page].present?
85
+ render :wysihtml5_infinite_scroll
86
+ else
87
+ render :wysihtml5_select
88
+ end
69
89
  end
70
90
 
71
91
  private
@@ -1,7 +1,8 @@
1
1
  module Spina
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
-
4
+ helper_method :current_theme, :current_user, :current_account
5
+
5
6
  include ApplicationHelper
6
7
 
7
8
  private
@@ -13,16 +14,13 @@ module Spina
13
14
  def current_theme
14
15
  @current_theme = ::Spina.themes.detect{|theme| theme.name == current_account.theme }
15
16
  end
16
- helper_method :current_theme
17
17
 
18
18
  def current_user
19
19
  @current_user ||= User.where(id: session[:user_id]).first if session[:user_id]
20
20
  end
21
- helper_method :current_user
22
21
 
23
22
  def current_account
24
23
  @current_account ||= Account.first
25
24
  end
26
- helper_method :current_account
27
25
  end
28
26
  end
@@ -1,5 +1,5 @@
1
1
  module Spina
2
- class InquiriesController < ApplicationController
2
+ class InquiriesController < Spina::ApplicationController
3
3
 
4
4
  before_filter :setup_negative_captcha, only: [:create]
5
5
 
@@ -27,4 +27,4 @@ module Spina
27
27
  end
28
28
 
29
29
  end
30
- end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module Spina
2
- class PagesController < ApplicationController
2
+ class PagesController < Spina::ApplicationController
3
3
  before_action :rewrite_page, only: [:show]
4
4
  before_action :current_user_can_view_page?, except: [:robots]
5
5
 
@@ -27,7 +27,7 @@ module Spina
27
27
  end
28
28
 
29
29
  def page
30
- @page ||= (action_name == 'homepage') ? Page.find_by(name: 'homepage') : Page.find_by(materialized_path: "/" + params[:id])
30
+ @page ||= (action_name == 'homepage') ? Page.find_by!(name: 'homepage') : Page.find_by!(materialized_path: "/" + params[:id])
31
31
  end
32
32
  helper_method :page
33
33
 
@@ -1,5 +1,5 @@
1
1
  module Spina
2
- class SitemapsController < ApplicationController
2
+ class SitemapsController < Spina::ApplicationController
3
3
  def show
4
4
  @pages = Page.live.sorted
5
5
  end
@@ -36,17 +36,17 @@ module Spina
36
36
  end
37
37
 
38
38
  def find_or_create_custom_pages(theme)
39
- theme.config.custom_pages.each do |page|
40
- Page.where(name: page[:name], deletable: false).first_or_create(title: page[:title], view_template: page[:view_template]).activate!
39
+ theme.config.custom_pages.each do |page|
40
+ Page.where(name: page[:name]).first_or_create(title: page[:title]).update_attributes(view_template: page[:view_template], deletable: page[:deletable])
41
41
  end
42
42
  end
43
43
 
44
44
  def deactivate_unused_view_templates(theme)
45
- Page.where.not(view_template: theme.config.view_templates.map{|t|t[0]}).each &:deactivate!
45
+ Page.where.not(view_template: theme.config.view_templates.keys).update_all(active: false)
46
46
  end
47
47
 
48
48
  def activate_used_view_templates(theme)
49
- Page.where(view_template: theme.config.view_templates.map{|t|t[0]}).each &:activate!
49
+ Page.where(view_template: theme.config.view_templates.keys).update_all(active: true)
50
50
  end
51
51
 
52
52
  def self.serialized_attr_accessor(*args)
@@ -72,16 +72,6 @@ module Spina
72
72
  self.siblings.where('position > ?', self.position).sorted.first
73
73
  end
74
74
 
75
- def deactivate!
76
- self.active = false
77
- self.save
78
- end
79
-
80
- def activate!
81
- self.active = true
82
- self.save
83
- end
84
-
85
75
  def set_materialized_path
86
76
  self.old_path = materialized_path
87
77
  self.materialized_path = generate_materialized_path
@@ -19,6 +19,11 @@ module Spina
19
19
  def content
20
20
  self
21
21
  end
22
+
23
+ def self.order_by_ids(ids)
24
+ sql = sanitize_sql_for_conditions({id: ids})
25
+ order("CASE WHEN #{sql} THEN 0 ELSE 1 END")
26
+ end
22
27
 
23
28
  end
24
29
  end
@@ -10,16 +10,17 @@ module Spina
10
10
  include ActionView::Helpers::UrlHelper
11
11
  include ActiveSupport::Configurable
12
12
 
13
- config_accessor :list_tag, :list_wrapper, :list_item_tag, :list_item_css, :selected_css, :current_css, :first_css, :last_css
13
+ config_accessor :list_tag, :list_class, :li, :list_wrapper, :list_item_tag, :list_item_css, :selected_css, :current_css, :first_css, :last_css
14
14
 
15
15
  self.list_tag = :ul
16
+ self.list_class = 'nav'
16
17
  self.list_item_tag = :li
17
18
  self.list_item_css = nil
18
19
  self.list_wrapper = false
19
- self.selected_css = :selected
20
- self.current_css = :current
21
- self.first_css = :first
22
- self.last_css = :last
20
+ self.selected_css = 'active'
21
+ self.current_css = 'current'
22
+ self.first_css = 'first'
23
+ self.last_css = 'last'
23
24
 
24
25
  attr_accessor :context, :collection, :current_menu_item
25
26
  delegate :output_buffer, :output_buffer=, to: :context
@@ -50,7 +51,7 @@ module Spina
50
51
  end
51
52
 
52
53
  def render_menu_items(menu_items)
53
- content_tag(list_tag) do
54
+ content_tag(list_tag, class: list_class) do
54
55
  menu_items.each_with_index.inject(ActiveSupport::SafeBuffer.new) do |buffer, (item, index)|
55
56
  buffer << render_menu_item(item, index, menu_items.length)
56
57
  end
@@ -8,7 +8,7 @@ module Spina
8
8
  end
9
9
 
10
10
  version :thumb do
11
- process resize_to_fill: [240, 135]
11
+ process resize_to_fill: [150, 150]
12
12
  end
13
13
 
14
14
  def too_large?(new_file)
@@ -22,7 +22,7 @@
22
22
 
23
23
  %td.nowrap
24
24
  = link_to t('spina.inquiries.mark_as_read'), spina.mark_as_read_admin_inquiry_path(inquiry), method: :patch, class: 'button button-link button-small', data: {icon: 'k'}
25
- = link_to "Verwijderen", spina.admin_inquiry_path(inquiry), method: :delete, class: 'button button-danger button-link button-small', data: {confirm: t('spina.inquiries.delete_confirmation', subject: inquiry.name)}
25
+ = link_to t('spina.delete'), spina.admin_inquiry_path(inquiry), method: :delete, class: 'button button-danger button-link button-small', data: {confirm: t('spina.inquiries.delete_confirmation', subject: inquiry.name)}
26
26
 
27
27
  - else
28
28
  %tr
@@ -20,4 +20,4 @@
20
20
  - if @inquiry.spam
21
21
  = link_to t('spina.inquiries.no_spam'), spina.unmark_spam_admin_inquiry_path(@inquiry), method: :patch, class: 'button', data: {icon: 'v'}
22
22
 
23
- = link_to t('spina.cancel'), spina.admin_inquiry_path(@inquiry), method: :delete, class: 'button button-danger button-link', data: {confirm: t('spina.inquiries.delete_confirmation', subject: @inquiry.name)}
23
+ = link_to t('spina.delete'), spina.admin_inquiry_path(@inquiry), method: :delete, class: 'button button-danger button-link', data: {confirm: t('spina.inquiries.delete_confirmation', subject: @inquiry.name)}
@@ -1,9 +1,7 @@
1
1
  .item
2
2
  .overlay
3
- = radio_button_tag :photo_id, photo.id
4
- = check_box_tag 'photo_ids[]', photo.id
5
- = link_to admin_photo_path(photo), class: 'icon-only', data: {aviary: true} do
6
- = icon('brush')
7
- = link_to spina.admin_photo_path(photo), method: :delete, class: 'icon-only', data: {confirm: t('spina.photos.delete_confirmation')} do
8
- = icon('trash')
3
+ = link_to admin_photo_path(photo), class: 'icon-only edit-photo-link', data: {aviary: true} do
4
+ =t('spina.photos.edit')
5
+ = link_to spina.admin_photo_path(photo), method: :delete, class: 'icon-only delete-photo-link', data: {confirm: t('spina.photos.delete_confirmation')} do
6
+ =t('spina.photos.delete')
9
7
  = image_tag photo.file.thumb.url, id: "photo_#{photo.id}", data: {posturl: spina.enhance_admin_photo_path(photo), image: photo.file.url}
@@ -1,22 +1,23 @@
1
1
  .modal.modal-large
2
- %header
3
- = link_to "", "#", class: 'close_modal', data: {dismiss: 'modal', icon: 'm'}
4
- %h3=t 'spina.photos.insert_photos'
5
-
6
2
  %section
7
- .gallery-select.gallery{data: {multiselect: true}}
8
- .item.item-small
3
+ .gallery-select.gallery-select-multiple.gallery{data: {multiselect: true}}
4
+ .item.item-small.item-uploader
9
5
  = form_for [spina, :admin, @photo], html: {multipart: true} do |f|
6
+ = f.label :file, t('spina.photos.upload_image')
10
7
  = f.file_field :file, data: {customfileinput: true}
11
8
 
12
9
  = form_tag spina.insert_photo_collection_admin_photos_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-image' do
13
- - @photos.each do |photo|
14
- .item{class: ('selected' if @selected_photos.include?(photo))}
15
- .overlay= check_box_tag 'photo_ids[]', photo.id, @selected_photos.include?(photo)
16
- = image_tag photo.file.thumb
10
+ .infinite-scroll
11
+ = render partial: 'spina/admin/photos/photo_multi_picker', collection: @photos
12
+
13
+ .infinite-pagination= link_to_next_page @photos, 'Next', params: {selected_photo_ids: @selected_photos.ids}, remote: true
17
14
 
18
- %footer
19
- = link_to t('spina.cancel'), "#", data: {dismiss: 'modal'}
20
- = button_tag type: 'submit', class: 'primary' do
21
- %i.icon.icon-plus
22
- = t('spina.photos.insert_photos')
15
+ .gallery-select-action-bar
16
+ .pull-right
17
+ = link_to t('spina.cancel'), "#", class: 'button button-link', data: {dismiss: 'modal'}
18
+ = button_tag type: 'submit', class: 'button button-primary button-large', style: 'margin-bottom: 0px' do
19
+ = icon('plus')
20
+ = t('spina.photos.choose_images')
21
+ %span.gallery-select-counter
22
+ - if @selected_photos.any?
23
+ (#{@selected_photos.count})
@@ -0,0 +1,3 @@
1
+ .item{class: ('selected' if @selected_photos.include?(photo_multi_picker))}
2
+ = check_box_tag 'photo_ids[]', photo_multi_picker.id, @selected_photos.include?(photo_multi_picker)
3
+ = image_tag photo_multi_picker.file.thumb.url, id: "photo_#{photo_multi_picker.id}"
@@ -1,22 +1,13 @@
1
1
  .modal.modal-large
2
- %header
3
- = link_to "", "#", class: 'close_modal', data: {dismiss: 'modal', icon: 'm'}
4
- %h3=t 'spina.photos.insert_photo'
5
-
6
2
  %section
7
3
  .gallery-select.gallery
8
- .item.item-small
4
+ .item.item-small.item-uploader
9
5
  = form_for [spina, :admin, @photo], html: {multipart: true} do |f|
6
+ = f.label :file, t('spina.photos.upload_image')
10
7
  = f.file_field :file, data: {customfileinput: true}
11
8
 
12
9
  = form_tag spina.insert_photo_admin_photos_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-image' do
13
- - @photos.each do |photo|
14
- .item{class: ('selected' if photo == @selected_photo)}
15
- .overlay= radio_button_tag :photo_id, photo.id, photo == @selected_photo
16
- = image_tag photo.file.thumb
10
+ .infinite-scroll
11
+ = render partial: 'spina/admin/photos/photo_single_picker', collection: @photos
17
12
 
18
- %footer
19
- = link_to t('spina.cancel'), "#", data: {dismiss: 'modal'}
20
- = button_tag type: 'submit', class: 'primary' do
21
- %i.icon.icon-plus
22
- = t('spina.photos.insert_photo')
13
+ .infinite-pagination= link_to_next_page @photos, 'Next', params: {selected_photo_id: @selected_photo.try(:id)}, remote: true
@@ -0,0 +1,3 @@
1
+ .item{class: ('selected' if @selected_photo == photo_single_picker)}
2
+ = radio_button_tag :photo_id, photo_single_picker.id, photo_single_picker == @selected_photo
3
+ = image_tag photo_single_picker.file.thumb.url, id: "photo_#{photo_single_picker.id}"
@@ -0,0 +1,4 @@
1
+ .item
2
+ = radio_button_tag :photo_id, photo_uploaded.id
3
+ = check_box_tag 'photo_ids[]', photo_uploaded.id
4
+ = image_tag photo_uploaded.file.thumb.url, id: "photo_#{photo_uploaded.id}"
@@ -1,20 +1,13 @@
1
1
  .modal.modal-large
2
- %header
3
- = link_to "", "#", class: 'close_modal', data: {dismiss: 'modal', icon: 'm'}
4
- %h3=t 'spina.photos.insert_photo'
5
-
6
2
  %section
7
3
  .gallery-select.gallery
8
- .item
4
+ .item.item-uploader
9
5
  = form_for [spina, :admin, @photo], html: {multipart: true} do |f|
6
+ = f.label :file, t('spina.photos.upload_image')
10
7
  = f.file_field :file, data: {customfileinput: true}
11
8
 
12
9
  = form_tag spina.wysihtml5_insert_admin_photos_path(params[:object_id]), remote: true, class: 'gallery-prepend-image' do
13
- - @photos.each do |photo|
14
- .item
15
- .overlay= radio_button_tag :photo_id, photo.id
16
- = image_tag photo.file.thumb
10
+ .infinite-scroll
11
+ = render partial: 'spina/admin/photos/photo_single_picker', collection: @photos
17
12
 
18
- %footer
19
- = link_to t('spina.cancel'), "#", data: {dismiss: 'modal'}
20
- = button_tag t('spina.photos.insert_photo'), type: 'submit', class: 'primary', data: {icon: 't '}
13
+ .infinite-pagination= link_to_next_page @photos, 'Next', remote: true
@@ -1,5 +1,7 @@
1
1
  <% if @photo.new_record? %>
2
2
  alert("<%= I18n.t 'spina.photos.cannot_be_created' %> <%= j @photo.errors.full_messages.join(', ').html_safe %>");
3
3
  <% else %>
4
- $(".gallery-prepend-image").prepend("<%= j render partial: 'spina/admin/photos/photo', object: @photo %>");
4
+ $item = $("<%=j render partial: 'spina/admin/photos/photo_uploaded', object: @photo %>");
5
+ $(".gallery-prepend-image .infinite-scroll").prepend($item);
6
+ $(".gallery-prepend-image .infinite-scroll .item:first-child").click();
5
7
  <% end %>