Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 147
- Log:
Fixed Ticket #95. Upper case 'y' in 'Yes' for account lists.
- Author:
- adh
- Date:
- Mon Nov 20 23:33:32 +0000 2006
- Size:
- 2112 Bytes
1 | module AccountHelper |
2 | |
3 | # Return a table cell with class 'yes' or 'no' and text contents 'Yes' or |
4 | # 'No' according to "if (value) 'yes' else 'no'". |
5 | # |
6 | def boolean_cell(value) |
7 | if (value) |
8 | '<td class="yes">Yes</td>' |
9 | else |
10 | '<td class="no">No</td>' |
11 | end |
12 | end |
13 | |
14 | # Return a table cell with class 'yes', 'no' or 'expired' and text contents |
15 | # 'Yes', 'No' or 'Expired' according to whether or not the given value is |
16 | # set and less than "Time.now.utc". |
17 | # |
18 | def expired_cell(value) |
19 | if (value) |
20 | if (Time.now.utc >= value) |
21 | '<td class="expired">Expired</td>' |
22 | else |
23 | '<td class="yes">Yes</td>' |
24 | end |
25 | else |
26 | '<td class="no">No</td>' |
27 | end |
28 | end |
29 | |
30 | # Return a table cell containing a series of actions to perform from a list |
31 | # of user accounts. The cell will have class name 'actions'. Pass the user |
32 | # object for which the actions should be generated. |
33 | # |
34 | def list_actions(user) |
35 | '<td class="actions">' << |
36 | button_to('Details', { :action => 'show', :id => user.id }) << |
37 | button_to('Delete', { :action => 'destroy', :id => user.id }, :confirm => "Are you absolutely sure you want to permanently delete this account?") << |
38 | '</td>' |
39 | end |
40 | |
41 | # Output a selection list for roles. Pass the name of the parent |
42 | # object, the name of the field to take the selected value, an array |
43 | # of option values for the selection list and the associated roles |
44 | # string. Must be followed by a code block that translates its given |
45 | # argument into a printable string for the selection menu. Multiple |
46 | # selections will be allowed. |
47 | |
48 | def create_roles_selector(name, field, values, roles) |
49 | roles = roles.to_authenticated_roles |
50 | str = "<select multiple name=\"%s[%s][]\" id=\"%s_%s\">\n" % [ name, field, name, field ] |
51 | |
52 | for value in values |
53 | str += ' <option value="%s"' % value |
54 | str += ' selected' if (roles.include? value) |
55 | str += '>' + yield(value) # Call the code block the caller set up |
56 | str += "</option>\n" |
57 | end |
58 | |
59 | str += " </select>\n" |
60 | |
61 | return str |
62 | end |
63 | |
64 | end |