Enable download of user credentials.

Closes #529.
This commit is contained in:
Akinori MUSHA 2014-09-24 22:52:12 +09:00
parent 67fa336fb9
commit b8a4c268ce
2 changed files with 6 additions and 3 deletions

View file

@ -8,7 +8,9 @@ class UserCredentialsController < ApplicationController
respond_to do |format|
format.html
format.json { render json: @user_credentials }
format.json {
send_data Utils.pretty_jsonify(@user_credentials.limit(nil).as_json), disposition: 'attachment'
}
end
end

View file

@ -37,8 +37,9 @@
<br/>
<div class="btn-group">
<%= link_to '<span class="glyphicon glyphicon-plus"></span> New Credential'.html_safe, new_user_credential_path, class: "btn btn-default" %>
<%= link_to new_user_credential_path, class: "btn btn-default" do %><span class="glyphicon glyphicon-plus"></span> New Credential<% end %>
<%= link_to user_credentials_path(format: :json), class: "btn btn-default" do %><span class="glyphicon glyphicon-download-alt"></span> Download Credentials<% end %>
</div>
</div>
</div>
</div>
</div>