Skip to content

Instantly share code, notes, and snippets.

View Szeliga's full-sized avatar

Szymon Szeliga Szeliga

View GitHub Profile
def index
if stale?(:last_modified => @clients.maximum("updated_at"), :etag => @clients)
respond_with @clients.as_json(:methods => [:emails_count, :phones_count, :communications_count])
end
end
def show
if stale?(@client)
respond_with @client.to_json(:include => {
:emails => {:limit => 10},
clients = Client.limit(10)
clients.each do |client|
puts client.address.postcode
end
before_validation :set_default_time
def set_default_time
self.start_date ||= Time.now.beginning_of_day
self.end_date ||= Time.now.end_of_day
end
@Szeliga
Szeliga / gist:3532886
Created August 30, 2012 16:47
Client list bb index
class MasterCrm.Views.Organization.Index extends Backbone.View
initialize: ->
@collection = new MasterCrm.Collections.Users()
@collection.on("reset change", @render_collection, this)
@collection.on "add", @append_element, this
$.fancybox.showActivity()
@collection.fetch()
@render()
MyApp::Application.routes.draw do
root :to => "frontend#index"
namespace :api do
resources :users
resources :clients
end
match 'photos/:id' => 'photos#show'
end
@mixin table-base
th
text-align: center
font-weight: bold
td, th
padding: 2px
@mixin left($dist)
float: left
margin-left: $dist
<h1>PLAIN HTML</h1>
<div id="main_wrapper">
<div class="left_column">
<% if @clients.any? %>
<%= render @clients %>
<% else %>
No clients available
<% end %>
</div>
<div class="right_column">
%h1 HAML
#main_wrapper
.left_column
- if @clients.any?
= render @clients
- else
No clients available
.right_column= render :partial => “menu”