diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb index b8c111af..690bba1f 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb @@ -43,7 +43,7 @@ Metamaps.Active = { Metamaps.Maps = {}; $(document).ready(function () { - + function init() { for (var prop in Metamaps) { // this runs the init function within each sub-object on the Metamaps one @@ -55,11 +55,13 @@ $(document).ready(function () { Metamaps[prop].init(); } } + } // initialize the famous ui var callFamous = function(){ if (Metamaps.Famous) { Metamaps.Famous.build(); + init(); } else { setTimeout(callFamous, 100); diff --git a/app/assets/stylesheets/apps.css.erb b/app/assets/stylesheets/apps.css.erb new file mode 100644 index 00000000..e6d75dd7 --- /dev/null +++ b/app/assets/stylesheets/apps.css.erb @@ -0,0 +1,131 @@ +.centerContent { + position: relative; + margin: 92px auto 0 auto; + padding: 20px 0 60px 20px; + width: 760px; + overflow: hidden; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + background: #fff; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + border: 1px solid #dcdcdc; + margin-bottom: 10px; + padding: 15px; +} + +.centerContent .page-header { + margin-bottom: 20px; + padding-bottom: 8px; + border-bottom: 1px solid #DCDCDC; +} + +.centerContent .form-group { + margin-bottom: 20px; +} + +.centerContent .inline-button { + display: inline-block; +} + +.centerContent.showApp p { + margin-bottom: 20px; +} + +.centerContent a { + color: #4fb5c0; +} +.centerContent a:hover { + text-decoration: underline; +} + +.centerContent a.button { + color: #FFFFFF; +} + +.centerContent a.button:hover { + text-decoration: none; +} + +.centerContent th { + text-align: left; +} + +.centerContent td { + padding-right: 20px; + padding-bottom: 20px; +} + +.centerContent .link-button { + line-height: 32px; + color: #FFFFFF; +} + +.centerContent .button-margin { + margin-bottom: 20px; +} + +.centerContent .button-margin-top { + margin-top: 20px; +} + +.centerContent a.red-button, .centerContent button.red-button, +.centerContent input[type="submit"].red-button { + color: #c04f4f; + background: transparent; + text-transform: none; +} +.centerContent .red-button:hover { + background: transparent; + color: #9A3E3E !important; +} + +.centerContent input[type="text"] { + font-family: 'din-medium', helvetica, sans-serif; + width: 400px; + height: 32px; + font-size: 14px; + direction: ltr; + -webkit-appearance: none; + appearance: none; + display: inline-block; + margin: 0; + padding: 0 8px; + background: #fff; + border: 1px solid #d9d9d9; + border-top: 1px solid #c0c0c0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 2px; + color: #424242; + letter-spacing: normal; + word-spacing: normal; + text-transform: none; + text-indent: 0px; + text-shadow: none; + display: inline-block; + text-align: start; +} + +.centerContent textarea { + color: #424242; + padding: 8px; + border: 1px solid #d9d9d9; + border-top: 1px solid #c0c0c0; + resize: none; + letter-spacing: normal; + word-spacing: normal; + text-transform: none; + text-indent: 0px; + text-shadow: none; + text-align: start; + font-family: 'din-medium', helvetica, sans-serif; + font-size: 14px; + line-height: 17px; + width: 400px; + box-sizing: border-box; + border-radius: 2px; +} diff --git a/app/controllers/api/restful_controller.rb b/app/controllers/api/restful_controller.rb index 06396e3d..721cd33c 100644 --- a/app/controllers/api/restful_controller.rb +++ b/app/controllers/api/restful_controller.rb @@ -30,18 +30,23 @@ class API::RestfulController < ActionController::Base end def current_user - super || token_user || nil + super || token_user || doorkeeper_user || nil end def token_user - authenticate_with_http_token do |token, options| - access_token = Token.find_by_token(token) - if access_token - @token_user ||= access_token.user - end + token = params[:access_token] + access_token = Token.find_by_token(token) + if access_token + @token_user ||= access_token.user end end + def doorkeeper_user + return unless doorkeeper_token.present? + doorkeeper_render_error unless valid_doorkeeper_token? + @doorkeeper_user ||= User.find(doorkeeper_token.resource_owner_id) + end + def permitted_params @permitted_params ||= PermittedParams.new(params) end diff --git a/app/views/doorkeeper/applications/_delete_form.html.erb b/app/views/doorkeeper/applications/_delete_form.html.erb new file mode 100644 index 00000000..69912ec3 --- /dev/null +++ b/app/views/doorkeeper/applications/_delete_form.html.erb @@ -0,0 +1,5 @@ +<%- submit_btn_css ||= 'button red-button' %> +<%= form_tag oauth_application_path(application) do %> + + <%= submit_tag t('doorkeeper.applications.buttons.destroy'), onclick: "return confirm('#{ t('doorkeeper.applications.confirmations.destroy') }')", class: submit_btn_css %> +<% end %> diff --git a/app/views/doorkeeper/applications/_form.html.erb b/app/views/doorkeeper/applications/_form.html.erb new file mode 100644 index 00000000..dd8bec62 --- /dev/null +++ b/app/views/doorkeeper/applications/_form.html.erb @@ -0,0 +1,36 @@ +<%= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f| %> + <% if application.errors.any? %> +

<%= t('doorkeeper.applications.form.error') %>

+ <% end %> + + <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do %> + <%= f.label :name, class: 'col-sm-2 control-label' %> +
+ <%= f.text_field :name, class: 'form-control' %> + <%= doorkeeper_errors_for application, :name %> +
+ <% end %> + + <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do %> + <%= f.label :redirect_uri, class: 'col-sm-2 control-label' %> +
+ <%= f.text_area :redirect_uri, class: 'form-control' %> + <%= doorkeeper_errors_for application, :redirect_uri %> + + <%= t('doorkeeper.applications.help.redirect_uri') %>. + + <% if Doorkeeper.configuration.native_redirect_uri %> + + <%= raw t('doorkeeper.applications.help.native_redirect_uri', native_redirect_uri: "#{ Doorkeeper.configuration.native_redirect_uri }") %> + + <% end %> +
+ <% end %> + +
+
+ <%= f.submit t('doorkeeper.applications.buttons.submit'), class: "btn btn-primary" %> + <%= link_to t('doorkeeper.applications.buttons.cancel'), oauth_applications_path, :class => "button link-button red-button", :data => { :bypass => 'true' } %> +
+
+<% end %> diff --git a/app/views/doorkeeper/applications/_script.html.erb b/app/views/doorkeeper/applications/_script.html.erb new file mode 100644 index 00000000..970791d4 --- /dev/null +++ b/app/views/doorkeeper/applications/_script.html.erb @@ -0,0 +1,10 @@ + diff --git a/app/views/doorkeeper/applications/edit.html.erb b/app/views/doorkeeper/applications/edit.html.erb new file mode 100644 index 00000000..8f92c3a3 --- /dev/null +++ b/app/views/doorkeeper/applications/edit.html.erb @@ -0,0 +1,10 @@ +
+
+ + + <%= render 'form', application: @application %> +
+
+<%= render 'script' %> diff --git a/app/views/doorkeeper/applications/index.html.erb b/app/views/doorkeeper/applications/index.html.erb new file mode 100644 index 00000000..449d5f5e --- /dev/null +++ b/app/views/doorkeeper/applications/index.html.erb @@ -0,0 +1,28 @@ +
+
+ + + + + + + + + + + + <% @applications.each do |application| %> + + + + + + <% end %> + +
<%= t('.name') %><%= t('.callback_url') %>
<%= link_to application.name, oauth_application_path(application), :data => { :bypass => 'true' } %><%= application.redirect_uri %><%= render 'delete_form', application: application %>
+<%= link_to t('.new'), new_oauth_application_path, class: 'button link-button', :data => { :bypass => 'true' } %> +
+
+<%= render 'script' %> diff --git a/app/views/doorkeeper/applications/new.html.erb b/app/views/doorkeeper/applications/new.html.erb new file mode 100644 index 00000000..ef864959 --- /dev/null +++ b/app/views/doorkeeper/applications/new.html.erb @@ -0,0 +1,11 @@ +
+
+<%= link_to t('doorkeeper.applications.buttons.back'), oauth_applications_path(), class: 'button link-button button-margin', :data => { :bypass => 'true' } %> + + +<%= render 'form', application: @application %> +
+
+<%= render 'script' %> diff --git a/app/views/doorkeeper/applications/show.html.erb b/app/views/doorkeeper/applications/show.html.erb new file mode 100644 index 00000000..045d16a0 --- /dev/null +++ b/app/views/doorkeeper/applications/show.html.erb @@ -0,0 +1,37 @@ +
+
+ + <%= link_to t('doorkeeper.applications.buttons.back'), oauth_applications_path(), class: 'button link-button button-margin', :data => { :bypass => 'true' } %> + + + +

<%= t('.application_id') %>:

+

<%= @application.uid %>

+ +

<%= t('.secret') %>:

+

<%= @application.secret %>

+ + +

<%= t('.callback_urls') %>:

+ + + <% @application.redirect_uri.split.each do |uri| %> + + + + + <% end %> +
+ <%= uri %> + + <%= link_to t('doorkeeper.applications.buttons.authorize'), oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code'), class: 'button link-button', target: '_blank', :data => { :bypass => 'true' } %> +
+ +
<%= link_to t('doorkeeper.applications.buttons.edit'), edit_oauth_application_path(@application), class: 'button link-button', :data => { :bypass => 'true' } %>
+ +
<%= render 'delete_form', application: @application, submit_btn_css: 'button red-button' %>
+
+
+<%= render 'script' %> diff --git a/app/views/doorkeeper/authorizations/error.html.erb b/app/views/doorkeeper/authorizations/error.html.erb new file mode 100644 index 00000000..4d778e29 --- /dev/null +++ b/app/views/doorkeeper/authorizations/error.html.erb @@ -0,0 +1,11 @@ +
+
+ + +
+
<%= @pre_auth.error_response.body[:error_description] %>
+
+
+
diff --git a/app/views/doorkeeper/authorizations/new.html.erb b/app/views/doorkeeper/authorizations/new.html.erb new file mode 100644 index 00000000..52b2f6a4 --- /dev/null +++ b/app/views/doorkeeper/authorizations/new.html.erb @@ -0,0 +1,48 @@ +
+
+ + +
+

+ <%= raw t('.prompt', client_name: "#{ @pre_auth.client.name }") %> +

+ + <% if @pre_auth.scopes.count > 0 %> +
+

<%= t('.able_to') %>:

+ +
    + <% @pre_auth.scopes.each do |scope| %> +
  • <%= t scope, scope: [:doorkeeper, :scopes] %>
  • + <% end %> +
+
+ <% end %> + +
+
+ <%= form_tag oauth_authorization_path, method: :post do %> + <%= hidden_field_tag :client_id, @pre_auth.client.uid %> + <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %> + <%= hidden_field_tag :state, @pre_auth.state %> + <%= hidden_field_tag :response_type, @pre_auth.response_type %> + <%= hidden_field_tag :scope, @pre_auth.scope %> + <%= submit_tag t('doorkeeper.authorizations.buttons.authorize'), class: "button" %> + <% end %> +
+
+ <%= form_tag oauth_authorization_path, method: :delete do %> + <%= hidden_field_tag :client_id, @pre_auth.client.uid %> + <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %> + <%= hidden_field_tag :state, @pre_auth.state %> + <%= hidden_field_tag :response_type, @pre_auth.response_type %> + <%= hidden_field_tag :scope, @pre_auth.scope %> + <%= submit_tag t('doorkeeper.authorizations.buttons.deny'), class: "button red-button" %> + <% end %> +
+
+
+
+
diff --git a/app/views/doorkeeper/authorizations/show.html.erb b/app/views/doorkeeper/authorizations/show.html.erb new file mode 100644 index 00000000..4079ed56 --- /dev/null +++ b/app/views/doorkeeper/authorizations/show.html.erb @@ -0,0 +1,11 @@ +
+
+ + +
+ <%= params[:code] %> +
+
+
diff --git a/app/views/doorkeeper/authorized_applications/_delete_form.html.erb b/app/views/doorkeeper/authorized_applications/_delete_form.html.erb new file mode 100644 index 00000000..27ea3d73 --- /dev/null +++ b/app/views/doorkeeper/authorized_applications/_delete_form.html.erb @@ -0,0 +1,5 @@ +<%- submit_btn_css ||= 'button red-button' %> +<%= form_tag oauth_authorized_application_path(application) do %> + + <%= submit_tag t('doorkeeper.authorized_applications.buttons.revoke'), onclick: "return confirm('#{ t('doorkeeper.authorized_applications.confirmations.revoke') }')", class: submit_btn_css %> +<% end %> diff --git a/app/views/doorkeeper/authorized_applications/_script.html.erb b/app/views/doorkeeper/authorized_applications/_script.html.erb new file mode 100644 index 00000000..5e8bebda --- /dev/null +++ b/app/views/doorkeeper/authorized_applications/_script.html.erb @@ -0,0 +1,10 @@ + diff --git a/app/views/doorkeeper/authorized_applications/index.html.erb b/app/views/doorkeeper/authorized_applications/index.html.erb new file mode 100644 index 00000000..0464c2be --- /dev/null +++ b/app/views/doorkeeper/authorized_applications/index.html.erb @@ -0,0 +1,30 @@ +
+
+ + +
+ + + + + + + + + + + <% @applications.each do |application| %> + + + + + + <% end %> + +
<%= t('doorkeeper.authorized_applications.index.application') %><%= t('doorkeeper.authorized_applications.index.created_at') %>
<%= application.name %><%= application.created_at.strftime(t('doorkeeper.authorized_applications.index.date_format')) %><%= render 'delete_form', application: application %>
+
+
+
+<%= render 'script' %> diff --git a/app/views/layouts/_account.html.erb b/app/views/layouts/_account.html.erb index 6150eebf..1f228481 100644 --- a/app/views/layouts/_account.html.erb +++ b/app/views/layouts/_account.html.erb @@ -3,9 +3,9 @@ # The inner HTML of the account box that comes up in the bottom left #%> -<% if authenticated? %> +<% if current_user %> <% account = current_user %> - <%= image_tag user.image.url(:sixtyfour), :size => "48x48", :class => "sidebarAccountImage" %> + <%= image_tag account.image.url(:sixtyfour), :size => "48x48", :class => "sidebarAccountImage" %>

<%= account.name.split[0...1][0] %>

'; t.featuredAuthContent += '
Recently Active
'; t.featuredAuthContent += '
Featured
'; +/* apps bars */ + t.registeredAppsContent = '
Registered Apps
'; + t.registeredAppsContent += '
Authorized Apps
'; + + t.authorizedAppsContent = '
Registered Apps
'; + t.authorizedAppsContent += '
Authorized Apps
'; + module.exports = t; });