From abefc91a42117c08955d8bdd28138630f7027a84 Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 23 Feb 2013 12:15:23 -0500 Subject: [PATCH] add legacy artist xml api --- app/controllers/legacy_controller.rb | 8 ++++++-- app/views/legacy/artists.xml.erb | 6 ++++++ config/routes.rb | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 app/views/legacy/artists.xml.erb diff --git a/app/controllers/legacy_controller.rb b/app/controllers/legacy_controller.rb index dc0db8ccf..2a5e02e3f 100644 --- a/app/controllers/legacy_controller.rb +++ b/app/controllers/legacy_controller.rb @@ -21,11 +21,15 @@ class LegacyController < ApplicationController end def users - @users = User.search(params).limit(100) + @users = User.limit(100).search(params).paginate(params[:page]) end def tags - @tags = Tag.search(params).limit(100) + @tags = Tag.limit(100).search(params).paginate(params[:page]) + end + + def artists + @artists = Artist.limit(100).search(params[:search]).paginate(params[:page]) end def unavailable diff --git a/app/views/legacy/artists.xml.erb b/app/views/legacy/artists.xml.erb new file mode 100644 index 000000000..f545b6051 --- /dev/null +++ b/app/views/legacy/artists.xml.erb @@ -0,0 +1,6 @@ + + + <% @artists.each do |artist| %> + " is_active="<%= artist.is_active? %>" name="<%= artist.name %>" updater_id="0" id="<%= artist.id %>" version="0"/> + <% end %> + diff --git a/config/routes.rb b/config/routes.rb index f005bd2be..a3dc2fe14 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -201,6 +201,7 @@ Danbooru::Application.routes.draw do # legacy aliases match "/artist" => redirect {|params, req| "/artists?page=#{req.params[:page]}"} + match "/artist/index.xml", :controller => "legacy", :action => "artists" match "/artist/index" => redirect {|params, req| "/artists?page=#{req.params[:page]}"} match "/artist/show/:id" => redirect("/artists/%{id}") match "/artist/show" => redirect {|params, req| "/artists?name=#{CGI::escape(req.params[:name])}"}