_form.rhtml
4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<%= javascript_include_tag 'tiny_mce/tiny_mce.js' %>
<%= javascript_include_tag 'noosfero_tiny_mce.js' %>
<script>
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_toolbar_location : "top",
theme_advanced_layout_manager: 'SimpleLayout',
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,undo,redo,separator,formatselect,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,image,table,separator,cleanup,code,separator,help",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
apply_source_formatting : true,
language: <%= language.inspect %>,
});
</script>
<%= error_messages_for :page %>
<% form_for :page, @page do |f| %>
<div class='comatose_field'>
<label for="page_title"><%= _("Title") %></label>
<%= f.text_field :title, :tabindex => 1, :maxlength => 255, :size => 30 %> <%= link_to_function _("More..."), "ComatoseEditForm.toggle_extra_fields(this, '%s', '%s')" % [_('More...'), _('Less...')], :id => 'more-options' %>
</div>
<div class='comatose_field' id='slug_row'>
<label for="page_slug"><%= _('Slug') %></label>
<%= f.text_field :slug, :tabindex=>6, :maxlength=>255, :size=>50, :disabled=>@root_pages.include?(@page) %>
</div>
<div class='comatose_field' id='keywords_row'>
<% if show_field? 'keywords' %>
<label for="page_keywords"><%= _('Keywords') %></label>
<%= f.text_field :keywords, :tabindex=>7, :maxlength=>1000, :size=>50 %>
<% end %>
</div>
<div class='comatose_field' id='parent_row'>
<% if show_field? 'parent' %>
<label for="page_parent"><%= _('Parent') %></label>
<% if mode != :new and @root_pages.include? @page %>
<select id="page_parent" disabled="true"><option><%= _('%s is a root page') % @page.title %></option></select>
<% else %>
<select id="page_parent" name="page[parent_id]" tabindex="8"><%= tree_select_box @root_pages, @page.parent_id, @page.id %></select>
<% end %>
<% end %>
</div>
<div class='comatose_field'>
<label for="page_body"><%= _('Content') %></label>
<%= text_editor('page', 'body', 'filter_type', :tabindex => 2) %>
</div>
<div class='comatose_field' id='filter_row'>
<% if show_field? 'filter' %>
<label for="page_filter_type"><%= _("Filter") %></label>
<%= select_filter_type('page', 'filter_type', :tabindex => 3 ) %>
<span class="field-help"><%= _('Converts plain text into HTML') %></span>
<% end %>
</div>
<div class='comatose_field' id='created_row'>
<% if show_field? 'created_on' %>
<label for="page_created_on"><%= _('Created') %></label>
<%= f.datetime_select :created_on %>
<% end %>
</div>
<div id="button-group">
<% unless @page.updated_on.nil? %>
<div class="last-update">
<label>
<%= link_to(n_("One revision", "%d revisions", @page.versions.length) % @page.versions.length, :action=>'versions', :id=>@page) if @page.versions.length > 0 %>
</label>
</div>
<% end %>
<%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %>
<%= button_to_function('Preview', "ComatoseEditForm.preview_content('#{url_for :controller=>controller.controller_name, :action=>'preview', :id=>@page}', '%s')" % _('Loading preview ...'), :tabindex=>3, :id=>'preview-btn' ) if show_field? 'preview' %>
<%= submit_tag ((mode == :edit) ? _('Save Changes') : _('Create Page')), :tabindex=>4 %>
<% if @page.versions.length > 0 %>
<%= link_to _("Revert"), :action=>'versions', :id=>@page %>
<% end %>
or
<a href="<%= url_for :controller=>controller.controller_name, :action=>'index' %>" onlick="ComatoseEditForm.cancel(this.href, '<%= _('Changes detected. You will lose all the updates you have made if you proceed...') %>'); return false;" tabindex="5"><%= _("Cancel") %></a>
</div>
<% end %>
<div id="preview-area" style='display: none;'>
<fieldset>
<legend><%= _('Page Preview') %></legend>
<div class="preview-body">
<div id="preview-panel"><span style='color:blue;'><%= _('Loading Preview...') %></span></div>
<div style="clear:both"></div>
</div>
</fieldset>
<div class="commands">
<a href="#" onclick="$('preview-area').hide();"><%= _("Close Preview") %></a><% _("or") %><a href="#"><%= _('Back to top') %></a>
</div>
</div>
<%= javascript_tag "ComatoseEditForm.init('#{mode.to_s}');" %>