Add organization users to sidebar and other org ajustments (#707)
This commit is contained in:
parent
11b81daedc
commit
160056a19d
6 changed files with 45 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
11
app/observers/organization_observer.rb
Normal file
11
app/observers/organization_observer.rb
Normal 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
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
<% if @organization.story.present? %>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<OUR STORY>
|
||||
our story
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<%= sanitized_sidebar @organization.story %>
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
<% if @organization.tech_stack.present? %>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<OUR STACK>
|
||||
our stack
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<%= sanitized_sidebar @organization.tech_stack %>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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 *" %>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue