Reorganised OAuth clients and tokens details page. Made clients info editable and some more stuff translatable in the OAuth pages.

This commit is contained in:
Matt Amos 2009-08-03 17:08:40 +00:00
parent 7c1cde7035
commit 655dc6787e
9 changed files with 109 additions and 112 deletions

View file

@ -1,40 +1,23 @@
<div class="field">
<label for="client_application_name">Name*</label><br/>
<label for="client_application_name"><%= t'oauth.client_application.form.name' %> (<%= t'oauth.client_application.form.required' %>)</label><br/>
<%= f.text_field :name %>
</div>
<div class="field">
<label for="client_application_url">Main Application URL*</label><br/>
<label for="client_application_url"><%= t'oauth.client_application.form.url' %> (<%= t'oauth.client_application.form.required' %>)</label><br/>
<%= f.text_field :url %>
</div>
<div class="field">
<label for="client_application_callback_url">Callback URL*</label><br/>
<label for="client_application_callback_url"><%= t'oauth.client_application.form.callback_url' %></label><br/>
<%= f.text_field :callback_url %>
</div>
<div class="field">
<label for="client_application_support_url">Support URL</label><br/>
<label for="client_application_support_url"><%= t'oauth.client_application.form.support_url' %></label><br/>
<%= f.text_field :support_url %>
</div>
<p><%= t'oauth.client_application.form.requests' %></p>
<% ClientApplication.all_permissions.each do |perm| %>
<div class="field">
<%= f.check_box :allow_read_prefs %>
<label for="client_application_allow_read_prefs">Request permission to read the user preferences.</label><br/>
</div>
<div class="field">
<%= f.check_box :allow_write_prefs %>
<label for="client_application_allow_write_prefs">Request permission to write the user preferences.</label><br/>
</div>
<div class="field">
<%= f.check_box :allow_write_diary %>
<label for="client_application_allow_write_diary">Request permission to create diary entries, comments and friends.</label><br/>
</div>
<div class="field">
<%= f.check_box :allow_write_api %>
<label for="client_application_allow_write_api">Request permission to write the API on the user's behalf.</label><br/>
</div>
<div class="field">
<%= f.check_box :allow_read_gpx %>
<label for="client_application_allow_read_gpx">Request permission to read the user's private GPS traces.</label><br/>
</div>
<div class="field">
<%= f.check_box :allow_write_gpx %>
<label for="client_application_allow_write_gpx">Request permission to upload GPS traces as the user.</label><br/>
<%= f.check_box perm %>
<label for="client_application_<%= perm.to_s %>"><%= t('oauth.client_application.form.' + perm.to_s) %></label><br/>
</div>
<% end %>

View file

@ -1,5 +1,6 @@
<h1>Edit your application</h1>
<% form_for :client_application do |f| %>
<h1><%= t'oauth.client_application.edit.title' %></h1>
<% form_for :client_application, @client_application, :url => oauth_client_path(@client_application), :html => { :method => :put } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<%= submit_tag "Edit" %>
<% end %>
<br/>
<%= submit_tag t'oauth.client_application.edit.submit' %>
<% end %>

View file

@ -1,9 +1,10 @@
<div class="flash"><%= flash[:notice] %></div>
<h1>OAuth Client Applications</h1>
<h1><%= t'oauth.client_application.index.title' %></h1>
<% unless @tokens.empty? %>
<p>The following tokens have been issued to applications in your name</p>
<h3><%= t'oauth.client_application.index.my_tokens' %></h3>
<p><%= t'oauth.client_application.index.list_tokens' %></p>
<table>
<tr><th>Application</th><th>Issued</th><th>&nbsp;</th></tr>
<tr><th><%= t'oauth.client_application.index.application' %></th>
<th><%= t'oauth.client_application.index.issued_at' %></th><th>&nbsp;</th></tr>
<% @tokens.each do |token|%>
<% content_tag_for :tr, token do %>
<td><%= link_to token.client_application.name, token.client_application.url %></td>
@ -11,29 +12,22 @@
<td>
<% form_tag :controller => 'oauth', :action => 'revoke' do %>
<%= hidden_field_tag 'token', token.token %>
<%= submit_tag "Revoke!" %>
<%= submit_tag t('oauth.client_application.index.revoke') %>
<% end %>
</td>
<% end %>
<% end %>
</table>
<% end %>
<h3>Application Developers</h3>
<h3><%= t'oauth.client_application.index.my_apps' %></h3>
<% if @client_applications.empty? %>
<p>
Do you have an application you would like to register for use with us using the <a href="http://oauth.net">OAuth</a> standard?
</p>
<p>
You must register your web application before it can make OAuth requests to this service
</p>
<p><%= t('oauth.client_application.index.no_apps', :oauth => "<a href=\"http://oauth.net\">OAuth</a>") %></p>
<% else %>
<p>
You have the following client applications registered:
</p>
<% @client_applications.each do |client|%>
<% div_for client do %>
<%= link_to client.name, :action => :show, :id => client.id %>
<% end %>
<% end %>
<p><%= t'oauth.client_application.index.registered_apps' %></p>
<% @client_applications.each do |client|%>
<% div_for client do %>
<%= link_to client.name, :action => :show, :id => client.id %>
<% end %>
<% end %>
<h3><%= link_to "Register your application", :action => :new %></h3>
<% end %>
<h3><%= link_to t('oauth.client_application.index.register_new'), :action => :new %></h3>

View file

@ -1,6 +1,6 @@
<h1>Register a new application</h1>
<h1><%= t'oauth.client_application.new.title' %></h1>
<% form_for :client_application, :url => { :action => :create } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<br />
<%= submit_tag "Register" %>
<%= submit_tag t'oauth.client_application.new.submit' %>
<% end %>

View file

@ -1,20 +1,28 @@
<h1>OAuth details for <%=@client_application.name %></h1>
<h1><%= t('oauth.client_application.show.title', :app_name => @client_application.name) %></h1>
<p>
<b>Consumer Key:</b> <%=@client_application.key %>
<b><%= t'oauth.client_application.show.key' %></b> <%=@client_application.key %>
</p>
<p>
<b>Consumer Secret:</b> <%=@client_application.secret %>
<b><%= t'oauth.client_application.show.secret' %></b> <%=@client_application.secret %>
</p>
<p>
<b>Request Token URL</b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.request_token_path %>
<b><%= t'oauth.client_application.show.url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.request_token_path %>
</p>
<p>
<b>Access Token URL</b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.access_token_path %>
<b><%= t'oauth.client_application.show.access_url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.access_token_path %>
</p>
<p>
<b>Authorize URL</b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.authorize_path %>
<b><%= t'oauth.client_application.show.authorize_url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.authorize_path %>
</p>
<p>
We support hmac-sha1 (recommended) as well as plain text in ssl mode.
</p>
<p><%= t'oauth.client_application.show.requests' %></p>
<ul><% @client_application.permissions.each do |perm| %>
<div class="field">
<li><%= t('oauth.client_application.form.' + perm.to_s) %></li>
</div>
<% end %></ul>
<p><%= t'oauth.client_application.show.support_notice' %></p>
<p><%= link_to t('oauth.client_application.show.edit'), edit_oauth_client_url(@client_application) %></p>