spina 0.12.0 → 1.0.0
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.
- checksums.yaml +5 -5
- data/README.md +65 -7
- data/app/assets/fonts/spina/ics_spina.eot +0 -0
- data/app/assets/fonts/spina/ics_spina.svg +65 -61
- data/app/assets/fonts/spina/ics_spina.ttf +0 -0
- data/app/assets/fonts/spina/ics_spina.woff +0 -0
- data/app/assets/fonts/spina/ics_spina.woff2 +0 -0
- data/app/assets/icons/spina/export.svg +10 -0
- data/app/assets/icons/spina/preview/ics_spina-preview.html +17 -1
- data/app/assets/images/spina/media_folder_placeholder.png +0 -0
- data/app/assets/images/spina/{admin/spina.png → spina-large.png} +0 -0
- data/app/assets/javascripts/spina/admin/application.js +50 -0
- data/app/assets/javascripts/spina/admin/controllers/infinite_scroll_controller.js +40 -0
- data/app/assets/javascripts/spina/admin/media_gallery.coffee +65 -0
- data/app/assets/javascripts/spina/admin/modal.coffee +0 -1
- data/app/assets/javascripts/spina/admin/pages.coffee.erb +2 -2
- data/app/assets/javascripts/spina/admin/{application.coffee.erb → scaffold.coffee} +20 -61
- data/app/assets/javascripts/spina/admin/trix.coffee.erb +5 -8
- data/app/assets/javascripts/spina/admin/uploads.coffee +2 -2
- data/app/assets/stylesheets/spina.sass +3 -3
- data/app/assets/stylesheets/spina/_buttons.sass +0 -1
- data/app/assets/stylesheets/spina/{_configuration.sass → _configuration.sass.erb} +5 -1
- data/app/assets/stylesheets/spina/_forms.sass +79 -20
- data/app/assets/stylesheets/spina/_gallery.sass +91 -3
- data/app/assets/stylesheets/spina/_ics_spina.scss +1 -0
- data/app/assets/stylesheets/spina/_tables.sass +4 -0
- data/app/assets/stylesheets/spina/_trix.sass +7 -4
- data/app/assets/stylesheets/spina_front_end.sass +19 -0
- data/app/controllers/concerns/spina/frontend.rb +29 -12
- data/app/controllers/spina/admin/admin_controller.rb +1 -1
- data/app/controllers/spina/admin/attachments_controller.rb +10 -5
- data/app/controllers/spina/admin/images_controller.rb +51 -0
- data/app/controllers/spina/admin/media_folders_controller.rb +37 -0
- data/app/controllers/spina/admin/media_picker_controller.rb +28 -0
- data/app/controllers/spina/admin/pages_controller.rb +16 -6
- data/app/controllers/spina/admin/resources_controller.rb +33 -0
- data/app/controllers/spina/admin/settings_controller.rb +56 -0
- data/app/controllers/spina/pages_controller.rb +0 -6
- data/app/helpers/spina/admin/pages_helper.rb +2 -2
- data/app/helpers/spina/admin_nav_helper.rb +7 -0
- data/app/helpers/spina/files_helper.rb +9 -0
- data/app/helpers/spina/images_helper.rb +17 -0
- data/app/helpers/spina/pages_helper.rb +17 -0
- data/app/models/concerns/spina/image_collectable.rb +23 -0
- data/app/models/concerns/spina/part.rb +7 -4
- data/app/models/spina/account.rb +10 -14
- data/app/models/spina/attachment.rb +8 -10
- data/app/models/spina/attachment_collection.rb +6 -1
- data/app/models/spina/current.rb +5 -0
- data/app/models/spina/image.rb +26 -0
- data/app/models/spina/{photo_collection.rb → image_collection.rb} +6 -6
- data/app/models/spina/image_collections_image.rb +6 -0
- data/app/models/spina/line.rb +1 -0
- data/app/models/spina/media_folder.rb +7 -0
- data/app/models/spina/navigation.rb +4 -0
- data/app/models/spina/navigation_item.rb +1 -1
- data/app/models/spina/page.rb +18 -13
- data/app/models/spina/page_part.rb +1 -0
- data/app/models/spina/resource.rb +16 -0
- data/app/models/spina/setting.rb +7 -0
- data/app/models/spina/structure.rb +2 -0
- data/app/models/spina/structure_item.rb +2 -0
- data/app/models/spina/structure_part.rb +2 -1
- data/app/models/spina/text.rb +1 -0
- data/app/views/dummy/show.html.haml +1 -0
- data/app/views/layouts/spina/admin/media_library.html.haml +6 -3
- data/app/views/layouts/spina/admin/pages.html.haml +4 -1
- data/app/views/layouts/spina/admin/resources.html.haml +10 -0
- data/app/views/spina/admin/accounts/style.html.haml +3 -2
- data/app/views/spina/admin/attachments/_attachment.html.haml +3 -3
- data/app/views/spina/admin/attachments/_select.html.haml +7 -15
- data/app/views/spina/admin/attachments/_select_collection.html.haml +7 -14
- data/app/views/spina/admin/attachments/create.js.erb +1 -3
- data/app/views/spina/admin/attachments/index.html.haml +4 -3
- data/app/views/spina/admin/attachments/insert.js.erb +5 -0
- data/app/views/spina/admin/image_collections/_image_collection.html.haml +5 -0
- data/app/views/spina/admin/images/_form.html.haml +5 -0
- data/app/views/spina/admin/images/_image.html.haml +10 -0
- data/app/views/spina/admin/images/create.js.erb +8 -0
- data/app/views/spina/admin/images/index.html.haml +22 -0
- data/app/views/spina/admin/images/index.js.erb +7 -0
- data/app/views/spina/admin/media_folders/_form.html.haml +14 -0
- data/app/views/spina/admin/media_folders/_media_folder.html.haml +8 -0
- data/app/views/spina/admin/media_folders/new.js.erb +1 -0
- data/app/views/spina/admin/media_folders/show.html.haml +17 -0
- data/app/views/spina/admin/media_picker/_modal.html.haml +26 -0
- data/app/views/spina/admin/media_picker/infinite_scroll.js.erb +5 -0
- data/app/views/spina/admin/media_picker/select.js.erb +28 -0
- data/app/views/spina/admin/media_picker/show.js.erb +1 -0
- data/app/views/spina/admin/navigations/_page.html.haml +2 -2
- data/app/views/spina/admin/navigations/edit.html.haml +1 -1
- data/app/views/spina/admin/pages/_form.html.haml +21 -15
- data/app/views/spina/admin/pages/_form_advanced.html.haml +53 -43
- data/app/views/spina/admin/pages/_form_page_content.html.haml +1 -1
- data/app/views/spina/admin/pages/_form_page_seo.html.haml +1 -1
- data/app/views/spina/admin/pages/_page_nested_list.html.haml +3 -3
- data/app/views/spina/admin/pages/index.html.haml +1 -1
- data/app/views/spina/admin/{page_partables → partables}/attachment_collections/_form.html.haml +1 -1
- data/app/views/spina/admin/{page_partables → partables}/attachments/_form.html.haml +4 -4
- data/app/views/spina/admin/partables/image_collections/_form.html.haml +16 -0
- data/app/views/spina/admin/partables/images/_form.html.haml +14 -0
- data/app/views/spina/admin/{page_partables → partables}/lines/_form.html.haml +1 -1
- data/app/views/spina/admin/{structure_partables → partables}/options/_form.html.haml +1 -1
- data/app/views/spina/admin/partables/photo_collections/_form.html.haml +4 -0
- data/app/views/spina/admin/partables/photos/_form.html.haml +4 -0
- data/app/views/spina/admin/{page_partables → partables}/structures/_form.html.haml +3 -3
- data/app/views/spina/admin/{page_partables → partables}/texts/_form.html.haml +1 -1
- data/app/views/spina/admin/password_resets/edit.html.haml +1 -1
- data/app/views/spina/admin/password_resets/new.html.haml +1 -1
- data/app/views/spina/admin/resources/edit.html.haml +49 -0
- data/app/views/spina/admin/resources/show.html.haml +14 -0
- data/app/views/spina/admin/sessions/new.html.haml +1 -1
- data/app/views/spina/admin/settings/_string_field.html.haml +4 -0
- data/app/views/spina/admin/settings/_wysiwyg_field.html.haml +4 -0
- data/app/views/spina/admin/settings/edit.html.haml +13 -0
- data/app/views/spina/admin/shared/_primary_navigation.html.haml +13 -5
- data/app/views/spina/admin/shared/_rich_text_field.html.haml +10 -10
- data/app/views/spina/admin/structure_items/_fields.html.haml +1 -1
- data/app/views/spina/admin/structure_partables/attachment_collections/_form.html.haml +14 -0
- data/app/views/spina/admin/structure_partables/attachments/_form.html.haml +13 -0
- data/app/views/spina/shared/_analytics.html.erb +8 -8
- data/app/views/spina/shared/_navigation.html.haml +3 -3
- data/app/views/spina/shared/_spina_link.html.haml +2 -0
- data/app/views/spina/sitemaps/show.xml.builder +2 -2
- data/config/initializers/assets.rb +6 -1
- data/config/locales/TH.yml +243 -0
- data/config/locales/bg.yml +250 -0
- data/config/locales/de.yml +67 -22
- data/config/locales/en.yml +29 -2
- data/config/locales/es.yml +58 -1
- data/config/locales/fr.yml +80 -32
- data/config/locales/id.yml +228 -0
- data/config/locales/nl.yml +32 -0
- data/config/locales/pl.yml +225 -0
- data/config/locales/pt-BR.yml +34 -3
- data/config/locales/ro.yml +225 -0
- data/config/locales/ru.yml +10 -0
- data/config/locales/sv.yml +223 -0
- data/config/routes.rb +13 -13
- data/db/migrate/10_create_spina_image_collections.rb +16 -0
- data/db/migrate/11_create_spina_resources.rb +15 -0
- data/db/migrate/1_create_spina_tables.rb +0 -19
- data/db/migrate/2_create_spina_translation_tables.rb +36 -6
- data/db/migrate/7_create_spina_settings.rb +11 -0
- data/db/migrate/8_create_spina_media_folders.rb +8 -0
- data/db/migrate/9_create_spina_images.rb +10 -0
- data/lib/generators/spina/install_generator.rb +2 -2
- data/lib/generators/spina/templates/app/views/default/pages/homepage.html.haml +3 -2
- data/lib/generators/spina/templates/app/views/default/pages/show.html.haml +2 -2
- data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +3 -5
- data/lib/generators/spina/templates/app/views/demo/pages/demo.html.haml +20 -23
- data/lib/generators/spina/templates/app/views/demo/pages/homepage.html.haml +2 -2
- data/lib/generators/spina/templates/app/views/demo/pages/show.html.haml +2 -2
- data/lib/generators/spina/templates/app/views/demo/shared/_navigation.html.haml +3 -5
- data/lib/generators/spina/templates/config/initializers/mobility.rb +6 -0
- data/lib/generators/spina/templates/config/initializers/spina.rb +3 -0
- data/lib/generators/spina/templates/config/initializers/themes/demo.rb +7 -7
- data/lib/spina.rb +0 -1
- data/lib/spina/engine.rb +6 -7
- data/lib/spina/plugin.rb +48 -3
- data/lib/spina/version.rb +1 -1
- data/vendor/assets/javascripts/spina/stimulus.umd.js +5 -0
- data/vendor/assets/javascripts/spina/trix.js +10 -9
- metadata +106 -103
- data/app/assets/images/spina/danger-zone-ribbon.png +0 -0
- data/app/assets/images/spina/spina_small.png +0 -0
- data/app/assets/javascripts/spina/admin/infinite_scroll.coffee +0 -25
- data/app/controllers/spina/admin/photos_controller.rb +0 -100
- data/app/models/concerns/spina/photo_collectable.rb +0 -24
- data/app/models/spina/photo.rb +0 -29
- data/app/models/spina/photo_collections_photo.rb +0 -6
- data/app/presenters/spina/pages/menu_presenter.rb +0 -63
- data/app/uploaders/spina/default_store_uploader.rb +0 -15
- data/app/uploaders/spina/file_uploader.rb +0 -6
- data/app/uploaders/spina/logo_uploader.rb +0 -13
- data/app/uploaders/spina/photo_uploader.rb +0 -23
- data/app/views/spina/admin/attachments/_fields.html.haml +0 -8
- data/app/views/spina/admin/attachments/insert.js.coffee +0 -5
- data/app/views/spina/admin/page_partables/options/_form.html.haml +0 -6
- data/app/views/spina/admin/page_partables/photo_collections/_form.html.haml +0 -17
- data/app/views/spina/admin/page_partables/photos/_form.html.haml +0 -14
- data/app/views/spina/admin/photos/_photo.html.haml +0 -8
- data/app/views/spina/admin/photos/_photo_collection.html.haml +0 -5
- data/app/views/spina/admin/photos/_photo_collection_select.html.haml +0 -23
- data/app/views/spina/admin/photos/_photo_link.html.haml +0 -11
- data/app/views/spina/admin/photos/_photo_multi_picker.html.haml +0 -3
- data/app/views/spina/admin/photos/_photo_select.html.haml +0 -16
- data/app/views/spina/admin/photos/_photo_single_picker.html.haml +0 -3
- data/app/views/spina/admin/photos/_photo_uploaded.html.haml +0 -4
- data/app/views/spina/admin/photos/_trix_select.html.haml +0 -11
- data/app/views/spina/admin/photos/create.js.erb +0 -4
- data/app/views/spina/admin/photos/index.html.haml +0 -13
- data/app/views/spina/admin/photos/index.js.erb +0 -5
- data/app/views/spina/admin/photos/insert_photo.js.erb +0 -10
- data/app/views/spina/admin/photos/insert_photo_collection.js.erb +0 -25
- data/app/views/spina/admin/photos/link.js.erb +0 -2
- data/app/views/spina/admin/photos/multi_picker_infinite_scroll.js.erb +0 -6
- data/app/views/spina/admin/photos/photo_collection_select.js.erb +0 -3
- data/app/views/spina/admin/photos/photo_select.js.erb +0 -3
- data/app/views/spina/admin/photos/single_picker_infinite_scroll.js.erb +0 -6
- data/app/views/spina/admin/photos/trix_infinite_scroll.js.erb +0 -4
- data/app/views/spina/admin/photos/trix_insert.js.erb +0 -2
- data/app/views/spina/admin/photos/trix_select.js.erb +0 -3
- data/app/views/spina/admin/structure_partables/lines/_form.html.haml +0 -5
- data/app/views/spina/admin/structure_partables/photo_collections/_form.html.haml +0 -17
- data/app/views/spina/admin/structure_partables/photos/_form.html.haml +0 -11
- data/app/views/spina/admin/structure_partables/texts/_form.html.haml +0 -5
- data/config/initializers/spina.rb +0 -0
- data/lib/generators/spina/templates/config/initializers/carrierwave.rb +0 -17
- data/lib/spina/railtie.rb +0 -9
Binary file
|
Binary file
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class Spina.InfiniteScroll
|
2
|
-
@init: (link) ->
|
3
|
-
$(window).off('scroll.infiniteScroll')
|
4
|
-
$('#main, #overlay section').off('scroll.infiniteScroll')
|
5
|
-
|
6
|
-
$link = $(link)
|
7
|
-
if (url = $link.find('a').attr('href'))
|
8
|
-
$(window).on 'scroll.infiniteScroll', => @loadNextPage($link)
|
9
|
-
$('#main, #overlay section').on('scroll.infiniteScroll', -> $(window).trigger 'scroll.infiniteScroll')
|
10
|
-
$(window).trigger('scroll.infiniteScroll')
|
11
|
-
|
12
|
-
@loadNextPage: ($link) ->
|
13
|
-
if ($(window).scrollTop() > $link.offset().top - $(window).height() - 500)
|
14
|
-
$(window).off('scroll.infiniteScroll')
|
15
|
-
$('#main, #overlay section').off('scroll.infiniteScroll')
|
16
|
-
$.rails.disableElement($link.find('a'))
|
17
|
-
$.getScript($link.find('a').attr('href'))
|
18
|
-
|
19
|
-
$.fn.infiniteScroll = () ->
|
20
|
-
Spina.InfiniteScroll.init(this)
|
21
|
-
|
22
|
-
$(document).on 'turbolinks:load', ->
|
23
|
-
$(window).off('scroll.infiniteScroll')
|
24
|
-
$('#main, #overlay section').off('scroll.infiniteScroll')
|
25
|
-
$(document).find('.infinite-pagination').infiniteScroll()
|
@@ -1,100 +0,0 @@
|
|
1
|
-
module Spina
|
2
|
-
module Admin
|
3
|
-
class PhotosController < AdminController
|
4
|
-
before_action :set_breadcrumbs
|
5
|
-
|
6
|
-
layout "spina/admin/media_library"
|
7
|
-
|
8
|
-
def index
|
9
|
-
add_breadcrumb I18n.t('spina.website.photos'), spina.admin_photos_path
|
10
|
-
@photos = Photo.sorted.page(params[:page])
|
11
|
-
@photo = Photo.new
|
12
|
-
end
|
13
|
-
|
14
|
-
def media_library
|
15
|
-
redirect_to spina.admin_photos_path
|
16
|
-
end
|
17
|
-
|
18
|
-
def create
|
19
|
-
@photos = photo_params[:files].map do |file|
|
20
|
-
Photo.create!(file: file)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def destroy
|
25
|
-
@photo = Photo.find(params[:id])
|
26
|
-
@photo.destroy
|
27
|
-
redirect_to spina.admin_photos_url
|
28
|
-
end
|
29
|
-
|
30
|
-
def enhance
|
31
|
-
@photo = Photo.find(params[:id])
|
32
|
-
@photo.remote_file_url = params[:new_image]
|
33
|
-
@photo.save
|
34
|
-
end
|
35
|
-
|
36
|
-
def link
|
37
|
-
@photo = Photo.find(params[:id])
|
38
|
-
end
|
39
|
-
|
40
|
-
def photo_select
|
41
|
-
@selected_photo_id = Photo.find_by(id: params[:selected_photo_id]).try(:id)
|
42
|
-
@hidden_field_id = params[:hidden_field_id]
|
43
|
-
@photos = Photo.order_by_ids(@selected_photo_id).sorted.page(params[:page])
|
44
|
-
@photo = Photo.new
|
45
|
-
|
46
|
-
if params[:page].present?
|
47
|
-
render :single_picker_infinite_scroll
|
48
|
-
else
|
49
|
-
render :photo_select
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def photo_collection_select
|
54
|
-
@selected_photo_ids = Photo.where(id: params[:selected_photo_ids]).ids
|
55
|
-
@photos = Photo.order_by_ids(@selected_photo_ids).sorted.page(params[:page])
|
56
|
-
@photo = Photo.new
|
57
|
-
|
58
|
-
if params[:page].present?
|
59
|
-
render :multi_picker_infinite_scroll
|
60
|
-
else
|
61
|
-
render :photo_collection_select
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def insert_photo
|
66
|
-
@photo = Photo.find(params[:photo_id]) if params[:photo_id].present?
|
67
|
-
end
|
68
|
-
|
69
|
-
def insert_photo_collection
|
70
|
-
@photos = Photo.find(params[:photo_ids]) if params[:photo_ids].present?
|
71
|
-
end
|
72
|
-
|
73
|
-
def trix_insert
|
74
|
-
@photo = Photo.find(params[:photo_id])
|
75
|
-
end
|
76
|
-
|
77
|
-
def trix_select
|
78
|
-
@photos = Photo.sorted.page(params[:page])
|
79
|
-
@photo = Photo.new
|
80
|
-
|
81
|
-
if params[:page].present?
|
82
|
-
render :trix_infinite_scroll
|
83
|
-
else
|
84
|
-
render :trix_select
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
private
|
89
|
-
|
90
|
-
def set_breadcrumbs
|
91
|
-
add_breadcrumb I18n.t('spina.website.media_library'), spina.admin_media_library_path
|
92
|
-
end
|
93
|
-
|
94
|
-
def photo_params
|
95
|
-
params.require(:photo).permit(files: [])
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
|
3
|
-
module Spina
|
4
|
-
module PhotoCollectable
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
attr_reader :photo_tokens, :photo_positions
|
9
|
-
end
|
10
|
-
|
11
|
-
def photo_tokens=(ids)
|
12
|
-
self.photo_ids = ids.split(",")
|
13
|
-
end
|
14
|
-
|
15
|
-
def photo_positions=(positions)
|
16
|
-
positions = positions.split(",")
|
17
|
-
self.photo_collections_photos.each do |photo|
|
18
|
-
photo.position = positions.index(photo.photo.try(:id).try(:to_s))
|
19
|
-
end
|
20
|
-
logger.info self.photo_collections_photos.inspect
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
data/app/models/spina/photo.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Spina
|
2
|
-
class Photo < ApplicationRecord
|
3
|
-
mount_uploader :file, PhotoUploader
|
4
|
-
|
5
|
-
has_many :page_parts, as: :page_partable
|
6
|
-
has_many :structure_parts, as: :structure_partable
|
7
|
-
has_many :photo_collections_photos
|
8
|
-
has_many :photo_collections, through: :photo_collections_photos
|
9
|
-
|
10
|
-
scope :sorted, -> { order('created_at DESC') }
|
11
|
-
scope :sorted_by_photo_collection, -> { order('position') }
|
12
|
-
|
13
|
-
validates_presence_of :file
|
14
|
-
|
15
|
-
def name
|
16
|
-
file.file.filename
|
17
|
-
end
|
18
|
-
|
19
|
-
def content
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.order_by_ids(ids)
|
24
|
-
sql = sanitize_sql_for_assignment({id: ids})
|
25
|
-
order("CASE WHEN #{sql} THEN 0 ELSE 1 END")
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'active_support/configurable'
|
2
|
-
require 'action_view/helpers/tag_helper'
|
3
|
-
require 'action_view/helpers/url_helper'
|
4
|
-
|
5
|
-
module Spina
|
6
|
-
module Pages
|
7
|
-
class MenuPresenter
|
8
|
-
include ActionView::Helpers::TagHelper
|
9
|
-
include ActionView::Helpers::UrlHelper
|
10
|
-
include ActiveSupport::Configurable
|
11
|
-
|
12
|
-
config_accessor :list_tag, :list_class, :list_item_tag, :list_item_css, :selected_css, :current_css
|
13
|
-
|
14
|
-
self.list_tag = :ul
|
15
|
-
self.list_class = 'nav'
|
16
|
-
self.list_item_tag = :li
|
17
|
-
self.list_item_css = nil
|
18
|
-
self.selected_css = 'active'
|
19
|
-
self.current_css = 'current'
|
20
|
-
|
21
|
-
attr_accessor :context, :collection, :current_menu_item
|
22
|
-
delegate :output_buffer, :output_buffer=, to: :context
|
23
|
-
|
24
|
-
def initialize(collection, context, current_menu_item = nil)
|
25
|
-
@collection = collection
|
26
|
-
@context = context
|
27
|
-
@current_menu_item = current_menu_item
|
28
|
-
@selected_menu_items = [@current_menu_item] + @current_menu_item.try(:ancestors)
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_html
|
32
|
-
render_menu_items(collection) if collection.present?
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def render_menu_items(menu_items)
|
38
|
-
content_tag(list_tag, class: list_class) do
|
39
|
-
menu_items.each.inject(ActiveSupport::SafeBuffer.new) do |buffer, item|
|
40
|
-
buffer << render_menu_item(item)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def render_menu_item(menu_item)
|
46
|
-
content_tag(list_item_tag, class: menu_item_css(menu_item[0])) do
|
47
|
-
buffer = ActiveSupport::SafeBuffer.new
|
48
|
-
buffer << link_to(menu_item[0].menu_title, menu_item[0].materialized_path)
|
49
|
-
buffer << render_menu_items(menu_item[1]) if menu_item[1].present?
|
50
|
-
buffer
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def menu_item_css(menu_item)
|
55
|
-
css = [list_item_css]
|
56
|
-
css << selected_css if (@selected_menu_items.present? && @selected_menu_items.include?(menu_item) )
|
57
|
-
css << current_css if @current_menu_item == menu_item
|
58
|
-
css
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Spina
|
2
|
-
class DefaultStoreUploader < CarrierWave::Uploader::Base
|
3
|
-
|
4
|
-
def store_dir
|
5
|
-
case ::Spina.config.storage
|
6
|
-
when :s3
|
7
|
-
"#{mounted_as}/#{model.class.to_s.underscore}/#{model.id}"
|
8
|
-
when :file
|
9
|
-
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
10
|
-
else
|
11
|
-
raise NotImplementedError, "Please set your storage preferences in config/initializers/spina.rb"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Spina
|
3
|
-
class PhotoUploader < Spina::DefaultStoreUploader
|
4
|
-
include CarrierWave::MiniMagick
|
5
|
-
|
6
|
-
version :image do
|
7
|
-
process resize_to_fit: [800, 800], if: :too_large?
|
8
|
-
end
|
9
|
-
|
10
|
-
version :thumb do
|
11
|
-
process resize_to_fill: [150, 150]
|
12
|
-
end
|
13
|
-
|
14
|
-
def too_large?(new_file)
|
15
|
-
new_file.size > 120 * 1000
|
16
|
-
end
|
17
|
-
|
18
|
-
def extension_white_list
|
19
|
-
%w(jpg jpeg gif png)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
-# %fieldset
|
2
|
-
-# %div{style: 'float: left; min-width: 400px;'}
|
3
|
-
-# = f.file_field :file, data: { customfile: true, placeholder: (f.object.new_record? ? "Nog geen bestand geselecteerd" : f.object.name) }
|
4
|
-
-# %br
|
5
|
-
-# = link_to "", '#', class: 'remove_field button button-link', data: {icon: 'x'}
|
6
|
-
-# = f.hidden_field :_destroy
|
7
|
-
-# %br
|
8
|
-
-#
|
@@ -1,5 +0,0 @@
|
|
1
|
-
hidden_input = $("input[name='<%= j params[:page_part_id] %>[page_partable_id]']")
|
2
|
-
hidden_input.parents('.media_picker').find('.attachment').remove()
|
3
|
-
hidden_input.parents('.media_picker').append("<div class='attachment'><%= @attachment.name %></div>")
|
4
|
-
hidden_input.val("<%= @attachment.id %>")
|
5
|
-
$.hideModal()
|
@@ -1,17 +0,0 @@
|
|
1
|
-
.horizontal-form-label
|
2
|
-
= f.object.title
|
3
|
-
.horizontal-form-content
|
4
|
-
= f.fields_for :page_partable, f.object.page_partable do |ff|
|
5
|
-
= link_to spina.photo_collection_select_admin_photos_path(ff.object_name, selected_photo_ids: ff.object.photo_ids), remote: true, class: 'media_picker clearfix' do
|
6
|
-
.placeholder
|
7
|
-
%span.button.button-small.button-round
|
8
|
-
%i.icon.icon-dots
|
9
|
-
=t 'spina.pages.photos_picker'
|
10
|
-
|
11
|
-
.photo-collection
|
12
|
-
- if ff.object.photos.sorted_by_photo_collection.any?
|
13
|
-
= render 'spina/admin/photos/photo_collection', photos: ff.object.photos.sorted_by_photo_collection
|
14
|
-
- elsif ff.object.photos.any?
|
15
|
-
= render 'spina/admin/photos/photo_collection', photos: ff.object.photos
|
16
|
-
= ff.hidden_field :photo_tokens, value: ff.object.photo_ids.join(",")
|
17
|
-
= ff.hidden_field :photo_positions, value: ff.object.photos.sorted_by_photo_collection.pluck(:photo_id).join(","), class: 'photo-positions'
|
@@ -1,14 +0,0 @@
|
|
1
|
-
.horizontal-form-label
|
2
|
-
= f.object.title
|
3
|
-
.horizontal-form-content
|
4
|
-
= link_to spina.photo_select_admin_photos_path(f.object_name, selected_photo_id: f.object.page_partable.try(:id)), remote: true, class: 'media_picker clearfix' do
|
5
|
-
.placeholder
|
6
|
-
%span.button.button-small.button-round
|
7
|
-
%i.icon.icon-dots
|
8
|
-
=t 'spina.pages.photo_picker'
|
9
|
-
|
10
|
-
- if f.object.page_partable && f.object.page_partable.file.present?
|
11
|
-
.image
|
12
|
-
= image_tag f.object.page_partable.file.thumb
|
13
|
-
|
14
|
-
= f.hidden_field :page_partable_id
|
@@ -1,8 +0,0 @@
|
|
1
|
-
.item
|
2
|
-
.overlay
|
3
|
-
= link_to spina.admin_photo_path(photo), method: :delete, class: 'icon-only delete-photo-link', data: {confirm: t('spina.photos.delete_confirmation')} do
|
4
|
-
= t('spina.photos.delete')
|
5
|
-
%span.photo-name= truncate(photo.name, length: 125)
|
6
|
-
= radio_button_tag :photo_id, photo.id
|
7
|
-
= check_box_tag 'photo_ids[]', photo.id
|
8
|
-
= image_tag photo.file.thumb.url, id: "photo_#{photo.id}"
|
@@ -1,23 +0,0 @@
|
|
1
|
-
.modal.modal-large
|
2
|
-
%section
|
3
|
-
.gallery-select.gallery-select-multiple.gallery{data: {multiselect: true}}
|
4
|
-
.item.item-small.item-uploader
|
5
|
-
= form_for [spina, :admin, @photo], html: {multipart: true} do |f|
|
6
|
-
= f.label :file, t('spina.photos.upload_image')
|
7
|
-
= f.file_field :files, multiple: true, data: {customfileinput: true}
|
8
|
-
|
9
|
-
= form_tag spina.insert_photo_collection_admin_photos_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-image' do
|
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: params.slice(:selected_photo_ids), remote: true
|
14
|
-
|
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_photo_ids.any?
|
23
|
-
(#{ @selected_photo_ids.count })
|
@@ -1,11 +0,0 @@
|
|
1
|
-
#modal.modal
|
2
|
-
%header.big-header
|
3
|
-
= link_to '#', class: 'close_modal', data: {dismiss: 'modal'} do
|
4
|
-
%i.icon-only{data: {icon: 'm'}}
|
5
|
-
|
6
|
-
%h3
|
7
|
-
=t 'spina.photos.link'
|
8
|
-
%strong= @photo.file.url
|
9
|
-
|
10
|
-
%footer
|
11
|
-
= link_to t('spina.close'), '#', data: {dismiss: 'modal'}, style: 'width: 100%'
|
@@ -1,16 +0,0 @@
|
|
1
|
-
.modal.modal-large
|
2
|
-
%section
|
3
|
-
.gallery-select.gallery
|
4
|
-
.item.item-small.item-uploader
|
5
|
-
= form_for [spina, :admin, @photo], html: {multipart: true} do |f|
|
6
|
-
= f.label :file, t('spina.photos.upload_image')
|
7
|
-
= f.file_field :files, multiple: true, data: {customfileinput: true}
|
8
|
-
|
9
|
-
= form_tag spina.insert_photo_admin_photos_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-image' do
|
10
|
-
= hidden_field_tag :hidden_field_id, @hidden_field_id
|
11
|
-
|
12
|
-
.infinite-scroll
|
13
|
-
= render partial: 'spina/admin/photos/photo_single_picker', collection: @photos
|
14
|
-
|
15
|
-
.infinite-pagination= link_to_next_page @photos, 'Next', params: params.slice(:selected_photo_id).permit(:selected_photo_id), remote: true
|
16
|
-
|