Skip to content

Commit

Permalink
Allow exporting only differing usernames. Closes #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
henrik committed Dec 19, 2010
1 parent f9a7f3b commit a939a29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app.rb
Expand Up @@ -60,7 +60,11 @@ class Mapping < Sequel::Model

get '/export.json' do
content_type :json
Mapping.select(:delicious, :pinboard).order(:delicious).map { |m| m.values }.to_json
mappings = Mapping.select(:delicious, :pinboard).order(:delicious)
if params[:different]
mappings = mappings.where('delicious != pinboard')
end
mappings.map { |m| m.values }.to_json
end

def render_list
Expand Down
3 changes: 2 additions & 1 deletion index.haml
Expand Up @@ -72,6 +72,7 @@

%footer
%p
<a href="/export.json">Export all mappings as JSON</a>.
<a href="/export.json">Export all mappings as JSON</a> (<a href="/export.json?different=true">only when usernames differ</a>).
%p
By <a href="http://henrik.nyh.se">Henrik Nyh</a>.
<a href="https://github.com/henrik/delpin">View source on GitHub</a>.

0 comments on commit a939a29

Please sign in to comment.