Merge pull request #7078 from opf/fix/29476/forum-layout

[29476] Forum layout adapted to news layout
pull/7087/head
Henriette Dinger 6 years ago committed by GitHub
commit 25c17bdea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      app/assets/stylesheets/content/_comments.sass
  2. 2
      app/assets/stylesheets/content/_index.sass
  3. 8
      app/assets/stylesheets/content/_news.lsg
  4. 31
      app/assets/stylesheets/content/_news.sass
  5. 40
      app/views/messages/show.html.erb
  6. 2
      app/views/news/_news.html.erb
  7. 2
      app/views/news/index.html.erb
  8. 10
      app/views/news/show.html.erb
  9. 6
      spec/support/pages/messages/show.rb

@ -26,8 +26,19 @@
// See docs/COPYRIGHT.rdoc for more details.
//++
.message-reply-menu
float: right
padding-left: 10px
> .button
margin-right: 0
.comments
margin: 1rem 0
.author
margin: 0
.comment
margin: 1.5rem
.timestamp
border-bottom: 1px dotted
cursor: help
.additional-information
font-style: italic
font-size: 13px

@ -6,7 +6,7 @@
@import content/editable_toolbar
@import content/forms
@import content/forms_mobile
@import content/forum
@import content/comments
@import content/collapsible_section
@import content/copy_to_clipboard
@import content/custom_logo

@ -8,7 +8,7 @@
<img class="avatar" title="OpenProject Admin" src="https://s3.amazonaws.com/uifaces/faces/twitter/jamesslock/128.jpg" alt="Avatar">
<a href="/news/5-important-news">More news</a>
</h3>
<p class="author">Added by <a title="User OpenProject Admin" href="">OpenProject Admin</a>
<p class="author additional-information">Added by <a title="User OpenProject Admin" href="">OpenProject Admin</a>
<a title="10/31/2018 09:15 AM" href="/projects/demo-project/activity?from=2018-10-31">3 months</a> ago
</p>
<div class="wiki">
@ -57,10 +57,10 @@
<a title="10/31/2018 09:15 AM" href="">3 months</a> ago
</p>
<div class="news--comments">
<div class="comments">
<h3 class="icon-context icon-quote">Comments</h3>
<div class="news--comment">
<div class="comment">
<div class="contextual">
<a data-confirm="Are you sure?" class="no-decoration-on-hover" title="Delete" alt="Delete" href="">
<i class="icon-context icon-delete"></i>
@ -77,7 +77,7 @@
</p>
</div>
<div class="news--comment">
<div class="comment">
<div class="contextual">
<a data-confirm="Are you sure?" class="no-decoration-on-hover" title="Delete" alt="Delete" href="">
<i class="icon-context icon-delete"></i>

@ -29,34 +29,9 @@
.news
margin-bottom: 30px
.author
font-style: italic
font-size: 12px
.news--comments
margin: 1rem 0
.author
font-style: italic
font-size: 12px
.timestamp
border-bottom: 1px dotted
cursor: help
.additional-information
font-size: 11px
.news--comment
margin: 1.5rem
.news--header
@include text-shortener
margin-bottom: 5px
.summary
font-style: italic
font-size: 1rem
p.author
font-style: italic
.news--header
@include text-shortener
margin-bottom: 10px

@ -62,8 +62,8 @@ See docs/COPYRIGHT.rdoc for more details.
</li>
<% end %>
<div class="message">
<p><span class="author"><%= authoring @topic.created_on, @topic.author %></span></p>
<div class="forum-message">
<p class="author additional-information"><%= authoring @topic.created_on, @topic.author %></p>
<div class="wiki">
<%= format_text(@topic.content, object: @topic, attachments: @topic.attachments) %>
</div>
@ -73,37 +73,39 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
<br />
<div class="forum-message--comments comments">
<% unless @replies.empty? %>
<h3 class="icon-context icon-quote"><%= t(:label_reply_plural) %> (<%= @replies.count %>)</h3>
<% @replies.each do |message| %>
<div class="message reply" id="<%= "message-#{message.id}" %>">
<h3>
<%= avatar(message.author) %>
<%= link_to h(message.subject), topic_path(@topic,
r: message,
anchor: "message-#{message.id}") %>
-
<%= authoring message.created_on, message.author %>
</h3>
<div class="message-reply-menu">
<%= link_to(icon_wrapper('icon-quote', t(:button_quote)),
<div class="comment" id="<%= "message-#{message.id}" %>">
<div class="contextual">
<%= link_to(icon_wrapper('icon-context icon-quote', t(:button_quote)),
{ action: 'quote', id: message },
title: t(:button_quote),
class: 'button boards--quote-button -small',
class: 'boards--quote-button no-decoration-on-hover',
alt: t(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(icon_wrapper('icon-edit', t(:button_edit)),
<%= link_to(icon_wrapper('icon-context icon-edit', t(:button_edit)),
{ action: 'edit', id: message },
title: t(:button_edit),
class: 'button -small',
class: 'no-decoration-on-hover',
alt: t(:button_edit)) if message.editable_by?(User.current) %>
<%= link_to(icon_wrapper('icon-delete', t(:button_delete)),
<%= link_to(icon_wrapper('icon-context icon-delete', t(:button_delete)),
{ action: 'destroy', id: message},
method: :delete,
data: { confirm: t(:text_are_you_sure) },
title: t(:button_delete),
class: 'button -small',
class: 'no-decoration-on-hover',
alt: t(:button_delete)) if message.destroyable_by?(User.current) %>
</div>
<h4 class="author additional-information">
<%= avatar(message.author) %>
<%= link_to h(message.subject), topic_path(@topic,
r: message,
anchor: "message-#{message.id}") %>
-
<%= authoring message.created_on, message.author %>
</h4>
<div class="wiki">
<%= format_text message, :content, attachments: message.attachments %>
</div>
@ -139,4 +141,6 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
<% end %>
</div>
<% html_title h(@topic.subject) %>

@ -30,7 +30,7 @@ See docs/COPYRIGHT.rdoc for more details.
<%= link_to_project(news.project) + ': ' unless @project %>
<h4 class='overview'><%= link_to h(news.title), news_path(news) %></h4>
<p class="author additional-information"><%= authoring news.created_on, news.author %></p>
<div class="news--comment">
<div class="comment">
<% if news.summary.present? %>
<div class="summary">
<%= format_text(news.summary, object: news) %>

@ -52,7 +52,7 @@ See docs/COPYRIGHT.rdoc for more details.
<h3 class="news--header"><%= avatar(news.author) %><%= link_to_project(news.project) + ': ' unless news.project == @project %>
<%= link_to h(news.title), news_path(news) %>
<%= "(#{l(:label_x_comments, count: news.comments_count)})" if news.comments_count > 0 %></h3>
<p class="author"><%= authoring news.created_on, news.author %></p>
<p class="author additional-information"><%= authoring news.created_on, news.author %></p>
<div class="wiki">
<%= format_text(news.summary.present? ? news.summary : truncate(news.description, length: 150, escape: false), object: news) %>
</div>

@ -65,18 +65,20 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
<% end %>
<% if @news.summary.present? %>
<div class="summary">
<%= format_text(@news.summary, object: @news) %>
</div>
<% end %>
<span class="author"><%= authoring @news.created_on, @news.author %></span></p>
<p class="author additional-information"><%= authoring @news.created_on, @news.author %></p>
<div class="wiki">
<%= format_text(@news.description, object: @news) %>
</div>
<br />
<div id="comments" class="news--comments">
<div id="comments" class="news--comments comments">
<h3 class="icon-context icon-quote"><%= l(:label_comment_plural) %></h3>
<% @comments.each do |comment| %>
<% next if comment.new_record? %>
<div class="news--comment">
<div class="comment">
<div class="contextual">
<%= link_to_if_authorized icon_wrapper('icon-context icon-delete', l(:button_delete)),
{controller: '/news/comments', action: 'destroy', id: comment},
@ -86,7 +88,7 @@ See docs/COPYRIGHT.rdoc for more details.
title: l(:button_delete),
alt: l(:button_delete) %>
</div>
<h4 class="comment author"><%= avatar(comment.author) %><%= authoring comment.created_on, comment.author %></h4>
<h4 class="author additional-information"><%= avatar(comment.author) %><%= authoring comment.created_on, comment.author %></h4>
<%= format_text(comment.comments, object: comment) %>
</div>
<% end %>

@ -41,7 +41,7 @@ module Pages::Messages
end
def expect_content(content)
expect(page).to have_selector('.message .wiki', text: content)
expect(page).to have_selector('.forum-message .wiki', text: content)
end
def expect_no_replies
@ -64,7 +64,7 @@ module Pages::Messages
def quote(quoted_message: nil, subject: nil, content:)
if quoted_message
within "#message-#{quoted_message.id} .message-reply-menu" do
within "#message-#{quoted_message.id} .contextual" do
click_on 'Quote'
end
else
@ -88,7 +88,7 @@ module Pages::Messages
end
def expect_reply(subject:, content:, reply: nil)
selector = '.message.reply'
selector = '.comment'
selector += "#message-#{reply.id}" if reply
within(selector) do

Loading…
Cancel
Save