Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 341
- Log:
Lots of changes to Hub to make it Rails 2.3.11 compatible. This is being
checked in as one large changeset because it doesn't really split down into
smaller components without having something that doesn't function in the
intermediate steps.
- Author:
- rool
- Date:
- Sat Mar 19 19:11:39 +0000 2011
- Size:
- 2995 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 | # To override the default URI constructed from the given controller and |
17 | # action, provide a sixth parameter with the required URI. |
18 | # |
19 | def make_action_link(controller, action, width, height, text, uri = nil) |
20 | if (uri.nil?) |
21 | |
22 | html = link_to(image_tag(image_path("#{controller}/#{action}.png"), :size => "#{width}x#{height}", :border => 0), |
23 | {:controller => controller, :action => action}, :class => 'image') |
24 | |
25 | unless (text.nil? or text.empty?) |
26 | html << '<br />' |
27 | html << link_to(text, :controller => controller, :action => action) |
28 | end |
29 | |
30 | else |
31 | |
32 | html = content_tag("a", image_tag(image_path("#{controller}/#{action}.png"), :size => "#{width}x#{height}", :border => 0), |
33 | { :href => uri, :class => 'image' }) |
34 | unless (text.nil? or text.empty?) |
35 | html << '<br />' |
36 | html << content_tag("a", text, { :href => uri }) |
37 | end |
38 | |
39 | end |
40 | |
41 | return html |
42 | end |
43 | |
44 | # Make a protected link to the given controller and action with the given ID, |
45 | # using an image based on the action name. The link is done as an image button |
46 | # in a form to help stop accidental activation by web spiders (so use this call |
47 | # for destructive actions such as 'delete'). Some given text is put underneath |
48 | # the form but not included as part of the link. The final parameter is |
49 | # optional; if you want a JavaScript "onclick" confirmation before the form can |
50 | # be submitted, pass the message to use in the dialogue box here. |
51 | # |
52 | # If you don't want the text link adding, pass 'nil' or an empty string. |
53 | # |
54 | def make_protected_action_link(controller, action, id, text, onclick = nil) |
55 | opts = {:type => 'image', |
56 | :name => 'submit', |
57 | :alt => action.humanize, |
58 | :src => image_path("#{controller}/#{action}.png")} |
59 | |
60 | unless (onclick.nil? or onclick.empty?) |
61 | opts[:onclick] = "return confirm('#{onclick}');" |
62 | end |
63 | |
64 | html = form_tag({:controller => controller, :action => action, :id => id}) |
65 | html << tag('input', opts) |
66 | html << '</form>' |
67 | |
68 | unless (text.nil? or text.empty?) |
69 | html << text |
70 | end |
71 | |
72 | return html |
73 | end |
74 | end |