Commit 8784fe3c2af51283ec57b2c3fe59ff8df902dffd

Authored by Caio Almeida
1 parent 011ca4fd

Ticket #116: Better display of recent activities

src/app/layout/blocks/recent-activities-plugin-activities/activities/event.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<img ng-src="{{activity.params.first_image}}" ng-attr-alt="{{activity.params.name}}" class="event-image" />
  2 +<p class="event-description"><b>{{activity.params.name}}</b><br />{{activity.params.lead | stripTags}}</p>
  3 +<br style="clear: both;" />
... ...
src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.ts
... ... @@ -18,7 +18,12 @@ export class RecentActivitiesPluginActivitiesBlockComponent {
18 18 constructor(private blockService: BlockService, private $state: any) { }
19 19  
20 20 getActivityTemplate(activity: any) {
21   - return 'app/layout/blocks/recent-activities-plugin-activities/activities/' + activity.verb + '.html';
  21 + if (activity.label === 'events') {
  22 + return 'app/layout/blocks/recent-activities-plugin-activities/activities/event.html';
  23 + }
  24 + else {
  25 + return 'app/layout/blocks/recent-activities-plugin-activities/activities/' + activity.verb + '.html';
  26 + }
22 27 }
23 28  
24 29 urlFor(params: any) {
... ...
src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.html
1 1 <div class="deckgrid recent-activities-block">
2 2 <div ng-repeat="activity in ctrl.activities" class="a-card panel media">
  3 +
  4 + <div class="subheader">
  5 + <p ng-if="activity.label === 'events'">
  6 + {{ 'activities.event.description' | translate }} <b>{{ activity.start_date | date:longDate }}</b> {{ 'time.at' | translate }} {{ activity.start_date | date:'HH:mm' }} - <a ng-href="/{{activity.user.identifier}}">{{activity.user.name}}</a> <span class="activity-label">{{activity.label}}</span>
  7 + </p>
  8 +
  9 + <p ng-if="activity.label !== 'events'">
  10 + {{ 'date.on' | translate }} <b>{{ activity.created_at | date:longDate }}</b> {{ 'time.at' | translate }} {{ activity.created_at | date:'HH:mm' }} - <a ng-href="/{{activity.user.identifier}}">{{activity.user.name}}</a> <span class="activity-label">{{activity.label}}</span>
  11 + </p>
  12 + </div>
  13 +
3 14 <div class="header media-body">
4 15 <h5 class="title media-heading">
5   - <a ng-href="/{{activity.user.identifier}}">{{activity.user.name}}</a>&nbsp;<ng-include src="ctrl.getActivityTemplate(activity)"></ng-include>
  16 + <ng-include src="ctrl.getActivityTemplate(activity)"></ng-include>
6 17 </h5>
7 18 </div>
8   - <div class="subheader">
9   - <span class="time">
10   - <i class="fa fa-clock-o"></i> <span am-time-ago="activity.created_at | dateFormat"></span>
11   - </span>
12   - </div>
  19 +
  20 + <hr />
13 21 </div>
14 22 </div>
... ...
src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.scss
... ... @@ -20,4 +20,53 @@
20 20 display: none;
21 21 }
22 22 }
  23 +
  24 + .panel {
  25 + margin-bottom: 15px;
  26 + box-shadow: none;
  27 + border-radius: 0;
  28 + }
  29 +
  30 + h5 {
  31 + text-transform: capitalize;
  32 + }
  33 +
  34 + .subheader {
  35 + p {
  36 + margin: 2px 0;
  37 + font-size: 11px;
  38 + }
  39 + }
  40 +
  41 + hr {
  42 + border: 0;
  43 + height: 1px;
  44 + background: #ccc;
  45 + margin: 0;
  46 + margin-top: 15px;
  47 + }
  48 +
  49 + .activity-label {
  50 + @include border-radius(2px);
  51 + font-size: 11px;
  52 + text-transform: capitalize;
  53 + background: #333;
  54 + color: #fff;
  55 + padding: 2px;
  56 + margin-left: 5px;
  57 + display: inline-block;
  58 + }
  59 +
  60 + .event-image {
  61 + width: 15%;
  62 + height: auto;
  63 + float: left;
  64 + }
  65 +
  66 + .event-description {
  67 + width: 83%;
  68 + margin: 2px 0 0 2px;
  69 + float: left;
  70 + display: block;
  71 + }
23 72 }
... ...
src/languages/en.json
... ... @@ -97,5 +97,8 @@
97 97 "block.edition.display_user.all": "All users",
98 98 "block.edition.display_user.logged": "Logged",
99 99 "block.edition.display_user.not_logged": "Not logged",
100   - "block.edition.language.label": "Show for:"
  100 + "block.edition.language.label": "Show for:",
  101 + "activities.event.description": "Event on",
  102 + "time.at": "at",
  103 + "date.on": "On"
101 104 }
... ...
src/languages/pt.json
... ... @@ -97,5 +97,8 @@
97 97 "block.edition.display_user.all": "Todos os usuários",
98 98 "block.edition.display_user.logged": "Logados",
99 99 "block.edition.display_user.not_logged": "Não logados",
100   - "block.edition.language.label": "Exibir para:"
  100 + "block.edition.language.label": "Exibir para:",
  101 + "activities.event.description": "Evento em",
  102 + "time.at": "às",
  103 + "date.on": "Em"
101 104 }
... ...