cama_image_lightbox 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +33 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/plugins/cama_image_lightbox/jquery.magnific-popup.min.js +4 -0
- data/app/assets/stylesheets/plugins/cama_image_lightbox/magnific-popup.css +351 -0
- data/app/helpers/plugins/cama_image_lightbox/main_helper.rb +46 -0
- data/config/camaleon_plugin.json +18 -0
- data/config/initializers/custom_models.rb +5 -0
- data/config/routes.rb +27 -0
- data/lib/cama_image_lightbox.rb +5 -0
- data/lib/cama_image_lightbox/engine.rb +4 -0
- data/lib/cama_image_lightbox/version.rb +3 -0
- data/lib/tasks/cama_image_lightbox_tasks.rake +4 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 211113bd923a6b5941e804a31dde65edf2913a74
|
4
|
+
data.tar.gz: d63822deb6b9324cf2d7bfc95fdae6db997ff767
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 56140f79b64c6cecd39f245b6c9aa6544b966937d74ee56d4a38cbf9e352dceda2254f09b1dd36bf4670f2105c0aa1a13da2cefd253900b2615f46eca5a2b359
|
7
|
+
data.tar.gz: bb2875aab24b599fd068aa1cc7472341bbfcb53c2a76d92c316dd5f6363fbf84f5b017ee653a81e49f8e89fae81888d56b03743bd07499b7e62e333e8a6b722d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Owen Peredo
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# CamaImageLightbox
|
2
|
+
Camaleon CMS Plugin to show Images in Lightbox
|
3
|
+
|
4
|
+
![](screenshot.png)
|
5
|
+
![](screenshot2.png)
|
6
|
+
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
* Add this line to your application's Gemfile:
|
10
|
+
```ruby
|
11
|
+
gem 'cama_image_lightbox'
|
12
|
+
```
|
13
|
+
* Execute bash
|
14
|
+
```
|
15
|
+
bundle
|
16
|
+
```
|
17
|
+
* Go to admin -> plugins -> activate plugin
|
18
|
+
* Edit any content and use shortcodes like
|
19
|
+
- Custom content to Image:
|
20
|
+
```
|
21
|
+
[lightbox url="http://localhost:3000/media/1/learn_a_programming_language_step_24.jpg"][/lightbox]
|
22
|
+
```
|
23
|
+
- Imple text to image:
|
24
|
+
```
|
25
|
+
[lightbox url="http://localhost:3000/media/1/learn_a_programming_language_step_24.jpg" title="My Image"]
|
26
|
+
```
|
27
|
+
- Multiple images: Thumbnail is used the thumb generated by camalaeon cms on uploader
|
28
|
+
```
|
29
|
+
[lightbox images="http://localhost:3000/media/1/learn_a_programming_language_step_24.jpg,http://localhost:3000/media/1/learn_a_programming_language_step_24.jpg,http://localhost:3000/media/1/learn_a_programming_language_step_24.jpg"]
|
30
|
+
```
|
31
|
+
|
32
|
+
## License
|
33
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
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 = 'CamaImageLightbox'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! Magnific Popup - v1.1.0 - 2016-02-20
|
2
|
+
* http://dimsemenov.com/plugins/magnific-popup/
|
3
|
+
* Copyright (c) 2016 Dmitry Semenov; */
|
4
|
+
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isLowIE=b.isIE8=document.all&&!document.addEventListener,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",c.mainEl&&c.mainEl.length?b.ev=c.mainEl.eq(0):b.ev=d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.fixedContentPos?b.wrap.css({overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}):b.wrap.css({top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b.st.autoFocusLast&&b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=b.st[d]?b.st[d].markup:!1;y("FirstMarkupParse",f),f?b.currTemplate[d]=a(f):b.currTemplate[d]=!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||!(2===c.which||c.ctrlKey||c.metaKey||c.altKey||c.shiftKey)){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(c,d){if(void 0===d||d===!1)return!0;if(e=c.split("_"),e.length>1){var f=b.find(p+"-"+e[0]);if(f.length>0){var g=e[1];"replaceWith"===g?f[0]!==d[0]&&f.replaceWith(d):"img"===g?f.is("img")?f.attr("src",d):f.replaceWith(a("<img>").attr("src",d).attr("class",f.attr("class"))):f.attr(e[1],d)}}else b.find(p+"-"+c).html(d)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading...",autoFocusLast:!0}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery";return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s);e.click(function(){b.prev()}),f.click(function(){b.next()}),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),A()});
|
@@ -0,0 +1,351 @@
|
|
1
|
+
/* Magnific Popup CSS */
|
2
|
+
.mfp-bg {
|
3
|
+
top: 0;
|
4
|
+
left: 0;
|
5
|
+
width: 100%;
|
6
|
+
height: 100%;
|
7
|
+
z-index: 1042;
|
8
|
+
overflow: hidden;
|
9
|
+
position: fixed;
|
10
|
+
background: #0b0b0b;
|
11
|
+
opacity: 0.8; }
|
12
|
+
|
13
|
+
.mfp-wrap {
|
14
|
+
top: 0;
|
15
|
+
left: 0;
|
16
|
+
width: 100%;
|
17
|
+
height: 100%;
|
18
|
+
z-index: 1043;
|
19
|
+
position: fixed;
|
20
|
+
outline: none !important;
|
21
|
+
-webkit-backface-visibility: hidden; }
|
22
|
+
|
23
|
+
.mfp-container {
|
24
|
+
text-align: center;
|
25
|
+
position: absolute;
|
26
|
+
width: 100%;
|
27
|
+
height: 100%;
|
28
|
+
left: 0;
|
29
|
+
top: 0;
|
30
|
+
padding: 0 8px;
|
31
|
+
box-sizing: border-box; }
|
32
|
+
|
33
|
+
.mfp-container:before {
|
34
|
+
content: '';
|
35
|
+
display: inline-block;
|
36
|
+
height: 100%;
|
37
|
+
vertical-align: middle; }
|
38
|
+
|
39
|
+
.mfp-align-top .mfp-container:before {
|
40
|
+
display: none; }
|
41
|
+
|
42
|
+
.mfp-content {
|
43
|
+
position: relative;
|
44
|
+
display: inline-block;
|
45
|
+
vertical-align: middle;
|
46
|
+
margin: 0 auto;
|
47
|
+
text-align: left;
|
48
|
+
z-index: 1045; }
|
49
|
+
|
50
|
+
.mfp-inline-holder .mfp-content,
|
51
|
+
.mfp-ajax-holder .mfp-content {
|
52
|
+
width: 100%;
|
53
|
+
cursor: auto; }
|
54
|
+
|
55
|
+
.mfp-ajax-cur {
|
56
|
+
cursor: progress; }
|
57
|
+
|
58
|
+
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
59
|
+
cursor: -moz-zoom-out;
|
60
|
+
cursor: -webkit-zoom-out;
|
61
|
+
cursor: zoom-out; }
|
62
|
+
|
63
|
+
.mfp-zoom {
|
64
|
+
cursor: pointer;
|
65
|
+
cursor: -webkit-zoom-in;
|
66
|
+
cursor: -moz-zoom-in;
|
67
|
+
cursor: zoom-in; }
|
68
|
+
|
69
|
+
.mfp-auto-cursor .mfp-content {
|
70
|
+
cursor: auto; }
|
71
|
+
|
72
|
+
.mfp-close,
|
73
|
+
.mfp-arrow,
|
74
|
+
.mfp-preloader,
|
75
|
+
.mfp-counter {
|
76
|
+
-webkit-user-select: none;
|
77
|
+
-moz-user-select: none;
|
78
|
+
user-select: none; }
|
79
|
+
|
80
|
+
.mfp-loading.mfp-figure {
|
81
|
+
display: none; }
|
82
|
+
|
83
|
+
.mfp-hide {
|
84
|
+
display: none !important; }
|
85
|
+
|
86
|
+
.mfp-preloader {
|
87
|
+
color: #CCC;
|
88
|
+
position: absolute;
|
89
|
+
top: 50%;
|
90
|
+
width: auto;
|
91
|
+
text-align: center;
|
92
|
+
margin-top: -0.8em;
|
93
|
+
left: 8px;
|
94
|
+
right: 8px;
|
95
|
+
z-index: 1044; }
|
96
|
+
.mfp-preloader a {
|
97
|
+
color: #CCC; }
|
98
|
+
.mfp-preloader a:hover {
|
99
|
+
color: #FFF; }
|
100
|
+
|
101
|
+
.mfp-s-ready .mfp-preloader {
|
102
|
+
display: none; }
|
103
|
+
|
104
|
+
.mfp-s-error .mfp-content {
|
105
|
+
display: none; }
|
106
|
+
|
107
|
+
button.mfp-close,
|
108
|
+
button.mfp-arrow {
|
109
|
+
overflow: visible;
|
110
|
+
cursor: pointer;
|
111
|
+
background: transparent;
|
112
|
+
border: 0;
|
113
|
+
-webkit-appearance: none;
|
114
|
+
display: block;
|
115
|
+
outline: none;
|
116
|
+
padding: 0;
|
117
|
+
z-index: 1046;
|
118
|
+
box-shadow: none;
|
119
|
+
touch-action: manipulation; }
|
120
|
+
|
121
|
+
button::-moz-focus-inner {
|
122
|
+
padding: 0;
|
123
|
+
border: 0; }
|
124
|
+
|
125
|
+
.mfp-close {
|
126
|
+
width: 44px;
|
127
|
+
height: 44px;
|
128
|
+
line-height: 44px;
|
129
|
+
position: absolute;
|
130
|
+
right: 0;
|
131
|
+
top: 0;
|
132
|
+
text-decoration: none;
|
133
|
+
text-align: center;
|
134
|
+
opacity: 0.65;
|
135
|
+
padding: 0 0 18px 10px;
|
136
|
+
color: #FFF;
|
137
|
+
font-style: normal;
|
138
|
+
font-size: 28px;
|
139
|
+
font-family: Arial, Baskerville, monospace; }
|
140
|
+
.mfp-close:hover,
|
141
|
+
.mfp-close:focus {
|
142
|
+
opacity: 1; }
|
143
|
+
.mfp-close:active {
|
144
|
+
top: 1px; }
|
145
|
+
|
146
|
+
.mfp-close-btn-in .mfp-close {
|
147
|
+
color: #333; }
|
148
|
+
|
149
|
+
.mfp-image-holder .mfp-close,
|
150
|
+
.mfp-iframe-holder .mfp-close {
|
151
|
+
color: #FFF;
|
152
|
+
right: -6px;
|
153
|
+
text-align: right;
|
154
|
+
padding-right: 6px;
|
155
|
+
width: 100%; }
|
156
|
+
|
157
|
+
.mfp-counter {
|
158
|
+
position: absolute;
|
159
|
+
top: 0;
|
160
|
+
right: 0;
|
161
|
+
color: #CCC;
|
162
|
+
font-size: 12px;
|
163
|
+
line-height: 18px;
|
164
|
+
white-space: nowrap; }
|
165
|
+
|
166
|
+
.mfp-arrow {
|
167
|
+
position: absolute;
|
168
|
+
opacity: 0.65;
|
169
|
+
margin: 0;
|
170
|
+
top: 50%;
|
171
|
+
margin-top: -55px;
|
172
|
+
padding: 0;
|
173
|
+
width: 90px;
|
174
|
+
height: 110px;
|
175
|
+
-webkit-tap-highlight-color: transparent; }
|
176
|
+
.mfp-arrow:active {
|
177
|
+
margin-top: -54px; }
|
178
|
+
.mfp-arrow:hover,
|
179
|
+
.mfp-arrow:focus {
|
180
|
+
opacity: 1; }
|
181
|
+
.mfp-arrow:before,
|
182
|
+
.mfp-arrow:after {
|
183
|
+
content: '';
|
184
|
+
display: block;
|
185
|
+
width: 0;
|
186
|
+
height: 0;
|
187
|
+
position: absolute;
|
188
|
+
left: 0;
|
189
|
+
top: 0;
|
190
|
+
margin-top: 35px;
|
191
|
+
margin-left: 35px;
|
192
|
+
border: medium inset transparent; }
|
193
|
+
.mfp-arrow:after {
|
194
|
+
border-top-width: 13px;
|
195
|
+
border-bottom-width: 13px;
|
196
|
+
top: 8px; }
|
197
|
+
.mfp-arrow:before {
|
198
|
+
border-top-width: 21px;
|
199
|
+
border-bottom-width: 21px;
|
200
|
+
opacity: 0.7; }
|
201
|
+
|
202
|
+
.mfp-arrow-left {
|
203
|
+
left: 0; }
|
204
|
+
.mfp-arrow-left:after {
|
205
|
+
border-right: 17px solid #FFF;
|
206
|
+
margin-left: 31px; }
|
207
|
+
.mfp-arrow-left:before {
|
208
|
+
margin-left: 25px;
|
209
|
+
border-right: 27px solid #3F3F3F; }
|
210
|
+
|
211
|
+
.mfp-arrow-right {
|
212
|
+
right: 0; }
|
213
|
+
.mfp-arrow-right:after {
|
214
|
+
border-left: 17px solid #FFF;
|
215
|
+
margin-left: 39px; }
|
216
|
+
.mfp-arrow-right:before {
|
217
|
+
border-left: 27px solid #3F3F3F; }
|
218
|
+
|
219
|
+
.mfp-iframe-holder {
|
220
|
+
padding-top: 40px;
|
221
|
+
padding-bottom: 40px; }
|
222
|
+
.mfp-iframe-holder .mfp-content {
|
223
|
+
line-height: 0;
|
224
|
+
width: 100%;
|
225
|
+
max-width: 900px; }
|
226
|
+
.mfp-iframe-holder .mfp-close {
|
227
|
+
top: -40px; }
|
228
|
+
|
229
|
+
.mfp-iframe-scaler {
|
230
|
+
width: 100%;
|
231
|
+
height: 0;
|
232
|
+
overflow: hidden;
|
233
|
+
padding-top: 56.25%; }
|
234
|
+
.mfp-iframe-scaler iframe {
|
235
|
+
position: absolute;
|
236
|
+
display: block;
|
237
|
+
top: 0;
|
238
|
+
left: 0;
|
239
|
+
width: 100%;
|
240
|
+
height: 100%;
|
241
|
+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
242
|
+
background: #000; }
|
243
|
+
|
244
|
+
/* Main image in popup */
|
245
|
+
img.mfp-img {
|
246
|
+
width: auto;
|
247
|
+
max-width: 100%;
|
248
|
+
height: auto;
|
249
|
+
display: block;
|
250
|
+
line-height: 0;
|
251
|
+
box-sizing: border-box;
|
252
|
+
padding: 40px 0 40px;
|
253
|
+
margin: 0 auto; }
|
254
|
+
|
255
|
+
/* The shadow behind the image */
|
256
|
+
.mfp-figure {
|
257
|
+
line-height: 0; }
|
258
|
+
.mfp-figure:after {
|
259
|
+
content: '';
|
260
|
+
position: absolute;
|
261
|
+
left: 0;
|
262
|
+
top: 40px;
|
263
|
+
bottom: 40px;
|
264
|
+
display: block;
|
265
|
+
right: 0;
|
266
|
+
width: auto;
|
267
|
+
height: auto;
|
268
|
+
z-index: -1;
|
269
|
+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
270
|
+
background: #444; }
|
271
|
+
.mfp-figure small {
|
272
|
+
color: #BDBDBD;
|
273
|
+
display: block;
|
274
|
+
font-size: 12px;
|
275
|
+
line-height: 14px; }
|
276
|
+
.mfp-figure figure {
|
277
|
+
margin: 0; }
|
278
|
+
|
279
|
+
.mfp-bottom-bar {
|
280
|
+
margin-top: -36px;
|
281
|
+
position: absolute;
|
282
|
+
top: 100%;
|
283
|
+
left: 0;
|
284
|
+
width: 100%;
|
285
|
+
cursor: auto; }
|
286
|
+
|
287
|
+
.mfp-title {
|
288
|
+
text-align: left;
|
289
|
+
line-height: 18px;
|
290
|
+
color: #F3F3F3;
|
291
|
+
word-wrap: break-word;
|
292
|
+
padding-right: 36px; }
|
293
|
+
|
294
|
+
.mfp-image-holder .mfp-content {
|
295
|
+
max-width: 100%; }
|
296
|
+
|
297
|
+
.mfp-gallery .mfp-image-holder .mfp-figure {
|
298
|
+
cursor: pointer; }
|
299
|
+
|
300
|
+
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
301
|
+
/**
|
302
|
+
* Remove all paddings around the image on small screen
|
303
|
+
*/
|
304
|
+
.mfp-img-mobile .mfp-image-holder {
|
305
|
+
padding-left: 0;
|
306
|
+
padding-right: 0; }
|
307
|
+
.mfp-img-mobile img.mfp-img {
|
308
|
+
padding: 0; }
|
309
|
+
.mfp-img-mobile .mfp-figure:after {
|
310
|
+
top: 0;
|
311
|
+
bottom: 0; }
|
312
|
+
.mfp-img-mobile .mfp-figure small {
|
313
|
+
display: inline;
|
314
|
+
margin-left: 5px; }
|
315
|
+
.mfp-img-mobile .mfp-bottom-bar {
|
316
|
+
background: rgba(0, 0, 0, 0.6);
|
317
|
+
bottom: 0;
|
318
|
+
margin: 0;
|
319
|
+
top: auto;
|
320
|
+
padding: 3px 5px;
|
321
|
+
position: fixed;
|
322
|
+
box-sizing: border-box; }
|
323
|
+
.mfp-img-mobile .mfp-bottom-bar:empty {
|
324
|
+
padding: 0; }
|
325
|
+
.mfp-img-mobile .mfp-counter {
|
326
|
+
right: 5px;
|
327
|
+
top: 3px; }
|
328
|
+
.mfp-img-mobile .mfp-close {
|
329
|
+
top: 0;
|
330
|
+
right: 0;
|
331
|
+
width: 35px;
|
332
|
+
height: 35px;
|
333
|
+
line-height: 35px;
|
334
|
+
background: rgba(0, 0, 0, 0.6);
|
335
|
+
position: fixed;
|
336
|
+
text-align: center;
|
337
|
+
padding: 0; } }
|
338
|
+
|
339
|
+
@media all and (max-width: 900px) {
|
340
|
+
.mfp-arrow {
|
341
|
+
-webkit-transform: scale(0.75);
|
342
|
+
transform: scale(0.75); }
|
343
|
+
.mfp-arrow-left {
|
344
|
+
-webkit-transform-origin: 0;
|
345
|
+
transform-origin: 0; }
|
346
|
+
.mfp-arrow-right {
|
347
|
+
-webkit-transform-origin: 100%;
|
348
|
+
transform-origin: 100%; }
|
349
|
+
.mfp-container {
|
350
|
+
padding-left: 6px;
|
351
|
+
padding-right: 6px; } }
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Plugins::CamaImageLightbox::MainHelper
|
2
|
+
def self.included(klass)
|
3
|
+
# klass.helper_method [:my_helper_method] rescue "" # here your methods accessible from views
|
4
|
+
end
|
5
|
+
|
6
|
+
# here all actions on going to active
|
7
|
+
# you can run sql commands like this:
|
8
|
+
# results = ActiveRecord::Base.connection.execute(query);
|
9
|
+
# plugin: plugin model
|
10
|
+
def cama_image_lightbox_on_active(plugin)
|
11
|
+
end
|
12
|
+
|
13
|
+
# here all actions on going to inactive
|
14
|
+
# plugin: plugin model
|
15
|
+
def cama_image_lightbox_on_inactive(plugin)
|
16
|
+
end
|
17
|
+
|
18
|
+
# here all actions to upgrade for a new version
|
19
|
+
# plugin: plugin model
|
20
|
+
def cama_image_lightbox_on_upgrade(plugin)
|
21
|
+
end
|
22
|
+
|
23
|
+
def cama_image_lightbox_before_app
|
24
|
+
shortcode_add("lightbox", lambda{|attrs, args|
|
25
|
+
@_lightbox_counter ||= 1
|
26
|
+
id = "lightbox_shortcode_#{@_lightbox_counter}"
|
27
|
+
append_asset_libraries({"lightbox"=>{js: [plugin_asset("jquery.magnific-popup.min")], css: [plugin_asset('magnific-popup')] } })
|
28
|
+
if attrs['images']
|
29
|
+
res = "<div id='#{id}' class='shortcode_lightbox_w'>"
|
30
|
+
attrs['images'].split(',').each do |img|
|
31
|
+
res << "<a href='#{img}'><img src='#{img.cama_parse_image_version}'></a>"
|
32
|
+
end
|
33
|
+
res << '</div>'
|
34
|
+
res << "<script>jQuery(function(){ $('##{id}').magnificPopup({delegate: 'a', type: 'image', gallery:{enabled: true}}); })</script>"
|
35
|
+
else
|
36
|
+
res = "<a class='shortcode_lightbox' id='lightbox_shortcode_#{@_lightbox_counter}' href='#{attrs['url']}'>#{args[:shortcode_content] || attrs['title'] }</a>"
|
37
|
+
res << "<script>jQuery(function(){ $('##{id}').magnificPopup({type: 'image'}); })</script>"
|
38
|
+
end
|
39
|
+
@_lightbox_counter += 1
|
40
|
+
res
|
41
|
+
}, 'Render a lightbox image to open in a magnific popup, sample:
|
42
|
+
[lightbox url="http://camaleon.tuzitio.com/"]<img alt="" src="http://....">[/lightbox] Or
|
43
|
+
[lightbox url="http://camaleon.tuzitio.com/" title="My Link"] Or
|
44
|
+
[lightbox images="http://camaleon.tuzitio.com/"]')
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"title": "Cama Image Lightbox",
|
3
|
+
"descr": "",
|
4
|
+
"key": "cama_image_lightbox", // must be the name of the folder of your plugin, sample: app/views/plugins/<my_plugin> ==> 'my_plugin'
|
5
|
+
"helpers": [
|
6
|
+
"Plugins::CamaImageLightbox::MainHelper"
|
7
|
+
],
|
8
|
+
"hooks": {
|
9
|
+
"on_active": [
|
10
|
+
"cama_image_lightbox_on_active"
|
11
|
+
],
|
12
|
+
"on_inactive": [
|
13
|
+
"cama_image_lightbox_on_inactive"
|
14
|
+
],
|
15
|
+
"app_before_load": ["cama_image_lightbox_before_app"]
|
16
|
+
//here you can add all your hooks (read documentation)
|
17
|
+
}
|
18
|
+
}
|
data/config/routes.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
scope PluginRoutes.system_info["relative_url_root"] do
|
4
|
+
scope '(:locale)', locale: /#{PluginRoutes.all_locales}/, :defaults => { } do
|
5
|
+
# frontend
|
6
|
+
namespace :plugins do
|
7
|
+
namespace 'cama_image_lightbox' do
|
8
|
+
get 'index' => 'front#index'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
#Admin Panel
|
14
|
+
scope :admin, as: 'admin', path: PluginRoutes.system_info['admin_path_name'] do
|
15
|
+
namespace 'plugins' do
|
16
|
+
namespace 'cama_image_lightbox' do
|
17
|
+
get 'index' => 'admin#index'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# main routes
|
23
|
+
#scope 'cama_image_lightbox', module: 'plugins/cama_image_lightbox/', as: 'cama_image_lightbox' do
|
24
|
+
# Here my routes for main routes
|
25
|
+
#end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cama_image_lightbox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Owen Peredo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Camaleon CMS Plugin to display images in popup.
|
42
|
+
email:
|
43
|
+
- owenperedo@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- app/assets/javascripts/plugins/cama_image_lightbox/jquery.magnific-popup.min.js
|
52
|
+
- app/assets/stylesheets/plugins/cama_image_lightbox/magnific-popup.css
|
53
|
+
- app/helpers/plugins/cama_image_lightbox/main_helper.rb
|
54
|
+
- config/camaleon_plugin.json
|
55
|
+
- config/initializers/custom_models.rb
|
56
|
+
- config/routes.rb
|
57
|
+
- lib/cama_image_lightbox.rb
|
58
|
+
- lib/cama_image_lightbox/engine.rb
|
59
|
+
- lib/cama_image_lightbox/version.rb
|
60
|
+
- lib/tasks/cama_image_lightbox_tasks.rake
|
61
|
+
homepage: ''
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.4.8
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Camaleon CMS Plugin to display images in popup.
|
85
|
+
test_files: []
|
86
|
+
has_rdoc:
|