Skip to content

Instantly share code, notes, and snippets.

View MittalPatel-BTC's full-sized avatar

Mittal Patel MittalPatel-BTC

View GitHub Profile
@MittalPatel-BTC
MittalPatel-BTC / defining_hash.rb
Created June 30, 2019 10:45
Ways of defining a hash
symbolic_hash = {a: 1, b: 2, c: 3}
string_hash = {"a" => 1, "b" => 2, "c" => 3}
@MittalPatel-BTC
MittalPatel-BTC / multiple_action.js
Created May 6, 2019 17:49
Paloma controller with multiple action in single file.
var ClientsController = Paloma.controller('Clients');
ClientsController.prototype.index = function(){
alert('This is the JS code for clients index action');
// logic goes here
};
ClientsController.prototype.show = function(){
alert('This is the JS code for clients show action');
// logic goes here
@MittalPatel-BTC
MittalPatel-BTC / app.js
Created May 6, 2019 17:47
Main application JS file
//= require paloma
//= require initializer
//= require page_specific/client/listing
@MittalPatel-BTC
MittalPatel-BTC / define_paloma_controller.js
Created May 6, 2019 17:46
Example of defining paloma controller.
Var ClientsController = Paloma.controller('Clients');
@MittalPatel-BTC
MittalPatel-BTC / admin_client_listing.js
Created May 6, 2019 17:44
Js for namespaced controller
var ClientsController = Paloma.controller('Admin/Clients');
ClientsController.prototype.index = function(){
alert('This is the JS code for admin clients index action');
};
@MittalPatel-BTC
MittalPatel-BTC / admin_clients_controller.rb
Created May 6, 2019 17:42
Admin client controller defines under admin namespace
class Admin::ClientsController < ApplicationController
def index
@clients = Client.all
end
end
@MittalPatel-BTC
MittalPatel-BTC / client_demo.js
Created May 6, 2019 17:40
Example of how to define Paloma controller and its action
var ClientsController = Paloma.controller('Clients');
ClientsController.prototype.index = function(){
// Call when client index action is fire
};
@MittalPatel-BTC
MittalPatel-BTC / application.js
Created May 6, 2019 17:37
Application JS file
//= require paloma
//= require initializer
@MittalPatel-BTC
MittalPatel-BTC / initializer.js
Created May 6, 2019 17:34
JS for starting paloma engine
$(document).ready( function(){
Paloma.engine.start();
});
@MittalPatel-BTC
MittalPatel-BTC / application.html.erb
Created May 6, 2019 17:33
Application layout file
<html>
<head>
<title>Rails Paloma Application</title>
</head>
<body>
<%= yield %>
<%= insert_paloma_hook %>
</body>
</html>