scrivito_gallery_widget 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f6c462fc3067107741e2c3441a84c8ec3c649c4
4
+ data.tar.gz: eaa42b31aca99bb059a5cc0aa704a80bb57937db
5
+ SHA512:
6
+ metadata.gz: cd4d5c9501b325d34dc0bba7613455191577de11fec43fe313b211ff6f4f7bd3b7cae9c6e47b6196645efc64e05e0f86357b219fb7d669b8f4f2bd04b00bdd7c
7
+ data.tar.gz: cf064d5a176df758f2536c391b7028f74d6fece8c925c0627d207a187bbdeedc784298a7227b0fa3e04afd817b44e5f3ed8e5e9106f378136ee30f3a632837f6
data/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ Copyright (c) 2009 - 2016 Infopark AG (http://www.infopark.com)
2
+
3
+ This software can be used and modified under the LGPL-3.0. Please refer to
4
+ http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
@@ -0,0 +1,24 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'ScrivitoGalleryWidget'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+ load 'rails/tasks/statistics.rake'
20
+
21
+
22
+
23
+ Bundler::GemHelper.install_tasks
24
+
@@ -0,0 +1,19 @@
1
+ (function($, App) {
2
+ 'use strict';
3
+
4
+ scrivito.on('content', function(content) {
5
+ var galleries = $(content).find('.scrivito_gallery_widget_image_list')
6
+ $.each(galleries, function(index, gallery) {
7
+ var active_on = $(gallery).data('image-activate-on');
8
+ $(gallery).on(active_on, 'li', function() {
9
+ var elem = $(this);
10
+ var target = $(elem.data('image-gallery-target'));
11
+ target.siblings().removeClass('active');
12
+ target.addClass('active');
13
+ elem.siblings().removeClass('active');
14
+ elem.addClass('active');
15
+
16
+ }); // end image handle
17
+ }); // end each
18
+ }); // end on content
19
+ })(jQuery, this);
@@ -0,0 +1,34 @@
1
+ .scrivito_gallery_widget_area {
2
+ img {
3
+ max-width: 100%;
4
+ display: block;
5
+ max-height: 300px;
6
+ margin: 0 auto;
7
+ }
8
+
9
+ > div {
10
+ display: none;
11
+ &.active {
12
+ display: block;
13
+ }
14
+ }
15
+ }
16
+
17
+ .scrivito_gallery_widget_image_list {
18
+ list-style: none;
19
+ margin: 0 -5px 0;
20
+ padding: 0;
21
+ li {
22
+ margin: 10px 5px 0;
23
+ float: left;
24
+ opacity: 0.3;
25
+ img {
26
+ width: auto;
27
+ max-width: 100%;
28
+ height: 100px;
29
+ }
30
+ &.active {
31
+ opacity: 1.0;
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ class GalleryWidget < Widget
2
+ attribute :images, :referencelist, only: Image
3
+
4
+ attribute :show_description, :enum, values: ['Yes','No'], default: 'Yes'
5
+ attribute :activate_on, :enum, values: ['mouseenter','click'], default: 'click'
6
+
7
+ def show_description?
8
+ show_description == 'Yes'
9
+ end
10
+
11
+ def activate_method
12
+ activate_on.presence || 'click'
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ <%= scrivito_details_for t('scrivito_gallery_widget.details.images', default: 'Images') do %>
2
+ <%= scrivito_tag :div, widget, :images %>
3
+ <% end %>
4
+
5
+ <%= scrivito_details_for t('scrivito_gallery_widget.details.show_description', default: 'Show Description') do %>
6
+ <%= scrivito_tag :div, widget, :show_description %>
7
+ <% end %>
8
+
9
+ <%= scrivito_details_for t('scrivito_gallery_widget.details.activate_on', default: 'Activate On') do %>
10
+ <%= scrivito_tag :div, widget, :activate_on %>
11
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <div class="scrivito_gallery_widget">
2
+ <div class="scrivito_gallery_widget_area">
3
+ <% widget.images.each_with_index do |image, index|%>
4
+ <div class="<%= index == 0 ? 'active' : '' %>" id="image-gallery-<%= image.id %>">
5
+ <%= image_tag scrivito_path(image) %>
6
+ <% if widget.show_description? && lookup_context.find_all('image/_image_description').any? %>
7
+ <%= render partial: 'image/image_description', locals: {image: image} %>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
11
+ </div>
12
+
13
+ <ul class="scrivito_gallery_widget_image_list clearfix" data-image-activate-on="<%= widget.activate_method %>">
14
+ <% widget.images.each_with_index do |image, index|%>
15
+ <li class="<%= index == 0 ? 'active' : '' %>" data-image-gallery-target="#image-gallery-<%= image.id %>">
16
+ <%= image_tag scrivito_path(image.blob.transform({ width: 200, height: 100 })) %>
17
+ </li>
18
+ <% end %>
19
+ </ul>
20
+ </div>
@@ -0,0 +1,3 @@
1
+ <%= scrivito_thumbnail t('scrivito_gallery_widget.thumbnail.title', default: 'Gallery'), image_tag("widgets/scrivito_gallery_widget.png") do %>
2
+ <%= t('scrivito_gallery_widget.thumbnail.description', default: 'Insert an easy gallery to your page') %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ require "scrivito_gallery_widget/engine"
2
+
3
+ module ScrivitoGalleryWidget
4
+ end
@@ -0,0 +1,5 @@
1
+ module ScrivitoGalleryWidget
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ScrivitoGalleryWidget
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module ScrivitoGalleryWidget
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :scrivito_gallery_widget do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrivito_gallery_widget
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Scrivito
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: scrivito
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: A scrivito widget to add a simpple gallery.
28
+ email:
29
+ - support@scrivito.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE
35
+ - Rakefile
36
+ - app/assets/images/widgets/scrivito_gallery_widget.png
37
+ - app/assets/javascripts/scrivito_gallery_widget.js
38
+ - app/assets/stylesheets/scrivito_gallery_widget.scss
39
+ - app/models/gallery_widget.rb
40
+ - app/views/gallery_widget/details.html.erb
41
+ - app/views/gallery_widget/show.html.erb
42
+ - app/views/gallery_widget/thumbnail.html.erb
43
+ - lib/scrivito_gallery_widget.rb
44
+ - lib/scrivito_gallery_widget/engine.rb
45
+ - lib/scrivito_gallery_widget/version.rb
46
+ - lib/tasks/scrivito_gallery_widget_tasks.rake
47
+ homepage: https://www.scrivito.com
48
+ licenses:
49
+ - LGPL-3.0
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.4.5
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: A scrivito widget to add a simpple gallery.
71
+ test_files: []