Last active
October 4, 2015 04:48
-
-
Save wvuwebgist/2580219 to your computer and use it in GitHub Desktop.
Flexslider for SlateCMS, v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Stylesheet for flexslider --> | |
<link rel="stylesheet" href="/themes/shared/flexslider/stylesheets/flexslider.2.1.css" /> <!-- Either reference the shared folder, or you may copy and paste these into your stylesheets. We recommend overriding styles with new rules instead of directly editing the rules in this stylesheet. This allows for easy upgrades later. --> | |
<!--====================================================== | |
The markup and call for images for Flexslider are determined by _gallery.rhtml | |
==========================================================--> | |
<!-- FlexSlider scripts --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script>window.jQuery || document.write('<script src="/themes/shared/javascripts/jquery-1.10.2.min.js"><\/script>')</script> | |
<script src="/themes/shared/flexslider/js/jquery.flexslider.2.1.min.js"></script> <!-- being sure to reference the shared folder --> | |
<script> | |
$(window).load(function() { | |
$('.flexslider').flexslider(); // customize this to fit your needs, docs @ http://www.woothemes.com/flexslider/ , examples of customization: http://pastie.org/8640169 | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# Customize this file to meet your needs and place in /yourtheme/snippets/collection. You will have to create those folders. %> | |
<div class="flexslider"> | |
<ul class="slides"> | |
<% for r in @resources -%> | |
<%# default setup: link image to location in gallery %> | |
<%# url, options = public_resource_url(r, @collection), {} -%> | |
<%# if url is the only thing in slate's description field for image properties, link entire image to that url %> | |
<% url, options = r.description, {} -%> | |
<%# if the description contains more then a url and has a div id of "url", do more fancy stuff. eg: <div id="url" style="display:none;">http://example.com</div> . | |
# Falls back to image gallery if there is no URL in slate's description field | |
%> | |
<%# description = Hpricot(r.description) %> | |
<%# url = (description/"#url").inner_html %> | |
<%# if url.blank? %> | |
<%# url = public_resource_url(r, @collection) %> | |
<%# end %> | |
<%# options = {} %> | |
<%# set up snippet for editable region. size will default to original unless otherwise specified. %> | |
<li><%= link_to resource_image(r, snippet_params[:size] || 'orig'), url, options -%> | |
<%# Standard set up to print a caption via description field. Still needs default setup. %> | |
<!-- <div class="flex-caption"> | |
<%#= content_tag('h2', r.name ) -%> | |
<%# unless r.description.blank? -%> | |
<%#= content_tag('p', r.description) -%> | |
<%# end -%> | |
</div> --> | |
</li> | |
<% end -%> | |
</ul> | |
</div><!-- /.flexslider --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ Collection.gallery collection_id=5579, template="gallery" }} | |
comment. Change the collection id to your set id/number in Slate. template="gallery" is required in order to reference your customized _gallery.rhtml file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment