Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

improve news widget styles

bsatarnejad7312cdc802ad
diff --git a/app/assets/stylesheets/content/_news.sass b/app/assets/stylesheets/content/_news.sass
index b2508171652..27c41400f17 100644
--- a/app/assets/stylesheets/content/_news.sass
+++ b/app/assets/stylesheets/content/_news.sass
@@ -33,19 +33,18 @@
@include text-shortener
margin-bottom: 5px
-.summary
+.news-summary
font-style: italic
-.author
+.news-author
font-size: 0.8rem
- color: #777777
+ color: $gray-dark
display: block
- margin-top: -7px
+ line-height: 2
-.author-avatar
- margin: -2px 10px 0 0
+.news-author-avatar
+ margin-right: 5px
float: left
-.title
- font-weight: bold
- margin-top: 2px
+
+
diff --git a/app/assets/stylesheets/content/work_packages/tabs/_activities.sass b/app/assets/stylesheets/content/work_packages/tabs/_activities.sass
index 1fb33b766c9..2f630c78a57 100644
--- a/app/assets/stylesheets/content/work_packages/tabs/_activities.sass
+++ b/app/assets/stylesheets/content/work_packages/tabs/_activities.sass
@@ -121,7 +121,7 @@ h4.comment
.date
display: block
font-size: 0.8rem
- color: #777777
+ color: $gray-dark
.comments-icons
a:hover
@@ -133,7 +133,7 @@ h4.comment
ul.work-package-details-activities-messages
li
- color: #777777
+ color: $gray-dark
margin-bottom: 0.1rem
&:last-child
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 50708c9574c..7eb15786072 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -252,6 +252,10 @@ module ApplicationHelper
l(label, author: link_to_user(author), age: time_tag(created)).html_safe
end
+ def authoring_at(created, author)
+ l(:'js.label_added_time_by', author: author.name, age: created, authorLink: user_path(author)).html_safe unless author.nil?
+ end
+
def time_tag(time)
text = distance_of_time_in_words(Time.now, time)
if @project and @project.module_enabled?('activity')
diff --git a/app/views/homescreen/blocks/_news.html.erb b/app/views/homescreen/blocks/_news.html.erb
index dcb400204f2..39837b8f369 100644
--- a/app/views/homescreen/blocks/_news.html.erb
+++ b/app/views/homescreen/blocks/_news.html.erb
@@ -4,11 +4,15 @@
<% @news.each do |news| %>
<li class="-widget-box--arrow-multiline">
<div>
- <%= avatar(news.author, {class: 'avatar author-avatar'}) %>
+ <%= avatar(news.author, {class: 'avatar news-author-avatar'}) %>
<%= link_to_project(news.project) + ': ' %>
<%= link_to h(news.title), news_path(news) %>
- <div class="author"> <span><%= authoring news.created_at, news.author %></span> </div>
- <div> <span class="additional-information"><%= news.summary %></span></div>
+ <div class="news-author">
+ <span><%= authoring_at Date.strptime(news.created_at.to_s), news.author %></span>
+ </div>
+ <div>
+ <p class="widget-box--additional-info"><%= news.summary %></p>
+ </div>
</div>
</li>
<% end %>
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index a55718b2c13..a7c6a75e9f6 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -318,7 +318,7 @@ en:
label_add_row_before: "Add row before"
label_add_selected_columns: "Add selected columns"
label_added_by: "added by"
- label_added_time_by: "Added by %{author} %{age}"
+ label_added_time_by: "Added by <a href=%{authorLink}>%{author}</a> at %{age}"
label_ago: "days ago"
label_all: "all"
label_all_work_packages: "all work packages"
diff --git a/frontend/src/app/modules/grids/widgets/news/news.component.html b/frontend/src/app/modules/grids/widgets/news/news.component.html
index 103b2103b75..e9096664c91 100644
--- a/frontend/src/app/modules/grids/widgets/news/news.component.html
+++ b/frontend/src/app/modules/grids/widgets/news/news.component.html
@@ -5,22 +5,35 @@
</widget-header>
<div class="grid--widget-content">
- <no-results *ngIf="noEntries" [title]="text.noResults">
+ <no-results *ngIf="noEntries"
+ [title]="text.noResults">
</no-results>
-
<ul class="widget-box--arrow-links">
- <li class="-widget-box--arrow-multiline" *ngFor="let news of entries">
+ <li class="-widget-box--arrow-multiline"
+ *ngFor="let news of entries">
<div>
- <user-avatar *ngIf="news.author" [user]="news.author" data-class-list="avatar" class="author-avatar">
+ <user-avatar
+ *ngIf="news.author"
+ [user]="news.author"
+ data-class-list="avatar news-author-avatar">
</user-avatar>
- <div class="title"><a [href]="newsProjectPath(news)" [textContent]="newsProjectName(news)">
- </a>: <a [href]="newsPath(news)" [textContent]="news.title"> </a></div>
- <div *ngIf="news.author" class="author"><span>{{text.createdBy}} </span>
- <a [href]="newsAuthorPath(news)" [textContent]="newsAuthorName(news)"> </a>
- <span> {{text.at}} {{newsCreated(news)}}</span>
+ <div>
+ <a
+ [href]="newsProjectPath(news)"
+ [textContent]="newsProjectName(news)">
+ </a>:
+ <a [href]="newsPath(news)"
+ [textContent]="news.title">
+ </a>
+ </div>
+ <div *ngIf="news.author"
+ class="news-author">
+ <span [innerHTML]="text.addedBy(news)"> </span>
</div>
<div>
- <p *ngIf="news.summary" [textContent]="news.summary" class="widget-box--additional-info"></p>
+ <p *ngIf="news.summary"
+ [textContent]="news.summary"
+ class="widget-box--additional-info"></p>
</div>
</div>
</li>
diff --git a/frontend/src/app/modules/grids/widgets/news/news.component.ts b/frontend/src/app/modules/grids/widgets/news/news.component.ts
index 60bac74a35b..20059e6f1dd 100644
--- a/frontend/src/app/modules/grids/widgets/news/news.component.ts
+++ b/frontend/src/app/modules/grids/widgets/news/news.component.ts
@@ -14,9 +14,10 @@ import { DmListParameter } from "core-app/modules/hal/dm-services/dm.service.int
})
export class WidgetNewsComponent extends AbstractWidgetComponent implements OnInit {
public text = {
- createdBy: this.i18n.t('js.label_created_by'),
at: this.i18n.t('js.grid.widgets.news.at'),
noResults: this.i18n.t('js.grid.widgets.news.no_results'),
+ addedBy: (news:NewsResource) => this.i18n.t('js.label_added_time_by',
+ { author: this.newsAuthorName(news), age: this.newsCreated(news), authorLink: this.newsAuthorPath(news)})
};
public entries:NewsResource[] = [];