Applied user preferences form patch by Janet Riley:

The 'week_starts' and 'due_style' preferences can now be selected with an options list rather than entered in a textfield. This makes much more sense without the user having to look at the help notes.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@253 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2006-06-04 14:20:32 +00:00
parent f395a37e63
commit edcc065659
3 changed files with 68 additions and 7 deletions

View file

@ -8,8 +8,8 @@
<% if @user.is_admin? %>
<li><strong>admin_email:</strong> email address for the admin user of Tracks (displayed on the signup page for users to contact to obtain an account)</li>
<% end %>
<li><strong>week_starts:</strong> day of the week shown as the start of the week on the popup calendar. 0 = Sunday, 1 = Monday etc.</li>
<li><strong>due_style:</strong> style in which due dates for the range 2-7 days away is shown. 0 = "Due in 3 days", 1 = "Due on Wednesday"</li>
<li><strong>week_starts:</strong> day of the week shown as the start of the week on the popup calendar.</li>
<li><strong>due_style:</strong> style in which due dates are shown, e.g. "Due in 3 days", "Due on Wednesday"</li>
</ul>
</div>
@ -20,7 +20,44 @@
<% next if !@user.is_admin? and k == "admin_email" %>
<tr>
<td><label><%= k %>:</label></td>
<td><input name="prefs[<%= k %>]" type="text" value="<%= v %>" /></td>
<td>
<% case k
when "week_starts" %>
<select name="prefs[<%= k %>]" >
<% day_num_to_name = { "0" => "Sunday",
"1" => "Monday",
"2" => "Tuesday",
"3" => "Wednesday",
"4" => "Thursday",
"5" => "Friday",
"6" => "Saturday"}
day_num_to_name.sort.each do |number, day| %>
<option value="<%= number%>"
<% if number == v %>
selected="true"
<% end %>
><%= day %></option>
<% end %>
</select>
<% when "due_style" %>
<select name="prefs[<%= k %>]" >
<option value="0"
<% if v == "0" %>
selected="true"
<% end %>
>Due in ___ days</option>
<option value="1"
<% if v == "1" %>
selected="true"
<% end %>
>Due on _______</option>
</select>
<% else %>
<input name="prefs[<%= k %>]" type="text" value="<%= v%>" >
<% end %>
</td>
</tr>
<% end %>
<tr><td><%= submit_tag "Update" %></td>

View file

@ -10,10 +10,34 @@
<ul id="prefs">
<li>Date format: <span class="highlight"><%= @prefs["date_format"] %></span></li>
<li>Week starts on: <span class="highlight"><%= @prefs["week_starts"] %></span></li>
<li>Week starts on: <span class="highlight">
<% case @prefs["week_starts"]
when "0"
%> Sunday <%
when "1"
%> Monday <%
when "2"
%> Tuesday <%
when "3"
%> Wednesday <%
when "4"
%> Thursday <%
when "5"
%> Friday <%
when "6"
%> Saturday <%
end
%>
</span></li>
<li>Show the last <span class="highlight"><%= @prefs["no_completed"] %></span> completed items on the home page</li>
<li>Staleness starts after <span class="highlight"><%= @prefs["staleness_starts"] %></span> days</li>
<li>Due style: <span class="highlight"><%= @prefs["due_style"] %></span></li>
<li>Due style: <span class="highlight">
<% if @prefs["due_style"] == "0" %>
Due in ___ days
<% else %>
Due on ________
<% end %>
</span></li>
<% if @user.is_admin? %>
<li>Admin email: <span class="highlight"><%= @prefs["admin_email"] %></span></li>
<% end %>

View file

@ -53,7 +53,7 @@ a.show_notes:hover {background-image: url(../images/notes_on.png); background-re
#display_box {
float: left;
width: 60%;
width: 55%;
margin: 0px 15px 50px 15px;
}
@ -177,7 +177,7 @@ h2 a:hover {
}
#input_box {
margin: 100px 5% 0% 65%;
margin: 100px 5% 0% 60%;
padding: 0px 15px 0px 15px;
}