Major Streamlined::UI Refactoring

Posted by Stu Fri, 27 Jul 2007 22:35:22 GMT

In the course of fixing a bug, I bit off of significant refactoring I have wanted to do for a while. Instead of saying this:

# old way 
class PoetUI < Streamlined::UI
  # declarative settings
end

You can now say this:

# new way
Streamlined.ui_for(Poet) do
  # declarative settings
end

The new syntax is more testable, since it does not rely on singleton methods and inheritance. It also makes it much easier to break the default 1-1 relationship between models and ui instances. The old syntax is still supported, via a bit of method_missing trickery. But I am sure there are some breakages, and I would like to deprecate the old syntax over time. Kick the tires and let me know if you have any problems.

Posted in ,  | no comments | no trackbacks

How to customize the look of the list view

Posted by Luis Sat, 21 Jul 2007 05:13:01 GMT

Whenever I talk to someone about Streamlined, they usually ask about how they can customize the look. I’m going to cover how to change the look of the list / index view as of the state of the edge before the 0.9 release comes out.

You can do this by creating a UI class for your model by executing “rake streamlined:model MODEL=your_model_name”. This will create a ModelUI class in app/streamlined and affects the views for that model.

If you’ve tried Streamlined before, then you’ll know that when you’re viewing the list view for a model, then you’ll see a paginated table that contains all the instances of the model. Each row has one instance, along with three buttons: one to go to the show view of the instance, the second to go to the edit view of the instance and a third to delete the instance. Below the table, there’s a few more buttons with the most important one being the one to create a new model instance.

There’s already pretty good documentation on how to modify which columns show up, so I’m going to focus on the other options.

First, you can add custom headers and/or custom footers by adding the lines
header_partials :list => 'shared/my_custom_header'
footer_partials :list => 'shared/my_custom_footer'
and then of course creating the header / footer partial and putting it in the place you specified. Second, you can turn off the delete button for each row. Perhaps you want to ensure that users delete from the show view or perhaps users should not delete instances of your model at all. Do this with
quick_delete_button false
Third, you can turn off the edit button for each row.
quick_edit_button false
Fourth, if your model is read only, then you can turn off the new and edit buttons by adding the line
read_only true
Note that you can still delete, so you’ll have to specify quick_delete_button false like above if you want that. I’m not sure if that’s the right behavior. Any thoughts on that? Fifth, you can turn off all the buttons that link to show/edit/delete by adding the line
table_row_buttons false
Sixth, you can turn off pagination via
pagination false
Seventh, you can turn off filtering via
table_filter false
Eighth, you can add custom CSS styles via
style_classes :list => {:row => 'person_row'}
which means that each row will have a CSS class person_row which you can then specify in a stylesheet.

That’s it for customizing the list view declaratively. I’ll make sure all of this gets into the wiki. Please let me know if I missed anything. If there’s another way you’d like to customize the list view, please add a ticket in Trac or leave a comment here.

Posted in ,  | Tags , ,  | 1 comment | no trackbacks

Streamlined no longer auto-registers AAA filter

Posted by Stu Fri, 20 Jul 2007 03:38:48 GMT

The following lines have been removed from acts_as_streamlined for the upcoming 0.9 release:

if defined? AuthenticatedSystem
  include AuthenticatedSystem
  before_filter :login_required  
end

The team discussed it, and we (mostly) agreed that developer should choose to add AAA’s filter themselves—Streamlined shouldn’t automatically choose it for them.

If you are using Streamlined with AAA and you want to require login, you will need to add the before_filter to your own controllers.

Posted in  | no comments | 1 trackback

Using %% when calling Connection.quote?

Posted by Stu Fri, 20 Jul 2007 02:11:16 GMT

I have committed a fix for Trac 43 as svn 565. It seems that some code paths through Rails Connection.quote use sprintf internally, while others do not. So we now pass %% which either acts as an escape, or doesn’t.

Is passing the unnecessary % on to the database is innocuous? It feels dirty. Is this a bug in ActiveRecord?

Posted in  | no comments | no trackbacks

Due to a rash of Trac Spam...

Posted by jgehtland Thu, 19 Jul 2007 20:57:05 GMT

Due to a rash of Trac spam, we’ve had to turn off anonymous ability to modify pages or tickets on the Trac install. To do so, you simply have to create an account, which is easy and free and we don’t use your information for anything. Ever.

Sorry for the inconvenience, but it will help keep the Trac instance clean.

Posted in  | no comments | no trackbacks

Trac is moving

Posted by Stu Sat, 30 Jun 2007 12:52:16 GMT

Trac is now at trac.streamlinedframework.org. Please update your links, I will be turning off the old links on port 8079.

Posted in  | 1 comment | no trackbacks

New in Edge: Render Filters

Posted by Matthew Mon, 25 Jun 2007 13:48:00 GMT

We’re excited to announce a new feature in Edge that will make it much easier to use Streamlined’s default actions while still having control over what gets rendered afterwards. Render filters allow you to tack additional code onto the end of a default action.

Matthew demonstrated these filters in a very early form at the Streamlined tutorial at RailsConf last month. They have since become much more useful and flexible. By using these filters, we’ve been able to stop copying and pasting default actions into our controllers only to make a single small change. Now, we can make the small change declaratively without redefining the action.

For example, what if you prefer that Streamlined redirect back to the list view instead of the show view after updating a record? You would add this render filter to your controller:

render_filter :update, :success => Proc.new {
  redirect_to :action => 'list'
}

What this says is that the Streamlined’s default update action should redirect back to the list action on success. (Render paths can also be defined for failure.)

The contents of the Proc are called in the context of the controller action itself, allowing you to redirect, assign new instance vars, etc. (Pretty much anything you can do inside a controller action.)

More examples and documentation can be found on the wiki.

Posted in  | 2 comments | no trackbacks

New Features in Edge

Posted by jgehtland Fri, 15 Jun 2007 14:55:19 GMT

Here’s some new features we’ve added in Edge, which are all documented over on the Wiki as well:

  • per-relationship options for modifying the display of the select box. If you need to pass options in to modify how the select box is displayed for a to-n relationship, you can do that with the
    :options_for_select
    attribute.
  • per-model-and-CRUD-context options for specifying a custom css class for items from that model. If, in your _ui.rb file, you do something like:
    class PersonUI < Streamlined::UI
       style_classes :list => {:row => 'person_row'}
    end
    
    Each row in the list (in LIST context only) will be wrapped in the CSS style “person_row”.
  • added an :update_only option for columns
  • added support for HTML wrappers around columns

And plenty more. Keep an eye on the Wiki and the Trac Timeline for more.

Posted in  | 2 comments | no trackbacks

RailsConf Tutorial Thoughts

Posted by jgehtland Fri, 18 May 2007 06:29:39 GMT

Wow! I want to publicly thank everybody who came out to the tutorial today. You guys had a lot of great questions, and stuck with us for two hours and forty five minutes. Just awesome. Thanks again!

Also, thanks to Luis and Matthew who helped out and kept me on track. Nice job, fellas.

We spoke with some folks in the audience who showed us interested modifications to Streamlined, and we encouraged them to submit them to us as patches. If they do it, we have some great new features to release soon.

One of the most important criticisms we received from a couple of people is that the blog here at streamlinedframework.org doesn’t mention the team behind Streamlined at all, which can give the impression that perhaps the framework is being written by some guy in a basement somewhere. So, to allay that, we’ve just added a link to our corporate website, but I’ll outline who we are here, as well.

Streamlined is managed by Relevance. We’re a consulting, training and development shop located in Chapel Hill, NC. Currently, the committers on Streamlined are:

We’d love to add more. Come on by!

no comments | 9 trackbacks

New Screencasts Online

Posted by jgehtland Thu, 17 May 2007 01:52:05 GMT

We’ve just posted three new screencasts for the newest version of Streamlined, we hope you’ll enjoy them.

We’ll have many more online in the next few days, but here are the first. Enjoy! Feedback welcome!

Posted in ,  | no comments | 6 trackbacks

Older Posts

Older Posts: 1 2 3 4 ... 6