Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('button').click(function(e) { $('input.sel').val(this.name); }
- def body_page_name
- [controller_name.classify.pluralize, action_name.classify].join
- end
- %body{data: {page: body_page_name}}
- $(function() {
- var page = $("body").data("page");
- if("object" === typeof window[page])
- window[page].init();
- });
- var TicketsShow = new function() {
- var self = this;
- self.init = function() {
- // code which may call other functions in self
- };
- };
- <body data-controller="<%= controller.controller_name %>"
- data-action="<%= controller.action_name %>" >
- $(document).ready(function() {
- if($('body').data('controller')=='stories') {
- $('.story').click(function(e) {
- var u=$(this).data('url');
- u && (document.location=u);
- });
- }
- });
- <body class='page1'>
- $('.page1 button').click(function(e) { $('input.sel').val(this.name); }
- module ApplicationHelper
- def body_attributes
- controller = params[:controller].gsub('/', ' ')
- action = params[:action]
- version = @version ? "version_#{@version}" : nil
- {
- class: ([controller, action, version] - [nil]).join(' ')
- }
- end
- end
- !!! 5
- %html
- %head
- ...
- %body{body_attributes}
- $(function () {
- if ($('body.pledge.new, body.pledge.create').length > 0) {
- // do work here...
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement