OneAim Content Management Released

Angelegt von suung Tue, 19 Apr 2011 20:31:00 GMT

Finally I released the Content Management used on OneAim.

OneAim is the following:

a) There is one aim

b) Projects having that one aim can be open or finished.

Great, what?
 

As the time goes by and the project becomes more and more old (Rails 2) I release it. 

https://github.com/suung/oneaim

Ruby meets Javascript - and the AJAX Server

Angelegt von suung Tue, 23 Nov 2010 15:57:00 GMT

I even stole the title of the article but i would appreciate if someone would take a closer look on that tool.

It's created by a group around the Mechanize - developer and aims to bring Javascript and Ruby code together - using Jaxer

 

Well, i guess it;s the thing.

Refactoring Redmine to be more agile and ajaxified

Angelegt von suung Mon, 27 Sep 2010 14:38:00 GMT

I did some redmine tweaking this weekend.

The goal was, to make it more agile. Agile in this terms means:

  • You can list issues, that follow each other easily
  • You need much less clicks, to get an overview over issue details and look into them, while browsing
  • You can add and edit (sub) issues inline

I think these are main goals, people address in plugins now or not at all.

I came up with some mayor changes, that should be done in core redmine, to fit my needs:

1) Pack Views into helpers and partials

I want to be able to toggle through single sections if my issue - create flow.
Therefore i created some helpers, that added divs and toggle - links with Javascript around the specific section (.e.g. in issues/show)

Doing this, i saw, that redmine is amazingly unflexible here. You even get problems toggling single sections, because of cascaded divs that have been added there just for design purpose (the background color of some parts of the issue and such)

So the tasks would be:

  • move sections into partials
  • wrap everything into sections

2) Make Controllers AJAX-agnostic

Take Redmine and try to render issues/show or issues/new in a modalbox via AJAX.
It works, most controllers contain a block like this:

respond_to do |format|

  format.html {#normal render behaviour}
  format.js {#render some attributes partial}

end

But
a) not every action has this block
b) it sometimes doesn't do, what you actually want to do.

If you want to render any action via xhr, you need two things to do:

a) skip the layout on xhr - requests

b) change the return - to behaviour slightly, to pass redirect_to or return_to.

Why the latter is needed - take a look at this example:

  1. You create an issue in an inline div.
  2. After you created the div, it should NOT redirect to issues show.
  3. Instead ideally it would know, where you have been and render only a bit of javascript, that magically loads the right row in some table.
  4. The same for error handling

So what is to do:

  • Also with the goal to be compatible with new Rails 3 goodness (responds_with...): Remove all respond_to - blocks and replace them with a Responder, that can handle those things.
  • Replace all links, that should be UI-context agnostic to pass parameters for redirect_to and others

Go with a plugin!

Plugins could do this as well (and we will come up with some plugins, eventually) but the problem is:

To add some simple line of code to let's say every action of your Issues-Controller would require
a) a hook at every place, where you want to do that
b) to copy the whole controller into your plugin (which likely is not compatible with others!)

One of the great things in Redmine is the list of hooks. Hooks are a way to inject code at exactly one single position.
A hook can for example add things to the bottom of the issue_details_list

in the code it looks similar to this:

call_hook(:issue_details_bottom) # or so

I will be about to paste a complete list of hooks soon.
Sadly, this pattern is not followed consequently enough.
A plugin can only be as good, as the positions for the hooks are chosen.
According to the above suggested refactorings, I would recommend:
  1. Go through controllers and views
  2. Create a ViewHook for every (now toggable and named) section in the view
  3. Create a hook for the corresponding Responder (or block, that responds to the browser) in the controllers.

 

Refactoring Redmine

Redmine is about to become really great. The code base is not lacking of basic principles. And even if you try to add more complex logic, than you see realized in redmine, you will find some methods, already prepared for or partially supporting your goal.
 
Eric Davis wrote a book about Refactoring Redmine. Will read it and review.

Observing Dynamically loaded Elements with jQuery and Prototype

Angelegt von andi Mon, 09 Aug 2010 20:18:00 GMT

Both jquery and Prototype make it easy to attach Observers to dynamically loaded dom elements.

In Prototype:

document.observe('click', function(e, el) {
  if (el = e.findElement('.foo')) {
    // bar
  }
});

while in jQuery live does the job:

$(".foo").live("click", function(e) {
   // bar
});

Damn old (and somehow good) articles on Ruby and Rails at O'Reilly

Angelegt von suung Tue, 20 Jul 2010 09:48:00 GMT

Because nobody mentioned them here before,

there is a long list of very old articles on Ruby and Rails at O'Reilly.

Though they are old, they are kind of worth a look for newbies:

 

The long list


Rolling with Ruby on Rails, January 20, 2005

Rolling with Ruby on Rails, Part 2, March 3, 2005

Rolling with Ruby on Rails Revisited, December 14, 2006

Rolling with Ruby on Rails Revisited, Part 2, January 5, 2007

Cookin' With Ruby on Rails, May 17, 2007

Cookin' with Ruby on Rails - Designing for Testability, June 28, 2007

Cookin' with Ruby on Rails - More Designing for Testability, July 28, 2007

Understanding ActiveRecord: A Gentle Introduction to the Heart of Rails (Part 1), April 19, 2007

Understanding ActiveRecord: A Gentle Introduction to the Heart of Rails (Part 2), May 10, 2007

Rails Testing: Not Just for the Paranoid, June 7, 2007

Ruby on Rails Meets Eclipse, April 26, 2007 (BAH!, use emacs!)

Bringing Ruby on Rails with FastCGI into Mac OS X Server, March 29, 2007 (sounds horrible)

Hacking Asterisk and Rails with RAGI, December 19, 2005 (interesting!)

What Is Ruby on Rails, October 13, 2005

Ruby on Rails: An Interview with David Heinemeier Hansson, August 30, 2005

Ajax on Rails, June 9, 2005

Behavior Driven Development Using Ruby (Part 1), August 9, 2007

Behavior Driven Development Using Ruby (Part 2), August 30, 2007

Behavior Driven Development Using Ruby (Part 3), September 20, 2007

How to Build Simple Console Apps with Ruby and ActiveRecord, June 21, 2007

Replacing AppleScript with Ruby, February 27, 2007

 

Ruby the Rival, November 16, 2005 ("What's wrong with Java")

Extending Ruby with C, November 18, 2004

An Introduction to RubyCocoa, Part 1, October 5, 2004

An Introduction to RubyCocoa, Part 2, October 12, 2004

Exploring E4X with Ruby, August 12, 2004

Ruby/Tk Primer: Creating a cron GUI Interface with Ruby/Tk, June 25, 2004

Ruby/Tk Primer, Part 2, July 23, 2004

 

Ruby/Tk Primer, Part 3, July 27, 2004

Ruby's Present and Future, December 18, 2003

Building Unix Tools with Ruby, September 18, 2003

Read iCal Data with Ruby, September 3, 2003

An Interview with the Creator of Ruby, November 29, 2001 (Matz)

An Introduction to Ruby, October 25, 2001