Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 108
- Log:
Substantial changes and additions to Hub. Now in a state where
it will integrate with other applications to an acceptable level.
Requires HubSsoLib gem 0.0.4 or later - see Changeset #107.
- Author:
- adh
- Date:
- Mon Oct 23 18:16:22 +0100 2006
- Size:
- 2456 Bytes
1 | # Methods added to this helper will be available to all templates in the application. |
2 | |
3 | module ApplicationHelper |
4 | |
5 | # Make a link to the given controller and action, using an image based on the |
6 | # action name of the given width and height. A <br /> tag separates the image |
7 | # from some given text to add underneath, also a link. Since web spiders may |
8 | # follow standard links, do not use this call for destructive actions such as |
9 | # 'delete'; use make_protected_action_link instead. Remember that 'robots.txt' |
10 | # files are not entirely sufficient as some local Desktop cacheing software |
11 | # packages ignore them, and this sort of software is more likely to be running |
12 | # under login credentials that let it get at otherwise protected pages. |
13 | # |
14 | # If you don't want the text link adding, pass 'nil' or an empty string. |
15 | # |
16 | def make_action_link(controller, action, width, height, text) |
17 | html = link_to(image_tag("#{controller}/#{action}", :size => "#{width}x#{height}", :border => 0), |
18 | {:controller => controller, :action => action}, :class => 'image') |
19 | |
20 | unless (text.nil? or text.empty?) |
21 | html << '<br />' |
22 | html << link_to(text, :controller => controller, :action => action) |
23 | end |
24 | |
25 | return html |
26 | end |
27 | |
28 | # Make a protected link to the given controller and action with the given ID, |
29 | # using an image based on the action name. The link is done as an image button |
30 | # in a form to help stop accidental activation by web spiders (so use this call |
31 | # for destructive actions such as 'delete'). Some given text is put underneath |
32 | # the form but not included as part of the link. The final parameter is |
33 | # optional; if you want a JavaScript "onclick" confirmation before the form can |
34 | # be submitted, pass the message to use in the dialogue box here. |
35 | # |
36 | # If you don't want the text link adding, pass 'nil' or an empty string. |
37 | # |
38 | def make_protected_action_link(controller, action, id, text, onclick = nil) |
39 | html = start_form_tag({:controller => controller, :action => action, :id => id}) |
40 | opts = {:type => 'image', |
41 | :name => 'submit', |
42 | :alt => Inflector.humanize(action), |
43 | :src => image_path("#{controller}/#{action}")} |
44 | |
45 | unless (onclick.nil? or onclick.empty?) |
46 | opts[:onclick] = "return confirm('#{onclick}');" |
47 | end |
48 | |
49 | html << tag('input', opts) |
50 | html << end_form_tag() |
51 | |
52 | unless (text.nil? or text.empty?) |
53 | html << text |
54 | end |
55 | end |
56 | end |