From d0d25dfd4c3b7cc6fcff6136bc0223dd1315de65 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Thu, 12 Nov 2015 10:57:08 +0100 Subject: [PATCH] save statics inside a non-cacheable folder --- CHANGELOG.md | 2 + app-loader/app-loader.coffee | 10 +-- app/coffee/app.coffee | 2 +- app/coffee/modules/admin/memberships.coffee | 2 +- app/coffee/modules/common/components.coffee | 4 +- app/coffee/modules/common/loading.coffee | 2 +- app/coffee/modules/issues/list.coffee | 2 +- app/coffee/modules/kanban/main.coffee | 2 +- app/coffee/modules/related-tasks.coffee | 2 +- app/coffee/modules/taskboard/main.coffee | 4 +- app/coffee/modules/wiki/main.coffee | 2 +- app/index.jade | 10 +-- app/modules/home/duties/duty.jade | 6 +- .../profile-contacts/profile-contacts.jade | 2 +- .../profile/profile-favs/items/ticket.jade | 2 +- .../profile/profile-favs/profile-favs.jade | 4 +- .../profile-projects/profile-projects.jade | 2 +- app/modules/profile/styles/profile-bar.scss | 2 +- app/modules/services/app-meta.service.coffee | 4 +- .../services/app-meta.service.spec.coffee | 11 ++- .../user-timeline-item.jade | 4 +- .../user-timeline/user-timeline.jade | 2 +- app/partials/admin/admin-project-export.jade | 2 +- app/partials/backlog/backlog.jade | 2 +- app/partials/error/error.jade | 2 +- app/partials/error/not-found.jade | 4 +- app/partials/error/permission-denied.jade | 2 +- app/partials/includes/components/beta.jade | 2 +- .../components/empty-search-results.jade | 2 +- .../includes/modules/issues-table.jade | 2 +- .../modules/lightbox-generic-loading.jade | 2 +- app/partials/includes/modules/sprints.jade | 2 +- app/partials/user/user-profile.jade | 2 +- app/themes/taiga/variables.scss | 4 +- gulpfile.js | 74 ++++++++++--------- karma.conf.js | 12 +-- 36 files changed, 102 insertions(+), 95 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64311291..f244e0b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog # +## 1.10.0 ??? (unreleased) +- Statics folder hash ## 1.9.0 Abies Siberica (2015-11-XX) diff --git a/app-loader/app-loader.coffee b/app-loader/app-loader.coffee index 06c24404..e8801f63 100644 --- a/app-loader/app-loader.coffee +++ b/app-loader/app-loader.coffee @@ -1,4 +1,4 @@ -version = ___VERSION___ +window._version = "___VERSION___" window.taigaConfig = { "api": "http://localhost:8000/api/v1/", "eventsUrl": null, @@ -16,16 +16,16 @@ window.taigaConfig = { "contribPlugins": [] } -promise = $.getJSON "/js/conf.json" +promise = $.getJSON "/conf.json" promise.done (data) -> window.taigaConfig = _.extend({}, window.taigaConfig, data) promise.always -> if window.taigaConfig.contribPlugins.length > 0 - plugins = _.map(window.taigaConfig.contribPlugins, (plugin) -> "#{plugin}?v=#{version}") + plugins = _.map(window.taigaConfig.contribPlugins, (plugin) -> "#{plugin}") ljs.load plugins, -> - ljs.load "/js/app.js?v=#{version}", -> + ljs.load "/#{window._version}/js/app.js", -> angular.bootstrap(document, ['taiga']) else - ljs.load "/js/app.js?v=#{version}", -> + ljs.load "/#{window._version}/js/app.js", -> angular.bootstrap(document, ['taiga']) diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index c879766d..0bbf75d1 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -508,7 +508,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven $translatePartialLoaderProvider.addPart('taiga') $translateProvider .useLoader('$translatePartialLoader', { - urlTemplate: '/locales/{part}/locale-{lang}.json' + urlTemplate: '/' + window._version + '/locales/{part}/locale-{lang}.json' }) .useSanitizeValueStrategy('escapeParameters') .addInterpolation('$translateMessageFormatInterpolation') diff --git a/app/coffee/modules/admin/memberships.coffee b/app/coffee/modules/admin/memberships.coffee index 9068b3b0..e87c5c4e 100644 --- a/app/coffee/modules/admin/memberships.coffee +++ b/app/coffee/modules/admin/memberships.coffee @@ -219,7 +219,7 @@ MembershipsRowAvatarDirective = ($log, $template, $translate) -> ctx = { full_name: if member.full_name then member.full_name else "" email: if member.user_email then member.user_email else member.email - imgurl: if member.photo then member.photo else "/images/unnamed.png" + imgurl: if member.photo then member.photo else "/" + window._version + "/images/unnamed.png" pending: if !member.is_user_active then pending else "" } diff --git a/app/coffee/modules/common/components.coffee b/app/coffee/modules/common/components.coffee index 6f41595a..23b6dab2 100644 --- a/app/coffee/modules/common/components.coffee +++ b/app/coffee/modules/common/components.coffee @@ -140,7 +140,7 @@ CreatedByDisplayDirective = ($template, $compile, $translate, $navUrls)-> if model? $scope.owner = model.owner_extra_info or { full_name_display: $translate.instant("COMMON.EXTERNAL_USER") - photo: "/images/user-noimage.png" + photo: "/" + window._version + "/images/user-noimage.png" } $scope.url = if $scope.owner?.is_active then $navUrls.resolve("user-profile", {username: $scope.owner.username}) else "" @@ -643,7 +643,7 @@ ListItemAssignedtoDirective = ($template) -> link = ($scope, $el, $attrs) -> bindOnce $scope, "usersById", (usersById) -> item = $scope.$eval($attrs.tgListitemAssignedto) - ctx = {name: "Unassigned", imgurl: "/images/unnamed.png"} + ctx = {name: "Unassigned", imgurl: "/" + window._version + "/images/unnamed.png"} member = usersById[item.assigned_to] if member diff --git a/app/coffee/modules/common/loading.coffee b/app/coffee/modules/common/loading.coffee index 54e4d3fb..33aa581b 100644 --- a/app/coffee/modules/common/loading.coffee +++ b/app/coffee/modules/common/loading.coffee @@ -22,7 +22,7 @@ module = angular.module("taigaCommon") TgLoadingService = ($compile) -> - spinner = "loading..." + spinner = "loading..." return () -> service = { diff --git a/app/coffee/modules/issues/list.coffee b/app/coffee/modules/issues/list.coffee index 1b90695e..51551823 100644 --- a/app/coffee/modules/issues/list.coffee +++ b/app/coffee/modules/issues/list.coffee @@ -780,7 +780,7 @@ IssueAssignedToInlineEditionDirective = ($repo, $rootscope, popoverService) -> link = ($scope, $el, $attrs) -> updateIssue = (issue) -> - ctx = {name: "Unassigned", imgurl: "/images/unnamed.png"} + ctx = {name: "Unassigned", imgurl: "/" + window._version + "/images/unnamed.png"} member = $scope.usersById[issue.assigned_to] if member ctx.imgurl = member.photo diff --git a/app/coffee/modules/kanban/main.coffee b/app/coffee/modules/kanban/main.coffee index b2f803ba..c38a5a48 100644 --- a/app/coffee/modules/kanban/main.coffee +++ b/app/coffee/modules/kanban/main.coffee @@ -547,7 +547,7 @@ KanbanUserDirective = ($log, $compile) -> render = (user) -> if user is undefined - ctx = {name: "Unassigned", imgurl: "/images/unnamed.png", clickable: clickable} + ctx = {name: "Unassigned", imgurl: "/" + window._version + "/images/unnamed.png", clickable: clickable} else ctx = {name: user.full_name_display, imgurl: user.photo, clickable: clickable} diff --git a/app/coffee/modules/related-tasks.coffee b/app/coffee/modules/related-tasks.coffee index ec0cbd8b..e1a991ce 100644 --- a/app/coffee/modules/related-tasks.coffee +++ b/app/coffee/modules/related-tasks.coffee @@ -248,7 +248,7 @@ RelatedTaskAssignedToInlineEditionDirective = ($repo, $rootscope, popoverService link = ($scope, $el, $attrs) -> updateRelatedTask = (task) -> - ctx = {name: "Unassigned", imgurl: "/images/unnamed.png"} + ctx = {name: "Unassigned", imgurl: "/" + window._version + "/images/unnamed.png"} member = $scope.usersById[task.assigned_to] if member ctx.imgurl = member.photo diff --git a/app/coffee/modules/taskboard/main.coffee b/app/coffee/modules/taskboard/main.coffee index 9e7f5f37..7d6e3900 100644 --- a/app/coffee/modules/taskboard/main.coffee +++ b/app/coffee/modules/taskboard/main.coffee @@ -185,7 +185,7 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin) @scope.usTasks[task.user_story][task.status].push(task) if tasks.length == 0 - + if @scope.userstories.length > 0 usId = @scope.userstories[0].id else @@ -442,7 +442,7 @@ TaskboardUserDirective = ($log) -> user = $scope.usersById[assigned_to] if user is undefined - _.assign($scope, {name: "Unassigned", imgurl: "/images/unnamed.png", clickable: clickable}) + _.assign($scope, {name: "Unassigned", imgurl: "/" + window._version + "/images/unnamed.png", clickable: clickable}) else _.assign($scope, {name: user.full_name_display, imgurl: user.photo, clickable: clickable}) diff --git a/app/coffee/modules/wiki/main.coffee b/app/coffee/modules/wiki/main.coffee index c108954a..4f4f4975 100644 --- a/app/coffee/modules/wiki/main.coffee +++ b/app/coffee/modules/wiki/main.coffee @@ -157,7 +157,7 @@ WikiSummaryDirective = ($log, $template, $compile, $translate) -> user = $scope.usersById[wiki.last_modifier] if user is undefined - user = {name: "unknown", imgUrl: "/images/user-noimage.png"} + user = {name: "unknown", imgUrl: "/" + window._version + "/images/user-noimage.png"} else user = {name: user.full_name_display, imgUrl: user.photo} diff --git a/app/index.jade b/app/index.jade index a9994cef..96aa95cd 100644 --- a/app/index.jade +++ b/app/index.jade @@ -10,8 +10,8 @@ html(lang="en") meta(name="description", content="Taiga is a project management platform for startups and agile developers & designers who want a simple, beautiful tool that makes work truly enjoyable.") meta(name="keywords", content="agile, scrum, taiga, management, project, developer, designer, user experience") //-meta(name="viewport", content="width=device-width, user-scalable=no") - link(rel="stylesheet", href="/styles/theme-taiga.css") - link(rel="icon", type="image/png", href="/images/favicon.png") + link(rel="stylesheet", href="/#{v}/styles/theme-taiga.css") + link(rel="icon", type="image/png", href="/#{v}/images/favicon.png") //- PRERENDER SERVICE: This is to know when the page is completely loaded. script(type='text/javascript'). @@ -39,6 +39,6 @@ html(lang="en") div(tg-joy-ride) - script(src="/js/libs.js?v=#{v}") - script(src="/js/templates.js?v=#{v}") - script(src="/js/app-loader.js?v=#{v}") + script(src="/#{v}/js/libs.js") + script(src="/#{v}/js/templates.js") + script(src="/#{v}/js/app-loader.js") diff --git a/app/modules/home/duties/duty.jade b/app/modules/home/duties/duty.jade index d3efacee..c922b6a6 100644 --- a/app/modules/home/duties/duty.jade +++ b/app/modules/home/duties/duty.jade @@ -1,7 +1,7 @@ a.list-itemtype-ticket( href="{{ ::vm.duty.get('url') }}" title="{{ ::duty.get('subject') }}" -) +) div.list-itemtype-avatar(ng-if="::vm.duty.get('assigned_to_extra_info')") img( ng-src="{{ ::vm.duty.get('assigned_to_extra_info').get('photo') }}" @@ -9,7 +9,7 @@ a.list-itemtype-ticket( ) div.list-itemtype-avatar(ng-if="::!vm.duty.get('assigned_to_extra_info')") img( - src="/images/unnamed.png" + src="/#{v}/images/unnamed.png" title="{{'ACTIVITY.VALUES.UNASSIGNED' | translate}}" ) div.list-itemtype-ticket-data @@ -17,7 +17,7 @@ a.list-itemtype-ticket( span.ticket-project {{ ::vm.duty.get('projectName')}} span.ticket-type {{ ::vm.getDutyType() }} span.ticket-status(ng-style="{'color': vm.duty.get('status_extra_info').get('color')}") {{ ::vm.duty.get('status_extra_info').get('name') }} - + h2 span.ticket-id(tg-bo-ref="duty.get('ref')") span.ticket-title {{ ::duty.get('subject') }} diff --git a/app/modules/profile/profile-contacts/profile-contacts.jade b/app/modules/profile/profile-contacts/profile-contacts.jade index 49a79f62..08ffe638 100644 --- a/app/modules/profile/profile-contacts/profile-contacts.jade +++ b/app/modules/profile/profile-contacts/profile-contacts.jade @@ -1,7 +1,7 @@ section.profile-contacts div(ng-if="vm.contacts === undefined") div.spin - img(src="/svg/spinner-circle.svg", alt="Loading...") + img(src="/#{v}/svg/spinner-circle.svg", alt="Loading...") div.empty-tab(ng-if="vm.contacts && !vm.contacts.size") include ../../../svg/hide.svg diff --git a/app/modules/profile/profile-favs/items/ticket.jade b/app/modules/profile/profile-favs/items/ticket.jade index f8051bc4..a55ec8d0 100644 --- a/app/modules/profile/profile-favs/items/ticket.jade +++ b/app/modules/profile/profile-favs/items/ticket.jade @@ -16,7 +16,7 @@ div.list-itemtype-ticket title="{{ 'COMMON.ASSIGNED_TO.NOT_ASSIGNED'|translate }}" ) img( - src="/images/unnamed.png", + src="/#{v}/images/unnamed.png", alt="{{ 'COMMON.ASSIGNED_TO.NOT_ASSIGNED'|translate }}" ) diff --git a/app/modules/profile/profile-favs/profile-favs.jade b/app/modules/profile/profile-favs/profile-favs.jade index 38d976e3..7ce66060 100644 --- a/app/modules/profile/profile-favs/profile-favs.jade +++ b/app/modules/profile/profile-favs/profile-favs.jade @@ -68,13 +68,13 @@ section.profile-favs div(ng-if="vm.isLoading") div.spin img( - src="/svg/spinner-circle.svg" + src="/#{v}/svg/spinner-circle.svg" alt="{{ 'COMMON.LOADING'|translate }}" ) .empty-search-results(ng-if="vm.hasNoResults && !vm.isLoading") img( - src="../../images/search-empty.png" + src="/#{v}/images/search-empty.png" alt="{{ 'USER.PROFILE_FAVS.EMPTY_TITLE' | translate }}" ) p.title {{ 'USER.PROFILE_FAVS.EMPTY_TITLE' | translate }} diff --git a/app/modules/profile/profile-projects/profile-projects.jade b/app/modules/profile/profile-projects/profile-projects.jade index c9d10a0f..3d4e8b2c 100644 --- a/app/modules/profile/profile-projects/profile-projects.jade +++ b/app/modules/profile/profile-projects/profile-projects.jade @@ -1,7 +1,7 @@ section.profile-projects div(ng-if="vm.projects === undefined") div.spin - img(src="/svg/spinner-circle.svg", alt="Loading...") + img(src="/#{v}/svg/spinner-circle.svg", alt="Loading...") .empty-tab(ng-if="vm.projects && !vm.projects.size") include ../../../svg/hide.svg diff --git a/app/modules/profile/styles/profile-bar.scss b/app/modules/profile/styles/profile-bar.scss index 6cb27072..265fafe9 100644 --- a/app/modules/profile/styles/profile-bar.scss +++ b/app/modules/profile/styles/profile-bar.scss @@ -149,7 +149,7 @@ .profile-quote { @extend %light; @extend %large; - background: url('/images/quote.png') no-repeat top left; + background: url('../images/quote.png') no-repeat top left; line-height: 1.4; padding: .5rem; } diff --git a/app/modules/services/app-meta.service.coffee b/app/modules/services/app-meta.service.coffee index 7c5ae20e..ef84f20d 100644 --- a/app/modules/services/app-meta.service.coffee +++ b/app/modules/services/app-meta.service.coffee @@ -68,14 +68,14 @@ class AppMetaService @._set("twitter:site", "@taigaio") @._set("twitter:title", title) @._set("twitter:description", truncate(description, 300)) - @._set("twitter:image", "#{window.location.origin}/images/logo-color.png") + @._set("twitter:image", "#{window.location.origin}/#{window._version}/images/logo-color.png") setOpenGraphMetas: (title, description) -> @._set("og:type", "object") @._set("og:site_name", "Taiga - Love your projects") @._set("og:title", title) @._set("og:description", truncate(description, 300)) - @._set("og:image", "#{window.location.origin}/images/logo-color.png") + @._set("og:image", "#{window.location.origin}/#{window._version}/images/logo-color.png") @._set("og:url", window.location.href) setAll: (title, description) -> diff --git a/app/modules/services/app-meta.service.spec.coffee b/app/modules/services/app-meta.service.spec.coffee index a8ae97ea..abbd046e 100644 --- a/app/modules/services/app-meta.service.spec.coffee +++ b/app/modules/services/app-meta.service.spec.coffee @@ -30,6 +30,9 @@ describe "AppMetaService", -> appMetaService = _tgAppMetaService_ $rootScope = _$rootScope_ + before -> + window._version = 1 + beforeEach -> module "taigaCommon" _inject() @@ -48,7 +51,7 @@ describe "AppMetaService", -> expect($("meta[name='twitter:site']")).to.have.attr("content", "@taigaio") expect($("meta[name='twitter:title']")).to.have.attr("content", data.title) expect($("meta[name='twitter:description']")).to.have.attr("content", data.description) - expect($("meta[name='twitter:image']")).to.have.attr("content", "#{window.location.origin}/images/logo-color.png") + expect($("meta[name='twitter:image']")).to.have.attr("content", "#{window.location.origin}/#{window._version}/images/logo-color.png") it "set meta for open graph", () -> appMetaService.setOpenGraphMetas(data.title, data.description) @@ -56,7 +59,7 @@ describe "AppMetaService", -> expect($("meta[property='og:site_name']")).to.have.attr("content", "Taiga - Love your projects") expect($("meta[property='og:title']")).to.have.attr("content", data.title) expect($("meta[property='og:description']")).to.have.attr("content", data.description) - expect($("meta[property='og:image']")).to.have.attr("content", "#{window.location.origin}/images/logo-color.png") + expect($("meta[property='og:image']")).to.have.attr("content", "#{window.location.origin}/#{window._version}/images/logo-color.png") expect($("meta[property='og:url']")).to.have.attr("content", window.location.href) it "set all meta", () -> @@ -67,12 +70,12 @@ describe "AppMetaService", -> expect($("meta[name='twitter:site']")).to.have.attr("content", "@taigaio") expect($("meta[name='twitter:title']")).to.have.attr("content", data.title) expect($("meta[name='twitter:description']")).to.have.attr("content", data.description) - expect($("meta[name='twitter:image']")).to.have.attr("content", "#{window.location.origin}/images/logo-color.png") + expect($("meta[name='twitter:image']")).to.have.attr("content", "#{window.location.origin}/#{window._version}/images/logo-color.png") expect($("meta[property='og:type']")).to.have.attr("content", "object") expect($("meta[property='og:site_name']")).to.have.attr("content", "Taiga - Love your projects") expect($("meta[property='og:title']")).to.have.attr("content", data.title) expect($("meta[property='og:description']")).to.have.attr("content", data.description) - expect($("meta[property='og:image']")).to.have.attr("content", "#{window.location.origin}/images/logo-color.png") + expect($("meta[property='og:image']")).to.have.attr("content", "#{window.location.origin}/#{window._version}/images/logo-color.png") expect($("meta[property='og:url']")).to.have.attr("content", window.location.href) it "set function to set the metas", () -> diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade b/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade index e37c1dca..38a492ee 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item.jade @@ -7,10 +7,10 @@ div.activity-item // profile image with url div.profile-contact-picture(ng-if="timeline.getIn(['data', 'user', 'is_profile_visible'])") a(tg-nav="user-profile:username=timeline.getIn(['data', 'user', 'username'])", title="{{::timeline.getIn(['data', 'user', 'name']) }}") - img(ng-src="{{::timeline.getIn(['data', 'user', 'photo']) || '/images/user-noimage.png'}}", alt="{{::timeline.getIn(['data', 'user', 'name'])}}") + img(ng-src="{{::timeline.getIn(['data', 'user', 'photo']) || '/#{v}/images/user-noimage.png'}}", alt="{{::timeline.getIn(['data', 'user', 'name'])}}") // profile image without url div.profile-contact-picture(ng-if="!timeline.getIn(['data', 'user', 'is_profile_visible'])") - img(ng-src="{{::timeline.getIn(['data', 'user', 'photo']) || '/images/user-noimage.png'}}", alt="{{::timeline.getIn(['data', 'user', 'name'])}}") + img(ng-src="{{::timeline.getIn(['data', 'user', 'photo']) || '/#{v}/images/user-noimage.png'}}", alt="{{::timeline.getIn(['data', 'user', 'name'])}}") p(tg-compile-html="timeline.get('title_html')") diff --git a/app/modules/user-timeline/user-timeline/user-timeline.jade b/app/modules/user-timeline/user-timeline/user-timeline.jade index c4ebca16..35c59719 100644 --- a/app/modules/user-timeline/user-timeline/user-timeline.jade +++ b/app/modules/user-timeline/user-timeline/user-timeline.jade @@ -1,7 +1,7 @@ section.profile-timeline div(ng-if="!vm.timelineList.size") div.spin - img(src="/svg/spinner-circle.svg", alt="Loading...") + img(src="/#{v}/svg/spinner-circle.svg", alt="Loading...") div(infinite-scroll="vm.loadTimeline()", infinite-scroll-distance="3", infinite-scroll-disabled="vm.scrollDisabled") div(tg-repeat="timeline in vm.timelineList", tg-user-timeline-item="timeline") diff --git a/app/partials/admin/admin-project-export.jade b/app/partials/admin/admin-project-export.jade index eb68dc5e..04fd1af4 100644 --- a/app/partials/admin/admin-project-export.jade +++ b/app/partials/admin/admin-project-export.jade @@ -21,7 +21,7 @@ div.wrapper(ng-controller="ProjectProfileController as ctrl", div.admin-project-export-result.hidden div.spin.hidden - img(src="/svg/spinner-circle.svg", alt="{{ 'COMMON.LOADING' | translate }}") + img(src="/#{v}/svg/spinner-circle.svg", alt="{{ 'COMMON.LOADING' | translate }}") h3.result-title p.result-message diff --git a/app/partials/backlog/backlog.jade b/app/partials/backlog/backlog.jade index 50bcb97f..b55788b4 100644 --- a/app/partials/backlog/backlog.jade +++ b/app/partials/backlog/backlog.jade @@ -55,7 +55,7 @@ div.wrapper(tg-backlog, ng-controller="BacklogController as ctrl", tg-backlog-empty-sortable ) img( - src="/images/backlog-empty.png" + src="/#{v}/images/backlog-empty.png" alt="{{'BACKLOG.EMPTY' | translate}}" ) p.title(translate="BACKLOG.EMPTY") diff --git a/app/partials/error/error.jade b/app/partials/error/error.jade index 39629937..0a875204 100644 --- a/app/partials/error/error.jade +++ b/app/partials/error/error.jade @@ -3,7 +3,7 @@ doctype html div.error-main div.error-container object.logo-svg(type="image/svg+xml", data="/svg/logo.svg") - img(src="/images/logo.png", alt="TAIGA") + img(src="/#{v}/images/logo.png", alt="TAIGA") h1.logo Taiga p.error-text(translate="ERROR.TEXT1") a(href="/", title="", translate="COMMON.GO_HOME") diff --git a/app/partials/error/not-found.jade b/app/partials/error/not-found.jade index 12172038..4470a474 100644 --- a/app/partials/error/not-found.jade +++ b/app/partials/error/not-found.jade @@ -2,8 +2,8 @@ doctype html div.error-main div.error-container - object.logo-svg(type="image/svg+xml", data="/svg/logo.svg") - img(src="/images/logo.png", alt="TAIGA") + object.logo-svg(type="image/svg+xml", data="/#{v}/svg/logo.svg") + img(src="/#{v}/images/logo.png", alt="TAIGA") h1.logo(translate="ERROR.NOT_FOUND") p.error-text(translate="ERROR.NOT_FOUND_TEXT") a(href="/", title="", translate="COMMON.GO_HOME") diff --git a/app/partials/error/permission-denied.jade b/app/partials/error/permission-denied.jade index 12869f63..fa1333fc 100644 --- a/app/partials/error/permission-denied.jade +++ b/app/partials/error/permission-denied.jade @@ -3,7 +3,7 @@ doctype html div.error-main div.error-container object.logo-svg(type="image/svg+xml", data="/svg/logo.svg") - img(src="/images/logo.png", alt="TAIGA") + img(src="/#{v}/images/logo.png", alt="TAIGA") h1.logo(translate="ERROR.PERMISSION_DENIED") p.error-text(translate="ERROR.PERMISSION_DENIED_TEXT") a(href="/", title="", translate="COMMON.GO_HOME") diff --git a/app/partials/includes/components/beta.jade b/app/partials/includes/components/beta.jade index a82f61ed..647d2108 100644 --- a/app/partials/includes/components/beta.jade +++ b/app/partials/includes/components/beta.jade @@ -1 +1 @@ -img.beta(src="/images/beta.png", title="{{'COMMON.BETA' | translate}}") +img.beta(src="/#{v}/images/beta.png", title="{{'COMMON.BETA' | translate}}") diff --git a/app/partials/includes/components/empty-search-results.jade b/app/partials/includes/components/empty-search-results.jade index be261c6c..f3248bd3 100644 --- a/app/partials/includes/components/empty-search-results.jade +++ b/app/partials/includes/components/empty-search-results.jade @@ -1,5 +1,5 @@ img( - src="../../images/search-empty.png" + src="/#{v}/images/search-empty.png" alt="{{ 'SEARCH.EMPTY_TITLE' | translate }}" ) p.title {{ 'SEARCH.EMPTY_TITLE' | translate }} diff --git a/app/partials/includes/modules/issues-table.jade b/app/partials/includes/modules/issues-table.jade index f696730d..ddf6ada0 100644 --- a/app/partials/includes/modules/issues-table.jade +++ b/app/partials/includes/modules/issues-table.jade @@ -53,7 +53,7 @@ section.issues-table.basic-table(ng-class="{empty: !issues.length}") section.empty-issues(ng-if="issues != undefined && issues.length == 0") img( - src="../../images/issues-empty.png", + src="/#{v}/images/issues-empty.png", alt="{{ISSUES.TABLE.EMPTY.TITLE | translate }}" ) p.title(translate="ISSUES.TABLE.EMPTY.TITLE") diff --git a/app/partials/includes/modules/lightbox-generic-loading.jade b/app/partials/includes/modules/lightbox-generic-loading.jade index 95d01cac..05c280d9 100644 --- a/app/partials/includes/modules/lightbox-generic-loading.jade +++ b/app/partials/includes/modules/lightbox-generic-loading.jade @@ -2,7 +2,7 @@ section div.spin.hidden - img(src="/svg/spinner-circle.svg", alt="{{'COMMON.LOADING' | translate}}") + img(src="/#{v}/svg/spinner-circle.svg", alt="{{'COMMON.LOADING' | translate}}") div.progress-bar-wrapper.hidden div.bar diff --git a/app/partials/includes/modules/sprints.jade b/app/partials/includes/modules/sprints.jade index d333e52d..2e1b163f 100644 --- a/app/partials/includes/modules/sprints.jade +++ b/app/partials/includes/modules/sprints.jade @@ -17,7 +17,7 @@ section.sprints div.sprints-empty(ng-if="totalMilestones === 0") img( - src="/images/sprint-empty.png" + src="/#{v}/images/sprint-empty.png" alt="{{'BACKLOG.SPRINTS.EMPTY' | translate}}" ) p.title(translate="BACKLOG.SPRINTS.EMPTY") diff --git a/app/partials/user/user-profile.jade b/app/partials/user/user-profile.jade index 4e60adf1..40f0abb8 100644 --- a/app/partials/user/user-profile.jade +++ b/app/partials/user/user-profile.jade @@ -19,7 +19,7 @@ div.wrapper(tg-user-profile, ng-controller="UserSettingsController as ctrl", img.avatar(ng-src="{{user.big_photo}}" alt="avatar") .overlay.hidden img.loading-spinner( - src="/svg/spinner-circle.svg", + src="/#{v}/svg/spinner-circle.svg", alt="{{'COMMON.LOADING' | translate}}" ) diff --git a/app/themes/taiga/variables.scss b/app/themes/taiga/variables.scss index 96d36e86..2eb4144b 100755 --- a/app/themes/taiga/variables.scss +++ b/app/themes/taiga/variables.scss @@ -63,11 +63,11 @@ $dropdown-color: rgba(darken($grayer, 20%), 1); // Background images %triangled-bg { - background: url('/images/bg.png') no-repeat center center; + background: url('../images/bg.png') no-repeat center center; background-size: cover; } %background-taiga { - background: url('/images/invitation_bg.jpg') no-repeat center center; + background: url('../images/invitation_bg.jpg') no-repeat center center; background-size: cover; } diff --git a/gulpfile.js b/gulpfile.js index fda87eff..5b81c483 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -37,9 +37,12 @@ if (argv.theme) { themes.set(argv.theme); } +var version = "v-" + Date.now(); + var paths = {}; paths.app = "app/"; paths.dist = "dist/"; +paths.distVersion = paths.dist + version + "/"; paths.tmp = "tmp/"; paths.extras = "extras/"; paths.vendor = "vendor/"; @@ -190,7 +193,7 @@ gulp.task("jade", function() { return gulp.src(paths.jade) .pipe(plumber()) .pipe(cached("jade")) - .pipe(jade({pretty: true, locals:{v:(new Date()).getTime()}})) + .pipe(jade({pretty: true, locals:{v:version}})) .pipe(gulp.dest(paths.tmp)); }); @@ -199,7 +202,7 @@ gulp.task("jade-inheritance", function() { .pipe(plumber()) .pipe(cached("jade")) .pipe(jadeInheritance({basedir: "./app/"})) - .pipe(jade({pretty: true, locals:{v:(new Date()).getTime()}})) + .pipe(jade({pretty: true, locals:{v: version}})) .pipe(gulp.dest(paths.tmp)); }); @@ -211,7 +214,7 @@ gulp.task("copy-index", function() { gulp.task("template-cache", function() { return gulp.src(paths.htmlPartials) .pipe(templateCache({standalone: true})) - .pipe(gulp.dest(paths.dist + "js/")); + .pipe(gulp.dest(paths.distVersion + "js/")); }); gulp.task("jade-deploy", function(cb) { @@ -316,7 +319,7 @@ gulp.task("main-css", function() { return gulp.src(_paths) .pipe(concat("theme-" + themes.current.name + ".css")) .pipe(gulpif(isDeploy, minifyCSS({noAdvanced: true}))) - .pipe(gulp.dest(paths.dist + "styles/")); + .pipe(gulp.dest(paths.distVersion + "styles/")); }); var compileThemes = function (cb) { @@ -365,19 +368,19 @@ gulp.task("styles-dependencies", function(cb) { */ gulp.task("conf", function() { return gulp.src(["conf/conf.example.json"]) - .pipe(gulp.dest(paths.dist + "js/")); + .pipe(gulp.dest(paths.dist)); }); gulp.task("app-loader", function() { return gulp.src("app-loader/app-loader.coffee") - .pipe(replace("___VERSION___", (new Date()).getTime())) + .pipe(replace("___VERSION___", version)) .pipe(coffee()) - .pipe(gulp.dest(paths.dist + "js/")); + .pipe(gulp.dest(paths.distVersion + "js/")); }); gulp.task("locales", function() { return gulp.src(paths.locales) - .pipe(gulp.dest(paths.dist + "locales")); + .pipe(gulp.dest(paths.distVersion + "locales")); }); gulp.task("coffee-lint", function () { @@ -412,14 +415,14 @@ gulp.task("coffee", function() { }) .pipe(concat("app.js")) .pipe(sourcemaps.write('./maps')) - .pipe(gulp.dest(paths.dist + "js/")); + .pipe(gulp.dest(paths.distVersion + "js/")); }); gulp.task("jslibs-watch", function() { return gulp.src(paths.libs) .pipe(plumber()) .pipe(concat("libs.js")) - .pipe(gulp.dest(paths.dist + "js/")); + .pipe(gulp.dest(paths.distVersion + "js/")); }); gulp.task("jslibs-deploy", function() { @@ -429,19 +432,17 @@ gulp.task("jslibs-deploy", function() { .pipe(concat("libs.js")) .pipe(uglify({mangle:false, preserveComments: false})) .pipe(sourcemaps.write("./maps")) - .pipe(gulp.dest(paths.dist + "js/")); + .pipe(gulp.dest(paths.distVersion + "js/")); }); gulp.task("app-watch", ["coffee-lint", "coffee", "conf", "locales", "app-loader"]); gulp.task("app-deploy", ["coffee", "conf", "locales", "app-loader"], function() { - return gulp.src(paths.dist) - .pipe(order(paths.coffee_order, {base: '.'})) + return gulp.src(paths.distVersion + "js/app.js") .pipe(sourcemaps.init()) - .pipe(concat("app.js")) .pipe(uglify({mangle:false, preserveComments: false})) .pipe(sourcemaps.write("./maps")) - .pipe(gulp.dest(paths.dist + "js/")); + .pipe(gulp.dest(paths.distVersion + "js/")); }); /* @@ -456,45 +457,45 @@ gulp.task("clear", ["clear-sass-cache"], function(done) { //SVG gulp.task("copy-svg", function() { return gulp.src(paths.app + "/svg/**/*") - .pipe(gulp.dest(paths.dist + "/svg/")); + .pipe(gulp.dest(paths.distVersion + "/svg/")); }); gulp.task("copy-theme-svg", function() { return gulp.src(themes.current.path + "/svg/**/*") - .pipe(gulp.dest(paths.dist + "/svg/" + themes.current.name)); + .pipe(gulp.dest(paths.distVersion + "/svg/" + themes.current.name)); }); gulp.task("copy-fonts", function() { return gulp.src(paths.app + "/fonts/*") - .pipe(gulp.dest(paths.dist + "/fonts/")); + .pipe(gulp.dest(paths.distVersion + "/fonts/")); }); gulp.task("copy-theme-fonts", function() { return gulp.src(themes.current.path + "/fonts/*") - .pipe(gulp.dest(paths.dist + "/fonts/" + themes.current.name)); + .pipe(gulp.dest(paths.distVersion + "/fonts/" + themes.current.name)); }); gulp.task("copy-images", function() { return gulp.src(paths.app + "/images/**/*") .pipe(gulpif(isDeploy, imagemin({progressive: true}))) - .pipe(gulp.dest(paths.dist + "/images/")); + .pipe(gulp.dest(paths.distVersion + "/images/")); }); gulp.task("copy-theme-images", function() { return gulp.src(themes.current.path + "/images/**/*") .pipe(gulpif(isDeploy, imagemin({progressive: true}))) - .pipe(gulp.dest(paths.dist + "/images/" + themes.current.name)); + .pipe(gulp.dest(paths.distVersion + "/images/" + themes.current.name)); }); gulp.task("copy-images-plugins", function() { return gulp.src(paths.app + "/plugins/**/images/*") .pipe(flatten()) - .pipe(gulp.dest(paths.dist + "/images/")); + .pipe(gulp.dest(paths.distVersion + "/images/")); }); gulp.task("copy-plugin-templates", function() { return gulp.src(paths.app + "/plugins/**/templates/**/*.html") - .pipe(gulp.dest(paths.dist + "/plugins/")); + .pipe(gulp.dest(paths.distVersion + "/plugins/")); }); gulp.task("copy-extras", function() { @@ -514,6 +515,10 @@ gulp.task("copy", [ "copy-extras" ]); +gulp.task("delete-old-version", function() { + del.sync(paths.dist + "v-*"); +}); + gulp.task("delete-tmp", function() { del.sync(paths.tmp); }); @@ -522,15 +527,16 @@ gulp.task("express", function() { var express = require("express"); var app = express(); - app.use("/js", express.static(__dirname + "/dist/js")); - app.use("/styles", express.static(__dirname + "/dist/styles")); - app.use("/images", express.static(__dirname + "/dist/images")); - app.use("/svg", express.static(__dirname + "/dist/svg")); - app.use("/partials", express.static(__dirname + "/dist/partials")); - app.use("/fonts", express.static(__dirname + "/dist/fonts")); - app.use("/plugins", express.static(__dirname + "/dist/plugins")); - app.use("/locales", express.static(__dirname + "/dist/locales")); - app.use("/maps", express.static(__dirname + "/dist/maps")); + app.use("/" + version + "/js", express.static(__dirname + "/dist/" + version + "/js")); + app.use("/" + version + "/styles", express.static(__dirname + "/dist/" + version + "/styles")); + app.use("/" + version + "/images", express.static(__dirname + "/dist/" + version + "/images")); + app.use("/" + version + "/svg", express.static(__dirname + "/dist/" + version + "/svg")); + app.use("/" + version + "/partials", express.static(__dirname + "/dist/" + version + "/partials")); + app.use("/" + version + "/fonts", express.static(__dirname + "/dist/" + version + "/fonts")); + app.use("/" + version + "/plugins", express.static(__dirname + "/dist/" + version + "/plugins")); + app.use("/" + version + "/locales", express.static(__dirname + "/dist/" + version + "/locales")); + app.use("/" + version + "/maps", express.static(__dirname + "/dist/" + version + "/maps")); + app.use("/conf.json", express.static(__dirname + "/dist/conf.json")); app.all("/*", function(req, res, next) { //Just send the index.html for other files to support HTML5Mode @@ -554,7 +560,7 @@ gulp.task("watch", function() { }); gulp.task("deploy", function(cb) { - runSequence("clear", "delete-tmp", [ + runSequence("clear", "delete-old-version", "delete-tmp", [ "copy", "jade-deploy", "app-deploy", @@ -564,7 +570,7 @@ gulp.task("deploy", function(cb) { }); //The default task (called when you run gulp from cli) gulp.task("default", function(cb) { - runSequence("delete-tmp", [ + runSequence("delete-old-version", "delete-tmp", [ "copy", "styles", "app-watch", diff --git a/karma.conf.js b/karma.conf.js index f60b812e..4e24c1ec 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -2,9 +2,6 @@ // Generated on Wed Apr 15 2015 09:44:14 GMT+0200 (CEST) // this is needed by theme.service.spec -var fs = require('fs'); -fs.writeFileSync('dist/styles/empty.css', ''); - module.exports = function(config) { var configuration = { @@ -20,7 +17,7 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ 'karma.app.conf.js', - 'dist/js/libs.js', + 'dist/**/js/libs.js', 'node_modules/angular-mocks/angular-mocks.js', 'vendor/bluebird/js/browser/bluebird.js', 'node_modules/chai-jquery/chai-jquery.js', @@ -28,8 +25,8 @@ module.exports = function(config) { 'vendor/lodash/dist/lodash.js', 'vendor/underscore.string/lib/underscore.string.js', 'test-utils.js', - 'dist/js/app.js', - 'dist/js/templates.js', + 'dist/**/js/app.js', + 'dist/**/js/templates.js', 'app/**/*spec.coffee' ], @@ -96,8 +93,7 @@ module.exports = function(config) { proxies: { '/images/': 'http://localhost:9001/images/', '/base/dist/js/maps/': 'http://localhost:9001/js/maps/', - '/base/dist/js/maps/': 'http://localhost:9001/js/maps/', - '/styles/theme-testTheme.css': 'http://localhost:9001/styles/empty.css' + '/base/dist/js/maps/': 'http://localhost:9001/js/maps/' }, // Continuous Integration mode