track.rhtml
1.55 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
<% extend CommunityTrackPlugin::StepHelper %>
<% form_tag({:controller => 'community_track_plugin_myprofile', :action => 'save_order', :track => track}) do %>
<div id="track">
<div>
<%= track.body %>
</div>
<h3><%= _("Steps") %></h3>
<% if track.allow_create?(user) %>
<div class="track actions">
<% content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "CommunityTrackPlugin::Step", :parent_id => track.id}), :class => 'button with-text icon-add') do %>
<strong><%= _("New %s") % CommunityTrackPlugin::Step.short_description %></strong>
<% end %>
<a href="#" class="reorder_button button with-text icon-up" onclick="enableReorder();"><%= _('Reorder Steps') %></a>
<%= submit_button :save, _('Save Order'), :class => "save_button" %>
</div>
<script>
function enableReorder() {
jQuery(".reorder_button").hide();
jQuery(".save_button").show();
jQuery("#sortable li").addClass("ui-state-default");
jQuery("#sortable").sortable();
jQuery("#sortable").disableSelection();
}
</script>
<% end %>
<ul id="sortable" class="step_list">
<%= render :partial => 'step_item', :collection => track.steps %>
</ul>
<% if track.allow_create?(user) && !track.hidden_steps.empty? %>
<div id="hidden_steps">
<h3><%= _('Hidden Steps') %></h3>
<ul class="step_list">
<%= render :partial => 'step_item', :collection => track.hidden_steps %>
</ul>
</div>
<% end %>
</div>
<% end %>