Commit 82b600ea75ed3bea163b4183ff0117851c7c4c25
1 parent
53d4dc1c
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
oauth_client: display icons for login with oauth providers
Showing
6 changed files
with
16 additions
and
12 deletions
Show diff stats
plugins/oauth_client/lib/oauth_client_plugin/provider.rb
... | ... | @@ -12,8 +12,10 @@ class OauthClientPlugin::Provider < Noosfero::Plugin::ActiveRecord |
12 | 12 | settings_items :client_secret, :type => :string |
13 | 13 | settings_items :client_options, :type => Hash |
14 | 14 | |
15 | - attr_accessible :identifier, :name, :environment, :strategy, :client_id, :client_secret, :enabled, :client_options | |
15 | + attr_accessible :identifier, :name, :environment, :strategy, :client_id, :client_secret, :enabled, :client_options, :image_builder | |
16 | 16 | |
17 | 17 | scope :enabled, :conditions => {:enabled => true} |
18 | 18 | |
19 | + acts_as_having_image | |
20 | + | |
19 | 21 | end | ... | ... |
plugins/oauth_client/public/images/facebook-icon.png
831 Bytes
plugins/oauth_client/public/images/google-icon.png
1.58 KB
plugins/oauth_client/public/style.css
... | ... | @@ -5,18 +5,11 @@ |
5 | 5 | display: inline-block; |
6 | 6 | text-decoration: none; |
7 | 7 | background-repeat: no-repeat; |
8 | - padding-left: 22px; | |
9 | 8 | line-height: 20px; |
10 | 9 | } |
11 | - | |
12 | -.oauth-login .provider .facebook { | |
13 | - background-image: url(images/facebook-icon.png); | |
10 | +.oauth-login .provider a img { | |
11 | + max-width: 40px; | |
14 | 12 | } |
15 | - | |
16 | -.oauth-login .provider .google_oauth2 { | |
17 | - background-image: url(images/google-icon.png); | |
18 | -} | |
19 | - | |
20 | 13 | .oauth-login .provider .developer { |
21 | 14 | display: none; |
22 | 15 | } | ... | ... |
plugins/oauth_client/views/auth/_oauth_login.html.erb
1 | 1 | <div class="oauth-login"> |
2 | + <% unless providers.empty? %> | |
3 | + <%= _('Login with:') %> | |
4 | + <% end %> | |
2 | 5 | <% providers.each do |provider| %> |
3 | 6 | <span class="provider"> |
4 | - <%= link_to _('Login with %s' % provider.name), "/plugin/oauth_client/#{provider.strategy}?id=#{provider.id}", :class => provider.strategy %> | |
7 | + <%= link_to provider.image ? image_tag(provider.image.public_filename) : provider.name, "/plugin/oauth_client/#{provider.strategy}?id=#{provider.id}", :class => provider.strategy, :title => provider.name %> | |
5 | 8 | </span> |
6 | 9 | <% end %> |
7 | 10 | |
8 | 11 | <span class="provider"> |
9 | 12 | <% unless Rails.env.production? %> |
10 | - <%= link_to _('Developer Login'), "/plugin/oauth/developer", :class => 'developer' %> | |
13 | + <%= link_to _('Developer Login'), "/plugin/oauth_client/developer", :class => 'developer' %> | |
11 | 14 | <% end %> |
12 | 15 | </span> |
13 | 16 | </div> | ... | ... |
plugins/oauth_client/views/oauth_client_plugin_admin/edit.html.erb
... | ... | @@ -35,6 +35,12 @@ |
35 | 35 | </span> |
36 | 36 | </div> |
37 | 37 | |
38 | + <div class="image-icon"> | |
39 | + <%= f.fields_for :image_builder, @provider.image do |i| %> | |
40 | + <%= file_field_or_thumbnail(_('Image:'), @provider.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> | |
41 | + <% end %> | |
42 | + </div> | |
43 | + | |
38 | 44 | <div class="client-id"> |
39 | 45 | <span class="label"> |
40 | 46 | <%= _('Client Id') %> | ... | ... |