RAILS PRESS RUBY on RAILS, it’s DRY and COOL …

RSS Feed

RAILS PRESS RSS

Tag Cloud

はてなブックマーク - railspress.matake.jp の注目エントリー
象形文字くさび形文字ミイラそろばんの玉そろばんコーラン占いの板?象牙大英博物館
« 前のエントリ
MacOSXをメールサーバにする
次のエントリー »
Rails2.0で何が変わるのか?

Posted on
2007/05/16

Tags
Plugin, 携帯電話

Keywords


この記事をはてなブックマークに登録 この記事のはてなブックマーク数 この記事を livedoor クリップに登録この記事の livedoor クリップ数 このエントリを del.icio.us に追加
ブックマークに追加する

Jpmobileのget_position_link_toのアンカーテキストを変更したい

$RAILS_ROOT/vendor/plugins/jpmobile/lib/jpmobile/helpers.rbの中のget_position_link_toを以下のように変更。
AUで二つのGPSリンクが表示されるのも、一つにするようにした。

なんだかapp/helpersの中でオーバーライドするのがうまくいかなかったので、とりあえず直接vendor/pluginsの中を編集しちゃった。

(変更前)

LANG : RUBY
  1. def get_position_link_to(options={})
  2.   options = options.symbolize_keys
  3.   show_all = options.delete(:show_all)
  4.  
  5.   s = []
  6.   if show_all || request.mobile.instance_of?(Mobile::Docomo)
  7.     s <<docomo_foma_gps_link_to( options[:message] ? options[:message] : "DoCoMo FOMA(GPS)", options)
  8.   end
  9.   if show_all || request.mobile.instance_of?(Mobile::Au)
  10.     s <<au_gps_link_to("au(GPS)", options)
  11.     s <<au_location_link_to("au(antenna)", options)
  12.   end
  13.   if show_all || request.mobile.instance_of?(Mobile::Jphone)
  14.     s <<jphone_location_link_to("Softbank(antenna)", options)
  15.   end
  16.   if show_all || request.mobile.instance_of?(Mobile::Vodafone) || request.mobile.instance_of?(Mobile::Softbank)
  17.     s <<softbank_location_link_to("Softbank 3G(GPS)", options)
  18.   end
  19.   if show_all || request.mobile.instance_of?(Mobile::Willcom)
  20.     s <<willcom_location_link_to("Willcom", options)
  21.   end
  22.   return s.join("<br />\n")
  23. end

(変更後)

LANG : RUBY
  1. def get_position_link_to(options={})
  2.   options = options.symbolize_keys
  3.   show_all = options.delete(:show_all)
  4.  
  5.   s = []
  6.   if show_all || request.mobile.instance_of?(Mobile::Docomo)
  7.     s <<docomo_foma_gps_link_to( options[:message] ? options[:message] : "DoCoMo FOMA(GPS)", options)
  8.   end
  9.   if show_all || request.mobile.instance_of?(Mobile::Au)
  10.     s <<au_gps_link_to( options[:message] ? options[:message] : "au(GPS)", options) ? true :
  11.     s <<au_location_link_to( options[:message] ? options[:message] : "au(antenna)", options)
  12.   end
  13.   if show_all || request.mobile.instance_of?(Mobile::Jphone)
  14.     s <<jphone_location_link_to( options[:message] ? options[:message] : "Softbank(antenna)", options)
  15.   end
  16.   if show_all || request.mobile.instance_of?(Mobile::Vodafone) || request.mobile.instance_of?(Mobile::Softbank)
  17.     s <<softbank_location_link_to( options[:message] ? options[:message] : "Softbank 3G(GPS)", options)
  18.   end
  19.   if show_all || request.mobile.instance_of?(Mobile::Willcom)
  20.     s <<willcom_location_link_to( options[:message] ? options[:message] : "Willcom", options)
  21.   end
  22.   return s.join("<br />\n")
  23. end


この記事がお役に立ちましたら、一言コメントもらえると嬉しいですm_ _m


コメントはこちらから




使用可能タグ: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


« 前のエントリ
MacOSXをメールサーバにする
次のエントリー »
Rails2.0で何が変わるのか?