diff options
Diffstat (limited to 'app/views/revisions/diff.html.erb')
| -rw-r--r-- | app/views/revisions/diff.html.erb | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb index d7bb528..3157dca 100644 --- a/app/views/revisions/diff.html.erb +++ b/app/views/revisions/diff.html.erb | |||
| @@ -4,11 +4,41 @@ | |||
| 4 | <%= link_to 'Revisions', node_revisions_path(@node) %> | 4 | <%= link_to 'Revisions', node_revisions_path(@node) %> |
| 5 | </p> | 5 | </p> |
| 6 | 6 | ||
| 7 | <%= form_tag diff_node_revisions_path do %> | 7 | <p class="diff_comparison_label"> |
| 8 | <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %> | 8 | Comparing <strong><%= describe_page_reference(params[:start_revision]) %></strong> |
| 9 | <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> | 9 | against <strong><%= describe_page_reference(params[:end_revision]) %></strong> |
| 10 | <%= select_tag :view, options_for_select([['Inline', 'inline'], ['Side by side', 'side_by_side']], @diff_view) %> | 10 | </p> |
| 11 | <%= submit_tag 'Diff' %> | 11 | |
| 12 | <% numeric_comparison = params[:start_revision].to_s =~ /\A\d+\z/ && params[:end_revision].to_s =~ /\A\d+\z/ %> | ||
| 13 | |||
| 14 | <% if numeric_comparison %> | ||
| 15 | <%= form_tag diff_node_revisions_path do %> | ||
| 16 | <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %> | ||
| 17 | <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> | ||
| 18 | <%= select_tag :view, options_for_select([['Inline', 'inline'], ['Side by side', 'side_by_side']], @diff_view) %> | ||
| 19 | <%= submit_tag 'Diff' %> | ||
| 20 | <% end %> | ||
| 21 | <% else %> | ||
| 22 | <p class="node_action_bar standalone_action_bar"><%= link_to 'Compare two numbered revisions instead', node_revisions_path(@node) %></p> | ||
| 23 | <% end %> | ||
| 24 | |||
| 25 | <% if @available_layer_pairs.present? %> | ||
| 26 | <p class="node_action_bar standalone_action_bar"> | ||
| 27 | <% @available_layer_pairs.each do |pair| %> | ||
| 28 | <% next if [params[:start_revision].to_s, params[:end_revision].to_s].sort == pair.map(&:to_s).sort %> | ||
| 29 | <%= button_to "Diff #{pair.first.to_s.capitalize} vs. #{pair.last.to_s.capitalize}", | ||
| 30 | diff_node_revisions_path(@node), | ||
| 31 | method: :get, | ||
| 32 | params: { start_revision: pair.first, end_revision: pair.last, view: @diff_view }, | ||
| 33 | form: { class: 'button_to computation' } %> | ||
| 34 | <% end %> | ||
| 35 | |||
| 36 | <% if !@locked_by_other && (@node.autosave || @node.draft) %> | ||
| 37 | <%= button_to (@node.draft && !@node.autosave ? 'Destroy Draft' : 'Discard Autosave'), | ||
| 38 | revert_node_path(@node), method: :put, | ||
| 39 | form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } %> | ||
| 40 | <% end %> | ||
| 41 | </p> | ||
| 12 | <% end %> | 42 | <% end %> |
| 13 | 43 | ||
| 14 | <div id="diffview"> | 44 | <div id="diffview"> |
