Add organization users to sidebar and other org ajustments (#707)

This commit is contained in:
Ben Halpern 2018-09-20 15:43:43 -04:00 committed by GitHub
parent 11b81daedc
commit 160056a19d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 2 deletions

View file

@ -1088,6 +1088,15 @@
color: #000000;
font-weight: 500;
}
.widget-user-pic{
display: inline-block;
img{
height: 60px;
width: 60px;
margin: 9px;
border-radius: 100px;
}
}
.utc-date{
width: 46px;
background: $dark-purple;

View file

@ -0,0 +1,11 @@
class OrganizationObserver < ActiveRecord::Observer
def after_create(organization)
return if Rails.env.development?
SlackBot.delay.ping "New Org Created: #{organization.name}\nhttps://dev.to/#{organization.username}",
channel: "orgactivity",
username: "org_bot",
icon_emoji: ":office:"
rescue StandardError
puts "error"
end
end

View file

@ -59,7 +59,7 @@
<% if @organization.story.present? %>
<div class="widget">
<header>
&lt;OUR STORY&gt;
our story
</header>
<div class="widget-body">
<%= sanitized_sidebar @organization.story %>
@ -69,7 +69,7 @@
<% if @organization.tech_stack.present? %>
<div class="widget">
<header>
&lt;OUR STACK&gt;
our stack
</header>
<div class="widget-body">
<%= sanitized_sidebar @organization.tech_stack %>

View file

@ -25,6 +25,22 @@
<%= render "articles/badges_area" %>
<% end %>
<% elsif @user && @user.class.name == "Organization" %>
<% if @user.users.size > 0 %>
<div class="widget">
<div class="widget-suggested-follows-container">
<header>meet the team</header>
<div class="widget-body">
<% @user.users.each do |user| %>
<div class="widget-user-pic">
<a href="/<%= user.username %>">
<img src="<%= ProfileImage.new(user).get(90) %>" />
</a>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
<% elsif @tag %>
<% if Article.active_threads([@tag,"discuss"], Timeframer.new(params[:timeframe]).datetime).any? %>
<div class="widget">

View file

@ -22,6 +22,7 @@
<div class="field">
<%= f.label :slug, "Username *" %>
<%= f.text_field :slug %>
<sub><em>Your organization URL will be dev.to/{username}</em></sub>
</div>
<div class="field">
<%= f.label "Profile Image *" %>

View file

@ -29,6 +29,12 @@ RSpec.describe "UserProfiles", type: :request do
get organization.path
expect(response.body).to include CGI.escapeHTML(organization.name)
end
it "renders organization users on sidebar" do
user.update(organization_id: organization.id)
get organization.path
expect(response.body).to include user.profile_image_url
end
end
describe "GET /user" do