diff --git a/.drone.yml b/.drone.yml index 78cf217f1..3877a6553 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..ac19f254e --- /dev/null +++ b/Makefile @@ -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" diff --git a/check-handlebars-templates.sh b/check-handlebars-templates.sh new file mode 100755 index 000000000..ae1e63946 --- /dev/null +++ b/check-handlebars-templates.sh @@ -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 diff --git a/compile-handlebars-templates.sh b/compile-handlebars-templates.sh new file mode 100755 index 000000000..5fe9a7cc8 --- /dev/null +++ b/compile-handlebars-templates.sh @@ -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 diff --git a/js/activitymodel.js b/js/activitymodel.js index c06c6e63e..d33238492 100644 --- a/js/activitymodel.js +++ b/js/activitymodel.js @@ -21,7 +21,7 @@ * * @returns int UNIX milliseconds timestamp */ - getUnixMilliseconds: function() { + getUnixMilliseconds: function () { if (_.isUndefined(this.unixMilliseconds)) { this.unixMilliseconds = moment(this.get('datetime')).valueOf(); } @@ -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'; } }); diff --git a/js/activitytabview.js b/js/activitytabview.js index 58e02e2bc..f2555ee7e 100644 --- a/js/activitytabview.js +++ b/js/activitytabview.js @@ -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') diff --git a/js/script.js b/js/script.js index 44343df7a..85e7092e9 100755 --- a/js/script.js +++ b/js/script.js @@ -209,11 +209,13 @@ $(function(){ activity.link = ''; } + var monochromeIcon = activity.type !== 'file_created' && activity.type !== 'file_deleted' && activity.type !== 'favorite'; + var content = '' + '
' + "\n" + '
' + "\n" - + '
' + + '
' + ((activity.icon) ? ' ' : '') + '
' + "\n" diff --git a/js/templates.js b/js/templates.js index db5d84491..fa133b5ae 100644 --- a/js/templates.js +++ b/js/templates.js @@ -10,6 +10,8 @@ templates['activitytabview'] = template({"compiler":[7,">= 4.0.0"],"main":functi + "\">\n
\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 " = 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 "
  • \n
    \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 "
  • \n
    \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 : "") + "
    \n
    " + ((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 : "") + "
    \n -
    +
    {{#if icon}} {{/if}}