Project

General

Profile

Patch #5675 ยป fixed_settings_html.diff

Holger Just, 2010-06-11 17:37

View differences:

app/helpers/settings_helper.rb (working copy)
setting_values = Setting.send(setting)
setting_values = [] unless setting_values.is_a?(Array)
setting_label(setting, options) +
hidden_field_tag("settings[#{setting}][]", '') +
setting_label(setting, options.merge({:for => nil})) +
hidden_field_tag("settings[#{setting}][]", '', :id => nil) +
choices.collect do |choice|
text, value = (choice.is_a?(Array) ? choice : [choice, choice])
content_tag('label',
check_box_tag("settings[#{setting}][]", value, Setting.send(setting).include?(value)) + text.to_s,
text, value = (choice.is_a?(Array) ? choice : [choice, choice])
id = "settings_#{setting}_#{value.downcase.underscore}"
content_tag('span',
check_box_tag("settings[#{setting}][]", value, Setting.send(setting).include?(value), :id => id) +
content_tag('label', text.to_s, :for => id),
:class => 'block'
)
end.join
......
def setting_check_box(setting, options={})
setting_label(setting, options) +
hidden_field_tag("settings[#{setting}]", 0) +
hidden_field_tag("settings[#{setting}]", 0, :id => nil) +
check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options)
end
def setting_label(setting, options={})
label = options.delete(:label)
label != false ? content_tag("label", l(label || "setting_#{setting}")) : ''
for_id = options.key?(:for) ? options.delete(:for) : "settings_#{setting}"
label != false ? content_tag("label", l(label || "setting_#{setting}"), :for => for_id) : ''
end
end
app/views/settings/_mail_handler.rhtml (working copy)
<div class="box tabular settings">
<p>
<%= setting_text_area :mail_handler_body_delimiters, :rows => 5 %>
<%= setting_text_area :mail_handler_body_delimiters, :rows => 5, :cols => 60 %>
<br /><em><%= l(:text_line_separated) %></em>
</p>
</div>
app/views/common/_tabs.rhtml (working copy)
</div>
</div>
<script>
<% javascript_tag do -%>
Event.observe(window, 'load', function() { displayTabsButtons(); });
Event.observe(window, 'resize', function() { displayTabsButtons(); });
</script>
<%- end %>
<% tabs.each do |tab| -%>
<%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
public/stylesheets/application.css (working copy)
width: 270px;
}
.tabular label.block{
.tabular span.block{display: block;}
.tabular span.block label {
font-weight: normal;
margin-left: 0px !important;
text-align: left;
float: none;
display: block;
width: auto;
}
    (1-1/1)