Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 3486 Bytes
1 | module Admin::PagesHelper |
2 | include Admin::NodeHelper |
3 | include Admin::ReferencesHelper |
4 | |
5 | def class_of_page |
6 | @page.class |
7 | end |
8 | |
9 | def filter |
10 | @page.parts.empty? ? nil : @page.parts.first.filter |
11 | end |
12 | |
13 | def meta_errors? |
14 | !!(@page.errors[:slug] or @page.errors[:breadcrumb]) |
15 | end |
16 | |
17 | def default_filter_name |
18 | @page.parts.empty? ? "" : @page.parts[0].filter_id |
19 | end |
20 | |
21 | def homepage |
22 | @homepage ||= Page.find_by_parent_id(nil) |
23 | end |
24 | |
25 | def status_to_display |
26 | @page.status_id = 100 if @page.status_id == 90 |
27 | @display_status = [] |
28 | Status.find_all.each { |s| @display_status << [t(s.name.downcase), s.id] unless s.name == 'Scheduled' } |
29 | return @display_status |
30 | end |
31 | |
32 | def page_edit_javascripts |
33 | <<-CODE |
34 | function addPart(form) { |
35 | if (validPartName()) { |
36 | new Ajax.Updater( |
37 | $('tab_control').down('.pages'), |
38 | '#{admin_page_parts_path}', |
39 | { |
40 | asynchronous: true, |
41 | evalScripts: true, |
42 | insertion: 'bottom', |
43 | onComplete: function(request){ partAdded() }, |
44 | onLoading: function(request){ partLoading() }, |
45 | parameters: Form.serialize(form) |
46 | } |
47 | ); |
48 | } |
49 | } |
50 | function removePart() { |
51 | if(confirm('Remove the current part?')) { |
52 | TabControls['tab_control'].removeSelected(); |
53 | } |
54 | } |
55 | function partAdded() { |
56 | var tabControl = TabControls['tab_control']; |
57 | $('add_part_busy').hide(); |
58 | $('add_part_button').disabled = false; |
59 | $('add_part_popup').closePopup(); |
60 | $('part_name_field').value = ''; |
61 | tabControl.updateTabs(); |
62 | tabControl.select(tabControl.tabs.last()); |
63 | } |
64 | function partLoading() { |
65 | $('add_part_button').disabled = true; |
66 | $('add_part_busy').appear(); |
67 | } |
68 | function validPartName() { |
69 | var partNameField = $('part_name_field'); |
70 | var name = partNameField.value.downcase(); |
71 | if (name.blank()) { |
72 | alert('Part name cannot be empty.'); |
73 | return false; |
74 | } |
75 | if (TabControls['tab_control'].findTabByCaption(name)) { |
76 | alert('Part name must be unique.'); |
77 | return false; |
78 | } |
79 | return true; |
80 | } |
81 | |
82 | var lastPageType = '#{@page.class.name}'; |
83 | var tagReferenceWindows = {}; |
84 | function loadTagReference(part) { |
85 | var pageType = $F('page_class_name'); |
86 | if (!tagReferenceWindows[pageType]) |
87 | tagReferenceWindows[pageType] = new Popup.AjaxWindow("#{admin_reference_path('tags')}?class_name=" + encodeURIComponent(pageType), {reload: false}); |
88 | var window = tagReferenceWindows[pageType]; |
89 | if(lastPageType != pageType) { |
90 | $('tag_reference_link_' + part).highlight(); |
91 | window.show(); |
92 | } else { |
93 | window.toggle(); |
94 | } |
95 | lastPageType = pageType; |
96 | return false; |
97 | } |
98 | |
99 | var lastFilter = '#{default_filter_name}'; |
100 | var filterWindows = {}; |
101 | function loadFilterReference(part) { |
102 | var filter = $F("part_" + part + "_filter_id"); |
103 | if (filter != "") { |
104 | if (!filterWindows[filter]) filterWindows[filter] = new Popup.AjaxWindow("#{admin_reference_path('filters')}?filter_name="+encodeURIComponent(filter), {reload: false}); |
105 | var window = filterWindows[filter]; |
106 | if(lastFilter != filter) { |
107 | window.show(); |
108 | } else { |
109 | window.toggle(); |
110 | } |
111 | lastFilter = filter; |
112 | } else { |
113 | alert('No documentation for filter.'); |
114 | } |
115 | return false; |
116 | } |
117 | CODE |
118 | end |
119 | end |