<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 %>
-<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 %>
\ No newline at end of file
+ <br/>
+ <%= submit_tag t'oauth.client_application.edit.submit' %>
+<% end %>
-<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> </th></tr>
+ <tr><th><%= t'oauth.client_application.index.application' %></th>
+ <th><%= t'oauth.client_application.index.issued_at' %></th><th> </th></tr>
<% @tokens.each do |token|%>
<% content_tag_for :tr, token do %>
<td><%= link_to token.client_application.name, token.client_application.url %></td>
<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 %>
<% end %>
-<h3><%= link_to "Register your application", :action => :new %></h3>
+<h3><%= link_to t('oauth.client_application.index.register_new'), :action => :new %></h3>
-<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 %>
-<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>
\ No newline at end of file
+<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>
+
<br /><br />
<%= button_to t('user.account.make all my edits public button'), :action => :go_public %>
<% end %>
-<h2><%= t 'user.account.my apps' %></h2>
-<% if @tokens.empty? %>
-<p><%= t 'oauth.token.none' %></p>
-<% else %>
-<table>
- <tr><th><%= t 'oauth.token.application' %></th><th><%= t 'oauth.token.issued' %></th><th> </th></tr>
- <% @tokens.each do |token|%>
- <% content_tag_for :tr, token do %>
- <td><%= link_to token.client_application.name, token.client_application.url %></td>
- <td><%= token.authorized_at %></td>
- <td>
- <% form_tag :controller => 'oauth', :action => 'revoke' do %>
- <%= hidden_field_tag 'token', token.token %>
- <%= submit_tag t('oauth.token.revoke') %>
- <% end %>
- </td>
- <% end %>
- <% end %>
-</table>
-<% end %>
-<h2><%= t 'user.account.developers' %></h2>
-<% if @user.client_applications.empty? %>
-<p><%= t 'user.account.dev_intro', :link => "<a href=\"http://oauth.net\">OAuth</a>" %></p>
-<p><%= link_to t('user.account.register_app'), :controller => 'oauth_clients', :action => :new %></p>
-<% else %>
-<p><%= t 'user.account.apps_registered' %></p>
-<ul><% @user.client_applications.each do |client| %>
- <li><% div_for client do %>
- <%= link_to client.name, :controller => 'oauth_clients', :action => :show, :id => client.id %>
- <% end %></li>
-<% end %></ul>
-<p><%= link_to t('user.account.register_another_app'), :controller => 'oauth_clients', :action => :new %></p>
-<% end %>
<br/>
<br/>
<%= link_to t('user.account.return to profile'), :controller => 'user', :action => @user.display_name %>
<br/>
<% if @user and @this_user.id == @user.id %>
<%= link_to t('user.view.change your settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
+<br/><br/>
+<%= link_to t('user.view.my_oauth_details'), :controller => 'oauth_clients', :action => 'index' %>
<% end %>
allow_write_api: "modify the map."
allow_read_gpx: "read your private GPS traces."
allow_write_gpx: "upload GPS traces."
- token:
- none: "You have not authorised any clients to act on your behalf. You do not have to do anything now to authorise them, as they will ask for authorisation when they need it. After that time you can return here to revoke those permissions if you do not want the clients to have your authorisation any more."
- application: "Application"
- issued: "Issued"
- revoke: "Revoke!"
+ new:
+ title: "Register a new application"
+ submit: "Register"
+ edit:
+ title: "Edit your application"
+ submit: "Edit"
+ show:
+ title: "OAuth details for {{app_name}}"
+ key: "Consumer Key:"
+ secret: "Consumer Secret:"
+ url: "Request Token URL:"
+ access_url: "Access Token URL:"
+ authorize_url: "Authorise URL:"
+ support_notice: "We support hmac-sha1 (recommended) as well as plain text in ssl mode."
+ edit: "Edit Details"
+ requests: "Requesting the following permissions from the user:"
+ allow_read_prefs: "read their user preferences."
+ allow_write_prefs: "modify their user preferences."
+ allow_write_diary: "create diary entries, comments and make friends."
+ allow_write_api: "modify the map."
+ allow_read_gpx: "read their private GPS traces."
+ allow_write_gpx: "upload GPS traces."
+ index:
+ title: "My OAuth Details"
+ my_tokens: "My Authorised Applications"
+ list_tokens: "The following tokens have been issued to applications in your name:"
+ application: "Application Name"
+ issued_at: "Issued At"
+ revoke: "Revoke!"
+ my_apps: "My Client Applications"
+ no_apps: "Do you have an application you would like to register for use with us using the {{oauth}} standard? You must register your web application before it can make OAuth requests to this service."
+ registered_apps: "You have the following client applications registered:"
+ register_new: "Register your application"
+ form:
+ name: "Name"
+ required: "Required"
+ url: "Main Application URL"
+ callback_url: "Callback URL"
+ support_url: "Support URL"
+ requests: "Request the following permissions from the user:"
+ allow_read_prefs: "read their user preferences."
+ allow_write_prefs: "modify their user preferences."
+ allow_write_diary: "create diary entries, comments and make friends."
+ allow_write_api: "modify the map."
+ allow_read_gpx: "read their private GPS traces."
+ allow_write_gpx: "upload GPS traces."
user:
login:
title: "Login"
nearby users: "Nearby users: "
no nearby users: "There are no users who admit to mapping nearby yet."
change your settings: change your settings
+ my_oauth_details: "View my OAuth details"
friend_map:
your location: Your location
nearby mapper: "Nearby mapper: "
return to profile: Return to profile
flash update success confirm needed: "User information updated successfully. Check your email for a note to confirm your new email address."
flash update success: "User information updated successfully."
- my apps: "My client applications"
- developers: "Application Developers"
- dev_intro: "Have you written an application which you would like to register to make {{link}} requests to the OpenStreetMap server?"
- register_app: "Register your application"
- apps_registered: "You have the following client applications registered:"
- register_another_app: "Register another application"
confirm:
heading: Confirm a user account
press confirm button: "Press the confirm button below to activate your account."
# run through the procedure of creating a client application and checking
# that it shows up on the user's account page.
def test_create_application
- post '/login', {'user[email]' => "test@example.com", 'user[password]' => "test", :referer => '/user/test/account'}
+ post '/login', {'user[email]' => "test@example.com", 'user[password]' => "test", :referer => '/user/test2'}
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template 'user/account'
+ assert_template 'user/view'
# check that the form to allow new client application creations exists
assert_in_body do
- assert_select "h2", "Application Developers"
+ assert_select "a[href='/oauth_clients']"
+ end
+
+ # now we follow the link to the oauth client list
+ get '/oauth_clients'
+ assert_response :success
+ assert_in_body do
assert_select "a[href='/oauth_clients/new']"
end
assert_equal 'Registered the information successfully', flash[:notice]
# now go back to the account page and check its listed under this user
- get '/user/test/account'
+ get '/oauth_clients'
assert_response :success
- assert_template 'user/account'
- assert_in_body { assert_select "li>div>a", "My New App" }
+ assert_template 'oauth_clients/index'
+ assert_in_body { assert_select "div>a", "My New App" }
end
##