File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,8 +134,7 @@ def preview
134134 flash [ :notice ] << t ( ".preview.remove_skin" )
135135 flash [ :notice ] << t ( ".preview.tip" )
136136 flash [ :notice ] << ( "<a href='#{ skin_path ( @skin ) } ' class='action' role='button'>" . html_safe + t ( ".preview.return_to_skin" ) + "</a>" . html_safe )
137- tag = FilterCount . where ( "public_works_count BETWEEN 10 AND 20" ) . random_order . first . filter
138- redirect_to tag_works_path ( tag , site_skin : @skin . id )
137+ redirect_to "#{ ArchiveConfig . SKIN_PREVIEW_URL } ?site_skin=#{ @skin . id } "
139138 end
140139
141140 def set
Original file line number Diff line number Diff line change @@ -802,3 +802,9 @@ PSEUD_SHARDS: 5
802802TAG_SHARDS : 5
803803USER_SHARDS : 5
804804WORKS_SHARDS : 5
805+
806+ # The relative URL to redirect to when previewing a skin
807+ # e.g. /works -> http://test.archiveofourown.org/works?site_skin=[skin_id]
808+ # Production should pick something more suitable with roughly 1-20 works and
809+ # predictable content such as /users/OTW_Translation/works
810+ SKIN_PREVIEW_URL : ' /works'
Original file line number Diff line number Diff line change 310310 public_site_page_title : Public Site Skins
311311 public_work_page_title : Public Work Skins
312312 preview :
313- skin_title : " You are previewing the skin %{title}. This is a randomly chosen page. "
313+ skin_title : " You are previewing the skin %{title}."
314314 remove_skin : " Go back or click any link to remove the skin."
315315 tip : " Tip: You can preview any archive page you want by tacking on '?site_skin=[skin_id]' like you can see in the url above."
316316 return_to_skin : " Return To Skin To Use"
Original file line number Diff line number Diff line change 133133 end
134134 end
135135
136+ describe "GET #preview" do
137+ context "with a public site skin" do
138+ let ( :skin ) { create ( :skin , :public ) }
139+
140+ it "redirects to the configured preview page" do
141+ get :preview , params : { id : skin . id }
142+ it_redirects_to_simple ( "#{ ArchiveConfig . SKIN_PREVIEW_URL } ?site_skin=#{ skin . id } " )
143+ expect ( flash [ :notice ] ) . to include ( "You are previewing the skin #{ skin . title } ." )
144+ end
145+ end
146+ end
147+
136148 describe "PUT #update" do
137149 shared_examples "an action guests and random logged-in users can't access" do |attribute :, value :|
138150 context "when logged in as a user who is not the skin author" do
You can’t perform that action at this time.
0 commit comments