From: Tom Hughes Date: Wed, 19 Aug 2009 07:59:15 +0000 (+0000) Subject: Cleanup some of the oauth stuff: X-Git-Tag: live~7322 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/173e92edb838ca423db1637cd767543a582f1c07 Cleanup some of the oauth stuff: - Detabify views. - Move translations to correct names. - Make flash messages translatable. --- diff --git a/app/controllers/oauth_clients_controller.rb b/app/controllers/oauth_clients_controller.rb index 94a7d4d5b..f90302894 100644 --- a/app/controllers/oauth_clients_controller.rb +++ b/app/controllers/oauth_clients_controller.rb @@ -17,7 +17,7 @@ class OauthClientsController < ApplicationController def create @client_application = @user.client_applications.build(params[:client_application]) if @client_application.save - flash[:notice] = "Registered the information successfully" + flash[:notice] = t'oauth_clients.create.flash' redirect_to :action => "show", :id => @client_application.id else render :action => "new" @@ -38,7 +38,7 @@ class OauthClientsController < ApplicationController def update @client_application = @user.client_applications.find(params[:id]) if @client_application.update_attributes(params[:client_application]) - flash[:notice] = "Updated the client information successfully" + flash[:notice] = t'oauth_clients.update.flash' redirect_to :action => "show", :id => @client_application.id else render :action => "edit" @@ -48,7 +48,7 @@ class OauthClientsController < ApplicationController def destroy @client_application = @user.client_applications.find(params[:id]) @client_application.destroy - flash[:notice] = "Destroyed the client application registration" + flash[:notice] = t'oauth_clients.destroy.flash' redirect_to :action => "index" end end diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb index c8ae12277..8af8af5e7 100644 --- a/app/controllers/oauth_controller.rb +++ b/app/controllers/oauth_controller.rb @@ -75,7 +75,7 @@ class OauthController < ApplicationController @token = @user.oauth_tokens.find_by_token params[:token] if @token @token.invalidate! - flash[:notice] = "You've revoked the token for #{@token.client_application.name}" + flash[:notice] = t('oauth.revoke.flash', :application => @token.client_application.name) end logger.info "about to redirect" redirect_to :controller => 'oauth_clients', :action => 'index' diff --git a/app/views/oauth/oauthorize.html.erb b/app/views/oauth/oauthorize.html.erb index 0b9d321fe..844a86d52 100644 --- a/app/views/oauth/oauthorize.html.erb +++ b/app/views/oauth/oauthorize.html.erb @@ -1,17 +1,15 @@

Authorize access to your account

-

<%= t('oauth.client_application.request_access', :app_name => link_to(@token.client_application.name,@token.client_application.url)) %>

+

<%= t('oauth.oauthorize.request_access', :app_name => link_to(@token.client_application.name,@token.client_application.url)) %>

<% form_tag authorize_url do %> <%= hidden_field_tag "oauth_token", @token.token %> <%- if params[:oauth_callback] -%> - <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %> -<%- end -%> -

<%= t 'oauth.client_application.allow_to' %>

- -

- <%= submit_tag %> -

+ <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %> + <%- end -%> +

<%= t 'oauth.oauthorize.allow_to' %>

+ +

<%= submit_tag %>

<% end %> diff --git a/app/views/oauth_clients/_form.html.erb b/app/views/oauth_clients/_form.html.erb index f8fd4347e..dc8f8e3d9 100644 --- a/app/views/oauth_clients/_form.html.erb +++ b/app/views/oauth_clients/_form.html.erb @@ -1,23 +1,23 @@
-
- <%= f.text_field :name %> +
+ <%= f.text_field :name %>
-
- <%= f.text_field :url %> +
+ <%= f.text_field :url %>
-
- <%= f.text_field :callback_url %> +
+ <%= f.text_field :callback_url %>
-
- <%= f.text_field :support_url %> +
+ <%= f.text_field :support_url %>
-

<%= t'oauth.client_application.form.requests' %>

+

<%= t'oauth_clients.form.requests' %>

<% ClientApplication.all_permissions.each do |perm| %>
<%= f.check_box perm %> -
+
<% end %> diff --git a/app/views/oauth_clients/edit.html.erb b/app/views/oauth_clients/edit.html.erb index 855fc03d8..085ddef4e 100644 --- a/app/views/oauth_clients/edit.html.erb +++ b/app/views/oauth_clients/edit.html.erb @@ -1,6 +1,6 @@ -

<%= t'oauth.client_application.edit.title' %>

+

<%= t'oauth_clients.edit.title' %>

<% form_for :client_application, @client_application, :url => oauth_client_path(@client_application.user.display_name, @client_application), :html => { :method => :put } do |f| %> - <%= render :partial => "form", :locals => { :f => f } %> -
- <%= submit_tag t'oauth.client_application.edit.submit' %> + <%= render :partial => "form", :locals => { :f => f } %> +
+ <%= submit_tag t'oauth_clients.edit.submit' %> <% end %> diff --git a/app/views/oauth_clients/index.html.erb b/app/views/oauth_clients/index.html.erb index 9f11cddef..d95c68bcb 100644 --- a/app/views/oauth_clients/index.html.erb +++ b/app/views/oauth_clients/index.html.erb @@ -1,10 +1,10 @@ -

<%= t'oauth.client_application.index.title' %>

+

<%= t'oauth_clients.index.title' %>

<% unless @tokens.empty? %> -

<%= t'oauth.client_application.index.my_tokens' %>

-

<%= t'oauth.client_application.index.list_tokens' %>

+

<%= t'oauth_clients.index.my_tokens' %>

+

<%= t'oauth_clients.index.list_tokens' %>

- - + + <% @tokens.each do |token|%> <% content_tag_for :tr, token do %> @@ -12,22 +12,22 @@ <% end %> <% end %>
<%= t'oauth.client_application.index.application' %><%= t'oauth.client_application.index.issued_at' %> 
<%= t'oauth_clients.index.application' %><%= t'oauth_clients.index.issued_at' %> 
<%= link_to token.client_application.name, token.client_application.url %> <% form_tag :controller => 'oauth', :action => 'revoke' do %> <%= hidden_field_tag 'token', token.token %> - <%= submit_tag t('oauth.client_application.index.revoke') %> + <%= submit_tag t('oauth_clients.index.revoke') %> <% end %>
<% end %> -

<%= t'oauth.client_application.index.my_apps' %>

+

<%= t'oauth_clients.index.my_apps' %>

<% if @client_applications.empty? %> -

<%= t('oauth.client_application.index.no_apps', :oauth => "OAuth") %>

+

<%= t('oauth_clients.index.no_apps', :oauth => "OAuth") %>

<% else %> -

<%= t'oauth.client_application.index.registered_apps' %>

+

<%= t'oauth_clients.index.registered_apps' %>

<% @client_applications.each do |client|%> <% div_for client do %> <%= link_to client.name, :action => :show, :id => client.id %> <% end %> <% end %> <% end %> -

<%= link_to t('oauth.client_application.index.register_new'), :action => :new %>

+

<%= link_to t('oauth_clients.index.register_new'), :action => :new %>

diff --git a/app/views/oauth_clients/new.html.erb b/app/views/oauth_clients/new.html.erb index 0c2ab16fb..292c53fc0 100644 --- a/app/views/oauth_clients/new.html.erb +++ b/app/views/oauth_clients/new.html.erb @@ -1,6 +1,6 @@ -

<%= t'oauth.client_application.new.title' %>

+

<%= t'oauth_clients.new.title' %>

<% form_for :client_application, :url => { :action => :create } do |f| %> <%= render :partial => "form", :locals => { :f => f } %>
- <%= submit_tag t('oauth.client_application.new.submit') %> + <%= submit_tag t('oauth_clients.new.submit') %> <% end %> diff --git a/app/views/oauth_clients/not_found.erb b/app/views/oauth_clients/not_found.erb index 9a9865b73..d5c6ca755 100644 --- a/app/views/oauth_clients/not_found.erb +++ b/app/views/oauth_clients/not_found.erb @@ -1 +1 @@ -

<%= t('oauth.client_application.not_found', :type => @type) %>

+

<%= t('oauth_clients.not_found.sorry', :type => @type) %>

diff --git a/app/views/oauth_clients/show.html.erb b/app/views/oauth_clients/show.html.erb index df8fbc248..2769fcd28 100644 --- a/app/views/oauth_clients/show.html.erb +++ b/app/views/oauth_clients/show.html.erb @@ -1,28 +1,27 @@ -

<%= t('oauth.client_application.show.title', :app_name => @client_application.name) %>

+

<%= t('oauth_clients.show.title', :app_name => @client_application.name) %>

- <%= t'oauth.client_application.show.key' %> <%=@client_application.key %> + <%= t'oauth_clients.show.key' %> <%=@client_application.key %>

- <%= t'oauth.client_application.show.secret' %> <%=@client_application.secret %> + <%= t'oauth_clients.show.secret' %> <%=@client_application.secret %>

- <%= t'oauth.client_application.show.url' %> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.request_token_path %> + <%= t'oauth_clients.show.url' %> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.request_token_path %>

- <%= t'oauth.client_application.show.access_url' %> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.access_token_path %> + <%= t'oauth_clients.show.access_url' %> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.access_token_path %>

- <%= t'oauth.client_application.show.authorize_url' %> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.authorize_path %> + <%= t'oauth_clients.show.authorize_url' %> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.authorize_path %>

-

<%= t'oauth.client_application.show.requests' %>

+

<%= t'oauth_clients.show.requests' %>

-

<%= t'oauth.client_application.show.support_notice' %>

- -

<%= link_to t('oauth.client_application.show.edit'), edit_oauth_client_url(@client_application.user.display_name, @client_application) %>

+

<%= t'oauth_clients.show.support_notice' %>

+

<%= link_to t('oauth_clients.show.edit'), edit_oauth_client_url(@client_application.user.display_name, @client_application) %>