This file contains 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
<div id="display_box"> | |
<div id="projects-empty-nd" style="<%= @no_projects ? 'display:block' : 'display:none'%>"> | |
<div class="message"><p>Currently there are no projects</p></div> | |
</div> | |
<%= render :partial => 'project_state_group', :object => @active_projects, :locals => { :state => 'active'} %> | |
<%= render :partial => 'project_state_group', :object => @hidden_projects, :locals => { :state => 'hidden'} %> | |
<%= render :partial => 'project_state_group', :object => @completed_projects, :locals => { :state => 'completed'} %> | |
</div> | |
<% @project = @new_project -%> |
This file contains 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
<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> |
This file contains 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
class ProjectsController < ApplicationController | |
# TODO refactor these before filters, sometimes they do the same check multiple times | |
before_filter :login_required, :only => [:new, :create, :index, :edit, :update, :destroy] | |
before_filter :fetch_current_project, :except => [:new, :create, :index] | |
before_filter :owner_required, :except => [:new, :create, :index, :show] | |
def index | |
@projects = current_user.projects.paginate(:per_page => 10, :page => params[:page]) | |
end | |
This file contains 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
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 |
This file contains 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
<div title="Account signup" id="signupform" class="form"> | |
<% form_tag :action=> "create" do %> | |
<%= error_messages_for 'user' %><br/> | |
<%= render_flash %> | |
<h3><%= @heading -%></h3> | |
<table> |
This file contains 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
# 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] |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
#!/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', |