diff --git a/Gemfile b/Gemfile index 740bd8bf834c1945c1d58ca048135e2bc2730353..331eaae4dfb01621676f7f7dbc209ce6dea5e76e 100644 --- a/Gemfile +++ b/Gemfile @@ -56,11 +56,6 @@ gem 'sass' # needs special branch for rails 4.2 gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2' -# legacy helper for form_remote_for and link_to_remote -# there's only a 0.0.0 version out there it seems -gem 'prototype_legacy_helper', '0.0.0', - github: 'rails/prototype_legacy_helper' - # Full text search for the database gem 'thinking-sphinx', '~> 3.4.2' diff --git a/Gemfile.lock b/Gemfile.lock index bbce8ec60487c6f9aa10f74438f2e8aab14b3084..fadfb0c9e308017a832f2c21f2bb9f3fc125c421 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,12 +6,6 @@ GIT prototype-rails (4.0.0) rails (~> 4.0) -GIT - remote: https://github.com/rails/prototype_legacy_helper.git - revision: a2cd95c3e3c1a4f7a9566efdab5ce59c886cb05f - specs: - prototype_legacy_helper (0.0.0) - PATH remote: vendor/gems/riseuplabs-greencloth-0.1 specs: @@ -278,7 +272,6 @@ DEPENDENCIES phantomjs-binaries (~> 2.1.1) poltergeist (~> 1.5) prototype-rails! - prototype_legacy_helper (= 0.0.0)! rails (~> 4.2.10) rails-html-sanitizer (~> 1.0.4) rake (~> 10.0) diff --git a/app/controllers/wiki/diffs_controller.rb b/app/controllers/wiki/diffs_controller.rb deleted file mode 100644 index 4267c1e4c58614001cfcd0b51ce966d220d7e08b..0000000000000000000000000000000000000000 --- a/app/controllers/wiki/diffs_controller.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Wiki::DiffsController < Wiki::BaseController - guard show: :may_show_wiki_diff? - - helper 'wikis/versions' - javascript :wiki - - def show - if @old - @diff = Crabgrass::Wiki::HTMLDiff.diff(@old.body_html, @new.body_html) - else - render template: '/wikis/versions/show' - end - end - - protected - - # making sure the version is available for the permission - def fetch_wiki - super - if params[:page] - fetch_versions_with_page - else - fetch_versions_without_page - end - rescue Wiki::VersionNotFoundError => err - error err - redirect_to wiki_versions_path(@wiki) - end - - def fetch_versions_without_page - old_id, new_id = params[:id].split('-') - @old = @wiki.find_version(old_id) unless old_id.blank? - @version = @new = @wiki.find_version(new_id) - params[:page] = @wiki.page_for_version(@new) - @versions = @wiki.versions.most_recent.paginate(pagination_params) - end - - def fetch_versions_with_page - @versions = @wiki.versions.most_recent.paginate(pagination_params) - @version = @new = @versions[0] - @old = @versions[1] - end -end diff --git a/app/helpers/wikis/diffs_helper.rb b/app/helpers/wikis/diffs_helper.rb deleted file mode 100644 index cb68f619ed5ece7e78051124c7b2ea469b88927b..0000000000000000000000000000000000000000 --- a/app/helpers/wikis/diffs_helper.rb +++ /dev/null @@ -1,48 +0,0 @@ -module Wikis::DiffsHelper - # not sure this is what we want. - # it's currently required by the Wiki::DiffsControllerTest - # but we might have remove diffs from the UI for now. - def back_to_wiki_link - wiki_path(@wiki) - end - - # some translations still have the %{user} and %{when} key. - # TODO clean them up and remove params here. - def comparing_changes_header - :comparing_changes_header.t(old_version: old_version_tag, - new_version: new_version_tag, - user: content_tag(:b, link_to_user(@new.user)), - when: content_tag(:i, full_time(@new.updated_at))).html_safe - end - - def old_version_tag - content_tag :del, short_description(@old, true), - class: 'diffmod', style: 'padding: 1px 4px;' - end - - def new_version_tag - content_tag :ins, short_description(@new, true), - class: 'diffins', style: 'padding: 1px 4px;' - end - - def diff_previous_link - if previous = @old.previous - link_to_remote (LARROW + :prev_change.t).html_safe, - url: wiki_diff_path(@wiki, @old.diff_id), - method: :get - else - content_tag :span, (LARROW + :prev_change.t).html_safe, class: 'disabled' - end - end - - def diff_next_link - if next_version = @new.next - link_to_remote (:next_change.t + RARROW).html_safe, - url: wiki_diff_path(@wiki, next_version.diff_id), - method: :get - else - content_tag :span, (:next_change.t + RARROW).html_safe, class: 'disabled' - end - end - -end diff --git a/app/views/wiki/diffs/_show.html.haml b/app/views/wiki/diffs/_show.html.haml deleted file mode 100644 index 7994bc31126a5ae2054491702eec6a7f21599f96..0000000000000000000000000000000000000000 --- a/app/views/wiki/diffs/_show.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.info - = comparing_changes_header - %br/ - %i= :changes_made.t when: full_time(@new.updated_at) - -.pagination - = diff_previous_link - = diff_next_link - -.diff.wiki - =@diff diff --git a/config/locales/en/wiki.yml b/config/locales/en/wiki.yml index bc1d17c5c91ceb37d2799d41aea1583f61c88b15..bb9dfbc20ebe35e5423687bc7641d3f31c5009f2 100644 --- a/config/locales/en/wiki.yml +++ b/config/locales/en/wiki.yml @@ -6,7 +6,6 @@ en: cant_find_wiki_section: "Can't find wiki section %{section}" changes_made: "Changes made %{when}." changes_might_be_overwritten: "Your changes might be overwritten." - comparing_changes_header: "Comparing changes between %{old_version} and %{new_version}." diff_link: "view changes" edit_wiki: "Edit Wiki" force_save_button: "Break Lock and Save" diff --git a/config/routes.rb b/config/routes.rb index 1bf31c06c85cafe5faf7c0dd9e9bd8170fe6b400..f988d2d8a1cb287601b56d7dcd268b3fed8e3281 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -219,7 +219,6 @@ Crabgrass::Application.routes.draw do post 'revert' end end - resources :diffs, only: [:show] end ## diff --git a/extensions/pages/wiki_page/test/functional/wiki/diffs_controller_test.rb b/extensions/pages/wiki_page/test/functional/wiki/diffs_controller_test.rb deleted file mode 100644 index c94bf15502df1c3135784e8dd64959f9113f6767..0000000000000000000000000000000000000000 --- a/extensions/pages/wiki_page/test/functional/wiki/diffs_controller_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'test_helper' - -class Wiki::DiffsControllerTest < ActionController::TestCase - fixtures :pages, :users, 'user/participations', :wikis, :groups - - def test_diff - login_as :orange - - (1..5).zip(%i[orange yellow blue red purple]).each do |i, user| - pages(:wiki).data.update_section!(:document, users(user), i, format('text %d for the wiki', i)) - end - - get :show, wiki_id: pages(:wiki).data_id, id: '4-5' - assert_response :success - - assert_equal assigns(:wiki).versions.reload.find_by_version(4).body_html, assigns(:old).body_html - assert_equal assigns(:wiki).versions.reload.find_by_version(5).body_html, assigns(:new).body_html - assert assigns(:diff).length > 10, 'difftext should contain something substantial' - end -end