diff --git a/app/assets/stylesheets/messaging.scss b/app/assets/stylesheets/messaging.scss new file mode 100644 index 0000000..fba9cbd --- /dev/null +++ b/app/assets/stylesheets/messaging.scss @@ -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; + } +} diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb index 4078249..7ec9c35 100644 --- a/app/views/messages/index.html.erb +++ b/app/views/messages/index.html.erb @@ -8,26 +8,41 @@
<%= flash[:error] %>
<% end %> -
- <% @received_messages.each do |message| %> -

- <%= message.sender.username %> -

-

- <%= message.body %> -

+ <% @received_messages.each do |message| %> +
+
+ + <% if message.sender.profile.avatars.any? %> + <%= message.sender.profile.avatars[0] %> + <% else %> + <%= image_tag "placeholder.png" %> + <% end %> + +

+ <%= message.sender.username %> + <%= message.body %> +

+
<%= form_for @message do |f| %>
- <%= 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 %> +
+ + <% if message.sender.profile.avatars.any? %> + <%= message.sender.profile.avatars[0] %> + <% else %> + <%= image_tag "placeholder.png" %> + <% end %> + + <%= 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 %> +
- <%= 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" %>
<% end %> - <% end %> -
+
+ <% end %> diff --git a/app/views/profiles/show.html.erb b/app/views/profiles/show.html.erb index 9a3f90b..b06b109 100644 --- a/app/views/profiles/show.html.erb +++ b/app/views/profiles/show.html.erb @@ -1,9 +1,6 @@
-
- <%= link_to "Inbox", messages_path %> -
<%= link_to "Edit Profile", [:edit, @profile] %>

Profile

diff --git a/app/views/shared/_nav.html.erb b/app/views/shared/_nav.html.erb index 7e98cb7..db9f2ff 100644 --- a/app/views/shared/_nav.html.erb +++ b/app/views/shared/_nav.html.erb @@ -8,5 +8,9 @@ Search Profiles +
  • + <%= link_to "Inbox", messages_path %> +
  • + - \ No newline at end of file + diff --git a/features/step_definitions/messages_step.rb b/features/step_definitions/messages_step.rb index 219980a..e179c7c 100644 --- a/features/step_definitions/messages_step.rb +++ b/features/step_definitions/messages_step.rb @@ -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