Skip to content

Instantly share code, notes, and snippets.

View diegorv's full-sized avatar

Diego Rossini diegorv

View GitHub Profile
status_message = 'Project saved'
page.notify :notice, status_message, 5.0
if @state_changed
page[dom_id(@project, 'container')].remove
page.insert_html :bottom, "list-#{@project.state}-projects", :partial => 'project_listing', :object => @project
else
page.replace_html dom_id(@project, 'container'), :partial => 'project_listing', :object => @project
end
page.sortable "list-#{@project.state}-projects", get_listing_sortable_options("list-#{@project.state}-projects")
page.replace_html "active-projects-count", @active_projects_count
<div title="Account signup" id="signupform" class="form">
<% form_tag :action=> "create" do %>
<%= error_messages_for 'user' %><br/>
<%= render_flash %>
<h3><%= @heading -%></h3>
<table>
<div id="left_col">
<% title "Your Projects" %>
<h1><%=h yield(:title) %></h1>
<% if @projects.empty? %>
<p>No projects yet. Click the button on the right to add one.</p>
<% else %>
<% for project in @projects %>
<div class="item <%= cycle('normal', 'alt') %>">
<h3><%= link_to h(project.name), project %> <span class="date">(Last Active on <%=h project.last_activity_at.strftime("%b, %d %Y at %I:%M %p") %>)</span></h3>
<p class="desc"><%= truncate(project.description, 255, '...').gsub(/\n/, '<br>') %></p>
# NOTE: We use "posts" for both forum topic posts and blog posts,
# There is some trickery to handle the two in a unified manner.
class PostsController < ApplicationController
include ApplicationHelper
include BlogsHelper
before_filter :login_required
before_filter :get_instance_vars
before_filter :check_blog_mismatch, :only => :show
before_filter :authorize_new, :only => [:create, :new]
class Forum < ActiveRecord::Base
attr_accessible :name, :description
has_many :topics, :order => "created_at DESC", :dependent => :destroy
has_many :posts, :through => :topics
validates_length_of :name, :maximum => 255, :allow_nil => true
validates_length_of :description, :maximum => 1000, :allow_nil => true
end
class Forum < ActiveRecord::Base
attr_accessible :name, :description
has_many :topics, :order => "created_at DESC", :dependent => :destroy
has_many :posts, :through => :topics
validates_length_of :name, :maximum => 255, :allow_nil => true
validates_length_of :description, :maximum => 1000, :allow_nil => true
end
class Forum < ActiveRecord::Base
attr_accessible :name, :description
has_many :topics, :order => "created_at DESC", :dependent => :destroy
has_many :posts, :through => :topics
validates_length_of :name, :maximum => 255, :allow_nil => true
validates_length_of :description, :maximum => 1000, :allow_nil => true
end
#!/usr/bin/env ruby
require 'rubygems'
require 'jabber/bot'
require "mysql"
# Create a public Jabber::Bot
bot = Jabber::Bot.new(
:name => "Robo",
:jabber_id => 'bot@dominio',
:password => 'eita',
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe "/employees/index.html.erb" do
include EmployeesHelper
before(:each) do
assigns[:employees] = [
stub_model(Employee,
:name => "name",
:cpf => "cpf",
<h1>Listing employees</h1>
<table>
<tr>
<th>Name</th>
<th>Cpf</th>
<th>Rg</th>
<th>Company entry</th>
<th>Company left</th>
<th>Salary</th>