Add show actions for note, artist, artist commentary versions.
Add these endpoints: * /note_versions/1234 * /artist_versions/1234 * /artist_commentary_versions/1234 This is so the /ip_addresses listing can link to these endpoints.
This commit is contained in:
@@ -5,4 +5,11 @@ class ArtistCommentaryVersionsController < ApplicationController
|
|||||||
@commentary_versions = ArtistCommentaryVersion.paginated_search(params)
|
@commentary_versions = ArtistCommentaryVersion.paginated_search(params)
|
||||||
respond_with(@commentary_versions)
|
respond_with(@commentary_versions)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@commentary_version = ArtistCommentaryVersion.find(params[:id])
|
||||||
|
respond_with(@commentary_version) do |format|
|
||||||
|
format.html { redirect_to artist_commentary_versions_path(search: { post_id: @commentary_version.post_id }) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,4 +6,10 @@ class ArtistVersionsController < ApplicationController
|
|||||||
respond_with(@artist_versions)
|
respond_with(@artist_versions)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@artist_version = ArtistVersion.find(params[:id])
|
||||||
|
respond_with(@artist_version) do |format|
|
||||||
|
format.html { redirect_to artist_versions_path(search: { artist_id: @artist_version.artist_id }) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,4 +6,11 @@ class NoteVersionsController < ApplicationController
|
|||||||
@note_versions = @note_versions.includes(:updater) if request.format.html?
|
@note_versions = @note_versions.includes(:updater) if request.format.html?
|
||||||
respond_with(@note_versions)
|
respond_with(@note_versions)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@note_version = NoteVersion.find(params[:id])
|
||||||
|
respond_with(@note_version) do |format|
|
||||||
|
format.html { redirect_to note_versions_path(search: { note_id: @note_version.note_id }) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :artist_urls, only: [:index, :update]
|
resources :artist_urls, only: [:index, :update]
|
||||||
resources :artist_versions, :only => [:index] do
|
resources :artist_versions, :only => [:index, :show] do
|
||||||
collection do
|
collection do
|
||||||
get :search
|
get :search
|
||||||
end
|
end
|
||||||
@@ -180,7 +180,7 @@ Rails.application.routes.draw do
|
|||||||
put :revert
|
put :revert
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :note_versions, :only => [:index]
|
resources :note_versions, :only => [:index, :show]
|
||||||
resource :note_previews, :only => [:show]
|
resource :note_previews, :only => [:show]
|
||||||
resources :pools do
|
resources :pools do
|
||||||
member do
|
member do
|
||||||
@@ -243,7 +243,7 @@ Rails.application.routes.draw do
|
|||||||
put :revert
|
put :revert
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :artist_commentary_versions, :only => [:index]
|
resources :artist_commentary_versions, :only => [:index, :show]
|
||||||
resource :related_tag, :only => [:show, :update]
|
resource :related_tag, :only => [:show, :update]
|
||||||
get "reports/uploads" => "reports#uploads"
|
get "reports/uploads" => "reports#uploads"
|
||||||
get "reports/upload_tags" => "reports#upload_tags"
|
get "reports/upload_tags" => "reports#upload_tags"
|
||||||
|
|||||||
@@ -2,14 +2,11 @@ require 'test_helper'
|
|||||||
|
|
||||||
class ArtistCommentaryVersionsControllerTest < ActionDispatch::IntegrationTest
|
class ArtistCommentaryVersionsControllerTest < ActionDispatch::IntegrationTest
|
||||||
context "The artist commentary versions controller" do
|
context "The artist commentary versions controller" do
|
||||||
setup do
|
setup do
|
||||||
@user = FactoryBot.create(:user)
|
@user = create(:user)
|
||||||
|
@commentary1 = as(@user) { create(:artist_commentary) }
|
||||||
as_user do
|
@commentary2 = as(@user) { create(:artist_commentary) }
|
||||||
@commentary1 = FactoryBot.create(:artist_commentary)
|
end
|
||||||
@commentary2 = FactoryBot.create(:artist_commentary)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "index action" do
|
context "index action" do
|
||||||
should "render" do
|
should "render" do
|
||||||
@@ -17,5 +14,15 @@ class ArtistCommentaryVersionsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "show action" do
|
||||||
|
should "work" do
|
||||||
|
get artist_commentary_version_path(@commentary1.versions.first)
|
||||||
|
assert_redirected_to artist_commentary_versions_path(search: { post_id: @commentary1.post_id })
|
||||||
|
|
||||||
|
get artist_commentary_version_path(@commentary1.versions.first), as: :json
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ require 'test_helper'
|
|||||||
class ArtistVersionsControllerTest < ActionDispatch::IntegrationTest
|
class ArtistVersionsControllerTest < ActionDispatch::IntegrationTest
|
||||||
context "An artist versions controller" do
|
context "An artist versions controller" do
|
||||||
setup do
|
setup do
|
||||||
@user = FactoryBot.create(:gold_user)
|
@user = create(:gold_user)
|
||||||
as_user do
|
@artist = as(@user) { create(:artist) }
|
||||||
@artist = create(:artist)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
should "get the index page" do
|
should "get the index page" do
|
||||||
@@ -18,5 +16,15 @@ class ArtistVersionsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
get_auth artist_versions_path(search: {name: @artist.name}), @user
|
get_auth artist_versions_path(search: {name: @artist.name}), @user
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "show action" do
|
||||||
|
should "work" do
|
||||||
|
get artist_version_path(@artist.versions.first)
|
||||||
|
assert_redirected_to artist_versions_path(search: { artist_id: @artist.id })
|
||||||
|
|
||||||
|
get artist_version_path(@artist.versions.first), as: :json
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,24 +4,14 @@ class NoteVersionsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
context "The note versions controller" do
|
context "The note versions controller" do
|
||||||
setup do
|
setup do
|
||||||
@user = create(:user)
|
@user = create(:user)
|
||||||
|
@user_2 = create(:user)
|
||||||
|
|
||||||
|
as(@user) { @note = create(:note) }
|
||||||
|
as(@user_2) { @note.update(body: "1 2") }
|
||||||
|
as(@user) { @note.update(body: "1 2 3") }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "index action" do
|
context "index action" do
|
||||||
setup do
|
|
||||||
as_user do
|
|
||||||
@note = create(:note)
|
|
||||||
end
|
|
||||||
@user_2 = create(:user)
|
|
||||||
|
|
||||||
CurrentUser.scoped(@user_2, "1.2.3.4") do
|
|
||||||
@note.update(body: "1 2")
|
|
||||||
end
|
|
||||||
|
|
||||||
CurrentUser.scoped(@user, "1.2.3.4") do
|
|
||||||
@note.update(body: "1 2 3")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
should "list all versions" do
|
should "list all versions" do
|
||||||
get note_versions_path
|
get note_versions_path
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@@ -32,5 +22,15 @@ class NoteVersionsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "show action" do
|
||||||
|
should "work" do
|
||||||
|
get note_version_path(@note.versions.first)
|
||||||
|
assert_redirected_to note_versions_path(search: { note_id: @note.id })
|
||||||
|
|
||||||
|
get note_version_path(@note.versions.first), as: :json
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user