Skip to content
Merged
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
10 changes: 10 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ pipeline:
when:
matrix:
TESTS: signed-off-check
handlebars:
image: node
commands:
- npm install -g handlebars
- ./check-handlebars-templates.sh
when:
matrix:
TESTS: handlebars

matrix:
include:
- TESTS: signed-off-check
- TESTS: handlebars
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Makefile for building the project

app_name=activity

project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build/artifacts
appstore_dir=$(build_dir)/appstore
source_dir=$(build_dir)/source
sign_dir=$(build_dir)/sign
package_name=$(app_name)
cert_dir=$(HOME)/.nextcloud/certificates
version+=master

all: dev-setup

compile-handlebars-templates: dev-setup
bash compile-handlebars-templates.sh

dev-setup:
echo "Done"
17 changes: 17 additions & 0 deletions check-handlebars-templates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

REPODIR=`git rev-parse --show-toplevel`

cd $REPODIR

bash compile-handlebars-templates.sh || exit 1

if [[ $(git diff --name-only) ]]; then
echo "Please submit your compiled handlebars templates"
echo
git diff
exit 1
fi

echo "All up to date! Carry on :D"
exit 0
6 changes: 6 additions & 0 deletions compile-handlebars-templates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# Prefer the local handlebars script, and fall back to the global one.
export PATH=./node_modules/.bin/:$PATH

handlebars -n OCA.Activity.Templates js/templates/ -f js/templates.js
9 changes: 8 additions & 1 deletion js/activitymodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @returns int UNIX milliseconds timestamp
*/
getUnixMilliseconds: function() {
getUnixMilliseconds: function () {
if (_.isUndefined(this.unixMilliseconds)) {
this.unixMilliseconds = moment(this.get('datetime')).valueOf();
}
Expand All @@ -40,6 +40,13 @@
*/
getFullDate: function () {
return OC.Util.formatDate(this.getUnixMilliseconds());
},

/**
* @returns bool
*/
isMonochromeIcon: function () {
return this.get('type') !== 'file_created' && this.get('type') !== 'file_deleted' && this.get('type') !== 'favorite';
}
});

Expand Down
1 change: 1 addition & 0 deletions js/activitytabview.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
subject: subject,
formattedDate: activity.getRelativeDate(),
formattedDateTooltip: activity.getFullDate(),
isMonochromeIcon: activity.isMonochromeIcon(),
timestamp: moment(activity.get('datetime')).valueOf(),
message: message,
icon: activity.get('icon')
Expand Down
4 changes: 3 additions & 1 deletion js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,13 @@ $(function(){
activity.link = '';
}

var monochromeIcon = activity.type !== 'file_created' && activity.type !== 'file_deleted' && activity.type !== 'favorite';

var content = ''
+ '<div class="box" data-activity-id="' + activity.activity_id + '">' + "\n"
+ ' <div class="messagecontainer">' + "\n"

+ ' <div class="activity-icon">'
+ ' <div class="activity-icon' + ((monochromeIcon) ? ' monochrome' : '') +'">'
+ ((activity.icon) ? ' <img src="' + activity.icon + '" alt="" />' : '')
+ ' </div>' + "\n"

Expand Down
8 changes: 6 additions & 2 deletions js/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ templates['activitytabview'] = template({"compiler":[7,">= 4.0.0"],"main":functi
+ "\">\n</div>\n";
},"useData":true});
templates['activitytabview_activity'] = template({"1":function(container,depth0,helpers,partials,data) {
return " monochrome";
},"3":function(container,depth0,helpers,partials,data) {
var helper;

return " <img src=\""
Expand All @@ -18,8 +20,10 @@ templates['activitytabview_activity'] = template({"1":function(container,depth0,
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

return "<li class=\"activity box\">\n <div class=\"activity-icon\">\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
return "<li class=\"activity box\">\n <div class=\"activity-icon"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isMonochromeIcon : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\">\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </div>\n <div class=\"activitysubject\">"
+ ((stack1 = ((helper = (helper = helpers.subject || (depth0 != null ? depth0.subject : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"subject","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "</div>\n <span class=\"activitytime has-tooltip live-relative-timestamp\" data-timestamp=\""
Expand Down
2 changes: 1 addition & 1 deletion js/templates/activitytabview_activity.handlebars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class="activity box">
<div class="activity-icon">
<div class="activity-icon{{#if isMonochromeIcon}} monochrome{{/if}}">
{{#if icon}}
<img src="{{icon}}" alt="">
{{/if}}
Expand Down