• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 16 years ago
  • Updated over 16 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rails wrapper for the iUI toolkit for building iPhone enabled web applications
rails_iui
========

A Rails wrapper around the iUI library for creating web applications.

This was originally created as a set of examples for some articles that should
be appearing soon. I'm releasing them as a plugin in the hope they'll be 
somewhat useful, even in their current partial state.

4-21-2008: Still functionally incomplete, and somewhat embarrassingly, without
automated tests.

More Info
=========

Details on iUI can be found at http://code.google.com/p/iui/

The URL for this repository is http://github.com/noelrappin/rails-iui/tree/master

The clone URL is git://github.com/noelrappin/rails-iui.git

Contact
=======

Contact the author at noelrappin at gmail.com

Example
=======

The rails_iui plugin does three things.

A series of Rake tasks will download iUI and insert it in the current Rails
project, changing the image URLs in the CSS file to match the standard Rails
layout.

rake iui:install  #download and install
rake iui:install_compact #download and install the compact version of iui
rake iui:clean    #removes iui files

The module ActionController::IphoneController adds support for recognizing
Mobile Safari as the :iphone pseudo-MIME type.

In your controller (can be ApplicationController) add the line

acts_as_iphone_controller

And any respond_to block can include iphone as an option, looking for 
.iphone.erb files in the view directory. Passing the argument true, as in
acts_as_iphone_controller(true) turns on test mode, where all requests are
treated as iphone regardless of user agent string. This is useful for testing
in some of the iPhone simulators. You'll need to restart the server for test
mode changes to take effect.

In your views, several methods from the IuiHelper module are automatically
imported into your application and are available throughout.  

viewport_tag(options = {})
  Builds the Mobile Safari meta viewport tag, pass the option 
  :device_width => true to specify the options for applications optimized for
  iPhone. More options to come.

include_iui_files 
  Place in the header of your layout, includes the tags for the iUI CSS and
  JavaScript files. Also defines the $ function, as in prototype.

button_link_to(name, options, html_options = {})
  Creates a link with the iUI CSS class of "button"
 
link_to_replace(name, options, html_options = {}) 
  An iUI link which replaces the link tag with the result text. Designed to
  be used for an anchor inside a list

link_to_external(name, options, html_options = {}) 
  An iUI link to an external item, this is an regular HTTP request, as 
  opposed to what iUI normally does, which is an Ajax request
  
link_to_target(target, name, options, html_options = {})
  An iUI link of a type based on the target parameter

iui_toolbar(initial_caption, search_url = nil)
  Sets the toolbar -- the caption is the heading. If there is a search_url,
  then a search button is added to the right side

iui_list(items, options = {}) 
  Creates an iPhone style of list. The items are expected to respond to the
  methods :caption -- the text display for the list, and :url, the url to
  go to when the item is selected. The :top and :bottom options specify
  text to be displayed above or below the list items. The :more option 
  specifies an item to go at the end of the list as a link_to_replace. The
  :as_replace options sends the list items without a surrounding ul tag, to
  be the response to a link_to_replace.
  
iui_grouped_list(items, options = {}, &group_by_block)
  Same as iui_list, but groups each item by their response to the 
  group_by_block
  
fieldset(&block)
  Wrapper around the iUI usage of a fieldset tag
  
row(label_text = "", &block)
  Wrapper around the iUI row (inside a fieldset) for rounded rectangles
  
row_label(&block)
  Wrapper for an iUI row that is just a label
  
panel(&block)
  Wrapper for an iUI div class panel

dialog(&block)
  Wrapper for an iUI div class dialog

servicelink_tel(telno)
  Creates a service link when a correctly formatted telephone number string is given (telno).
  Triggres the iPhone Phone App so that a call is initiated.

servicelink_email(email)
  Creates a service link when to the mail application. A mailto type link is created
  Triggres the iPhone Email App.

servicebutton_map(gadr,caption)
  Creates a service button to the maps application. The gadr parameter is a correctly 
  formatted google adress string. 
  A good place to implement the gadr method is in your people/adress model. Like so:
	def gadr
		 "#{street},#{zip} #{city},#{country}"
	end
  caption is the text that goes into the button 

observe_orientation_change(url_options = {})
  Place in the layout header file, the url_options is any Rails URL format.
  The URL gets a callback when the iPhone's orientation changes. The 
  parameter "position" is set to "0" for upright, "90" for counter-clockwise
  landscape, and "-90" for clockwise landscape
  
register_orientation_change
  Must be placed inside the body tag for the layout for observe_orientation_change
  to work.


Upcoming
========

Tests
Better documentation

Better JavaScript effects



Copyright (c) 2008 Noel Rappin, released under the MIT license

More Repositories

1

tank-engine

A new plugin for creating Rails applications targeted for iPhones. A successor to rails_iui
Ruby
147
star
2

mstwjs_code

Code repository for Master Space and Time With JavaScript
Ruby
52
star
3

summer_breeze

"Summer breeze, makes me feel fine Blowing through the jasmine in my mind"... creates dynamic rails fixtures for Jasmine tests. In development.
Ruby
52
star
4

rails_conf_2021_hotwire

RailsConf 2021 sample code repository
Ruby
43
star
5

warning_signs

A gem for managing Ruby and Rails dependencies
Ruby
26
star
6

rails_javascript_documention_drafts

25
star
7

date_by_example

A Ruby implementation of Go-style date-formatting by example
Ruby
17
star
8

huddle

A Demo Application for Rails Prescriptions, eventually a full-fledged support application for remote scrums
Ruby
13
star
9

rubomop

Rubomop cleans up after your rubocop. It automatically deletes entries from your .rubcop_todo.yml
Ruby
12
star
10

snow_globe

Code Repo for Take My Money
Ruby
8
star
11

rails_conf_2022

Rails 7 Front End Tooling Workshop for Rails Conf 2022
Ruby
8
star
12

gemfile_sorter

A Ruby Gem that sorts Gemfiles. Mostly
Ruby
6
star
13

rails_conf_north_by

Workshop for RailsConf 2019
Ruby
5
star
14

walk_through_coverage

A rake task that does a series of rcov coverage runs for each individual app file
Ruby
5
star
15

scottish_ruby_travel_app

Sample application for Scottish Ruby workshop
Ruby
4
star
16

testbed

A simple helper for creating a lot of one line tests that do the same thing
Ruby
3
star
17

spec_sequence

The code relating to the beyond red, green, refactor talk: http://www.slideshare.net/noelrap/what-we-talk-about-when-we-talk-about-testing-or
Ruby
3
star
18

ancient_city

Code for ancient city ruby workshop
Ruby
3
star
19

deckset_editor

An attempt to build a simple editor for Deckset (https://www.decksetapp.com) using Electron and Elm
Elm
3
star
20

foot_travel

Sample app for Fancy OO Techniques
Ruby
2
star
21

html_tag

An alternative syntax to Rails content_tag, inspired by the old Ruby CGI library
Ruby
2
star
22

madruby_muppet

Ruby
1
star
23

pub_rx

My self-publishing system, in progress
CSS
1
star
24

hungry_app

Ruby
1
star