Last active
September 19, 2015 08:06
-
-
Save AttyC/12f0267048cd7f6b1f57 to your computer and use it in GitHub Desktop.
Add Lettering.js plugin to Rails app
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Workspace</title> | |
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> | |
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> | |
<script>Stripe.setPublishableKey("<%= Rails.configuration.stripe[:publishable_key] %>");</script> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<nav class="navbar navbar-fixed-top" id="nav" role="navigation"> | |
<div class="container-fluid"> | |
<div class="navbar-header"> | |
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> | |
<span class="sr-only">Toggle navigation</span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</button> | |
<% if user_signed_in? %> | |
<li> | |
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %> | |
</li> | |
<% else %> | |
<li> | |
<%= link_to('Login', new_user_session_path ) %> | |
</li> | |
<% end %> | |
</div> | |
<%= form_tag("/products", method: "get", :class => 'search pull-right') do %> | |
<%= label_tag(:q, "Search for:") %> | |
<%= text_field_tag(:q) %> | |
<% submit_tag("Search") %> | |
<% end %> | |
<div class="navbar-collapse collapse" id="myScrollSpy"> | |
<ul class="navbar-nav nav"> | |
<li><%= link_to 'Home', root_path %></li> | |
<li><%= link_to 'Products', products_path %></li> | |
<li><%= link_to 'Orders', orders_path %></li> | |
<li><%= link_to 'Contact', contact_path %></li> | |
</ul> | |
</div><!--end navbar collapse --> | |
</div><!--end navbar container--> | |
</nav> | |
<h1>Tots' Music Shop</h1> | |
<h2>Buy musical instruments and props</h2> | |
<p class="notice"><%= notice %></p> | |
<p class="alert"><%= alert %></p> | |
<%= yield %> | |
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> | |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> | |
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> | |
<script type="text/javascript" src="https://js.stripe.com/v2/"></script> | |
</body> | |
</html> |
This file contains hidden or 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
// This is a manifest file that'll be compiled into application.js, which will include all the files | |
// listed below. | |
// | |
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | |
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. | |
// | |
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | |
// compiled file. | |
// | |
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details | |
// about supported directives. | |
// | |
//= require jquery | |
//= require jquery_ujs | |
//= require turbolinks | |
//= require jquery.lettering-0.6.1.min | |
//= require_tree . | |
This file contains hidden or 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
<h1 class="fancy_title">Some Title</h1> | |
<h3>Featured Product</h3> | |
<h4><%= @featured_product.name %></h4> | |
<p><%= @featured_product.description %></p> | |
<%= image_tag @featured_product.image_url, alt: @featured_product.description, width: "300px" %> | |
This file contains hidden or 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
/* Lettering.JS 0.6.1 by Dave Rupert - http://daverupert.com */ | |
(function($){function injector(t,splitter,klass,after){var a=t.text().split(splitter),inject='';if(a.length){$(a).each(function(i,item){inject+='<span class="'+klass+(i+1)+'">'+item+'</span>'+after});t.empty().append(inject)}}var methods={init:function(){return this.each(function(){injector($(this),'','char','')})},words:function(){return this.each(function(){injector($(this),' ','word',' ')})},lines:function(){return this.each(function(){var r="eefec303079ad17405c889e092e105b0";injector($(this).children("br").replaceWith(r).end(),r,'line','')})}};$.fn.lettering=function(method){if(method&&methods[method]){return methods[method].apply(this,[].slice.call(arguments,1))}else if(method==='letters'||!method){return methods.init.apply(this,[].slice.call(arguments,0))}$.error('Method '+method+' does not exist on jQuery.lettering');return this}})(jQuery); |
This file contains hidden or 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
$(document).on('ready page:load', function(){ | |
/*$('.rating').raty( { path: '/assets', scoreName: 'comment[rating]'} );*/ | |
$('.rated').raty( { path: '/assets', | |
readOnly: true, | |
score: function() { | |
return $(this).attr('data-score'); | |
} | |
}); | |
$('.banner').unslider(); | |
$(".fancy_title").lettering(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment