Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some styling to the inbox #25

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/assets/stylesheets/messaging.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.message {
display: inline-block;
max-width: 75%;
min-height: 70px;
vertical-align: top;
}

.reply {
display: inline-block;
height: 33px;
min-height: 70px;
max-width: 75%;
}

.messages {
img {
height: 70px;
vertical-align: top;
}
}

.message {
strong {
color: #1b75bc;
font-weight: bold;
font-size: 16px;
margin-right: 7px;
margin-left: 7px;
}
}
47 changes: 31 additions & 16 deletions app/views/messages/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,41 @@
<div class="notice alert"><%= flash[:error] %></div>
<% end %>

<div class="col-xs-12 messages">
<% @received_messages.each do |message| %>
<h3>
<%= message.sender.username %>
</h3>
<p>
<%= message.body %>
</p>
<% @received_messages.each do |message| %>
<div class="col-xs-12 messages well">
<div class="user-message">
<img>
<% if message.sender.profile.avatars.any? %>
<%= message.sender.profile.avatars[0] %>
<% else %>
<%= image_tag "placeholder.png" %>
<% end %>
</img>
<p class="message">
<strong><%= message.sender.username %></strong>
<%= message.body %>
</p>
</div>
<%= form_for @message do |f| %>
<fieldset>
<%= f.label "Reply to this message" %>
<%= f.text_area :body, id: ["message", message.id, "body"], class: "form-control" %>
<%= f.hidden_field :sender_id, value: message.receiver.id %>
<%= f.hidden_field :receiver_id, value: message.sender.id %>
<%= f.hidden_field :replied_to_id, value: message.id %>
<div>
<img>
<% if message.sender.profile.avatars.any? %>
<%= message.sender.profile.avatars[0] %>
<% else %>
<%= image_tag "placeholder.png" %>
<% end %>
</img>
<%= f.text_area :body, id: ["message", message.id, "body"], class: "form-control reply", placeholder: "Reply..." %>
<%= f.hidden_field :sender_id, value: message.receiver.id %>
<%= f.hidden_field :receiver_id, value: message.sender.id %>
<%= f.hidden_field :replied_to_id, value: message.id %>
</div>
</fieldset>
<fieldset>
<%= f.submit "Reply", id: ["message", message.id, "reply"].join("_"), class: "form-control" %>
<%= f.submit "Reply", id: ["message", message.id, "reply"].join("_"), class: "btn btn-info mt-10" %>
</fieldset>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>
3 changes: 0 additions & 3 deletions app/views/profiles/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<div class="row">
<div class="center-content col-sm-10 col-sm-offset-1">
<div class="row">
<div class="inbox">
<%= link_to "Inbox", messages_path %>
</div>
<span><%= link_to "Edit Profile", [:edit, @profile] %></span>
<h1>Profile</h1>

Expand Down
6 changes: 5 additions & 1 deletion app/views/shared/_nav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
<a href="/profiles/search">Search Profiles</a>
</li>

<li>
<%= link_to "Inbox", messages_path %>
</li>

</ul>
</nav>
</nav>
3 changes: 1 addition & 2 deletions features/step_definitions/messages_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@

Then(/^They can view all of their messages$/) do
expect(page).to have_css("h1", text: "Inbox")
expect(page).to have_css("h3", text: @customer_one.username)
expect(page).to have_css("h3", text: @customer_two.username)
expect(page).to have_css("strong", text: @customer_one.username)
expect(page).to have_css("p", text: "Hello there")
expect(page).to have_css("p", text: "Hi")
end