diff --git a/app/assets/javascripts/app.js b/app/assets/javascripts/app.js index 2805906ae..e73636780 100644 --- a/app/assets/javascripts/app.js +++ b/app/assets/javascripts/app.js @@ -13,6 +13,8 @@ Helpy.ready = function(){ // return; // }); + $('.profile').initial(); + $('.attachinary-input').attachinary(); $('.screenshot-link').magnificPopup({type:'image', gallery:{enabled:true}}); diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index 74f9a5221..076689169 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -24,6 +24,7 @@ //= require cloudinary //= require attachinary //= require magnific-popup +//= require initial.js/initial.js //= require app // Jtruncate plugin, http://www.jeremymartin.name/projects.php?project=jTruncate diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 2ef14425b..06dedda22 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -10,4 +10,16 @@ def user_avatar(user, size=40) end end + def avatar_image(user, size=40) + + if user.avatar.nil? == false + image_tag("http://res.cloudinary.com/helpy-io/image/upload/c_thumb,w_#{size},h_#{size}/#{user.avatar.path}", width: "#{size}px", class: 'img-circle') + elsif !user.thumbnail.nil? + image_tag(user.thumbnail, width: "#{size}px", class: 'img-circle') + else + image_tag('#', data: { name: "#{user.name}", width: "#{size}", height: "#{size}", 'font-size': '16', 'char-count': 2}, class: 'profile img-circle') + end + + end + end diff --git a/app/views/admin/_edit_user.html.erb b/app/views/admin/_edit_user.html.erb index 50930042f..616d10cbf 100644 --- a/app/views/admin/_edit_user.html.erb +++ b/app/views/admin/_edit_user.html.erb @@ -2,7 +2,7 @@ <%= bootstrap_form_for(@user, remote: true, layout: :horizontal, label_col: "col-sm-2", control_col: "col-sm-10") do |f| %>
- <%= image_tag(user_avatar(@user), width: '150px', class: 'img-circle') %> + <%= avatar_image(@user, size=150) %>
<%= @user.name %>
diff --git a/app/views/admin/_topic.html.erb b/app/views/admin/_topic.html.erb index 31ae1a43f..2b8eeb930 100644 --- a/app/views/admin/_topic.html.erb +++ b/app/views/admin/_topic.html.erb @@ -2,7 +2,7 @@ <%= check_box_tag "topic_ids[]", topic.id, false, class: 'topic-checkbox pull-left' %> diff --git a/app/views/admin/_user.html.erb b/app/views/admin/_user.html.erb index 7e8fcdcca..5ed093e22 100644 --- a/app/views/admin/_user.html.erb +++ b/app/views/admin/_user.html.erb @@ -1,7 +1,7 @@ diff --git a/app/views/admin/_user_info.html.erb b/app/views/admin/_user_info.html.erb index 19eab2eda..c2c56f919 100644 --- a/app/views/admin/_user_info.html.erb +++ b/app/views/admin/_user_info.html.erb @@ -1,6 +1,7 @@
- <%= image_tag(@topic.user.image_url, width: '90px', class: 'img-circle') %> + <%#= image_tag(@topic.user.image_url, width: '90px', class: 'img-circle') %> + <%= avatar_image(@topic.user, size=90) %>
diff --git a/app/views/admin/_user_info_horizontal.html.erb b/app/views/admin/_user_info_horizontal.html.erb index 530c7b00e..86d2831e5 100644 --- a/app/views/admin/_user_info_horizontal.html.erb +++ b/app/views/admin/_user_info_horizontal.html.erb @@ -2,7 +2,7 @@
- <%= image_tag(user_avatar(@user,150), width: '150px', class: 'img-circle') %> + <%= avatar_image(@user, size=150) %>