#
module SettingsHelper
def category_name(category)
- message_or_default("property.category.#{category}", category)
+ message("property.category.#{category}", :default => category)
end
def property_name(property)
- message_or_default("property.#{property.key()}.name", property.name())
+ message("property.#{property.key()}.name", :default => property.name())
end
def property_description(property)
- message_or_default("property.#{property.key()}.description", property.description())
+ message("property.#{property.key()}.description", :default => property.description())
+ end
+
+ def property_help(property)
+ message("property.#{property.key()}.help", :default => '')
end
def property_value(property)
property.getType()
end
- def message_or_default(message_key, default)
- message(message_key, :default => default)
- end
-
def by_name(categories)
categories.sort_by { |category| category_name(category) }
end
+<style>
+ #body {
+ padding: 0;
+ }
+</style>
<% form_tag({:action => 'save'}) do -%>
<table class="data form marginbottom10">
<thead>
--- /dev/null
+<div id="body" class="nolayout">
+ <% if @snapshot %><div class="print"><h2><%= @snapshot.project.name(true) %></h2></div><% end %>
+ <div class="error" id="error" style="display:none"><span id="errormsg"></span> [<a href="#" onclick="javascript:$('error').hide();return false;"><%= message('hide').downcase -%></a>]</div>
+ <div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> [<a href="#" onclick="javascript:$('warning').hide();return false;"><%= message('hide').downcase -%></a>]</div>
+ <div class="notice" id="info" style="display:none"><span id="infomsg"></span> [<a href="#" onclick="javascript:$('info').hide();return false;"><%= message('hide').downcase -%></a>]</div>
+ <%= yield %>
+</div>
\ No newline at end of file
-<div class="multi_value">
+<div class="multi_value marginbottom5">
<%= render "settings/type_#{property_type(property, value)}", :property => property, :value => value -%>
- <a href="#" class="delete"></a>
+ <a href="#" class="delete link-action"><%= message('delete') -%></a>
<br/>
</div>
:update => 'properties',
:script => false do -%>
- <table class="data marginbottom10" style="margin: 10px;">
+ <table class="data marginbottom10">
<thead>
<tr>
<th><%= h category_name(@category) -%></th>
<div class="template" style="display:none;">
<%= render "settings/multi_value", :property => property, :value => nil -%>
</div>
- <a href="#" class="add"><%= message('settings.add') -%></a>
- <% else -%>
+ <button class="add_value"><%= message('settings.add') -%></button>
+ <br/>
+ <% else -%>
<%= render "settings/type_#{property_type(property, value)}", :property => property, :value => value -%>
<% end -%>
<% default_prop_value = (@resource ? Property.value(property.key, nil, property.defaultValue) : property.defaultValue) -%>
- <% unless default_prop_value.blank? %>
- <p class="note">Default: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%></p>
+ <% unless default_prop_value.blank? -%>
+ <div class="note">Default: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%></div>
+ <% end -%>
+
+ <% details = property_help(property) -%>
+ <% unless details.blank? -%>
+ <br/>
+
+ <div class="help"><%= details -%></div>
<% end -%>
</td>
</tr>
<% end -%>
<% end -%>
-<script type="text/javascript">
+<script>
$j('.delete').live('click', function () {
$j(this).parent('.multi_value').remove();
+ return false;
});
- $j('.add').live('click', function () {
+ $j('.add_value').live('click', function () {
var template = $j(this).siblings('.template');
template.before(template.html());
+ return false;
});
-</script>
\ No newline at end of file
+
+ function enlargeTextInput(propertyKey) {
+ var input = $j('#' + propertyKey);
+ var textArea = '<textarea class="width100" rows="10" name="' + input.attr('name') + '" id="input_' + propertyKey + '">' + input.val() + '</textarea>';
+ input.replaceWith(textArea);
+ }
+</script>
<table width="100%">
<tr>
<td width="1%" nowrap class="column first">
- <table class="data selector">
+ <table class="data">
<thead>
<tr>
<th><%= message('category') -%></th>
</div>
</td>
</tr>
-</table>
-
-<script type="text/javascript">
- function enlargeTextInput(propertyKey) {
- var eltId = 'input_' + propertyKey;
- var textValue = $F(eltId);
- var textArea = '<textarea class="width100" id="' + propertyKey + '" name="' + propertyKey + '" rows="10" id="input_' + propertyKey + '">' + textValue + '</textarea>';
- $(eltId).parentNode.replace(textArea);
- }
-</script>
+</table>
\ No newline at end of file
-<input type="text" name="<%= h property.key -%>[]" value="<%= h value if value -%>" size="50" id="input_<%= h property.key -%>"/>
-<%= link_to_function(image_tag('zoom.png'), "enlargeTextInput('#{property.key}')", :class => 'nolink') -%>
\ No newline at end of file
+<input type="text" name="<%= h property.key -%>[]" value="<%= h value if value -%>" size="50" id="input_<%= property.key.parameterize -%>"/>
+<% unless property.multi_values -%>
+ <%= link_to_function(image_tag('zoom.png'), "enlargeTextInput('input_#{property.key.parameterize}')", :class => 'nolink') -%>
+<% end -%>
margin-bottom: 10px;
}
+.marginbottom5 {
+ margin-bottom: 5px;
+}
+
.marginright10 {
margin-right: 10px;
}
padding: 2px 0 2px 20px;
}
-.delete {
- background: url("../images/cross.png") no-repeat scroll left 50% transparent;
- padding: 2px 0 2px 20px;
-}
-
.restore {
display: block;
background: url("../images/restore.gif") no-repeat scroll left 50% transparent;