Created
October 7, 2011 17:35
-
-
Save kredmer/1270883 to your computer and use it in GitHub Desktop.
edit in place i18n translation select-one-editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System: | |
ruby-1.8.7-p334 | |
hobo (1.0.3) | |
rails (2.3.11) | |
Models: | |
Contact Model | |
has_many :contact_activities | |
ContactActivitiy | |
belongs_to :activity, :polymorphic => true | |
belongs_to :contact, :class_name => 'Contact', :creator => true, :accessible => true | |
Opportunity | |
Oppstate = HoboFields::EnumString.for(:open, :won, :lost, :name => "Oppstate") | |
fields do | |
.. | |
dealstate Opportunity::Oppstate | |
.. | |
end | |
belongs_to :contact, :class_name => 'Contact', :creator => true | |
has_one :contact_activity, :as => :activity, :dependent => :destroy | |
------ | |
DRYML-TAG: | |
<def tag="activitycard" for="Opportunity"> | |
1. <field-list fields='dealvalue' tag="editor"/> | |
2. <form action="" without-actions> | |
<field-list: fields='dealstate'/> | |
</form> | |
</def> | |
----- | |
html-output for 1. | |
<select onchange="Hobo.ajaxRequest('/opportunities/16-dddd', [], {method:'put', params:'opportunity[dealstate]=' + this.value})" class="dealstate-tag oppstate opportunity_dealstate editor"> | |
<option value="open">Open</option> | |
<option selected="selected" value="won">Won</option> | |
<option value="lost">Lost</option> | |
</select> | |
html-output for 2. | |
<select name="opportunity[dealstate]" class="dealstate-tag oppstate opportunity-dealstate"> | |
<option value="open">Offen</option> | |
<option selected="selected" value="won">Gewonnen</option> | |
<option value="lost">Verloren</option> | |
</select> | |
----- | |
de.yml | |
oppstates: | |
open: "offen" | |
won: "gewonnen" | |
lost: "verloren" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment