Skip to content

Instantly share code, notes, and snippets.

View jamesbebbington's full-sized avatar

James Bebbington jamesbebbington

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>jTable 0.0.1 - A jTree hack-job proof-of-concept</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
Looking for a CMS for a simple site that incorporates a blog. It should:
* Be PHP (a client requirement)
* Allow me to create a custom theme using my text editor. Cutting and pasting into DB-backed admin interface can go fuck itself.
* Allow for pretty URL routing schemes.
* Have a half decent templating system; nested templates please, one basic site layout with partial templates injected into it.
Shortlist:
* Wordpress
Processing Admin::SnippetsController#update (for 127.0.0.1 at 2009-02-18 12:45:22) [PUT]
Session ID: BAh7CToMY3NyZl9pZCIlODE3YTYwYTQzOWQ3NjIyYjY0MGYzYWEyMzViYzdk
NDM6DnJldHVybl90bzAiDHVzZXJfaWRpBiIKZmxhc2hJQzonQWN0aW9uQ29u
dHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--865f4e6789be806e7d073e726a3e70bfa85348ea
Parameters: {"commit"=>"Save Changes", "action"=>"update", "_method"=>"put", "authenticity_token"=>"0a179689c71ca13ea61ef966c3cea238ecc0a3ad", "id"=>"6", "controller"=>"admin/snippets", "snippet"=>{"name"=>"comment_form", "filter_id"=>"", "lock_version"=>"0", "content"=>"<r:page>\r\n <r:if_enable_comments>\r\n\r\n <r:comments:form>\r\n <%= ir_tag :h2, 'Add a comment', :type => :blocked %>\r\n <r:error>\r\n <p class=\"error\">Please correct the errors below.</p>\r\n </r:error>\r\n <fieldset>\r\n <p>\r\n <label for=\"comment[author]\">Your name:</label>\r\n <r:error on=\"author\"><span class=\"error\">Name <r:message /></span></r:error>
@projects = current_account.projects.find(:all, :include => [:owner, :current_phase]) do
case params[:state] ||= 'active'
when 'all': # No-op
when 'active': archived_at.nil?
when 'inactive': archived_at.not.nil?
end
end
# Controller
@filters = {
:states => %w{active inactive all},
:owners => current_account.users,
:organisations => current_account.organisations,
}
# View
- form_tag projects_path, :method => :get, :id => 'filters' do
%h2 Customise view
Running Integration Spec Task
.......................................F................F.................................................-----...---...------...------...------..----...........----...----.......----...---....------....................................
(::) failed steps (::)
expected: /Under Construction/m,
got: "" (using =~)
Diff:
@@ -1,2 +1,2 @@
-/Under Construction/m
Running Models Spec Task
...........................................................................................................................................................................................................................................
1)
'Page#find_by_url should find a custom file not found page' FAILED
expected: #<CustomFileNotFoundPage id: 444134792, title: "No Picture", slug: "no-picture", breadcrumb: "No Picture", class_name: "CustomFileNotFoundPage", status_id: 100, parent_id: 222566307, layout_id: nil, created_at: "2009-05-07 10:01:07", updated_at: "2009-05-07 10:01:07", published_at: "2009-05-07 11:01:07", created_by_id: nil, updated_by_id: nil, virtual: false, lock_version: 0, description: nil, keywords: nil>,
got: #<FileNotFoundPage id: 30993517, title: "File Not Found", slug: "missing", breadcrumb: "File Not Found", class_name: "FileNotFoundPage", status_id: 100, parent_id: 516519628, layout_id: nil, created_at: "2009-05-07 10:01:07", updated_at: "2009-05-07 10:01:07"
module ApplicationHelper
# Why is this a helper - should be method in User model
def get_name(first_name, last_name, middle_name)
full_name = "" # Why's this here? It's never used
if middle_name != "" && last_name != "" && first_name != "" then # Doesn't handle nils
return first_name + " " + middle_name + " " + last_name
# Ruby intrinsically returns, idomatic ruby coder wouldn't bother with return
end
if last_name != "" && first_name != "" then
# Conditional statments both overly verbose, fragile (doesn't handle all cases - what if validation changes and we don't require a last_name - method then returns nothing useful)
# Works:
require 'test_helper'
class RootControllerTest < ActionController::TestCase
setup :activate_authlogic
context "A User" do
setup do
require 'roleful'
@klass = Class.new do
attr_reader :role
def initialize(*role)
@role = role.empty? ? :null : role
end
include Roleful
end
user = @klass.new(:debugulator)