Adding More Feature to Journal.Rails
Last night (yes, Sunday) I spent an hour or so adding the missing features to the Journal.Rails app. You can now search and sort by date and category.
I know what you're thinking — Wow! What's so great about that. Well, I'm happy to report it was both simple and easy to do. Just like Domino, it's not scary at all.
With the PHP version of Journal.ntf I never got round to adding search. Mainly because I didn't know how and never bothered to learn. With Rails it's easy, by nature of its architecture and took me about ten minutes to add. To see how I did it you can read this Wiki page. All I had to do was add a Search action to the Journal controller:
def search @query = params:q @results = Entry.search params:q, :case => :sensitive end
Then I add a matching file called search.rhtml to the Views folder and include this rHTML:
<p>Searched for "<%= @query %>". <% if @results.empty? %> Nothing found</p> <% else %> Found <%= pluralize(@results.size, "matching entry") %>.</p> <table> <% for entry in @results %> <tr>
Ordered views was a doddle and makes so much sense I worked this out myself. I added an action called "bydate" to the controller like so:
def bydate @entry_pages, @entries = paginate :entries, :order_by => 'diary_date, subject', :per_page => 10 render :action => 'list' end
Note that the last line tells the action to use the list.rhtml (default "view") to render the list of entries. We can use list.rhtml like a $$ViewTemplateDefault and then use actions to add new "view" and alter the column/sort order.
After adding the bydate action to the controller we can access the results at the URL /journal/bydate.
This is merely a few simple tweaks to the site and is just me playing around still. It's very rough. Note that I've not mimicked the Domino Categorised View feature. Because I don't like them and never use them. Categorised Views might be ok for users of a system that's trying to mimic its Notes counterpart, but nowhere else. Ever seen a categorised view on any other website? I rest my case.
Jake,
This looks great.
I am curious, how is the security with Rails? Is it comparable to Domino login and security?
E
Is it just me, or is everybody else not seeing the /journal/bydate link in date order?
Fixed it Andy. Woops.
Erskine. I've not really got to that bit yet, but, as I understand it, it's as secure as you make it.
I am not sure about websites but I have seen categorised views with SharePoint.
I think it allows two or three levels of categorization - there is some restriction on the number of categorization levels;not sure about it.