From 2c02f8ba52600eea47a4689abe892b1fc82ab4bb Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 8 Apr 2016 10:25:09 +0200 Subject: [PATCH] 7a944010cac7bad881670238f97941df7e8d682f --- dist/index.html | 12 +-- .../fonts/OpenSans-Bold.ttf | Bin .../fonts/OpenSans-CondLight.eot | Bin .../fonts/OpenSans-CondLight.svg | 0 .../fonts/OpenSans-CondLight.ttf | Bin .../fonts/OpenSans-CondLight.woff | Bin .../fonts/OpenSans-Light.ttf | Bin .../fonts/OpenSans-Regular.ttf | Bin .../fonts/OpenSans-Semibold.ttf | Bin .../fonts/taiga.eot | Bin .../fonts/taiga.svg | 0 .../fonts/taiga.ttf | Bin .../fonts/taiga.woff | Bin .../images/attachment-gallery.png | Bin .../images/backlog-empty.png | Bin .../images/bg.png | Bin .../images/discover.png | Bin .../images/favicon.png | Bin .../images/invitation_bg.jpg | Bin .../images/issues-empty.png | Bin .../images/logo-color.png | Bin .../images/logo.png | Bin .../images/looking-for-people.png | Bin .../images/markitup/bg-container.png | Bin .../images/markitup/bg-editor-bbcode.png | Bin .../images/markitup/bg-editor-dotclear.png | Bin .../images/markitup/bg-editor-html.png | Bin .../images/markitup/bg-editor-json.png | Bin .../images/markitup/bg-editor-markdown.png | Bin .../images/markitup/bg-editor-textile.png | Bin .../images/markitup/bg-editor-wiki.png | Bin .../images/markitup/bg-editor-xml.png | Bin .../images/markitup/bg-editor.png | Bin .../images/markitup/body.png | Bin .../images/markitup/bold.png | Bin .../images/markitup/clean.png | Bin .../images/markitup/code.png | Bin .../images/markitup/h1.png | Bin .../images/markitup/h2.png | Bin .../images/markitup/h3.png | Bin .../images/markitup/h4.png | Bin .../images/markitup/h5.png | Bin .../images/markitup/h6.png | Bin .../images/markitup/handle.png | Bin .../images/markitup/help.png | Bin .../images/markitup/image.png | Bin .../images/markitup/italic.png | Bin .../images/markitup/jaysalvat.png | Bin .../images/markitup/link.png | Bin .../images/markitup/list-bullet.png | Bin .../images/markitup/list-numeric.png | Bin .../images/markitup/markitup.png | Bin .../images/markitup/menu.png | Bin .../images/markitup/picture.png | Bin .../images/markitup/preview.png | Bin .../images/markitup/preview_ico.png | Bin .../images/markitup/quotes.png | Bin .../images/markitup/stroke.png | Bin .../images/markitup/submenu.png | Bin .../images/menu-vert.png | Bin .../images/menu.png | Bin .../images/notification-decoration.png | Bin .../images/project-logos/project-logo-01.png | Bin .../images/project-logos/project-logo-02.png | Bin .../images/project-logos/project-logo-03.png | Bin .../images/project-logos/project-logo-04.png | Bin .../images/project-logos/project-logo-05.png | Bin .../images/quote.png | Bin .../images/search-empty.png | Bin .../images/sprint-empty.png | Bin .../images/unnamed.png | Bin .../images/user-noimage.png | Bin .../js/app-loader.js | 2 +- .../js/app.js | 2 +- .../js/libs.js | 0 .../js/maps/app.js.map | 2 +- .../js/maps/libs.js.map | 0 .../js/templates.js | 78 +++++++++--------- .../locales/taiga/locale-ca.json | 0 .../locales/taiga/locale-de.json | 0 .../locales/taiga/locale-en.json | 0 .../locales/taiga/locale-es.json | 0 .../locales/taiga/locale-fi.json | 0 .../locales/taiga/locale-fr.json | 0 .../locales/taiga/locale-it.json | 0 .../locales/taiga/locale-nl.json | 0 .../locales/taiga/locale-pl.json | 0 .../locales/taiga/locale-pt-br.json | 0 .../locales/taiga/locale-ru.json | 0 .../locales/taiga/locale-sv.json | 0 .../locales/taiga/locale-tr.json | 0 .../locales/taiga/locale-zh-hant.json | 0 .../styles/theme-high-contrast.css | 0 .../styles/theme-material-design.css | 0 .../styles/theme-taiga.css | 0 .../svg/icons/block-user.svg | 0 .../svg/icons/multi-block-project.svg | 0 .../svg/icons/project-limit.svg | 0 .../svg/icons/team-question.svg | 0 .../svg/logo-color.svg | 0 .../svg/logo-moustache.svg | 0 .../svg/logo-nav.svg | 0 .../svg/logo.svg | 0 .../svg/pattern.svg | 0 .../svg/spinner-circle.svg | 0 .../svg/spinner.svg | 0 .../svg/sprite.svg | 0 107 files changed, 48 insertions(+), 48 deletions(-) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-Bold.ttf (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-CondLight.eot (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-CondLight.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-CondLight.ttf (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-CondLight.woff (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-Light.ttf (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-Regular.ttf (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/OpenSans-Semibold.ttf (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/taiga.eot (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/taiga.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/taiga.ttf (100%) rename dist/{v-1459503555751 => v-1460103845046}/fonts/taiga.woff (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/attachment-gallery.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/backlog-empty.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/bg.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/discover.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/favicon.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/invitation_bg.jpg (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/issues-empty.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/logo-color.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/logo.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/looking-for-people.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-container.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-bbcode.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-dotclear.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-html.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-json.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-markdown.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-textile.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-wiki.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor-xml.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bg-editor.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/body.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/bold.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/clean.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/code.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/h1.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/h2.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/h3.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/h4.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/h5.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/h6.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/handle.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/help.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/image.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/italic.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/jaysalvat.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/link.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/list-bullet.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/list-numeric.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/markitup.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/menu.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/picture.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/preview.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/preview_ico.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/quotes.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/stroke.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/markitup/submenu.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/menu-vert.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/menu.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/notification-decoration.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/project-logos/project-logo-01.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/project-logos/project-logo-02.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/project-logos/project-logo-03.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/project-logos/project-logo-04.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/project-logos/project-logo-05.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/quote.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/search-empty.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/sprint-empty.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/unnamed.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/images/user-noimage.png (100%) rename dist/{v-1459503555751 => v-1460103845046}/js/app-loader.js (98%) rename dist/{v-1459503555751 => v-1460103845046}/js/app.js (96%) rename dist/{v-1459503555751 => v-1460103845046}/js/libs.js (100%) rename dist/{v-1459503555751 => v-1460103845046}/js/maps/app.js.map (73%) rename dist/{v-1459503555751 => v-1460103845046}/js/maps/libs.js.map (100%) rename dist/{v-1459503555751 => v-1460103845046}/js/templates.js (97%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-ca.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-de.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-en.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-es.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-fi.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-fr.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-it.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-nl.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-pl.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-pt-br.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-ru.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-sv.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-tr.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/locales/taiga/locale-zh-hant.json (100%) rename dist/{v-1459503555751 => v-1460103845046}/styles/theme-high-contrast.css (100%) rename dist/{v-1459503555751 => v-1460103845046}/styles/theme-material-design.css (100%) rename dist/{v-1459503555751 => v-1460103845046}/styles/theme-taiga.css (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/icons/block-user.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/icons/multi-block-project.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/icons/project-limit.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/icons/team-question.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/logo-color.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/logo-moustache.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/logo-nav.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/logo.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/pattern.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/spinner-circle.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/spinner.svg (100%) rename dist/{v-1459503555751 => v-1460103845046}/svg/sprite.svg (100%) diff --git a/dist/index.html b/dist/index.html index 2e12c86..e1129d6 100644 --- a/dist/index.html +++ b/dist/index.html @@ -9,8 +9,8 @@ - - + + - - + + + iocaine diff --git a/dist/v-1459503555751/fonts/OpenSans-Bold.ttf b/dist/v-1460103845046/fonts/OpenSans-Bold.ttf similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-Bold.ttf rename to dist/v-1460103845046/fonts/OpenSans-Bold.ttf diff --git a/dist/v-1459503555751/fonts/OpenSans-CondLight.eot b/dist/v-1460103845046/fonts/OpenSans-CondLight.eot similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-CondLight.eot rename to dist/v-1460103845046/fonts/OpenSans-CondLight.eot diff --git a/dist/v-1459503555751/fonts/OpenSans-CondLight.svg b/dist/v-1460103845046/fonts/OpenSans-CondLight.svg similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-CondLight.svg rename to dist/v-1460103845046/fonts/OpenSans-CondLight.svg diff --git a/dist/v-1459503555751/fonts/OpenSans-CondLight.ttf b/dist/v-1460103845046/fonts/OpenSans-CondLight.ttf similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-CondLight.ttf rename to dist/v-1460103845046/fonts/OpenSans-CondLight.ttf diff --git a/dist/v-1459503555751/fonts/OpenSans-CondLight.woff b/dist/v-1460103845046/fonts/OpenSans-CondLight.woff similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-CondLight.woff rename to dist/v-1460103845046/fonts/OpenSans-CondLight.woff diff --git a/dist/v-1459503555751/fonts/OpenSans-Light.ttf b/dist/v-1460103845046/fonts/OpenSans-Light.ttf similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-Light.ttf rename to dist/v-1460103845046/fonts/OpenSans-Light.ttf diff --git a/dist/v-1459503555751/fonts/OpenSans-Regular.ttf b/dist/v-1460103845046/fonts/OpenSans-Regular.ttf similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-Regular.ttf rename to dist/v-1460103845046/fonts/OpenSans-Regular.ttf diff --git a/dist/v-1459503555751/fonts/OpenSans-Semibold.ttf b/dist/v-1460103845046/fonts/OpenSans-Semibold.ttf similarity index 100% rename from dist/v-1459503555751/fonts/OpenSans-Semibold.ttf rename to dist/v-1460103845046/fonts/OpenSans-Semibold.ttf diff --git a/dist/v-1459503555751/fonts/taiga.eot b/dist/v-1460103845046/fonts/taiga.eot similarity index 100% rename from dist/v-1459503555751/fonts/taiga.eot rename to dist/v-1460103845046/fonts/taiga.eot diff --git a/dist/v-1459503555751/fonts/taiga.svg b/dist/v-1460103845046/fonts/taiga.svg similarity index 100% rename from dist/v-1459503555751/fonts/taiga.svg rename to dist/v-1460103845046/fonts/taiga.svg diff --git a/dist/v-1459503555751/fonts/taiga.ttf b/dist/v-1460103845046/fonts/taiga.ttf similarity index 100% rename from dist/v-1459503555751/fonts/taiga.ttf rename to dist/v-1460103845046/fonts/taiga.ttf diff --git a/dist/v-1459503555751/fonts/taiga.woff b/dist/v-1460103845046/fonts/taiga.woff similarity index 100% rename from dist/v-1459503555751/fonts/taiga.woff rename to dist/v-1460103845046/fonts/taiga.woff diff --git a/dist/v-1459503555751/images/attachment-gallery.png b/dist/v-1460103845046/images/attachment-gallery.png similarity index 100% rename from dist/v-1459503555751/images/attachment-gallery.png rename to dist/v-1460103845046/images/attachment-gallery.png diff --git a/dist/v-1459503555751/images/backlog-empty.png b/dist/v-1460103845046/images/backlog-empty.png similarity index 100% rename from dist/v-1459503555751/images/backlog-empty.png rename to dist/v-1460103845046/images/backlog-empty.png diff --git a/dist/v-1459503555751/images/bg.png b/dist/v-1460103845046/images/bg.png similarity index 100% rename from dist/v-1459503555751/images/bg.png rename to dist/v-1460103845046/images/bg.png diff --git a/dist/v-1459503555751/images/discover.png b/dist/v-1460103845046/images/discover.png similarity index 100% rename from dist/v-1459503555751/images/discover.png rename to dist/v-1460103845046/images/discover.png diff --git a/dist/v-1459503555751/images/favicon.png b/dist/v-1460103845046/images/favicon.png similarity index 100% rename from dist/v-1459503555751/images/favicon.png rename to dist/v-1460103845046/images/favicon.png diff --git a/dist/v-1459503555751/images/invitation_bg.jpg b/dist/v-1460103845046/images/invitation_bg.jpg similarity index 100% rename from dist/v-1459503555751/images/invitation_bg.jpg rename to dist/v-1460103845046/images/invitation_bg.jpg diff --git a/dist/v-1459503555751/images/issues-empty.png b/dist/v-1460103845046/images/issues-empty.png similarity index 100% rename from dist/v-1459503555751/images/issues-empty.png rename to dist/v-1460103845046/images/issues-empty.png diff --git a/dist/v-1459503555751/images/logo-color.png b/dist/v-1460103845046/images/logo-color.png similarity index 100% rename from dist/v-1459503555751/images/logo-color.png rename to dist/v-1460103845046/images/logo-color.png diff --git a/dist/v-1459503555751/images/logo.png b/dist/v-1460103845046/images/logo.png similarity index 100% rename from dist/v-1459503555751/images/logo.png rename to dist/v-1460103845046/images/logo.png diff --git a/dist/v-1459503555751/images/looking-for-people.png b/dist/v-1460103845046/images/looking-for-people.png similarity index 100% rename from dist/v-1459503555751/images/looking-for-people.png rename to dist/v-1460103845046/images/looking-for-people.png diff --git a/dist/v-1459503555751/images/markitup/bg-container.png b/dist/v-1460103845046/images/markitup/bg-container.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-container.png rename to dist/v-1460103845046/images/markitup/bg-container.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-bbcode.png b/dist/v-1460103845046/images/markitup/bg-editor-bbcode.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-bbcode.png rename to dist/v-1460103845046/images/markitup/bg-editor-bbcode.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-dotclear.png b/dist/v-1460103845046/images/markitup/bg-editor-dotclear.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-dotclear.png rename to dist/v-1460103845046/images/markitup/bg-editor-dotclear.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-html.png b/dist/v-1460103845046/images/markitup/bg-editor-html.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-html.png rename to dist/v-1460103845046/images/markitup/bg-editor-html.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-json.png b/dist/v-1460103845046/images/markitup/bg-editor-json.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-json.png rename to dist/v-1460103845046/images/markitup/bg-editor-json.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-markdown.png b/dist/v-1460103845046/images/markitup/bg-editor-markdown.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-markdown.png rename to dist/v-1460103845046/images/markitup/bg-editor-markdown.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-textile.png b/dist/v-1460103845046/images/markitup/bg-editor-textile.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-textile.png rename to dist/v-1460103845046/images/markitup/bg-editor-textile.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-wiki.png b/dist/v-1460103845046/images/markitup/bg-editor-wiki.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-wiki.png rename to dist/v-1460103845046/images/markitup/bg-editor-wiki.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor-xml.png b/dist/v-1460103845046/images/markitup/bg-editor-xml.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor-xml.png rename to dist/v-1460103845046/images/markitup/bg-editor-xml.png diff --git a/dist/v-1459503555751/images/markitup/bg-editor.png b/dist/v-1460103845046/images/markitup/bg-editor.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bg-editor.png rename to dist/v-1460103845046/images/markitup/bg-editor.png diff --git a/dist/v-1459503555751/images/markitup/body.png b/dist/v-1460103845046/images/markitup/body.png similarity index 100% rename from dist/v-1459503555751/images/markitup/body.png rename to dist/v-1460103845046/images/markitup/body.png diff --git a/dist/v-1459503555751/images/markitup/bold.png b/dist/v-1460103845046/images/markitup/bold.png similarity index 100% rename from dist/v-1459503555751/images/markitup/bold.png rename to dist/v-1460103845046/images/markitup/bold.png diff --git a/dist/v-1459503555751/images/markitup/clean.png b/dist/v-1460103845046/images/markitup/clean.png similarity index 100% rename from dist/v-1459503555751/images/markitup/clean.png rename to dist/v-1460103845046/images/markitup/clean.png diff --git a/dist/v-1459503555751/images/markitup/code.png b/dist/v-1460103845046/images/markitup/code.png similarity index 100% rename from dist/v-1459503555751/images/markitup/code.png rename to dist/v-1460103845046/images/markitup/code.png diff --git a/dist/v-1459503555751/images/markitup/h1.png b/dist/v-1460103845046/images/markitup/h1.png similarity index 100% rename from dist/v-1459503555751/images/markitup/h1.png rename to dist/v-1460103845046/images/markitup/h1.png diff --git a/dist/v-1459503555751/images/markitup/h2.png b/dist/v-1460103845046/images/markitup/h2.png similarity index 100% rename from dist/v-1459503555751/images/markitup/h2.png rename to dist/v-1460103845046/images/markitup/h2.png diff --git a/dist/v-1459503555751/images/markitup/h3.png b/dist/v-1460103845046/images/markitup/h3.png similarity index 100% rename from dist/v-1459503555751/images/markitup/h3.png rename to dist/v-1460103845046/images/markitup/h3.png diff --git a/dist/v-1459503555751/images/markitup/h4.png b/dist/v-1460103845046/images/markitup/h4.png similarity index 100% rename from dist/v-1459503555751/images/markitup/h4.png rename to dist/v-1460103845046/images/markitup/h4.png diff --git a/dist/v-1459503555751/images/markitup/h5.png b/dist/v-1460103845046/images/markitup/h5.png similarity index 100% rename from dist/v-1459503555751/images/markitup/h5.png rename to dist/v-1460103845046/images/markitup/h5.png diff --git a/dist/v-1459503555751/images/markitup/h6.png b/dist/v-1460103845046/images/markitup/h6.png similarity index 100% rename from dist/v-1459503555751/images/markitup/h6.png rename to dist/v-1460103845046/images/markitup/h6.png diff --git a/dist/v-1459503555751/images/markitup/handle.png b/dist/v-1460103845046/images/markitup/handle.png similarity index 100% rename from dist/v-1459503555751/images/markitup/handle.png rename to dist/v-1460103845046/images/markitup/handle.png diff --git a/dist/v-1459503555751/images/markitup/help.png b/dist/v-1460103845046/images/markitup/help.png similarity index 100% rename from dist/v-1459503555751/images/markitup/help.png rename to dist/v-1460103845046/images/markitup/help.png diff --git a/dist/v-1459503555751/images/markitup/image.png b/dist/v-1460103845046/images/markitup/image.png similarity index 100% rename from dist/v-1459503555751/images/markitup/image.png rename to dist/v-1460103845046/images/markitup/image.png diff --git a/dist/v-1459503555751/images/markitup/italic.png b/dist/v-1460103845046/images/markitup/italic.png similarity index 100% rename from dist/v-1459503555751/images/markitup/italic.png rename to dist/v-1460103845046/images/markitup/italic.png diff --git a/dist/v-1459503555751/images/markitup/jaysalvat.png b/dist/v-1460103845046/images/markitup/jaysalvat.png similarity index 100% rename from dist/v-1459503555751/images/markitup/jaysalvat.png rename to dist/v-1460103845046/images/markitup/jaysalvat.png diff --git a/dist/v-1459503555751/images/markitup/link.png b/dist/v-1460103845046/images/markitup/link.png similarity index 100% rename from dist/v-1459503555751/images/markitup/link.png rename to dist/v-1460103845046/images/markitup/link.png diff --git a/dist/v-1459503555751/images/markitup/list-bullet.png b/dist/v-1460103845046/images/markitup/list-bullet.png similarity index 100% rename from dist/v-1459503555751/images/markitup/list-bullet.png rename to dist/v-1460103845046/images/markitup/list-bullet.png diff --git a/dist/v-1459503555751/images/markitup/list-numeric.png b/dist/v-1460103845046/images/markitup/list-numeric.png similarity index 100% rename from dist/v-1459503555751/images/markitup/list-numeric.png rename to dist/v-1460103845046/images/markitup/list-numeric.png diff --git a/dist/v-1459503555751/images/markitup/markitup.png b/dist/v-1460103845046/images/markitup/markitup.png similarity index 100% rename from dist/v-1459503555751/images/markitup/markitup.png rename to dist/v-1460103845046/images/markitup/markitup.png diff --git a/dist/v-1459503555751/images/markitup/menu.png b/dist/v-1460103845046/images/markitup/menu.png similarity index 100% rename from dist/v-1459503555751/images/markitup/menu.png rename to dist/v-1460103845046/images/markitup/menu.png diff --git a/dist/v-1459503555751/images/markitup/picture.png b/dist/v-1460103845046/images/markitup/picture.png similarity index 100% rename from dist/v-1459503555751/images/markitup/picture.png rename to dist/v-1460103845046/images/markitup/picture.png diff --git a/dist/v-1459503555751/images/markitup/preview.png b/dist/v-1460103845046/images/markitup/preview.png similarity index 100% rename from dist/v-1459503555751/images/markitup/preview.png rename to dist/v-1460103845046/images/markitup/preview.png diff --git a/dist/v-1459503555751/images/markitup/preview_ico.png b/dist/v-1460103845046/images/markitup/preview_ico.png similarity index 100% rename from dist/v-1459503555751/images/markitup/preview_ico.png rename to dist/v-1460103845046/images/markitup/preview_ico.png diff --git a/dist/v-1459503555751/images/markitup/quotes.png b/dist/v-1460103845046/images/markitup/quotes.png similarity index 100% rename from dist/v-1459503555751/images/markitup/quotes.png rename to dist/v-1460103845046/images/markitup/quotes.png diff --git a/dist/v-1459503555751/images/markitup/stroke.png b/dist/v-1460103845046/images/markitup/stroke.png similarity index 100% rename from dist/v-1459503555751/images/markitup/stroke.png rename to dist/v-1460103845046/images/markitup/stroke.png diff --git a/dist/v-1459503555751/images/markitup/submenu.png b/dist/v-1460103845046/images/markitup/submenu.png similarity index 100% rename from dist/v-1459503555751/images/markitup/submenu.png rename to dist/v-1460103845046/images/markitup/submenu.png diff --git a/dist/v-1459503555751/images/menu-vert.png b/dist/v-1460103845046/images/menu-vert.png similarity index 100% rename from dist/v-1459503555751/images/menu-vert.png rename to dist/v-1460103845046/images/menu-vert.png diff --git a/dist/v-1459503555751/images/menu.png b/dist/v-1460103845046/images/menu.png similarity index 100% rename from dist/v-1459503555751/images/menu.png rename to dist/v-1460103845046/images/menu.png diff --git a/dist/v-1459503555751/images/notification-decoration.png b/dist/v-1460103845046/images/notification-decoration.png similarity index 100% rename from dist/v-1459503555751/images/notification-decoration.png rename to dist/v-1460103845046/images/notification-decoration.png diff --git a/dist/v-1459503555751/images/project-logos/project-logo-01.png b/dist/v-1460103845046/images/project-logos/project-logo-01.png similarity index 100% rename from dist/v-1459503555751/images/project-logos/project-logo-01.png rename to dist/v-1460103845046/images/project-logos/project-logo-01.png diff --git a/dist/v-1459503555751/images/project-logos/project-logo-02.png b/dist/v-1460103845046/images/project-logos/project-logo-02.png similarity index 100% rename from dist/v-1459503555751/images/project-logos/project-logo-02.png rename to dist/v-1460103845046/images/project-logos/project-logo-02.png diff --git a/dist/v-1459503555751/images/project-logos/project-logo-03.png b/dist/v-1460103845046/images/project-logos/project-logo-03.png similarity index 100% rename from dist/v-1459503555751/images/project-logos/project-logo-03.png rename to dist/v-1460103845046/images/project-logos/project-logo-03.png diff --git a/dist/v-1459503555751/images/project-logos/project-logo-04.png b/dist/v-1460103845046/images/project-logos/project-logo-04.png similarity index 100% rename from dist/v-1459503555751/images/project-logos/project-logo-04.png rename to dist/v-1460103845046/images/project-logos/project-logo-04.png diff --git a/dist/v-1459503555751/images/project-logos/project-logo-05.png b/dist/v-1460103845046/images/project-logos/project-logo-05.png similarity index 100% rename from dist/v-1459503555751/images/project-logos/project-logo-05.png rename to dist/v-1460103845046/images/project-logos/project-logo-05.png diff --git a/dist/v-1459503555751/images/quote.png b/dist/v-1460103845046/images/quote.png similarity index 100% rename from dist/v-1459503555751/images/quote.png rename to dist/v-1460103845046/images/quote.png diff --git a/dist/v-1459503555751/images/search-empty.png b/dist/v-1460103845046/images/search-empty.png similarity index 100% rename from dist/v-1459503555751/images/search-empty.png rename to dist/v-1460103845046/images/search-empty.png diff --git a/dist/v-1459503555751/images/sprint-empty.png b/dist/v-1460103845046/images/sprint-empty.png similarity index 100% rename from dist/v-1459503555751/images/sprint-empty.png rename to dist/v-1460103845046/images/sprint-empty.png diff --git a/dist/v-1459503555751/images/unnamed.png b/dist/v-1460103845046/images/unnamed.png similarity index 100% rename from dist/v-1459503555751/images/unnamed.png rename to dist/v-1460103845046/images/unnamed.png diff --git a/dist/v-1459503555751/images/user-noimage.png b/dist/v-1460103845046/images/user-noimage.png similarity index 100% rename from dist/v-1459503555751/images/user-noimage.png rename to dist/v-1460103845046/images/user-noimage.png diff --git a/dist/v-1459503555751/js/app-loader.js b/dist/v-1460103845046/js/app-loader.js similarity index 98% rename from dist/v-1459503555751/js/app-loader.js rename to dist/v-1460103845046/js/app-loader.js index 5c19b4a..b05f716 100644 --- a/dist/v-1459503555751/js/app-loader.js +++ b/dist/v-1460103845046/js/app-loader.js @@ -1,7 +1,7 @@ (function() { var loadPlugin, loadPlugins, loadStylesheet, promise; - window._version = "v-1459503555751"; + window._version = "v-1460103845046"; window.taigaConfig = { "api": "http://localhost:8000/api/v1/", diff --git a/dist/v-1459503555751/js/app.js b/dist/v-1460103845046/js/app.js similarity index 96% rename from dist/v-1459503555751/js/app.js rename to dist/v-1460103845046/js/app.js index cb19686..98fb561 100644 --- a/dist/v-1459503555751/js/app.js +++ b/dist/v-1460103845046/js/app.js @@ -10,7 +10,7 @@ this.scope.oldSelectedStatuses=selectedStatuses,this.scope.filtersQOld=this.scop var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs1,this.params=params1,this.q=q,this.location=location,this.appMetaService=appMetaService,this.navUrls=navUrls,this.events=events,this.analytics=analytics,this.translate=translate,bindMethods(this),this.scope.sectionName=this.translate.instant("KANBAN.SECTION_NAME"),this.scope.statusViewModes={},this.initializeEventHandlers(),promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("KANBAN.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.translate.instant("KANBAN.PAGE_DESCRIPTION",{projectName:_this.scope.project.name,projectDescription:_this.scope.project.description}),_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(KanbanController,superClass),KanbanController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","tgAppMetaService","$tgNavUrls","$tgEvents","$tgAnalytics","$translate"],KanbanController.prototype.initializeEventHandlers=function(){return this.scope.$on("usform:new:success",function(_this){return function(){return _this.loadUserstories(),_this.refreshTagsColors(),_this.analytics.trackEvent("userstory","create","create userstory on kanban",1)}}(this)),this.scope.$on("usform:bulk:success",function(_this){return function(){return _this.loadUserstories(),_this.analytics.trackEvent("userstory","create","bulk create userstory on kanban",1)}}(this)),this.scope.$on("usform:edit:success",function(_this){return function(){return _this.loadUserstories(),_this.refreshTagsColors()}}(this)),this.scope.$on("assigned-to:added",this.onAssignedToChanged),this.scope.$on("kanban:us:move",this.moveUs),this.scope.$on("kanban:show-userstories-for-status",this.loadUserStoriesForStatus),this.scope.$on("kanban:hide-userstories-for-status",this.hideUserStoriesForStatus)},KanbanController.prototype.addNewUs=function(type,statusId){switch(type){case"standard":return this.rootscope.$broadcast("usform:new",this.scope.projectId,statusId,this.scope.usStatusList);case"bulk":return this.rootscope.$broadcast("usform:bulk",this.scope.projectId,statusId)}},KanbanController.prototype.changeUsAssignedTo=function(us){return this.rootscope.$broadcast("assigned-to:add",us)},KanbanController.prototype.onAssignedToChanged=function(ctx,userid,us){var promise;return us.assigned_to=userid,promise=this.repo.save(us),promise.then(null,function(){return console.log("FAIL")})},KanbanController.prototype.refreshTagsColors=function(){return this.rs.projects.tagsColors(this.scope.projectId).then(function(_this){return function(tags_colors){return _this.scope.project.tags_colors=tags_colors}}(this))},KanbanController.prototype.loadUserstories=function(){var params,promise;return params={status__is_archived:!1},promise=this.rs.userstories.listAll(this.scope.projectId,params).then(function(_this){return function(userstories){var i,j,k,len,len1,len2,ref,ref1,ref2,status,us,usByStatus,us_archived;for(_this.scope.userstories=userstories,usByStatus=_.groupBy(userstories,"status"),us_archived=[],ref=_this.scope.usStatusList,i=0,len=ref.length;len>i;i++){if(status=ref[i],null==usByStatus[status.id]&&(usByStatus[status.id]=[]),null!=_this.scope.usByStatus)for(ref1=_this.scope.usByStatus[status.id],j=0,len1=ref1.length;len1>j;j++)us=ref1[j],us.status!==status.id&&us_archived.push(us);if(status.is_archived&&null!=_this.scope.usByStatus&&0!==_this.scope.usByStatus[status.id].length)for(ref2=_this.scope.usByStatus[status.id].concat(us_archived),k=0,len2=ref2.length;len2>k;k++)us=ref2[k],us.status===status.id&&usByStatus[status.id].push(us);usByStatus[status.id]=_.sortBy(usByStatus[status.id],"kanban_order")}return 0===userstories.length&&(status=_this.scope.usStatusList[0],usByStatus[status.id].push({isPlaceholder:!0})),_this.scope.usByStatus=usByStatus,scopeDefer(_this.scope,function(){return _this.scope.$broadcast("userstories:loaded",userstories)}),userstories}}(this)),promise.then(function(_this){return function(){return _this.scope.$broadcast("redraw:wip")}}(this)),promise},KanbanController.prototype.loadUserStoriesForStatus=function(ctx,statusId){var params;return params={status:statusId},this.rs.userstories.listAll(this.scope.projectId,params).then(function(_this){return function(userstories){return _this.scope.usByStatus[statusId]=_.sortBy(userstories,"kanban_order"),_this.scope.$broadcast("kanban:shown-userstories-for-status",statusId,userstories),userstories}}(this))},KanbanController.prototype.hideUserStoriesForStatus=function(ctx,statusId){return this.scope.usByStatus[statusId]=[],this.scope.$broadcast("kanban:hidden-userstories-for-status",statusId)},KanbanController.prototype.loadKanban=function(){return this.q.all([this.refreshTagsColors(),this.loadUserstories()])},KanbanController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.is_kanban_activated||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.projectId=project.id,_this.scope.points=_.sortBy(project.points,"order"),_this.scope.pointsById=groupBy(project.points,function(x){return x.id}),_this.scope.usStatusById=groupBy(project.us_statuses,function(x){return x.id}),_this.scope.usStatusList=_.sortBy(project.us_statuses,"order"),_this.generateStatusViewModes(),_this.scope.$emit("project:loaded",project),project}}(this))},KanbanController.prototype.initializeSubscription=function(){var routingKey1;return routingKey1="changes.project."+this.scope.projectId+".userstories",this.events.subscribe(this.scope,routingKey1,function(_this){return function(message){return _this.loadUserstories()}}(this))},KanbanController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.members,project.roles),_this.initializeSubscription(),_this.loadKanban()}}(this))},KanbanController.prototype.generateStatusViewModes=function(){var i,len,mode,ref,status,storedStatusViewModes;for(storedStatusViewModes=this.rs.kanban.getStatusViewModes(this.scope.projectId),this.scope.statusViewModes={},ref=this.scope.usStatusList,i=0,len=ref.length;len>i;i++)status=ref[i],mode=storedStatusViewModes[status.id]||defaultViewMode,this.scope.statusViewModes[status.id]=mode;return this.storeStatusViewModes()},KanbanController.prototype.storeStatusViewModes=function(){return this.rs.kanban.storeStatusViewModes(this.scope.projectId,this.scope.statusViewModes)},KanbanController.prototype.updateStatusViewMode=function(statusId,newViewMode){return this.scope.statusViewModes[statusId]=newViewMode,this.storeStatusViewModes()},KanbanController.prototype.isMaximized=function(statusId){var mode;return mode=this.scope.statusViewModes[statusId]||defaultViewMode,"maximized"===mode},KanbanController.prototype.isMinimized=function(statusId){var mode;return mode=this.scope.statusViewModes[statusId]||defaultViewMode,"minimized"===mode},KanbanController.prototype.prepareBulkUpdateData=function(uses,field){return null==field&&(field="kanban_order"),_.map(uses,function(x){return{us_id:x.id,order:x[field]}})},KanbanController.prototype.resortUserStories=function(uses){var i,index,item,items,len;for(items=[],index=i=0,len=uses.length;len>i;index=++i)item=uses[index],item.kanban_order=index,item.isModified()&&items.push(item);return items},KanbanController.prototype.moveUs=function(ctx,us,oldStatusId,newStatusId,index){var itemsToSave,promise,r;return oldStatusId!==newStatusId?(r=this.scope.usByStatus[oldStatusId].indexOf(us),this.scope.usByStatus[oldStatusId].splice(r,1),this.scope.usByStatus[newStatusId].splice(index,0,us),us.status=newStatusId):(r=this.scope.usByStatus[newStatusId].indexOf(us),this.scope.usByStatus[newStatusId].splice(r,1),this.scope.usByStatus[newStatusId].splice(index,0,us)),itemsToSave=this.resortUserStories(this.scope.usByStatus[newStatusId]),this.scope.usByStatus[newStatusId]=_.sortBy(this.scope.usByStatus[newStatusId],"kanban_order"),promise=this.repo.save(us),promise=promise.then(function(_this){return function(){var data;return itemsToSave=_.reject(itemsToSave,{id:us.id}),data=_this.prepareBulkUpdateData(itemsToSave),_this.rs.userstories.bulkUpdateKanbanOrder(us.project,data).then(function(){return itemsToSave})}}(this))},KanbanController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("KanbanController",KanbanController),KanbanDirective=function($repo,$rootscope){var link;return link=function($scope,$el,$attrs){var tableBodyDom;return tableBodyDom=$el.find(".kanban-table-body"),tableBodyDom.on("scroll",function(event){var tableHeaderDom,target;return target=angular.element(event.currentTarget),tableHeaderDom=$el.find(".kanban-table-header .kanban-table-inner"),tableHeaderDom.css("left",-1*target.scrollLeft())}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgKanban",["$tgRepo","$rootScope",KanbanDirective]),KanbanArchivedStatusHeaderDirective=function($rootscope,$translate){var hideArchivedText,link,showArchivedText;return showArchivedText=$translate.instant("KANBAN.ACTION_SHOW_ARCHIVED"),hideArchivedText=$translate.instant("KANBAN.ACTION_HIDE_ARCHIVED"),link=function($scope,$el,$attrs){var hidden,status;return status=$scope.$eval($attrs.tgKanbanArchivedStatusHeader),hidden=!0,$scope["class"]="icon-open-eye",$scope.title=showArchivedText,$el.on("click",function(event){return hidden=!hidden,$scope.$apply(function(){return hidden?($scope["class"]="icon-open-eye",$scope.title=showArchivedText,$rootscope.$broadcast("kanban:hide-userstories-for-status",status.id)):($scope["class"]="icon-closed-eye",$scope.title=hideArchivedText,$rootscope.$broadcast("kanban:show-userstories-for-status",status.id))})}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgKanbanArchivedStatusHeader",["$rootScope","$translate",KanbanArchivedStatusHeaderDirective]),KanbanArchivedStatusIntroDirective=function($translate){var link,userStories;return userStories=[],link=function($scope,$el,$attrs){var hiddenUserStoriexText,status,updateIntroText;return hiddenUserStoriexText=$translate.instant("KANBAN.HIDDEN_USER_STORIES"),status=$scope.$eval($attrs.tgKanbanArchivedStatusIntro),$el.text(hiddenUserStoriexText),updateIntroText=function(){return userStories.length>0?$el.text(""):$el.text(hiddenUserStoriexText)},$scope.$on("kanban:us:move",function(ctx,itemUs,oldStatusId,newStatusId,itemIndex){var r;return status.id===newStatusId?status.id===oldStatusId?(r=userStories.indexOf(itemUs),userStories.splice(r,1),userStories.splice(itemIndex,0,itemUs)):(itemUs.isArchived=!0,userStories.splice(itemIndex,0,itemUs)):status.id===oldStatusId&&(itemUs.isArchived=!1,r=userStories.indexOf(itemUs),userStories.splice(r,1)),updateIntroText()}),$scope.$on("kanban:shown-userstories-for-status",function(ctx,statusId,userStoriesLoaded){return statusId===status.id?(userStories=_.filter(userStoriesLoaded,function(us){return us.status===status.id}),updateIntroText()):void 0}),$scope.$on("kanban:hidden-userstories-for-status",function(ctx,statusId){return statusId===status.id?(userStories=[],updateIntroText()):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgKanbanArchivedStatusIntro",["$translate",KanbanArchivedStatusIntroDirective]),KanbanUserstoryDirective=function($rootscope,$loading,$rs,$rs2){var link;return link=function($scope,$el,$attrs,$model){return $el.disableSelection(),$scope.$watch("us",function(us){return us.is_blocked&&!$el.hasClass("blocked")?$el.addClass("blocked"):!us.is_blocked&&$el.hasClass("blocked")?$el.removeClass("blocked"):void 0}),$el.on("click",".icon-edit",function(event){var currentLoading,target,us;if(!$el.find(".icon-edit").hasClass("noclick"))return target=$(event.target),currentLoading=$loading().target(target).timeout(200).removeClasses("icon-edit").start(),us=$model.$modelValue,$rs.userstories.getByRef(us.project,us.ref).then(function(_this){return function(editingUserStory){return $rs2.attachments.list("us",us.id,us.project).then(function(attachments){return $rootscope.$broadcast("usform:edit",editingUserStory,attachments.toJS()),currentLoading.finish()})}}(this))}),$scope.getTemplateUrl=function(){return $scope.us.isPlaceholder?"common/components/kanban-placeholder.html":"kanban/kanban-task.html"},$scope.$on("$destroy",function(){return $el.off()})},{template:'',link:link,require:"ngModel"}},module.directive("tgKanbanUserstory",["$rootScope","$tgLoading","$tgResources","tgResources",KanbanUserstoryDirective]),KanbanSquishColumnDirective=function(rs){var link;return link=function($scope,$el,$attrs){var updateTableWidth;return $scope.$on("project:loaded",function(event,project){return $scope.folds=rs.kanban.getStatusColumnModes(project.id),updateTableWidth()}),$scope.foldStatus=function(status){$scope.folds[status.id]=!$scope.folds[status.id],rs.kanban.storeStatusColumnModes($scope.projectId,$scope.folds),updateTableWidth()},updateTableWidth=function(){var columnWidths,totalWidth;return columnWidths=_.map($scope.usStatusList,function(status){return $scope.folds[status.id]?40:310}),totalWidth=_.reduce(columnWidths,function(total,width){return total+width}),$el.find(".kanban-table-inner").css("width",totalWidth)}},{link:link}},module.directive("tgKanbanSquishColumn",["$tgResources",KanbanSquishColumnDirective]),KanbanWipLimitDirective=function(){var link;return link=function($scope,$el,$attrs){var redrawWipLimit,status;return $el.disableSelection(),status=$scope.$eval($attrs.tgKanbanWipLimit),redrawWipLimit=function(_this){return function(){return $el.find(".kanban-wip-limit").remove(),timeout(200,function(){var element;return element=$el.find(".kanban-task")[status.wip_limit],element?angular.element(element).before("
"):void 0})}}(this),status&&!status.is_archived&&($scope.$on("redraw:wip",redrawWipLimit),$scope.$on("kanban:us:move",redrawWipLimit),$scope.$on("usform:new:success",redrawWipLimit),$scope.$on("usform:bulk:success",redrawWipLimit)),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgKanbanWipLimit",KanbanWipLimitDirective),KanbanUserDirective=function($log,$compile,$translate){var clickable,link,template;return template=_.template('
\n class="not-clickable"<% } %>>\n <%- name %>\n \n
'),clickable=!1,link=function($scope,$el,$attrs,$model){var render,username_label,wtid;return username_label=$el.parent().find("a.task-assigned"),username_label.addClass("not-clickable"),$attrs.tgKanbanUserAvatar?(wtid=$scope.$watch($attrs.tgKanbanUserAvatar,function(v){var user;return null==$scope.usersById?($log.error("KanbanUserDirective requires userById set in scope."),wtid()):(user=$scope.usersById[v],render(user))}),render=function(user){var ctx,html;return ctx=void 0===user?{name:$translate.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png",clickable:clickable}:{name:user.full_name_display,imgurl:user.photo,clickable:clickable},html=$compile(template(ctx))($scope),$el.html(html),username_label.text(ctx.name)},bindOnce($scope,"project",function(project){return project.my_permissions.indexOf("modify_us")>-1?(clickable=!0,$el.on("click",function(_this){return function(event){var $ctrl,us;if(!$el.find("a").hasClass("noclick"))return us=$model.$modelValue,$ctrl=$el.controller(),$ctrl.changeUsAssignedTo(us)}}(this)),username_label.removeClass("not-clickable"),username_label.on("click",function(event){var $ctrl,us;if(!$el.find("a").hasClass("noclick"))return us=$model.$modelValue,$ctrl=$el.controller(),$ctrl.changeUsAssignedTo(us)})):void 0}),$scope.$on("$destroy",function(){return $el.off()})):$log.error("KanbanUserDirective: no attr is defined")},{link:link,require:"ngModel"}},module.directive("tgKanbanUserAvatar",["$log","$compile","$translate",KanbanUserDirective])}.call(this),function(){var KanbanSortableDirective,bindOnce,groupBy,mixOf,module,scopeDefer,taiga,timeout,toggleText;taiga=this.taiga,mixOf=this.taiga.mixOf,toggleText=this.taiga.toggleText,scopeDefer=this.taiga.scopeDefer,bindOnce=this.taiga.bindOnce,groupBy=this.taiga.groupBy,timeout=this.taiga.timeout,module=angular.module("taigaKanban"),KanbanSortableDirective=function($repo,$rs,$rootscope){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,"project",function(project){var deleteElement,itemEl,newParentScope,oldParentScope,tdom;if(project.my_permissions.indexOf("modify_us")>-1)return oldParentScope=null,newParentScope=null,itemEl=null,tdom=$el,deleteElement=function(itemEl){return itemEl.scope().$destroy(),itemEl.off(),itemEl.remove()},tdom.sortable({handle:".kanban-task-inner",dropOnEmpty:!0,connectWith:".kanban-uses-box",revert:400}),tdom.on("sortstop",function(event,ui){var itemIndex,itemUs,newStatusId,oldStatusId,parentEl;return parentEl=ui.item.parent(),itemEl=ui.item,itemUs=itemEl.scope().us,itemIndex=itemEl.index(),newParentScope=parentEl.scope(),newStatusId=newParentScope.s.id,oldStatusId=oldParentScope.s.id,newStatusId!==oldStatusId&&deleteElement(itemEl),$scope.$apply(function(){return $rootscope.$broadcast("kanban:us:move",itemUs,itemUs.status,newStatusId,itemIndex)}),ui.item.find("a").removeClass("noclick")}),tdom.on("sortstart",function(event,ui){return oldParentScope=ui.item.parent().scope(),ui.item.find("a").addClass("noclick")})}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgKanbanSortable",["$tgRepo","$tgResources","$rootScope",KanbanSortableDirective])}.call(this),function(){var IssueDetailController,IssuePriorityButtonDirective,IssueSeverityButtonDirective,IssueStatusButtonDirective,IssueStatusDisplayDirective,IssueTypeButtonDirective,PromoteIssueToUsButtonDirective,bindMethods,bindOnce,groupBy,joinStr,mixOf,module,taiga,toString,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,toString=this.taiga.toString,joinStr=this.taiga.joinStr,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,bindMethods=this.taiga.bindMethods,module=angular.module("taigaIssues"),IssueDetailController=function(superClass){function IssueDetailController(scope,rootscope,repo,confirm,rs,params,q,location,log,appMetaService,analytics,navUrls,translate){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.log=log,this.appMetaService=appMetaService,this.analytics=analytics,this.navUrls=navUrls,this.translate=translate,bindMethods(this),this.scope.issueRef=this.params.issueref,this.scope.sectionName=this.translate.instant("ISSUES.SECTION_NAME"),this.initializeEventHandlers(),promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this._setMeta(),_this.initializeOnDeleteGoToUrl()}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(IssueDetailController,superClass),IssueDetailController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate"],IssueDetailController.prototype._setMeta=function(){var description,ref,ref1,ref2,ref3,title;return title=this.translate.instant("ISSUE.PAGE_TITLE",{issueRef:"#"+this.scope.issue.ref,issueSubject:this.scope.issue.subject,projectName:this.scope.project.name}),description=this.translate.instant("ISSUE.PAGE_DESCRIPTION",{issueStatus:(null!=(ref=this.scope.statusById[this.scope.issue.status])?ref.name:void 0)||"--",issueType:(null!=(ref1=this.scope.typeById[this.scope.issue.type])?ref1.name:void 0)||"--",issueSeverity:(null!=(ref2=this.scope.severityById[this.scope.issue.severity])?ref2.name:void 0)||"--",issuePriority:(null!=(ref3=this.scope.priorityById[this.scope.issue.priority])?ref3.name:void 0)||"--",issueDescription:angular.element(this.scope.issue.description_html||"").text()}),this.appMetaService.setAll(title,description)},IssueDetailController.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(_this){return function(){return _this.analytics.trackEvent("attachment","create","create attachment on issue",1)}}(this)),this.scope.$on("promote-issue-to-us:success",function(_this){return function(){return _this.analytics.trackEvent("issue","promoteToUserstory","promote issue to userstory",1),_this.rootscope.$broadcast("object:updated"),_this.loadIssue()}}(this)),this.scope.$on("comment:new",function(_this){return function(){return _this.loadIssue()}}(this)),this.scope.$on("custom-attributes-values:edit",function(_this){return function(){return _this.rootscope.$broadcast("object:updated")}}(this))},IssueDetailController.prototype.initializeOnDeleteGoToUrl=function(){var ctx;return ctx={project:this.scope.project.slug},this.scope.project.is_issues_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-issues",ctx):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",ctx)},IssueDetailController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.statusList=project.issue_statuses,_this.scope.statusById=groupBy(project.issue_statuses,function(x){return x.id}),_this.scope.typeById=groupBy(project.issue_types,function(x){return x.id}),_this.scope.typeList=_.sortBy(project.issue_types,"order"),_this.scope.severityList=project.severities,_this.scope.severityById=groupBy(project.severities,function(x){return x.id}),_this.scope.priorityList=project.priorities,_this.scope.priorityById=groupBy(project.priorities,function(x){return x.id}),project}}(this))},IssueDetailController.prototype.loadIssue=function(){return this.rs.issues.getByRef(this.scope.projectId,this.params.issueref).then(function(_this){return function(issue){var ctx,ref,ref1;return _this.scope.issue=issue,_this.scope.issueId=issue.id,_this.scope.commentModel=issue,null!=(null!=(ref=_this.scope.issue.neighbors.previous)?ref.ref:void 0)&&(ctx={project:_this.scope.project.slug,ref:_this.scope.issue.neighbors.previous.ref},_this.scope.previousUrl=_this.navUrls.resolve("project-issues-detail",ctx)),null!=(null!=(ref1=_this.scope.issue.neighbors.next)?ref1.ref:void 0)?(ctx={project:_this.scope.project.slug,ref:_this.scope.issue.neighbors.next.ref},_this.scope.nextUrl=_this.navUrls.resolve("project-issues-detail",ctx)):void 0}}(this))},IssueDetailController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.members,project.roles),_this.loadIssue()}}(this))},IssueDetailController.prototype.onUpvote=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadIssue(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.issues.upvote(this.scope.issueId).then(onSuccess,onError)},IssueDetailController.prototype.onDownvote=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadIssue(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.issues.downvote(this.scope.issueId).then(onSuccess,onError)},IssueDetailController.prototype.onWatch=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadIssue(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.issues.watch(this.scope.issueId).then(onSuccess,onError)},IssueDetailController.prototype.onUnwatch=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadIssue(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.issues.unwatch(this.scope.issueId).then(onSuccess,onError)},IssueDetailController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("IssueDetailController",IssueDetailController),IssueStatusDisplayDirective=function($template,$compile){var link,template;return template=$template.get("common/components/status-display.html",!0),link=function($scope,$el,$attrs){var render;return render=function(issue){var html,status;return status=$scope.statusById[issue.status],html=template({is_closed:status.is_closed,status:status}),html=$compile(html)($scope),$el.html(html)},$scope.$watch($attrs.ngModel,function(issue){return null!=issue?render(issue):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgIssueStatusDisplay",["$tgTemplate","$compile",IssueStatusDisplayDirective]),IssueStatusButtonDirective=function($rootScope,$repo,$confirm,$loading,$qqueue,$template,$compile){var link,template;return template=$template.get("issue/issues-status-button.html",!0),link=function($scope,$el,$attrs,$model){var isEditable,render,save;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_issue")},render=function(_this){return function(issue){var html,status;return status=$scope.statusById[issue.status],html=template({status:status,statuses:$scope.statusList,editable:isEditable()}),html=$compile(html)($scope),$el.html(html)}}(this),save=$qqueue.bindAdd(function(_this){return function(statusId){var currentLoading,issue,onError,onSuccess;return $.fn.popover().closeAll(),issue=$model.$modelValue.clone(),issue.status=statusId,currentLoading=$loading().target($el).start(),onSuccess=function(){return $model.$setViewValue(issue),$rootScope.$broadcast("object:updated"),currentLoading.finish()},onError=function(){return $confirm.notify("error"),issue.revert(),$model.$setViewValue(issue),currentLoading.finish()},$repo.save(issue).then(onSuccess,onError)}}(this)),$el.on("click",".js-edit-status",function(event){return event.preventDefault(),event.stopPropagation(),isEditable()?$el.find(".pop-status").popover().open():void 0}),$el.on("click",".status",function(event){var target;return event.preventDefault(),event.stopPropagation(),isEditable()?(target=angular.element(event.currentTarget),save(target.data("status-id"))):void 0}),$scope.$watch($attrs.ngModel,function(issue){return issue?render(issue):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgIssueStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$tgTemplate","$compile",IssueStatusButtonDirective]),IssueTypeButtonDirective=function($rootScope,$repo,$confirm,$loading,$qqueue,$template,$compile){var link,template;return template=$template.get("issue/issue-type-button.html",!0),link=function($scope,$el,$attrs,$model){var isEditable,render,save;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_issue")},render=function(_this){return function(issue){var html,type;return type=$scope.typeById[issue.type],html=template({type:type,typees:$scope.typeList,editable:isEditable()}),html=$compile(html)($scope),$el.html(html)}}(this),save=$qqueue.bindAdd(function(_this){return function(type){var currentLoading,issue,onError,onSuccess;return $.fn.popover().closeAll(),issue=$model.$modelValue.clone(),issue.type=type,currentLoading=$loading().target($el.find(".level-name")).start(),onSuccess=function(){return $model.$setViewValue(issue),$rootScope.$broadcast("object:updated"),currentLoading.finish()},onError=function(){return $confirm.notify("error"),issue.revert(),$model.$setViewValue(issue),currentLoading.finish()},$repo.save(issue).then(onSuccess,onError)}}(this)),$el.on("click",".type-data",function(event){return event.preventDefault(),event.stopPropagation(),isEditable()?$el.find(".pop-type").popover().open():void 0}),$el.on("click",".type",function(event){var target,type;return event.preventDefault(),event.stopPropagation(),isEditable()?(target=angular.element(event.currentTarget),type=target.data("type-id"),save(type)):void 0}),$scope.$watch($attrs.ngModel,function(issue){return issue?render(issue):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgIssueTypeButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$tgTemplate","$compile",IssueTypeButtonDirective]),IssueSeverityButtonDirective=function($rootScope,$repo,$confirm,$loading,$qqueue,$template,$compile){var link,template;return template=$template.get("issue/issue-severity-button.html",!0),link=function($scope,$el,$attrs,$model){var isEditable,render,save;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_issue")},render=function(_this){return function(issue){var html,severity;return severity=$scope.severityById[issue.severity],html=template({severity:severity,severityes:$scope.severityList,editable:isEditable()}),html=$compile(html)($scope),$el.html(html)}}(this),save=$qqueue.bindAdd(function(_this){return function(severity){var currentLoading,issue,onError,onSuccess;return $.fn.popover().closeAll(),issue=$model.$modelValue.clone(),issue.severity=severity,currentLoading=$loading().target($el.find(".level-name")).start(),onSuccess=function(){return $model.$setViewValue(issue),$rootScope.$broadcast("object:updated"),currentLoading.finish()},onError=function(){return $confirm.notify("error"),issue.revert(),$model.$setViewValue(issue),currentLoading.finish()},$repo.save(issue).then(onSuccess,onError)}}(this)),$el.on("click",".severity-data",function(event){return event.preventDefault(),event.stopPropagation(),isEditable()?$el.find(".pop-severity").popover().open():void 0}),$el.on("click",".severity",function(event){var severity,target;return event.preventDefault(),event.stopPropagation(),isEditable()?(target=angular.element(event.currentTarget),severity=target.data("severity-id"),save(severity)):void 0}),$scope.$watch($attrs.ngModel,function(issue){return issue?render(issue):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgIssueSeverityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$tgTemplate","$compile",IssueSeverityButtonDirective]),IssuePriorityButtonDirective=function($rootScope,$repo,$confirm,$loading,$qqueue,$template,$compile){var link,template;return template=$template.get("issue/issue-priority-button.html",!0),link=function($scope,$el,$attrs,$model){var isEditable,render,save;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_issue")},render=function(_this){return function(issue){var html,priority;return priority=$scope.priorityById[issue.priority],html=template({priority:priority,priorityes:$scope.priorityList,editable:isEditable()}),html=$compile(html)($scope),$el.html(html)}}(this),save=$qqueue.bindAdd(function(_this){return function(priority){var currentLoading,issue,onError,onSuccess; return $.fn.popover().closeAll(),issue=$model.$modelValue.clone(),issue.priority=priority,currentLoading=$loading().target($el.find(".level-name")).start(),onSuccess=function(){return $model.$setViewValue(issue),$rootScope.$broadcast("object:updated"),currentLoading.finish()},onError=function(){return $confirm.notify("error"),issue.revert(),$model.$setViewValue(issue),currentLoading.finish()},$repo.save(issue).then(onSuccess,onError)}}(this)),$el.on("click",".priority-data",function(event){return event.preventDefault(),event.stopPropagation(),isEditable()?$el.find(".pop-priority").popover().open():void 0}),$el.on("click",".priority",function(event){var priority,target;return event.preventDefault(),event.stopPropagation(),isEditable()?(target=angular.element(event.currentTarget),priority=target.data("priority-id"),save(priority)):void 0}),$scope.$watch($attrs.ngModel,function(issue){return issue?render(issue):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgIssuePriorityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$tgTemplate","$compile",IssuePriorityButtonDirective]),PromoteIssueToUsButtonDirective=function($rootScope,$repo,$confirm,$qqueue,$translate){var link;return link=function($scope,$el,$attrs,$model){var save;return save=$qqueue.bindAdd(function(_this){return function(issue,askResponse){var data,onError,onSuccess;return data={generated_from_issue:issue.id,project:issue.project,subject:issue.subject,description:issue.description,tags:issue.tags,is_blocked:issue.is_blocked,blocked_note:issue.blocked_note},onSuccess=function(){return askResponse.finish(),$confirm.notify("success"),$rootScope.$broadcast("promote-issue-to-us:success")},onError=function(){return askResponse.finish(),$confirm.notify("error")},$repo.create("userstories",data).then(onSuccess,onError)}}(this)),$el.on("click","a",function(event){var issue,message,subtitle,title;return event.preventDefault(),issue=$model.$modelValue,title=$translate.instant("ISSUES.CONFIRM_PROMOTE.TITLE"),message=$translate.instant("ISSUES.CONFIRM_PROMOTE.MESSAGE"),subtitle=issue.subject,$confirm.ask(title,subtitle,message).then(function(_this){return function(response){return save(issue,response)}}(this))}),$scope.$on("$destroy",function(){return $el.off()})},{restrict:"AE",require:"ngModel",templateUrl:"issue/promote-issue-to-us-button.html",link:link}},module.directive("tgPromoteIssueToUsButton",["$rootScope","$tgRepo","$tgConfirm","$tgQqueue","$translate",PromoteIssueToUsButtonDirective])}.call(this),function(){var CreateBulkIssuesDirective,CreateIssueDirective,bindOnce,debounce,module,taiga;taiga=this.taiga,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,module=angular.module("taigaIssues"),CreateIssueDirective=function($repo,$confirm,$rootscope,lightboxService,$loading,$q,attachmentsService){var link;return link=function($scope,$el,$attrs){var attachmentsToAdd,createAttachments,form,resetAttachments,submit,submitButton;return form=$el.find("form").checksley(),$scope.issue={},$scope.attachments=Immutable.List(),$scope.$on("issueform:new",function(ctx,project){return form.reset(),resetAttachments(),$el.find(".tag-input").val(""),lightboxService.open($el),$scope.issue={project:project.id,subject:"",status:project.default_issue_status,type:project.default_issue_type,priority:project.default_priority,severity:project.default_severity,tags:[]}}),$scope.$on("$destroy",function(){return $el.off()}),createAttachments=function(obj){var promises;return promises=_.map(attachmentsToAdd.toJS(),function(attachment){return attachmentsService.upload(attachment.file,obj.id,$scope.issue.project,"issue")}),$q.all(promises)},attachmentsToAdd=Immutable.List(),resetAttachments=function(){return attachmentsToAdd=Immutable.List(),$scope.attachments=Immutable.List()},$scope.addAttachment=function(attachment){return attachmentsToAdd=attachmentsToAdd.push(attachment)},submit=debounce(2e3,function(_this){return function(event){var currentLoading,promise;return event.preventDefault(),form.validate()?(currentLoading=$loading().target(submitButton).start(),promise=$repo.create("issues",$scope.issue),promise.then(function(data){return createAttachments(data)}),promise.then(function(data){return currentLoading.finish(),$rootscope.$broadcast("issueform:new:success",data),lightboxService.close($el),$confirm.notify("success")}),promise.then(null,function(){return currentLoading.finish(),$confirm.notify("error")})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit)},{link:link}},module.directive("tgLbCreateIssue",["$tgRepo","$tgConfirm","$rootScope","lightboxService","$tgLoading","$q","tgAttachmentsService",CreateIssueDirective]),CreateBulkIssuesDirective=function($repo,$rs,$confirm,$rootscope,$loading,lightboxService){var link;return link=function($scope,$el,attrs){var form,submit,submitButton;return form=null,$scope.$on("issueform:bulk",function(ctx,projectId,status){return form&&form.reset(),lightboxService.open($el),$scope["new"]={projectId:projectId,bulk:""}}),submit=debounce(2e3,function(_this){return function(event){var currentLoading,data,projectId,promise;return event.preventDefault(),form=$el.find("form").checksley(),form.validate()?(currentLoading=$loading().target(submitButton).start(),data=$scope["new"].bulk,projectId=$scope["new"].projectId,promise=$rs.issues.bulkCreate(projectId,data),promise.then(function(result){return currentLoading.finish(),$rootscope.$broadcast("issueform:new:success",result),lightboxService.close($el),$confirm.notify("success")}),promise.then(null,function(){return currentLoading.finish(),$confirm.notify("error")})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgLbCreateBulkIssues",["$tgRepo","$tgResources","$tgConfirm","$rootScope","$tgLoading","lightboxService",CreateBulkIssuesDirective])}.call(this),function(){var IssueAssignedToInlineEditionDirective,IssueStatusInlineEditionDirective,IssuesController,IssuesDirective,IssuesFiltersDirective,bindOnce,debounceLeading,groupBy,joinStr,mixOf,module,startswith,taiga,toString,trim,bind=function(fn,me){return function(){return fn.apply(me,arguments)}},extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,trim=this.taiga.trim,toString=this.taiga.toString,joinStr=this.taiga.joinStr,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,debounceLeading=this.taiga.debounceLeading,startswith=this.taiga.startswith,module=angular.module("taigaIssues"),IssuesController=function(superClass){function IssuesController(scope,rootscope,repo,confirm,rs,urls,params,q,location,appMetaService,navUrls,events,analytics,translate){var filters,promise;return this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.urls=urls,this.params=params,this.q=q,this.location=location,this.appMetaService=appMetaService,this.navUrls=navUrls,this.events=events,this.analytics=analytics,this.translate=translate,this.loadIssues=bind(this.loadIssues,this),this.scope.sectionName="Issues",this.scope.filters={},_.isEmpty(this.location.search())?(filters=this.rs.issues.getFilters(this.params.pslug),filters.page=1,this.location.search(filters),void this.location.replace()):(promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ISSUES.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.translate.instant("ISSUES.PAGE_DESCRIPTION",{projectName:_this.scope.project.name,projectDescription:_this.scope.project.description}),_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),void this.scope.$on("issueform:new:success",function(_this){return function(){return _this.analytics.trackEvent("issue","create","create issue on issues list",1),_this.loadIssues()}}(this)))}return extend(IssuesController,superClass),IssuesController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$tgUrls","$routeParams","$q","$tgLocation","tgAppMetaService","$tgNavUrls","$tgEvents","$tgAnalytics","$translate"],IssuesController.prototype.initializeSubscription=function(){var routingKey;return routingKey="changes.project."+this.scope.projectId+".issues",this.events.subscribe(this.scope,routingKey,function(_this){return function(message){return _this.loadIssues()}}(this))},IssuesController.prototype.storeFilters=function(){return this.rs.issues.storeFilters(this.params.pslug,this.location.search())},IssuesController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.is_issues_activated||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.issueStatusById=groupBy(project.issue_statuses,function(x){return x.id}),_this.scope.issueStatusList=_.sortBy(project.issue_statuses,"order"),_this.scope.severityById=groupBy(project.severities,function(x){return x.id}),_this.scope.severityList=_.sortBy(project.severities,"order"),_this.scope.priorityById=groupBy(project.priorities,function(x){return x.id}),_this.scope.priorityList=_.sortBy(project.priorities,"order"),_this.scope.issueTypes=_.sortBy(project.issue_types,"order"),_this.scope.issueTypeById=groupBy(project.issue_types,function(x){return x.id}),project}}(this))},IssuesController.prototype.getUrlFilters=function(){var filters;return filters=_.pick(this.location.search(),"page","tags","status","types","q","severities","priorities","assignedTo","createdBy","orderBy"),filters.page||(filters.page=1),filters},IssuesController.prototype.getUrlFilter=function(name){var filters;return filters=_.pick(this.location.search(),name),filters[name]},IssuesController.prototype.loadMyFilters=function(){return this.rs.issues.getMyFilters(this.scope.projectId).then(function(_this){return function(filters){return _.map(filters,function(value,key){return{id:key,name:key,type:"myFilters",selected:!1}})}}(this))},IssuesController.prototype.removeNotExistingFiltersFromUrl=function(){var currentSearch,existingValues,filterName,filterValue,splittedValues,urlfilters;currentSearch=this.location.search(),urlfilters=this.getUrlFilters();for(filterName in urlfilters)filterValue=urlfilters[filterName],"page"!==filterName&&"orderBy"!==filterName&&"q"!==filterName&&(splittedValues="tags"===filterName?_.map((""+filterValue).split(",")):_.map((""+filterValue).split(","),function(x){return"null"===x?null:parseInt(x)}),existingValues=_.intersection(splittedValues,_.map(this.scope.filters[filterName],"id")),splittedValues.length!==existingValues.length&&this.location.search(filterName,existingValues.join()));return currentSearch!==this.location.search()?this.location.replace():void 0},IssuesController.prototype.markSelectedFilters=function(filters,urlfilters){var isSelected,j,key,len,name,obj,ref,ref1,results,searchdata,val,value;searchdata={},ref=_.omit(urlfilters,"page","orderBy");for(name in ref)for(value=ref[name],null==searchdata[name]&&(searchdata[name]={}),ref1=(""+value).split(","),j=0,len=ref1.length;len>j;j++)val=ref1[j],searchdata[name][val]=!0;isSelected=function(type,id){return null!=searchdata[type]&&searchdata[type][id]?!0:!1},results=[];for(key in filters)value=filters[key],results.push(function(){var k,len1,results1;for(results1=[],k=0,len1=value.length;len1>k;k++)obj=value[k],results1.push(obj.selected=isSelected(obj.type,obj.id)?!0:void 0);return results1}());return results},IssuesController.prototype.loadFilters=function(){var loadFilters,promise,urlfilters;return urlfilters=this.getUrlFilters(),urlfilters.q&&(this.scope.filtersQ=urlfilters.q),promise=this.loadMyFilters().then(function(_this){return function(myFilters){return _this.scope.filters.myFilters=myFilters,myFilters}}(this)),loadFilters={},loadFilters.project=this.scope.projectId,loadFilters.tags=urlfilters.tags,loadFilters.status=urlfilters.status,loadFilters.q=urlfilters.q,loadFilters.types=urlfilters.types,loadFilters.severities=urlfilters.severities,loadFilters.priorities=urlfilters.priorities,loadFilters.assigned_to=urlfilters.assignedTo,loadFilters.owner=urlfilters.createdBy,promise=promise.then(function(_this){return function(){return _this.rs.issues.filtersData(loadFilters)}}(this)),promise.then(function(_this){return function(data){var choicesFiltersFormat,tagsFilterFormat,usersFiltersFormat;return usersFiltersFormat=function(users,type,unknownOption){var reformatedUsers,unknownItem;return reformatedUsers=_.map(users,function(t){return t.type=type,t.name=t.full_name?t.full_name:unknownOption,t}),unknownItem=_.remove(reformatedUsers,function(u){return!u.id}),reformatedUsers=_.sortBy(reformatedUsers,function(u){return u.name.toUpperCase()}),unknownItem.length>0&&reformatedUsers.unshift(unknownItem[0]),reformatedUsers},choicesFiltersFormat=function(choices,type,byIdObject){return _.map(choices,function(t){return t.type=type,t})},tagsFilterFormat=function(tags){return _.map(tags,function(t){return t.id=t.name,t.type="tags",t})},_this.scope.filters.status=choicesFiltersFormat(data.statuses,"status",_this.scope.issueStatusById),_this.scope.filters.severities=choicesFiltersFormat(data.severities,"severities",_this.scope.severityById),_this.scope.filters.priorities=choicesFiltersFormat(data.priorities,"priorities",_this.scope.priorityById),_this.scope.filters.assignedTo=usersFiltersFormat(data.assigned_to,"assignedTo","Unassigned"),_this.scope.filters.createdBy=usersFiltersFormat(data.owners,"createdBy","Unknown"),_this.scope.filters.types=choicesFiltersFormat(data.types,"types",_this.scope.issueTypeById),_this.scope.filters.tags=tagsFilterFormat(data.tags),_this.removeNotExistingFiltersFromUrl(),_this.markSelectedFilters(_this.scope.filters,urlfilters),_this.rootscope.$broadcast("filters:loaded",_this.scope.filters)}}(this))},IssuesController.prototype.loadIssuesRequests=0,IssuesController.prototype.loadIssues=function(){var name,promise,ref,values;this.scope.urlFilters=this.getUrlFilters(),this.scope.httpParams={},ref=this.scope.urlFilters;for(name in ref)values=ref[name],"severities"===name?name="severity":"orderBy"===name?name="order_by":"priorities"===name?name="priority":"assignedTo"===name?name="assigned_to":"createdBy"===name?name="owner":"status"===name?name="status":"types"===name&&(name="type"),this.scope.httpParams[name]=values;return promise=this.rs.issues.list(this.scope.projectId,this.scope.httpParams),this.loadIssuesRequests+=1,promise.index=this.loadIssuesRequests,promise.then(function(_this){return function(data){return promise.index===_this.loadIssuesRequests&&(_this.scope.issues=data.models,_this.scope.page=data.current,_this.scope.count=data.count,_this.scope.paginatedBy=data.paginatedBy),data}}(this)),promise},IssuesController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.members,project.roles),_this.initializeSubscription(),_this.loadFilters(),_this.loadIssues()}}(this))},IssuesController.prototype.saveCurrentFiltersTo=function(newFilter){var deferred;return deferred=this.q.defer(),this.rs.issues.getMyFilters(this.scope.projectId).then(function(_this){return function(filters){return filters[newFilter]=_this.location.search(),_this.rs.issues.storeMyFilters(_this.scope.projectId,filters).then(function(){return deferred.resolve()})}}(this)),deferred.promise},IssuesController.prototype.deleteMyFilter=function(filter){var deferred;return deferred=this.q.defer(),this.rs.issues.getMyFilters(this.scope.projectId).then(function(_this){return function(filters){return delete filters[filter],_this.rs.issues.storeMyFilters(_this.scope.projectId,filters).then(function(){return deferred.resolve()})}}(this)),deferred.promise},IssuesController.prototype.addNewIssue=function(){return this.rootscope.$broadcast("issueform:new",this.scope.project)},IssuesController.prototype.addIssuesInBulk=function(){return this.rootscope.$broadcast("issueform:bulk",this.scope.projectId)},IssuesController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("IssuesController",IssuesController),IssuesDirective=function($log,$location,$template,$compile){var link,linkOrdering,linkPagination,template;return template=$template.get("issue/issue-paginator.html",!0),linkPagination=function($scope,$el,$attrs,$ctrl){var $pagEl,afterCurrent,atBegin,atEnd,beforeCurrent,getNumPages,renderPagination;return afterCurrent=2,beforeCurrent=4,atBegin=2,atEnd=2,$pagEl=$el.find(".issues-paginator"),getNumPages=function(){var numPages;return numPages=$scope.count/$scope.paginatedBy,numPages=parseInt(numPages,10)=numPages)return void $pagEl.hide();for($pagEl.show(),pages=[],options={},options.pages=pages,options.showPrevious=$scope.page>1,options.showNext=!($scope.page===numPages),cpage=$scope.page,i=j=1,ref=numPages;ref>=1?ref>=j:j>=ref;i=ref>=1?++j:--j)i===cpage+afterCurrent&&numPages>cpage+afterCurrent+atEnd?pages.push({classes:"dots",type:"dots"}):i===cpage-beforeCurrent&&cpage>atBegin+beforeCurrent?pages.push({classes:"dots",type:"dots"}):i>cpage+afterCurrent&&numPages-atEnd>=i||cpage-beforeCurrent>i&&i>atBegin||(i===cpage?pages.push({classes:"active",num:i,type:"page-active"}):pages.push({classes:"page",num:i,type:"page"}));return html=template(options),html=$compile(html)($scope),$pagEl.html(html)},$scope.$watch("issues",function(value){return value?renderPagination():void 0}),$el.on("click",".issues-paginator a.next",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page+1),$ctrl.loadIssues()})}),$el.on("click",".issues-paginator a.previous",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page-1),$ctrl.loadIssues()})}),$el.on("click",".issues-paginator li.page > a",function(event){var pagenum,target;return event.preventDefault(),target=angular.element(event.currentTarget),pagenum=target.data("pagenum"),$scope.$apply(function(){return $ctrl.selectFilter("page",pagenum),$ctrl.loadIssues()})})},linkOrdering=function($scope,$el,$attrs,$ctrl){var colHeadElement,currentOrder,icon;return currentOrder=$ctrl.getUrlFilter("orderBy")||"created_date",currentOrder&&(icon=startswith(currentOrder,"-")?"icon-arrow-up":"icon-arrow-bottom",colHeadElement=$el.find(".row.title > div[data-fieldname='"+trim(currentOrder,"-")+"']"),colHeadElement.html(colHeadElement.html()+"")),$el.on("click",".row.title > div",function(event){var finalOrder,newOrder,target;return target=angular.element(event.currentTarget),currentOrder=$ctrl.getUrlFilter("orderBy"),newOrder=target.data("fieldname"),finalOrder=currentOrder===newOrder?"-"+newOrder:newOrder,$scope.$apply(function(){return $ctrl.replaceFilter("orderBy",finalOrder),$ctrl.storeFilters(),$ctrl.loadIssues().then(function(){return $el.find(".row.title > div > span.icon").remove(),icon=startswith(finalOrder,"-")?"icon-arrow-up":"icon-arrow-bottom",target.html(target.html()+"")})})})},link=function($scope,$el,$attrs){var $ctrl;return $ctrl=$el.controller(),linkOrdering($scope,$el,$attrs,$ctrl),linkPagination($scope,$el,$attrs,$ctrl),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgIssues",["$log","$tgLocation","$tgTemplate","$compile",IssuesDirective]),IssuesFiltersDirective=function($q,$log,$location,$rs,$confirm,$loading,$template,$translate,$compile,$auth){var link,template,templateSelected;return template=$template.get("issue/issues-filters.html",!0),templateSelected=$template.get("issue/issues-filters-selected.html",!0),link=function($scope,$el,$attrs){var $ctrl,getFiltersType,initializeSelectedFilters,reloadIssues,renderFilters,renderSelectedFilters,selectQFilter,selectedFilters,showCategories,showFilters,toggleFilterSelection,unwatchIssues;return $ctrl=$el.closest(".wrapper").controller(),selectedFilters=[],showFilters=function(title,type){return $el.find(".filters-cats").hide(),$el.find(".filter-list").removeClass("hidden"),$el.find(".breadcrumb").removeClass("hidden"),$el.find("h2 .subfilter .title").html(title),$el.find("h2 .subfilter .title").prop("data-type",type)},showCategories=function(){return $el.find(".filters-cats").show(),$el.find(".filter-list").addClass("hidden"),$el.find(".breadcrumb").addClass("hidden")},initializeSelectedFilters=function(filters){var j,len,name,val,values;selectedFilters=[];for(name in filters)for(values=filters[name],j=0,len=values.length;len>j;j++)val=values[j],val.selected&&selectedFilters.push(val);return renderSelectedFilters(selectedFilters)},renderSelectedFilters=function(selectedFilters){var html;return _.filter(selectedFilters,function(_this){return function(f){return f.color?f.style="border-left: 3px solid "+f.color:void 0}}(this)),html=templateSelected({filters:selectedFilters}),html=$compile(html)($scope),$el.find(".filters-applied").html(html),$auth.isAuthenticated()&&selectedFilters.length>0?$el.find(".save-filters").show():$el.find(".save-filters").hide()},renderFilters=function(filters){var html;return _.filter(filters,function(_this){return function(f){return f.color?f.style="border-left: 3px solid "+f.color:void 0}}(this)),html=template({filters:filters}),html=$compile(html)($scope),$el.find(".filter-list").html(html)},getFiltersType=function(){return $el.find(".subfilter .title").prop("data-type")},reloadIssues=function(){var currentFiltersType;return currentFiltersType=getFiltersType(),$q.all([$ctrl.loadIssues(),$ctrl.loadFilters()]).then(function(){var filters;return filters=$scope.filters[currentFiltersType],renderFilters(_.reject(filters,"selected"))})},toggleFilterSelection=function(type,id){var currentFiltersType,filter,filterId,filters;return"myFilters"===type?($rs.issues.getMyFilters($scope.projectId).then(function(data){var filters,myFilters;return myFilters=data,filters=myFilters[id],filters.page=1,$ctrl.replaceAllFilters(filters),$ctrl.storeFilters(),$ctrl.loadIssues(),$ctrl.markSelectedFilters($scope.filters,filters),initializeSelectedFilters($scope.filters)}),null):(filters=$scope.filters[type],filterId="tags"===type?taiga.toString(id):id,filter=_.find(filters,{id:filterId}),filter.selected=!filter.selected,null===id&&(id="null"),filter.selected?(selectedFilters.push(filter),$ctrl.selectFilter(type,id),$ctrl.selectFilter("page",1),$ctrl.storeFilters()):(selectedFilters=_.reject(selectedFilters,function(f){return f.id===filter.id&&f.type===filter.type}),$ctrl.unselectFilter(type,id),$ctrl.selectFilter("page",1),$ctrl.storeFilters()),reloadIssues(),renderSelectedFilters(selectedFilters),currentFiltersType=getFiltersType(),type===currentFiltersType?renderFilters(_.reject(filters,"selected")):void 0)},$scope.$on("filters:loaded",function(ctx,filters){return initializeSelectedFilters(filters)}),$scope.$on("filters:issueupdate",function(ctx,filters){var html;return html=template({filters:filters.status}),html=$compile(html)($scope),$el.find(".filter-list").html(html)}),selectQFilter=debounceLeading(100,function(value,oldValue){return void 0!==value&&value!==oldValue?($ctrl.replaceFilter("page",null,!0),0===value.length?($ctrl.replaceFilter("q",null),$ctrl.storeFilters()):($ctrl.replaceFilter("q",value),$ctrl.storeFilters()),reloadIssues()):void 0}),unwatchIssues=$scope.$watch("issues",function(newValue){return _.isUndefined(newValue)?void 0:($scope.$watch("filtersQ",selectQFilter),unwatchIssues())}),$el.on("click",".filters-cats > ul > li > a",function(event){var tags,target;return event.preventDefault(),target=angular.element(event.currentTarget),tags=$scope.filters[target.data("type")],renderFilters(_.reject(tags,"selected")),showFilters(target.attr("title"),target.data("type"))}),$el.on("click",".filters-inner > .filters-step-cat > .breadcrumb > .back",function(event){return event.preventDefault(),showCategories($el)}),$el.on("click",".filters-applied a",function(event){var id,target,type;return event.preventDefault(),target=angular.element(event.currentTarget),id=target.data("id")||null,type=target.data("type"),toggleFilterSelection(type,id)}),$el.on("click",".filter-list .single-filter",function(event){var id,target,type;return event.preventDefault(),target=angular.element(event.currentTarget),target.toggleClass("active"),id=target.data("id")||null,type=target.data("type"),"myFilters"===type&&target.removeClass("active"),toggleFilterSelection(type,id)}),$el.on("click",".filter-list .single-filter .remove-filter",function(event){var customFilterName,message,target,title;return event.preventDefault(),event.stopPropagation(),target=angular.element(event.currentTarget),customFilterName=target.parent().data("id"),title=$translate.instant("ISSUES.FILTERS.CONFIRM_DELETE.TITLE"),message=$translate.instant("ISSUES.FILTERS.CONFIRM_DELETE.MESSAGE",{customFilterName:customFilterName}),$confirm.askOnDelete(title,message).then(function(askResponse){var promise;return promise=$ctrl.deleteMyFilter(customFilterName),promise.then(function(){return promise=$ctrl.loadMyFilters(),promise.then(function(filters){return askResponse.finish(),$scope.filters.myFilters=filters,renderFilters($scope.filters.myFilters)}),promise.then(null,function(){return askResponse.finish()})}),promise.then(null,function(){return askResponse.finish(!1),$confirm.notify("error")})})}),$el.on("click",".save-filters",function(event){return event.preventDefault(),renderFilters($scope.filters.myFilters),showFilters("My filters","myFilters"),$el.find(".save-filters").hide(),$el.find(".my-filter-name").removeClass("hidden"),$el.find(".my-filter-name").focus(),$scope.$apply()}),$el.on("keyup",".my-filter-name",function(event){var currentLoading,newFilter,promise,target;return event.preventDefault(),13===event.keyCode?(target=angular.element(event.currentTarget),newFilter=target.val(),currentLoading=$loading().target($el.find(".new")).start(),promise=$ctrl.saveCurrentFiltersTo(newFilter),promise.then(function(){var loadPromise;return loadPromise=$ctrl.loadMyFilters(),loadPromise.then(function(filters){var currentfilterstype;return currentLoading.finish(),$scope.filters.myFilters=filters,currentfilterstype=$el.find("h2 .subfilter .title").prop("data-type"),"myFilters"===currentfilterstype&&renderFilters($scope.filters.myFilters),$el.find(".my-filter-name").addClass("hidden"),$el.find(".save-filters").show()}),loadPromise.then(null,function(){return currentLoading.finish(),$confirm.notify("error","Error loading custom filters")})}),promise.then(null,function(){return currentLoading.finish(),$el.find(".my-filter-name").val(newFilter).focus().select(),$confirm.notify("error","Filter not saved")})):27===event.keyCode?($el.find(".my-filter-name").val(""),$el.find(".my-filter-name").addClass("hidden"),$el.find(".save-filters").show()):void 0})},{link:link}},module.directive("tgIssuesFilters",["$q","$log","$tgLocation","$tgResources","$tgConfirm","$tgLoading","$tgTemplate","$translate","$compile","$tgAuth",IssuesFiltersDirective]),IssueStatusInlineEditionDirective=function($repo,$template,$rootscope){var link,selectionTemplate,updateIssueStatus;return selectionTemplate=$template.get("issue/issue-status-inline-edition-selection.html",!0),updateIssueStatus=function($el,issue,issueStatusById){var issueStatusDom,issueStatusDomParent,status;return issueStatusDomParent=$el.find(".issue-status"),issueStatusDom=$el.find(".issue-status .issue-status-bind"),status=issueStatusById[issue.status],status?(issueStatusDom.text(status.name),issueStatusDom.prop("title",status.name),issueStatusDomParent.css("color",status.color)):void 0},link=function($scope,$el,$attrs){var $ctrl,issue;return $ctrl=$el.controller(),issue=$scope.$eval($attrs.tgIssueStatusInlineEdition),$el.on("click",".issue-status",function(event){return event.preventDefault(),event.stopPropagation(),$el.find(".pop-status").popover().open()}),$el.on("click",".status",function(event){var filter,j,len,ref,target;for(event.preventDefault(),event.stopPropagation(),target=angular.element(event.currentTarget),ref=$scope.filters.status,j=0,len=ref.length;len>j;j++)filter=ref[j],filter.id===issue.status&&filter.count--;return issue.status=target.data("status-id"),$el.find(".pop-status").popover().close(),updateIssueStatus($el,issue,$scope.issueStatusById),$scope.$apply(function(){var k,len1,ref1;for($repo.save(issue).then(function(){return $ctrl.loadIssues()}),ref1=$scope.filters.status,k=0,len1=ref1.length;len1>k;k++)filter=ref1[k],filter.id===issue.status&&filter.count++;return $rootscope.$broadcast("filters:issueupdate",$scope.filters)})}),taiga.bindOnce($scope,"project",function(project){return $el.append(selectionTemplate({statuses:project.issue_statuses})),updateIssueStatus($el,issue,$scope.issueStatusById),-1===project.my_permissions.indexOf("modify_issue")?($el.unbind("click"),$el.find("a").addClass("not-clickable")):void 0}),$scope.$watch($attrs.tgIssueStatusInlineEdition,function(_this){return function(val){return updateIssueStatus($el,val,$scope.issueStatusById)}}(this)),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgIssueStatusInlineEdition",["$tgRepo","$tgTemplate","$rootScope",IssueStatusInlineEditionDirective]),IssueAssignedToInlineEditionDirective=function($repo,$rootscope,$translate){var link,template;return template=_.template('<%- name %>\n
<%- name %>
'),link=function($scope,$el,$attrs){var $ctrl,issue,updateIssue;return updateIssue=function(issue){var ctx,member;return ctx={name:$translate.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png"},member=$scope.usersById[issue.assigned_to],member&&(ctx.name=member.full_name_display,ctx.imgurl=member.photo),$el.find(".avatar").html(template(ctx)),$el.find(".issue-assignedto").attr("title",ctx.name)},$ctrl=$el.controller(),issue=$scope.$eval($attrs.tgIssueAssignedToInlineEdition),updateIssue(issue),$el.on("click",".issue-assignedto",function(event){return $rootscope.$broadcast("assigned-to:add",issue)}),taiga.bindOnce($scope,"project",function(project){return-1===project.my_permissions.indexOf("modify_issue")?($el.unbind("click"),$el.find("a").addClass("not-clickable")):void 0}),$scope.$on("assigned-to:added",function(_this){return function(ctx,userId,updatedIssue){return updatedIssue.id===issue.id?(updatedIssue.assigned_to=userId,$repo.save(updatedIssue),updateIssue(updatedIssue)):void 0}}(this)),$scope.$watch($attrs.tgIssueAssignedToInlineEdition,function(_this){return function(val){return updateIssue(val)}}(this)),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgIssueAssignedToInlineEdition",["$tgRepo","$rootScope","$translate",IssueAssignedToInlineEditionDirective])}.call(this),function(){var UsClientRequirementButtonDirective,UsStatusButtonDirective,UsStatusDisplayDirective,UsTeamRequirementButtonDirective,UserStoryDetailController,bindMethods,bindOnce,groupBy,mixOf,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype, child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,bindMethods=this.taiga.bindMethods,module=angular.module("taigaUserStories"),UserStoryDetailController=function(superClass){function UserStoryDetailController(scope,rootscope,repo,confirm,rs,params,q,location,log,appMetaService,navUrls,analytics,translate){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.log=log,this.appMetaService=appMetaService,this.navUrls=navUrls,this.analytics=analytics,this.translate=translate,bindMethods(this),this.scope.usRef=this.params.usref,this.scope.sectionName=this.translate.instant("US.SECTION_NAME"),this.initializeEventHandlers(),promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this._setMeta(),_this.initializeOnDeleteGoToUrl()}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(UserStoryDetailController,superClass),UserStoryDetailController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate"],UserStoryDetailController.prototype._setMeta=function(){var closedTasks,description,progressPercentage,ref,title,totalTasks;return totalTasks=this.scope.tasks.length,closedTasks=_.filter(this.scope.tasks,function(_this){return function(t){return _this.scope.taskStatusById[t.status].is_closed}}(this)).length,progressPercentage=totalTasks>0?Math.round(100*closedTasks/totalTasks):0,title=this.translate.instant("US.PAGE_TITLE",{userStoryRef:"#"+this.scope.us.ref,userStorySubject:this.scope.us.subject,projectName:this.scope.project.name}),description=this.translate.instant("US.PAGE_DESCRIPTION",{userStoryStatus:(null!=(ref=this.scope.statusById[this.scope.us.status])?ref.name:void 0)||"--",userStoryPoints:this.scope.us.total_points,userStoryDescription:angular.element(this.scope.us.description_html||"").text(),userStoryClosedTasks:closedTasks,userStoryTotalTasks:totalTasks,userStoryProgressPercentage:progressPercentage}),this.appMetaService.setAll(title,description)},UserStoryDetailController.prototype.initializeEventHandlers=function(){return this.scope.$on("related-tasks:update",function(_this){return function(){var allClosed;return _this.scope.tasks=_.clone(_this.scope.tasks,!1),allClosed=_.every(_this.scope.tasks,function(task){return task.is_closed}),_this.scope.us.is_closed!==allClosed?_this.loadUs():void 0}}(this)),this.scope.$on("attachment:create",function(_this){return function(){return _this.analytics.trackEvent("attachment","create","create attachment on userstory",1)}}(this)),this.scope.$on("comment:new",function(_this){return function(){return _this.loadUs()}}(this))},UserStoryDetailController.prototype.initializeOnDeleteGoToUrl=function(){var ctx;return ctx={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",ctx),this.scope.project.is_backlog_activated?this.scope.us.milestone?(ctx.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",ctx)):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-backlog",ctx):this.scope.project.is_kanban_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-kanban",ctx):void 0},UserStoryDetailController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.statusList=project.us_statuses,_this.scope.statusById=groupBy(project.us_statuses,function(x){return x.id}),_this.scope.taskStatusById=groupBy(project.task_statuses,function(x){return x.id}),_this.scope.pointsList=_.sortBy(project.points,"order"),_this.scope.pointsById=groupBy(_this.scope.pointsList,function(e){return e.id}),project}}(this))},UserStoryDetailController.prototype.loadUs=function(){var httpParams,kanbanStaus,milestone,noMilestone;return httpParams=_.pick(this.location.search(),"milestone","no-milestone","kanban-status"),milestone=httpParams.milestone,milestone&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:milestone,order_by:"sprint_order"}),noMilestone=httpParams["no-milestone"],noMilestone&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:"null",order_by:"backlog_order"}),kanbanStaus=httpParams["kanban-status"],kanbanStaus&&this.rs.userstories.storeQueryParams(this.scope.projectId,{status:kanbanStaus,order_by:"kanban_order"}),this.rs.userstories.getByRef(this.scope.projectId,this.params.usref).then(function(_this){return function(us){var ctx,ref,ref1;return _this.scope.us=us,_this.scope.usId=us.id,_this.scope.commentModel=us,null!=(null!=(ref=_this.scope.us.neighbors.previous)?ref.ref:void 0)&&(ctx={project:_this.scope.project.slug,ref:_this.scope.us.neighbors.previous.ref},_this.scope.previousUrl=_this.navUrls.resolve("project-userstories-detail",ctx)),null!=(null!=(ref1=_this.scope.us.neighbors.next)?ref1.ref:void 0)&&(ctx={project:_this.scope.project.slug,ref:_this.scope.us.neighbors.next.ref},_this.scope.nextUrl=_this.navUrls.resolve("project-userstories-detail",ctx)),us}}(this))},UserStoryDetailController.prototype.loadSprint=function(){return this.scope.us.milestone?this.rs.sprints.get(this.scope.us.project,this.scope.us.milestone).then(function(_this){return function(sprint){return _this.scope.sprint=sprint,sprint}}(this)):void 0},UserStoryDetailController.prototype.loadTasks=function(){return this.rs.tasks.list(this.scope.projectId,null,this.scope.usId).then(function(_this){return function(tasks){return _this.scope.tasks=tasks,tasks}}(this))},UserStoryDetailController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.members,project.roles),_this.loadUs().then(function(){return _this.q.all([_this.loadSprint(),_this.loadTasks()])})}}(this))},UserStoryDetailController.prototype.onUpvote=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadUs(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.userstories.upvote(this.scope.usId).then(onSuccess,onError)},UserStoryDetailController.prototype.onDownvote=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadUs(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.userstories.downvote(this.scope.usId).then(onSuccess,onError)},UserStoryDetailController.prototype.onWatch=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadUs(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.userstories.watch(this.scope.usId).then(onSuccess,onError)},UserStoryDetailController.prototype.onUnwatch=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadUs(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.userstories.unwatch(this.scope.usId).then(onSuccess,onError)},UserStoryDetailController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("UserStoryDetailController",UserStoryDetailController),UsStatusDisplayDirective=function($template,$compile){var link,template;return template=$template.get("common/components/status-display.html",!0),link=function($scope,$el,$attrs){var render;return render=function(us){var html,status;return status=$scope.statusById[us.status],html=template({is_closed:us.is_closed,status:status}),html=$compile(html)($scope),$el.html(html)},$scope.$watch($attrs.ngModel,function(us){return null!=us?render(us):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgUsStatusDisplay",["$tgTemplate","$compile",UsStatusDisplayDirective]),UsStatusButtonDirective=function($rootScope,$repo,$confirm,$loading,$qqueue,$template){var link,template;return template=$template.get("us/us-status-button.html",!0),link=function($scope,$el,$attrs,$model){var isEditable,render,save;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_us")},render=function(_this){return function(us){var html,status;return status=$scope.statusById[us.status],html=template({status:status,statuses:$scope.statusList,editable:isEditable()}),$el.html(html)}}(this),save=$qqueue.bindAdd(function(_this){return function(status){var currentLoading,onError,onSuccess,us;return us=$model.$modelValue.clone(),us.status=status,$.fn.popover().closeAll(),currentLoading=$loading().target($el).start(),onSuccess=function(){return $model.$setViewValue(us),$rootScope.$broadcast("object:updated"),currentLoading.finish()},onError=function(){return $confirm.notify("error"),currentLoading.finish()},$repo.save(us).then(onSuccess,onError)}}(this)),$el.on("click",".js-edit-status",function(event){return event.preventDefault(),event.stopPropagation(),isEditable()?$el.find(".pop-status").popover().open():void 0}),$el.on("click",".status",function(event){var status,target;return event.preventDefault(),event.stopPropagation(),isEditable()?(target=angular.element(event.currentTarget),status=target.data("status-id"),save(status)):void 0}),$scope.$watch($attrs.ngModel,function(us){return us?render(us):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgUsStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$tgTemplate",UsStatusButtonDirective]),UsTeamRequirementButtonDirective=function($rootscope,$tgrepo,$confirm,$loading,$qqueue,$template,$compile){var link,template;return template=$template.get("us/us-team-requirement-button.html",!0),link=function($scope,$el,$attrs,$model){var canEdit,render,save;return canEdit=function(){return-1!==$scope.project.my_permissions.indexOf("modify_us")},render=function(us){var ctx,html;return ctx={canEdit:canEdit(),isRequired:us.team_requirement},html=template(ctx),html=$compile(html)($scope),$el.html(html)},save=$qqueue.bindAdd(function(_this){return function(team_requirement){var currentLoading,promise,us;return us=$model.$modelValue.clone(),us.team_requirement=team_requirement,currentLoading=$loading().target($el.find("label")).start(),promise=$tgrepo.save(us),promise.then(function(){return $model.$setViewValue(us),currentLoading.finish(),$rootscope.$broadcast("object:updated")}),promise.then(null,function(){return currentLoading.finish(),$confirm.notify("error")})}}(this)),$el.on("click",".team-requirement",function(event){var team_requirement;if(canEdit())return team_requirement=!$model.$modelValue.team_requirement,save(team_requirement)}),$scope.$watch($attrs.ngModel,function(us){return us?render(us):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgUsTeamRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$tgTemplate","$compile",UsTeamRequirementButtonDirective]),UsClientRequirementButtonDirective=function($rootscope,$tgrepo,$confirm,$loading,$qqueue,$template,$compile){var link,template;return template=$template.get("us/us-client-requirement-button.html",!0),link=function($scope,$el,$attrs,$model){var canEdit,render,save;return canEdit=function(){return-1!==$scope.project.my_permissions.indexOf("modify_us")},render=function(us){var ctx,html;return ctx={canEdit:canEdit(),isRequired:us.client_requirement},html=$compile(template(ctx))($scope),$el.html(html)},save=$qqueue.bindAdd(function(_this){return function(client_requirement){var currentLoading,promise,us;return us=$model.$modelValue.clone(),us.client_requirement=client_requirement,currentLoading=$loading().target($el.find("label")).start(),promise=$tgrepo.save(us),promise.then(function(){return $model.$setViewValue(us),currentLoading.finish(),$rootscope.$broadcast("object:updated")}),promise.then(null,function(){return $confirm.notify("error")})}}(this)),$el.on("click",".client-requirement",function(event){var client_requirement;if(canEdit())return client_requirement=!$model.$modelValue.client_requirement,save(client_requirement)}),$scope.$watch($attrs.ngModel,function(us){return us?render(us):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgUsClientRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$tgTemplate","$compile",UsClientRequirementButtonDirective])}.call(this),function(){var TaskDetailController,TaskIsIocaineButtonDirective,TaskStatusButtonDirective,TaskStatusDisplayDirective,bindMethods,groupBy,mixOf,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,groupBy=this.taiga.groupBy,bindMethods=this.taiga.bindMethods,module=angular.module("taigaTasks"),TaskDetailController=function(superClass){function TaskDetailController(scope,rootscope,repo,confirm,rs,params,q,location,log,appMetaService,navUrls,analytics,translate){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.log=log,this.appMetaService=appMetaService,this.navUrls=navUrls,this.analytics=analytics,this.translate=translate,bindMethods(this),this.scope.taskRef=this.params.taskref,this.scope.sectionName=this.translate.instant("TASK.SECTION_NAME"),this.initializeEventHandlers(),promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this._setMeta(),_this.initializeOnDeleteGoToUrl()}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(TaskDetailController,superClass),TaskDetailController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate"],TaskDetailController.prototype._setMeta=function(){var description,ref,title;return title=this.translate.instant("TASK.PAGE_TITLE",{taskRef:"#"+this.scope.task.ref,taskSubject:this.scope.task.subject,projectName:this.scope.project.name}),description=this.translate.instant("TASK.PAGE_DESCRIPTION",{taskStatus:(null!=(ref=this.scope.statusById[this.scope.task.status])?ref.name:void 0)||"--",taskDescription:angular.element(this.scope.task.description_html||"").text()}),this.appMetaService.setAll(title,description)},TaskDetailController.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(_this){return function(){return _this.analytics.trackEvent("attachment","create","create attachment on task",1)}}(this)),this.scope.$on("custom-attributes-values:edit",function(_this){return function(){return _this.rootscope.$broadcast("object:updated")}}(this)),this.scope.$on("comment:new",function(_this){return function(){return _this.loadTask()}}(this))},TaskDetailController.prototype.initializeOnDeleteGoToUrl=function(){var ctx;if(ctx={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",ctx),this.scope.project.is_backlog_activated){if(this.scope.task.milestone)return ctx.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",ctx);if(this.scope.task.us)return ctx.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",ctx)}else if(this.scope.project.is_kanban_activated&&this.scope.us)return ctx.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",ctx)},TaskDetailController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.statusList=project.task_statuses,_this.scope.statusById=groupBy(project.task_statuses,function(x){return x.id}),project}}(this))},TaskDetailController.prototype.loadTask=function(){return this.rs.tasks.getByRef(this.scope.projectId,this.params.taskref).then(function(_this){return function(task){var ctx,ref,ref1;return _this.scope.task=task,_this.scope.taskId=task.id,_this.scope.commentModel=task,null!=(null!=(ref=_this.scope.task.neighbors.previous)?ref.ref:void 0)&&(ctx={project:_this.scope.project.slug,ref:_this.scope.task.neighbors.previous.ref},_this.scope.previousUrl=_this.navUrls.resolve("project-tasks-detail",ctx)),null!=(null!=(ref1=_this.scope.task.neighbors.next)?ref1.ref:void 0)&&(ctx={project:_this.scope.project.slug,ref:_this.scope.task.neighbors.next.ref},_this.scope.nextUrl=_this.navUrls.resolve("project-tasks-detail",ctx)),task}}(this))},TaskDetailController.prototype.loadSprint=function(){return this.scope.task.milestone?this.rs.sprints.get(this.scope.task.project,this.scope.task.milestone).then(function(_this){return function(sprint){return _this.scope.sprint=sprint,sprint}}(this)):void 0},TaskDetailController.prototype.loadUserStory=function(){return this.scope.task.user_story?this.rs.userstories.get(this.scope.task.project,this.scope.task.user_story).then(function(_this){return function(us){return _this.scope.us=us,us}}(this)):void 0},TaskDetailController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.members,project.roles),_this.loadTask().then(function(){return _this.q.all([_this.loadSprint(),_this.loadUserStory()])})}}(this))},TaskDetailController.prototype.onUpvote=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadTask(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.tasks.upvote(this.scope.taskId).then(onSuccess,onError)},TaskDetailController.prototype.onDownvote=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadTask(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.tasks.downvote(this.scope.taskId).then(onSuccess,onError)},TaskDetailController.prototype.onWatch=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadTask(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.tasks.watch(this.scope.taskId).then(onSuccess,onError)},TaskDetailController.prototype.onUnwatch=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.loadTask(),_this.rootscope.$broadcast("object:updated")}}(this),onError=function(_this){return function(){return _this.confirm.notify("error")}}(this),this.rs.tasks.unwatch(this.scope.taskId).then(onSuccess,onError)},TaskDetailController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("TaskDetailController",TaskDetailController),TaskStatusDisplayDirective=function($template,$compile){var link,template;return template=$template.get("common/components/status-display.html",!0),link=function($scope,$el,$attrs){var render;return render=function(task){var html,status;return status=$scope.statusById[task.status],html=template({is_closed:status.is_closed,status:status}),html=$compile(html)($scope),$el.html(html)},$scope.$watch($attrs.ngModel,function(task){return null!=task?render(task):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgTaskStatusDisplay",["$tgTemplate","$compile",TaskStatusDisplayDirective]),TaskStatusButtonDirective=function($rootScope,$repo,$confirm,$loading,$qqueue,$compile,$translate,$template){var link,template;return template=$template.get("us/us-status-button.html",!0),link=function($scope,$el,$attrs,$model){var isEditable,render,save;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_task")},render=function(_this){return function(task){var html,status;return status=$scope.statusById[task.status],html=$compile(template({status:status,statuses:$scope.statusList,editable:isEditable()}))($scope),$el.html(html)}}(this),save=$qqueue.bindAdd(function(_this){return function(status){var currentLoading,onError,onSuccess,task;return task=$model.$modelValue.clone(),task.status=status,currentLoading=$loading().target($el).start(),onSuccess=function(){return $model.$setViewValue(task),$rootScope.$broadcast("object:updated"),currentLoading.finish()},onError=function(){return $confirm.notify("error"),currentLoading.finish()},$repo.save(task).then(onSuccess,onError)}}(this)),$el.on("click",".js-edit-status",function(event){return event.preventDefault(),event.stopPropagation(),isEditable()?$el.find(".pop-status").popover().open():void 0}),$el.on("click",".status",function(event){var target;return event.preventDefault(),event.stopPropagation(),isEditable()?(target=angular.element(event.currentTarget),$.fn.popover().closeAll(),save(target.data("status-id"))):void 0}),$scope.$watch($attrs.ngModel,function(task){return task?render(task):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgTaskStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$compile","$translate","$tgTemplate",TaskStatusButtonDirective]),TaskIsIocaineButtonDirective=function($rootscope,$tgrepo,$confirm,$loading,$qqueue,$compile,$template){var link,template;return template=$template.get("issue/iocaine-button.html",!0),link=function($scope,$el,$attrs,$model){var isEditable,render,save;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_task")},render=function(task){var ctx,html;return isEditable()||task.is_iocaine?(ctx={isIocaine:task.is_iocaine,isEditable:isEditable()},html=$compile(template(ctx))($scope),$el.html(html)):void $el.html("")},save=$qqueue.bindAdd(function(_this){return function(is_iocaine){var currentLoading,promise,task;return task=$model.$modelValue.clone(),task.is_iocaine=is_iocaine,currentLoading=$loading().target($el.find("label")).start(),promise=$tgrepo.save(task),promise.then(function(){return $model.$setViewValue(task),$rootscope.$broadcast("object:updated")}),promise.then(null,function(){return $confirm.notify("error")}),promise["finally"](function(){return currentLoading.finish()})}}(this)),$el.on("click",".is-iocaine",function(event){var is_iocaine;if(isEditable())return is_iocaine=!$model.$modelValue.is_iocaine,save(is_iocaine)}),$scope.$watch($attrs.ngModel,function(task){return task?render(task):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgTaskIsIocaineButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQqueue","$compile","$tgTemplate",TaskIsIocaineButtonDirective])}.call(this),function(){var LeaveProjectDirective,TeamController,TeamFiltersDirective,TeamMemberCurrentUserDirective,TeamMemberStatsDirective,TeamMembersDirective,membersFilter,mixOf,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,module=angular.module("taigaTeam"),TeamController=function(superClass){function TeamController(scope,rootscope,repo,rs,params,q,location,navUrls,appMetaService,auth,translate,projectService){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.rs=rs,this.params=params,this.q=q,this.location=location,this.navUrls=navUrls,this.appMetaService=appMetaService,this.auth=auth,this.translate=translate,this.projectService=projectService,this.scope.sectionName="TEAM.SECTION_NAME",promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("TEAM.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.translate.instant("TEAM.PAGE_DESCRIPTION",{projectName:_this.scope.project.name,projectDescription:_this.scope.project.description}),_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(TeamController,superClass),TeamController.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$location","$tgNavUrls","tgAppMetaService","$tgAuth","$translate","tgProjectService"],TeamController.prototype.setRole=function(role){return role?this.scope.filtersRole=role:this.scope.filtersRole=null},TeamController.prototype.loadMembers=function(){var i,len,member,ref,user;for(user=this.auth.getUser(),this.scope.totals={},ref=this.scope.activeUsers,i=0,len=ref.length;len>i;i++)member=ref[i],this.scope.totals[member.id]=0;return this.scope.currentUser=_.find(this.scope.activeUsers,{id:null!=user?user.id:void 0}),this.scope.memberships=_.reject(this.scope.activeUsers,{id:null!=user?user.id:void 0})},TeamController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.issuesEnabled=project.is_issues_activated,_this.scope.tasksEnabled=project.is_kanban_activated||project.is_backlog_activated,_this.scope.wikiEnabled=project.is_wiki_activated,_this.scope.owner=project.owner.id,project}}(this))},TeamController.prototype.loadMemberStats=function(){return this.rs.projects.memberStats(this.scope.projectId).then(function(_this){return function(stats){var totals;return totals={},_.forEach(_this.scope.totals,function(total,userId){var vals;return vals=_.map(stats,function(memberStats,statsKey){return memberStats[userId]}),total=_.reduce(vals,function(sum,el){return sum+el}),_this.scope.totals[userId]=total}),_this.scope.stats=_this._processStats(stats),_this.scope.stats.totals=_this.scope.totals}}(this))},TeamController.prototype._processStat=function(stat){var key,max,min,singleStat,value;max=_.max(_.toArray(stat)),min=_.min(_.toArray(stat)),singleStat=Object();for(key in stat)hasProp.call(stat,key)&&(value=stat[key],value===min?singleStat[key]=.1:value===max?singleStat[key]=1:singleStat[key]=.5*value/max);return singleStat},TeamController.prototype._processStats=function(stats){var key,value;for(key in stats)value=stats[key],stats[key]=this._processStat(value);return stats},TeamController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){var userRoles;return _this.fillUsersAndRoles(project.members,project.roles),_this.loadMembers(),userRoles=_.map(_this.scope.users,function(user){return user.role}),_this.scope.roles=_.filter(_this.scope.roles,function(role){return-1!==userRoles.indexOf(role.id)}),_this.loadMemberStats()}}(this))},TeamController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("TeamController",TeamController),TeamFiltersDirective=function(){return{templateUrl:"team/team-filter.html"}},module.directive("tgTeamFilters",[TeamFiltersDirective]),TeamMemberStatsDirective=function(){return{templateUrl:"team/team-member-stats.html",scope:{stats:"=",userId:"=user",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled"}}},module.directive("tgTeamMemberStats",TeamMemberStatsDirective),TeamMemberCurrentUserDirective=function(){return{templateUrl:"team/team-member-current-user.html",scope:{project:"=project",currentUser:"=currentuser",stats:"=",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled",owner:"=owner"}}},module.directive("tgTeamCurrentUser",TeamMemberCurrentUserDirective),TeamMembersDirective=function(){var template;return template="team/team-members.html",{templateUrl:template,scope:{memberships:"=",filtersQ:"=filtersq",filtersRole:"=filtersrole",stats:"=",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled",owner:"=owner"}}},module.directive("tgTeamMembers",TeamMembersDirective),LeaveProjectDirective=function($repo,$confirm,$location,$rs,$navurls,$translate,lightboxFactory,currentUserService){var link;return link=function($scope,$el,$attrs){var leaveConfirm;return leaveConfirm=function(){var confirm_leave_project_text,leave_project_text;return leave_project_text=$translate.instant("TEAM.ACTION_LEAVE_PROJECT"),confirm_leave_project_text=$translate.instant("TEAM.CONFIRM_LEAVE_PROJECT"),$confirm.ask(leave_project_text,confirm_leave_project_text).then(function(_this){return function(response){var promise;return promise=$rs.projects.leave($scope.project.id),promise.then(function(){return currentUserService.loadProjects().then(function(){return response.finish(),$confirm.notify("success"),$location.path($navurls.resolve("home"))})}),promise.then(null,function(response){return response.finish(),$confirm.notify("error",response.data._error_message)})}}(this))},$scope.leave=function(){return $scope.project.owner.id===$scope.user.id?lightboxFactory.create("tg-lightbox-leave-project-warning",{"class":"lightbox lightbox-leave-project-warning"},{isCurrentUser:!0,project:$scope.project}):leaveConfirm()}},{scope:{user:"=",project:"="},templateUrl:"team/leave-project.html",link:link}},module.directive("tgLeaveProject",["$tgRepo","$tgConfirm","$tgLocation","$tgResources","$tgNavUrls","$translate","tgLightboxFactory","tgCurrentUserService",LeaveProjectDirective]),membersFilter=function(){return function(members,filtersQ,filtersRole){return _.filter(members,function(m){return(!filtersRole||m.role===filtersRole.id)&&(!filtersQ||m.full_name.search(new RegExp(filtersQ,"i"))>=0)})}},module.filter("membersFilter",membersFilter)}.call(this),function(){var EditableWikiContentDirective,WikiDetailController,WikiSummaryDirective,bindOnce,debounce,groupBy,mixOf,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,module=angular.module("taigaWiki"),WikiDetailController=function(superClass){function WikiDetailController(scope,rootscope,repo,model,confirm,rs,params,q,location,filter,log,appMetaService,navUrls,analytics,translate){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.model=model,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.filter=filter,this.log=log,this.appMetaService=appMetaService,this.navUrls=navUrls,this.analytics=analytics,this.translate=translate,this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.wikiTitle=this.scope.wikiSlug,this.scope.sectionName="Wiki", -this.scope.linksVisible=!1,promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this._setMeta()}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(WikiDetailController,superClass),WikiDetailController.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$filter","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate"],WikiDetailController.prototype._setMeta=function(){var description,ref,ref1,ref2,title;return title=this.translate.instant("WIKI.PAGE_TITLE",{wikiPageName:this.scope.wikiTitle,projectName:this.scope.project.name}),description=this.translate.instant("WIKI.PAGE_DESCRIPTION",{wikiPageContent:angular.element((null!=(ref=this.scope.wiki)?ref.html:void 0)||"").text(),totalEditions:(null!=(ref1=this.scope.wiki)?ref1.editions:void 0)||0,lastModifiedDate:moment(null!=(ref2=this.scope.wiki)?ref2.modified_date:void 0).format(this.translate.instant("WIKI.DATETIME"))}),this.appMetaService.setAll(title,description)},WikiDetailController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.is_wiki_activated||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},WikiDetailController.prototype.loadWiki=function(){var promise;return promise=this.rs.wiki.getBySlug(this.scope.projectId,this.params.slug),promise.then(function(_this){return function(wiki){return _this.scope.wiki=wiki,_this.scope.wikiId=wiki.id,_this.scope.wiki}}(this)),promise.then(null,function(_this){return function(xhr){var data;return _this.scope.wikiId=null,-1===_this.scope.project.my_permissions.indexOf("add_wiki_page")?null:(data={project:_this.scope.projectId,slug:_this.scope.wikiSlug,content:""},_this.scope.wiki=_this.model.make_model("wiki",data),_this.scope.wiki)}}(this))},WikiDetailController.prototype.loadWikiLinks=function(){return this.rs.wiki.listLinks(this.scope.projectId).then(function(_this){return function(wikiLinks){var selectedWikiLink;return _this.scope.wikiLinks=wikiLinks,selectedWikiLink=_.find(wikiLinks,{href:_this.scope.wikiSlug}),null!=selectedWikiLink?_this.scope.wikiTitle=selectedWikiLink.title:void 0}}(this))},WikiDetailController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.members,project.roles),_this.q.all([_this.loadWikiLinks(),_this.loadWiki()]).then(_this.checkLinksPerms.bind(_this))}}(this))},WikiDetailController.prototype.checkLinksPerms=function(){return-1!==this.scope.project.my_permissions.indexOf("modify_wiki_link")||-1!==this.scope.project.my_permissions.indexOf("view_wiki_links")&&this.scope.wikiLinks.length?this.scope.linksVisible=!0:void 0},WikiDetailController.prototype["delete"]=function(){var message,title;return title=this.translate.instant("WIKI.DELETE_LIGHTBOX_TITLE"),message=this.scope.wikiTitle,this.confirm.askOnDelete(title,message).then(function(_this){return function(askResponse){var onError,onSuccess;return onSuccess=function(){var ctx;return askResponse.finish(),ctx={project:_this.scope.projectSlug},_this.location.path(_this.navUrls.resolve("project-wiki",ctx)),_this.confirm.notify("success")},onError=function(){return askResponse.finish(!1),_this.confirm.notify("error")},_this.repo.remove(_this.scope.wiki).then(onSuccess,onError)}}(this))},WikiDetailController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("WikiDetailController",WikiDetailController),WikiSummaryDirective=function($log,$template,$compile,$translate){var link,template;return template=$template.get("wiki/wiki-summary.html",!0),link=function($scope,$el,$attrs,$model){var render;return render=function(wiki){var ctx,html,user;return null==$scope.usersById?$log.error("WikiSummaryDirective requires userById set in scope."):user=$scope.usersById[wiki.last_modifier],user=void 0===user?{name:"unknown",imgUrl:"/"+window._version+"/images/user-noimage.png"}:{name:user.full_name_display,imgUrl:user.photo},ctx={totalEditions:wiki.editions,lastModifiedDate:moment(wiki.modified_date).format($translate.instant("WIKI.DATETIME")),user:user},html=template(ctx),html=$compile(html)($scope),$el.html(html)},$scope.$watch($attrs.ngModel,function(wikiPage){return wikiPage?render(wikiPage):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgWikiSummary",["$log","$tgTemplate","$compile","$translate",WikiSummaryDirective]),EditableWikiContentDirective=function($window,$document,$repo,$confirm,$loading,$analytics,$qqueue){var link;return link=function($scope,$el,$attrs,$model){var cancelEdition,disableEdition,getSelectedText,isEditable,save,switchToEditMode,switchToReadMode;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_wiki_page")},switchToEditMode=function(){return $el.find(".edit-wiki-content").show(),$el.find(".view-wiki-content").hide(),$el.find("textarea").focus()},switchToReadMode=function(){return $el.find(".edit-wiki-content").hide(),$el.find(".view-wiki-content").show()},disableEdition=function(){return $el.find(".view-wiki-content .edit").remove(),$el.find(".edit-wiki-content").remove()},cancelEdition=function(){return $model.$modelValue.id?($scope.$apply(function(_this){return function(){return $model.$modelValue.revert()}}(this)),switchToReadMode()):void 0},getSelectedText=function(){return $window.getSelection?$window.getSelection().toString():$document.selection?$document.selection.createRange().text:null},save=$qqueue.bindAdd(function(wiki){var currentLoading,onError,onSuccess,promise;return onSuccess=function(wikiPage){return null==wiki.id&&$analytics.trackEvent("wikipage","create","create wiki page",1),$model.$setViewValue(wikiPage.clone()),$confirm.notify("success"),switchToReadMode()},onError=function(){return $confirm.notify("error")},currentLoading=$loading().removeClasses("icon-floppy").target($el.find(".icon-floppy")).start(),promise=null!=wiki.id?$repo.save(wiki).then(onSuccess,onError):$repo.create("wiki",wiki).then(onSuccess,onError),promise["finally"](function(){return currentLoading.finish()})}),$el.on("click","a",function(event){var href,target;return target=angular.element(event.target),href=target.attr("href"),0===href.indexOf("#")?(event.preventDefault(),$("body").scrollTop($(href).offset().top)):void 0}),$el.on("mousedown",".view-wiki-content",function(event){var target;target=angular.element(event.target),isEditable()&&2===event.button}),$el.on("mouseup",".view-wiki-content",function(event){var target;return target=angular.element(event.target),getSelectedText()||!isEditable()||target.is("a")||target.is("pre")?void 0:switchToEditMode()}),$el.on("click",".save",debounce(2e3,function(){return save($scope.wiki)})),$el.on("click",".cancel",function(){return cancelEdition()}),$el.on("keydown","textarea",function(event){return 27===event.keyCode?cancelEdition():void 0}),$scope.$watch($attrs.ngModel,function(wikiPage){return wikiPage?isEditable()?($el.addClass("editable"),null==wikiPage.id||0===$.trim(wikiPage.content).length?switchToEditMode():void 0):disableEdition():void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel",templateUrl:"wiki/editable-wiki-content.html"}},module.directive("tgEditableWikiContent",["$window","$document","$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics","$tgQqueue",EditableWikiContentDirective])}.call(this),function(){var WikiNavDirective,bindOnce,groupBy,mixOf,module,taiga;taiga=this.taiga,mixOf=this.taiga.mixOf,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,module=angular.module("taigaWiki"),WikiNavDirective=function($tgrepo,$log,$location,$confirm,$navUrls,$analytics,$loading,$template,$compile,$translate){var link,template;return template=$template.get("wiki/wiki-nav.html",!0),link=function($scope,$el,$attrs){var $ctrl,render;return $ctrl=$el.controller(),null==$attrs.ngModel?$log.error("WikiNavDirective: no ng-model attr is defined"):(render=function(wikiLinks){var addWikiLinkPermission,deleteWikiLinkPermission,html;return addWikiLinkPermission=$scope.project.my_permissions.indexOf("add_wiki_link")>-1,deleteWikiLinkPermission=$scope.project.my_permissions.indexOf("delete_wiki_link")>-1,html=template({wikiLinks:wikiLinks,projectSlug:$scope.projectSlug,addWikiLinkPermission:addWikiLinkPermission,deleteWikiLinkPermission:deleteWikiLinkPermission}),html=$compile(html)($scope),$el.off(),$el.html(html),$el.on("click",".wiki-link .link-title",function(event){var linkId,linkSlug,target;return event.preventDefault(),target=angular.element(event.currentTarget),linkId=target.parents(".wiki-link").data("id"),linkSlug=$scope.wikiLinks[linkId].href,$scope.$apply(function(){var ctx;return ctx={project:$scope.projectSlug,slug:linkSlug},$location.path($navUrls.resolve("project-wiki-page",ctx))})}),$el.on("click",".add-button",function(event){return event.preventDefault(),$el.find(".new").removeClass("hidden"),$el.find(".new input").focus(),$el.find(".add-button").hide()}),$el.on("click",".wiki-link .icon-delete",function(event){var linkId,message,target,title;return event.preventDefault(),event.stopPropagation(),target=angular.element(event.currentTarget),linkId=target.parents(".wiki-link").data("id"),title=$translate.instant("WIKI.DELETE_LIGHTBOX_TITLE"),message=$scope.wikiLinks[linkId].title,$confirm.askOnDelete(title,message).then(function(_this){return function(askResponse){var promise;return promise=$tgrepo.remove($scope.wikiLinks[linkId]),promise.then(function(){return promise=$ctrl.loadWikiLinks(),promise.then(function(){return askResponse.finish(),render($scope.wikiLinks)}),promise.then(null,function(){return askResponse.finish()})}),promise.then(null,function(){return askResponse.finish(!1),$confirm.notify("error")})}}(this))}),$el.on("keyup",".new input",function(event){var currentLoading,newLink,promise,target;return event.preventDefault(),13===event.keyCode?(target=angular.element(event.currentTarget),newLink=target.val(),currentLoading=$loading().target($el.find(".new")).start(),promise=$tgrepo.create("wiki-links",{project:$scope.projectId,title:newLink}),promise.then(function(){var loadPromise;return $analytics.trackEvent("wikilink","create","create wiki link",1),loadPromise=$ctrl.loadWikiLinks(),loadPromise.then(function(){return currentLoading.finish(),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show(),render($scope.wikiLinks)}),loadPromise.then(null,function(){return currentLoading.finish(),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show(),$confirm.notify("error","Error loading wiki links")})}),promise.then(null,function(error){var ref;return currentLoading.finish(),$el.find(".new input").val(newLink),$el.find(".new input").focus().select(),null!=(null!=error&&null!=(ref=error.__all__)?ref[0]:void 0)?$confirm.notify("error","The link already exists"):$confirm.notify("error")})):27===event.keyCode?(target=angular.element(event.currentTarget),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show()):void 0})},bindOnce($scope,$attrs.ngModel,render))},{link:link}},module.directive("tgWikiNav",["$tgRepo","$log","$tgLocation","$tgConfirm","$tgNavUrls","$tgAnalytics","$tgLoading","$tgTemplate","$compile","$translate",WikiNavDirective])}.call(this),function(){var ChangeOwnerLightboxController,ChangeOwnerLightboxDirective,LbRequestOwnershipDirective,LightboxAddMembersController,LightboxAddMembersDirective,LightboxAddMembersWarningMessageDirective,TransferProjectStartSuccessDirective,debounce,module,taiga;taiga=this.taiga,debounce=this.taiga.debounce,module=angular.module("taigaKanban"),LightboxAddMembersController=function(){function LightboxAddMembersController(scope1,lightboxService1,tgLoader,confirm,rs1,rootScope){var pendingMembersCount;this.scope=scope1,this.lightboxService=lightboxService1,this.tgLoader=tgLoader,this.confirm=confirm,this.rs=rs1,this.rootScope=rootScope,this._defaultMaxInvites=4,this._defaultRole=this.project.roles[0].id,this.form=null,this.submitInvites=!1,this.canAddUsers=!0,this.memberInvites=[],null===this.project.max_memberships?this.membersLimit=this._defaultMaxInvites:(pendingMembersCount=Math.max(this.project.max_memberships-this.project.total_memberships,0),this.membersLimit=Math.min(pendingMembersCount,this._defaultMaxInvites)),this.addSingleMember()}return LightboxAddMembersController.$inject=["$scope","lightboxService","tgLoader","$tgConfirm","$tgResources","$rootScope"],LightboxAddMembersController.prototype.addSingleMember=function(){return this.memberInvites.push({email:"",role_id:this._defaultRole}),this.memberInvites.length>=this.membersLimit&&(this.canAddUsers=!1),this.showWarningMessage=!this.canAddUsers&&this.project.total_memberships+this.memberInvites.length===this.project.max_memberships},LightboxAddMembersController.prototype.removeSingleMember=function(index){return this.memberInvites.splice(index,1),this.canAddUsers=!0,this.showWarningMessage=1===this.membersLimit},LightboxAddMembersController.prototype.submit=function(){var promise;return this.form.initializeFields(),this.form.reset(),this.form.validate()?(this.memberInvites=_.filter(this.memberInvites,function(invites){return""!==invites.email}),this.submitInvites=!0,promise=this.rs.memberships.bulkCreateMemberships(this.project.id,this.memberInvites,this.invitationText),promise.then(this._onSuccessInvite.bind(this),this._onErrorInvite.bind(this))):void 0},LightboxAddMembersController.prototype._onSuccessInvite=function(){return this.submitInvites=!1,this.rootScope.$broadcast("membersform:new:success"),this.lightboxService.closeAll(),this.confirm.notify("success")},LightboxAddMembersController.prototype._onErrorInvite=function(response){return this.submitInvites=!1,this.form.setErrors(response.data),response.data._error_message?this.confirm.notify("error",response.data._error_message):void 0},LightboxAddMembersController}(),module.controller("LbAddMembersController",LightboxAddMembersController),LightboxAddMembersDirective=function(lightboxService){var link;return link=function(scope,el,attrs,ctrl){return lightboxService.open(el),ctrl.form=el.find("form").checksley()},{scope:{},bindToController:{project:"="},controller:"LbAddMembersController",controllerAs:"vm",templateUrl:"admin/lightbox-add-members.html",link:link}},module.directive("tgLbAddMembers",["lightboxService",LightboxAddMembersDirective]),LightboxAddMembersWarningMessageDirective=function(){return{templateUrl:"admin/lightbox-add-members-no-more=memberships-warning-message.html",scope:{project:"="}}},module.directive("tgLightboxAddMembersWarningMessage",[LightboxAddMembersWarningMessageDirective]),LbRequestOwnershipDirective=function(lightboxService,rs,confirmService,$translate){return{link:function(scope,el){return lightboxService.open(el),scope.request=function(){return scope.loading=!0,rs.projects.transferRequest(scope.projectId).then(function(){return scope.loading=!1,lightboxService.close(el),confirmService.notify("success",$translate.instant("ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP_SUCCESS"))})}},templateUrl:"common/lightbox/lightbox-request-ownership.html"}},module.directive("tgLbRequestOwnership",["lightboxService","tgResources","$tgConfirm","$translate",LbRequestOwnershipDirective]),ChangeOwnerLightboxController=function(){function ChangeOwnerLightboxController(rs1,lightboxService1,confirm,translate){this.rs=rs1,this.lightboxService=lightboxService1,this.confirm=confirm,this.translate=translate,this.users=[],this.q="",this.commentOpen=!1}return ChangeOwnerLightboxController.prototype.limit=3,ChangeOwnerLightboxController.prototype.normalizeString=function(normalizedString){return normalizedString=normalizedString.replace("Á","A").replace("Ä","A").replace("À","A"),normalizedString=normalizedString.replace("É","E").replace("Ë","E").replace("È","E"),normalizedString=normalizedString.replace("Í","I").replace("Ï","I").replace("Ì","I"),normalizedString=normalizedString.replace("Ó","O").replace("Ö","O").replace("Ò","O"),normalizedString=normalizedString.replace("Ú","U").replace("Ü","U").replace("Ù","U")},ChangeOwnerLightboxController.prototype.filterUsers=function(user){var text,username;return username=user.full_name_display.toUpperCase(),username=this.normalizeString(username),text=this.q.toUpperCase(),text=this.normalizeString(text),_.includes(username,text)},ChangeOwnerLightboxController.prototype.getUsers=function(){var users;return users=this.users.length||this.q.length?this.users:this.activeUsers,users=users.slice(0,this.limit),users=_.reject(users,{selected:!0}),_.reject(users,{id:this.currentOwnerId})},ChangeOwnerLightboxController.prototype.userSearch=function(){return this.users=this.activeUsers,this.selected=_.find(this.users,{selected:!0}),this.q?this.users=_.filter(this.users,this.filterUsers.bind(this)):void 0},ChangeOwnerLightboxController.prototype.selectUser=function(user){return this.activeUsers=_.map(this.activeUsers,function(user){return user.selected=!1,user}),user.selected=!0,this.userSearch()},ChangeOwnerLightboxController.prototype.submit=function(){return this.loading=!0,this.rs.projects.transferStart(this.projectId,this.selected.id,this.comment).then(function(_this){return function(){var desc,title;return _this.loading=!1,_this.lightboxService.closeAll(),title=_this.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_TITLE"),desc=_this.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_DESC"),_this.confirm.success(title,desc,{type:"svg",name:"icon-speak-up"})}}(this))},ChangeOwnerLightboxController}(),ChangeOwnerLightboxController.$inject=["tgResources","lightboxService","$tgConfirm","$translate"],module.controller("ChangeOwnerLightbox",ChangeOwnerLightboxController),ChangeOwnerLightboxDirective=function(lightboxService,lightboxKeyboardNavigationService,$template,$compile){var link;return link=function(scope,el){return lightboxService.open(el)},{scope:!0,controller:"ChangeOwnerLightbox",controllerAs:"vm",bindToController:{currentOwnerId:"=",projectId:"=",activeUsers:"="},templateUrl:"common/lightbox/lightbox-change-owner.html",link:link}},module.directive("tgLbChangeOwner",["lightboxService","lightboxKeyboardNavigationService","$tgTemplate","$compile",ChangeOwnerLightboxDirective]),TransferProjectStartSuccessDirective=function(lightboxService){var link;return link=function(scope,el){return scope.close=function(){return lightboxService.close(el)},lightboxService.open(el)},{templateUrl:"common/lightbox/lightbox-transfer-project-start-success.html",link:link}},module.directive("tgLbTransferProjectStartSuccess",["lightboxService",TransferProjectStartSuccessDirective])}.call(this),function(){var MembershipsController,MembershipsDirective,MembershipsRowActionsDirective,MembershipsRowAdminCheckboxDirective,MembershipsRowAvatarDirective,MembershipsRowRoleSelectorDirective,NoMoreMembershipsExplanationDirective,bindMethods,mixOf,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,bindMethods=this.taiga.bindMethods,module=angular.module("taigaAdmin"),MembershipsController=function(superClass){function MembershipsController(scope,rootscope,repo,confirm,rs,params,q,location,navUrls,analytics,appMetaService,translate,auth,lightboxFactory1){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.navUrls=navUrls,this.analytics=analytics,this.appMetaService=appMetaService,this.translate=translate,this.auth=auth,this.lightboxFactory=lightboxFactory1,bindMethods(this),this.scope.project={},this.scope.filters={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ADMIN.MEMBERSHIPS.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("membersform:new:success",function(_this){return function(){return _this.loadInitialData(),_this.analytics.trackEvent("membership","create","create memberships on admin",1)}}(this))}return extend(MembershipsController,superClass),MembershipsController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAnalytics","tgAppMetaService","$translate","$tgAuth","tgLightboxFactory"],MembershipsController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.i_am_admin||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.canAddUsers=null===project.max_memberships||project.max_memberships>project.total_memberships,_this.scope.$emit("project:loaded",project),project}}(this))},MembershipsController.prototype.loadMembers=function(){var httpFilters;return httpFilters=this.getUrlFilters(),this.rs.memberships.list(this.scope.projectId,httpFilters).then(function(_this){return function(data){return _this.scope.memberships=_.filter(data.models,function(membership){return null===membership.user||membership.is_user_active}),_this.scope.page=data.current,_this.scope.count=data.count,_this.scope.paginatedBy=data.paginatedBy,data}}(this))},MembershipsController.prototype.loadInitialData=function(){return this.loadProject().then(function(_this){return function(){return _this.q.all([_this.loadMembers(),_this.auth.refresh()])}}(this))},MembershipsController.prototype.getUrlFilters=function(){var filters;return filters=_.pick(this.location.search(),"page"),filters.page||(filters.page=1),filters},MembershipsController.prototype.addNewMembers=function(){return this.lightboxFactory.create("tg-lb-add-members",{"class":"lightbox lightbox-add-member",project:"project"},{project:this.scope.project})},MembershipsController.prototype.showLimitUsersWarningMessage=function(){var icon,message,title;return title=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING"),message=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING_MESSAGE",{members:this.scope.project.max_memberships}),icon="/"+window._version+"/svg/icons/team-question.svg",this.confirm.success(title,message,{name:icon,type:"img"})},MembershipsController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("MembershipsController",MembershipsController),MembershipsDirective=function($template,$compile){var link,linkPagination,template;return template=$template.get("admin/admin-membership-paginator.html",!0),linkPagination=function($scope,$el,$attrs,$ctrl){var $pagEl,afterCurrent,atBegin,atEnd,beforeCurrent,getNumPages,renderPagination;return afterCurrent=2,beforeCurrent=4,atBegin=2,atEnd=2,$pagEl=$el.find(".memberships-paginator"),getNumPages=function(){var numPages;return numPages=$scope.count/$scope.paginatedBy,numPages=parseInt(numPages,10)=numPages)return void $pagEl.hide();for(pages=[],options={},options.pages=pages,options.showPrevious=$scope.page>1,options.showNext=!($scope.page===numPages),cpage=$scope.page,i=j=1,ref=numPages;ref>=1?ref>=j:j>=ref;i=ref>=1?++j:--j)i===cpage+afterCurrent&&numPages>cpage+afterCurrent+atEnd?pages.push({classes:"dots",type:"dots"}):i===cpage-beforeCurrent&&cpage>atBegin+beforeCurrent?pages.push({classes:"dots",type:"dots"}):i>cpage+afterCurrent&&numPages-atEnd>=i||cpage-beforeCurrent>i&&i>atBegin||(i===cpage?pages.push({classes:"active",num:i,type:"page-active"}):pages.push({classes:"page",num:i,type:"page"}));return html=template(options),html=$compile(html)($scope),$pagEl.html(html),$pagEl.show()},$scope.$watch("memberships",function(value){return value?renderPagination():void 0}),$el.on("click",".memberships-paginator a.next",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page+1),$ctrl.loadMembers()})}),$el.on("click",".memberships-paginator a.previous",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page-1),$ctrl.loadMembers()})}),$el.on("click",".memberships-paginator li.page > a",function(event){var pagenum,target;return event.preventDefault(),target=angular.element(event.currentTarget),pagenum=target.data("pagenum"),$scope.$apply(function(){return $ctrl.selectFilter("page",pagenum),$ctrl.loadMembers()})})},link=function($scope,$el,$attrs){var $ctrl;return $ctrl=$el.controller(),linkPagination($scope,$el,$attrs,$ctrl),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgMemberships",["$tgTemplate","$compile",MembershipsDirective]),MembershipsRowAvatarDirective=function($log,$template,$translate){var link,template;return template=$template.get("admin/memberships-row-avatar.html",!0),link=function($scope,$el,$attrs){var member,pending,render;return pending=$translate.instant("ADMIN.MEMBERSHIP.STATUS_PENDING"),render=function(member){var ctx,html;return ctx={full_name:member.full_name?member.full_name:"",email:member.user_email?member.user_email:member.email,imgurl:member.photo?member.photo:"/"+window._version+"/images/unnamed.png",pending:member.is_user_active?"":pending,isOwner:member.is_owner},html=template(ctx),$el.html(html)},null==$attrs.tgMembershipsRowAvatar?$log.error("MembershipsRowAvatarDirective: the directive need a member"):(member=$scope.$eval($attrs.tgMembershipsRowAvatar),render(member),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowAvatar",["$log","$tgTemplate","$translate",MembershipsRowAvatarDirective]),MembershipsRowAdminCheckboxDirective=function($log,$repo,$confirm,$template,$compile){var link,template;return template=$template.get("admin/admin-memberships-row-checkbox.html",!0),link=function($scope,$el,$attrs){var html,member,render;return $scope.$on("$destroy",function(){return $el.off()}),null==$attrs.tgMembershipsRowAdminCheckbox?$log.error("MembershipsRowAdminCheckboxDirective: the directive need a member"):(member=$scope.$eval($attrs.tgMembershipsRowAdminCheckbox),member.is_owner?void $el.find(".js-check").remove():(render=function(member){var ctx,html;return ctx={inputId:"is-admin-"+member.id},html=template(ctx),html=$compile(html)($scope),$el.html(html)},$el.on("click",":checkbox",function(_this){return function(event){var onError,onSuccess,target;return onSuccess=function(){return $confirm.notify("success")},onError=function(data){return member.revert(),$el.find(":checkbox").prop("checked",member.is_admin),$confirm.notify("error",data.is_admin[0])},target=angular.element(event.currentTarget),member.is_admin=target.prop("checked"),$repo.save(member).then(onSuccess,onError)}}(this)),html=render(member),member.is_admin?$el.find(":checkbox").prop("checked",!0):void 0))},{link:link}},module.directive("tgMembershipsRowAdminCheckbox",["$log","$tgRepo","$tgConfirm","$tgTemplate","$compile",MembershipsRowAdminCheckboxDirective]),MembershipsRowRoleSelectorDirective=function($log,$repo,$confirm){var link,template;return template=_.template(''),link=function($scope,$el,$attrs){var $ctrl,html,member,render;return render=function(member){var ctx,html;return ctx={roleList:$scope.project.roles,selectedRole:member.role},html=template(ctx),$el.html(html)},null==$attrs.tgMembershipsRowRoleSelector?$log.error("MembershipsRowRoleSelectorDirective: the directive need a member"):($ctrl=$el.controller(),member=$scope.$eval($attrs.tgMembershipsRowRoleSelector),html=render(member),$el.on("change","select",function(_this){return function(event){var newRole,onError,onSuccess,target;return onSuccess=function(){return $confirm.notify("success")},onError=function(){return $confirm.notify("error")},target=angular.element(event.currentTarget),newRole=parseInt(target.val(),10),member.role!==newRole?(member.role=newRole,$repo.save(member).then(onSuccess,onError)):void 0}}(this)),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowRoleSelector",["$log","$tgRepo","$tgConfirm",MembershipsRowRoleSelectorDirective]),MembershipsRowActionsDirective=function($log,$repo,$rs,$confirm,$compile,$translate,$location,$navUrls,lightboxFactory){var activedTemplate,link,pendingTemplate;return activedTemplate='
\n
\n\n \n \n \n',pendingTemplate='\n\n\n \n \n \n',link=function($scope,$el,$attrs){var $ctrl,leaveConfirm,member,render;return render=function(member){var html;return html=member.user?$compile(activedTemplate)($scope):$compile(pendingTemplate)($scope),$el.html(html)},null==$attrs.tgMembershipsRowActions?$log.error("MembershipsRowActionsDirective: the directive need a member"):($ctrl=$el.controller(),member=$scope.$eval($attrs.tgMembershipsRowActions),render(member),$el.on("click",".js-resend",function(event){var onError,onSuccess;return event.preventDefault(),onSuccess=function(){var text;return text=$translate.instant("ADMIN.MEMBERSHIP.SUCCESS_SEND_INVITATION",{email:$scope.member.email}),$confirm.notify("success",text)},onError=function(){var text;return text=$translate.instant("ADMIM.MEMBERSHIP.ERROR_SEND_INVITATION"),$confirm.notify("error",text)},$rs.memberships.resendInvitation($scope.member.id).then(onSuccess,onError)}),leaveConfirm=function(){var defaultMsg,message,title;return title=$translate.instant("ADMIN.MEMBERSHIP.DELETE_MEMBER"),defaultMsg=$translate.instant("ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE",{email:member.email}),message=member.user?member.full_name:defaultMsg,$confirm.askOnDelete(title,message).then(function(askResponse){var onError,onSuccess;return onSuccess=function(_this){return function(){var text;return askResponse.finish(),member.user!==$scope.user.id?($scope.page>1&&$scope.count-1<=$scope.paginatedBy&&$ctrl.selectFilter("page",$scope.page-1),$ctrl.loadInitialData()):$location.path($navUrls.resolve("home")),text=$translate.instant("ADMIN.MEMBERSHIP.SUCCESS_DELETE",{message:message}),$confirm.notify("success",text,null,5e3)}}(this),onError=function(_this){return function(){var text;return askResponse.finish(!1),text=$translate.instant("ADMIN.MEMBERSHIP.ERROR_DELETE",{message:message}),$confirm.notify("error",text)}}(this),$repo.remove(member).then(onSuccess,onError)})},$el.on("click",".delete",function(event){var isCurrentUser;return event.preventDefault(),$scope.project.owner.id===member.user?(isCurrentUser=$scope.user.id===member.user, +this.scope.linksVisible=!1,promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this._setMeta()}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(WikiDetailController,superClass),WikiDetailController.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$filter","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate"],WikiDetailController.prototype._setMeta=function(){var description,ref,ref1,ref2,title;return title=this.translate.instant("WIKI.PAGE_TITLE",{wikiPageName:this.scope.wikiTitle,projectName:this.scope.project.name}),description=this.translate.instant("WIKI.PAGE_DESCRIPTION",{wikiPageContent:angular.element((null!=(ref=this.scope.wiki)?ref.html:void 0)||"").text(),totalEditions:(null!=(ref1=this.scope.wiki)?ref1.editions:void 0)||0,lastModifiedDate:moment(null!=(ref2=this.scope.wiki)?ref2.modified_date:void 0).format(this.translate.instant("WIKI.DATETIME"))}),this.appMetaService.setAll(title,description)},WikiDetailController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.is_wiki_activated||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},WikiDetailController.prototype.loadWiki=function(){var promise;return promise=this.rs.wiki.getBySlug(this.scope.projectId,this.params.slug),promise.then(function(_this){return function(wiki){return _this.scope.wiki=wiki,_this.scope.wikiId=wiki.id,_this.scope.wiki}}(this)),promise.then(null,function(_this){return function(xhr){var data;return _this.scope.wikiId=null,-1===_this.scope.project.my_permissions.indexOf("add_wiki_page")?null:(data={project:_this.scope.projectId,slug:_this.scope.wikiSlug,content:""},_this.scope.wiki=_this.model.make_model("wiki",data),_this.scope.wiki)}}(this))},WikiDetailController.prototype.loadWikiLinks=function(){return this.rs.wiki.listLinks(this.scope.projectId).then(function(_this){return function(wikiLinks){var selectedWikiLink;return _this.scope.wikiLinks=wikiLinks,selectedWikiLink=_.find(wikiLinks,{href:_this.scope.wikiSlug}),null!=selectedWikiLink?_this.scope.wikiTitle=selectedWikiLink.title:void 0}}(this))},WikiDetailController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.members,project.roles),_this.q.all([_this.loadWikiLinks(),_this.loadWiki()]).then(_this.checkLinksPerms.bind(_this))}}(this))},WikiDetailController.prototype.checkLinksPerms=function(){return-1!==this.scope.project.my_permissions.indexOf("modify_wiki_link")||-1!==this.scope.project.my_permissions.indexOf("view_wiki_links")&&this.scope.wikiLinks.length?this.scope.linksVisible=!0:void 0},WikiDetailController.prototype["delete"]=function(){var message,title;return title=this.translate.instant("WIKI.DELETE_LIGHTBOX_TITLE"),message=this.scope.wikiTitle,this.confirm.askOnDelete(title,message).then(function(_this){return function(askResponse){var onError,onSuccess;return onSuccess=function(){var ctx;return askResponse.finish(),ctx={project:_this.scope.projectSlug},_this.location.path(_this.navUrls.resolve("project-wiki",ctx)),_this.confirm.notify("success")},onError=function(){return askResponse.finish(!1),_this.confirm.notify("error")},_this.repo.remove(_this.scope.wiki).then(onSuccess,onError)}}(this))},WikiDetailController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("WikiDetailController",WikiDetailController),WikiSummaryDirective=function($log,$template,$compile,$translate){var link,template;return template=$template.get("wiki/wiki-summary.html",!0),link=function($scope,$el,$attrs,$model){var render;return render=function(wiki){var ctx,html,user;return null==$scope.usersById?$log.error("WikiSummaryDirective requires userById set in scope."):user=$scope.usersById[wiki.last_modifier],user=void 0===user?{name:"unknown",imgUrl:"/"+window._version+"/images/user-noimage.png"}:{name:user.full_name_display,imgUrl:user.photo},ctx={totalEditions:wiki.editions,lastModifiedDate:moment(wiki.modified_date).format($translate.instant("WIKI.DATETIME")),user:user},html=template(ctx),html=$compile(html)($scope),$el.html(html)},$scope.$watch($attrs.ngModel,function(wikiPage){return wikiPage?render(wikiPage):void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgWikiSummary",["$log","$tgTemplate","$compile","$translate",WikiSummaryDirective]),EditableWikiContentDirective=function($window,$document,$repo,$confirm,$loading,$analytics,$qqueue){var link;return link=function($scope,$el,$attrs,$model){var cancelEdition,disableEdition,getSelectedText,isEditable,save,switchToEditMode,switchToReadMode;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_wiki_page")},switchToEditMode=function(){return $el.find(".edit-wiki-content").show(),$el.find(".view-wiki-content").hide(),$el.find("textarea").focus()},switchToReadMode=function(){return $el.find(".edit-wiki-content").hide(),$el.find(".view-wiki-content").show()},disableEdition=function(){return $el.find(".view-wiki-content .edit").remove(),$el.find(".edit-wiki-content").remove()},cancelEdition=function(){return $model.$modelValue.id?($scope.$apply(function(_this){return function(){return $model.$modelValue.revert()}}(this)),switchToReadMode()):void 0},getSelectedText=function(){return $window.getSelection?$window.getSelection().toString():$document.selection?$document.selection.createRange().text:null},save=$qqueue.bindAdd(function(wiki){var currentLoading,onError,onSuccess,promise;return onSuccess=function(wikiPage){return null==wiki.id&&$analytics.trackEvent("wikipage","create","create wiki page",1),$model.$setViewValue(wikiPage.clone()),$confirm.notify("success"),switchToReadMode()},onError=function(){return $confirm.notify("error")},currentLoading=$loading().removeClasses("icon-floppy").target($el.find(".icon-floppy")).start(),promise=null!=wiki.id?$repo.save(wiki).then(onSuccess,onError):$repo.create("wiki",wiki).then(onSuccess,onError),promise["finally"](function(){return currentLoading.finish()})}),$el.on("click","a",function(event){var href,target;return target=angular.element(event.target),href=target.attr("href"),0===href.indexOf("#")?(event.preventDefault(),$("body").scrollTop($(href).offset().top)):void 0}),$el.on("mousedown",".view-wiki-content",function(event){var target;target=angular.element(event.target),isEditable()&&2===event.button}),$el.on("mouseup",".view-wiki-content",function(event){var target;return target=angular.element(event.target),getSelectedText()||!isEditable()||target.is("a")||target.is("pre")?void 0:switchToEditMode()}),$el.on("click",".save",debounce(2e3,function(){return save($scope.wiki)})),$el.on("click",".cancel",function(){return cancelEdition()}),$el.on("keydown","textarea",function(event){return 27===event.keyCode?cancelEdition():void 0}),$scope.$watch($attrs.ngModel,function(wikiPage){return wikiPage?isEditable()?($el.addClass("editable"),null==wikiPage.id||0===$.trim(wikiPage.content).length?switchToEditMode():void 0):disableEdition():void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel",templateUrl:"wiki/editable-wiki-content.html"}},module.directive("tgEditableWikiContent",["$window","$document","$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics","$tgQqueue",EditableWikiContentDirective])}.call(this),function(){var WikiNavDirective,bindOnce,groupBy,mixOf,module,taiga;taiga=this.taiga,mixOf=this.taiga.mixOf,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,module=angular.module("taigaWiki"),WikiNavDirective=function($tgrepo,$log,$location,$confirm,$navUrls,$analytics,$loading,$template,$compile,$translate){var link,template;return template=$template.get("wiki/wiki-nav.html",!0),link=function($scope,$el,$attrs){var $ctrl,render;return $ctrl=$el.controller(),null==$attrs.ngModel?$log.error("WikiNavDirective: no ng-model attr is defined"):(render=function(wikiLinks){var addWikiLinkPermission,deleteWikiLinkPermission,html;return addWikiLinkPermission=$scope.project.my_permissions.indexOf("add_wiki_link")>-1,deleteWikiLinkPermission=$scope.project.my_permissions.indexOf("delete_wiki_link")>-1,html=template({wikiLinks:wikiLinks,projectSlug:$scope.projectSlug,addWikiLinkPermission:addWikiLinkPermission,deleteWikiLinkPermission:deleteWikiLinkPermission}),html=$compile(html)($scope),$el.off(),$el.html(html),$el.on("click",".wiki-link .link-title",function(event){var linkId,linkSlug,target;return event.preventDefault(),target=angular.element(event.currentTarget),linkId=target.parents(".wiki-link").data("id"),linkSlug=$scope.wikiLinks[linkId].href,$scope.$apply(function(){var ctx;return ctx={project:$scope.projectSlug,slug:linkSlug},$location.path($navUrls.resolve("project-wiki-page",ctx))})}),$el.on("click",".add-button",function(event){return event.preventDefault(),$el.find(".new").removeClass("hidden"),$el.find(".new input").focus(),$el.find(".add-button").hide()}),$el.on("click",".js-delete-link",function(event){var linkId,message,target,title;return event.preventDefault(),event.stopPropagation(),target=angular.element(event.currentTarget),linkId=target.parents(".wiki-link").data("id"),title=$translate.instant("WIKI.DELETE_LIGHTBOX_TITLE"),message=$scope.wikiLinks[linkId].title,$confirm.askOnDelete(title,message).then(function(_this){return function(askResponse){var promise;return promise=$tgrepo.remove($scope.wikiLinks[linkId]),promise.then(function(){return promise=$ctrl.loadWikiLinks(),promise.then(function(){return askResponse.finish(),render($scope.wikiLinks)}),promise.then(null,function(){return askResponse.finish()})}),promise.then(null,function(){return askResponse.finish(!1),$confirm.notify("error")})}}(this))}),$el.on("keyup",".new input",function(event){var currentLoading,newLink,promise,target;return event.preventDefault(),13===event.keyCode?(target=angular.element(event.currentTarget),newLink=target.val(),currentLoading=$loading().target($el.find(".new")).start(),promise=$tgrepo.create("wiki-links",{project:$scope.projectId,title:newLink}),promise.then(function(){var loadPromise;return $analytics.trackEvent("wikilink","create","create wiki link",1),loadPromise=$ctrl.loadWikiLinks(),loadPromise.then(function(){return currentLoading.finish(),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show(),render($scope.wikiLinks)}),loadPromise.then(null,function(){return currentLoading.finish(),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show(),$confirm.notify("error","Error loading wiki links")})}),promise.then(null,function(error){var ref;return currentLoading.finish(),$el.find(".new input").val(newLink),$el.find(".new input").focus().select(),null!=(null!=error&&null!=(ref=error.__all__)?ref[0]:void 0)?$confirm.notify("error","The link already exists"):$confirm.notify("error")})):27===event.keyCode?(target=angular.element(event.currentTarget),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show()):void 0})},bindOnce($scope,$attrs.ngModel,render))},{link:link}},module.directive("tgWikiNav",["$tgRepo","$log","$tgLocation","$tgConfirm","$tgNavUrls","$tgAnalytics","$tgLoading","$tgTemplate","$compile","$translate",WikiNavDirective])}.call(this),function(){var ChangeOwnerLightboxController,ChangeOwnerLightboxDirective,LbRequestOwnershipDirective,LightboxAddMembersController,LightboxAddMembersDirective,LightboxAddMembersWarningMessageDirective,TransferProjectStartSuccessDirective,debounce,module,taiga;taiga=this.taiga,debounce=this.taiga.debounce,module=angular.module("taigaKanban"),LightboxAddMembersController=function(){function LightboxAddMembersController(scope1,lightboxService1,tgLoader,confirm,rs1,rootScope){var pendingMembersCount;this.scope=scope1,this.lightboxService=lightboxService1,this.tgLoader=tgLoader,this.confirm=confirm,this.rs=rs1,this.rootScope=rootScope,this._defaultMaxInvites=4,this._defaultRole=this.project.roles[0].id,this.form=null,this.submitInvites=!1,this.canAddUsers=!0,this.memberInvites=[],null===this.project.max_memberships?this.membersLimit=this._defaultMaxInvites:(pendingMembersCount=Math.max(this.project.max_memberships-this.project.total_memberships,0),this.membersLimit=Math.min(pendingMembersCount,this._defaultMaxInvites)),this.addSingleMember()}return LightboxAddMembersController.$inject=["$scope","lightboxService","tgLoader","$tgConfirm","$tgResources","$rootScope"],LightboxAddMembersController.prototype.addSingleMember=function(){return this.memberInvites.push({email:"",role_id:this._defaultRole}),this.memberInvites.length>=this.membersLimit&&(this.canAddUsers=!1),this.showWarningMessage=!this.canAddUsers&&this.project.total_memberships+this.memberInvites.length===this.project.max_memberships},LightboxAddMembersController.prototype.removeSingleMember=function(index){return this.memberInvites.splice(index,1),this.canAddUsers=!0,this.showWarningMessage=1===this.membersLimit},LightboxAddMembersController.prototype.submit=function(){var promise;return this.form.initializeFields(),this.form.reset(),this.form.validate()?(this.memberInvites=_.filter(this.memberInvites,function(invites){return""!==invites.email}),this.submitInvites=!0,promise=this.rs.memberships.bulkCreateMemberships(this.project.id,this.memberInvites,this.invitationText),promise.then(this._onSuccessInvite.bind(this),this._onErrorInvite.bind(this))):void 0},LightboxAddMembersController.prototype._onSuccessInvite=function(){return this.submitInvites=!1,this.rootScope.$broadcast("membersform:new:success"),this.lightboxService.closeAll(),this.confirm.notify("success")},LightboxAddMembersController.prototype._onErrorInvite=function(response){return this.submitInvites=!1,this.form.setErrors(response.data),response.data._error_message?this.confirm.notify("error",response.data._error_message):void 0},LightboxAddMembersController}(),module.controller("LbAddMembersController",LightboxAddMembersController),LightboxAddMembersDirective=function(lightboxService){var link;return link=function(scope,el,attrs,ctrl){return lightboxService.open(el),ctrl.form=el.find("form").checksley()},{scope:{},bindToController:{project:"="},controller:"LbAddMembersController",controllerAs:"vm",templateUrl:"admin/lightbox-add-members.html",link:link}},module.directive("tgLbAddMembers",["lightboxService",LightboxAddMembersDirective]),LightboxAddMembersWarningMessageDirective=function(){return{templateUrl:"admin/lightbox-add-members-no-more=memberships-warning-message.html",scope:{project:"="}}},module.directive("tgLightboxAddMembersWarningMessage",[LightboxAddMembersWarningMessageDirective]),LbRequestOwnershipDirective=function(lightboxService,rs,confirmService,$translate){return{link:function(scope,el){return lightboxService.open(el),scope.request=function(){return scope.loading=!0,rs.projects.transferRequest(scope.projectId).then(function(){return scope.loading=!1,lightboxService.close(el),confirmService.notify("success",$translate.instant("ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP_SUCCESS"))})}},templateUrl:"common/lightbox/lightbox-request-ownership.html"}},module.directive("tgLbRequestOwnership",["lightboxService","tgResources","$tgConfirm","$translate",LbRequestOwnershipDirective]),ChangeOwnerLightboxController=function(){function ChangeOwnerLightboxController(rs1,lightboxService1,confirm,translate){this.rs=rs1,this.lightboxService=lightboxService1,this.confirm=confirm,this.translate=translate,this.users=[],this.q="",this.commentOpen=!1}return ChangeOwnerLightboxController.prototype.limit=3,ChangeOwnerLightboxController.prototype.normalizeString=function(normalizedString){return normalizedString=normalizedString.replace("Á","A").replace("Ä","A").replace("À","A"),normalizedString=normalizedString.replace("É","E").replace("Ë","E").replace("È","E"),normalizedString=normalizedString.replace("Í","I").replace("Ï","I").replace("Ì","I"),normalizedString=normalizedString.replace("Ó","O").replace("Ö","O").replace("Ò","O"),normalizedString=normalizedString.replace("Ú","U").replace("Ü","U").replace("Ù","U")},ChangeOwnerLightboxController.prototype.filterUsers=function(user){var text,username;return username=user.full_name_display.toUpperCase(),username=this.normalizeString(username),text=this.q.toUpperCase(),text=this.normalizeString(text),_.includes(username,text)},ChangeOwnerLightboxController.prototype.getUsers=function(){var users;return users=this.users.length||this.q.length?this.users:this.activeUsers,users=users.slice(0,this.limit),users=_.reject(users,{selected:!0}),_.reject(users,{id:this.currentOwnerId})},ChangeOwnerLightboxController.prototype.userSearch=function(){return this.users=this.activeUsers,this.selected=_.find(this.users,{selected:!0}),this.q?this.users=_.filter(this.users,this.filterUsers.bind(this)):void 0},ChangeOwnerLightboxController.prototype.selectUser=function(user){return this.activeUsers=_.map(this.activeUsers,function(user){return user.selected=!1,user}),user.selected=!0,this.userSearch()},ChangeOwnerLightboxController.prototype.submit=function(){return this.loading=!0,this.rs.projects.transferStart(this.projectId,this.selected.id,this.comment).then(function(_this){return function(){var desc,title;return _this.loading=!1,_this.lightboxService.closeAll(),title=_this.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_TITLE"),desc=_this.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_DESC"),_this.confirm.success(title,desc,{type:"svg",name:"icon-speak-up"})}}(this))},ChangeOwnerLightboxController}(),ChangeOwnerLightboxController.$inject=["tgResources","lightboxService","$tgConfirm","$translate"],module.controller("ChangeOwnerLightbox",ChangeOwnerLightboxController),ChangeOwnerLightboxDirective=function(lightboxService,lightboxKeyboardNavigationService,$template,$compile){var link;return link=function(scope,el){return lightboxService.open(el)},{scope:!0,controller:"ChangeOwnerLightbox",controllerAs:"vm",bindToController:{currentOwnerId:"=",projectId:"=",activeUsers:"="},templateUrl:"common/lightbox/lightbox-change-owner.html",link:link}},module.directive("tgLbChangeOwner",["lightboxService","lightboxKeyboardNavigationService","$tgTemplate","$compile",ChangeOwnerLightboxDirective]),TransferProjectStartSuccessDirective=function(lightboxService){var link;return link=function(scope,el){return scope.close=function(){return lightboxService.close(el)},lightboxService.open(el)},{templateUrl:"common/lightbox/lightbox-transfer-project-start-success.html",link:link}},module.directive("tgLbTransferProjectStartSuccess",["lightboxService",TransferProjectStartSuccessDirective])}.call(this),function(){var MembershipsController,MembershipsDirective,MembershipsRowActionsDirective,MembershipsRowAdminCheckboxDirective,MembershipsRowAvatarDirective,MembershipsRowRoleSelectorDirective,NoMoreMembershipsExplanationDirective,bindMethods,mixOf,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,bindMethods=this.taiga.bindMethods,module=angular.module("taigaAdmin"),MembershipsController=function(superClass){function MembershipsController(scope,rootscope,repo,confirm,rs,params,q,location,navUrls,analytics,appMetaService,translate,auth,lightboxFactory1){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.navUrls=navUrls,this.analytics=analytics,this.appMetaService=appMetaService,this.translate=translate,this.auth=auth,this.lightboxFactory=lightboxFactory1,bindMethods(this),this.scope.project={},this.scope.filters={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ADMIN.MEMBERSHIPS.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("membersform:new:success",function(_this){return function(){return _this.loadInitialData(),_this.analytics.trackEvent("membership","create","create memberships on admin",1)}}(this))}return extend(MembershipsController,superClass),MembershipsController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAnalytics","tgAppMetaService","$translate","$tgAuth","tgLightboxFactory"],MembershipsController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.i_am_admin||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.canAddUsers=null===project.max_memberships||project.max_memberships>project.total_memberships,_this.scope.$emit("project:loaded",project),project}}(this))},MembershipsController.prototype.loadMembers=function(){var httpFilters;return httpFilters=this.getUrlFilters(),this.rs.memberships.list(this.scope.projectId,httpFilters).then(function(_this){return function(data){return _this.scope.memberships=_.filter(data.models,function(membership){return null===membership.user||membership.is_user_active}),_this.scope.page=data.current,_this.scope.count=data.count,_this.scope.paginatedBy=data.paginatedBy,data}}(this))},MembershipsController.prototype.loadInitialData=function(){return this.loadProject().then(function(_this){return function(){return _this.q.all([_this.loadMembers(),_this.auth.refresh()])}}(this))},MembershipsController.prototype.getUrlFilters=function(){var filters;return filters=_.pick(this.location.search(),"page"),filters.page||(filters.page=1),filters},MembershipsController.prototype.addNewMembers=function(){return this.lightboxFactory.create("tg-lb-add-members",{"class":"lightbox lightbox-add-member",project:"project"},{project:this.scope.project})},MembershipsController.prototype.showLimitUsersWarningMessage=function(){var icon,message,title;return title=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING"),message=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING_MESSAGE",{members:this.scope.project.max_memberships}),icon="/"+window._version+"/svg/icons/team-question.svg",this.confirm.success(title,message,{name:icon,type:"img"})},MembershipsController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("MembershipsController",MembershipsController),MembershipsDirective=function($template,$compile){var link,linkPagination,template;return template=$template.get("admin/admin-membership-paginator.html",!0),linkPagination=function($scope,$el,$attrs,$ctrl){var $pagEl,afterCurrent,atBegin,atEnd,beforeCurrent,getNumPages,renderPagination;return afterCurrent=2,beforeCurrent=4,atBegin=2,atEnd=2,$pagEl=$el.find(".memberships-paginator"),getNumPages=function(){var numPages;return numPages=$scope.count/$scope.paginatedBy,numPages=parseInt(numPages,10)=numPages)return void $pagEl.hide();for(pages=[],options={},options.pages=pages,options.showPrevious=$scope.page>1,options.showNext=!($scope.page===numPages),cpage=$scope.page,i=j=1,ref=numPages;ref>=1?ref>=j:j>=ref;i=ref>=1?++j:--j)i===cpage+afterCurrent&&numPages>cpage+afterCurrent+atEnd?pages.push({classes:"dots",type:"dots"}):i===cpage-beforeCurrent&&cpage>atBegin+beforeCurrent?pages.push({classes:"dots",type:"dots"}):i>cpage+afterCurrent&&numPages-atEnd>=i||cpage-beforeCurrent>i&&i>atBegin||(i===cpage?pages.push({classes:"active",num:i,type:"page-active"}):pages.push({classes:"page",num:i,type:"page"}));return html=template(options),html=$compile(html)($scope),$pagEl.html(html),$pagEl.show()},$scope.$watch("memberships",function(value){return value?renderPagination():void 0}),$el.on("click",".memberships-paginator a.next",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page+1),$ctrl.loadMembers()})}),$el.on("click",".memberships-paginator a.previous",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page-1),$ctrl.loadMembers()})}),$el.on("click",".memberships-paginator li.page > a",function(event){var pagenum,target;return event.preventDefault(),target=angular.element(event.currentTarget),pagenum=target.data("pagenum"),$scope.$apply(function(){return $ctrl.selectFilter("page",pagenum),$ctrl.loadMembers()})})},link=function($scope,$el,$attrs){var $ctrl;return $ctrl=$el.controller(),linkPagination($scope,$el,$attrs,$ctrl),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgMemberships",["$tgTemplate","$compile",MembershipsDirective]),MembershipsRowAvatarDirective=function($log,$template,$translate){var link,template;return template=$template.get("admin/memberships-row-avatar.html",!0),link=function($scope,$el,$attrs){var member,pending,render;return pending=$translate.instant("ADMIN.MEMBERSHIP.STATUS_PENDING"),render=function(member){var ctx,html;return ctx={full_name:member.full_name?member.full_name:"",email:member.user_email?member.user_email:member.email,imgurl:member.photo?member.photo:"/"+window._version+"/images/unnamed.png",pending:member.is_user_active?"":pending,isOwner:member.is_owner},html=template(ctx),$el.html(html)},null==$attrs.tgMembershipsRowAvatar?$log.error("MembershipsRowAvatarDirective: the directive need a member"):(member=$scope.$eval($attrs.tgMembershipsRowAvatar),render(member),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowAvatar",["$log","$tgTemplate","$translate",MembershipsRowAvatarDirective]),MembershipsRowAdminCheckboxDirective=function($log,$repo,$confirm,$template,$compile){var link,template;return template=$template.get("admin/admin-memberships-row-checkbox.html",!0),link=function($scope,$el,$attrs){var html,member,render;return $scope.$on("$destroy",function(){return $el.off()}),null==$attrs.tgMembershipsRowAdminCheckbox?$log.error("MembershipsRowAdminCheckboxDirective: the directive need a member"):(member=$scope.$eval($attrs.tgMembershipsRowAdminCheckbox),member.is_owner?void $el.find(".js-check").remove():(render=function(member){var ctx,html;return ctx={inputId:"is-admin-"+member.id},html=template(ctx),html=$compile(html)($scope),$el.html(html)},$el.on("click",":checkbox",function(_this){return function(event){var onError,onSuccess,target;return onSuccess=function(){return $confirm.notify("success")},onError=function(data){return member.revert(),$el.find(":checkbox").prop("checked",member.is_admin),$confirm.notify("error",data.is_admin[0])},target=angular.element(event.currentTarget),member.is_admin=target.prop("checked"),$repo.save(member).then(onSuccess,onError)}}(this)),html=render(member),member.is_admin?$el.find(":checkbox").prop("checked",!0):void 0))},{link:link}},module.directive("tgMembershipsRowAdminCheckbox",["$log","$tgRepo","$tgConfirm","$tgTemplate","$compile",MembershipsRowAdminCheckboxDirective]),MembershipsRowRoleSelectorDirective=function($log,$repo,$confirm){var link,template;return template=_.template(''),link=function($scope,$el,$attrs){var $ctrl,html,member,render;return render=function(member){var ctx,html;return ctx={roleList:$scope.project.roles,selectedRole:member.role},html=template(ctx),$el.html(html)},null==$attrs.tgMembershipsRowRoleSelector?$log.error("MembershipsRowRoleSelectorDirective: the directive need a member"):($ctrl=$el.controller(),member=$scope.$eval($attrs.tgMembershipsRowRoleSelector),html=render(member),$el.on("change","select",function(_this){return function(event){var newRole,onError,onSuccess,target;return onSuccess=function(){return $confirm.notify("success")},onError=function(){return $confirm.notify("error")},target=angular.element(event.currentTarget),newRole=parseInt(target.val(),10),member.role!==newRole?(member.role=newRole,$repo.save(member).then(onSuccess,onError)):void 0}}(this)),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowRoleSelector",["$log","$tgRepo","$tgConfirm",MembershipsRowRoleSelectorDirective]),MembershipsRowActionsDirective=function($log,$repo,$rs,$confirm,$compile,$translate,$location,$navUrls,lightboxFactory){var activedTemplate,link,pendingTemplate;return activedTemplate='
\n
\n\n \n \n \n',pendingTemplate='\n\n\n \n \n \n',link=function($scope,$el,$attrs){var $ctrl,leaveConfirm,member,render;return render=function(member){var html;return html=member.user?$compile(activedTemplate)($scope):$compile(pendingTemplate)($scope),$el.html(html)},null==$attrs.tgMembershipsRowActions?$log.error("MembershipsRowActionsDirective: the directive need a member"):($ctrl=$el.controller(),member=$scope.$eval($attrs.tgMembershipsRowActions),render(member),$el.on("click",".js-resend",function(event){var onError,onSuccess;return event.preventDefault(),onSuccess=function(){var text;return text=$translate.instant("ADMIN.MEMBERSHIP.SUCCESS_SEND_INVITATION",{email:$scope.member.email}),$confirm.notify("success",text)},onError=function(){var text;return text=$translate.instant("ADMIM.MEMBERSHIP.ERROR_SEND_INVITATION"),$confirm.notify("error",text)},$rs.memberships.resendInvitation($scope.member.id).then(onSuccess,onError)}),leaveConfirm=function(){var defaultMsg,message,title;return title=$translate.instant("ADMIN.MEMBERSHIP.DELETE_MEMBER"),defaultMsg=$translate.instant("ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE",{email:member.email}),message=member.user?member.full_name:defaultMsg,$confirm.askOnDelete(title,message).then(function(askResponse){var onError,onSuccess;return onSuccess=function(_this){return function(){var text;return askResponse.finish(),member.user!==$scope.user.id?($scope.page>1&&$scope.count-1<=$scope.paginatedBy&&$ctrl.selectFilter("page",$scope.page-1),$ctrl.loadInitialData()):$location.path($navUrls.resolve("home")),text=$translate.instant("ADMIN.MEMBERSHIP.SUCCESS_DELETE",{message:message}),$confirm.notify("success",text,null,5e3)}}(this),onError=function(_this){return function(){var text;return askResponse.finish(!1),text=$translate.instant("ADMIN.MEMBERSHIP.ERROR_DELETE",{message:message}),$confirm.notify("error",text)}}(this),$repo.remove(member).then(onSuccess,onError)})},$el.on("click",".delete",function(event){var isCurrentUser;return event.preventDefault(),$scope.project.owner.id===member.user?(isCurrentUser=$scope.user.id===member.user, lightboxFactory.create("tg-lightbox-leave-project-warning",{"class":"lightbox lightbox-leave-project-warning"},{isCurrentUser:isCurrentUser,project:$scope.project})):leaveConfirm()}),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowActions",["$log","$tgRepo","$tgResources","$tgConfirm","$compile","$translate","$tgLocation","$tgNavUrls","tgLightboxFactory",MembershipsRowActionsDirective]),NoMoreMembershipsExplanationDirective=function(){return{templateUrl:"admin/no-more-memberships-explanation.html",scope:{project:"="}}},module.directive("tgNoMoreMembershipsExplanation",[NoMoreMembershipsExplanationDirective])}.call(this),function(){var AdminNavigationDirective,module;AdminNavigationDirective=function(){var link;return link=function($scope,$el,$attrs){var section;return section=$attrs.tgAdminNavigation,$el.find(".active").removeClass("active"),$el.find("#adminmenu-"+section+" a").addClass("active"),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module=angular.module("taigaAdmin"),module.directive("tgAdminNavigation",AdminNavigationDirective)}.call(this),function(){var AdminProjectChangeOwnerDirective,AdminProjectRequestOwnershipDirective,AdminProjectRestrictionsDirective,CsvExporterController,CsvExporterIssuesController,CsvExporterTasksController,CsvExporterUserstoriesController,CsvIssueDirective,CsvTaskDirective,CsvUsDirective,ProjectDefaultValuesDirective,ProjectExportDirective,ProjectLogoDirective,ProjectLogoModelDirective,ProjectModulesDirective,ProjectProfileController,ProjectProfileDirective,bindOnce,debounce,groupBy,joinStr,mixOf,module,taiga,toString,trim,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty,bind=function(fn,me){return function(){return fn.apply(me,arguments)}};taiga=this.taiga,mixOf=this.taiga.mixOf,trim=this.taiga.trim,toString=this.taiga.toString,joinStr=this.taiga.joinStr,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,module=angular.module("taigaAdmin"),ProjectProfileController=function(superClass){function ProjectProfileController(scope1,rootscope,repo,confirm,rs,params,q,location,navUrls,appMetaService,translate,tgAuth,currentUserService1){var promise;this.scope=scope1,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.navUrls=navUrls,this.appMetaService=appMetaService,this.translate=translate,this.tgAuth=tgAuth,this.currentUserService=currentUserService1,this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,sectionName,title;return sectionName=_this.translate.instant(_this.scope.sectionName),title=_this.translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE",{sectionName:sectionName,projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description),_this.fillUsersAndRoles(_this.scope.project.members,_this.scope.project.roles)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:loaded",function(_this){return function(){var description,sectionName,title;return sectionName=_this.translate.instant(_this.scope.sectionName),title=_this.translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE",{sectionName:sectionName,projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this))}return extend(ProjectProfileController,superClass),ProjectProfileController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","$tgAuth","tgCurrentUserService"],ProjectProfileController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.i_am_admin||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.pointsList=_.sortBy(project.points,"order"),_this.scope.usStatusList=_.sortBy(project.us_statuses,"order"),_this.scope.taskStatusList=_.sortBy(project.task_statuses,"order"),_this.scope.prioritiesList=_.sortBy(project.priorities,"order"),_this.scope.severitiesList=_.sortBy(project.severities,"order"),_this.scope.issueTypesList=_.sortBy(project.issue_types,"order"),_this.scope.issueStatusList=_.sortBy(project.issue_statuses,"order"),_this.scope.$emit("project:loaded",project),project}}(this))},ProjectProfileController.prototype.loadInitialData=function(){return this.q.all([this.loadProject(),this.tgAuth.refresh()])},ProjectProfileController.prototype.openDeleteLightbox=function(){return this.rootscope.$broadcast("deletelightbox:new",this.scope.project)},ProjectProfileController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("ProjectProfileController",ProjectProfileController),ProjectProfileDirective=function($repo,$confirm,$loading,$navurls,$location,projectService,currentUserService){var link;return link=function($scope,$el,$attrs){var $ctrl,form,submit,submitButton;return $ctrl=$el.controller(),form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(_this){return function(event){var currentLoading,promise;return event.preventDefault(),form.validate()?(currentLoading=$loading().target(submitButton).start(),promise=$repo.save($scope.project),promise.then(function(){var newUrl;return currentLoading.finish(),$confirm.notify("success"),newUrl=$navurls.resolve("project-admin-project-profile-details",{project:$scope.project.slug}),$location.path(newUrl),$ctrl.loadInitialData(),projectService.fetchProject(),currentUserService.loadProjects()}),promise.then(null,function(data){return currentLoading.finish(),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit)},{link:link}},module.directive("tgProjectProfile",["$tgRepo","$tgConfirm","$tgLoading","$tgNavUrls","$tgLocation","tgProjectService","tgCurrentUserService",ProjectProfileDirective]),ProjectDefaultValuesDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el,$attrs){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(_this){return function(event){var currentLoading,promise;return event.preventDefault(),form.validate()?(currentLoading=$loading().target(submitButton).start(),promise=$repo.save($scope.project),promise.then(function(){return currentLoading.finish(),$confirm.notify("success")}),promise.then(null,function(data){return currentLoading.finish(),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgProjectDefaultValues",["$tgRepo","$tgConfirm","$tgLoading",ProjectDefaultValuesDirective]),ProjectModulesDirective=function($repo,$confirm,$loading,projectService){var link;return link=function($scope,$el,$attrs){var submit;return submit=function(_this){return function(){var form,promise;return form=$el.find("form").checksley(),form.initializeFields(),form.reset(),form.validate()?(promise=$repo.save($scope.project),promise.then(function(){return $scope.$emit("project:loaded",$scope.project),$confirm.notify("success"),projectService.fetchProject()}),promise.then(null,function(data){return form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this),$el.on("change",".module-activation.module-direct-active input",function(event){return event.preventDefault(),submit()}),$el.on("submit","form",function(event){return event.preventDefault(),submit()}),$el.on("click",".icon-save",function(event){return event.preventDefault(),submit()}),$el.on("keydown",".videoconference-attributes input",function(e){return 32!==e.which}),$scope.$watch("project.videoconferences",function(newVal,oldVal){return null!=newVal&&null!=oldVal&&newVal!==oldVal?$scope.project.videoconferences_extra_data="":void 0}),$scope.$watch("isVideoconferenceActivated",function(newValue,oldValue){return newValue===!1&&($scope.project.videoconferences=null,$scope.project.videoconferences_extra_data="",oldValue===!0)?submit():void 0}),$scope.$watch("project",function(project){return null!=project.videoconferences?$scope.isVideoconferenceActivated=!0:$scope.isVideoconferenceActivated=!1})},{link:link}},module.directive("tgProjectModules",["$tgRepo","$tgConfirm","$tgLoading","tgProjectService",ProjectModulesDirective]),ProjectExportDirective=function($window,$rs,$confirm,$translate){var link;return link=function($scope,$el,$attrs){var asyn_message,buttonsEl,dump_ready_text,hideButtons,hideResult,hideSpinner,loading_msg,loading_title,resultEl,resultMessageEl,resultTitleEl,setAsyncMessage,setAsyncTitle,setLoadingMessage,setLoadingTitle,setSyncMessage,setSyncTitle,showButtons,showErrorMode,showExportResultAsyncMode,showExportResultSyncMode,showLoadingMode,showResult,showSpinner,spinnerEl,syn_message;return buttonsEl=$el.find(".admin-project-export-buttons"),showButtons=function(){return buttonsEl.removeClass("hidden")},hideButtons=function(){return buttonsEl.addClass("hidden")},resultEl=$el.find(".admin-project-export-result"),showResult=function(){return resultEl.removeClass("hidden")},hideResult=function(){return resultEl.addClass("hidden")},spinnerEl=$el.find(".spin"),showSpinner=function(){return spinnerEl.removeClass("hidden")},hideSpinner=function(){return spinnerEl.addClass("hidden")},resultTitleEl=$el.find(".result-title"),loading_title=$translate.instant("ADMIN.PROJECT_EXPORT.LOADING_TITLE"),loading_msg=$translate.instant("ADMIN.PROJECT_EXPORT.LOADING_MESSAGE"),dump_ready_text=function(){return resultTitleEl.html($translate.instant("ADMIN.PROJECT_EXPORT.DUMP_READY"))},asyn_message=function(){return resultTitleEl.html($translate.instant("ADMIN.PROJECT_EXPORT.ASYNC_MESSAGE"))},syn_message=function(url){return resultTitleEl.html($translate.instant("ADMIN.PROJECT_EXPORT.SYNC_MESSAGE",{url:url}))},setLoadingTitle=function(){return resultTitleEl.html(loading_title)},setAsyncTitle=function(){return resultTitleEl.html(loading_msg)},setSyncTitle=function(){return resultTitleEl.html(dump_ready_text)},resultMessageEl=$el.find(".result-message "),setLoadingMessage=function(){return resultMessageEl.html(loading_msg)},setAsyncMessage=function(){return resultMessageEl.html(asyn_message)},setSyncMessage=function(url){return resultMessageEl.html(syn_message(url))},showLoadingMode=function(){return showSpinner(),setLoadingTitle(),setLoadingMessage(),hideButtons(),showResult()},showExportResultAsyncMode=function(){return hideSpinner(),setAsyncTitle(),setAsyncMessage()},showExportResultSyncMode=function(url){return hideSpinner(),setSyncTitle(),setSyncMessage(url)},showErrorMode=function(){return hideSpinner(),hideResult(),showButtons()},$el.on("click","a.button-export",debounce(2e3,function(_this){return function(event){var onError,onSuccess;return event.preventDefault(),onSuccess=function(result){var dumpUrl;return 202===result.status?showExportResultAsyncMode():(dumpUrl=result.data.url,showExportResultSyncMode(dumpUrl),$window.open(dumpUrl,"_blank"))},onError=function(result){var errorMsg,ref;return showErrorMode(),errorMsg=$translate.instant("ADMIN.PROJECT_EXPORT.ERROR"),429===result.status?errorMsg=$translate.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY"):(null!=(ref=result.data)?ref._error_message:void 0)&&(errorMsg=$translate.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY",{message:result.data._error_message})),$confirm.notify("error",errorMsg)},showLoadingMode(),$rs.projects["export"]($scope.projectId).then(onSuccess,onError)}}(this)))},{link:link}},module.directive("tgProjectExport",["$window","$tgResources","$tgConfirm","$translate",ProjectExportDirective]),CsvExporterController=function(superClass){function CsvExporterController(scope1,rootscope,urls,confirm,rs,translate){this.scope=scope1,this.rootscope=rootscope,this.urls=urls,this.confirm=confirm,this.rs=rs,this.translate=translate,this._generateUuid=bind(this._generateUuid,this),this.setCsvUuid=bind(this.setCsvUuid,this),this.rootscope.$on("project:loaded",this.setCsvUuid),this.scope.$watch("csvUuid",function(_this){return function(value){return value?_this.scope.csvUrl=_this.urls.resolveAbsolute(_this.type+"-csv",value):_this.scope.csvUrl=""}}(this))}return extend(CsvExporterController,superClass),CsvExporterController.$inject=["$scope","$rootScope","$tgUrls","$tgConfirm","$tgResources","$translate"],CsvExporterController.prototype.setCsvUuid=function(){return this.scope.csvUuid=this.scope.project[this.type+"_csv_uuid"]},CsvExporterController.prototype._generateUuid=function(response){var promise;return null==response&&(response=null),promise=this.rs.projects["regenerate_"+this.type+"_csv_uuid"](this.scope.projectId),promise.then(function(_this){return function(data){var ref;return _this.scope.csvUuid=null!=(ref=data.data)?ref.uuid:void 0}}(this)),promise.then(null,function(_this){return function(){return _this.confirm.notify("error")}}(this)),promise["finally"](function(){return response?response.finish():void 0}),promise},CsvExporterController.prototype.regenerateUuid=function(){var subtitle,title;return this.scope.csvUuid?(title=this.translate.instant("ADMIN.REPORTS.REGENERATE_TITLE"),subtitle=this.translate.instant("ADMIN.REPORTS.REGENERATE_SUBTITLE"),this.confirm.ask(title,subtitle).then(this._generateUuid)):this._generateUuid()},CsvExporterController}(taiga.Controller),CsvExporterUserstoriesController=function(superClass){function CsvExporterUserstoriesController(){return CsvExporterUserstoriesController.__super__.constructor.apply(this,arguments)}return extend(CsvExporterUserstoriesController,superClass),CsvExporterUserstoriesController.prototype.type="userstories",CsvExporterUserstoriesController}(CsvExporterController),CsvExporterTasksController=function(superClass){function CsvExporterTasksController(){return CsvExporterTasksController.__super__.constructor.apply(this,arguments)}return extend(CsvExporterTasksController,superClass),CsvExporterTasksController.prototype.type="tasks",CsvExporterTasksController}(CsvExporterController),CsvExporterIssuesController=function(superClass){function CsvExporterIssuesController(){return CsvExporterIssuesController.__super__.constructor.apply(this,arguments)}return extend(CsvExporterIssuesController,superClass),CsvExporterIssuesController.prototype.type="issues",CsvExporterIssuesController}(CsvExporterController),module.controller("CsvExporterUserstoriesController",CsvExporterUserstoriesController),module.controller("CsvExporterTasksController",CsvExporterTasksController),module.controller("CsvExporterIssuesController",CsvExporterIssuesController),CsvUsDirective=function($translate){var link;return link=function($scope){return $scope.sectionTitle="ADMIN.CSV.SECTION_TITLE_US"},{controller:"CsvExporterUserstoriesController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:link,scope:!0}},module.directive("tgCsvUs",["$translate",CsvUsDirective]),CsvTaskDirective=function($translate){var link;return link=function($scope){return $scope.sectionTitle="ADMIN.CSV.SECTION_TITLE_TASK"},{controller:"CsvExporterTasksController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:link,scope:!0}},module.directive("tgCsvTask",["$translate",CsvTaskDirective]),CsvIssueDirective=function($translate){var link;return link=function($scope){return $scope.sectionTitle="ADMIN.CSV.SECTION_TITLE_ISSUE"},{controller:"CsvExporterIssuesController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:link,scope:!0}},module.directive("tgCsvIssue",["$translate",CsvIssueDirective]),ProjectLogoDirective=function($auth,$model,$rs,$confirm){var link;return link=function($scope,$el,$attrs){var onError,onSuccess,showSizeInfo;return showSizeInfo=function(){return $el.find(".size-info").addClass("active")},onSuccess=function(response){var project;return project=$model.make_model("projects",response.data),$scope.project=project,$el.find(".loading-overlay").removeClass("active"),$confirm.notify("success")},onError=function(response){return 413===response.status&&showSizeInfo(),$el.find(".loading-overlay").removeClass("active"),$confirm.notify("error",response.data._error_message)},$el.on("click",".js-change-logo",function(){return $el.find("#logo-field").click()}),$el.on("change","#logo-field",function(event){return $scope.logoAttachment?($el.find(".loading-overlay").addClass("active"),$rs.projects.changeLogo($scope.project.id,$scope.logoAttachment).then(onSuccess,onError)):void 0}),$el.on("click","a.js-use-default-logo",function(event){return $el.find(".loading-overlay").addClass("active"),$rs.projects.removeLogo($scope.project.id).then(onSuccess,onError)}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgProjectLogo",["$tgAuth","$tgModel","$tgResources","$tgConfirm",ProjectLogoDirective]),ProjectLogoModelDirective=function($parse){var link;return link=function($scope,$el,$attrs){var model,modelSetter;return model=$parse($attrs.tgProjectLogoModel),modelSetter=model.assign,$el.bind("change",function(){return $scope.$apply(function(){return modelSetter($scope,$el[0].files[0])})})},{link:link}},module.directive("tgProjectLogoModel",["$parse",ProjectLogoModelDirective]),AdminProjectRestrictionsDirective=function(){return{scope:{project:"="},templateUrl:"admin/admin-project-restrictions.html"}},module.directive("tgAdminProjectRestrictions",[AdminProjectRestrictionsDirective]),AdminProjectRequestOwnershipDirective=function(lightboxFactory){return{link:function(scope){return scope.requestOwnership=function(){return lightboxFactory.create("tg-lb-request-ownership",{"class":"lightbox lightbox-request-ownership"},{projectId:scope.projectId})}},scope:{projectId:"=",owner:"="},templateUrl:"admin/admin-project-request-ownership.html"}},module.directive("tgAdminProjectRequestOwnership",["tgLightboxFactory",AdminProjectRequestOwnershipDirective]),AdminProjectChangeOwnerDirective=function(lightboxFactory){return{link:function(scope){return scope.changeOwner=function(){return lightboxFactory.create("tg-lb-change-owner",{"class":"lightbox lightbox-select-user","project-id":"projectId","active-users":"activeUsers","current-owner-id":"currentOwnerId"},{projectId:scope.projectId,activeUsers:scope.activeUsers,currentOwnerId:scope.owner.id,members:scope.members})}},scope:{activeUsers:"=",projectId:"=",owner:"=",members:"="},templateUrl:"admin/admin-project-change-owner.html"}},module.directive("tgAdminProjectChangeOwner",["tgLightboxFactory",AdminProjectChangeOwnerDirective])}.call(this),function(){var ColorSelectionDirective,DATE_TYPE,MULTILINE_TYPE,ProjectCustomAttributesController,ProjectCustomAttributesDirective,ProjectValuesController,ProjectValuesDirective,ProjectValuesSectionController,TEXT_TYPE,TYPE_CHOICES,URL_TYPE,bindOnce,debounce,groupBy,joinStr,mixOf,module,taiga,toString,trim,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty,bind=function(fn,me){return function(){return fn.apply(me,arguments)}};taiga=this.taiga,mixOf=this.taiga.mixOf,trim=this.taiga.trim,toString=this.taiga.toString,joinStr=this.taiga.joinStr,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,module=angular.module("taigaAdmin"),ProjectValuesSectionController=function(superClass){function ProjectValuesSectionController(scope,rootscope,repo,confirm,rs,params,q,location,navUrls,appMetaService,translate){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.navUrls=navUrls,this.appMetaService=appMetaService,this.translate=translate,this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,sectionName,title;return sectionName=_this.translate.instant(_this.scope.sectionName),title=_this.translate.instant("ADMIN.PROJECT_VALUES.PAGE_TITLE",{sectionName:sectionName,projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(ProjectValuesSectionController,superClass),ProjectValuesSectionController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],ProjectValuesSectionController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.i_am_admin||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},ProjectValuesSectionController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject()},ProjectValuesSectionController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("ProjectValuesSectionController",ProjectValuesSectionController),ProjectValuesController=function(superClass){function ProjectValuesController(scope,rootscope,repo,confirm,rs){this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.moveValue=bind(this.moveValue,this),this.loadValues=bind(this.loadValues,this),this.scope.$on("admin:project-values:move",this.moveValue),this.rootscope.$on("project:loaded",this.loadValues)}return extend(ProjectValuesController,superClass),ProjectValuesController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources"],ProjectValuesController.prototype.loadValues=function(){return this.rs[this.scope.resource].listValues(this.scope.projectId,this.scope.type).then(function(_this){return function(values){return _this.scope.values=values,_this.scope.maxValueOrder=_.maxBy(values,"order").order,values}}(this))},ProjectValuesController.prototype.moveValue=function(ctx,itemValue,itemIndex){var r,values;return values=this.scope.values,r=values.indexOf(itemValue),values.splice(r,1),values.splice(itemIndex,0,itemValue),_.each(values,function(value,index){return value.order=index}),this.repo.saveAll(values)},ProjectValuesController}(taiga.Controller),module.controller("ProjectValuesController",ProjectValuesController),ProjectValuesDirective=function($log,$repo,$confirm,$location,animationFrame,$translate,$rootscope){var link,linkDragAndDrop,linkValue;return linkDragAndDrop=function($scope,$el,$attrs){var itemEl,newParentScope,oldParentScope,tdom;return oldParentScope=null,newParentScope=null,itemEl=null,tdom=$el.find(".sortable"),tdom.sortable({handle:".row.table-main.visualization",dropOnEmpty:!0,connectWith:".project-values-body",revert:400,axis:"y"}),tdom.on("sortstop",function(event,ui){var itemIndex,itemValue;return itemEl=ui.item,itemValue=itemEl.scope().value,itemIndex=itemEl.index(),$scope.$broadcast("admin:project-values:move",itemValue,itemIndex)}),$scope.$on("$destroy",function(){return $el.off()})},linkValue=function($scope,$el,$attrs){var $ctrl,cancel,goToBottomList,initializeNewValue,initializeTextTranslations,objName,saveNewValue,saveValue,valueType;return $ctrl=$el.controller(),valueType=$attrs.type,objName=$attrs.objname,initializeNewValue=function(){return $scope.newValue={name:"",is_closed:!1,is_archived:!1}},initializeTextTranslations=function(){return $scope.addNewElementText=$translate.instant("ADMIN.PROJECT_VALUES_"+objName.toUpperCase()+".ACTION_ADD")},initializeNewValue(),initializeTextTranslations(),$rootscope.$on("$translateChangeEnd",function(){return $scope.$evalAsync(initializeTextTranslations)}),goToBottomList=function(_this){return function(focus){var table;return null==focus&&(focus=!1),table=$el.find(".table-main"),$(document.body).scrollTop(table.offset().top+table.height()),focus?$el.find(".new-value input:visible").first().focus():void 0}}(this),saveValue=function(target){var form,formEl,promise,value;return formEl=target.parents("form"),form=formEl.checksley(),form.validate()?(value=formEl.scope().value,promise=$repo.save(value),promise.then(function(_this){return function(){var row;return row=target.parents(".row.table-main"),row.addClass("hidden"),row.siblings(".visualization").removeClass("hidden")}}(this)),promise.then(null,function(data){return form.setErrors(data)})):void 0},saveNewValue=function(target){var form,formEl,promise;return formEl=target.parents("form"),form=formEl.checksley(),form.validate()?($scope.newValue.project=$scope.project.id,$scope.newValue.order=$scope.maxValueOrder?$scope.maxValueOrder+1:1,promise=$repo.create(valueType,$scope.newValue),promise.then(function(_this){return function(data){return target.addClass("hidden"),$scope.values.push(data),$scope.maxValueOrder=data.order,initializeNewValue()}}(this)),promise.then(null,function(data){return form.setErrors(data)})):void 0},cancel=function(target){var formEl,row,value;return row=target.parents(".row.table-main"),formEl=target.parents("form"),value=formEl.scope().value,$scope.$apply(function(){return row.addClass("hidden"),value.revert(),row.siblings(".visualization").removeClass("hidden")})},$el.on("click",".show-add-new",function(event){return event.preventDefault(),$el.find(".new-value").removeClass("hidden"),goToBottomList(!0)}),$el.on("click",".add-new",debounce(2e3,function(event){var target;return event.preventDefault(),target=$el.find(".new-value"),saveNewValue(target)})),$el.on("click",".delete-new",function(event){return event.preventDefault(),$el.find(".new-value").addClass("hidden"),initializeNewValue()}),$el.on("click",".edit-value",function(event){var editionRow,row,target;return event.preventDefault(),target=angular.element(event.currentTarget),row=target.parents(".row.table-main"),row.addClass("hidden"),editionRow=row.siblings(".edition"),editionRow.removeClass("hidden"),editionRow.find("input:visible").first().focus().select()}),$el.on("keyup",".edition input",function(event){var target;return 13===event.keyCode?(target=angular.element(event.currentTarget),saveValue(target)):27===event.keyCode?(target=angular.element(event.currentTarget),cancel(target)):void 0}),$el.on("keyup",".new-value input",function(event){var target;return 13===event.keyCode?(target=$el.find(".new-value"),saveNewValue(target)):27===event.keyCode?($el.find(".new-value").addClass("hidden"),initializeNewValue()):void 0}),$el.on("click",".save",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),saveValue(target)}),$el.on("click",".cancel",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),cancel(target)}),$el.on("click",".delete-value",function(event){var choices,formEl,subtitle,target,text,title,value;return event.preventDefault(),target=angular.element(event.currentTarget),formEl=target.parents("form"),value=formEl.scope().value,choices={},_.each($scope.values,function(option){return value.id!==option.id?choices[option.id]=option.name:void 0}),subtitle=value.name,0===_.keys(choices).length?$confirm.error($translate.instant("ADMIN.PROJECT_VALUES.ERROR_DELETE_ALL")):(title=$translate.instant("ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE"),text=$translate.instant("ADMIN.PROJECT_VALUES.REPLACEMENT"),$confirm.askChoice(title,subtitle,choices,text).then(function(response){var onError,onSucces;return onSucces=function(){return $ctrl.loadValues()["finally"](function(){return response.finish()})},onError=function(){return $confirm.notify("error")},$repo.remove(value,{moveTo:response.selected}).then(onSucces,onError)}))})},link=function($scope,$el,$attrs){return linkDragAndDrop($scope,$el,$attrs),linkValue($scope,$el,$attrs),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgProjectValues",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope",ProjectValuesDirective]),ColorSelectionDirective=function(){var link;return link=function($scope,$el,$attrs,$model){var $ctrl;return $ctrl=$el.controller(),$scope.$watch($attrs.ngModel,function(element){return $scope.color=element.color}),$el.on("click",".current-color",function(event){var body,target;return event.preventDefault(),event.stopPropagation(),target=angular.element(event.currentTarget),$el.find(".select-color").hide(),target.siblings(".select-color").show(),body=angular.element("body"),body.on("click",function(_this){return function(event){return 0===angular.element(event.target).parent(".select-color").length?($el.find(".select-color").hide(),body.unbind("click")):void 0}}(this))}),$el.on("click",".select-color .color",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),$scope.$apply(function(){return $model.$modelValue.color=target.data("color")}),$el.find(".select-color").hide()}),$el.on("click",".select-color .selected-color",function(event){return event.preventDefault(),$scope.$apply(function(){return $model.$modelValue.color=$scope.color}),$el.find(".select-color").hide()}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,require:"ngModel"}},module.directive("tgColorSelection",ColorSelectionDirective),TEXT_TYPE="text",MULTILINE_TYPE="multiline",DATE_TYPE="date",URL_TYPE="url",TYPE_CHOICES=[{key:TEXT_TYPE,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT"},{key:MULTILINE_TYPE,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI"},{key:DATE_TYPE,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE"},{key:URL_TYPE,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL"}],ProjectCustomAttributesController=function(superClass){function ProjectCustomAttributesController(scope,rootscope,repo,rs,params,q,location,navUrls,appMetaService,translate){this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.rs=rs,this.params=params,this.q=q,this.location=location,this.navUrls=navUrls,this.appMetaService=appMetaService,this.translate=translate,this.moveCustomAttributes=bind(this.moveCustomAttributes,this),this.deleteCustomAttribute=bind(this.deleteCustomAttribute,this),this.saveCustomAttribute=bind(this.saveCustomAttribute,this),this.createCustomAttribute=bind(this.createCustomAttribute,this),this.loadCustomAttributes=bind(this.loadCustomAttributes,this),this.scope.TYPE_CHOICES=TYPE_CHOICES,this.scope.project={},this.rootscope.$on("project:loaded",function(_this){return function(){var description,sectionName,title;return _this.loadCustomAttributes(),sectionName=_this.translate.instant(_this.scope.sectionName),title=_this.translate.instant("ADMIN.CUSTOM_ATTRIBUTES.PAGE_TITLE",{sectionName:sectionName,projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this))}return extend(ProjectCustomAttributesController,superClass),ProjectCustomAttributesController.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],ProjectCustomAttributesController.prototype.loadCustomAttributes=function(){return this.rs.customAttributes[this.scope.type].list(this.scope.projectId).then(function(_this){return function(customAttributes){return _this.scope.customAttributes=customAttributes,_this.scope.maxOrder=_.maxBy(customAttributes,"order").order, customAttributes}}(this))},ProjectCustomAttributesController.prototype.createCustomAttribute=function(attrValues){return this.repo.create("custom-attributes/"+this.scope.type,attrValues)},ProjectCustomAttributesController.prototype.saveCustomAttribute=function(attrModel){return this.repo.save(attrModel)},ProjectCustomAttributesController.prototype.deleteCustomAttribute=function(attrModel){return this.repo.remove(attrModel)},ProjectCustomAttributesController.prototype.moveCustomAttributes=function(attrModel,newIndex){var customAttributes,r;return customAttributes=this.scope.customAttributes,r=customAttributes.indexOf(attrModel),customAttributes.splice(r,1),customAttributes.splice(newIndex,0,attrModel),_.each(customAttributes,function(val,idx){return val.order=idx}),this.repo.saveAll(customAttributes)},ProjectCustomAttributesController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("ProjectCustomAttributesController",ProjectCustomAttributesController),ProjectCustomAttributesDirective=function($log,$confirm,animationFrame,$translate){var link;return link=function($scope,$el,$attrs){var $ctrl,cancelCreate,cancelUpdate,create,deleteCustomAttribute,hideAddButton,hideCancelButton,hideCreateForm,hideEditForm,resetNewAttr,revertChangesInCustomAttribute,showAddButton,showCancelButton,showCreateForm,showEditForm,sortableEl,update;return $ctrl=$el.controller(),$scope.$on("$destroy",function(){return $el.off()}),sortableEl=$el.find(".js-sortable"),sortableEl.sortable({handle:".js-view-custom-field",dropOnEmpty:!0,revert:400,axis:"y"}),sortableEl.on("sortstop",function(event,ui){var itemAttr,itemEl,itemIndex;return itemEl=ui.item,itemAttr=itemEl.scope().attr,itemIndex=itemEl.index(),$ctrl.moveCustomAttributes(itemAttr,itemIndex)}),showCreateForm=function(){return $el.find(".js-new-custom-field").removeClass("hidden"),$el.find(".js-new-custom-field input:visible").first().focus()},hideCreateForm=function(){return $el.find(".js-new-custom-field").addClass("hidden")},showAddButton=function(){return $el.find(".js-add-custom-field-button").removeClass("hidden")},hideAddButton=function(){return $el.find(".js-add-custom-field-button").addClass("hidden")},showCancelButton=function(){return $el.find(".js-cancel-new-custom-field-button").removeClass("hidden")},hideCancelButton=function(){return $el.find(".js-cancel-new-custom-field-button").addClass("hidden")},resetNewAttr=function(){return $scope.newAttr={}},create=function(formEl){var attr,form,onError,onSucces;return form=formEl.checksley(),form.validate()?(onSucces=function(_this){return function(){return $ctrl.loadCustomAttributes(),hideCreateForm(),resetNewAttr(),$confirm.notify("success")}}(this),onError=function(_this){return function(data){return form.setErrors(data)}}(this),attr=$scope.newAttr,attr.project=$scope.projectId,attr.order=$scope.maxOrder?$scope.maxOrder+1:1,$ctrl.createCustomAttribute(attr).then(onSucces,onError)):void 0},cancelCreate=function(){return hideCreateForm(),resetNewAttr()},$scope.$watch("customAttributes",function(customAttributes){return customAttributes?0===customAttributes.length?(hideCancelButton(),hideAddButton(),showCreateForm()):(hideCreateForm(),showAddButton(),showCancelButton()):void 0}),$el.on("click",".js-add-custom-field-button",function(event){return event.preventDefault(),showCreateForm()}),$el.on("click",".js-create-custom-field-button",debounce(2e3,function(event){var formEl,target;return event.preventDefault(),target=angular.element(event.currentTarget),formEl=target.closest("form"),create(formEl)})),$el.on("click",".js-cancel-new-custom-field-button",function(event){return event.preventDefault(),cancelCreate()}),$el.on("keyup",".js-new-custom-field input",function(event){var formEl,target;return 13===event.keyCode?(target=angular.element(event.currentTarget),formEl=target.closest("form"),create(formEl)):27===event.keyCode?cancelCreate():void 0}),showEditForm=function(formEl){return formEl.find(".js-view-custom-field").addClass("hidden"),formEl.find(".js-edit-custom-field").removeClass("hidden"),formEl.find(".js-edit-custom-field input:visible").first().focus().select()},hideEditForm=function(formEl){return formEl.find(".js-edit-custom-field").addClass("hidden"),formEl.find(".js-view-custom-field").removeClass("hidden")},revertChangesInCustomAttribute=function(formEl){return $scope.$apply(function(){return formEl.scope().attr.revert()})},update=function(formEl){var attr,form,onError,onSucces;return form=formEl.checksley(),form.validate()?(onSucces=function(_this){return function(){return $ctrl.loadCustomAttributes(),hideEditForm(formEl),$confirm.notify("success")}}(this),onError=function(_this){return function(data){return form.setErrors(data)}}(this),attr=formEl.scope().attr,$ctrl.saveCustomAttribute(attr).then(onSucces,onError)):void 0},cancelUpdate=function(formEl){return hideEditForm(formEl),revertChangesInCustomAttribute(formEl)},$el.on("click",".js-edit-custom-field-button",function(event){var formEl,target;return event.preventDefault(),target=angular.element(event.currentTarget),formEl=target.closest("form"),showEditForm(formEl)}),$el.on("click",".js-update-custom-field-button",debounce(2e3,function(event){var formEl,target;return event.preventDefault(),target=angular.element(event.currentTarget),formEl=target.closest("form"),update(formEl)})),$el.on("click",".js-cancel-edit-custom-field-button",function(event){var formEl,target;return event.preventDefault(),target=angular.element(event.currentTarget),formEl=target.closest("form"),cancelUpdate(formEl)}),$el.on("keyup",".js-edit-custom-field input",function(event){var formEl,target;return 13===event.keyCode?(target=angular.element(event.currentTarget),formEl=target.closest("form"),update(formEl)):27===event.keyCode?(target=angular.element(event.currentTarget),formEl=target.closest("form"),cancelUpdate(formEl)):void 0}),deleteCustomAttribute=function(formEl){var attr,message,text,title;return attr=formEl.scope().attr,message=attr.name,title=$translate.instant("COMMON.CUSTOM_ATTRIBUTES.DELETE"),text=$translate.instant("COMMON.CUSTOM_ATTRIBUTES.CONFIRM_DELETE"),$confirm.ask(title,text,message).then(function(response){var onError,onSucces;return onSucces=function(){return $ctrl.loadCustomAttributes()["finally"](function(){return response.finish()})},onError=function(){return $confirm.notify("error",null,"We have not been able to delete '"+message+"'.")},$ctrl.deleteCustomAttribute(attr).then(onSucces,onError)})},$el.on("click",".js-delete-custom-field-button",debounce(2e3,function(event){var formEl,target;return event.preventDefault(),target=angular.element(event.currentTarget),formEl=target.closest("form"),deleteCustomAttribute(formEl)}))},{link:link}},module.directive("tgProjectCustomAttributes",["$log","$tgConfirm","animationFrame","$translate",ProjectCustomAttributesDirective])}.call(this),function(){var EditRoleDirective,NewRoleDirective,RolePermissionsDirective,RolesController,RolesDirective,bindMethods,bindOnce,debounce,mixOf,module,taiga,bind=function(fn,me){return function(){return fn.apply(me,arguments)}},extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty,indexOf=[].indexOf||function(item){for(var i=0,l=this.length;l>i;i++)if(i in this&&this[i]===item)return i;return-1};taiga=this.taiga,mixOf=this.taiga.mixOf,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,bindMethods=this.taiga.bindMethods,module=angular.module("taigaAdmin"),RolesController=function(superClass){function RolesController(scope,rootscope,repo,confirm,rs,params,q,location,navUrls,appMetaService,translate){var promise;this.scope=scope,this.rootscope=rootscope,this.repo=repo,this.confirm=confirm,this.rs=rs,this.params=params,this.q=q,this.location=location,this.navUrls=navUrls,this.appMetaService=appMetaService,this.translate=translate,this._disableComputable=bind(this._disableComputable,this),this._enableComputable=bind(this._enableComputable,this),bindMethods(this),this.scope.sectionName="ADMIN.MENU.PERMISSIONS",this.scope.project={},this.scope.anyComputableRole=!0,promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ADMIN.ROLES.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(RolesController,superClass),RolesController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],RolesController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.i_am_admin||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.anyComputableRole=_.some(_.map(project.roles,function(point){return point.computable})),project}}(this))},RolesController.prototype.loadRoles=function(){return this.rs.roles.list(this.scope.projectId).then(function(_this){return function(roles){var public_permission;return roles=roles.map(function(role){return role.external_user=!1,role}),public_permission={name:_this.translate.instant("ADMIN.ROLES.EXTERNAL_USER"),permissions:_this.scope.project.public_permissions,external_user:!0},roles.push(public_permission),_this.scope.roles=roles,_this.scope.role=_this.scope.roles[0],roles}}(this))},RolesController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(){return _this.loadRoles()}}(this)),promise},RolesController.prototype.setRole=function(role){return this.scope.role=role,this.scope.$broadcast("role:changed",this.scope.role)},RolesController.prototype["delete"]=function(){var choices,i,len,ref,replacement,role,subtitle,title,warning;for(choices={},ref=this.scope.roles,i=0,len=ref.length;len>i;i++)role=ref[i],role.id!==this.scope.role.id&&(choices[role.id]=role.name);return 0===_.keys(choices).length?this.confirm.error(this.translate.instant("ADMIN.ROLES.ERROR_DELETE_ALL")):(title=this.translate.instant("ADMIN.ROLES.TITLE_DELETE_ROLE"),subtitle=this.scope.role.name,replacement=this.translate.instant("ADMIN.ROLES.REPLACEMENT_ROLE"),warning=this.translate.instant("ADMIN.ROLES.WARNING_DELETE_ROLE"),this.confirm.askChoice(title,subtitle,choices,replacement,warning).then(function(_this){return function(response){var onError,onSuccess;return onSuccess=function(){return _this.loadProject(),_this.loadRoles()["finally"](function(){return response.finish()})},onError=function(){return _this.confirm.notify("error")},_this.repo.remove(_this.scope.role,{moveTo:response.selected}).then(onSuccess,onError)}}(this)))},RolesController.prototype._enableComputable=function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.confirm.notify("success"),_this.loadProject()}}(this),onError=function(_this){return function(){return _this.confirm.notify("error"),_this.scope.role.revert()}}(this),this.repo.save(this.scope.role).then(onSuccess,onError)},RolesController.prototype._disableComputable=function(){var askOnError,askOnSuccess,message,subtitle,title;return askOnSuccess=function(_this){return function(response){var onError,onSuccess;return onSuccess=function(){return response.finish(),_this.confirm.notify("success"),_this.loadProject()},onError=function(){return response.finish(),_this.confirm.notify("error"),_this.scope.role.revert()},_this.repo.save(_this.scope.role).then(onSuccess,onError)}}(this),askOnError=function(_this){return function(response){return _this.scope.role.revert()}}(this),title=this.translate.instant("ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_TITLE"),subtitle=this.translate.instant("ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_SUBTITLE",{roleName:this.scope.role.name}),message=this.translate.instant("ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_MESSAGE"),this.confirm.ask(title,subtitle,message).then(askOnSuccess,askOnError)},RolesController.prototype.toggleComputable=debounce(2e3,function(){return this.scope.role.computable?this._enableComputable():this._disableComputable()}),RolesController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("RolesController",RolesController),EditRoleDirective=function($repo,$confirm){var link;return link=function($scope,$el,$attrs){var submit,toggleView;return toggleView=function(){return $el.find(".total").toggle(),$el.find(".edit-role").toggle()},submit=function(){var promise;return $scope.role.name=$el.find("input").val(),promise=$repo.save($scope.role),promise.then(function(){return $confirm.notify("success")}),promise.then(null,function(data){return $confirm.notify("error")}),toggleView()},$el.on("click",".edit-value",function(){return toggleView(),$el.find("input").focus(),$el.find("input").val($scope.role.name)}),$el.on("click","a.save",submit),$el.on("keyup","input",function(event){return 13===event.keyCode?submit():27===event.keyCode?toggleView():void 0}),$scope.$on("role:changed",function(){return $el.find(".edit-role").is(":visible")?toggleView():void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgEditRole",["$tgRepo","$tgConfirm",EditRoleDirective]),RolesDirective=function(){var link;return link=function($scope,$el,$attrs){var $ctrl;return $ctrl=$el.controller(),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgRoles",RolesDirective),NewRoleDirective=function($tgrepo,$confirm){var DEFAULT_PERMISSIONS,link;return DEFAULT_PERMISSIONS=["view_project","view_milestones","view_us","view_tasks","view_issues"],link=function($scope,$el,$attrs){var $ctrl;return $ctrl=$el.controller(),$scope.$on("$destroy",function(){return $el.off()}),$el.on("click","a.add-button",function(event){return event.preventDefault(),$el.find(".new").removeClass("hidden"),$el.find(".new").focus(),$el.find(".add-button").hide()}),$el.on("keyup",".new",function(event){var newRole,onError,onSuccess,target;return event.preventDefault(),13===event.keyCode?(target=angular.element(event.currentTarget),newRole={project:$scope.projectId,name:target.val(),permissions:DEFAULT_PERMISSIONS,order:_.maxBy($scope.roles,function(r){return r.order}).order+1,computable:!1},$el.find(".new").addClass("hidden"),$el.find(".new").val(""),onSuccess=function(role){var insertPosition;return insertPosition=$scope.roles.length-1,$scope.roles.splice(insertPosition,0,role),$ctrl.setRole(role),$el.find(".add-button").show(),$ctrl.loadProject()},onError=function(){return $confirm.notify("error")},$tgrepo.create("roles",newRole).then(onSuccess,onError)):27===event.keyCode?(target=angular.element(event.currentTarget),$el.find(".new").addClass("hidden"),$el.find(".new").val(""),$el.find(".add-button").show()):void 0})},{link:link}},module.directive("tgNewRole",["$tgRepo","$tgConfirm",NewRoleDirective]),RolePermissionsDirective=function($rootscope,$repo,$confirm,$compile){var baseTemplate,categoryTemplate,link,resumeTemplate;return resumeTemplate=_.template('
\n
\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\n <% _.each(category.permissions, function(permission) { %>\n
\n <% }) %>\n
\n\n \n'),categoryTemplate=_.template('
\n
\n
\n
\n
\n <% _.each(category.permissions, function(permission) { %>\n
\n \n
\n disabled="disabled" <% } %>\n <% if(permission.active) { %> checked="checked" <% } %>/>\n
\n \n \n
\n
\n <% }) %>\n
\n
\n
'),baseTemplate=_.template('
'),link=function($scope,$el,$attrs){var $ctrl,generateCategoriesFromRole,renderCategory,renderPermissions,renderResume;return $ctrl=$el.controller(),generateCategoriesFromRole=function(role){var categories,isPermissionEditable,issuePermissions,milestonePermissions,setActivePermissions,setActivePermissionsPerCategory,taskPermissions,userStoryPermissions,wikiPermissions;return setActivePermissions=function(permissions){return _.map(permissions,function(x){var ref;return _.extend({},x,{active:(ref=x.key,indexOf.call(role.permissions,ref)>=0)})})},isPermissionEditable=function(permission,role,project){return role.external_user&&!project.is_private&&0===permission.key.indexOf("view_")?!1:!0},setActivePermissionsPerCategory=function(category){return _.map(category,function(cat){return cat.permissions=cat.permissions.map(function(permission){return permission.editable=isPermissionEditable(permission,role,$scope.project),permission}),_.extend({},cat,{activePermissions:_.filter(cat.permissions,"active").length})})},categories=[],milestonePermissions=[{key:"view_milestones",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.VIEW_SPRINTS"},{key:"add_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.ADD_SPRINTS"},{key:"modify_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.MODIFY_SPRINTS"},{key:"delete_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.DELETE_SPRINTS"}],categories.push({name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.NAME",permissions:setActivePermissions(milestonePermissions)}),userStoryPermissions=[{key:"view_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.VIEW_USER_STORIES"},{key:"add_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.ADD_USER_STORIES"},{key:"modify_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.MODIFY_USER_STORIES"},{key:"delete_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.DELETE_USER_STORIES"}],categories.push({name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.NAME",permissions:setActivePermissions(userStoryPermissions)}),taskPermissions=[{key:"view_tasks",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.VIEW_TASKS"},{key:"add_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.ADD_TASKS"},{key:"modify_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.MODIFY_TASKS"},{key:"delete_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.DELETE_TASKS"}],categories.push({name:"COMMON.PERMISIONS_CATEGORIES.TASKS.NAME",permissions:setActivePermissions(taskPermissions)}),issuePermissions=[{key:"view_issues",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.VIEW_ISSUES"},{key:"add_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.ADD_ISSUES"},{key:"modify_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.MODIFY_ISSUES"},{key:"delete_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.DELETE_ISSUES"}],categories.push({name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.NAME",permissions:setActivePermissions(issuePermissions)}),wikiPermissions=[{key:"view_wiki_pages",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_PAGES"},{key:"add_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_PAGES"},{key:"modify_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.MODIFY_WIKI_PAGES"},{key:"delete_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_PAGES"},{key:"view_wiki_links",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_LINKS"},{key:"add_wiki_link",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_LINKS"},{key:"delete_wiki_link",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_LINKS"}],categories.push({name:"COMMON.PERMISIONS_CATEGORIES.WIKI.NAME",permissions:setActivePermissions(wikiPermissions)}),setActivePermissionsPerCategory(categories)},renderResume=function(element,category){return element.find(".resume").html($compile(resumeTemplate({category:category}))($scope))},renderCategory=function(category,index){var html;return html=categoryTemplate({category:category,index:index}),html=angular.element(html),renderResume(html,category),$compile(html)($scope)},renderPermissions=function(){var html;return $el.off(),html=baseTemplate(),_.each(generateCategoriesFromRole($scope.role),function(category,index){return html=angular.element(html).append(renderCategory(category,index))}),$el.html(html),$el.on("click",".resume",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),target.toggleClass("open-drawer"),target.next().toggleClass("open")}),$el.on("change",".category-item input",function(event){var getActivePermissions,onError,onSuccess,target;return getActivePermissions=function(){var activePermissions;return activePermissions=_.filter($el.find(".category-item input"),function(t){return angular.element(t).is(":checked")}),activePermissions=_.sortBy(_.map(activePermissions,function(t){var permission;return permission=angular.element(t).parents(".category-item").data("id")})),activePermissions.length&&activePermissions.push("view_project"),activePermissions},target=angular.element(event.currentTarget),$scope.role.permissions=getActivePermissions(),onSuccess=function(){var categories,categoryId;return categories=generateCategoriesFromRole($scope.role),categoryId=target.parents(".category-config").data("id"),renderResume(target.parents(".category-config"),categories[categoryId]),$rootscope.$broadcast("projects:reload"),$confirm.notify("success"),$ctrl.loadProject()},onError=function(){return $confirm.notify("error"),target.prop("checked",!target.prop("checked")),$scope.role.permissions=getActivePermissions()},$scope.role.external_user?($scope.project.public_permissions=$scope.role.permissions,$scope.project.anon_permissions=$scope.role.permissions.filter(function(permission){return 0===permission.indexOf("view_")}),$repo.save($scope.project).then(onSuccess,onError)):$repo.save($scope.role).then(onSuccess,onError)})},$scope.$on("$destroy",function(){return $el.off()}),$scope.$on("role:changed",function(){return renderPermissions()}),bindOnce($scope,$attrs.ngModel,renderPermissions)},{link:link}},module.directive("tgRolePermissions",["$rootScope","$tgRepo","$tgConfirm","$compile",RolePermissionsDirective])}.call(this),function(){var BitbucketController,BitbucketWebhooksDirective,GithubController,GithubWebhooksDirective,GitlabController,GitlabWebhooksDirective,NewWebhookDirective,SelectInputText,ValidOriginIpsDirective,WebhookDirective,WebhooksController,bindMethods,debounce,mixOf,module,taiga,timeout,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,bindMethods=this.taiga.bindMethods,debounce=this.taiga.debounce,timeout=this.taiga.timeout,module=angular.module("taigaAdmin"),WebhooksController=function(superClass){function WebhooksController(scope,repo,rs,params,location,navUrls,appMetaService,translate){var promise;this.scope=scope,this.repo=repo,this.rs=rs,this.params=params,this.location=location,this.navUrls=navUrls,this.appMetaService=appMetaService,this.translate=translate,bindMethods(this),this.scope.sectionName="ADMIN.WEBHOOKS.SECTION_NAME",this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ADMIN.WEBHOOKS.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("webhooks:reload",this.loadWebhooks)}return extend(WebhooksController,superClass),WebhooksController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],WebhooksController.prototype.loadWebhooks=function(){return this.rs.webhooks.list(this.scope.projectId).then(function(_this){return function(webhooks){return _this.scope.webhooks=webhooks}}(this))},WebhooksController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return project.i_am_admin||_this.location.path(_this.navUrls.resolve("permission-denied")),_this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},WebhooksController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(){return _this.loadWebhooks()}}(this)),promise},WebhooksController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("WebhooksController",WebhooksController),WebhookDirective=function($rs,$repo,$confirm,$loading,$translate){var link;return link=function($scope,$el,$attrs){var cancel,openHistory,save,showEditMode,showVisualizationMode,updateLogs,updateShowHideHistoryText,webhook;return webhook=$scope.$eval($attrs.tgWebhook),updateLogs=function(){var prettyDate;return prettyDate=$translate.instant("ADMIN.WEBHOOKS.DATE"),$rs.webhooklogs.list(webhook.id).then(function(_this){return function(webhooklogs){var i,len,log,ref;for(i=0,len=webhooklogs.length;len>i;i++)log=webhooklogs[i],log.validStatus=200<=(ref=log.status)&&300>ref,log.prettySentHeaders=_.map(_.toPairs(log.request_headers),function(arg){var header,value;return header=arg[0],value=arg[1],header+": "+value}).join("\n"),log.prettySentData=JSON.stringify(log.request_data),log.prettyDate=moment(log.created).format(prettyDate);return webhook.logs_counter=webhooklogs.length,webhook.logs=webhooklogs,updateShowHideHistoryText()}}(this))},updateShowHideHistoryText=function(){var historyElement,text,textElement,title;return textElement=$el.find(".toggle-history"),historyElement=textElement.parents(".single-webhook-wrapper").find(".webhooks-history"),historyElement.hasClass("open")?(text=$translate.instant("ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY"),title=$translate.instant("ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY_TITLE")):(text=$translate.instant("ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY"),title=$translate.instant("ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY_TITLE")),textElement.text(text),textElement.prop("title",title)},showVisualizationMode=function(){return $el.find(".edition-mode").addClass("hidden"),$el.find(".visualization-mode").removeClass("hidden")},showEditMode=function(){return $el.find(".visualization-mode").addClass("hidden"),$el.find(".edition-mode").removeClass("hidden")},openHistory=function(){return $el.find(".webhooks-history").addClass("open")},cancel=function(){return showVisualizationMode(),$scope.$apply(function(){return webhook.revert()})},save=debounce(2e3,function(target){var form,promise;return form=target.parents("form").checksley(),form.validate()?(promise=$repo.save(webhook),promise.then(function(_this){return function(){return showVisualizationMode()}}(this)),promise.then(null,function(data){return $confirm.notify("error"),form.setErrors(data)})):void 0}),$el.on("click",".test-webhook",function(){return openHistory(),$rs.webhooks.test(webhook.id).then(function(_this){return function(){return updateLogs()}}(this))}),$el.on("click",".edit-webhook",function(){return showEditMode()}),$el.on("click",".cancel-existing",function(){return cancel()}),$el.on("click",".edit-existing",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),save(target)}),$el.on("keyup",".edition-mode input",function(event){var target;return 13===event.keyCode?(target=angular.element(event.currentTarget),save(target)):27===event.keyCode?(target=angular.element(event.currentTarget),cancel(target)):void 0}),$el.on("click",".delete-webhook",function(){var message,title;return title=$translate.instant("ADMIN.WEBHOOKS.DELETE"),message=$translate.instant("ADMIN.WEBHOOKS.WEBHOOK_NAME",{name:webhook.name}),$confirm.askOnDelete(title,message).then(function(_this){return function(askResponse){var onError,onSucces;return onSucces=function(){return askResponse.finish(),$scope.$emit("webhooks:reload")},onError=function(){return askResponse.finish(!1),$confirm.notify("error")},$repo.remove(webhook).then(onSucces,onError)}}(this))}),$el.on("click",".toggle-history",function(event){var target;return target=angular.element(event.currentTarget),null==webhook.logs||0===webhook.logs.length?updateLogs().then(function(){return timeout(0,function(){return $el.find(".webhooks-history").toggleClass("open"),updateShowHideHistoryText()})}):($el.find(".webhooks-history").toggleClass("open"),$scope.$apply(function(){return updateShowHideHistoryText()}))}),$el.on("click",".history-single",function(event){var target;return target=angular.element(event.currentTarget),target.toggleClass("history-single-open"),target.siblings(".history-single-response").toggleClass("open")}),$el.on("click",".resend-request",function(event){var log,target;return target=angular.element(event.currentTarget),log=target.data("log"),$rs.webhooklogs.resend(log).then(function(_this){return function(){return updateLogs()}}(this))})},{link:link}},module.directive("tgWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading","$translate",WebhookDirective]),NewWebhookDirective=function($rs,$repo,$confirm,$loading){var link;return link=function($scope,$el,$attrs){var addWebhookDOMNode,formDOMNode,initializeNewValue,save,webhook;return webhook=$scope.$eval($attrs.tgWebhook),formDOMNode=$el.find(".new-webhook-form"),addWebhookDOMNode=$el.find(".add-webhook"),initializeNewValue=function(){return $scope.newValue={name:"",url:"",key:""}},initializeNewValue(),$scope.$watch("webhooks",function(webhooks){return null!=webhooks?0===webhooks.length?(formDOMNode.removeClass("hidden"),addWebhookDOMNode.addClass("hidden"),formDOMNode.find("input")[0].focus()):(formDOMNode.addClass("hidden"),addWebhookDOMNode.removeClass("hidden")):void 0}),save=debounce(2e3,function(){var form,promise;return form=formDOMNode.checksley(),form.validate()?($scope.newValue.project=$scope.project.id,promise=$repo.create("webhooks",$scope.newValue),promise.then(function(_this){return function(){return $scope.$emit("webhooks:reload"),initializeNewValue()}}(this)),promise.then(null,function(data){return $confirm.notify("error"),form.setErrors(data)})):void 0}),formDOMNode.on("click",".add-new",function(event){return event.preventDefault(),save()}),formDOMNode.on("keyup","input",function(event){return 13===event.keyCode?save():void 0}),formDOMNode.on("click",".cancel-new",function(event){return $scope.$apply(function(){return initializeNewValue(),$scope.webhooks.length>=1?formDOMNode.addClass("hidden"):void 0})}),addWebhookDOMNode.on("click",function(event){return formDOMNode.removeClass("hidden"),formDOMNode.find("input")[0].focus()})},{link:link}},module.directive("tgNewWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading",NewWebhookDirective]),GithubController=function(superClass){function GithubController(scope,repo,rs,params,appMetaService,translate){var promise;this.scope=scope,this.repo=repo, this.rs=rs,this.params=params,this.appMetaService=appMetaService,this.translate=translate,bindMethods(this),this.scope.sectionName=this.translate.instant("ADMIN.GITHUB.SECTION_NAME"),this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ADMIN.GITHUB.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return extend(GithubController,superClass),GithubController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],GithubController.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"github").then(function(_this){return function(github){return _this.scope.github=github}}(this))},GithubController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},GithubController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(){return _this.loadModules()}}(this)),promise},GithubController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("GithubController",GithubController),GitlabController=function(superClass){function GitlabController(scope,repo,rs,params,appMetaService,translate){var promise;this.scope=scope,this.repo=repo,this.rs=rs,this.params=params,this.appMetaService=appMetaService,this.translate=translate,bindMethods(this),this.scope.sectionName=this.translate.instant("ADMIN.GITLAB.SECTION_NAME"),this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ADMIN.GITLAB.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(_this){return function(){return _this.loadModules()}}(this))}return extend(GitlabController,superClass),GitlabController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],GitlabController.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"gitlab").then(function(_this){return function(gitlab){return _this.scope.gitlab=gitlab}}(this))},GitlabController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},GitlabController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(){return _this.loadModules()}}(this)),promise},GitlabController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("GitlabController",GitlabController),BitbucketController=function(superClass){function BitbucketController(scope,repo,rs,params,appMetaService,translate){var promise;this.scope=scope,this.repo=repo,this.rs=rs,this.params=params,this.appMetaService=appMetaService,this.translate=translate,bindMethods(this),this.scope.sectionName=this.translate.instant("ADMIN.BITBUCKET.SECTION_NAME"),this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){var description,title;return title=_this.translate.instant("ADMIN.BITBUCKET.PAGE_TITLE",{projectName:_this.scope.project.name}),description=_this.scope.project.description,_this.appMetaService.setAll(title,description)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(_this){return function(){return _this.loadModules()}}(this))}return extend(BitbucketController,superClass),BitbucketController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],BitbucketController.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"bitbucket").then(function(_this){return function(bitbucket){return _this.scope.bitbucket=bitbucket}}(this))},BitbucketController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},BitbucketController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(){return _this.loadModules()}}(this)),promise},BitbucketController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("BitbucketController",BitbucketController),SelectInputText=function(){var link;return link=function($scope,$el,$attrs){return $el.on("click",".select-input-content",function(){return $el.find("input").select(),$el.find(".help-copy").addClass("visible")})},{link:link}},module.directive("tgSelectInputText",SelectInputText),GithubWebhooksDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el,$attrs){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(_this){return function(event){var currentLoading,promise;return event.preventDefault(),form.validate()?(currentLoading=$loading().target(submitButton).start(),promise=$repo.saveAttribute($scope.github,"github"),promise.then(function(){return currentLoading.finish(),$confirm.notify("success")}),promise.then(null,function(data){return currentLoading.finish(),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit)},{link:link}},module.directive("tgGithubWebhooks",["$tgRepo","$tgConfirm","$tgLoading",GithubWebhooksDirective]),GitlabWebhooksDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el,$attrs){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(_this){return function(event){var currentLoading,promise;return event.preventDefault(),form.validate()?(currentLoading=$loading().target(submitButton).start(),promise=$repo.saveAttribute($scope.gitlab,"gitlab"),promise.then(function(){return currentLoading.finish(),$confirm.notify("success"),$scope.$emit("project:modules:reload")}),promise.then(null,function(data){return currentLoading.finish(),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit)},{link:link}},module.directive("tgGitlabWebhooks",["$tgRepo","$tgConfirm","$tgLoading",GitlabWebhooksDirective]),BitbucketWebhooksDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el,$attrs){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(_this){return function(event){var currentLoading,promise;return event.preventDefault(),form.validate()?(currentLoading=$loading().target(submitButton).start(),promise=$repo.saveAttribute($scope.bitbucket,"bitbucket"),promise.then(function(){return currentLoading.finish(),$confirm.notify("success"),$scope.$emit("project:modules:reload")}),promise.then(null,function(data){return currentLoading.finish(),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit)},{link:link}},module.directive("tgBitbucketWebhooks",["$tgRepo","$tgConfirm","$tgLoading",BitbucketWebhooksDirective]),ValidOriginIpsDirective=function(){var link;return link=function($scope,$el,$attrs,$ngModel){return $ngModel.$parsers.push(function(value){return value=$.trim(value),""===value?[]:value.split(",")})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgValidOriginIps",ValidOriginIpsDirective)}.call(this),function(){var createProjectRestrictionDirective,module;module=angular.module("taigaProject"),createProjectRestrictionDirective=function(){return{templateUrl:"project/wizard-restrictions.html"}},module.directive("tgCreateProjectRestriction",[createProjectRestrictionDirective])}.call(this),function(){var CreateProject,DeleteProjectDirective,bindOnce,debounce,module,taiga,timeout;taiga=this.taiga,bindOnce=this.taiga.bindOnce,timeout=this.taiga.timeout,debounce=this.taiga.debounce,module=angular.module("taigaProject"),CreateProject=function($rootscope,$repo,$confirm,$location,$navurls,$rs,$projectUrl,$loading,lightboxService,$cacheFactory,$translate,currentUserService,$auth){var directive,link;return link=function($scope,$el,attrs){var currentLoading,form,onErrorSubmit,onSuccessSubmit,openLightbox,submit,submitButton;return $scope.data={},$scope.templates=[],currentLoading=null,$auth.refresh(),$scope.canCreatePrivateProjects=currentUserService.canCreatePrivateProjects(),$scope.canCreatePublicProjects=currentUserService.canCreatePublicProjects(),form=$el.find("form").checksley({onlyOneErrorElement:!0}),onSuccessSubmit=function(response){return $cacheFactory.get("$http").removeAll(),currentLoading.finish(),$rootscope.$broadcast("projects:reload"),$confirm.notify("success",$translate.instant("COMMON.SAVE")),$location.url($projectUrl.get(response)),lightboxService.close($el),currentUserService.loadProjects()},onErrorSubmit=function(response){var error_field,i,len,ref,results,selectors;for(currentLoading.finish(),form.setErrors(response),selectors=[],ref=_.keys(response),results=[],i=0,len=ref.length;len>i;i++)error_field=ref[i],results.push(selectors.push("[name="+error_field+"]"));return results},submit=function(_this){return function(event){var promise;return event.preventDefault(),form.validate()?(currentLoading=$loading().target(submitButton).start(),promise=$repo.create("projects",$scope.data),promise.then(onSuccessSubmit,onErrorSubmit)):void 0}}(this),openLightbox=function(){return $scope.data={is_private:!1},$scope.templates.length?$scope.data.creation_template=_.head(_.filter($scope.templates,function(x){return"scrum"===x.slug})).id:$rs.projects.templates().then(function(_this){return function(result){return $scope.templates=result,$scope.data.creation_template=_.head(_.filter($scope.templates,function(x){return"scrum"===x.slug})).id}}(this)),lightboxService.open($el)},submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".close",function(event){return event.preventDefault(),lightboxService.close($el)}),$scope.$on("$destroy",function(){return $el.off()}),openLightbox()},directive={link:link,templateUrl:"project/wizard-create-project.html",scope:{}}},module.directive("tgLbCreateProject",["$rootScope","$tgRepo","$tgConfirm","$location","$tgNavUrls","$tgResources","$projectUrl","$tgLoading","lightboxService","$cacheFactory","$translate","tgCurrentUserService","$tgAuth",CreateProject]),DeleteProjectDirective=function($repo,$rootscope,$auth,$location,$navUrls,$confirm,lightboxService,tgLoader,currentUserService){var link;return link=function($scope,$el,$attrs){var projectToDelete,submit;return projectToDelete=null,$scope.$on("deletelightbox:new",function(ctx,project){return lightboxService.open($el),projectToDelete=project}),$scope.$on("$destroy",function(){return $el.off()}),submit=function(){var promise;return tgLoader.start(),lightboxService.close($el),promise=$repo.remove(projectToDelete),promise.then(function(data){return tgLoader.pageLoaded(),$rootscope.$broadcast("projects:reload"),$location.path($navUrls.resolve("home")),$confirm.notify("success"),currentUserService.loadProjects()}),promise.then(null,function(){return $confirm.notify("error"),lightboxService.close($el)})},$el.on("click",".button-red",function(event){return event.preventDefault(),lightboxService.close($el)}),$el.on("click",".button-green",function(event){return event.preventDefault(),submit()})},{link:link}},module.directive("tgLbDeleteProject",["$tgRepo","$rootScope","$tgAuth","$tgLocation","$tgNavUrls","$tgConfirm","lightboxService","tgLoader","tgCurrentUserService",DeleteProjectDirective])}.call(this),function(){var BindHtmlDirective,BindOnceAltDirective,BindOnceBindDirective,BindOnceHrefDirective,BindOnceHtmlDirective,BindOnceRefDirective,BindOnceSrcDirective,BindOnceTitleDirective,BindTitleDirective,bindOnce,module;bindOnce=this.taiga.bindOnce,BindOnceBindDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoBind,function(val){return $el.text(val)})},{link:link}},BindOnceHtmlDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoHtml,function(val){return $el.html(val)})},{link:link}},BindOnceRefDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoRef,function(val){return $el.html("#"+val+" ")})},{link:link}},BindOnceSrcDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoSrc,function(val){return $el.attr("src",val)})},{link:link}},BindOnceHrefDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoHref,function(val){return $el.attr("href",val)})},{link:link}},BindOnceAltDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoAlt,function(val){return $el.attr("alt",val)})},{link:link}},BindOnceTitleDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoTitle,function(val){return $el.attr("title",val)})},{link:link}},BindTitleDirective=function(){var link;return link=function($scope,$el,$attrs){return $scope.$watch($attrs.tgTitleHtml,function(val){return null!=val?$el.attr("title",val):void 0})},{link:link}},BindHtmlDirective=function(){var link;return link=function($scope,$el,$attrs){return $scope.$watch($attrs.tgBindHtml,function(val){return null!=val?$el.html(val):void 0})},{link:link}},module=angular.module("taigaBase"),module.directive("tgBoBind",BindOnceBindDirective),module.directive("tgBoHtml",BindOnceHtmlDirective),module.directive("tgBoRef",BindOnceRefDirective),module.directive("tgBoSrc",BindOnceSrcDirective),module.directive("tgBoHref",BindOnceHrefDirective),module.directive("tgBoAlt",BindOnceAltDirective),module.directive("tgBoTitle",BindOnceTitleDirective),module.directive("tgBindTitle",BindTitleDirective),module.directive("tgBindHtml",BindHtmlDirective)}.call(this),function(){var ConfigurationService,module;ConfigurationService=function(){function ConfigurationService(){this.config=window.taigaConfig}return ConfigurationService.prototype.get=function(key,defaultValue){return null==defaultValue&&(defaultValue=null),_.has(this.config,key)?this.config[key]:defaultValue},ConfigurationService}(),module=angular.module("taigaBase"),module.service("$tgConfig",ConfigurationService)}.call(this),function(){var ContribController,ContribUserSettingsController,module,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;module=angular.module("taigaBase"),ContribController=function(superClass){function ContribController(rootScope,scope,params,repo,rs,confirm){var promise;this.rootScope=rootScope,this.scope=scope,this.params=params,this.repo=repo,this.rs=rs,this.confirm=confirm,this.scope.currentPlugin=_.head(_.filter(this.rootScope.adminPlugins,{slug:this.params.plugin})),this.scope.projectSlug=this.params.pslug,promise=this.loadInitialData(),promise.then(null,function(_this){return function(){return _this.confirm.notify("error")}}(this))}return extend(ContribController,superClass),ContribController.$inject=["$rootScope","$scope","$routeParams","$tgRepo","$tgResources","$tgConfirm"],ContribController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.$broadcast("project:loaded",project),project}}(this))},ContribController.prototype.loadInitialData=function(){return this.loadProject()},ContribController}(taiga.Controller),module.controller("ContribController",ContribController),ContribUserSettingsController=function(superClass){function ContribUserSettingsController(rootScope,scope,params){this.rootScope=rootScope,this.scope=scope,this.params=params,this.scope.currentPlugin=_.head(_.filter(this.rootScope.userSettingsPlugins,{slug:this.params.plugin}))}return extend(ContribUserSettingsController,superClass),ContribUserSettingsController.$inject=["$rootScope","$scope","$routeParams"],ContribUserSettingsController}(taiga.Controller),module.controller("ContribUserSettingsController",ContribUserSettingsController)}.call(this),function(){var FiltersStorageService,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,FiltersStorageService=function(superClass){function FiltersStorageService(storage,params){this.storage=storage,this.params=params}return extend(FiltersStorageService,superClass),FiltersStorageService.$inject=["$tgStorage","$routeParams"],FiltersStorageService.prototype.generateHash=function(components){return null==components&&(components=[]),components=_.map(components,function(x){return JSON.stringify(x)}),hex_sha1(components.join(":"))},FiltersStorageService}(taiga.Service)}.call(this),function(){var HttpService,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,HttpService=function(superClass){function HttpService(http,q,storage,rootScope,cacheFactory,translate){this.http=http,this.q=q,this.storage=storage,this.rootScope=rootScope,this.cacheFactory=cacheFactory,this.translate=translate,HttpService.__super__.constructor.call(this),this.cache=this.cacheFactory("httpget")}return extend(HttpService,superClass),HttpService.$inject=["$http","$q","$tgStorage","$rootScope","$cacheFactory","$translate"],HttpService.prototype.headers=function(){var headers,lang,token;return headers={},token=this.storage.get("token"),token&&(headers.Authorization="Bearer "+token),lang=this.translate.preferredLanguage(),lang&&(headers["Accept-Language"]=lang),headers},HttpService.prototype.request=function(options){return options.headers=_.assign({},options.headers||{},this.headers()),this.http(options)},HttpService.prototype.get=function(url,params,options){return options=_.assign({method:"GET",url:url},options),params&&(options.params=params),options.cache=this.cache,this.request(options)["finally"](function(_this){return function(data){return _this.cache.removeAll()}}(this))},HttpService.prototype.post=function(url,data,params,options){return options=_.assign({method:"POST",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype.put=function(url,data,params,options){return options=_.assign({method:"PUT",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype.patch=function(url,data,params,options){return options=_.assign({method:"PATCH",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype["delete"]=function(url,data,params,options){return options=_.assign({method:"DELETE",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgHttp",HttpService)}.call(this),function(){var locationFactory,module;locationFactory=function($location,$route,$rootscope){return $location.noreload=function(scope){var lastRoute,un;return lastRoute=$route.current,un=scope.$on("$locationChangeSuccess",function(){return $route.current=lastRoute,un()}),$location},$location.isInCurrentRouteParams=function(name,value){var params;return params=$location.search()||{},params[name]===value},$location},module=angular.module("taigaBase"),module.factory("$tgLocation",["$location","$route","$rootScope",locationFactory])}.call(this),function(){var Model,ModelService,module,provider,taiga,indexOf=[].indexOf||function(item){for(var i=0,l=this.length;l>i;i++)if(i in this&&this[i]===item)return i;return-1},extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;Model=function(){function Model(name,data,dataTypes){this._attrs=data,this._name=name,this._dataTypes=dataTypes,this.setAttrs(data),this.initialize()}return Model.prototype.clone=function(){var instance;return instance=new Model(this._name,this._attrs,this._dataTypes),instance._modifiedAttrs=this._modifiedAttrs,instance._isModified=this._isModified,instance},Model.prototype.applyCasts=function(){var attrName,castMethod,castName,ref,results;ref=this._dataTypes,results=[];for(attrName in ref)castName=ref[attrName],castMethod=service.casts[castName],castMethod&&results.push(this._attrs[attrName]=castMethod(this._attrs[attrName]));return results},Model.prototype.getIdAttrName=function(){return"id"},Model.prototype.getName=function(){return this._name},Model.prototype.getAttrs=function(patch){return null==patch&&(patch=!1),null!=this._attrs.version&&(this._modifiedAttrs.version=this._attrs.version),patch?_.extend({},this._modifiedAttrs):_.extend({},this._attrs,this._modifiedAttrs)},Model.prototype.setAttrs=function(attrs){return this._attrs=attrs,this._modifiedAttrs={},this.applyCasts(),this._isModified=!1},Model.prototype.setAttr=function(name,value){return this._modifiedAttrs[name]=value,this._isModified=!0},Model.prototype.initialize=function(){var getter,self,setter;return self=this,getter=function(name){return function(){return"string"==typeof name&&"__"===name.substr(0,2)?self[name]:indexOf.call(_.keys(self._modifiedAttrs),name)<0?self._attrs[name]:self._modifiedAttrs[name]}},setter=function(name){return function(value){return"string"==typeof name&&"__"===name.substr(0,2)?void(self[name]=value):void(self._attrs[name]!==value?(self._modifiedAttrs[name]=value,self._isModified=!0):delete self._modifiedAttrs[name])}},_.each(this._attrs,function(value,name){var options;return options={get:getter(name),set:setter(name),enumerable:!0,configurable:!0},Object.defineProperty(self,name,options)})},Model.prototype.serialize=function(){var data;return data={data:_.clone(this._attrs),name:this._name},JSON.stringify(data)},Model.prototype.isModified=function(){return this._isModified},Model.prototype.isAttributeModified=function(attribute){return null!=this._modifiedAttrs[attribute]},Model.prototype.markSaved=function(){return this._isModified=!1,this._attrs=this.getAttrs(),this._modifiedAttrs={}},Model.prototype.revert=function(){return this._modifiedAttrs={},this._isModified=!1},Model.desSerialize=function(sdata){var ddata,model;return ddata=JSON.parse(sdata),model=new Model(ddata.url,ddata.data)},Model}(),taiga=this.taiga,ModelService=function(superClass){function ModelService(q,urls,storage,http){this.q=q,this.urls=urls,this.storage=storage,this.http=http,ModelService.__super__.constructor.call(this)}return extend(ModelService,superClass),ModelService.$inject=["$q","$tgUrls","$tgStorage","$tgHttp"],ModelService}(taiga.Service),provider=function($q,$http,$gmUrls,$gmStorage){var service;return service={},service.make_model=function(name,data,cls,dataTypes){return null==cls&&(cls=Model),null==dataTypes&&(dataTypes={}),new cls(name,data,dataTypes)},service.cls=Model,service.casts={"int":function(value){return parseInt(value,10)},"float":function(value){return parseFloat(value,10)}},service},module=angular.module("taigaBase"),module.factory("$tgModel",["$q","$http","$tgUrls","$tgStorage",provider])}.call(this),function(){var NavigationUrlsDirective,NavigationUrlsService,bindOnce,module,taiga,trim,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,trim=this.taiga.trim,bindOnce=this.taiga.bindOnce,module=angular.module("taigaBase"),NavigationUrlsService=function(superClass){function NavigationUrlsService(){this.urls={}}return extend(NavigationUrlsService,superClass),NavigationUrlsService.prototype.update=function(urls){return this.urls=_.merge({},this.urls,urls||{})},NavigationUrlsService.prototype.formatUrl=function(url,ctx){var replacer;return null==ctx&&(ctx={}),replacer=function(match){return match=trim(match,":"),ctx[match]||"undefined"},url.replace(/(:\w+)/g,replacer)},NavigationUrlsService.prototype.resolve=function(name,ctx){var url;return url=this.urls[name],url?ctx?this.formatUrl(url,ctx):url:""},NavigationUrlsService}(taiga.Service),module.service("$tgNavUrls",NavigationUrlsService),NavigationUrlsDirective=function($navurls,$auth,$q,$location,lightboxService){var bindOnceP,link,parseNav;return bindOnceP=function($scope,attr){var defered;return defered=$q.defer(),bindOnce($scope,attr,function(v){return defered.resolve(v)}),defered.promise},parseNav=function(data,$scope){var index,name,obj,params,promises,ref,result,values;if(ref=_.map(data.split(":"),trim),name=ref[0],params=ref[1],params)for(result=params.split(/(\w+)=/),result=_.filter(result,function(str){return str.length}),result=_.map(result,function(str){return trim(str.replace(/,$/g,""))}),params=[],index=0;indexi;i++)param=params[i],key=Object.keys(param)[0],value=param[key],options[key]=$scope.$eval(value);return[name,options]})},link=function($scope,$el,$attrs){return $el.is("a")&&$el.attr("href","#"),$el.on("mouseenter",function(event){var target;return target=$(event.currentTarget),target.data("fullUrl")&&$attrs.tgNavGetParams===target.data("params")?void 0:parseNav($attrs.tgNav,$scope).then(function(result){var fullUrl,getURLParams,getURLParamsStr,name,options,url,user;return name=result[0],options=result[1],user=$auth.getUser(),user&&(options.user=user.username),url=$navurls.resolve(name),fullUrl=$navurls.formatUrl(url,options),$attrs.tgNavGetParams&&(getURLParams=JSON.parse($attrs.tgNavGetParams),getURLParamsStr=$.param(getURLParams),fullUrl=fullUrl+"?"+getURLParamsStr,target.data("params",$attrs.tgNavGetParams)),target.data("fullUrl",fullUrl),target.is("a")&&target.attr("href",fullUrl),$el.on("click",function(event){if(!event.metaKey&&!event.ctrlKey&&(event.preventDefault(),target=$(event.currentTarget),!target.hasClass("noclick"))){switch(fullUrl=target.data("fullUrl"),event.which){case 1:$location.url(fullUrl),$scope.$apply();break;case 2:window.open(fullUrl)}return lightboxService.closeAll()}})})}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgNav",["$tgNavUrls","$tgAuth","$q","$tgLocation","lightboxService",NavigationUrlsDirective])}.call(this),function(){var RepositoryService,module,taiga,extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;taiga=this.taiga,RepositoryService=function(superClass){function RepositoryService(q,model1,storage,http,urls){this.q=q,this.model=model1,this.storage=storage,this.http=http,this.urls=urls,RepositoryService.__super__.constructor.call(this)}return extend(RepositoryService,superClass),RepositoryService.$inject=["$q","$tgModel","$tgStorage","$tgHttp","$tgUrls"],RepositoryService.prototype.resolveUrlForModel=function(model){var idAttrName;return idAttrName=model.getIdAttrName(),this.urls.resolve(model.getName())+"/"+model[idAttrName]},RepositoryService.prototype.resolveUrlForAttributeModel=function(model){return this.urls.resolve(model.getName(),model.parent)},RepositoryService.prototype.create=function(name,data,dataTypes,extraParams){var defered,promise,url;return null==dataTypes&&(dataTypes={}),null==extraParams&&(extraParams={}),defered=this.q.defer(),url=this.urls.resolve(name),promise=this.http.post(url,JSON.stringify(data)),promise.success(function(_this){return function(_data,_status){return defered.resolve(_this.model.make_model(name,_data,null,dataTypes))}}(this)),promise.error(function(_this){return function(data,status){return defered.reject(data)}}(this)),defered.promise},RepositoryService.prototype.remove=function(model,params){var defered,promise,url;return null==params&&(params={}),defered=this.q.defer(),url=this.resolveUrlForModel(model),promise=this.http["delete"](url,{},params),promise.success(function(data,status){return defered.resolve(model)}),promise.error(function(data,status){return defered.reject(model)}),defered.promise},RepositoryService.prototype.saveAll=function(models,patch){var promises;return null==patch&&(patch=!0),promises=_.map(models,function(_this){return function(x){return _this.save(x,!0)}}(this)),this.q.all(promises)},RepositoryService.prototype.save=function(model,patch){var data,defered,promise,url;return null==patch&&(patch=!0),defered=this.q.defer(),!model.isModified()&&patch?(defered.resolve(model),defered.promise):(url=this.resolveUrlForModel(model),data=JSON.stringify(model.getAttrs(patch)),promise=patch?this.http.patch(url,data):this.http.put(url,data),promise.success(function(_this){return function(data,status){return model._isModified=!1,model._attrs=_.extend(model.getAttrs(),data),model._modifiedAttrs={},model.applyCasts(),defered.resolve(model)}}(this)),promise.error(function(data,status){return defered.reject(data)}),defered.promise)},RepositoryService.prototype.saveAttribute=function(model,attribute,patch){var data,defered,promise,url;return null==patch&&(patch=!0),defered=this.q.defer(),!model.isModified()&&patch?(defered.resolve(model),defered.promise):(url=this.resolveUrlForAttributeModel(model),data={},data[attribute]=model.getAttrs(),promise=patch?this.http.patch(url,data):this.http.put(url,data),promise.success(function(_this){return function(data,status){return model._isModified=!1,model._attrs=_.extend(model.getAttrs(),data),model._modifiedAttrs={},model.applyCasts(),defered.resolve(model)}}(this)),promise.error(function(data,status){return defered.reject(data)}),defered.promise)},RepositoryService.prototype.refresh=function(model){ diff --git a/dist/v-1459503555751/js/libs.js b/dist/v-1460103845046/js/libs.js similarity index 100% rename from dist/v-1459503555751/js/libs.js rename to dist/v-1460103845046/js/libs.js diff --git a/dist/v-1459503555751/js/maps/app.js.map b/dist/v-1460103845046/js/maps/app.js.map similarity index 73% rename from dist/v-1459503555751/js/maps/app.js.map rename to dist/v-1460103845046/js/maps/app.js.map index b889657..f527d36 100644 --- a/dist/v-1459503555751/js/maps/app.js.map +++ b/dist/v-1460103845046/js/maps/app.js.map @@ -1 +1 @@ -{"version":3,"sources":["app.js"],"names":["configure","i18nInit","init","module","modules","pluginsWithModule","taiga","this","taigaContribPlugins","window","generateHash","components","_","map","x","JSON","stringify","hex_sha1","join","generateUniqueSessionIdentifier","date","randomNumber","Date","getTime","Math","floor","random","sessionId","$routeProvider","$locationProvider","$httpProvider","$provide","$tgEventsProvider","$compileProvider","$translateProvider","$translatePartialLoaderProvider","$animateProvider","authHttpIntercept","blockingIntercept","decorators","defaultHeaders","loaderIntercept","originalWhen","preferedLangCode","userInfo","versionCheckHttpIntercept","classNameFilter","when","path","route","resolve","angular","extend","languageLoad","$q","$translate","deferred","defer","then","promise","call","templateUrl","controller","controllerAs","loader","title","description","joyride","reloadOnSearch","access","requiresLogin","section","redirectTo","params","pslug","disableHeader","mobileViewport","otherwise","html5Mode","enabled","requireBase","Content-Type","Accept-Language","taigaConfig","defaultLanguage","X-Session-Id","defaults","headers","patch","post","put","get","useApplyAsync","setSessionId","$location","$navUrls","$lightboxService","httpResponseError","response","nextUrl","status","config","cancelable","closeAll","replace","url","indexOf","encodeURIComponent","search","reject","responseError","factory","interceptors","push","loaderService","request","logRequest","requestError","rejection","logResponse","$injector","data","version","element","injector","invoke","_this","$confirm","versionErrorMsg","instant","notify","$routeParams","redirectToBlockedPage","responseOk","blockedUrl","currentUrl","project","blocked_code","debugInfoEnabled","debugInfo","localStorage","parse","lang","addPart","useLoader","urlTemplate","_version","useSanitizeValueStrategy","addInterpolation","preferredLanguage","fallbackLanguage","getDecorators","each","decorator","provider","messages","moment","locale","defaultMessage","type","email","urlstrict","number","digits","dateIso","alphanum","phone","notnull","notblank","required","regexp","min","max","range","minlength","maxlength","rangelength","mincheck","maxcheck","rangecheck","equalto","linewidth","pikaday","checksley","updateMessages","$log","$rootscope","$auth","$events","$analytics","appMetaService","projectService","navigationBarService","un","user","validators","debug","$on","refresh","val","width","lines","valid","nl2br","split","every","line","length","prettyDate","isValid","updateValidators","contribPlugins","adminPlugins","filter","userSettingsPlugins","e","ctx","language","Promise","setScheduler","cb","$evalAsync","setupConnection","isAuthenticated","getUser","initialize","event","next","start","setSection","setProjectBySlug","cleanProject","setAll","addMobileViewport","removeMobileViewport","enableHeader","plugin","value","concat","run","TaigaBase","TaigaController","TaigaService","child","parent","ctor","constructor","key","hasProp","prototype","__super__","hasOwnProperty","bind","fn","me","apply","arguments","superClass","onInitialDataError","xhr","location","navUrls","q","Base","Service","Controller","bindMethods","bindOnce","cancelTimeout","debounce","debounceLeading","defineImmutableProperty","groupBy","isImage","joinStr","mixOf","replaceTags","scopeDefer","sizeFormat","slugify","startswith","stripTags","timeout","toString","toggleText","trim","truncate","unslugify","item","i","l","slice","str","breakTag","object","dependencies","methods","keys","forIn","bindAll","scope","attr","continuation","delBind","$eval","$watch","Mixed","base","method","mixin","mixins","name","ref","char","toLowerCase","capitalize","texts","nextTextPosition","text","coll","pred","len","result","wait","setTimeout","timeoutVar","clearTimeout","func","$apply","isNumber","isString","isPlainObject","isUndefined","leading","trailing","str1","str2","startsWith","maxLength","suffix","out","String","substring","lastIndexOf","input","precision","size","units","isNaN","parseFloat","isFinite","log","pow","toFixed","exception","pattern","RegExp","tags","obj","Object","defineProperty","fn_result","isFunction","isObject","removeKeys","chain","flatten","reduce","cartesianProduct","reduceRight","a","b","y","match","oldImmutable","newImmutable","pathObj","forEach","newValue","toJS","FiltersMixin","PageMixin","fillUsersAndRoles","users","roles","activeUsers","computableRoles","is_active","sortBy","activeUsersById","id","usersById","members","uniq","includes","loadUsersAndRoles","all","rs","projects","usersList","projectId","rolesList","results","selectFilter","load","existing","compact","isInCurrentRouteParams","noreload","replaceFilter","replaceAllFilters","filters","unselectFilter","newValues","parsedValues","isEmpty","AuthService","CancelAccountDirective","ChangeEmailDirective","ChangePasswordFromRecoveryDirective","ForgotPasswordDirective","InvitationDirective","LoginDirective","LoginPage","PublicRegisterMessageDirective","RegisterDirective","currentUserService","$inject","rootscope","storage","model","http","urls","translate","currentUserService1","themeService","userModel","_currentTheme","_getUserTheme","setUserdata","userData","Immutable","fromJS","getAttrs","setUser","theme","_setTheme","newTheme","use","_setLocales","make_model","auth","set","clear","remove","setToken","token","getToken","removeToken","auth_token","login","clone","logout","removeUser","register","getInvitation","invitations","acceptInvitiationWithNewUser","acceptInvitiationWithExistingUser","forgotPassword","changePasswordFromRecovery","changeEmail","cancelAccount","service","$config","templates","template","templateFn","publicRegisterEnabled","restrict","directive","link","$scope","$el","$attrs","form","onError","onSuccess","submit","Form","find","decodeURIComponent","loginFormType","preventDefault","validate","username","password","on","prerenderReady","off","onErrorSubmit","onSuccessSubmit","onlyOneErrorElement","trackEvent","_error_message","error","setErrors","message","success","$params","tokenInParams","loginForm","onErrorSubmitLogin","onErrorSubmitRegister","onSuccessSubmitLogin","onSuccessSubmitRegister","registerForm","submitLogin","submitRegister","invitation","dataLogin","project_slug","project_name","dataRegister","escape","$repo","$model","email_token","queryOne","cancel_token","TaigaMainDirective","$window","onresize","$broadcast","home","not-found","permission-denied","discover","discover-search","forgot-password","change-password","change-email","cancel-account","create-project","profile","user-profile","blocked-project","project-backlog","project-taskboard","project-kanban","project-issues","project-search","project-userstories-detail","project-tasks-detail","project-issues-detail","project-wiki","project-wiki-page","project-team","project-admin-home","project-admin-project-profile-details","project-admin-project-profile-default-values","project-admin-project-profile-modules","project-admin-project-profile-export","project-admin-project-profile-reports","project-admin-project-values-status","project-admin-project-values-points","project-admin-project-values-priorities","project-admin-project-values-severities","project-admin-project-values-types","project-admin-project-values-custom-fields","project-admin-memberships","project-admin-roles","project-admin-third-parties-webhooks","project-admin-third-parties-github","project-admin-third-parties-gitlab","project-admin-third-parties-bitbucket","project-admin-contrib","user-settings-user-profile","user-settings-user-change-password","user-settings-user-avatar","user-settings-mail-notifications","user-settings-contrib","$navurls","update","AnimationFrame","Capslock","CheckPermissionDirective","ClassPermissionDirective","DataPickerConfig","ProjectUrl","Qqueue","SelectedText","Template","ToggleCommentDirective","i18n","previousMonth","nextMonth","months","weekdays","weekdaysShort","isRTL","firstDay","parseInt","format","$document","getSelection","selection","createRange","render","permission","removeClass","unObserve","unwatch","addClass","tgCheckPermission","$observe","checkPermissions","tgClassPermissionWatchAction","unbindWatcher","className","negation","my_permissions","classes","add","animationFrame","performAnimation","tail","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","time","shift","slug","is_backlog_activated","is_kanban_activated","is_wiki_activated","is_issues_activated","lastPromise","qqueue","bindAdd","args","$templateCache","lodash","tmp","hideIcon","open","showIcon","warningIcon","$","fadeOut","currentTarget","append","fadeIn","EventsProvider","EventsService","win","liveAnnouncementService1","rootScope","liveAnnouncementService","processMessage","subscriptions","connected","pendingMessages","missedHeartbeats","heartbeatInterval","WebSocket","info","loc","scheme","stopExistingConnection","protocol","trimStart","host","ws","addEventListener","onOpen","onMessage","onClose","removeEventListener","stopHeartBeatMessages","close","notifications","subscribe","show","desc","$digest","startHeartBeatMessages","heartbeatIntervalTime","maxMissedHeartbeats","setInterval","error1","Error","sendMessage","cmd","clearInterval","processHeartBeatPongMessage","serialize","msg","send","routingKey","subscription","routing_key","callback","unsubscribe","$get","$win","$conf","$rootScope","FeedbackDirective","$loading","feedbackService","openLightbox","submitButton","currentLoading","target","create","feedback","finish","focus","RelatedTaskAssignedToInlineEditionDirective","RelatedTaskCreateButtonDirective","RelatedTaskCreateFormDirective","RelatedTaskRowDirective","RelatedTasksDirective","$compile","$template","templateEdit","templateView","renderEdit","renderView","saveTask","task","subject","save","html","keyCode","$modelValue","perms","modify_task","delete_task","select","askOnDelete","askResponse","$emit","ngModel","require","$tgmodel","newTask","assigned_to","createTask","default_task_status","newRelatedTaskFormOpen","us","$rs","_isEditable","_isVisible","loadTasks","tasks","list","usId","showRelatedTasks","$ctrl","autoSave","notAutoSave","updateRelatedTask","member","imgurl","photo","full_name_display","tgRelatedTaskAssignedToInlineEdition","unbind","userId","updatedRelatedTask","ResourcesService","initResources","initUrls","auth-register","by_username","users-password-recovery","users-change-password-from-recovery","users-change-password","users-change-email","users-cancel-account","user-stats","user-liked","user-voted","user-watched","user-contacts","user-me","permissions","notify-policies","user-storage","memberships","bulk-create-memberships","resolver","project-templates","project-modules","bulk-update-projects-order","project-like","project-unlike","project-watch","project-unwatch","project-transfer-validate-token","project-transfer-accept","project-transfer-reject","project-transfer-request","project-transfer-start","userstory-statuses","points","task-statuses","issue-statuses","issue-types","priorities","severities","milestones","userstories","bulk-create-us","bulk-update-us-backlog-order","bulk-update-us-sprint-order","bulk-update-us-kanban-order","userstories-filters","userstory-upvote","userstory-downvote","userstory-watch","userstory-unwatch","bulk-create-tasks","bulk-update-task-taskboard-order","task-upvote","task-downvote","task-watch","task-unwatch","issues","bulk-create-issues","issues-filters","issue-upvote","issue-downvote","issue-watch","issue-unwatch","wiki","wiki-restore","wiki-links","history/us","history/issue","history/task","history/wiki","attachments/us","attachments/issue","attachments/task","attachments/wiki_page","custom-attributes/userstory","custom-attributes/issue","custom-attributes/task","custom-attributes-values/userstory","custom-attributes-values/issue","custom-attributes-values/task","webhooks","webhooks-test","webhooklogs","webhooklogs-resend","userstories-csv","tasks-csv","issues-csv","timeline-profile","timeline-user","timeline-project","exporter","importer","locales","applications","application-tokens","stats-discover","$urls","providers","toArray","SearchBoxDirective","SearchController","SearchDirective","scope1","repo","loadSearchData","sectionName","loadInitialData","projectName","projectDescription","searchTerm","t","searchResults","term","loadFilters","defered","loadProject","getBySlug","issueStatusById","issue_statuses","taskStatusById","task_statuses","severityById","priorityById","usStatusById","us_statuses","loading","_loadSearchData","_promise","abort","$route","reload","$templatecache","$routeparams","linkTable","activeSectionName","applyAutoTab","getActiveSection","lastSearchResults","markSectionTabActive","renderFilterTabs","renderTableContent","tabsDom","maxVal","selectedSection","wikipages","oldElements","oldScope","children","$destroy","$new","parseHTML","activeSection","sectionData","searchText","AnalyticsService","doc","conf","initialized","accountId","pageEvent","trackRoutes","ignoreFirstPageLoad","injectAnalytics","ga","getUrl","trackPage","s","o","g","r","m","createElement","getElementsByTagName","async","src","parentNode","insertBefore","document","page","category","action","label","BindScope","jQuery","CompileHtmlDirective","attrs","tgCompileHtml","oldValue","contents","AssignedToDirective","BlockButtonDirective","CreatedByDisplayDirective","DateRangeDirective","DateSelectorDirective","DeleteButtonDirective","EditableDescriptionDirective","EditableSubjectDirective","EditableWysiwyg","ListItemAssignedtoDirective","ListItemIssueStatusDirective","ListItemPriorityDirective","ListItemSeverityDirective","ListItemTaskStatusDirective","ListItemTypeDirective","ListItemUsStatusDirective","SprintProgressBarDirective","TgMainTitleDirective","TgProgressBarDirective","WatchersDirective","renderRange","first","second","endDate","initDate","tgDateRange","valFirst","valSecond","datePickerConfigService","selectedDate","datePickerConfig","merge","field","onSelect","picker","setDate","Pikaday","renderProgress","percentage","visual_percentage","hasClass","css","tgSprintProgressbar","sprint","closedPoints","totalPoints","closed_points","total_points","round","owner","owner_extra_info","created_date","$qqueue","deleteWatcher","isEditable","renderWatchers","ref1","requiredPerm","watchers","$setViewValue","watcherId","revert","watcherIds","pull","$currentUserService","renderAssignedTo","assignedObject","fullName","isIocaine","isUnassigned","assigned_to_extra_info","is_iocaine","fullNameVisible","ask","instance","is_blocked","onDeleteGoToUrl","onDeleteTitle","subtitle","hide","click","$selectedText","noDescriptionMegEditMode","noDescriptionMegReadMode","is","href","scrollTop","offset","top","noDescriptionMsg","attachmentsService","attachmentsFullService","isInEditMode","uploadFile","file","addAttachment","getIn","textarea","dataTransfer","promises","stopPropagation","originalEvent","files","markItUp","replaceWith","tgListitemUsStatus","tgListitemTaskStatus","tgListitemAssignedto","issue","tgListitemIssueStatus","issueTypeById","domNode","color","tgListitemType","priority","tgListitemPriority","severity","tgListitemSeverity","el","tgProgressBar","i18nSectionName","ConfirmService","NOTIFICATION_MSG","light-error","lightboxService","lightboxSelector","ok","askChoice","choices","replacement","warning","choicesField","selected","icon","detailImage","useSVG","createElementNS","setAttributeNS","classList","appendChild","prepend","stop","percent","body","selector","tsem","one","CustomAttributeValueDirective","CustomAttributesValuesController","CustomAttributesValuesDirective","DATE_TYPE","MULTILINE_TYPE","TEXT_TYPE","TYPE_CHOICES","URL_TYPE","confirm","objectId","customAttributes","customAttributesValues","loadCustomAttributesValues","getAttributeValue","attribute","attributeValue","attributes_values","updateAttributeValue","attributesValues","$templates","$storage","collapsedHash","$ctrls","collapsed","hash","requiredEditionPerm","setFocusAndSelectOnInputField","edit","editable","tgCustomAttributeValue","EstimationsService","LbUsEstimationDirective","UsEstimationDirective","$tgEstimationsService","estimationProcess","onSelectedPointForRole","roleId","pointId","mainTemplate","calculateTotalPoints","calculateRoles","EstimationProcess","pointsTemplate","$el1","us1","project1","bindClickEvents","pointsById","notNullValues","values","v","k","acc","num","role","pointObj","renderPointsSelector","siblings","popover","horizontalList","maxPointLength","pop","point","some","horizontal","closest","height","clientHeight","defaultFilter","momentFormat","momentFromNow","yesNoFilter","defaultValue","without_suffix","fromNow","HistoryController","HistoryDirective","IGNORED_FIELDS","userstories.userstory","tasks.task","issues.issue","loadHistory","history","changeModel","historyEntry","historyResult","j","len1","values_diff","description_diff","description_html","blocked_note_diff","blocked_note","blocked_note_html","comments","comment","deleteComment","activityId","undeleteComment","checkPermissionsService","templateActivity","templateBase","templateBaseEntries","templateChangeAttachment","templateChangeDiff","templateChangeGeneric","templateChangeList","templateChangePoints","templateDeletedComment","countChanges","formatChange","getHumanizedFieldName","getPrettyDateFormat","renderActivity","renderAttachmentEntry","renderBase","renderChange","renderChangeEntries","renderChangeEntry","renderChangesHelperText","renderComment","renderComments","renderCustomAttributesEntry","renderHistory","rerender","showAllActivity","showAllComments","humanizedFieldNames","content","is_closed","finish_date","milestone","user_story","client_requirement","team_requirement","attachments","is_deprecated","order","backlog_order","sprint_order","kanban_order","taskboard_order","us_order","change","isArray","changes","diff","filename","from","to","outerHTML","customAttrsChanges","added","removed","difference","ref2","delete_comment_date","delete_comment_user","deleteCommentDate","deleteCommentUser","comment_html","canRestoreComment","pk","avatar","userFullName","userProfileUrl","creationDate","created_at","changesText","mode","deleteCommentActionTitle","canDeleteComment","entries","totalEntries","showMore","commentsVisible","historyVisible","check","ngmodel","totalComments","takeRight","totalChanges","parents","toggleClass","ImportProjectButtonDirective","LbImportErrorDirective","$lightboxFactory","$tgAuth","getRestrictionError","errorKey","maxMemberships","membersError","privateError","publicError","isPrivate","canCreatePrivateProjects","canCreatePublicProjects","max_memberships","trigger","loadProjects","errorMsg","restrictionError","class","error_message","AssignedToLightboxDirective","AttachmentPreviewLightboxDirective","BlockLightboxDirective","BlockingMessageInputDirective","CreateBulkUserstoriesDirective","CreateEditUserstoryDirective","LightboxDirective","LightboxKeyboardNavigationService","LightboxLeaveProjectWarningDirective","LightboxService","WatchersLightboxDirective","docEl","lightboxContent","not","code","which","removeAttr","lightboxEl","dispatch","activeElement","prev","$tgrepo","block","unblock","finishCallback","watch","attachmentsToAdd","attachmentsToDelete","createAttachments","deleteAttachments","resetAttachments","createEditUs","isNew","List","attachment","deleteAttachment","statusList","reset","usStatusList","is_archived","upload","broadcastEvent","keydown","statusId","bulk","bulkCreate","lightboxKeyboardNavigationService","closeLightbox","filterUsers","normalizeString","selectedItem","selectedUser","usersTemplate","string","normalizedString","toUpperCase","partial","assignedToId","searchingText","usersSearch","getFilteredUsers","_filterUsers","Loader","LoaderDirective","tgLoader","onStart","onEnd","autoClose","lastResponseDate","pageLoaded","requestCount","startLoadTime","minTime","force","endTime","timeoutValue","intervalAuto","auto","LoadingDirective","TgLoadingService","spinner","settings","removeClasses","classess","timeoutId","tgLoading","showLoading","RelatedTaskStatusDirective","UsStatusDirective","usStatusDom","usStatusDomParent","tgUsStatus","onUpdate","statuses","selectionTemplate","updateTaskStatus","taskStatusDom","taskStatusDomParent","tgRelatedTaskStatus","closePopover","isVisible","docViewBottom","docViewLeft","docViewRight","docViewTop","docViewWidth","elemBottom","elemLeft","elemRight","elemTop","elemWidth","display","visibility","left","ExceptionHandlerFactory","ravenConfig","Raven","install","cause","captureException","ColorizeTagsDirective","LbTagLineDirective","TagLineDirective","TagsDirective","formatter","parser","$formatters","$parsers","backlog","kanban","taskboard","srcTags","tgColorizeTagsType","sort","tag","tags_colors","tgColorizeTags","COMMA_KEY","ENTER_KEY","templateTags","addValue","deleteValue","hideSaveButton","renderTags","resetInput","saveInputTag","showSaveButton","tagsColors","style","autocomplete","fromCharCode","positioningFunction","position","elements","menu","source","my","using","ui","ESC_KEY","hideAddTagButton","hideAddTagButtonText","hideInput","renderInReadModeOnly","showAddTagButton","showAddTagButtonText","showInput","blur","MarkitupDirective","previewTemplate","addLine","cancelablePromise","closePreviewMode","markdownTitle","prepareUrlFormatting","preview","previewDomNode","previewInProgress","renderMarkItUp","setCaretPosition","urlFormatting","markItUpDomNode","markdownDomNode","mdrender","markdown","caretPosition","scrollRelation","totalLines","createTextRange","move","selectionStart","setSelectionRange","scrollHeight","nline","cursorPosition","indices","regex","exec","index","donotparse","endIndex","startIndex","heading","n","placeHolder","markdownSettings","nameSpace","onShiftEnter","keepDefault","openWith","onEnter","afterInsert","cursorLine","emptyListItem","lastLine","markdownCaretPositon","newLineContent","markupSet","closeWith","separator","beforeInsert","markItUpRemove","textcomplete","cache","searchProps","searchTypes","prop","res","count","BacklogFiltersDirective","templateSelected","currentFiltersType","getFiltersType","initializeSelectedFilters","reloadUserstories","renderFilters","renderSelectedFilters","selectQFilter","selectedFilters","showCategories","showFilters","toggleFilterSelection","f","loadUserstories","generateFilters","currentFilters","CreateEditSprint","createSprint","getLastSprint","hasErrors","resetSprint","estimated_start","estimated_finish","newSprint","copy","setAttr","sprintsCounter","__all__","milestonesCounter","openSprints","sortedSprints","sprints","closed","estimatedFinish","estimatedStart","lastSprint","lastSprintNameDom","editSprint","BacklogController","BacklogDirective","BurndownBacklogGraphDirective","TgBacklogProgressBarDirective","ToggleBurndownVisibility","UsPointsDirective","UsRolePointsSelectorDirective","params1","events","analytics","rs2","showTags","activeFilters","showGraphPlaceholder","initializeEventHandlers","getShowTags","loadProjectStats","loadSprints","loadClosedSprints","moveUs","unloadClosedSprints","initializeSubscription","routingKey1","routingKey2","toggleShowTags","storeShowTags","toggleActiveFilters","stats","defined_points","completedPercentage","total_milestones","closedSprints","totalClosedMilestones","user_stories","closedSprintsById","totalMilestones","totalOpenMilestones","reverse","sprintsById","currentSprint","findCurrentSprint","restoreFilters","selectedStatuses","selectedTags","oldSelectedTags","oldSelectedStatuses","filtersQ","filtersQOld","filterGrp","resetFilters","httpParams","getUrlFilters","storeQueryParams","listUnassigned","setSearchDataFilters","loadBacklog","closedMilestones","total_closed_milestones","prepareBulkUpdateData","uses","us_id","resortUserStories","items","isModified","usList","newUsIndex","newSprintId","len2","movedFromClosedSprint","movedToClosedSprint","oldSprintId","splice","Array","bulkUpdateBacklogOrder","bulkUpdateSprintOrder","console","len3","isFilterSelected","searchdata","urlfilters","results1","pick","filtersData","choicesFiltersFormat","tagsFilterFormat","byIdObject","markSelectedFilters","isSelected","omit","updateUserStoryStatus","editUserStory","$event","getByRef","deleteUserStory","without","addNewUs","default_us_status","addNewSprint","currentDate","end","doomLineTemplate","linkDoomLine","linkFilters","linkToolbar","showHideFilter","showHideTags","addDoomLineDom","getUsItems","reloadDoomLine","removeDoomlineDom","current_sum","domElement","assigned_points","before","rowElements","checkSelected","getUsToMove","lastChecked","moveToCurrentSprint","moveToLatestSprint","moveUssToSprint","shiftPressed","ussDom","itemScope","selectedUss","extraPoints","totalExtraPoints","ussCurrent","union","saveAll","moveToSprintDom","selectedUsDom","shiftKey","current","nextAll","prevAll","nextUntil","prevUntil","elm","ussToMove","hideText","showText","sidebar","filtersSearch","disableSelection","numberOfRoles","roleName","rolScope","$tgTemplate","rolesTemplate","bindClickElements","filteringRoleId","renderRolesSelector","selectedRoleId","updatingSelectedRoleId","tgBacklogUsPoints","popRolesDom","firstLoad","toggleGraph","isBurndownGraphCollapsed","redrawChart","dataToDraw","client_increment_line","colors","evolution_line","milestonesRange","optimal_line","options","team_increment_line","zero_line","ml","zip","fillColor","optimal","evolution","grid","borderWidth","right","bottom","borderColor","hoverable","xaxis","ticks","axisLabel","axisLabelUseCanvas","axisLabelFontSizePixels","axisLabelFontFamily","axisLabelPadding","tickFormatter","axis","yaxis","series","shadowSize","fill","radius","lineWidth","tooltip","tooltipOpts","xval","yval","flotItem","seriesIndex","sprintName","abs","empty","plot","adjustPercentaje","projectPointsPercentaje","closedPointsPercentaje","adjusted","tgBacklogProgressBar","definedPoints","BacklogEmptySortableDirective","BacklogSortableDirective","SprintSortableDirective","deleteElement","$tgConfirm","getUsIndex","filterError","sortable","cancel","connectWith","dropOnEmpty","placeholder","scroll","disableHorizontalScroll","tolerance","itemIndex","itemUs","forcePlaceholderSize","BacklogSprintDirective","BacklogSprintHeaderDirective","ToggleExcludeClosedSprintsVisualization","slideOptions","sprintTableMinHeight","toggleSprint","duration","easing","sprintArrow","sprintTable","tgBacklogSprint","slideToggle","compiledTemplate","estimatedDateRange","taskboardUrl","templateScope","assign","excludeClosedSprints","loadingElm","after","SprintGraphDirective","days","day","unshift","d","optimal_points","open_points","tickSize","last","daysNames","formattedDate","roundedValue","CreateBulkTasksDirective","CreateEditTaskDirective","sprintId","TaskboardController","TaskboardDirective","TaskboardSquishColumnDirective","TaskboardTaskDirective","TaskboardUserDirective","rs1","_setMeta","startDate","completedPoints","completedPointsSum","totalPointsSum","openTasks","totalTasks","total_tasks","loadTaskboard","taskMove","refreshTagsColors","loadSprintStats","loadSprint","pointsList","roleById","taskStatusList","remainingPointsSum","remainingTasks","completed_points","completed_tasks","usTasks","isPlaceholder","sslug","refreshTasksOrder","resortTasks","bulkUpdateTaskTaskboardOrder","task_id","addNewTask","editTaskAssignedTo","tableBodyDom","tableHeaderDom","scrollLeft","$rs2","editingTask","avatarWidth","maxColumnWidth","getCeilWidth","recalculateStatusColumnWidth","recalculateTaskboardWidth","refreshTaskboardTableWidth","setStatusColumnWidth","statusesFolded","getStatusColumnModes","usFolded","getUsRowModes","foldStatus","storeStatusColumnModes","foldUs","storeUsRowModes","tasksMatrixSize","sqrt","column","columnWidths","columns","totalWidth","outerWidth","total","statusFoldedWidth","clickable","username_label","TaskboardSortableDirective","itemEl","newParentScope","oldParentScope","tdom","handle","itemTask","newStatusId","newUsId","oldStatusId","oldUsId","parentEl","st","KanbanArchivedStatusHeaderDirective","KanbanArchivedStatusIntroDirective","KanbanController","KanbanDirective","KanbanSquishColumnDirective","KanbanUserDirective","KanbanUserstoryDirective","KanbanWipLimitDirective","defaultViewMode","viewModes","statusViewModes","onAssignedToChanged","loadUserStoriesForStatus","hideUserStoriesForStatus","changeUsAssignedTo","userid","status__is_archived","listAll","usByStatus","us_archived","loadKanban","generateStatusViewModes","storedStatusViewModes","getStatusViewModes","storeStatusViewModes","updateStatusViewMode","newViewMode","isMaximized","isMinimized","itemsToSave","bulkUpdateKanbanOrder","hideArchivedText","showArchivedText","hidden","tgKanbanArchivedStatusHeader","userStories","hiddenUserStoriexText","updateIntroText","tgKanbanArchivedStatusIntro","isArchived","userStoriesLoaded","editingUserStory","getTemplateUrl","updateTableWidth","folds","redrawWipLimit","tgKanbanWipLimit","wip_limit","wtid","tgKanbanUserAvatar","KanbanSortableDirective","IssueDetailController","IssuePriorityButtonDirective","IssueSeverityButtonDirective","IssueStatusButtonDirective","IssueStatusDisplayDirective","IssueTypeButtonDirective","PromoteIssueToUsButtonDirective","issueRef","issueref","initializeOnDeleteGoToUrl","ref3","issueSubject","issueStatus","statusById","issueType","typeById","issueSeverity","issuePriority","issueDescription","loadIssue","issue_types","typeList","severityList","priorityList","issueId","commentModel","neighbors","previous","previousUrl","onUpvote","upvote","onDownvote","downvote","onWatch","onUnwatch","typees","severityes","priorityes","generated_from_issue","CreateBulkIssuesDirective","CreateIssueDirective","default_issue_status","default_issue_type","default_priority","default_severity","IssueAssignedToInlineEditionDirective","IssueStatusInlineEditionDirective","IssuesController","IssuesDirective","IssuesFiltersDirective","loadIssues","getFilters","storeFilters","issueStatusList","issueTypes","getUrlFilter","loadMyFilters","getMyFilters","removeNotExistingFiltersFromUrl","currentSearch","existingValues","filterName","filterValue","splittedValues","intersection","myFilters","types","assignedTo","createdBy","usersFiltersFormat","unknownOption","reformatedUsers","unknownItem","full_name","u","owners","loadIssuesRequests","urlFilters","models","paginatedBy","saveCurrentFiltersTo","newFilter","storeMyFilters","deleteMyFilter","addNewIssue","addIssuesInBulk","linkOrdering","linkPagination","$pagEl","afterCurrent","atBegin","atEnd","beforeCurrent","getNumPages","renderPagination","numPages","cpage","pages","showPrevious","showNext","pagenum","colHeadElement","currentOrder","finalOrder","newOrder","reloadIssues","unwatchIssues","filterId","customFilterName","loadPromise","currentfilterstype","updateIssueStatus","issueStatusDom","issueStatusDomParent","tgIssueStatusInlineEdition","updateIssue","tgIssueAssignedToInlineEdition","updatedIssue","UsClientRequirementButtonDirective","UsStatusButtonDirective","UsStatusDisplayDirective","UsTeamRequirementButtonDirective","UserStoryDetailController","usRef","usref","closedTasks","progressPercentage","userStoryRef","userStorySubject","userStoryStatus","userStoryPoints","userStoryDescription","userStoryClosedTasks","userStoryTotalTasks","userStoryProgressPercentage","allClosed","loadUs","kanbanStaus","noMilestone","order_by","canEdit","isRequired","TaskDetailController","TaskIsIocaineButtonDirective","TaskStatusButtonDirective","TaskStatusDisplayDirective","taskRef","taskref","taskSubject","taskStatus","taskDescription","loadTask","taskId","loadUserStory","LeaveProjectDirective","TeamController","TeamFiltersDirective","TeamMemberCurrentUserDirective","TeamMemberStatsDirective","TeamMembersDirective","membersFilter","setRole","filtersRole","loadMembers","totals","currentUser","issuesEnabled","tasksEnabled","wikiEnabled","loadMemberStats","memberStats","vals","statsKey","sum","_processStats","_processStat","stat","singleStat","userRoles","lightboxFactory","leaveConfirm","confirm_leave_project_text","leave_project_text","leave","isCurrentUser","EditableWikiContentDirective","WikiDetailController","WikiSummaryDirective","projectSlug","wikiSlug","wikiTitle","linksVisible","wikiPageName","wikiPageContent","totalEditions","editions","lastModifiedDate","modified_date","loadWiki","wikiId","loadWikiLinks","listLinks","wikiLinks","selectedWikiLink","checkLinksPerms","last_modifier","imgUrl","wikiPage","cancelEdition","disableEdition","getSelectedText","switchToEditMode","switchToReadMode","button","WikiNavDirective","addWikiLinkPermission","deleteWikiLinkPermission","linkId","linkSlug","newLink","ChangeOwnerLightboxController","ChangeOwnerLightboxDirective","LbRequestOwnershipDirective","LightboxAddMembersController","LightboxAddMembersDirective","LightboxAddMembersWarningMessageDirective","TransferProjectStartSuccessDirective","lightboxService1","pendingMembersCount","_defaultMaxInvites","_defaultRole","submitInvites","canAddUsers","memberInvites","membersLimit","total_memberships","addSingleMember","role_id","showWarningMessage","removeSingleMember","initializeFields","invites","bulkCreateMemberships","invitationText","_onSuccessInvite","_onErrorInvite","ctrl","bindToController","confirmService","transferRequest","commentOpen","limit","getUsers","currentOwnerId","userSearch","selectUser","transferStart","MembershipsController","MembershipsDirective","MembershipsRowActionsDirective","MembershipsRowAdminCheckboxDirective","MembershipsRowAvatarDirective","MembershipsRowRoleSelectorDirective","NoMoreMembershipsExplanationDirective","lightboxFactory1","i_am_admin","httpFilters","membership","is_user_active","addNewMembers","showLimitUsersWarningMessage","pending","user_email","isOwner","is_owner","tgMembershipsRowAvatar","tgMembershipsRowAdminCheckbox","inputId","is_admin","roleList","selectedRole","tgMembershipsRowRoleSelector","newRole","activedTemplate","pendingTemplate","tgMembershipsRowActions","resendInvitation","defaultMsg","AdminNavigationDirective","tgAdminNavigation","AdminProjectChangeOwnerDirective","AdminProjectRequestOwnershipDirective","AdminProjectRestrictionsDirective","CsvExporterController","CsvExporterIssuesController","CsvExporterTasksController","CsvExporterUserstoriesController","CsvIssueDirective","CsvTaskDirective","CsvUsDirective","ProjectDefaultValuesDirective","ProjectExportDirective","ProjectLogoDirective","ProjectLogoModelDirective","ProjectModulesDirective","ProjectProfileController","ProjectProfileDirective","tgAuth","prioritiesList","severitiesList","issueTypesList","openDeleteLightbox","newUrl","fetchProject","newVal","oldVal","videoconferences_extra_data","videoconferences","isVideoconferenceActivated","asyn_message","buttonsEl","dump_ready_text","hideButtons","hideResult","hideSpinner","loading_msg","loading_title","resultEl","resultMessageEl","resultTitleEl","setAsyncMessage","setAsyncTitle","setLoadingMessage","setLoadingTitle","setSyncMessage","setSyncTitle","showButtons","showErrorMode","showExportResultAsyncMode","showExportResultSyncMode","showLoadingMode","showResult","showSpinner","spinnerEl","syn_message","dumpUrl","_generateUuid","setCsvUuid","csvUrl","resolveAbsolute","csvUuid","uuid","regenerateUuid","sectionTitle","showSizeInfo","logoAttachment","changeLogo","removeLogo","$parse","modelSetter","tgProjectLogoModel","requestOwnership","changeOwner","project-id","active-users","current-owner-id","ColorSelectionDirective","ProjectCustomAttributesController","ProjectCustomAttributesDirective","ProjectValuesController","ProjectValuesDirective","ProjectValuesSectionController","moveValue","loadValues","resource","listValues","maxValueOrder","maxBy","itemValue","linkDragAndDrop","linkValue","goToBottomList","initializeNewValue","initializeTextTranslations","objName","saveNewValue","saveValue","valueType","objname","addNewElementText","table","formEl","row","editionRow","option","onSucces","moveTo","moveCustomAttributes","deleteCustomAttribute","saveCustomAttribute","createCustomAttribute","loadCustomAttributes","maxOrder","attrValues","attrModel","newIndex","idx","cancelCreate","cancelUpdate","hideAddButton","hideCancelButton","hideCreateForm","hideEditForm","resetNewAttr","revertChangesInCustomAttribute","showAddButton","showCancelButton","showCreateForm","showEditForm","sortableEl","itemAttr","newAttr","EditRoleDirective","NewRoleDirective","RolePermissionsDirective","RolesController","RolesDirective","_disableComputable","_enableComputable","anyComputableRole","computable","loadRoles","public_permission","external_user","public_permissions","askOnError","askOnSuccess","toggleComputable","toggleView","toggle","DEFAULT_PERMISSIONS","insertPosition","baseTemplate","categoryTemplate","resumeTemplate","generateCategoriesFromRole","renderCategory","renderPermissions","renderResume","categories","isPermissionEditable","issuePermissions","milestonePermissions","setActivePermissions","setActivePermissionsPerCategory","taskPermissions","userStoryPermissions","wikiPermissions","active","is_private","cat","activePermissions","getActivePermissions","categoryId","anon_permissions","BitbucketController","BitbucketWebhooksDirective","GithubController","GithubWebhooksDirective","GitlabController","GitlabWebhooksDirective","NewWebhookDirective","SelectInputText","ValidOriginIpsDirective","WebhookDirective","WebhooksController","loadWebhooks","openHistory","showEditMode","showVisualizationMode","updateLogs","updateShowHideHistoryText","webhook","tgWebhook","validStatus","prettySentHeaders","toPairs","request_headers","arg","header","prettySentData","request_data","created","logs_counter","logs","historyElement","textElement","test","resend","addWebhookDOMNode","formDOMNode","loadModules","github","gitlab","bitbucket","saveAttribute","$ngModel","createProjectRestrictionDirective","CreateProject","DeleteProjectDirective","$projectUrl","$cacheFactory","removeAll","error_field","selectors","creation_template","head","projectToDelete","BindHtmlDirective","BindOnceAltDirective","BindOnceBindDirective","BindOnceHrefDirective","BindOnceHtmlDirective","BindOnceRefDirective","BindOnceSrcDirective","BindOnceTitleDirective","BindTitleDirective","tgBoBind","tgBoHtml","tgBoRef","tgBoSrc","tgBoHref","tgBoAlt","tgBoTitle","tgTitleHtml","tgBindHtml","ConfigurationService","has","ContribController","ContribUserSettingsController","currentPlugin","FiltersStorageService","HttpService","cacheFactory","locationFactory","lastRoute","Model","ModelService","dataTypes","_attrs","_name","_dataTypes","setAttrs","_modifiedAttrs","_isModified","applyCasts","attrName","castMethod","castName","casts","getIdAttrName","getName","getter","self","setter","substr","enumerable","configurable","isAttributeModified","markSaved","desSerialize","sdata","ddata","$http","$gmUrls","$gmStorage","cls","int","float","NavigationUrlsDirective","NavigationUrlsService","formatUrl","replacer","bindOnceP","parseNav","param","tgNavGetParams","tgNav","fullUrl","getURLParams","getURLParamsStr","metaKey","ctrlKey","RepositoryService","model1","resolveUrlForModel","idAttrName","resolveUrlForAttributeModel","extraParams","_data","_status","queryMany","httpOptions","enablePagination","queryOneAttribute","queryOneRaw","queryPaginated","queryOnePaginatedRaw","wikipage","StorageService","_default","serializedValue","getItem","setItem","contains","removeItem","UrlsService","fmt","mainUrl","trimEnd","resourceProvider","_get","userstory","_list","filtersHashSuffix","hashSuffix","myFiltersHashSuffix","getQueryParams","listInAllProjects","project_id","bulk_issues","ns","innerPromise","hashSuffixStatusColumnModes","hashSuffixStatusViewModes","listByUser","invitation_extra_text","bulk_memberships","notifyPolicies","listByMember","memberId","bulkUpdateOrder","bulkData","regenerate_userstories_csv_uuid","regenerate_issues_csv_uuid","regenerate_tasks_csv_uuid","statusUpdater","complete","failed","maxFileSize","uploadComplete","uploadFailed","uploadProgress","fileName","fileSize","evt","loaded","uploadedSize","totalSize","responseText","getResponseHeader","FormData","XMLHttpRequest","setRequestHeader","transformRequest","identity","deferredAbort","get_all","noop","hashSuffixUsRowModes","userStoryId","sprint_id","bulk_tasks","changeAvatar","removeAvatar","changePassword","currentPassword","newPassword","current_password","userSettings","contacts","status_id","bulk_stories","webhookId","webhooklogId","UserChangePasswordController","UserChangePasswordDirective","newPassword1","newPassword2","DeleteUserDirective","TaigaAvatarModelDirective","UserAvatarDirective","UserProfileDirective","UserSettingsController","getLan","getTheme","maxFileSizeMsg","availableThemes","avatarAttachment","tgAvatarModel","UserSettingsNavigationDirective","tgUserSettingsNavigation","UserNotificationsController","UserNotificationsDirective","UserNotificationsListDirective","policy","policyIndex","prev_level","notify_level","AttachmentLinkDirective","tgAttachmentLink","AttachmentGalleryDirective","onDelete","AttachmentController","editMode","mergeIn","AttachmentDirective","AttachmentsDropDirective","eventAttr","tgAttachmentsDrop","AttachmentsFullController","deprecatedsCount","attachmentsVisible","deprecatedsVisible","uploadingAttachments","objId","setMode","toggleDeprecatedsVisible","addAttachments","loadAttachments","toDeleteAttachment","errorMessage","reorderAttachment","updateAttachment","toUpdateAttachment","hasPermission","editPermission","showAttachments","AttachmentsFullDirective","AttachmentsFullService","_attachments","_deprecatedsCount","_attachmentsVisible","_deprecatedsVisible","regenerate","it","uploading","Map","oldIndex","findIndex","setIn","oldAttachment","AttachmentsSimpleController","onAdd","AttachmentsSimpleDirective","AttachmentSortableDirective","tgAttachmentsSortable","containment","helper","AutoSelectDirective","$timeout","FileChangeDirective","tgFileChange","JoyRideDirective","joyRideService","initJoyrRide","intro","unsuscribe","introJs","oncomplete","onexit","disableJoyRide","setOptions","exitOnEsc","exitOnOverlayClick","showStepNumbers","nextLabel","prevLabel","skipLabel","doneLabel","disableInteraction","setOption","loadJoyRideConfig","exit","JoyRideService","getConfig","dashboard","steps","joyRide","joyRides","LiveAnnouncementDirective","defineProperties","LiveAnnouncementService","ProjectLogoBigSrcDirective","projectLogoService","logo","projectLogo","getDefaultProjectLogo","ProjectLogoSmallSrcDirective","ProjectMenuController","_getActiveSection","_setVideoConference","_setMenuPermissions","videoconferenceUrl","_videoConferenceUrl","indexBacklog","indexKanban","oldSectionName","sectionsBreadcrumb","baseUrl","ProjectMenuDirective","projectChange","vm","fixed","TermsOfServiceAndPrivacyPolicyNoticeDirective","privacyPolicyUrl","termsOfServiceUrl","VoteButtonController","isMouseOver","showTextWhenMouseIsOver","showTextWhenMouseIsLeave","toggleVote","is_voter","_downvote","_upvote","VoteButtonDirective","WatchButtonController","openWatchers","getPerms","toggleWatch","is_watcher","_unwatch","_watch","WatchButtonDirective","attributes","environment","DiscoverHomeOrderByController","is_open","week","month","year","currentText","currentOrderBy","orderBy","onChange","DiscoverHomeOrderByDirective","DiscoverSearchBarController","discoverProjectsService","projectsCount","fetchStats","submitFilter","DiscoverSearchBarDirective","DiscoverSearchListHeaderController","like_is_open","activity_is_open","openLike","setOrderBy","openActivity","DiscoverSearchListHeaderDirective","FeaturedProjectsController","featured","fetchFeatured","FeaturedProjectsDirective","HighlightedDirective","highlighted","MostActiveController","mostActive","getOrderBy","fetch","fetchMostActive","MostActiveDirective","MostLikedController","mostLiked","fetchMostLiked","MostLikedDirective","DiscoverHomeController","onSubmit","DiscoverSearchController","routeParams","searchResult","nextSearchPage","loadingGlobal","loadingList","loadingPagination","resetSearchList","fetchByGlobalSearch","fetchByOrderBy","getFilter","fetchSearch","is_looking_for_people","onChangeFilter","updateParams","onChangeOrder","DiscoverSearchDirective","DiscoverProjectsService","projectsService","_mostLiked","_mostActive","_featured","_searchResult","_projectsCount","decorate","_decorate","_nextSearchPage","_discoverParams","discover_mode","_params","getProjects","is_featured","ExternalAppController","externalAppsService","xhrError","loginUrl","createApplicationToken","_getApplicationToken","_redirect","_applicationId","application","_state","state","_user","_application","loginWithAnotherUserUrl","applicationToken","getApplicationToken","back","authorizeApplicationToken","ExternalAppsService","applicationId","externalapps","FeedbackService","sendFeedback","DutyDirective","navurls","duty","getDutyType","HomeController","HomeService","_attachProjectInfoToWorkInProgress","workInProgress","projectsById","_attachProjectInfoToDuty","_duties","watching","objType","getWorkInProgress","assignedIssuesPromise","assignedTasksPromise","assignedUserStoriesPromise","params_us","projectsPromise","watchingIssuesPromise","watchingTasksPromise","watchingUserStoriesPromise","getProjectsByUserId","p","status__is_closed","HomeProjectListDirective","newProject","WorkingOnController","homeService","_setAssignedTo","elem","_setWatching","WorkingOnDirective","DropdownProjectListDirective","DropdownUserDirective","authService","configService","locationService","navUrlsService","isFeedbackEnabled","userMenu","NavigationBarDirective","isEnabledHeader","NavigationBarService","enabledHeader","ProfileBarController","userService","loadStats","getStats","ProfileBarDirective","ProfileContactsController","loadContacts","getContacts","ProfileContactsDirective","FavItemDirective","itemType","FavsBaseController","ProfileLikedController","ProfileVotedController","ProfileWatchedController","_init","enableFilterByAll","enableFilterByProjects","enableFilterByUserStories","enableFilterByTasks","enableFilterByIssues","enableFilterByTextQuery","_resetList","scrollDisabled","_page","_enableLoadingSpinner","isLoading","_disableLoadingSpinner","_enableScroll","_disableScroll","_checkIfHasMorePages","hasNext","_checkIfHasNoResults","hasNoResults","loadItems","_getItems","filterByTextQuery","showAll","showProjectsOnly","showUserStoriesOnly","showTasksOnly","showIssuesOnly","getLiked","getVoted","getWatched","ProfileLikedDirective","ProfileVotedDirective","ProfileWatchedDirective","ProfileHints","hintKey","HINTS","hint","linkText","ProfileProjectsController","attachUserContactsToProjects","ProfileProjectsDirective","ProfileTabDirective","transclude","tab","tabIcon","iconName","tabActive","tabDisabled","addTab","ProfileTabsController","tabs","toggleTab","ProfileTabsDirective","ProfileController","getUserByUserName","notFound","userUsername","BlockedProjectExplanationDirective","LikeProjectButtonController","likeButtonService","toggleLike","_unlike","_like","like","unlike","LikeProjectButtonDirective","LikeProjectButtonService","_getProjectIndex","_updateProjects","isFan","projectIndex","totalFans","is_fan","total_fans","setProjects","_updateCurrentProject","setProject","likeProject","unlikeProject","SortProjectsDirective","opacity","sortData","sorted_project_ids","bulkUpdateProjectsOrder","WatchProjectButtonController","watchButtonService","showWatchOptions","toggleWatcherOptions","closeWatcherOptions","notifyLevel","WatchProjectButtonDirective","WatchProjectButtonService","isWatcher","totalWatchers","total_watchers","watchProject","unwatchProject","ProjectsListingController","ProjectController","activeMembers","setfn","metas","ProjectsService","projectUrl","getProjectBySlug","getProjectStats","paginate","colorized_tags","transferValidateToken","transferAccept","reason","transferReject","CantOwnProjectExplanationDirective","TransferProject","showAddComment","_refreshUserData","_validateToken","_setProjectData","_checkOwnerData","canBeOwnedByUser","canOwnProject","ownerMessage","maxProjects","currentProjects","validNumberOfMemberships","addComment","hideComment","TransferProjectDirective","Resource","urlsService","urlname","object_id","x-disable-pagination","progressMessage","progressPercent","pagination","paginateResponseService","x-lazy-pagination","getTimeline","only_relevant","Resources","services","serviceFn","serviceName","serviceProperty","warm","getUserStorage","setUserStorage","createUserStorage","getUserByUsername","getProfileTimeline","getUserTimeline","AppMetaService","_set","meta","setTitle","setDescription","setTwitterMetas","origin","setOpenGraphMetas","listener","_listener","$watchCollection","AttachmentsService","getMaxFileSize","maxFileSizeFormated","sizeError","saveError","ChekcPermissionsService","CurrentUserService","storageService","_projects","_projectsById","_joyride","_loadUserInfo","LightboxFactory","compile","scopeAttrs","PaginateResponse","paginateResponse","ProjectLogoService","modulo","COLORS","IMAGES","logos","murmurhash3_32_gc","ProjectService","_project","_section","_sectionsBreadcrumb","_activeMembers","ScopeEvent","scopes","_searchDuplicatedScopes","$id","_create","duplicatedScopeName","_tgEmitter","EventEmitter2","removeAllListeners","emitter","ThemeService","themeName","stylesheetEl","UserService","pageNumber","objectType","textQuery","contactsFiltered","contact","contactId","permissionDenied","UserTimelineAttachmentDirective","validFileExtensions","extension","is_image","templateHtml","UserTimelineItemTitle","sce","_fieldTranslationKey","timeline","title_attr","_getLink","_getUsernameSpan","field_name","new_value","sprint_name","us_name","event_us","_getTimelineObj","_getDetailObjUrl","obj_name","role_name","keySeq","_translateTitleParams","parent_userstory","_getParams","timeline_type","translate_params","getTitle","paramsKeys","translation","UserTimelineType","timelineType","hasIn","getType","UserTimelineItemDirective","UserTimelinePaginationSequence","generate","getContent","minItems","UserTimelineController","userTimelineService","timelineList","getProjectTimeline","loadTimeline","UserTimelineDirective","UserTimelineService","userTimelinePaginationSequenceService","userTimelineItemType","userTimelineItemTitle","_valid_fields","_invalid","fieldKey","value_diff","_isInValidTimeline","invalid","_parseEventType","event_type","_getTimelineObject","_attachExtraInfoToTimelineEntry","_parseTimeline","newdata","newItem","blocked","moveInBacklog","deleteIn","_addEntyAttributes","filterNot"],"mappings":"CAyBA,WACE,GAAIA,WAAWC,SAAUC,KAAMC,OAAQC,QAASC,kBAAmBC,KAEnEC,MAAKD,MAAQA,SAEbC,KAAKC,oBAAsBD,KAAKC,qBAAuBC,OAAOD,wBAE9DF,MAAMI,aAAe,SAASC,YAO5B,MANkB,OAAdA,aACFA,eAEFA,WAAaC,EAAEC,IAAIF,WAAY,SAASG,GACtC,MAAOC,MAAKC,UAAUF,KAEjBG,SAASN,WAAWO,KAAK,OAGlCZ,MAAMa,gCAAkC,WACtC,GAAIC,MAAM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,mBAAmBn4F,UAGnCzR,MACIA,KAAKqpG,sCAAsCV,SAAS7iG,SAG7DsjG,oBAAoBl6F,UAAU+5F,mBAAqB,SAASxwF,WAC1D,GAAI3S,OAqBJ,OApBAA,WACAA,OAAOyrF,MAAQ,SAAUhqF,OACvB,MAAO,UAAS2zB,MACd,MAAO3zB,OAAM+Q,GAAGC,SAASspF,YAAYppF,UAAWyiB,MAAM/3B,KAAK,SAASwC,UAClE,MAAO4B,OAAM2iG,eAAevkG,cAG/B3F,MACH8F,OAAOxF,IAAM,SAAUiH,OACrB,MAAO,UAASwO,KACd,MAAOxO,OAAMijG,mBAAmBz0F,OAEjC/V,MACH8F,OAAOgH,OAAS,SAAUvF,OACxB,MAAO,UAAS++C,OACd,MAAOA,OAAMmkD,UAAU,SAASh5F,MAC9B,MAAOlK,OAAMqiG,mBAAmBn4F,UAGnCzR,MACIA,KAAKqpG,sCAAsCV,SAAS7iG,SAGtDsjG,qBAENrpG,MAAMkQ,SAETrN,QAAQhD,OAAO,qBAAqBsd,QAAQ,wBAAyBksF,sBAEpE/lG,KAAKrD","file":"app.js","sourceRoot":"/source/","sourcesContent":["\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: app.coffee\n */\n\n(function() {\n var configure, i18nInit, init, module, modules, pluginsWithModule, taiga;\n\n this.taiga = taiga = {};\n\n this.taigaContribPlugins = this.taigaContribPlugins || window.taigaContribPlugins || [];\n\n taiga.generateHash = function(components) {\n if (components == null) {\n components = [];\n }\n components = _.map(components, function(x) {\n return JSON.stringify(x);\n });\n return hex_sha1(components.join(\":\"));\n };\n\n taiga.generateUniqueSessionIdentifier = function() {\n var date, randomNumber;\n date = (new Date()).getTime();\n randomNumber = Math.floor(Math.random() * 0x9000000);\n return taiga.generateHash([date, randomNumber]);\n };\n\n taiga.sessionId = taiga.generateUniqueSessionIdentifier();\n\n configure = function($routeProvider, $locationProvider, $httpProvider, $provide, $tgEventsProvider, $compileProvider, $translateProvider, $translatePartialLoaderProvider, $animateProvider) {\n var authHttpIntercept, blockingIntercept, decorators, defaultHeaders, loaderIntercept, originalWhen, preferedLangCode, userInfo, versionCheckHttpIntercept;\n $animateProvider.classNameFilter(/^(?:(?!ng-animate-disabled).)*$/);\n originalWhen = $routeProvider.when;\n $routeProvider.when = function(path, route) {\n route.resolve || (route.resolve = {});\n angular.extend(route.resolve, {\n languageLoad: [\n \"$q\", \"$translate\", function($q, $translate) {\n var deferred;\n deferred = $q.defer();\n $translate().then(function() {\n return deferred.resolve();\n });\n return deferred.promise;\n }\n ]\n });\n return originalWhen.call($routeProvider, path, route);\n };\n $routeProvider.when(\"/\", {\n templateUrl: \"home/home.html\",\n controller: \"Home\",\n controllerAs: \"vm\",\n loader: true,\n title: \"HOME.PAGE_TITLE\",\n loader: true,\n description: \"HOME.PAGE_DESCRIPTION\",\n joyride: \"dashboard\"\n });\n $routeProvider.when(\"/discover\", {\n templateUrl: \"discover/discover-home/discover-home.html\",\n controller: \"DiscoverHome\",\n controllerAs: \"vm\",\n title: \"PROJECT.NAVIGATION.DISCOVER\",\n loader: true\n });\n $routeProvider.when(\"/discover/search\", {\n templateUrl: \"discover/discover-search/discover-search.html\",\n title: \"PROJECT.NAVIGATION.DISCOVER\",\n loader: true,\n controller: \"DiscoverSearch\",\n controllerAs: \"vm\",\n reloadOnSearch: false\n });\n $routeProvider.when(\"/projects/\", {\n templateUrl: \"projects/listing/projects-listing.html\",\n access: {\n requiresLogin: true\n },\n title: \"PROJECTS.PAGE_TITLE\",\n description: \"PROJECTS.PAGE_DESCRIPTION\",\n loader: true,\n controller: \"ProjectsListing\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/blocked-project/:pslug/\", {\n templateUrl: \"projects/project/blocked-project.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/project/:pslug/\", {\n templateUrl: \"projects/project/project.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\",\n section: \"project-timeline\"\n });\n $routeProvider.when(\"/project/:pslug/search\", {\n templateUrl: \"search/search.html\",\n reloadOnSearch: false,\n section: \"search\",\n loader: true\n });\n $routeProvider.when(\"/project/:pslug/backlog\", {\n templateUrl: \"backlog/backlog.html\",\n loader: true,\n section: \"backlog\",\n joyride: \"backlog\"\n });\n $routeProvider.when(\"/project/:pslug/kanban\", {\n templateUrl: \"kanban/kanban.html\",\n loader: true,\n section: \"kanban\",\n joyride: \"kanban\"\n });\n $routeProvider.when(\"/project/:pslug/taskboard/:sslug\", {\n templateUrl: \"taskboard/taskboard.html\",\n loader: true,\n section: \"backlog\"\n });\n $routeProvider.when(\"/project/:pslug/us/:usref\", {\n templateUrl: \"us/us-detail.html\",\n loader: true,\n section: \"backlog-kanban\"\n });\n $routeProvider.when(\"/project/:pslug/task/:taskref\", {\n templateUrl: \"task/task-detail.html\",\n loader: true,\n section: \"backlog-kanban\"\n });\n $routeProvider.when(\"/project/:pslug/wiki\", {\n redirectTo: function(params) {\n return \"/project/\" + params.pslug + \"/wiki/home\";\n }\n });\n $routeProvider.when(\"/project/:pslug/wiki/:slug\", {\n templateUrl: \"wiki/wiki.html\",\n loader: true,\n section: \"wiki\"\n });\n $routeProvider.when(\"/project/:pslug/team\", {\n templateUrl: \"team/team.html\",\n loader: true,\n section: \"team\"\n });\n $routeProvider.when(\"/project/:pslug/issues\", {\n templateUrl: \"issue/issues.html\",\n loader: true,\n section: \"issues\"\n });\n $routeProvider.when(\"/project/:pslug/issue/:issueref\", {\n templateUrl: \"issue/issues-detail.html\",\n loader: true,\n section: \"issues\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/details\", {\n templateUrl: \"admin/admin-project-profile.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/default-values\", {\n templateUrl: \"admin/admin-project-default-values.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/modules\", {\n templateUrl: \"admin/admin-project-modules.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/export\", {\n templateUrl: \"admin/admin-project-export.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/reports\", {\n templateUrl: \"admin/admin-project-reports.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/status\", {\n templateUrl: \"admin/admin-project-values-status.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/points\", {\n templateUrl: \"admin/admin-project-values-points.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/priorities\", {\n templateUrl: \"admin/admin-project-values-priorities.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/severities\", {\n templateUrl: \"admin/admin-project-values-severities.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/types\", {\n templateUrl: \"admin/admin-project-values-types.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/custom-fields\", {\n templateUrl: \"admin/admin-project-values-custom-fields.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/memberships\", {\n templateUrl: \"admin/admin-memberships.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/roles\", {\n templateUrl: \"admin/admin-roles.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/webhooks\", {\n templateUrl: \"admin/admin-third-parties-webhooks.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/github\", {\n templateUrl: \"admin/admin-third-parties-github.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/gitlab\", {\n templateUrl: \"admin/admin-third-parties-gitlab.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/bitbucket\", {\n templateUrl: \"admin/admin-third-parties-bitbucket.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/contrib/:plugin\", {\n templateUrl: \"contrib/main.html\"\n });\n $routeProvider.when(\"/project/:pslug/transfer/:token\", {\n templateUrl: \"projects/transfer/transfer-page.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/user-settings/user-profile\", {\n templateUrl: \"user/user-profile.html\"\n });\n $routeProvider.when(\"/user-settings/user-change-password\", {\n templateUrl: \"user/user-change-password.html\"\n });\n $routeProvider.when(\"/user-settings/mail-notifications\", {\n templateUrl: \"user/mail-notifications.html\"\n });\n $routeProvider.when(\"/change-email/:email_token\", {\n templateUrl: \"user/change-email.html\"\n });\n $routeProvider.when(\"/cancel-account/:cancel_token\", {\n templateUrl: \"user/cancel-account.html\"\n });\n $routeProvider.when(\"/user-settings/contrib/:plugin\", {\n templateUrl: \"contrib/user-settings.html\"\n });\n $routeProvider.when(\"/profile\", {\n templateUrl: \"profile/profile.html\",\n loader: true,\n access: {\n requiresLogin: true\n },\n controller: \"Profile\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/profile/:slug\", {\n templateUrl: \"profile/profile.html\",\n loader: true,\n controller: \"Profile\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/login\", {\n templateUrl: \"auth/login.html\",\n title: \"LOGIN.PAGE_TITLE\",\n description: \"LOGIN.PAGE_DESCRIPTION\",\n disableHeader: true,\n controller: \"LoginPage\"\n });\n $routeProvider.when(\"/register\", {\n templateUrl: \"auth/register.html\",\n title: \"REGISTER.PAGE_TITLE\",\n description: \"REGISTER.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/forgot-password\", {\n templateUrl: \"auth/forgot-password.html\",\n title: \"FORGOT_PASSWORD.PAGE_TITLE\",\n description: \"FORGOT_PASSWORD.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/change-password/:token\", {\n templateUrl: \"auth/change-password-from-recovery.html\",\n title: \"CHANGE_PASSWORD.PAGE_TITLE\",\n description: \"CHANGE_PASSWORD.PAGE_TITLE\",\n disableHeader: true\n });\n $routeProvider.when(\"/invitation/:token\", {\n templateUrl: \"auth/invitation.html\",\n title: \"INVITATION.PAGE_TITLE\",\n description: \"INVITATION.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/external-apps\", {\n templateUrl: \"external-apps/external-app.html\",\n title: \"EXTERNAL_APP.PAGE_TITLE\",\n description: \"EXTERNAL_APP.PAGE_DESCRIPTION\",\n controller: \"ExternalApp\",\n controllerAs: \"vm\",\n disableHeader: true,\n mobileViewport: true\n });\n $routeProvider.when(\"/error\", {\n templateUrl: \"error/error.html\"\n });\n $routeProvider.when(\"/not-found\", {\n templateUrl: \"error/not-found.html\"\n });\n $routeProvider.when(\"/permission-denied\", {\n templateUrl: \"error/permission-denied.html\"\n });\n $routeProvider.otherwise({\n redirectTo: \"/not-found\"\n });\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false\n });\n defaultHeaders = {\n \"Content-Type\": \"application/json\",\n \"Accept-Language\": window.taigaConfig.defaultLanguage || \"en\",\n \"X-Session-Id\": taiga.sessionId\n };\n $httpProvider.defaults.headers[\"delete\"] = defaultHeaders;\n $httpProvider.defaults.headers.patch = defaultHeaders;\n $httpProvider.defaults.headers.post = defaultHeaders;\n $httpProvider.defaults.headers.put = defaultHeaders;\n $httpProvider.defaults.headers.get = {\n \"X-Session-Id\": taiga.sessionId\n };\n $httpProvider.useApplyAsync(true);\n $tgEventsProvider.setSessionId(taiga.sessionId);\n authHttpIntercept = function($q, $location, $navUrls, $lightboxService) {\n var httpResponseError;\n httpResponseError = function(response) {\n var nextUrl;\n if (response.status === 0 || (response.status === -1 && !response.config.cancelable)) {\n $lightboxService.closeAll();\n $location.path($navUrls.resolve(\"error\"));\n $location.replace();\n } else if (response.status === 401 && $location.url().indexOf('/login') === -1) {\n nextUrl = encodeURIComponent($location.url());\n $location.url($navUrls.resolve(\"login\")).search(\"next=\" + nextUrl);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"authHttpIntercept\", [\"$q\", \"$location\", \"$tgNavUrls\", \"lightboxService\", authHttpIntercept]);\n $httpProvider.interceptors.push(\"authHttpIntercept\");\n loaderIntercept = function($q, loaderService) {\n return {\n request: function(config) {\n loaderService.logRequest();\n return config;\n },\n requestError: function(rejection) {\n loaderService.logResponse();\n return $q.reject(rejection);\n },\n responseError: function(rejection) {\n loaderService.logResponse();\n return $q.reject(rejection);\n },\n response: function(response) {\n loaderService.logResponse();\n return response;\n }\n };\n };\n $provide.factory(\"loaderIntercept\", [\"$q\", \"tgLoader\", loaderIntercept]);\n $httpProvider.interceptors.push(\"loaderIntercept\");\n versionCheckHttpIntercept = function($q) {\n var httpResponseError;\n httpResponseError = function(response) {\n var $injector;\n if (response.status === 400 && response.data.version) {\n $injector = angular.element(\"body\").injector();\n $injector.invoke([\n \"$tgConfirm\", \"$translate\", (function(_this) {\n return function($confirm, $translate) {\n var versionErrorMsg;\n versionErrorMsg = $translate.instant(\"ERROR.VERSION_ERROR\");\n return $confirm.notify(\"error\", versionErrorMsg, null, 10000);\n };\n })(this)\n ]);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"versionCheckHttpIntercept\", [\"$q\", versionCheckHttpIntercept]);\n $httpProvider.interceptors.push(\"versionCheckHttpIntercept\");\n blockingIntercept = function($q, $routeParams, $location, $navUrls) {\n var redirectToBlockedPage, responseError, responseOk;\n redirectToBlockedPage = function() {\n var blockedUrl, currentUrl, pslug;\n pslug = $routeParams.pslug;\n blockedUrl = $navUrls.resolve(\"blocked-project\", {\n project: pslug\n });\n currentUrl = $location.url();\n if (currentUrl.indexOf(blockedUrl) === -1) {\n return $location.replace().path(blockedUrl);\n }\n };\n responseOk = function(response) {\n if (response.data.blocked_code) {\n redirectToBlockedPage();\n }\n return response;\n };\n responseError = function(response) {\n if (response.status === 451) {\n redirectToBlockedPage();\n }\n return $q.reject(response);\n };\n return {\n response: responseOk,\n responseError: responseError\n };\n };\n $provide.factory(\"blockingIntercept\", [\"$q\", \"$routeParams\", \"$location\", \"$tgNavUrls\", blockingIntercept]);\n $httpProvider.interceptors.push(\"blockingIntercept\");\n $compileProvider.debugInfoEnabled(window.taigaConfig.debugInfo || false);\n if (localStorage.userInfo) {\n userInfo = JSON.parse(localStorage.userInfo);\n }\n preferedLangCode = (userInfo != null ? userInfo.lang : void 0) || window.taigaConfig.defaultLanguage || \"en\";\n $translatePartialLoaderProvider.addPart('taiga');\n $translateProvider.useLoader('$translatePartialLoader', {\n urlTemplate: '/' + window._version + '/locales/{part}/locale-{lang}.json'\n }).useSanitizeValueStrategy('escapeParameters').addInterpolation('$translateMessageFormatInterpolation').preferredLanguage(preferedLangCode);\n $translateProvider.fallbackLanguage(preferedLangCode);\n decorators = window.getDecorators();\n return _.each(decorators, function(decorator) {\n return $provide.decorator(decorator.provider, decorator.decorator);\n });\n };\n\n i18nInit = function(lang, $translate) {\n var messages;\n moment.locale(lang);\n messages = {\n defaultMessage: $translate.instant(\"COMMON.FORM_ERRORS.DEFAULT_MESSAGE\"),\n type: {\n email: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_EMAIL\"),\n url: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_URL\"),\n urlstrict: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_URLSTRICT\"),\n number: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_NUMBER\"),\n digits: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_DIGITS\"),\n dateIso: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_DATEISO\"),\n alphanum: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_ALPHANUM\"),\n phone: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_PHONE\")\n },\n notnull: $translate.instant(\"COMMON.FORM_ERRORS.NOTNULL\"),\n notblank: $translate.instant(\"COMMON.FORM_ERRORS.NOT_BLANK\"),\n required: $translate.instant(\"COMMON.FORM_ERRORS.REQUIRED\"),\n regexp: $translate.instant(\"COMMON.FORM_ERRORS.REGEXP\"),\n min: $translate.instant(\"COMMON.FORM_ERRORS.MIN\"),\n max: $translate.instant(\"COMMON.FORM_ERRORS.MAX\"),\n range: $translate.instant(\"COMMON.FORM_ERRORS.RANGE\"),\n minlength: $translate.instant(\"COMMON.FORM_ERRORS.MIN_LENGTH\"),\n maxlength: $translate.instant(\"COMMON.FORM_ERRORS.MAX_LENGTH\"),\n rangelength: $translate.instant(\"COMMON.FORM_ERRORS.RANGE_LENGTH\"),\n mincheck: $translate.instant(\"COMMON.FORM_ERRORS.MIN_CHECK\"),\n maxcheck: $translate.instant(\"COMMON.FORM_ERRORS.MAX_CHECK\"),\n rangecheck: $translate.instant(\"COMMON.FORM_ERRORS.RANGE_CHECK\"),\n equalto: $translate.instant(\"COMMON.FORM_ERRORS.EQUAL_TO\"),\n linewidth: $translate.instant(\"COMMON.FORM_ERRORS.LINEWIDTH\"),\n pikaday: $translate.instant(\"COMMON.FORM_ERRORS.PIKADAY\")\n };\n return checksley.updateMessages('default', messages);\n };\n\n init = function($log, $rootscope, $auth, $events, $analytics, $translate, $location, $navUrls, appMetaService, projectService, loaderService, navigationBarService) {\n var un, user, validators;\n $log.debug(\"Initialize application\");\n $rootscope.$on('$translatePartialLoaderStructureChanged', function() {\n return $translate.refresh();\n });\n validators = {\n linewidth: function(val, width) {\n var lines, valid;\n lines = taiga.nl2br(val).split(\"
\");\n valid = _.every(lines, function(line) {\n return line.length < width;\n });\n return valid;\n },\n pikaday: function(val) {\n var prettyDate;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n return moment(val, prettyDate).isValid();\n }\n };\n checksley.updateValidators(validators);\n $rootscope.contribPlugins = this.taigaContribPlugins;\n $rootscope.adminPlugins = _.filter(this.taigaContribPlugins, {\n \"type\": \"admin\"\n });\n $rootscope.userSettingsPlugins = _.filter(this.taigaContribPlugins, {\n \"type\": \"userSettings\"\n });\n $rootscope.$on(\"$translateChangeEnd\", function(e, ctx) {\n var lang;\n lang = ctx.language;\n return i18nInit(lang, $translate);\n });\n Promise.setScheduler(function(cb) {\n return $rootscope.$evalAsync(cb);\n });\n $events.setupConnection();\n if ($auth.isAuthenticated()) {\n user = $auth.getUser();\n }\n $analytics.initialize();\n un = $rootscope.$on('$routeChangeStart', function(event, next) {\n if (next.loader) {\n loaderService.start(true);\n }\n return un();\n });\n return $rootscope.$on('$routeChangeSuccess', function(event, next) {\n var description, title;\n if (next.loader) {\n loaderService.start(true);\n }\n if (next.access && next.access.requiresLogin) {\n if (!$auth.isAuthenticated()) {\n $location.path($navUrls.resolve(\"login\"));\n }\n }\n projectService.setSection(next.section);\n if (next.params.pslug) {\n projectService.setProjectBySlug(next.params.pslug);\n } else {\n projectService.cleanProject();\n }\n if (next.title || next.description) {\n title = $translate.instant(next.title || \"\");\n description = $translate.instant(next.description || \"\");\n appMetaService.setAll(title, description);\n }\n if (next.mobileViewport) {\n appMetaService.addMobileViewport();\n } else {\n appMetaService.removeMobileViewport();\n }\n if (next.disableHeader) {\n return navigationBarService.disableHeader();\n } else {\n return navigationBarService.enableHeader();\n }\n });\n };\n\n pluginsWithModule = _.filter(this.taigaContribPlugins, function(plugin) {\n return plugin.module;\n });\n\n angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 500);\n\n modules = [\"taigaBase\", \"taigaCommon\", \"taigaResources\", \"taigaResources2\", \"taigaAuth\", \"taigaEvents\", \"taigaHome\", \"taigaNavigationBar\", \"taigaProjects\", \"taigaRelatedTasks\", \"taigaBacklog\", \"taigaTaskboard\", \"taigaKanban\", \"taigaIssues\", \"taigaUserStories\", \"taigaTasks\", \"taigaTeam\", \"taigaWiki\", \"taigaSearch\", \"taigaAdmin\", \"taigaProject\", \"taigaUserSettings\", \"taigaFeedback\", \"taigaPlugins\", \"taigaIntegrations\", \"taigaComponents\", \"taigaProfile\", \"taigaHome\", \"taigaUserTimeline\", \"taigaExternalApps\", \"taigaDiscover\", \"templates\", \"ngSanitize\", \"ngRoute\", \"ngAnimate\", \"ngAria\", \"pascalprecht.translate\", \"infinite-scroll\", \"tgRepeat\"].concat(_.map(pluginsWithModule, function(plugin) {\n return plugin.module;\n }));\n\n module = angular.module(\"taiga\", modules);\n\n module.config([\"$routeProvider\", \"$locationProvider\", \"$httpProvider\", \"$provide\", \"$tgEventsProvider\", \"$compileProvider\", \"$translateProvider\", \"$translatePartialLoaderProvider\", \"$animateProvider\", configure]);\n\n module.run([\"$log\", \"$rootScope\", \"$tgAuth\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"tgProjectService\", \"tgLoader\", \"tgNavigationBarService\", \"$route\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: classes.coffee\n */\n\n(function() {\n var TaigaBase, TaigaController, TaigaService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n TaigaBase = (function() {\n function TaigaBase() {}\n\n return TaigaBase;\n\n })();\n\n TaigaService = (function(superClass) {\n extend(TaigaService, superClass);\n\n function TaigaService() {\n return TaigaService.__super__.constructor.apply(this, arguments);\n }\n\n return TaigaService;\n\n })(TaigaBase);\n\n TaigaController = (function(superClass) {\n extend(TaigaController, superClass);\n\n function TaigaController() {\n this.onInitialDataError = bind(this.onInitialDataError, this);\n return TaigaController.__super__.constructor.apply(this, arguments);\n }\n\n TaigaController.prototype.onInitialDataError = function(xhr) {\n if (xhr) {\n if (xhr.status === 404) {\n this.location.path(this.navUrls.resolve(\"not-found\"));\n this.location.replace();\n } else if (xhr.status === 403) {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n this.location.replace();\n }\n }\n return this.q.reject(xhr);\n };\n\n return TaigaController;\n\n })(TaigaBase);\n\n this.taiga.Base = TaigaBase;\n\n this.taiga.Service = TaigaService;\n\n this.taiga.Controller = TaigaController;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: utils.coffee\n */\n\n(function() {\n var bindMethods, bindOnce, cancelTimeout, debounce, debounceLeading, defineImmutableProperty, groupBy, isImage, joinStr, mixOf, nl2br, patch, replaceTags, scopeDefer, sizeFormat, slugify, startswith, stripTags, taiga, timeout, toString, toggleText, trim, truncate, unslugify,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },\n slice = [].slice,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n nl2br = (function(_this) {\n return function(str) {\n var breakTag;\n breakTag = '
';\n return (str + '').replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1' + breakTag + '$2');\n };\n })(this);\n\n bindMethods = (function(_this) {\n return function(object) {\n var dependencies, methods;\n dependencies = _.keys(object);\n methods = [];\n _.forIn(object, function(value, key) {\n if (indexOf.call(dependencies, key) < 0) {\n return methods.push(key);\n }\n });\n return _.bindAll(object, methods);\n };\n })(this);\n\n bindOnce = (function(_this) {\n return function(scope, attr, continuation) {\n var delBind, val;\n val = scope.$eval(attr);\n if (val !== void 0) {\n return continuation(val);\n }\n delBind = null;\n return delBind = scope.$watch(attr, function(val) {\n if (val === void 0) {\n return;\n }\n continuation(val);\n if (delBind) {\n return delBind();\n }\n });\n };\n })(this);\n\n mixOf = function() {\n var Mixed, base, i, method, mixin, mixins, name, ref;\n base = arguments[0], mixins = 2 <= arguments.length ? slice.call(arguments, 1) : [];\n Mixed = (function(superClass) {\n extend(Mixed, superClass);\n\n function Mixed() {\n return Mixed.__super__.constructor.apply(this, arguments);\n }\n\n return Mixed;\n\n })(base);\n for (i = mixins.length - 1; i >= 0; i += -1) {\n mixin = mixins[i];\n ref = mixin.prototype;\n for (name in ref) {\n method = ref[name];\n Mixed.prototype[name] = method;\n }\n }\n return Mixed;\n };\n\n trim = function(data, char) {\n return _.trim(data, char);\n };\n\n slugify = function(data) {\n return data.toString().toLowerCase().trim().replace(/\\s+/g, '-').replace(/&/g, '-and-').replace(/[^\\w\\-]+/g, '').replace(/\\-\\-+/g, '-');\n };\n\n unslugify = function(data) {\n if (data) {\n return _.capitalize(data.replace(/-/g, ' '));\n }\n return data;\n };\n\n toggleText = function(element, texts) {\n var nextTextPosition, text;\n nextTextPosition = element.data('nextTextPosition');\n if ((nextTextPosition == null) || nextTextPosition >= texts.length) {\n nextTextPosition = 0;\n }\n text = texts[nextTextPosition];\n element.data('nextTextPosition', nextTextPosition + 1);\n return element.text(text);\n };\n\n groupBy = function(coll, pred) {\n var i, item, len, result;\n result = {};\n for (i = 0, len = coll.length; i < len; i++) {\n item = coll[i];\n result[pred(item)] = item;\n }\n return result;\n };\n\n timeout = function(wait, continuation) {\n return window.setTimeout(continuation, wait);\n };\n\n cancelTimeout = function(timeoutVar) {\n return window.clearTimeout(timeoutVar);\n };\n\n scopeDefer = function(scope, func) {\n return _.defer((function(_this) {\n return function() {\n return scope.$apply(func);\n };\n })(this));\n };\n\n toString = function(value) {\n if (_.isNumber(value)) {\n return value + \"\";\n } else if (_.isString(value)) {\n return value;\n } else if (_.isPlainObject(value)) {\n return JSON.stringify(value);\n } else if (_.isUndefined(value)) {\n return \"\";\n }\n return value.toString();\n };\n\n joinStr = function(str, coll) {\n return coll.join(str);\n };\n\n debounce = function(wait, func) {\n return _.debounce(func, wait, {\n leading: true,\n trailing: false\n });\n };\n\n debounceLeading = function(wait, func) {\n return _.debounce(func, wait, {\n leading: false,\n trailing: true\n });\n };\n\n startswith = function(str1, str2) {\n return _.startsWith(str1, str2);\n };\n\n truncate = function(str, maxLength, suffix) {\n var out;\n if (suffix == null) {\n suffix = \"...\";\n }\n if ((typeof str !== \"string\") && !(str instanceof String)) {\n return str;\n }\n out = str.slice(0);\n if (out.length > maxLength) {\n out = out.substring(0, maxLength + 1);\n out = out.substring(0, Math.min(out.length, out.lastIndexOf(\" \")));\n out = out + suffix;\n }\n return out;\n };\n\n sizeFormat = function(input, precision) {\n var number, size, units;\n if (precision == null) {\n precision = 1;\n }\n if (isNaN(parseFloat(input)) || !isFinite(input)) {\n return \"-\";\n }\n if (input === 0) {\n return \"0 bytes\";\n }\n units = [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n number = Math.floor(Math.log(input) / Math.log(1024));\n if (number > 5) {\n number = 5;\n }\n size = (input / Math.pow(1024, number)).toFixed(precision);\n return size + \" \" + units[number];\n };\n\n stripTags = function(str, exception) {\n var pattern;\n if (exception) {\n pattern = new RegExp('<(?!' + exception + '\\s*\\/?)[^>]+>', 'gi');\n return String(str).replace(pattern, '');\n } else {\n return String(str).replace(/<\\/?[^>]+>/g, '');\n }\n };\n\n replaceTags = function(str, tags, replace) {\n var pattern;\n pattern = new RegExp('<(' + tags + ')>', 'gi');\n str = str.replace(pattern, '<' + replace + '>');\n pattern = new RegExp('<\\/(' + tags + ')>', 'gi');\n str = str.replace(pattern, '');\n return str;\n };\n\n defineImmutableProperty = (function(_this) {\n return function(obj, name, fn) {\n return Object.defineProperty(obj, name, {\n get: function() {\n var fn_result;\n if (!_.isFunction(fn)) {\n throw \"defineImmutableProperty third param must be a function\";\n }\n fn_result = fn();\n if (fn_result && _.isObject(fn_result)) {\n if (fn_result.size === void 0) {\n throw \"defineImmutableProperty must return immutable data\";\n }\n }\n return fn_result;\n }\n });\n };\n })(this);\n\n _.mixin({\n removeKeys: function(obj, keys) {\n return _.chain([keys]).flatten().reduce(function(obj, key) {\n delete obj[key];\n return obj;\n }, obj).value();\n },\n cartesianProduct: function() {\n return _.reduceRight(arguments, function(a, b) {\n return _.flatten(_.map(a, function(x) {\n return _.map(b, function(y) {\n return [y].concat(x);\n });\n }), true);\n }, [[]]);\n }\n });\n\n isImage = function(name) {\n return name.match(/\\.(jpe?g|png|gif|gifv|webm)/i) !== null;\n };\n\n patch = function(oldImmutable, newImmutable) {\n var pathObj;\n pathObj = {};\n newImmutable.forEach(function(newValue, key) {\n if (newValue !== oldImmutable.get(key)) {\n if (newValue.toJS) {\n return pathObj[key] = newValue.toJS();\n } else {\n return pathObj[key] = newValue;\n }\n }\n });\n return pathObj;\n };\n\n taiga = this.taiga;\n\n taiga.nl2br = nl2br;\n\n taiga.bindMethods = bindMethods;\n\n taiga.bindOnce = bindOnce;\n\n taiga.mixOf = mixOf;\n\n taiga.trim = trim;\n\n taiga.slugify = slugify;\n\n taiga.unslugify = unslugify;\n\n taiga.toggleText = toggleText;\n\n taiga.groupBy = groupBy;\n\n taiga.timeout = timeout;\n\n taiga.cancelTimeout = cancelTimeout;\n\n taiga.scopeDefer = scopeDefer;\n\n taiga.toString = toString;\n\n taiga.joinStr = joinStr;\n\n taiga.truncate = truncate;\n\n taiga.debounce = debounce;\n\n taiga.debounceLeading = debounceLeading;\n\n taiga.startswith = startswith;\n\n taiga.sizeFormat = sizeFormat;\n\n taiga.stripTags = stripTags;\n\n taiga.replaceTags = replaceTags;\n\n taiga.defineImmutableProperty = defineImmutableProperty;\n\n taiga.isImage = isImage;\n\n taiga.patch = patch;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/controllerMixins.coffee\n */\n\n(function() {\n var FiltersMixin, PageMixin, groupBy, joinStr, taiga, toString, trim;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n joinStr = this.taiga.joinStr;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n PageMixin = (function() {\n function PageMixin() {}\n\n PageMixin.prototype.fillUsersAndRoles = function(users, roles) {\n var activeUsers, computableRoles;\n activeUsers = _.filter(users, (function(_this) {\n return function(user) {\n return user.is_active;\n };\n })(this));\n this.scope.activeUsers = _.sortBy(activeUsers, \"full_name_display\");\n this.scope.activeUsersById = groupBy(this.scope.activeUsers, function(e) {\n return e.id;\n });\n this.scope.users = _.sortBy(users, \"full_name_display\");\n this.scope.usersById = groupBy(this.scope.users, function(e) {\n return e.id;\n });\n this.scope.roles = _.sortBy(roles, \"order\");\n computableRoles = _(this.scope.project.members).map(\"role\").uniq().value();\n return this.scope.computableRoles = _(roles).filter(\"computable\").filter(function(x) {\n return _.includes(computableRoles, x.id);\n }).value();\n };\n\n PageMixin.prototype.loadUsersAndRoles = function() {\n var promise;\n promise = this.q.all([this.rs.projects.usersList(this.scope.projectId), this.rs.projects.rolesList(this.scope.projectId)]);\n return promise.then((function(_this) {\n return function(results) {\n var roles, users;\n users = results[0], roles = results[1];\n _this.fillUsersAndRoles(users, roles);\n return results;\n };\n })(this));\n };\n\n return PageMixin;\n\n })();\n\n taiga.PageMixin = PageMixin;\n\n FiltersMixin = (function() {\n function FiltersMixin() {}\n\n FiltersMixin.prototype.selectFilter = function(name, value, load) {\n var existing, location, params;\n if (load == null) {\n load = false;\n }\n params = this.location.search();\n if (params[name] !== void 0 && name !== \"page\") {\n existing = _.map(taiga.toString(params[name]).split(\",\"), function(x) {\n return trim(x);\n });\n existing.push(taiga.toString(value));\n existing = _.compact(existing);\n value = joinStr(\",\", _.uniq(existing));\n }\n if (!this.location.isInCurrentRouteParams(name, value)) {\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n }\n };\n\n FiltersMixin.prototype.replaceFilter = function(name, value, load) {\n var location;\n if (load == null) {\n load = false;\n }\n if (!this.location.isInCurrentRouteParams(name, value)) {\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n }\n };\n\n FiltersMixin.prototype.replaceAllFilters = function(filters, load) {\n var location;\n if (load == null) {\n load = false;\n }\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(filters);\n };\n\n FiltersMixin.prototype.unselectFilter = function(name, value, load) {\n var location, newValues, params, parsedValues;\n if (load == null) {\n load = false;\n }\n params = this.location.search();\n if (params[name] === void 0) {\n return;\n }\n if (value === void 0 || value === null) {\n delete params[name];\n }\n parsedValues = _.map(taiga.toString(params[name]).split(\",\"), function(x) {\n return trim(x);\n });\n newValues = _.reject(parsedValues, function(x) {\n return x === taiga.toString(value);\n });\n newValues = _.compact(newValues);\n if (_.isEmpty(newValues)) {\n value = null;\n } else {\n value = joinStr(\",\", _.uniq(newValues));\n }\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n };\n\n return FiltersMixin;\n\n })();\n\n taiga.FiltersMixin = FiltersMixin;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaAdmin\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/auth.coffee\n */\n\n(function() {\n var AuthService, CancelAccountDirective, ChangeEmailDirective, ChangePasswordFromRecoveryDirective, ForgotPasswordDirective, InvitationDirective, LoginDirective, LoginPage, PublicRegisterMessageDirective, RegisterDirective, debounce, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAuth\", [\"taigaResources\"]);\n\n LoginPage = (function() {\n LoginPage.$inject = ['tgCurrentUserService', '$location', '$tgNavUrls', '$routeParams'];\n\n function LoginPage(currentUserService, $location, $navUrls, $routeParams) {\n var url;\n if (currentUserService.isAuthenticated()) {\n url = $navUrls.resolve(\"home\");\n if ($routeParams['next']) {\n url = $routeParams['next'];\n $location.search('next', null);\n }\n $location.path(url);\n }\n }\n\n return LoginPage;\n\n })();\n\n module.controller('LoginPage', LoginPage);\n\n AuthService = (function(superClass) {\n extend(AuthService, superClass);\n\n AuthService.$inject = [\"$rootScope\", \"$tgStorage\", \"$tgModel\", \"$tgResources\", \"$tgHttp\", \"$tgUrls\", \"$tgConfig\", \"$translate\", \"tgCurrentUserService\", \"tgThemeService\"];\n\n function AuthService(rootscope, storage, model, rs, http, urls, config, translate, currentUserService1, themeService) {\n var userModel;\n this.rootscope = rootscope;\n this.storage = storage;\n this.model = model;\n this.rs = rs;\n this.http = http;\n this.urls = urls;\n this.config = config;\n this.translate = translate;\n this.currentUserService = currentUserService1;\n this.themeService = themeService;\n AuthService.__super__.constructor.call(this);\n userModel = this.getUser();\n this._currentTheme = this._getUserTheme();\n this.setUserdata(userModel);\n }\n\n AuthService.prototype.setUserdata = function(userModel) {\n if (userModel) {\n this.userData = Immutable.fromJS(userModel.getAttrs());\n return this.currentUserService.setUser(this.userData);\n } else {\n return this.userData = null;\n }\n };\n\n AuthService.prototype._getUserTheme = function() {\n var ref;\n return ((ref = this.rootscope.user) != null ? ref.theme : void 0) || this.config.get(\"defaultTheme\") || \"taiga\";\n };\n\n AuthService.prototype._setTheme = function() {\n var newTheme;\n newTheme = this._getUserTheme();\n if (this._currentTheme !== newTheme) {\n this._currentTheme = newTheme;\n return this.themeService.use(this._currentTheme);\n }\n };\n\n AuthService.prototype._setLocales = function() {\n var lang, ref;\n lang = ((ref = this.rootscope.user) != null ? ref.lang : void 0) || this.config.get(\"defaultLanguage\") || \"en\";\n this.translate.preferredLanguage(lang);\n return this.translate.use(lang);\n };\n\n AuthService.prototype.getUser = function() {\n var user, userData;\n if (this.rootscope.user) {\n return this.rootscope.user;\n }\n userData = this.storage.get(\"userInfo\");\n if (userData) {\n user = this.model.make_model(\"users\", userData);\n this.rootscope.user = user;\n this._setLocales();\n this._setTheme();\n return user;\n } else {\n this._setTheme();\n }\n return null;\n };\n\n AuthService.prototype.setUser = function(user) {\n this.rootscope.auth = user;\n this.storage.set(\"userInfo\", user.getAttrs());\n this.rootscope.user = user;\n this.setUserdata(user);\n this._setLocales();\n return this._setTheme();\n };\n\n AuthService.prototype.clear = function() {\n this.rootscope.auth = null;\n this.rootscope.user = null;\n return this.storage.remove(\"userInfo\");\n };\n\n AuthService.prototype.setToken = function(token) {\n return this.storage.set(\"token\", token);\n };\n\n AuthService.prototype.getToken = function() {\n return this.storage.get(\"token\");\n };\n\n AuthService.prototype.removeToken = function() {\n return this.storage.remove(\"token\");\n };\n\n AuthService.prototype.isAuthenticated = function() {\n if (this.getUser() !== null) {\n return true;\n }\n return false;\n };\n\n AuthService.prototype.refresh = function() {\n var url;\n url = this.urls.resolve(\"user-me\");\n return this.http.get(url).then((function(_this) {\n return function(data, status) {\n var user;\n user = data.data;\n user.token = _this.getUser().auth_token;\n user = _this.model.make_model(\"users\", user);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.login = function(data, type) {\n var url;\n url = this.urls.resolve(\"auth\");\n data = _.clone(data, false);\n data.type = type ? type : \"normal\";\n this.removeToken();\n return this.http.post(url, data).then((function(_this) {\n return function(data, status) {\n var user;\n user = _this.model.make_model(\"users\", data.data);\n _this.setToken(user.auth_token);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.logout = function() {\n this.removeToken();\n this.clear();\n this.currentUserService.removeUser();\n this._setTheme();\n return this._setLocales();\n };\n\n AuthService.prototype.register = function(data, type, existing) {\n var url;\n url = this.urls.resolve(\"auth-register\");\n data = _.clone(data, false);\n data.type = type ? type : \"public\";\n if (type === \"private\") {\n data.existing = existing ? existing : false;\n }\n this.removeToken();\n return this.http.post(url, data).then((function(_this) {\n return function(response) {\n var user;\n user = _this.model.make_model(\"users\", response.data);\n _this.setToken(user.auth_token);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.getInvitation = function(token) {\n return this.rs.invitations.get(token);\n };\n\n AuthService.prototype.acceptInvitiationWithNewUser = function(data) {\n return this.register(data, \"private\", false);\n };\n\n AuthService.prototype.acceptInvitiationWithExistingUser = function(data) {\n return this.register(data, \"private\", true);\n };\n\n AuthService.prototype.forgotPassword = function(data) {\n var url;\n url = this.urls.resolve(\"users-password-recovery\");\n data = _.clone(data, false);\n this.removeToken();\n return this.http.post(url, data);\n };\n\n AuthService.prototype.changePasswordFromRecovery = function(data) {\n var url;\n url = this.urls.resolve(\"users-change-password-from-recovery\");\n data = _.clone(data, false);\n this.removeToken();\n return this.http.post(url, data);\n };\n\n AuthService.prototype.changeEmail = function(data) {\n var url;\n url = this.urls.resolve(\"users-change-email\");\n data = _.clone(data, false);\n return this.http.post(url, data);\n };\n\n AuthService.prototype.cancelAccount = function(data) {\n var url;\n url = this.urls.resolve(\"users-cancel-account\");\n data = _.clone(data, false);\n return this.http.post(url, data);\n };\n\n return AuthService;\n\n })(taiga.Service);\n\n module.service(\"$tgAuth\", AuthService);\n\n PublicRegisterMessageDirective = function($config, $navUrls, $routeParams, templates) {\n var template, templateFn;\n template = templates.get(\"auth/login-text.html\", true);\n templateFn = function() {\n var nextUrl, publicRegisterEnabled, url;\n publicRegisterEnabled = $config.get(\"publicRegisterEnabled\");\n if (!publicRegisterEnabled) {\n return \"\";\n }\n url = $navUrls.resolve(\"register\");\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"register\")) {\n nextUrl = encodeURIComponent($routeParams['next']);\n url += \"?next=\" + nextUrl;\n }\n return template({\n url: url\n });\n };\n return {\n restrict: \"AE\",\n scope: {},\n template: templateFn\n };\n };\n\n module.directive(\"tgPublicRegisterMessage\", [\"$tgConfig\", \"$tgNavUrls\", \"$routeParams\", \"$tgTemplate\", PublicRegisterMessageDirective]);\n\n LoginDirective = function($auth, $confirm, $location, $config, $routeParams, $navUrls, $events, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onError, onSuccess, submit;\n form = new checksley.Form($el.find(\"form.login-form\"));\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"login\")) {\n $scope.nextUrl = decodeURIComponent($routeParams['next']);\n } else {\n $scope.nextUrl = $navUrls.resolve(\"home\");\n }\n onSuccess = function(response) {\n $events.setupConnection();\n return $location.url($scope.nextUrl);\n };\n onError = function(response) {\n return $confirm.notify(\"light-error\", $translate.instant(\"LOGIN_FORM.ERROR_AUTH_INCORRECT\"));\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, loginFormType, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n data = {\n \"username\": $el.find(\"form.login-form input[name=username]\").val(),\n \"password\": $el.find(\"form.login-form input[name=password]\").val()\n };\n loginFormType = $config.get(\"loginFormType\", \"normal\");\n promise = $auth.login(data, loginFormType);\n return promise.then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n window.prerenderReady = true;\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLogin\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgConfig\", \"$routeParams\", \"$tgNavUrls\", \"$tgEvents\", \"$translate\", LoginDirective]);\n\n RegisterDirective = function($auth, $confirm, $location, $navUrls, $config, $routeParams, $analytics, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n if (!$config.get(\"publicRegisterEnabled\")) {\n $location.path($navUrls.resolve(\"not-found\"));\n $location.replace();\n }\n $scope.data = {};\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n $scope.nextUrl = $navUrls.resolve(\"home\");\n onSuccessSubmit = function(response) {\n $analytics.trackEvent(\"auth\", \"register\", \"user registration\", 1);\n return $location.url($scope.nextUrl);\n };\n onErrorSubmit = function(response) {\n var text;\n if (response.data._error_message) {\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n $confirm.notify(\"light-error\", text);\n }\n return form.setErrors(response.data);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.register($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return window.prerenderReady = true;\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRegister\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\", \"$routeParams\", \"$tgAnalytics\", \"$translate\", RegisterDirective]);\n\n ForgotPasswordDirective = function($auth, $confirm, $location, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var message, title;\n $location.path($navUrls.resolve(\"login\"));\n title = $translate.instant(\"FORGOT_PASSWORD_FORM.SUCCESS_TITLE\");\n message = $translate.instant(\"FORGOT_PASSWORD_FORM.SUCCESS_TEXT\");\n return $confirm.success(title, message);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"FORGOT_PASSWORD_FORM.ERROR\");\n return $confirm.notify(\"light-error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.forgotPassword($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return window.prerenderReady = true;\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgForgotPassword\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$translate\", ForgotPasswordDirective]);\n\n ChangePasswordFromRecoveryDirective = function($auth, $confirm, $location, $params, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit, text;\n $scope.data = {};\n if ($params.token != null) {\n $scope.tokenInParams = true;\n $scope.data.token = $params.token;\n } else {\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.ERROR\");\n $confirm.notify(\"light-error\", text);\n }\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.ERROR\");\n return $confirm.notify(\"light-error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.changePasswordFromRecovery($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangePasswordFromRecovery\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$translate\", ChangePasswordFromRecoveryDirective]);\n\n InvitationDirective = function($auth, $confirm, $location, $params, $navUrls, $analytics, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var loginForm, onErrorSubmitLogin, onErrorSubmitRegister, onSuccessSubmitLogin, onSuccessSubmitRegister, promise, registerForm, submitLogin, submitRegister, token;\n token = $params.token;\n promise = $auth.getInvitation(token);\n promise.then(function(invitation) {\n return $scope.invitation = invitation;\n });\n promise.then(null, function(response) {\n var text;\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"INVITATION_LOGIN_FORM.NOT_FOUND\");\n return $confirm.notify(\"light-error\", text);\n });\n $scope.dataLogin = {\n token: token\n };\n loginForm = $el.find(\"form.login-form\").checksley({\n onlyOneErrorElement: true\n });\n onSuccessSubmitLogin = function(response) {\n var text;\n $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with existing user\", 1);\n $location.path($navUrls.resolve(\"project\", {\n project: $scope.invitation.project_slug\n }));\n text = $translate.instant(\"INVITATION_LOGIN_FORM.SUCCESS\", {\n \"project_name\": $scope.invitation.project_name\n });\n return $confirm.notify(\"success\", text);\n };\n onErrorSubmitLogin = function(response) {\n return $confirm.notify(\"light-error\", response.data._error_message);\n };\n submitLogin = debounce(2000, (function(_this) {\n return function(event) {\n event.preventDefault();\n if (!loginForm.validate()) {\n return;\n }\n promise = $auth.acceptInvitiationWithExistingUser($scope.dataLogin);\n return promise.then(onSuccessSubmitLogin, onErrorSubmitLogin);\n };\n })(this));\n $el.on(\"submit\", \"form.login-form\", submitLogin);\n $el.on(\"click\", \".button-login\", submitLogin);\n $scope.dataRegister = {\n token: token\n };\n registerForm = $el.find(\"form.register-form\").checksley({\n onlyOneErrorElement: true\n });\n onSuccessSubmitRegister = function(response) {\n $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with new user\", 1);\n $location.path($navUrls.resolve(\"project\", {\n project: $scope.invitation.project_slug\n }));\n return $confirm.notify(\"success\", \"You've successfully joined this project\", \"Welcome to \" + (_.escape($scope.invitation.project_name)));\n };\n onErrorSubmitRegister = function(response) {\n var text;\n if (response.data._error_message) {\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n $confirm.notify(\"light-error\", text);\n }\n return registerForm.setErrors(response.data);\n };\n submitRegister = debounce(2000, (function(_this) {\n return function(event) {\n event.preventDefault();\n if (!registerForm.validate()) {\n return;\n }\n promise = $auth.acceptInvitiationWithNewUser($scope.dataRegister);\n return promise.then(onSuccessSubmitRegister, onErrorSubmitRegister);\n };\n })(this));\n $el.on(\"submit\", \"form.register-form\", submitRegister);\n $el.on(\"click\", \".button-register\", submitRegister);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgInvitation\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\", InvitationDirective]);\n\n ChangeEmailDirective = function($repo, $model, $auth, $confirm, $location, $params, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n $scope.data.email_token = $params.email_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var text;\n if ($auth.isAuthenticated()) {\n $repo.queryOne(\"users\", $auth.getUser().id).then((function(_this) {\n return function(data) {\n $auth.setUser(data);\n return $location.path($navUrls.resolve(\"home\"));\n };\n })(this));\n } else {\n $location.path($navUrls.resolve(\"login\"));\n }\n text = $translate.instant(\"CHANGE_EMAIL_FORM.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n return $confirm.notify(\"light-error\", text);\n };\n submit = function() {\n var promise;\n if (!form.validate()) {\n return;\n }\n promise = $auth.changeEmail($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n $el.on(\"submit\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \"a.button-change-email\", function(event) {\n event.preventDefault();\n return submit();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangeEmail\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$translate\", ChangeEmailDirective]);\n\n CancelAccountDirective = function($repo, $model, $auth, $confirm, $location, $params, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n $scope.data.cancel_token = $params.cancel_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var text;\n $auth.logout();\n $location.path($navUrls.resolve(\"home\"));\n text = $translate.instant(\"CANCEL_ACCOUNT.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n return $confirm.notify(\"error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.cancelAccount($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgCancelAccount\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", CancelAccountDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaBacklog\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base.coffee\n */\n\n(function() {\n var TaigaMainDirective, bindOnce, groupBy, init, module, taiga, urls;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaBase\", []);\n\n TaigaMainDirective = function($rootscope, $window) {\n var link;\n link = function($scope, $el, $attrs) {\n return $window.onresize = function() {\n return $rootscope.$broadcast(\"resize\");\n };\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMain\", [\"$rootScope\", \"$window\", TaigaMainDirective]);\n\n urls = {\n \"home\": \"/\",\n \"projects\": \"/projects\",\n \"error\": \"/error\",\n \"not-found\": \"/not-found\",\n \"permission-denied\": \"/permission-denied\",\n \"discover\": \"/discover\",\n \"discover-search\": \"/discover/search\",\n \"login\": \"/login\",\n \"forgot-password\": \"/forgot-password\",\n \"change-password\": \"/change-password/:token\",\n \"change-email\": \"/change-email/:token\",\n \"cancel-account\": \"/cancel-account/:token\",\n \"register\": \"/register\",\n \"invitation\": \"/invitation/:token\",\n \"create-project\": \"/create-project\",\n \"profile\": \"/profile\",\n \"user-profile\": \"/profile/:username\",\n \"blocked-project\": \"/blocked-project/:project\",\n \"project\": \"/project/:project\",\n \"project-backlog\": \"/project/:project/backlog\",\n \"project-taskboard\": \"/project/:project/taskboard/:sprint\",\n \"project-kanban\": \"/project/:project/kanban\",\n \"project-issues\": \"/project/:project/issues\",\n \"project-search\": \"/project/:project/search\",\n \"project-userstories-detail\": \"/project/:project/us/:ref\",\n \"project-tasks-detail\": \"/project/:project/task/:ref\",\n \"project-issues-detail\": \"/project/:project/issue/:ref\",\n \"project-wiki\": \"/project/:project/wiki\",\n \"project-wiki-page\": \"/project/:project/wiki/:slug\",\n \"project-team\": \"/project/:project/team\",\n \"project-admin-home\": \"/project/:project/admin/project-profile/details\",\n \"project-admin-project-profile-details\": \"/project/:project/admin/project-profile/details\",\n \"project-admin-project-profile-default-values\": \"/project/:project/admin/project-profile/default-values\",\n \"project-admin-project-profile-modules\": \"/project/:project/admin/project-profile/modules\",\n \"project-admin-project-profile-export\": \"/project/:project/admin/project-profile/export\",\n \"project-admin-project-profile-reports\": \"/project/:project/admin/project-profile/reports\",\n \"project-admin-project-values-status\": \"/project/:project/admin/project-values/status\",\n \"project-admin-project-values-points\": \"/project/:project/admin/project-values/points\",\n \"project-admin-project-values-priorities\": \"/project/:project/admin/project-values/priorities\",\n \"project-admin-project-values-severities\": \"/project/:project/admin/project-values/severities\",\n \"project-admin-project-values-types\": \"/project/:project/admin/project-values/types\",\n \"project-admin-project-values-custom-fields\": \"/project/:project/admin/project-values/custom-fields\",\n \"project-admin-memberships\": \"/project/:project/admin/memberships\",\n \"project-admin-roles\": \"/project/:project/admin/roles\",\n \"project-admin-third-parties-webhooks\": \"/project/:project/admin/third-parties/webhooks\",\n \"project-admin-third-parties-github\": \"/project/:project/admin/third-parties/github\",\n \"project-admin-third-parties-gitlab\": \"/project/:project/admin/third-parties/gitlab\",\n \"project-admin-third-parties-bitbucket\": \"/project/:project/admin/third-parties/bitbucket\",\n \"project-admin-contrib\": \"/project/:project/admin/contrib/:plugin\",\n \"user-settings-user-profile\": \"/user-settings/user-profile\",\n \"user-settings-user-change-password\": \"/user-settings/user-change-password\",\n \"user-settings-user-avatar\": \"/user-settings/user-avatar\",\n \"user-settings-mail-notifications\": \"/user-settings/mail-notifications\",\n \"user-settings-contrib\": \"/user-settings/contrib/:plugin\"\n };\n\n init = function($log, $navurls) {\n $log.debug(\"Initialize navigation urls\");\n return $navurls.update(urls);\n };\n\n module.run([\"$log\", \"$tgNavUrls\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common.coffee\n */\n\n(function() {\n var AnimationFrame, Capslock, CheckPermissionDirective, ClassPermissionDirective, DataPickerConfig, ProjectUrl, Qqueue, SelectedText, Template, ToggleCommentDirective, module, taiga,\n slice = [].slice;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\", []);\n\n DataPickerConfig = function($translate) {\n return {\n get: function() {\n return {\n i18n: {\n previousMonth: $translate.instant(\"COMMON.PICKERDATE.PREV_MONTH\"),\n nextMonth: $translate.instant(\"COMMON.PICKERDATE.NEXT_MONTH\"),\n months: [$translate.instant(\"COMMON.PICKERDATE.MONTHS.JAN\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.FEB\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.MAR\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.APR\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.MAY\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.JUN\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.JUL\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.AUG\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.SEP\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.OCT\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.NOV\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.DEC\")],\n weekdays: [$translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.SUN\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.MON\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.TUE\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.WED\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.THU\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.FRI\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.SAT\")],\n weekdaysShort: [$translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.SUN\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.MON\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.TUE\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.WED\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.THU\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.FRI\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.SAT\")]\n },\n isRTL: $translate.instant(\"COMMON.PICKERDATE.IS_RTL\") === \"true\",\n firstDay: parseInt($translate.instant(\"COMMON.PICKERDATE.FIRST_DAY_OF_WEEK\"), 10),\n format: $translate.instant(\"COMMON.PICKERDATE.FORMAT\")\n };\n }\n };\n };\n\n module.factory(\"tgDatePickerConfigService\", [\"$translate\", DataPickerConfig]);\n\n SelectedText = function($window, $document) {\n var get;\n get = function() {\n if ($window.getSelection) {\n return $window.getSelection().toString();\n } else if ($document.selection) {\n return $document.selection.createRange().text;\n }\n return \"\";\n };\n return {\n get: get\n };\n };\n\n module.factory(\"$selectedText\", [\"$window\", \"$document\", SelectedText]);\n\n CheckPermissionDirective = function(projectService) {\n var link, render;\n render = function($el, project, permission) {\n if (project && permission) {\n if (project.get('my_permissions').indexOf(permission) > -1) {\n return $el.removeClass('hidden');\n }\n }\n };\n link = function($scope, $el, $attrs) {\n var permission, unObserve, unwatch;\n $el.addClass('hidden');\n permission = $attrs.tgCheckPermission;\n unwatch = $scope.$watch(function() {\n return projectService.project;\n }, function() {\n if (!projectService.project) {\n return;\n }\n render($el, projectService.project, permission);\n return unwatch();\n });\n unObserve = $attrs.$observe(\"tgCheckPermission\", function(permission) {\n if (!permission) {\n return;\n }\n render($el, projectService.project, permission);\n return unObserve();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n CheckPermissionDirective.$inject = [\"tgProjectService\"];\n\n module.directive(\"tgCheckPermission\", CheckPermissionDirective);\n\n ClassPermissionDirective = function() {\n var link, name;\n name = \"tgClassPermission\";\n link = function($scope, $el, $attrs) {\n var checkPermissions, tgClassPermissionWatchAction, unbindWatcher;\n checkPermissions = function(project, className, permission) {\n var negation;\n negation = permission[0] === \"!\";\n if (negation) {\n permission = permission.slice(1);\n }\n if (negation && project.my_permissions.indexOf(permission) === -1) {\n return $el.addClass(className);\n } else if (!negation && project.my_permissions.indexOf(permission) !== -1) {\n return $el.addClass(className);\n } else {\n return $el.removeClass(className);\n }\n };\n tgClassPermissionWatchAction = function(project) {\n var className, classes, permission, results;\n if (project) {\n unbindWatcher();\n classes = $scope.$eval($attrs[name]);\n results = [];\n for (className in classes) {\n permission = classes[className];\n results.push(checkPermissions(project, className, permission));\n }\n return results;\n }\n };\n return unbindWatcher = $scope.$watch(\"project\", tgClassPermissionWatchAction);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgClassPermission\", ClassPermissionDirective);\n\n AnimationFrame = function() {\n var add, animationFrame, performAnimation, tail;\n animationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;\n performAnimation = (function(_this) {\n return function(time) {\n var fn;\n fn = tail.shift();\n fn();\n if (tail.length) {\n return animationFrame(performAnimation);\n }\n };\n })(this);\n tail = [];\n add = function() {\n var fn, i, len, results;\n results = [];\n for (i = 0, len = arguments.length; i < len; i++) {\n fn = arguments[i];\n tail.push(fn);\n if (tail.length === 1) {\n results.push(animationFrame(performAnimation));\n } else {\n results.push(void 0);\n }\n }\n return results;\n };\n return {\n add: add\n };\n };\n\n module.factory(\"animationFrame\", AnimationFrame);\n\n ToggleCommentDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.find(\"textarea\").on(\"focus\", function() {\n return $el.addClass(\"active\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgToggleComment\", ToggleCommentDirective);\n\n ProjectUrl = function($navurls) {\n var get;\n get = function(project) {\n var ctx;\n ctx = {\n project: project.slug\n };\n if (project.is_backlog_activated && project.my_permissions.indexOf(\"view_us\") > -1) {\n return $navurls.resolve(\"project-backlog\", ctx);\n }\n if (project.is_kanban_activated && project.my_permissions.indexOf(\"view_us\") > -1) {\n return $navurls.resolve(\"project-kanban\", ctx);\n }\n if (project.is_wiki_activated && project.my_permissions.indexOf(\"view_wiki_pages\") > -1) {\n return $navurls.resolve(\"project-wiki\", ctx);\n }\n if (project.is_issues_activated && project.my_permissions.indexOf(\"view_issues\") > -1) {\n return $navurls.resolve(\"project-issues\", ctx);\n }\n return $navurls.resolve(\"project\", ctx);\n };\n return {\n get: get\n };\n };\n\n module.factory(\"$projectUrl\", [\"$tgNavUrls\", ProjectUrl]);\n\n Qqueue = function($q) {\n var deferred, lastPromise, qqueue;\n deferred = $q.defer();\n deferred.resolve();\n lastPromise = deferred.promise;\n qqueue = {\n bindAdd: (function(_this) {\n return function(fn) {\n return function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return lastPromise = lastPromise.then(function() {\n return fn.apply(_this, args);\n });\n };\n return qqueue;\n };\n })(this),\n add: (function(_this) {\n return function(fn) {\n if (!lastPromise) {\n lastPromise = fn();\n } else {\n lastPromise = lastPromise.then(fn);\n }\n return qqueue;\n };\n })(this)\n };\n return qqueue;\n };\n\n module.factory(\"$tgQqueue\", [\"$q\", Qqueue]);\n\n Template = function($templateCache) {\n return {\n get: (function(_this) {\n return function(name, lodash) {\n var tmp;\n if (lodash == null) {\n lodash = false;\n }\n tmp = $templateCache.get(name);\n if (lodash) {\n tmp = _.template(tmp);\n }\n return tmp;\n };\n })(this)\n };\n };\n\n module.factory(\"$tgTemplate\", [\"$templateCache\", Template]);\n\n Capslock = function($translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var hideIcon, open, showIcon, warningIcon;\n open = false;\n warningIcon = \"\";\n hideIcon = function() {\n return $('.icon-capslock').fadeOut(function() {\n open = false;\n return $(this).remove();\n });\n };\n showIcon = function(e) {\n var element;\n if (open) {\n return;\n }\n element = e.currentTarget;\n $(element).parent().append(warningIcon);\n $('.icon-capslock').fadeIn();\n return open = true;\n };\n $el.on('blur', function(e) {\n return hideIcon();\n });\n $el.on('keyup.capslock, focus', function(e) {\n if ($el.val() === $el.val().toLowerCase()) {\n return hideIcon(e);\n } else {\n return showIcon(e);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off('.capslock');\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgCapslock\", [\"$translate\", Capslock]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/events.coffee\n */\n\n(function() {\n var EventsProvider, EventsService, bindMethods, module, startswith, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n startswith = this.taiga.startswith;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaEvents\", []);\n\n EventsService = (function() {\n function EventsService(win, log, config, auth, liveAnnouncementService1, rootScope) {\n this.win = win;\n this.log = log;\n this.config = config;\n this.auth = auth;\n this.liveAnnouncementService = liveAnnouncementService1;\n this.rootScope = rootScope;\n this.processMessage = bind(this.processMessage, this);\n bindMethods(this);\n }\n\n EventsService.prototype.initialize = function(sessionId) {\n this.sessionId = sessionId;\n this.subscriptions = {};\n this.connected = false;\n this.error = false;\n this.pendingMessages = [];\n this.missedHeartbeats = 0;\n this.heartbeatInterval = null;\n if (this.win.WebSocket === void 0) {\n return this.log.info(\"WebSockets not supported on your browser\");\n }\n };\n\n EventsService.prototype.setupConnection = function() {\n var loc, path, scheme, url;\n this.stopExistingConnection();\n url = this.config.get(\"eventsUrl\");\n if (!url) {\n return;\n }\n if (!startswith(url, \"ws:\") && !startswith(url, \"wss:\")) {\n loc = this.win.location;\n scheme = loc.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n path = _.trimStart(url, \"/\");\n url = scheme + \"//\" + loc.host + \"/\" + path;\n }\n this.ws = new this.win.WebSocket(url);\n this.ws.addEventListener(\"open\", this.onOpen);\n this.ws.addEventListener(\"message\", this.onMessage);\n this.ws.addEventListener(\"error\", this.onError);\n return this.ws.addEventListener(\"close\", this.onClose);\n };\n\n EventsService.prototype.stopExistingConnection = function() {\n if (this.ws === void 0) {\n return;\n }\n this.ws.removeEventListener(\"open\", this.onOpen);\n this.ws.removeEventListener(\"close\", this.onClose);\n this.ws.removeEventListener(\"error\", this.onError);\n this.ws.removeEventListener(\"message\", this.onMessage);\n this.stopHeartBeatMessages();\n this.ws.close();\n return delete this.ws;\n };\n\n EventsService.prototype.notifications = function() {\n return this.subscribe(null, 'notifications', (function(_this) {\n return function(data) {\n _this.liveAnnouncementService.show(data.title, data.desc);\n return _this.rootScope.$digest();\n };\n })(this));\n };\n\n EventsService.prototype.startHeartBeatMessages = function() {\n var heartbeatIntervalTime, maxMissedHeartbeats;\n if (this.heartbeatInterval) {\n return;\n }\n maxMissedHeartbeats = this.config.get(\"eventsMaxMissedHeartbeats\", 5);\n heartbeatIntervalTime = this.config.get(\"eventsHeartbeatIntervalTime\", 60000);\n this.missedHeartbeats = 0;\n this.heartbeatInterval = setInterval((function(_this) {\n return function() {\n var e, error1;\n try {\n if (_this.missedHeartbeats >= maxMissedHeartbeats) {\n throw new Error(\"Too many missed heartbeats PINGs.\");\n }\n _this.missedHeartbeats++;\n _this.sendMessage({\n cmd: \"ping\"\n });\n return _this.log.debug(\"HeartBeat send PING\");\n } catch (error1) {\n e = error1;\n _this.log.error(\"HeartBeat error: \" + e.message);\n return _this.stopHeartBeatMessages();\n }\n };\n })(this), heartbeatIntervalTime);\n return this.log.debug(\"HeartBeat enabled\");\n };\n\n EventsService.prototype.stopHeartBeatMessages = function() {\n if (!this.heartbeatInterval) {\n return;\n }\n clearInterval(this.heartbeatInterval);\n this.heartbeatInterval = null;\n return this.log.debug(\"HeartBeat disabled\");\n };\n\n EventsService.prototype.processHeartBeatPongMessage = function(data) {\n this.missedHeartbeats = 0;\n return this.log.debug(\"HeartBeat recived PONG\");\n };\n\n EventsService.prototype.serialize = function(message) {\n if (_.isObject(message)) {\n return JSON.stringify(message);\n }\n return message;\n };\n\n EventsService.prototype.sendMessage = function(message) {\n var i, len, messages, msg, results;\n this.pendingMessages.push(message);\n if (!this.connected) {\n return;\n }\n messages = _.map(this.pendingMessages, this.serialize);\n this.pendingMessages = [];\n results = [];\n for (i = 0, len = messages.length; i < len; i++) {\n msg = messages[i];\n results.push(this.ws.send(msg));\n }\n return results;\n };\n\n EventsService.prototype.processMessage = function(data) {\n var routingKey, subscription;\n routingKey = data.routing_key;\n if (this.subscriptions[routingKey] == null) {\n return;\n }\n subscription = this.subscriptions[routingKey];\n if (subscription.scope) {\n return subscription.scope.$apply(function() {\n return subscription.callback(data.data);\n });\n } else {\n return subscription.callback(data.data);\n }\n };\n\n EventsService.prototype.subscribe = function(scope, routingKey, callback) {\n var message, subscription;\n if (this.error) {\n return;\n }\n this.log.debug(\"Subscribe to: \" + routingKey);\n subscription = {\n scope: scope,\n routingKey: routingKey,\n callback: _.debounce(callback, 500, {\n \"leading\": true,\n \"trailing\": false\n })\n };\n message = {\n \"cmd\": \"subscribe\",\n \"routing_key\": routingKey\n };\n this.subscriptions[routingKey] = subscription;\n this.sendMessage(message);\n if (scope) {\n return scope.$on(\"$destroy\", (function(_this) {\n return function() {\n return _this.unsubscribe(routingKey);\n };\n })(this));\n }\n };\n\n EventsService.prototype.unsubscribe = function(routingKey) {\n var message;\n if (this.error) {\n return;\n }\n this.log.debug(\"Unsubscribe from: \" + routingKey);\n message = {\n \"cmd\": \"unsubscribe\",\n \"routing_key\": routingKey\n };\n return this.sendMessage(message);\n };\n\n EventsService.prototype.onOpen = function() {\n var message, token;\n this.connected = true;\n this.startHeartBeatMessages();\n this.notifications();\n this.log.debug(\"WebSocket connection opened\");\n token = this.auth.getToken();\n message = {\n cmd: \"auth\",\n data: {\n token: token,\n sessionId: this.sessionId\n }\n };\n return this.sendMessage(message);\n };\n\n EventsService.prototype.onMessage = function(event) {\n var data;\n this.log.debug(\"WebSocket message received: \" + event.data);\n data = JSON.parse(event.data);\n if (data.cmd === \"pong\") {\n return this.processHeartBeatPongMessage(data);\n } else {\n return this.processMessage(data);\n }\n };\n\n EventsService.prototype.onError = function(error) {\n this.log.error(\"WebSocket error: \" + error);\n return this.error = true;\n };\n\n EventsService.prototype.onClose = function() {\n this.log.debug(\"WebSocket closed.\");\n this.connected = false;\n return this.stopHeartBeatMessages();\n };\n\n return EventsService;\n\n })();\n\n EventsProvider = (function() {\n function EventsProvider() {}\n\n EventsProvider.prototype.setSessionId = function(sessionId) {\n return this.sessionId = sessionId;\n };\n\n EventsProvider.prototype.$get = function($win, $log, $conf, $auth, liveAnnouncementService, $rootScope) {\n var service;\n service = new EventsService($win, $log, $conf, $auth, liveAnnouncementService, $rootScope);\n service.initialize(this.sessionId);\n return service;\n };\n\n EventsProvider.prototype.$get.$inject = [\"$window\", \"$log\", \"$tgConfig\", \"$tgAuth\", \"tgLiveAnnouncementService\", \"$rootScope\"];\n\n return EventsProvider;\n\n })();\n\n module.provider(\"$tgEvents\", EventsProvider);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/feedback.coffee\n */\n\n(function() {\n var FeedbackDirective, bindOnce, debounce, groupBy, mixOf, module, taiga, trim;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n mixOf = this.taiga.mixOf;\n\n debounce = this.taiga.debounce;\n\n trim = this.taiga.trim;\n\n module = angular.module(\"taigaFeedback\", []);\n\n FeedbackDirective = function($lightboxService, $repo, $confirm, $loading, feedbackService) {\n var directive, link;\n link = function($scope, $el, $attrs) {\n var form, openLightbox, submit, submitButton;\n form = $el.find(\"form\").checksley();\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.create(\"feedback\", $scope.feedback);\n promise.then(function(data) {\n currentLoading.finish();\n $lightboxService.close($el);\n return $confirm.notify(\"success\", \"\\\\o/ we'll be happy to read your\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n openLightbox = function() {\n $scope.feedback = {};\n $lightboxService.open($el);\n return $el.find(\"textarea\").focus();\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return openLightbox();\n };\n directive = {\n link: link,\n templateUrl: \"common/lightbox-feedback.html\",\n scope: {}\n };\n return directive;\n };\n\n module.directive(\"tgLbFeedback\", [\"lightboxService\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"tgFeedbackService\", FeedbackDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/integrations.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaIntegrations\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaIssues\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/kanban.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaKanban\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/projects.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaProject\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/related-tasks.coffee\n */\n\n(function() {\n var RelatedTaskAssignedToInlineEditionDirective, RelatedTaskCreateButtonDirective, RelatedTaskCreateFormDirective, RelatedTaskRowDirective, RelatedTasksDirective, debounce, module, taiga, trim;\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaRelatedTasks\", []);\n\n RelatedTaskRowDirective = function($repo, $compile, $confirm, $rootscope, $loading, $template, $translate) {\n var link, templateEdit, templateView;\n templateView = $template.get(\"task/related-task-row.html\", true);\n templateEdit = $template.get(\"task/related-task-row-edit.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var renderEdit, renderView, saveTask;\n saveTask = debounce(2000, function(task) {\n var currentLoading, promise;\n task.subject = $el.find('input').val();\n currentLoading = $loading().target($el.find('.task-name')).start();\n promise = $repo.save(task);\n promise.then((function(_this) {\n return function() {\n currentLoading.finish();\n return $rootscope.$broadcast(\"related-tasks:update\");\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n currentLoading.finish();\n $el.find('input').val(task.subject);\n return $confirm.notify(\"error\");\n };\n })(this));\n return promise;\n });\n renderEdit = function(task) {\n $el.html($compile(templateEdit({\n task: task\n }))($scope));\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return saveTask($model.$modelValue).then(function() {\n return renderView($model.$modelValue);\n });\n } else if (event.keyCode === 27) {\n return renderView($model.$modelValue);\n }\n });\n $el.on(\"click\", \".save-task\", function(event) {\n return saveTask($model.$modelValue).then(function() {\n return renderView($model.$modelValue);\n });\n });\n return $el.on(\"click\", \".cancel-edit\", function(event) {\n return renderView($model.$modelValue);\n });\n };\n renderView = function(task) {\n var perms;\n $el.off();\n perms = {\n modify_task: $scope.project.my_permissions.indexOf(\"modify_task\") !== -1,\n delete_task: $scope.project.my_permissions.indexOf(\"delete_task\") !== -1\n };\n $el.html($compile(templateView({\n task: task,\n perms: perms\n }))($scope));\n $el.on(\"click\", \".edit-task\", function() {\n renderEdit($model.$modelValue);\n return $el.find('input').focus().select();\n });\n return $el.on(\"click\", \".delete-task\", function(event) {\n var message, title;\n title = $translate.instant(\"TASK.TITLE_DELETE_ACTION\");\n task = $model.$modelValue;\n message = task.subject;\n return $confirm.askOnDelete(title, message).then(function(askResponse) {\n var promise;\n promise = $repo.remove(task);\n promise.then(function() {\n askResponse.finish();\n return $scope.$emit(\"related-tasks:delete\");\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n });\n });\n };\n $scope.$watch($attrs.ngModel, function(val) {\n if (!val) {\n return;\n }\n return renderView(val);\n });\n $scope.$on(\"related-tasks:assigned-to-changed\", function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n $scope.$on(\"related-tasks:status-changed\", function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgRelatedTaskRow\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$rootScope\", \"$tgLoading\", \"$tgTemplate\", \"$translate\", RelatedTaskRowDirective]);\n\n RelatedTaskCreateFormDirective = function($repo, $compile, $confirm, $tgmodel, $loading, $analytics, $template) {\n var link, newTask, template;\n template = $template.get(\"task/related-task-create-form.html\", true);\n newTask = {\n subject: \"\",\n assigned_to: null\n };\n link = function($scope, $el, $attrs) {\n var close, createTask, render;\n createTask = debounce(2000, function(task) {\n var currentLoading, promise;\n task.subject = $el.find('input').val();\n task.assigned_to = $scope.newTask.assigned_to;\n task.status = $scope.newTask.status;\n $scope.newTask.status = $scope.project.default_task_status;\n $scope.newTask.assigned_to = null;\n currentLoading = $loading().target($el.find('.task-name')).start();\n promise = $repo.create(\"tasks\", task);\n promise.then(function() {\n $analytics.trackEvent(\"task\", \"create\", \"create task on userstory\", 1);\n currentLoading.finish();\n return $scope.$emit(\"related-tasks:add\");\n });\n promise.then(null, function() {\n $el.find('input').val(task.subject);\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n return promise;\n });\n close = function() {\n $el.off();\n $el.html(\"\");\n return $scope.newRelatedTaskFormOpen = false;\n };\n render = function() {\n $scope.newRelatedTaskFormOpen = true;\n $el.html($compile(template())($scope));\n $el.find('input').focus().select();\n $el.addClass('active');\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return createTask(newTask).then(function() {\n return render();\n });\n } else if (event.keyCode === 27) {\n return $scope.$apply(function() {\n return close();\n });\n }\n });\n $el.on(\"click\", \".icon-close\", function(event) {\n return $scope.$apply(function() {\n return close();\n });\n });\n return $el.on(\"click\", \".icon-save\", function(event) {\n return createTask(newTask).then(function() {\n return close();\n });\n });\n };\n taiga.bindOnce($scope, \"us\", function(val) {\n newTask[\"status\"] = $scope.project.default_task_status;\n newTask[\"project\"] = $scope.project.id;\n newTask[\"user_story\"] = $scope.us.id;\n $scope.newTask = $tgmodel.make_model(\"tasks\", newTask);\n return $el.html(\"\");\n });\n $scope.$on(\"related-tasks:show-form\", function() {\n return render();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskCreateForm\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgLoading\", \"$tgAnalytics\", \"$tgTemplate\", RelatedTaskCreateFormDirective]);\n\n RelatedTaskCreateButtonDirective = function($repo, $compile, $confirm, $tgmodel, $template) {\n var link, template;\n template = $template.get(\"common/components/add-button.html\", true);\n link = function($scope, $el, $attrs) {\n $scope.$watch(\"project\", function(val) {\n if (!val) {\n return;\n }\n $el.off();\n if ($scope.project.my_permissions.indexOf(\"add_task\") !== -1) {\n $el.html($compile(template())($scope));\n } else {\n $el.html(\"\");\n }\n return $el.on(\"click\", \".add-button\", function(event) {\n return $scope.$emit(\"related-tasks:add-new-clicked\");\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskCreateButton\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgTemplate\", RelatedTaskCreateButtonDirective]);\n\n RelatedTasksDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var _isEditable, _isVisible, loadTasks;\n loadTasks = function() {\n return $rs.tasks.list($scope.projectId, null, $scope.usId).then((function(_this) {\n return function(tasks) {\n $scope.tasks = _.sortBy(tasks, 'ref');\n return tasks;\n };\n })(this));\n };\n _isVisible = function() {\n if ($scope.project) {\n return $scope.project.my_permissions.indexOf(\"view_tasks\") !== -1;\n }\n return false;\n };\n _isEditable = function() {\n if ($scope.project) {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n }\n return false;\n };\n $scope.showRelatedTasks = function() {\n var ref;\n return _isVisible() && (_isEditable() || ((ref = $scope.tasks) != null ? ref.length : void 0));\n };\n $scope.$on(\"related-tasks:add\", function() {\n return loadTasks().then(function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n });\n $scope.$on(\"related-tasks:delete\", function() {\n return loadTasks().then(function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n });\n $scope.$on(\"related-tasks:add-new-clicked\", function() {\n return $scope.$broadcast(\"related-tasks:show-form\");\n });\n taiga.bindOnce($scope, \"us\", function(val) {\n return loadTasks();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTasks\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", RelatedTasksDirective]);\n\n RelatedTaskAssignedToInlineEditionDirective = function($repo, $rootscope, $translate) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task, updateRelatedTask;\n updateRelatedTask = function(task) {\n var ctx, member;\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\"\n };\n member = $scope.usersById[task.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name_display;\n }\n $el.find(\".avatar\").html(template(ctx));\n return $el.find(\".task-assignedto\").attr('title', ctx.name);\n };\n $ctrl = $el.controller();\n task = $scope.$eval($attrs.tgRelatedTaskAssignedToInlineEdition);\n notAutoSave = $scope.$eval($attrs.notAutoSave);\n autoSave = !notAutoSave;\n updateRelatedTask(task);\n $el.on(\"click\", \".task-assignedto\", function(event) {\n return $rootscope.$broadcast(\"assigned-to:add\", task);\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_task\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"assigned-to:added\", debounce(2000, (function(_this) {\n return function(ctx, userId, updatedRelatedTask) {\n if (updatedRelatedTask.id === task.id) {\n updatedRelatedTask.assigned_to = userId;\n if (autoSave) {\n $repo.save(updatedRelatedTask).then(function() {\n return $scope.$emit(\"related-tasks:assigned-to-changed\");\n });\n }\n return updateRelatedTask(updatedRelatedTask);\n }\n };\n })(this)));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskAssignedToInlineEdition\", [\"$tgRepo\", \"$rootScope\", \"$translate\", RelatedTaskAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources.coffee\n */\n\n(function() {\n var ResourcesService, initResources, initUrls, module, taiga, urls,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n ResourcesService = (function(superClass) {\n extend(ResourcesService, superClass);\n\n function ResourcesService() {\n return ResourcesService.__super__.constructor.apply(this, arguments);\n }\n\n return ResourcesService;\n\n })(taiga.Service);\n\n urls = {\n \"auth\": \"/auth\",\n \"auth-register\": \"/auth/register\",\n \"invitations\": \"/invitations\",\n \"users\": \"/users\",\n \"by_username\": \"/users/by_username\",\n \"users-password-recovery\": \"/users/password_recovery\",\n \"users-change-password-from-recovery\": \"/users/change_password_from_recovery\",\n \"users-change-password\": \"/users/change_password\",\n \"users-change-email\": \"/users/change_email\",\n \"users-cancel-account\": \"/users/cancel\",\n \"user-stats\": \"/users/%s/stats\",\n \"user-liked\": \"/users/%s/liked\",\n \"user-voted\": \"/users/%s/voted\",\n \"user-watched\": \"/users/%s/watched\",\n \"user-contacts\": \"/users/%s/contacts\",\n \"user-me\": \"/users/me\",\n \"permissions\": \"/permissions\",\n \"notify-policies\": \"/notify-policies\",\n \"user-storage\": \"/user-storage\",\n \"memberships\": \"/memberships\",\n \"bulk-create-memberships\": \"/memberships/bulk_create\",\n \"roles\": \"/roles\",\n \"permissions\": \"/permissions\",\n \"resolver\": \"/resolver\",\n \"projects\": \"/projects\",\n \"project-templates\": \"/project-templates\",\n \"project-modules\": \"/projects/%s/modules\",\n \"bulk-update-projects-order\": \"/projects/bulk_update_order\",\n \"project-like\": \"/projects/%s/like\",\n \"project-unlike\": \"/projects/%s/unlike\",\n \"project-watch\": \"/projects/%s/watch\",\n \"project-unwatch\": \"/projects/%s/unwatch\",\n \"project-transfer-validate-token\": \"/projects/%s/transfer_validate_token\",\n \"project-transfer-accept\": \"/projects/%s/transfer_accept\",\n \"project-transfer-reject\": \"/projects/%s/transfer_reject\",\n \"project-transfer-request\": \"/projects/%s/transfer_request\",\n \"project-transfer-start\": \"/projects/%s/transfer_start\",\n \"userstory-statuses\": \"/userstory-statuses\",\n \"points\": \"/points\",\n \"task-statuses\": \"/task-statuses\",\n \"issue-statuses\": \"/issue-statuses\",\n \"issue-types\": \"/issue-types\",\n \"priorities\": \"/priorities\",\n \"severities\": \"/severities\",\n \"milestones\": \"/milestones\",\n \"userstories\": \"/userstories\",\n \"bulk-create-us\": \"/userstories/bulk_create\",\n \"bulk-update-us-backlog-order\": \"/userstories/bulk_update_backlog_order\",\n \"bulk-update-us-sprint-order\": \"/userstories/bulk_update_sprint_order\",\n \"bulk-update-us-kanban-order\": \"/userstories/bulk_update_kanban_order\",\n \"userstories-filters\": \"/userstories/filters_data\",\n \"userstory-upvote\": \"/userstories/%s/upvote\",\n \"userstory-downvote\": \"/userstories/%s/downvote\",\n \"userstory-watch\": \"/userstories/%s/watch\",\n \"userstory-unwatch\": \"/userstories/%s/unwatch\",\n \"tasks\": \"/tasks\",\n \"bulk-create-tasks\": \"/tasks/bulk_create\",\n \"bulk-update-task-taskboard-order\": \"/tasks/bulk_update_taskboard_order\",\n \"task-upvote\": \"/tasks/%s/upvote\",\n \"task-downvote\": \"/tasks/%s/downvote\",\n \"task-watch\": \"/tasks/%s/watch\",\n \"task-unwatch\": \"/tasks/%s/unwatch\",\n \"issues\": \"/issues\",\n \"bulk-create-issues\": \"/issues/bulk_create\",\n \"issues-filters\": \"/issues/filters_data\",\n \"issue-upvote\": \"/issues/%s/upvote\",\n \"issue-downvote\": \"/issues/%s/downvote\",\n \"issue-watch\": \"/issues/%s/watch\",\n \"issue-unwatch\": \"/issues/%s/unwatch\",\n \"wiki\": \"/wiki\",\n \"wiki-restore\": \"/wiki/%s/restore\",\n \"wiki-links\": \"/wiki-links\",\n \"history/us\": \"/history/userstory\",\n \"history/issue\": \"/history/issue\",\n \"history/task\": \"/history/task\",\n \"history/wiki\": \"/history/wiki\",\n \"attachments/us\": \"/userstories/attachments\",\n \"attachments/issue\": \"/issues/attachments\",\n \"attachments/task\": \"/tasks/attachments\",\n \"attachments/wiki_page\": \"/wiki/attachments\",\n \"custom-attributes/userstory\": \"/userstory-custom-attributes\",\n \"custom-attributes/issue\": \"/issue-custom-attributes\",\n \"custom-attributes/task\": \"/task-custom-attributes\",\n \"custom-attributes-values/userstory\": \"/userstories/custom-attributes-values\",\n \"custom-attributes-values/issue\": \"/issues/custom-attributes-values\",\n \"custom-attributes-values/task\": \"/tasks/custom-attributes-values\",\n \"webhooks\": \"/webhooks\",\n \"webhooks-test\": \"/webhooks/%s/test\",\n \"webhooklogs\": \"/webhooklogs\",\n \"webhooklogs-resend\": \"/webhooklogs/%s/resend\",\n \"userstories-csv\": \"/userstories/csv?uuid=%s\",\n \"tasks-csv\": \"/tasks/csv?uuid=%s\",\n \"issues-csv\": \"/issues/csv?uuid=%s\",\n \"timeline-profile\": \"/timeline/profile\",\n \"timeline-user\": \"/timeline/user\",\n \"timeline-project\": \"/timeline/project\",\n \"search\": \"/search\",\n \"exporter\": \"/exporter\",\n \"importer\": \"/importer/load_dump\",\n \"feedback\": \"/feedback\",\n \"locales\": \"/locales\",\n \"applications\": \"/applications\",\n \"application-tokens\": \"/application-tokens\",\n \"stats-discover\": \"/stats/discover\"\n };\n\n initUrls = function($log, $urls) {\n $log.debug(\"Initialize api urls\");\n return $urls.update(urls);\n };\n\n initResources = function($log, $rs) {\n var i, len, provider, providers, results;\n $log.debug(\"Initialize resources\");\n providers = _.toArray(arguments).slice(2);\n results = [];\n for (i = 0, len = providers.length; i < len; i++) {\n provider = providers[i];\n results.push(provider($rs));\n }\n return results;\n };\n\n module = angular.module(\"taigaResources\", [\"taigaBase\"]);\n\n module.service(\"$tgResources\", ResourcesService);\n\n module.run([\"$log\", \"$tgUrls\", initUrls]);\n\n module.run([\"$log\", \"$tgResources\", \"$tgProjectsResourcesProvider\", \"$tgCustomAttributesResourcesProvider\", \"$tgCustomAttributesValuesResourcesProvider\", \"$tgMembershipsResourcesProvider\", \"$tgNotifyPoliciesResourcesProvider\", \"$tgInvitationsResourcesProvider\", \"$tgRolesResourcesProvider\", \"$tgUserSettingsResourcesProvider\", \"$tgSprintsResourcesProvider\", \"$tgUserstoriesResourcesProvider\", \"$tgTasksResourcesProvider\", \"$tgIssuesResourcesProvider\", \"$tgWikiResourcesProvider\", \"$tgSearchResourcesProvider\", \"$tgMdRenderResourcesProvider\", \"$tgHistoryResourcesProvider\", \"$tgKanbanResourcesProvider\", \"$tgModulesResourcesProvider\", \"$tgWebhooksResourcesProvider\", \"$tgWebhookLogsResourcesProvider\", \"$tgLocalesResourcesProvider\", \"$tgUsersResourcesProvider\", initResources]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/search.coffee\n */\n\n(function() {\n var SearchBoxDirective, SearchController, SearchDirective, bindOnce, debounce, debounceLeading, groupBy, mixOf, module, taiga, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n mixOf = this.taiga.mixOf;\n\n debounceLeading = this.taiga.debounceLeading;\n\n trim = this.taiga.trim;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaSearch\", []);\n\n SearchController = (function(superClass) {\n extend(SearchController, superClass);\n\n SearchController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$translate\"];\n\n function SearchController(scope1, repo, rs, params, q, location, appMetaService, navUrls, translate) {\n var loadSearchData, promise;\n this.scope = scope1;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.translate = translate;\n this.scope.sectionName = \"Search\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"SEARCH.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"SEARCH.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.searchTerm = null;\n loadSearchData = debounceLeading(100, (function(_this) {\n return function(t) {\n return _this.loadSearchData(t);\n };\n })(this));\n bindOnce(this.scope, \"projectId\", (function(_this) {\n return function(projectId) {\n if (!_this.scope.searchResults && _this.scope.searchTerm) {\n return _this.loadSearchData();\n }\n };\n })(this));\n this.scope.$watch(\"searchTerm\", (function(_this) {\n return function(term) {\n if (term !== void 0 && _this.scope.projectId) {\n return _this.loadSearchData(term);\n }\n };\n })(this));\n }\n\n SearchController.prototype.loadFilters = function() {\n var defered;\n defered = this.q.defer();\n defered.resolve();\n return defered.promise;\n };\n\n SearchController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issueStatusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.taskStatusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n SearchController.prototype.loadSearchData = function(term) {\n if (term == null) {\n term = \"\";\n }\n this.scope.loading = true;\n return this._loadSearchData(term).then((function(_this) {\n return function(data) {\n _this.scope.searchResults = data;\n return _this.scope.loading = false;\n };\n })(this));\n };\n\n SearchController.prototype._loadSearchData = function(term) {\n if (term == null) {\n term = \"\";\n }\n if (this._promise) {\n this._promise.abort();\n }\n this._promise = this.rs.search[\"do\"](this.scope.projectId, term);\n return this._promise;\n };\n\n SearchController.prototype.loadInitialData = function() {\n return this.loadProject().then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n return _this.fillUsersAndRoles(project.members, project.roles);\n };\n })(this));\n };\n\n return SearchController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"SearchController\", SearchController);\n\n SearchBoxDirective = function(projectService, $lightboxService, $navurls, $location, $route) {\n var link;\n link = function($scope, $el, $attrs) {\n var openLightbox, project, submit;\n project = null;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, text, url;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n text = $el.find(\"#search-text\").val();\n url = $navurls.resolve(\"project-search\", {\n project: project.get(\"slug\")\n });\n return $scope.$apply(function() {\n $lightboxService.close($el);\n $location.path(url);\n $location.search(\"text\", text).path(url);\n return $route.reload();\n });\n };\n })(this));\n openLightbox = function() {\n project = projectService.project;\n return $lightboxService.open($el).then(function() {\n return $el.find(\"#search-text\").focus();\n });\n };\n $el.on(\"submit\", \"form\", submit);\n return openLightbox();\n };\n return {\n templateUrl: \"search/lightbox-search.html\",\n link: link\n };\n };\n\n SearchBoxDirective.$inject = [\"tgProjectService\", \"lightboxService\", \"$tgNavUrls\", \"$tgLocation\", \"$route\"];\n\n module.directive(\"tgSearchBox\", SearchBoxDirective);\n\n SearchDirective = function($log, $compile, $templatecache, $routeparams, $location) {\n var link, linkTable;\n linkTable = function($scope, $el, $attrs, $ctrl) {\n var activeSectionName, applyAutoTab, getActiveSection, lastSearchResults, markSectionTabActive, renderFilterTabs, renderTableContent, tabsDom, templates;\n applyAutoTab = true;\n activeSectionName = \"userstories\";\n tabsDom = $el.find(\".search-filter\");\n lastSearchResults = null;\n getActiveSection = function(data) {\n var i, len, maxVal, name, ref, selectedSection, value;\n maxVal = 0;\n selectedSection = {};\n selectedSection.name = \"userstories\";\n selectedSection.value = [];\n if (!applyAutoTab) {\n selectedSection.name = activeSectionName;\n selectedSection.value = data[activeSectionName];\n return selectedSection;\n }\n if (data) {\n ref = [\"userstories\", \"issues\", \"tasks\", \"wikipages\"];\n for (i = 0, len = ref.length; i < len; i++) {\n name = ref[i];\n value = data[name];\n if (value.length > maxVal) {\n maxVal = value.length;\n selectedSection.name = name;\n selectedSection.value = value;\n break;\n }\n }\n }\n if (maxVal === 0) {\n return selectedSection;\n }\n return selectedSection;\n };\n renderFilterTabs = function(data) {\n var name, results, value;\n results = [];\n for (name in data) {\n value = data[name];\n tabsDom.find(\"li.\" + name).show();\n results.push(tabsDom.find(\"li.\" + name + \" .num\").html(value.length));\n }\n return results;\n };\n markSectionTabActive = function(section) {\n tabsDom.find(\"a.active\").removeClass(\"active\");\n tabsDom.find(\"li.\" + section.name + \" a\").addClass(\"active\");\n applyAutoTab = false;\n return activeSectionName = section.name;\n };\n templates = {\n issues: $templatecache.get(\"search-issues\"),\n tasks: $templatecache.get(\"search-tasks\"),\n userstories: $templatecache.get(\"search-userstories\"),\n wikipages: $templatecache.get(\"search-wikipages\")\n };\n renderTableContent = function(section) {\n var element, oldElements, oldScope, scope, template;\n oldElements = $el.find(\".search-result-table\").children();\n oldScope = oldElements.scope();\n if (oldScope) {\n oldScope.$destroy();\n oldElements.remove();\n }\n scope = $scope.$new();\n scope[section.name] = section.value;\n template = angular.element.parseHTML(trim(templates[section.name]));\n element = $compile(template)(scope);\n return $el.find(\".search-result-table\").html(element);\n };\n $scope.$watch(\"searchResults\", function(data) {\n var activeSection;\n lastSearchResults = data;\n if (!lastSearchResults) {\n return;\n }\n activeSection = getActiveSection(data);\n renderFilterTabs(data);\n renderTableContent(activeSection);\n return markSectionTabActive(activeSection);\n });\n $scope.$watch(\"searchTerm\", function(searchTerm) {\n if (searchTerm !== void 0) {\n return $location.search(\"text\", searchTerm);\n }\n });\n return $el.on(\"click\", \".search-filter li > a\", function(event) {\n var section, sectionData, sectionName, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n sectionName = target.parent().data(\"name\");\n sectionData = !lastSearchResults ? [] : lastSearchResults[sectionName];\n section = {\n name: sectionName,\n value: sectionData\n };\n return $scope.$apply(function() {\n renderTableContent(section);\n return markSectionTabActive(section);\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, searchText;\n $ctrl = $el.controller();\n linkTable($scope, $el, $attrs, $ctrl);\n searchText = $routeparams.text;\n return $scope.$watch(\"projectId\", function(projectId) {\n if (projectId != null) {\n return $scope.searchTerm = searchText;\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSearch\", [\"$log\", \"$compile\", \"$templateCache\", \"$routeParams\", \"$tgLocation\", SearchDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTaskboard\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/tasks.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTasks\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/team.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTeam\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaUserSettings\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/userstories.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaUserStories\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/wiki.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaWiki\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/analytics.coffee\n */\n\n(function() {\n var AnalyticsService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n AnalyticsService = (function(superClass) {\n extend(AnalyticsService, superClass);\n\n AnalyticsService.$inject = [\"$rootScope\", \"$log\", \"$tgConfig\", \"$window\", \"$document\", \"$location\"];\n\n function AnalyticsService(rootscope, log, config, win, doc, location) {\n var conf;\n this.rootscope = rootscope;\n this.log = log;\n this.config = config;\n this.win = win;\n this.doc = doc;\n this.location = location;\n this.initialized = false;\n conf = this.config.get(\"analytics\", {});\n this.accountId = conf.accountId;\n this.pageEvent = conf.pageEvent || \"$routeChangeSuccess\";\n this.trackRoutes = conf.trackRoutes || true;\n this.ignoreFirstPageLoad = conf.ignoreFirstPageLoad || false;\n }\n\n AnalyticsService.prototype.initialize = function() {\n if (!this.accountId) {\n this.log.debug(\"Analytics: no acount id provided. Disabling.\");\n return;\n }\n this.injectAnalytics();\n this.win.ga(\"create\", this.accountId, \"auto\");\n this.win.ga(\"require\", \"displayfeatures\");\n if (this.trackRoutes && (!this.ignoreFirstPageLoad)) {\n this.win.ga(\"send\", \"pageview\", this.getUrl());\n }\n if (this.trackRoutes) {\n this.rootscope.$on(this.pageEvent, (function(_this) {\n return function() {\n return _this.trackPage(_this.getUrl(), \"Taiga\");\n };\n })(this));\n }\n return this.initialized = true;\n };\n\n AnalyticsService.prototype.getUrl = function() {\n return this.location.path();\n };\n\n AnalyticsService.prototype.injectAnalytics = function() {\n var fn;\n fn = (function(i,s,o,g,r,a,m){i[\"GoogleAnalyticsObject\"]=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments);},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);});\n return fn(window, document, \"script\", \"//www.google-analytics.com/analytics.js\", \"ga\");\n };\n\n AnalyticsService.prototype.trackPage = function(url, title) {\n if (!this.initialized) {\n return;\n }\n if (!this.win.ga) {\n return;\n }\n title = title || this.doc[0].title;\n return this.win.ga(\"send\", \"pageview\", {\n \"page\": url,\n \"title\": title\n });\n };\n\n AnalyticsService.prototype.trackEvent = function(category, action, label, value) {\n if (!this.initialized) {\n return;\n }\n if (!this.win.ga) {\n return;\n }\n return this.win.ga(\"send\", \"event\", category, action, label, value);\n };\n\n return AnalyticsService;\n\n })(taiga.Service);\n\n module.service(\"$tgAnalytics\", AnalyticsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: bind-scope.coffee\n */\n\n(function() {\n var BindScope, module;\n\n module = angular.module(\"taigaCommon\");\n\n BindScope = function(config) {\n var link;\n if (!config.debugInfo) {\n jQuery.fn.scope = function() {\n return this.data('scope');\n };\n }\n link = function($scope, $el) {\n if (!config.debugInfo) {\n return $el.data('scope', $scope).addClass('tg-scope');\n }\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBindScope\", [\"$tgConfig\", BindScope]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: compile-html.directive.coffee\n */\n\n(function() {\n var CompileHtmlDirective;\n\n CompileHtmlDirective = function($compile) {\n var link;\n link = function(scope, element, attrs) {\n return scope.$watch(attrs.tgCompileHtml, function(newValue, oldValue) {\n element.html(newValue);\n return $compile(element.contents())(scope);\n });\n };\n return {\n link: link\n };\n };\n\n CompileHtmlDirective.$inject = [\"$compile\"];\n\n angular.module(\"taigaCommon\").directive(\"tgCompileHtml\", CompileHtmlDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/components.coffee\n */\n\n(function() {\n var AssignedToDirective, BlockButtonDirective, CreatedByDisplayDirective, DateRangeDirective, DateSelectorDirective, DeleteButtonDirective, EditableDescriptionDirective, EditableSubjectDirective, EditableWysiwyg, ListItemAssignedtoDirective, ListItemIssueStatusDirective, ListItemPriorityDirective, ListItemSeverityDirective, ListItemTaskStatusDirective, ListItemTypeDirective, ListItemUsStatusDirective, SprintProgressBarDirective, TgMainTitleDirective, TgProgressBarDirective, WatchersDirective, bindOnce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n DateRangeDirective = function($translate) {\n var link, renderRange;\n renderRange = function($el, first, second) {\n var endDate, initDate, prettyDate;\n prettyDate = $translate.instant(\"BACKLOG.SPRINTS.DATE\");\n initDate = moment(first).format(prettyDate);\n endDate = moment(second).format(prettyDate);\n return $el.html(initDate + \"-\" + endDate);\n };\n link = function($scope, $el, $attrs) {\n var first, ref, second;\n ref = $attrs.tgDateRange.split(\",\"), first = ref[0], second = ref[1];\n return bindOnce($scope, first, function(valFirst) {\n return bindOnce($scope, second, function(valSecond) {\n return renderRange($el, valFirst, valSecond);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgDateRange\", [\"$translate\", DateRangeDirective]);\n\n DateSelectorDirective = function($rootscope, datePickerConfigService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var initialize, selectedDate, unbind;\n selectedDate = null;\n initialize = function() {\n var datePickerConfig;\n datePickerConfig = datePickerConfigService.get();\n _.merge(datePickerConfig, {\n field: $el[0],\n onSelect: (function(_this) {\n return function(date) {\n return selectedDate = date;\n };\n })(this),\n onOpen: (function(_this) {\n return function() {\n if (selectedDate != null) {\n return $el.picker.setDate(selectedDate);\n }\n };\n })(this)\n });\n return $el.picker = new Pikaday(datePickerConfig);\n };\n unbind = $rootscope.$on(\"$translateChangeEnd\", (function(_this) {\n return function(ctx) {\n return initialize();\n };\n })(this));\n $scope.$watch($attrs.ngModel, function(val) {\n if ((val != null) && !$el.picker) {\n initialize();\n }\n if (val != null) {\n return $el.picker.setDate(val);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n $el.off();\n return unbind();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgDateSelector\", [\"$rootScope\", \"tgDatePickerConfigService\", DateSelectorDirective]);\n\n SprintProgressBarDirective = function() {\n var link, renderProgress;\n renderProgress = function($el, percentage, visual_percentage) {\n if ($el.hasClass(\".current-progress\")) {\n return $el.css(\"width\", percentage + \"%\");\n } else {\n $el.find(\".current-progress\").css(\"width\", visual_percentage + \"%\");\n return $el.find(\".number\").html(percentage + \" %\");\n }\n };\n link = function($scope, $el, $attrs) {\n bindOnce($scope, $attrs.tgSprintProgressbar, function(sprint) {\n var closedPoints, percentage, totalPoints, visual_percentage;\n closedPoints = sprint.closed_points;\n totalPoints = sprint.total_points;\n percentage = 0;\n if (totalPoints !== 0) {\n percentage = Math.round(100 * (closedPoints / totalPoints));\n }\n visual_percentage = 0;\n if (totalPoints !== 0) {\n visual_percentage = Math.round(98 * (closedPoints / totalPoints));\n }\n return renderProgress($el, percentage, visual_percentage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintProgressbar\", SprintProgressBarDirective);\n\n CreatedByDisplayDirective = function($template, $compile, $translate, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, $attrs.ngModel, function(model) {\n var ref;\n if (model != null) {\n $scope.owner = model.owner_extra_info || {\n full_name_display: $translate.instant(\"COMMON.EXTERNAL_USER\"),\n photo: \"/\" + window._version + \"/images/user-noimage.png\"\n };\n $scope.url = ((ref = $scope.owner) != null ? ref.is_active : void 0) ? $navUrls.resolve(\"user-profile\", {\n username: $scope.owner.username\n }) : \"\";\n return $scope.date = moment(model.created_date).format($translate.instant(\"COMMON.DATETIME\"));\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n scope: true,\n templateUrl: \"common/components/created-by.html\"\n };\n };\n\n module.directive(\"tgCreatedByDisplay\", [\"$tgTemplate\", \"$compile\", \"$translate\", \"$tgNavUrls\", CreatedByDisplayDirective]);\n\n WatchersDirective = function($rootscope, $confirm, $repo, $qqueue, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"common/components/watchers.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var deleteWatcher, isEditable, renderWatchers, save;\n isEditable = function() {\n var ref, ref1;\n return ((ref = $scope.project) != null ? (ref1 = ref.my_permissions) != null ? ref1.indexOf($attrs.requiredPerm) : void 0 : void 0) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(watchers) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watchers;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n watchers = _.map(watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n $model.$modelValue.revert();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n deleteWatcher = $qqueue.bindAdd((function(_this) {\n return function(watcherIds) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watcherIds;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n var watchers;\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n item.revert();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n renderWatchers = function(watchers) {\n var ctx, html;\n ctx = {\n watchers: watchers,\n isEditable: isEditable()\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n $el.on(\"click\", \".js-delete-watcher\", function(event) {\n var message, target, title, watcherId;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n watcherId = target.data(\"watcher-id\");\n title = $translate.instant(\"COMMON.WATCHERS.TITLE_LIGHTBOX_DELETE_WARTCHER\");\n message = $scope.usersById[watcherId].full_name_display;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var watcherIds;\n askResponse.finish();\n watcherIds = _.clone($model.$modelValue.watchers, false);\n watcherIds = _.pull(watcherIds, watcherId);\n return deleteWatcher(watcherIds);\n };\n })(this));\n });\n $scope.$on(\"watcher:added\", function(ctx, watcherId) {\n var watchers;\n watchers = _.clone($model.$modelValue.watchers, false);\n watchers.push(watcherId);\n watchers = _.uniq(watchers);\n return save(watchers);\n });\n $scope.$watch($attrs.ngModel, function(item) {\n var watchers;\n if (item == null) {\n return;\n }\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n return renderWatchers(watchers);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgWatchers\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", \"$translate\", WatchersDirective]);\n\n AssignedToDirective = function($rootscope, $confirm, $repo, $loading, $qqueue, $template, $translate, $compile, $currentUserService) {\n var link, template;\n template = $template.get(\"common/components/assigned-to.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, renderAssignedTo, save;\n isEditable = function() {\n var ref, ref1;\n return ((ref = $scope.project) != null ? (ref1 = ref.my_permissions) != null ? ref1.indexOf($attrs.requiredPerm) : void 0 : void 0) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(userId) {\n var currentLoading, promise;\n $model.$modelValue.assigned_to = userId;\n currentLoading = $loading().target($el).start();\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n currentLoading.finish();\n renderAssignedTo($model.$modelValue);\n return $rootscope.$broadcast(\"object:updated\");\n });\n promise.then(null, function() {\n $model.$modelValue.revert();\n $confirm.notify(\"error\");\n return currentLoading.finish();\n });\n return promise;\n };\n })(this));\n renderAssignedTo = function(assignedObject) {\n var ctx, fullName, html, isIocaine, isUnassigned, photo;\n if ((assignedObject != null ? assignedObject.assigned_to : void 0) != null) {\n fullName = assignedObject.assigned_to_extra_info.full_name_display;\n photo = assignedObject.assigned_to_extra_info.photo;\n isUnassigned = false;\n } else {\n fullName = $translate.instant(\"COMMON.ASSIGNED_TO.ASSIGN\");\n photo = \"/\" + window._version + \"/images/unnamed.png\";\n isUnassigned = true;\n }\n isIocaine = assignedObject != null ? assignedObject.is_iocaine : void 0;\n ctx = {\n fullName: fullName,\n photo: photo,\n isUnassigned: isUnassigned,\n isEditable: isEditable(),\n isIocaine: isIocaine,\n fullNameVisible: !(isUnassigned && !$currentUserService.isAuthenticated())\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n $el.on(\"click\", \".user-assigned\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"assigned-to:add\", $model.$modelValue);\n });\n });\n $el.on(\"click\", \".assign-to-me\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n $model.$modelValue.assigned_to = $currentUserService.getUser().get('id');\n return save($currentUserService.getUser().get('id'));\n });\n $el.on(\"click\", \".remove-user\", function(event) {\n var title;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n title = $translate.instant(\"COMMON.ASSIGNED_TO.CONFIRM_UNASSIGNED\");\n return $confirm.ask(title).then((function(_this) {\n return function(response) {\n response.finish();\n $model.$modelValue.assigned_to = null;\n return save(null);\n };\n })(this));\n });\n $scope.$on(\"assigned-to:added\", function(ctx, userId, item) {\n if (item.id !== $model.$modelValue.id) {\n return;\n }\n return save(userId);\n });\n $scope.$watch($attrs.ngModel, function(instance) {\n return renderAssignedTo(instance);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgAssignedTo\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$translate\", \"$compile\", \"tgCurrentUserService\", AssignedToDirective]);\n\n BlockButtonDirective = function($rootscope, $loading, $template) {\n var link, template;\n template = $template.get(\"common/components/block-button.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n $scope.$watch($attrs.ngModel, function(item) {\n if (!item) {\n return;\n }\n if (isEditable()) {\n $el.find('.item-block').addClass('editable');\n }\n if (item.is_blocked) {\n $el.find('.item-block').removeClass('is-active');\n return $el.find('.item-unblock').addClass('is-active');\n } else {\n $el.find('.item-block').addClass('is-active');\n return $el.find('.item-unblock').removeClass('is-active');\n }\n });\n $el.on(\"click\", \".item-block\", function(event) {\n event.preventDefault();\n return $rootscope.$broadcast(\"block\", $model.$modelValue);\n });\n $el.on(\"click\", \".item-unblock\", function(event) {\n var currentLoading, finish;\n event.preventDefault();\n currentLoading = $loading().target($el.find(\".item-unblock\")).start();\n finish = function() {\n return currentLoading.finish();\n };\n return $rootscope.$broadcast(\"unblock\", $model.$modelValue, finish);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgBlockButton\", [\"$rootScope\", \"$tgLoading\", \"$tgTemplate\", BlockButtonDirective]);\n\n DeleteButtonDirective = function($log, $repo, $confirm, $location, $template) {\n var link, template;\n template = $template.get(\"common/components/delete-button.html\");\n link = function($scope, $el, $attrs, $model) {\n if (!$attrs.onDeleteGoToUrl) {\n return $log.error(\"DeleteButtonDirective requires on-delete-go-to-url set in scope.\");\n }\n if (!$attrs.onDeleteTitle) {\n return $log.error(\"DeleteButtonDirective requires on-delete-title set in scope.\");\n }\n $el.on(\"click\", \".button-delete\", function(event) {\n var subtitle, title;\n title = $attrs.onDeleteTitle;\n subtitle = $model.$modelValue.subject;\n return $confirm.askOnDelete(title, subtitle).then((function(_this) {\n return function(askResponse) {\n var promise;\n promise = $repo.remove($model.$modelValue);\n promise.then(function() {\n var url;\n askResponse.finish();\n url = $scope.$eval($attrs.onDeleteGoToUrl);\n return $location.path(url);\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgDeleteButton\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"$tgTemplate\", DeleteButtonDirective]);\n\n EditableSubjectDirective = function($rootscope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"common/components/editable-subject.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, save;\n $scope.$on(\"object:updated\", function() {\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n });\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(subject) {\n var currentLoading, promise;\n $model.$modelValue.subject = subject;\n currentLoading = $loading().target($el.find('.save-container')).start();\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n return promise;\n };\n })(this));\n $el.click(function() {\n if (!isEditable()) {\n return;\n }\n $el.find('.edit-subject').show();\n $el.find('.view-subject').hide();\n return $el.find('input').focus();\n });\n $el.on(\"click\", \".save\", function(e) {\n var subject;\n e.preventDefault();\n subject = $scope.item.subject;\n return save(subject);\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var subject;\n if (event.keyCode === 13) {\n subject = $scope.item.subject;\n return save(subject);\n } else if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n }\n });\n $el.find('.edit-subject').hide();\n $scope.$watch($attrs.ngModel, function(value) {\n if (!value) {\n return;\n }\n $scope.item = value;\n if (!isEditable()) {\n return $el.find('.view-subject .edit').remove();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgEditableSubject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", EditableSubjectDirective]);\n\n EditableDescriptionDirective = function($rootscope, $repo, $confirm, $compile, $loading, $selectedText, $qqueue, $template) {\n var link, noDescriptionMegEditMode, noDescriptionMegReadMode, template;\n template = $template.get(\"common/components/editable-description.html\");\n noDescriptionMegEditMode = $template.get(\"common/components/editable-description-msg-edit-mode.html\");\n noDescriptionMegReadMode = $template.get(\"common/components/editable-description-msg-read-mode.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, save;\n $el.find('.edit-description').hide();\n $el.find('.view-description .edit').hide();\n $scope.$on(\"object:updated\", function() {\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(description) {\n var currentLoading, promise;\n $model.$modelValue.description = description;\n currentLoading = $loading().target($el.find('.save-container')).start();\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n };\n })(this));\n $el.on(\"mouseup\", \".view-description\", function(event) {\n var target;\n target = angular.element(event.target);\n if (!isEditable()) {\n return;\n }\n if (target.is('a')) {\n return;\n }\n if ($selectedText.get().length) {\n return;\n }\n $el.find('.edit-description').show();\n $el.find('.view-description').hide();\n return $el.find('textarea').focus();\n });\n $el.on(\"click\", \"a\", function(event) {\n var href, target;\n target = angular.element(event.target);\n href = target.attr('href');\n if (href.indexOf(\"#\") === 0) {\n event.preventDefault();\n return $('body').scrollTop($(href).offset().top);\n }\n });\n $el.on(\"click\", \".save\", function(e) {\n var description;\n e.preventDefault();\n description = $scope.item.description;\n return save(description);\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $scope.item.revert();\n };\n })(this));\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n }\n });\n $scope.$watch($attrs.ngModel, function(value) {\n if (!value) {\n return;\n }\n $scope.item = value;\n if (isEditable()) {\n $el.find('.view-description .edit').show();\n $el.find('.view-description .us-content').addClass('editable');\n return $scope.noDescriptionMsg = $compile(noDescriptionMegEditMode)($scope);\n } else {\n return $scope.noDescriptionMsg = $compile(noDescriptionMegReadMode)($scope);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgEditableDescription\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$compile\", \"$tgLoading\", \"$selectedText\", \"$tgQqueue\", \"$tgTemplate\", EditableDescriptionDirective]);\n\n EditableWysiwyg = function(attachmentsService, attachmentsFullService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var isInEditMode, uploadFile;\n isInEditMode = function() {\n return $el.find('textarea').is(':visible');\n };\n uploadFile = function(file, type) {\n if (!attachmentsService.validate(file)) {\n return;\n }\n return attachmentsFullService.addAttachment($model.$modelValue.project, $model.$modelValue.id, type, file).then(function(result) {\n if (taiga.isImage(result.getIn(['file', 'name']))) {\n return '![' + result.getIn(['file', 'name']) + '](' + result.getIn(['file', 'url']) + ')';\n } else {\n return '[' + result.getIn(['file', 'name']) + '](' + result.getIn(['file', 'url']) + ')';\n }\n });\n };\n $el.on('dragover', function(e) {\n var textarea;\n textarea = $el.find('textarea').focus();\n return false;\n });\n return $el.on('drop', function(e) {\n var dataTransfer, promises, textarea, type;\n e.stopPropagation();\n e.preventDefault();\n if (isInEditMode()) {\n dataTransfer = e.dataTransfer || (e.originalEvent && e.originalEvent.dataTransfer);\n textarea = $el.find('textarea');\n textarea.addClass('in-progress');\n type = $model.$modelValue['_name'];\n if (type === \"userstories\") {\n type = \"us\";\n } else if (type === \"tasks\") {\n type = \"task\";\n } else if (type === \"issues\") {\n type = \"issue\";\n } else if (type === \"wiki\") {\n type = \"wiki_page\";\n }\n promises = _.map(dataTransfer.files, function(file) {\n return uploadFile(file, type);\n });\n return Promise.all(promises).then(function(result) {\n textarea = $el.find('textarea');\n $.markItUp({\n replaceWith: result.join(' ')\n });\n return textarea.removeClass('in-progress');\n });\n }\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgEditableWysiwyg\", [\"tgAttachmentsService\", \"tgAttachmentsFullService\", EditableWysiwyg]);\n\n ListItemUsStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var us;\n us = $scope.$eval($attrs.tgListitemUsStatus);\n return bindOnce($scope, \"usStatusById\", function(usStatusById) {\n return $el.html(usStatusById[us.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemUsStatus\", ListItemUsStatusDirective);\n\n ListItemTaskStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var task;\n task = $scope.$eval($attrs.tgListitemTaskStatus);\n return bindOnce($scope, \"taskStatusById\", function(taskStatusById) {\n return $el.html(taskStatusById[task.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemTaskStatus\", ListItemTaskStatusDirective);\n\n ListItemAssignedtoDirective = function($template, $translate) {\n var link, template;\n template = $template.get(\"common/components/list-item-assigned-to-avatar.html\", true);\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, \"usersById\", function(usersById) {\n var ctx, item, member;\n item = $scope.$eval($attrs.tgListitemAssignedto);\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\"\n };\n member = usersById[item.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name_display;\n }\n return $el.html(template(ctx));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemAssignedto\", [\"$tgTemplate\", \"$translate\", ListItemAssignedtoDirective]);\n\n ListItemIssueStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemIssueStatus);\n return bindOnce($scope, \"issueStatusById\", function(issueStatusById) {\n return $el.html(issueStatusById[issue.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemIssueStatus\", ListItemIssueStatusDirective);\n\n ListItemTypeDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(issueTypeById, issue) {\n var domNode, type;\n type = issueTypeById[issue.type];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", type.color);\n return domNode.attr(\"title\", type.name);\n };\n bindOnce($scope, \"issueTypeById\", function(issueTypeById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemType);\n return render(issueTypeById, issue);\n });\n return $scope.$watch($attrs.tgListitemType, function(issue) {\n return render($scope.issueTypeById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemType\", ListItemTypeDirective);\n\n ListItemPriorityDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(priorityById, issue) {\n var domNode, priority;\n priority = priorityById[issue.priority];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", priority.color);\n return domNode.attr(\"title\", priority.name);\n };\n bindOnce($scope, \"priorityById\", function(priorityById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemPriority);\n return render(priorityById, issue);\n });\n return $scope.$watch($attrs.tgListitemPriority, function(issue) {\n return render($scope.priorityById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemPriority\", ListItemPriorityDirective);\n\n ListItemSeverityDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(severityById, issue) {\n var domNode, severity;\n severity = severityById[issue.severity];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", severity.color);\n return domNode.attr(\"title\", severity.name);\n };\n bindOnce($scope, \"severityById\", function(severityById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemSeverity);\n return render(severityById, issue);\n });\n return $scope.$watch($attrs.tgListitemSeverity, function(issue) {\n return render($scope.severityById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemSeverity\", ListItemSeverityDirective);\n\n TgProgressBarDirective = function($template) {\n var link, render, template;\n template = $template.get(\"common/components/progress-bar.html\", true);\n render = function(el, percentage) {\n return el.html(template({\n percentage: percentage\n }));\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch($attrs.tgProgressBar, function(percentage) {\n percentage = _.max([0, percentage]);\n percentage = _.min([100, percentage]);\n return render($el, percentage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProgressBar\", [\"$tgTemplate\", TgProgressBarDirective]);\n\n TgMainTitleDirective = function($translate) {\n var link;\n link = function($scope, $el, $attrs) {\n $attrs.$observe(\"i18nSectionName\", function(i18nSectionName) {\n return $scope.sectionName = i18nSectionName;\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/main-title.html\",\n scope: {\n projectName: \"=projectName\"\n }\n };\n };\n\n module.directive(\"tgMainTitle\", [\"$translate\", TgMainTitleDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/confirm.coffee\n */\n\n(function() {\n var ConfirmService, NOTIFICATION_MSG, bindMethods, cancelTimeout, debounce, module, taiga, timeout,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n timeout = this.taiga.timeout;\n\n cancelTimeout = this.taiga.cancelTimeout;\n\n debounce = this.taiga.debounce;\n\n bindMethods = this.taiga.bindMethods;\n\n NOTIFICATION_MSG = {\n \"success\": {\n title: \"NOTIFICATION.OK\",\n message: \"NOTIFICATION.SAVED\"\n },\n \"error\": {\n title: \"NOTIFICATION.WARNING\",\n message: \"NOTIFICATION.WARNING_TEXT\"\n },\n \"light-error\": {\n title: \"NOTIFICATION.WARNING\",\n message: \"NOTIFICATION.WARNING_TEXT\"\n }\n };\n\n ConfirmService = (function(superClass) {\n extend(ConfirmService, superClass);\n\n ConfirmService.$inject = [\"$q\", \"lightboxService\", \"$tgLoading\", \"$translate\"];\n\n function ConfirmService(q, lightboxService, loading, translate) {\n this.q = q;\n this.lightboxService = lightboxService;\n this.loading = loading;\n this.translate = translate;\n bindMethods(this);\n }\n\n ConfirmService.prototype.hide = function(el) {\n if (el) {\n this.lightboxService.close(el);\n return el.off(\".confirm-dialog\");\n }\n };\n\n ConfirmService.prototype.ask = function(title, subtitle, message, lightboxSelector) {\n var defered, el;\n if (lightboxSelector == null) {\n lightboxSelector = \".lightbox-generic-ask\";\n }\n defered = this.q.defer();\n el = angular.element(lightboxSelector);\n el.find(\".title\").text(title);\n el.find(\".subtitle\").text(subtitle);\n el.find(\".message\").text(message);\n el.on(\"click.confirm-dialog\", \".button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n currentLoading = _this.loading().target(target).start();\n return defered.resolve({\n finish: function(ok) {\n if (ok == null) {\n ok = true;\n }\n currentLoading.finish();\n if (ok) {\n return _this.hide(el);\n }\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \".button-red\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.reject();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.askOnDelete = function(title, message) {\n return this.ask(title, this.translate.instant(\"NOTIFICATION.ASK_DELETE\"), message);\n };\n\n ConfirmService.prototype.askChoice = function(title, subtitle, choices, replacement, warning, lightboxSelector) {\n var choicesField, defered, el;\n if (lightboxSelector == null) {\n lightboxSelector = \".lightbox-ask-choice\";\n }\n defered = this.q.defer();\n el = angular.element(lightboxSelector);\n el.find(\".title\").text(title);\n el.find(\".subtitle\").text(subtitle);\n if (replacement) {\n el.find(\".replacement\").text(replacement);\n } else {\n el.find(\".replacement\").remove();\n }\n if (warning) {\n el.find(\".warning\").text(warning);\n } else {\n el.find(\".warning\").remove();\n }\n choicesField = el.find(\".choices\");\n choicesField.html('');\n _.each(choices, function(value, key) {\n value = _.escape(value);\n return choicesField.append(angular.element(\"\"));\n });\n el.on(\"click.confirm-dialog\", \"a.button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n currentLoading = _this.loading().target(target).start();\n return defered.resolve({\n selected: choicesField.val(),\n finish: function(ok) {\n if (ok == null) {\n ok = true;\n }\n currentLoading.finish();\n if (ok) {\n return _this.hide(el);\n }\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \".button-red\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.reject();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.error = function(message) {\n var defered, el;\n defered = this.q.defer();\n el = angular.element(\".lightbox-generic-error\");\n el.find(\".title\").html(message);\n el.on(\"click.confirm-dialog\", \".button-green\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n el.on(\"click.confirm-dialog\", \".close\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.success = function(title, message, icon) {\n var defered, detailImage, el, useSVG;\n defered = this.q.defer();\n el = angular.element(\".lightbox-generic-success\");\n el.find(\"img\").remove();\n el.find(\"svg\").remove();\n if (icon) {\n if (icon.type === \"img\") {\n detailImage = $('').addClass('lb-icon').attr('src', icon.name);\n } else if (icon.type === \"svg\") {\n useSVG = document.createElementNS('http://www.w3.org/2000/svg', 'use');\n useSVG.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + icon.name);\n detailImage = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n detailImage.classList.add(\"icon\");\n detailImage.classList.add(\"lb-icon\");\n detailImage.classList.add(icon.name);\n detailImage.appendChild(useSVG);\n }\n if (detailImage) {\n el.find('section').prepend(detailImage);\n }\n }\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n el.on(\"click.confirm-dialog\", \".button-green\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n el.on(\"click.confirm-dialog\", \".close\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.loader = function(title, message) {\n var el;\n el = angular.element(\".lightbox-generic-loading\");\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n return {\n start: (function(_this) {\n return function() {\n return _this.lightboxService.open(el);\n };\n })(this),\n stop: (function(_this) {\n return function() {\n return _this.lightboxService.close(el);\n };\n })(this),\n update: (function(_this) {\n return function(status, title, message, percent) {\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n if (percent) {\n el.find(\".spin\").addClass(\"hidden\");\n el.find(\".progress-bar-wrapper\").removeClass(\"hidden\");\n el.find(\".progress-bar-wrapper > .bar\").width(percent + '%');\n return el.find(\".progress-bar-wrapper > span\").html(percent + '%').css('left', (percent - 9) + '%');\n } else {\n el.find(\".spin\").removeClass(\"hidden\");\n return el.find(\".progress-bar-wrapper\").addClass(\"hidden\");\n }\n };\n })(this)\n };\n };\n\n ConfirmService.prototype.notify = function(type, message, title, time) {\n var body, el, selector;\n selector = \".notification-message-\" + type;\n el = angular.element(selector);\n if (el.hasClass(\"active\")) {\n return;\n }\n if (title) {\n el.find(\"h4\").html(title);\n } else {\n el.find(\"h4\").html(this.translate.instant(NOTIFICATION_MSG[type].title));\n }\n if (message) {\n el.find(\"p\").html(message);\n } else {\n el.find(\"p\").html(this.translate.instant(NOTIFICATION_MSG[type].message));\n }\n body = angular.element(\"body\");\n body.find(\".notification-message .notification-light\").removeClass('active').addClass('inactive');\n body.find(selector).removeClass('inactive').addClass('active');\n if (this.tsem) {\n cancelTimeout(this.tsem);\n }\n if (!time) {\n time = type === 'error' || type === 'light-error' ? 3500 : 1500;\n }\n this.tsem = timeout(time, (function(_this) {\n return function() {\n body.find(selector).removeClass('active').addClass('inactive').one('animationend', function() {\n return $(this).removeClass('inactive');\n });\n return delete _this.tsem;\n };\n })(this));\n return el.on(\"click\", \".icon-close, .close\", (function(_this) {\n return function(event) {\n return body.find(selector).removeClass('active').addClass('inactive');\n };\n })(this));\n };\n\n return ConfirmService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaCommon\");\n\n module.service(\"$tgConfirm\", ConfirmService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/custom-field-values.coffee\n */\n\n(function() {\n var CustomAttributeValueDirective, CustomAttributesValuesController, CustomAttributesValuesDirective, DATE_TYPE, MULTILINE_TYPE, TEXT_TYPE, TYPE_CHOICES, URL_TYPE, bindMethods, bindOnce, debounce, generateHash, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n bindMethods = this.taiga.bindMethods;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n generateHash = taiga.generateHash;\n\n module = angular.module(\"taigaCommon\");\n\n TEXT_TYPE = \"text\";\n\n MULTILINE_TYPE = \"multiline\";\n\n DATE_TYPE = \"date\";\n\n URL_TYPE = \"url\";\n\n TYPE_CHOICES = [\n {\n key: TEXT_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT\"\n }, {\n key: MULTILINE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI\"\n }, {\n key: DATE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE\"\n }, {\n key: URL_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL\"\n }\n ];\n\n CustomAttributesValuesController = (function(superClass) {\n extend(CustomAttributesValuesController, superClass);\n\n CustomAttributesValuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$q\"];\n\n function CustomAttributesValuesController(scope, rootscope, repo, rs, confirm, q) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.rs = rs;\n this.confirm = confirm;\n this.q = q;\n bindMethods(this);\n this.type = null;\n this.objectId = null;\n this.projectId = null;\n this.customAttributes = [];\n this.customAttributesValues = null;\n }\n\n CustomAttributesValuesController.prototype.initialize = function(type, objectId) {\n this.project = this.scope.project;\n this.type = type;\n this.objectId = objectId;\n return this.projectId = this.scope.projectId;\n };\n\n CustomAttributesValuesController.prototype.loadCustomAttributesValues = function() {\n if (!this.objectId) {\n return this.customAttributesValues;\n }\n return this.rs.customAttributesValues[this.type].get(this.objectId).then((function(_this) {\n return function(customAttributesValues) {\n _this.customAttributes = _this.project[_this.type + \"_custom_attributes\"];\n _this.customAttributesValues = customAttributesValues;\n return customAttributesValues;\n };\n })(this));\n };\n\n CustomAttributesValuesController.prototype.getAttributeValue = function(attribute) {\n var attributeValue;\n attributeValue = _.clone(attribute, false);\n attributeValue.value = this.customAttributesValues.attributes_values[attribute.id];\n return attributeValue;\n };\n\n CustomAttributesValuesController.prototype.updateAttributeValue = function(attributeValue) {\n var attributesValues, onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"custom-attributes-values:edit\");\n };\n })(this);\n onError = (function(_this) {\n return function(response) {\n _this.confirm.notify(\"error\");\n return _this.q.reject();\n };\n })(this);\n attributesValues = _.clone(this.customAttributesValues.attributes_values, true);\n attributesValues[attributeValue.id] = attributeValue.value;\n this.customAttributesValues.attributes_values = attributesValues;\n this.customAttributesValues.id = this.objectId;\n return this.repo.save(this.customAttributesValues).then(onSuccess, onError);\n };\n\n return CustomAttributesValuesController;\n\n })(taiga.Controller);\n\n CustomAttributesValuesDirective = function($templates, $storage) {\n var collapsedHash, link, template, templateFn;\n template = $templates.get(\"custom-attributes/custom-attributes-values.html\", true);\n collapsedHash = function(type) {\n return generateHash([\"custom-attributes-collapsed\", type]);\n };\n link = function($scope, $el, $attrs, $ctrls) {\n var $ctrl, $model;\n $ctrl = $ctrls[0];\n $model = $ctrls[1];\n bindOnce($scope, $attrs.ngModel, function(value) {\n $ctrl.initialize($attrs.type, value.id);\n return $ctrl.loadCustomAttributesValues();\n });\n $el.on(\"click\", \".custom-fields-header .icon\", function() {\n var collapsed, hash;\n hash = collapsedHash($attrs.type);\n collapsed = !($storage.get(hash) || false);\n $storage.set(hash, collapsed);\n if (collapsed) {\n $el.find(\".custom-fields-header .icon\").removeClass(\"open\");\n return $el.find(\".custom-fields-body\").removeClass(\"open\");\n } else {\n $el.find(\".custom-fields-header .icon\").addClass(\"open\");\n return $el.find(\".custom-fields-body\").addClass(\"open\");\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n templateFn = function($el, $attrs) {\n var collapsed;\n collapsed = $storage.get(collapsedHash($attrs.type)) || false;\n return template({\n requiredEditionPerm: $attrs.requiredEditionPerm,\n collapsed: collapsed\n });\n };\n return {\n require: [\"tgCustomAttributesValues\", \"ngModel\"],\n controller: CustomAttributesValuesController,\n controllerAs: \"ctrl\",\n restrict: \"AE\",\n scope: true,\n link: link,\n template: templateFn\n };\n };\n\n module.directive(\"tgCustomAttributesValues\", [\"$tgTemplate\", \"$tgStorage\", \"$translate\", CustomAttributesValuesDirective]);\n\n CustomAttributeValueDirective = function($template, $selectedText, $compile, $translate, datePickerConfigService) {\n var link, template, templateEdit;\n template = $template.get(\"custom-attributes/custom-attribute-value.html\", true);\n templateEdit = $template.get(\"custom-attributes/custom-attribute-value-edit.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var attributeValue, isEditable, prettyDate, render, setFocusAndSelectOnInputField, submit;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n render = function(attributeValue, edit) {\n var ctx, datePickerConfig, editable, html, value;\n if (edit == null) {\n edit = false;\n }\n if (attributeValue.type === DATE_TYPE && attributeValue.value) {\n value = moment(attributeValue.value, \"YYYY-MM-DD\").format(prettyDate);\n } else {\n value = attributeValue.value;\n }\n editable = isEditable();\n ctx = {\n id: attributeValue.id,\n name: attributeValue.name,\n description: attributeValue.description,\n value: value,\n isEditable: editable,\n type: attributeValue.type\n };\n if (editable && (edit || !value)) {\n html = templateEdit(ctx);\n html = $compile(html)($scope);\n $el.html(html);\n if (attributeValue.type === DATE_TYPE) {\n datePickerConfig = datePickerConfigService.get();\n _.merge(datePickerConfig, {\n field: $el.find(\"input[name=value]\")[0],\n onSelect: (function(_this) {\n return function(date) {\n var selectedDate;\n return selectedDate = date;\n };\n })(this),\n onOpen: (function(_this) {\n return function() {\n if (typeof selectedDate !== \"undefined\" && selectedDate !== null) {\n return $el.picker.setDate(selectedDate);\n }\n };\n })(this)\n });\n return $el.picker = new Pikaday(datePickerConfig);\n }\n } else {\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n }\n };\n isEditable = function() {\n var permissions, requiredEditionPerm;\n permissions = $scope.project.my_permissions;\n requiredEditionPerm = $attrs.requiredEditionPerm;\n return permissions.indexOf(requiredEditionPerm) > -1;\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, input;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n input = $el.find(\"input[name=value], textarea[name='value']\");\n attributeValue.value = input.val();\n if (attributeValue.type === DATE_TYPE) {\n if (moment(attributeValue.value, prettyDate).isValid()) {\n attributeValue.value = moment(attributeValue.value, prettyDate).format(\"YYYY-MM-DD\");\n }\n }\n return $scope.$apply(function() {\n return $ctrl.updateAttributeValue(attributeValue).then(function() {\n return render(attributeValue, false);\n });\n });\n };\n })(this));\n setFocusAndSelectOnInputField = function() {\n return $el.find(\"input[name='value'], textarea[name='value']\").focus().select();\n };\n attributeValue = $scope.$eval($attrs.tgCustomAttributeValue);\n render(attributeValue);\n $el.on(\"click\", \".js-value-view-mode span a\", function(event) {\n return event.stopPropagation();\n });\n $el.on(\"click\", \".js-value-view-mode\", function() {\n if (!isEditable()) {\n return;\n }\n if ($selectedText.get().length) {\n return;\n }\n render(attributeValue, true);\n return setFocusAndSelectOnInputField();\n });\n $el.on(\"click\", \".js-edit-description\", function(event) {\n event.preventDefault();\n render(attributeValue, true);\n return setFocusAndSelectOnInputField();\n });\n $el.on(\"keyup\", \"input[name=value], textarea[name='value']\", function(event) {\n if (event.keyCode === 13 && event.currentTarget.type !== \"textarea\") {\n return submit(event);\n } else if (event.keyCode === 27) {\n return render(attributeValue, false);\n }\n });\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".js-save-description\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"^tgCustomAttributesValues\",\n restrict: \"AE\"\n };\n };\n\n module.directive(\"tgCustomAttributeValue\", [\"$tgTemplate\", \"$selectedText\", \"$compile\", \"$translate\", \"tgDatePickerConfigService\", CustomAttributeValueDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/estimation.coffee\n */\n\n(function() {\n var EstimationsService, LbUsEstimationDirective, UsEstimationDirective, groupBy, module, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaCommon\");\n\n LbUsEstimationDirective = function($tgEstimationsService, $rootScope, $repo, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $scope.$watch($attrs.ngModel, function(us) {\n var estimationProcess;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n estimationProcess.onSelectedPointForRole = function(roleId, pointId) {\n return $scope.$apply(function() {\n return $model.$setViewValue(us);\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, template;\n ctx = {\n totalPoints: this.calculateTotalPoints(),\n roles: this.calculateRoles(),\n editable: this.isEditable\n };\n mainTemplate = \"common/estimation/us-estimation-points-per-role.html\";\n template = $template.get(mainTemplate, true);\n html = template(ctx);\n html = $compile(html)($scope);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgLbUsEstimation\", [\"$tgEstimationsService\", \"$rootScope\", \"$tgRepo\", \"$tgTemplate\", \"$compile\", LbUsEstimationDirective]);\n\n UsEstimationDirective = function($tgEstimationsService, $rootScope, $repo, $qqueue, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $scope.$watch($attrs.ngModel, function(us) {\n var estimationProcess;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n estimationProcess.onSelectedPointForRole = function(roleId, pointId) {\n return this.save(roleId, pointId).then(function() {\n return $rootScope.$broadcast(\"object:updated\");\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, template;\n ctx = {\n totalPoints: this.calculateTotalPoints(),\n roles: this.calculateRoles(),\n editable: this.isEditable\n };\n mainTemplate = \"common/estimation/us-estimation-points-per-role.html\";\n template = $template.get(mainTemplate, true);\n html = template(ctx);\n html = $compile(html)($scope);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsEstimation\", [\"$tgEstimationsService\", \"$rootScope\", \"$tgRepo\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", UsEstimationDirective]);\n\n EstimationsService = function($template, $qqueue, $repo, $confirm, $q) {\n var EstimationProcess, create, pointsTemplate;\n pointsTemplate = $template.get(\"common/estimation/us-estimation-points.html\", true);\n EstimationProcess = (function() {\n function EstimationProcess($el1, us1, project1) {\n this.$el = $el1;\n this.us = us1;\n this.project = project1;\n this.bindClickEvents = bind(this.bindClickEvents, this);\n this.isEditable = this.project.my_permissions.indexOf(\"modify_us\") !== -1;\n this.roles = this.project.roles;\n this.points = this.project.points;\n this.pointsById = groupBy(this.points, function(x) {\n return x.id;\n });\n this.onSelectedPointForRole = function(roleId, pointId) {};\n this.render = function() {};\n }\n\n EstimationProcess.prototype.save = function(roleId, pointId) {\n var deferred;\n deferred = $q.defer();\n $qqueue.add((function(_this) {\n return function() {\n var onError, onSuccess;\n onSuccess = function() {\n return deferred.resolve();\n };\n onError = function() {\n $confirm.notify(\"error\");\n _this.us.revert();\n _this.render();\n return deferred.reject();\n };\n return $repo.save(_this.us).then(onSuccess, onError);\n };\n })(this));\n return deferred.promise;\n };\n\n EstimationProcess.prototype.calculateTotalPoints = function() {\n var notNullValues, values;\n values = _.map(this.us.points, (function(_this) {\n return function(v, k) {\n var ref;\n return (ref = _this.pointsById[v]) != null ? ref.value : void 0;\n };\n })(this));\n if (values.length === 0) {\n return \"?\";\n }\n notNullValues = _.filter(values, function(v) {\n return v != null;\n });\n if (notNullValues.length === 0) {\n return \"?\";\n }\n return _.reduce(notNullValues, function(acc, num) {\n return acc + num;\n });\n };\n\n EstimationProcess.prototype.calculateRoles = function() {\n var computableRoles, roles;\n computableRoles = _.filter(this.project.roles, \"computable\");\n roles = _.map(computableRoles, (function(_this) {\n return function(role) {\n var pointId, pointObj;\n pointId = _this.us.points[role.id];\n pointObj = _this.pointsById[pointId];\n role = _.clone(role, true);\n role.points = (pointObj != null) && (pointObj.name != null) ? pointObj.name : \"?\";\n return role;\n };\n })(this));\n return roles;\n };\n\n EstimationProcess.prototype.bindClickEvents = function() {\n this.$el.on(\"click\", \".total.clickable\", (function(_this) {\n return function(event) {\n var roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n _this.renderPointsSelector(roleId, target);\n target.siblings().removeClass('active');\n return target.addClass('active');\n };\n })(this));\n return this.$el.on(\"click\", \".point\", (function(_this) {\n return function(event) {\n var pointId, points, roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n pointId = target.data(\"point-id\");\n _this.$el.find(\".popover\").popover().close();\n points = _.clone(_this.us.points, true);\n points[roleId] = pointId;\n _this.us.points = points;\n _this.render();\n return _this.onSelectedPointForRole(roleId, pointId);\n };\n })(this));\n };\n\n EstimationProcess.prototype.renderPointsSelector = function(roleId, target) {\n var horizontalList, html, maxPointLength, points, pop;\n points = _.map(this.points, (function(_this) {\n return function(point) {\n point = _.clone(point, true);\n point.selected = _this.us.points[roleId] === point.id ? false : true;\n return point;\n };\n })(this));\n maxPointLength = 5;\n horizontalList = _.some(points, (function(_this) {\n return function(point) {\n return point.name.length > maxPointLength;\n };\n })(this));\n html = pointsTemplate({\n \"points\": points,\n roleId: roleId,\n horizontal: horizontalList\n });\n this.$el.find(\".popover\").popover().close();\n this.$el.find(\".pop-points-open\").remove();\n if (target != null) {\n this.$el.find(target).append(html);\n } else {\n this.$el.append(html);\n }\n this.$el.find(\".pop-points-open\").popover().open(function() {\n return $(this).removeClass(\"active\").closest(\"li\").removeClass(\"active\");\n });\n this.$el.find(\".pop-points-open\").show();\n pop = this.$el.find(\".pop-points-open\");\n if (pop.offset().top + pop.height() > document.body.clientHeight) {\n return pop.addClass('pop-bottom');\n }\n };\n\n return EstimationProcess;\n\n })();\n create = function($el, us, project) {\n var estimationProcess;\n $el.unbind(\"click\");\n estimationProcess = new EstimationProcess($el, us, project);\n if (estimationProcess.isEditable) {\n estimationProcess.bindClickEvents();\n }\n return estimationProcess;\n };\n return {\n create: create\n };\n };\n\n module.factory(\"$tgEstimationsService\", [\"$tgTemplate\", \"$tgQqueue\", \"$tgRepo\", \"$tgConfirm\", \"$q\", EstimationsService]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/filters.coffee\n */\n\n(function() {\n var defaultFilter, module, momentFormat, momentFromNow, sizeFormat, taiga, unslugify, yesNoFilter;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n defaultFilter = function() {\n return function(value, defaultValue) {\n if (value === [null, void 0]) {\n return defaultValue;\n }\n return value;\n };\n };\n\n module.filter(\"default\", defaultFilter);\n\n yesNoFilter = function($translate) {\n return function(value) {\n if (value) {\n return $translate.instant(\"COMMON.YES\");\n }\n return $translate.instant(\"COMMON.NO\");\n };\n };\n\n module.filter(\"yesNo\", [\"$translate\", yesNoFilter]);\n\n unslugify = function() {\n return taiga.unslugify;\n };\n\n module.filter(\"unslugify\", unslugify);\n\n momentFormat = function() {\n return function(input, format) {\n if (input) {\n return moment(input).format(format);\n }\n return \"\";\n };\n };\n\n module.filter(\"momentFormat\", momentFormat);\n\n momentFromNow = function() {\n return function(input, without_suffix) {\n if (input) {\n return moment(input).fromNow(without_suffix || false);\n }\n return \"\";\n };\n };\n\n module.filter(\"momentFromNow\", momentFromNow);\n\n sizeFormat = (function(_this) {\n return function() {\n return _this.taiga.sizeFormat;\n };\n })(this);\n\n module.filter(\"sizeFormat\", sizeFormat);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/history.coffee\n */\n\n(function() {\n var HistoryController, HistoryDirective, IGNORED_FIELDS, bindOnce, debounce, module, taiga, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n IGNORED_FIELDS = {\n \"userstories.userstory\": [\"watchers\", \"kanban_order\", \"backlog_order\", \"sprint_order\", \"finish_date\", \"tribe_gig\"],\n \"tasks.task\": [\"watchers\", \"us_order\", \"taskboard_order\"],\n \"issues.issue\": [\"watchers\"]\n };\n\n HistoryController = (function(superClass) {\n extend(HistoryController, superClass);\n\n HistoryController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\"];\n\n function HistoryController(scope, repo, rs) {\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n }\n\n HistoryController.prototype.initialize = function(type, objectId) {\n this.type = type;\n return this.objectId = objectId;\n };\n\n HistoryController.prototype.loadHistory = function(type, objectId) {\n return this.rs.history.get(type, objectId).then((function(_this) {\n return function(history) {\n var changeModel, historyEntry, historyResult, i, j, len, len1;\n for (i = 0, len = history.length; i < len; i++) {\n historyResult = history[i];\n if (historyResult.values_diff.description_diff != null) {\n historyResult.values_diff.description = historyResult.values_diff.description_diff;\n }\n delete historyResult.values_diff.description_html;\n delete historyResult.values_diff.description_diff;\n if (historyResult.values_diff.blocked_note_diff != null) {\n historyResult.values_diff.blocked_note = historyResult.values_diff.blocked_note_diff;\n }\n delete historyResult.values_diff.blocked_note_html;\n delete historyResult.values_diff.blocked_note_diff;\n }\n for (j = 0, len1 = history.length; j < len1; j++) {\n historyEntry = history[j];\n changeModel = historyEntry.key.split(\":\")[0];\n if (IGNORED_FIELDS[changeModel] != null) {\n historyEntry.values_diff = _.removeKeys(historyEntry.values_diff, IGNORED_FIELDS[changeModel]);\n }\n }\n _this.scope.history = _.filter(history, function(item) {\n return Object.keys(item.values_diff).length > 0;\n });\n return _this.scope.comments = _.filter(history, function(item) {\n return item.comment !== \"\";\n });\n };\n })(this));\n };\n\n HistoryController.prototype.deleteComment = function(type, objectId, activityId) {\n return this.rs.history.deleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n HistoryController.prototype.undeleteComment = function(type, objectId, activityId) {\n return this.rs.history.undeleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n return HistoryController;\n\n })(taiga.Controller);\n\n HistoryDirective = function($log, $loading, $qqueue, $template, $confirm, $translate, $compile, $navUrls, $rootScope, checkPermissionsService) {\n var link, templateActivity, templateBase, templateBaseEntries, templateChangeAttachment, templateChangeDiff, templateChangeGeneric, templateChangeList, templateChangePoints, templateDeletedComment;\n templateChangeDiff = $template.get(\"common/history/history-change-diff.html\", true);\n templateChangePoints = $template.get(\"common/history/history-change-points.html\", true);\n templateChangeGeneric = $template.get(\"common/history/history-change-generic.html\", true);\n templateChangeAttachment = $template.get(\"common/history/history-change-attachment.html\", true);\n templateChangeList = $template.get(\"common/history/history-change-list.html\", true);\n templateDeletedComment = $template.get(\"common/history/history-deleted-comment.html\", true);\n templateActivity = $template.get(\"common/history/history-activity.html\", true);\n templateBaseEntries = $template.get(\"common/history/history-base-entries.html\", true);\n templateBase = $template.get(\"common/history/history-base.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var countChanges, formatChange, getHumanizedFieldName, getPrettyDateFormat, objectId, renderActivity, renderAttachmentEntry, renderBase, renderChange, renderChangeEntries, renderChangeEntry, renderChangesHelperText, renderComment, renderComments, renderCustomAttributesEntry, renderHistory, rerender, save, showAllActivity, showAllComments, type;\n type = $attrs.type;\n objectId = null;\n showAllComments = false;\n showAllActivity = false;\n getPrettyDateFormat = function() {\n return $translate.instant(\"ACTIVITY.DATETIME\");\n };\n bindOnce($scope, $attrs.ngModel, function(model) {\n type = $attrs.type;\n objectId = model.id;\n $ctrl.initialize(type, objectId);\n return $ctrl.loadHistory(type, objectId);\n });\n getHumanizedFieldName = function(field) {\n var humanizedFieldNames;\n humanizedFieldNames = {\n subject: $translate.instant(\"ACTIVITY.FIELDS.SUBJECT\"),\n name: $translate.instant(\"ACTIVITY.FIELDS.NAME\"),\n description: $translate.instant(\"ACTIVITY.FIELDS.DESCRIPTION\"),\n content: $translate.instant(\"ACTIVITY.FIELDS.CONTENT\"),\n status: $translate.instant(\"ACTIVITY.FIELDS.STATUS\"),\n is_closed: $translate.instant(\"ACTIVITY.FIELDS.IS_CLOSED\"),\n finish_date: $translate.instant(\"ACTIVITY.FIELDS.FINISH_DATE\"),\n type: $translate.instant(\"ACTIVITY.FIELDS.TYPE\"),\n priority: $translate.instant(\"ACTIVITY.FIELDS.PRIORITY\"),\n severity: $translate.instant(\"ACTIVITY.FIELDS.SEVERITY\"),\n assigned_to: $translate.instant(\"ACTIVITY.FIELDS.ASSIGNED_TO\"),\n watchers: $translate.instant(\"ACTIVITY.FIELDS.WATCHERS\"),\n milestone: $translate.instant(\"ACTIVITY.FIELDS.MILESTONE\"),\n user_story: $translate.instant(\"ACTIVITY.FIELDS.USER_STORY\"),\n project: $translate.instant(\"ACTIVITY.FIELDS.PROJECT\"),\n is_blocked: $translate.instant(\"ACTIVITY.FIELDS.IS_BLOCKED\"),\n blocked_note: $translate.instant(\"ACTIVITY.FIELDS.BLOCKED_NOTE\"),\n points: $translate.instant(\"ACTIVITY.FIELDS.POINTS\"),\n client_requirement: $translate.instant(\"ACTIVITY.FIELDS.CLIENT_REQUIREMENT\"),\n team_requirement: $translate.instant(\"ACTIVITY.FIELDS.TEAM_REQUIREMENT\"),\n is_iocaine: $translate.instant(\"ACTIVITY.FIELDS.IS_IOCAINE\"),\n tags: $translate.instant(\"ACTIVITY.FIELDS.TAGS\"),\n attachments: $translate.instant(\"ACTIVITY.FIELDS.ATTACHMENTS\"),\n is_deprecated: $translate.instant(\"ACTIVITY.FIELDS.IS_DEPRECATED\"),\n blocked_note: $translate.instant(\"ACTIVITY.FIELDS.BLOCKED_NOTE\"),\n is_blocked: $translate.instant(\"ACTIVITY.FIELDS.IS_BLOCKED\"),\n order: $translate.instant(\"ACTIVITY.FIELDS.ORDER\"),\n backlog_order: $translate.instant(\"ACTIVITY.FIELDS.BACKLOG_ORDER\"),\n sprint_order: $translate.instant(\"ACTIVITY.FIELDS.SPRINT_ORDER\"),\n kanban_order: $translate.instant(\"ACTIVITY.FIELDS.KANBAN_ORDER\"),\n taskboard_order: $translate.instant(\"ACTIVITY.FIELDS.TASKBOARD_ORDER\"),\n us_order: $translate.instant(\"ACTIVITY.FIELDS.US_ORDER\")\n };\n return humanizedFieldNames[field] || field;\n };\n countChanges = function(comment) {\n return _.keys(comment.values_diff).length;\n };\n formatChange = function(change) {\n if (_.isArray(change)) {\n if (change.length === 0) {\n return $translate.instant(\"ACTIVITY.VALUES.EMPTY\");\n }\n return change.join(\", \");\n }\n if (change === \"\") {\n return $translate.instant(\"ACTIVITY.VALUES.EMPTY\");\n }\n if ((change == null) || change === false) {\n return $translate.instant(\"ACTIVITY.VALUES.NO\");\n }\n if (change === true) {\n return $translate.instant(\"ACTIVITY.VALUES.YES\");\n }\n return change;\n };\n renderAttachmentEntry = function(value) {\n var attachments;\n attachments = _.map(value, function(changes, type) {\n if (type === \"new\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: $translate.instant(\"ACTIVITY.NEW_ATTACHMENT\"),\n diff: change.filename\n });\n });\n } else if (type === \"deleted\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: $translate.instant(\"ACTIVITY.DELETED_ATTACHMENT\"),\n diff: change.filename\n });\n });\n } else {\n return _.map(changes, function(change) {\n var diff, name;\n name = $translate.instant(\"ACTIVITY.UPDATED_ATTACHMENT\", {\n filename: change.filename\n });\n diff = _.map(change.changes, function(values, name) {\n return {\n name: getHumanizedFieldName(name),\n from: formatChange(values[0]),\n to: formatChange(values[1])\n };\n });\n return templateChangeAttachment({\n name: name,\n diff: diff\n });\n });\n }\n });\n return _.flatten(attachments).join(\"\\n\");\n };\n renderCustomAttributesEntry = function(value) {\n var customAttributes;\n customAttributes = _.map(value, function(changes, type) {\n if (type === \"new\") {\n return _.map(changes, function(change) {\n var html;\n html = templateChangeGeneric({\n name: change.name,\n from: formatChange(\"\"),\n to: formatChange(change.value)\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n });\n } else if (type === \"deleted\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: $translate.instant(\"ACTIVITY.DELETED_CUSTOM_ATTRIBUTE\"),\n diff: change.name\n });\n });\n } else {\n return _.map(changes, function(change) {\n var customAttrsChanges;\n customAttrsChanges = _.map(change.changes, function(values) {\n return templateChangeGeneric({\n name: change.name,\n from: formatChange(values[0]),\n to: formatChange(values[1])\n });\n });\n return _.flatten(customAttrsChanges).join(\"\\n\");\n });\n }\n });\n return _.flatten(customAttributes).join(\"\\n\");\n };\n renderChangeEntry = function(field, value) {\n var added, from, html, name, removed, to;\n if (field === \"description\") {\n return templateChangeDiff({\n name: getHumanizedFieldName(\"description\"),\n diff: value[1]\n });\n } else if (field === \"blocked_note\") {\n return templateChangeDiff({\n name: getHumanizedFieldName(\"blocked_note\"),\n diff: value[1]\n });\n } else if (field === \"points\") {\n html = templateChangePoints({\n points: value\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n } else if (field === \"attachments\") {\n return renderAttachmentEntry(value);\n } else if (field === \"custom_attributes\") {\n return renderCustomAttributesEntry(value);\n } else if (field === \"tags\" || field === \"watchers\") {\n name = getHumanizedFieldName(field);\n removed = _.difference(value[0], value[1]);\n added = _.difference(value[1], value[0]);\n html = templateChangeList({\n name: name,\n removed: removed,\n added: added\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n } else if (field === \"assigned_to\") {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0] || $translate.instant(\"ACTIVITY.VALUES.UNASSIGNED\"));\n to = formatChange(value[1] || $translate.instant(\"ACTIVITY.VALUES.UNASSIGNED\"));\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n } else {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0]);\n to = formatChange(value[1]);\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n }\n };\n renderChangeEntries = function(change) {\n return _.map(change.values_diff, function(value, field) {\n return renderChangeEntry(field, value);\n });\n };\n renderChangesHelperText = function(change) {\n var size;\n size = countChanges(change);\n return $translate.instant(\"ACTIVITY.SIZE_CHANGE\", {\n size: size\n }, 'messageformat');\n };\n renderComment = function(comment) {\n var html, ref, ref1, ref2;\n if (comment.delete_comment_date || ((ref = comment.delete_comment_user) != null ? ref.name : void 0)) {\n html = templateDeletedComment({\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(getPrettyDateFormat()) : void 0,\n deleteCommentUser: comment.delete_comment_user.name,\n deleteComment: comment.comment_html,\n activityId: comment.id,\n canRestoreComment: $scope.user && (comment.delete_comment_user.pk === $scope.user.id || $scope.project.my_permissions.indexOf(\"modify_project\") > -1)\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n }\n html = templateActivity({\n avatar: comment.user.photo,\n userFullName: comment.user.name,\n userProfileUrl: comment.user.is_active ? $navUrls.resolve(\"user-profile\", {\n username: comment.user.username\n }) : \"\",\n creationDate: moment(comment.created_at).format(getPrettyDateFormat()),\n comment: comment.comment_html,\n changesText: renderChangesHelperText(comment),\n changes: renderChangeEntries(comment),\n mode: \"comment\",\n deleteCommentActionTitle: $translate.instant(\"COMMENTS.DELETE\"),\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(getPrettyDateFormat()) : void 0,\n deleteCommentUser: ((ref1 = comment.delete_comment_user) != null ? ref1.name : void 0) ? comment.delete_comment_user.name : void 0,\n activityId: comment.id,\n canDeleteComment: comment.user.pk === ((ref2 = $scope.user) != null ? ref2.id : void 0) || $scope.project.my_permissions.indexOf(\"modify_project\") > -1\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n };\n renderChange = function(change) {\n var ref;\n return templateActivity({\n avatar: change.user.photo,\n userFullName: change.user.name,\n userProfileUrl: change.user.is_active ? $navUrls.resolve(\"user-profile\", {\n username: change.user.username\n }) : \"\",\n creationDate: moment(change.created_at).format(getPrettyDateFormat()),\n comment: change.comment_html,\n changes: renderChangeEntries(change),\n changesText: \"\",\n mode: \"activity\",\n deleteCommentDate: change.delete_comment_date ? moment(change.delete_comment_date).format(getPrettyDateFormat()) : void 0,\n deleteCommentUser: ((ref = change.delete_comment_user) != null ? ref.name : void 0) ? change.delete_comment_user.name : void 0,\n activityId: change.id\n });\n };\n renderHistory = function(entries, totalEntries) {\n var html, showMore;\n if (entries.length === totalEntries) {\n showMore = 0;\n } else {\n showMore = totalEntries - entries.length;\n }\n html = templateBaseEntries({\n entries: entries,\n showMore: showMore\n });\n html = $compile(html)($scope);\n return html;\n };\n renderBase = function() {\n var changes, comments, commentsVisible, historyVisible, html;\n comments = $scope.comments || [];\n changes = $scope.history || [];\n historyVisible = !!changes.length;\n commentsVisible = (!!comments.length) || checkPermissionsService.check('modify_' + $attrs.type);\n html = templateBase({\n ngmodel: $attrs.ngModel,\n type: $attrs.type,\n mode: $attrs.mode,\n historyVisible: historyVisible,\n commentsVisible: commentsVisible\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n rerender = function() {\n renderBase();\n renderComments();\n return renderActivity();\n };\n renderComments = function() {\n var comments, html, totalComments;\n comments = $scope.comments || [];\n totalComments = comments.length;\n if (!showAllComments) {\n comments = _.takeRight(comments, 4);\n }\n comments = _.map(comments, function(x) {\n return renderComment(x);\n });\n html = renderHistory(comments, totalComments);\n return $el.find(\".comments-list\").html(html);\n };\n renderActivity = function() {\n var changes, html, totalChanges;\n changes = $scope.history || [];\n totalChanges = changes.length;\n if (!showAllActivity) {\n changes = _.takeRight(changes, 4);\n }\n changes = _.map(changes, function(x) {\n return renderChange(x);\n });\n html = renderHistory(changes, totalChanges);\n return $el.find(\".changes-list\").html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(target) {\n var currentLoading, model, onError, onSuccess;\n $scope.$broadcast(\"markdown-editor:submit\");\n $el.find(\".comment-list\").addClass(\"activeanimation\");\n currentLoading = $loading().target(target).start();\n onSuccess = function() {\n $rootScope.$broadcast(\"comment:new\");\n return $ctrl.loadHistory(type, objectId)[\"finally\"](function() {\n return currentLoading.finish();\n });\n };\n onError = function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n };\n model = $scope.$eval($attrs.ngModel);\n return $ctrl.repo.save(model).then(onSuccess, onError);\n };\n })(this));\n $scope.$watch(\"comments\", rerender);\n $scope.$watch(\"history\", rerender);\n $scope.$on(\"object:updated\", function() {\n return $ctrl.loadHistory(type, objectId);\n });\n $el.on(\"click\", \".add-comment button.button-green\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n }));\n $el.on(\"click\", \"a\", function(event) {\n var href, target;\n target = angular.element(event.target);\n href = target.attr('href');\n if (href && href.indexOf(\"#\") === 0) {\n event.preventDefault();\n return $('body').scrollTop($(href).offset().top);\n }\n });\n $el.on(\"click\", \".show-more\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.parent().is(\".changes-list\")) {\n showAllActivity = !showAllActivity;\n return renderActivity();\n } else {\n showAllComments = !showAllComments;\n return renderComments();\n }\n });\n $el.on(\"click\", \".show-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').show();\n target.parents('.activity-single').find('.show-deleted-comment').hide();\n return target.parents('.activity-single').find('.comment-body').show();\n });\n $el.on(\"click\", \".hide-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').hide();\n target.parents('.activity-single').find('.show-deleted-comment').show();\n return target.parents('.activity-single').find('.comment-body').hide();\n });\n $el.on(\"click\", \".changes-title\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return target.parent().find(\".change-entry\").toggleClass(\"active\");\n });\n $el.on(\"focus\", \".add-comment textarea\", function(event) {\n return $(this).addClass('active');\n });\n $el.on(\"click\", \".history-tabs li a\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n $el.find(\".history-tabs li a\").removeClass(\"active\");\n target.addClass(\"active\");\n $el.find(\".history section\").addClass(\"hidden\");\n return $el.find(\".history section.\" + (target.data('section-class'))).removeClass(\"hidden\");\n });\n $el.on(\"click\", \".comment-delete\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.deleteComment(type, objectId, activityId);\n }));\n $el.on(\"click\", \".comment-restore\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.undeleteComment(type, objectId, activityId);\n }));\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return renderBase();\n };\n return {\n controller: HistoryController,\n restrict: \"AE\",\n link: link\n };\n };\n\n module.directive(\"tgHistory\", [\"$log\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$tgConfirm\", \"$translate\", \"$compile\", \"$tgNavUrls\", \"$rootScope\", \"tgCheckPermissionsService\", HistoryDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/importer.coffee\n */\n\n(function() {\n var ImportProjectButtonDirective, LbImportErrorDirective, module;\n\n module = angular.module(\"taigaCommon\");\n\n ImportProjectButtonDirective = function($rs, $confirm, $location, $navUrls, $translate, $lightboxFactory, currentUserService, $tgAuth) {\n var link;\n link = function($scope, $el, $attrs) {\n var getRestrictionError;\n getRestrictionError = function(result) {\n var errorKey, maxMemberships, membersError, privateError, publicError, user;\n if (result.headers) {\n errorKey = '';\n user = currentUserService.getUser();\n maxMemberships = 0;\n if (result.headers.isPrivate) {\n privateError = !currentUserService.canCreatePrivateProjects().valid;\n maxMemberships = null;\n if (user.get('max_memberships_private_projects') !== null && result.headers.memberships >= user.get('max_memberships_private_projects')) {\n membersError = true;\n } else {\n membersError = false;\n }\n if (privateError && membersError) {\n errorKey = 'private-space-members';\n maxMemberships = user.get('max_memberships_private_projects');\n } else if (privateError) {\n errorKey = 'private-space';\n } else if (membersError) {\n errorKey = 'private-members';\n maxMemberships = user.get('max_memberships_private_projects');\n }\n } else {\n publicError = !currentUserService.canCreatePublicProjects().valid;\n if (user.get('max_memberships_public_projects') !== null && result.headers.memberships >= user.get('max_memberships_public_projects')) {\n membersError = true;\n } else {\n membersError = false;\n }\n if (publicError && membersError) {\n errorKey = 'public-space-members';\n maxMemberships = user.get('max_memberships_public_projects');\n } else if (publicError) {\n errorKey = 'public-space';\n } else if (membersError) {\n errorKey = 'public-members';\n maxMemberships = user.get('max_memberships_public_projects');\n }\n }\n return {\n key: errorKey,\n values: {\n max_memberships: maxMemberships,\n members: result.headers.memberships\n }\n };\n } else {\n return false;\n }\n };\n $el.on(\"click\", \".import-project-button\", function(event) {\n event.preventDefault();\n $el.find(\"input.import-file\").val(\"\");\n return $el.find(\"input.import-file\").trigger(\"click\");\n });\n return $el.on(\"change\", \"input.import-file\", function(event) {\n var file, loader, onError, onSuccess;\n event.preventDefault();\n file = event.target.files[0];\n if (!file) {\n return;\n }\n loader = $confirm.loader($translate.instant(\"PROJECT.IMPORT.UPLOADING_FILE\"));\n onSuccess = function(result) {\n return currentUserService.loadProjects().then(function() {\n var ctx, message, msg, title;\n loader.stop();\n if (result.status === 202) {\n title = $translate.instant(\"PROJECT.IMPORT.ASYNC_IN_PROGRESS_TITLE\");\n message = $translate.instant(\"PROJECT.IMPORT.ASYNC_IN_PROGRESS_MESSAGE\");\n return $confirm.success(title, message);\n } else {\n ctx = {\n project: result.data.slug\n };\n $location.path($navUrls.resolve(\"project-admin-project-profile-details\", ctx));\n msg = $translate.instant(\"PROJECT.IMPORT.SYNC_SUCCESS\");\n return $confirm.notify(\"success\", msg);\n }\n });\n };\n onError = function(result) {\n return $tgAuth.refresh().then(function() {\n var errorMsg, ref, restrictionError;\n restrictionError = getRestrictionError(result);\n loader.stop();\n if (restrictionError) {\n return $lightboxFactory.create('tg-lb-import-error', {\n \"class\": 'lightbox lightbox-import-error'\n }, restrictionError);\n } else {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR\");\n if (result.status === 429) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_TOO_MANY_REQUEST\");\n } else if ((ref = result.data) != null ? ref._error_message : void 0) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_MESSAGE\", {\n error_message: result.data._error_message\n });\n }\n return $confirm.notify(\"error\", errorMsg);\n }\n });\n };\n loader.start();\n return $rs.projects[\"import\"](file, loader.update).then(onSuccess, onError);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgImportProjectButton\", [\"$tgResources\", \"$tgConfirm\", \"$location\", \"$tgNavUrls\", \"$translate\", \"tgLightboxFactory\", \"tgCurrentUserService\", \"$tgAuth\", ImportProjectButtonDirective]);\n\n LbImportErrorDirective = function(lightboxService) {\n var link;\n link = function(scope, el, attrs) {\n lightboxService.open(el);\n return scope.close = function() {\n lightboxService.close(el);\n };\n };\n return {\n templateUrl: \"common/lightbox/lightbox-import-error.html\",\n link: link\n };\n };\n\n LbImportErrorDirective.$inject = [\"lightboxService\"];\n\n module.directive(\"tgLbImportError\", LbImportErrorDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/lightboxes.coffee\n */\n\n(function() {\n var AssignedToLightboxDirective, AttachmentPreviewLightboxDirective, BlockLightboxDirective, BlockingMessageInputDirective, CreateBulkUserstoriesDirective, CreateEditUserstoryDirective, LightboxDirective, LightboxKeyboardNavigationService, LightboxLeaveProjectWarningDirective, LightboxService, WatchersLightboxDirective, bindOnce, debounce, module, sizeFormat, timeout,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n module = angular.module(\"taigaCommon\");\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n sizeFormat = this.taiga.sizeFormat;\n\n LightboxService = (function(superClass) {\n extend(LightboxService, superClass);\n\n function LightboxService(animationFrame, q) {\n this.animationFrame = animationFrame;\n this.q = q;\n }\n\n LightboxService.prototype.open = function($el) {\n var defered, docEl, lightboxContent;\n if (_.isString($el)) {\n $el = $($el);\n }\n defered = this.q.defer();\n lightboxContent = $el.children().not(\".close\");\n lightboxContent.hide();\n this.animationFrame.add(function() {\n return $el.css('display', 'flex');\n });\n this.animationFrame.add(function() {\n $el.addClass(\"open\");\n return $el.one(\"transitionend\", (function(_this) {\n return function() {\n return $el.find('input,textarea').first().focus();\n };\n })(this));\n });\n this.animationFrame.add((function(_this) {\n return function() {\n lightboxContent.show();\n return defered.resolve();\n };\n })(this));\n docEl = angular.element(document);\n docEl.on(\"keydown.lightbox\", (function(_this) {\n return function(e) {\n var code;\n code = e.keyCode ? e.keyCode : e.which;\n if (code === 27) {\n return _this.close($el);\n }\n };\n })(this));\n return defered.promise;\n };\n\n LightboxService.prototype.close = function($el) {\n var docEl, scope;\n if (_.isString($el)) {\n $el = $($el);\n }\n docEl = angular.element(document);\n docEl.off(\".lightbox\");\n docEl.off(\".keyboard-navigation\");\n $el.one(\"transitionend\", (function(_this) {\n return function() {\n $el.removeAttr('style');\n return $el.removeClass(\"open\").removeClass('close');\n };\n })(this));\n this.animationFrame.add(function() {\n return $el.addClass('close');\n });\n if ($el.hasClass(\"remove-on-close\")) {\n scope = $el.data(\"scope\");\n scope.$destroy();\n return $el.remove();\n }\n };\n\n LightboxService.prototype.closeAll = function() {\n var docEl, i, len, lightboxEl, ref, results;\n docEl = angular.element(document);\n ref = docEl.find(\".lightbox.open\");\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n lightboxEl = ref[i];\n results.push(this.close($(lightboxEl)));\n }\n return results;\n };\n\n return LightboxService;\n\n })(taiga.Service);\n\n module.service(\"lightboxService\", [\"animationFrame\", \"$q\", LightboxService]);\n\n LightboxKeyboardNavigationService = (function(superClass) {\n extend(LightboxKeyboardNavigationService, superClass);\n\n function LightboxKeyboardNavigationService() {\n return LightboxKeyboardNavigationService.__super__.constructor.apply(this, arguments);\n }\n\n LightboxKeyboardNavigationService.prototype.stop = function() {\n var docEl;\n docEl = angular.element(document);\n return docEl.off(\".keyboard-navigation\");\n };\n\n LightboxKeyboardNavigationService.prototype.dispatch = function($el, code) {\n var activeElement, next, prev;\n activeElement = $el.find(\".selected\");\n if (code === 13) {\n if ($el.find(\".user-list-single\").length === 1) {\n return $el.find('.user-list-single:first').trigger(\"click\");\n } else {\n return activeElement.trigger(\"click\");\n }\n } else if (code === 40) {\n if (!activeElement.length) {\n return $el.find('.user-list-single:not(\".is-active\"):first').addClass('selected');\n } else {\n next = activeElement.next('.user-list-single');\n if (next.length) {\n activeElement.removeClass('selected');\n return next.addClass('selected');\n }\n }\n } else if (code === 38) {\n if (!activeElement.length) {\n return $el.find('.user-list-single:last').addClass('selected');\n } else {\n prev = activeElement.prev('.user-list-single:not(\".is-active\")');\n if (prev.length) {\n activeElement.removeClass('selected');\n return prev.addClass('selected');\n }\n }\n }\n };\n\n LightboxKeyboardNavigationService.prototype.init = function($el) {\n var docEl;\n this.stop();\n docEl = angular.element(document);\n return docEl.on(\"keydown.keyboard-navigation\", (function(_this) {\n return function(event) {\n var code;\n code = event.keyCode ? event.keyCode : event.which;\n if (code === 40 || code === 38 || code === 13) {\n event.preventDefault();\n return _this.dispatch($el, code);\n }\n };\n })(this));\n };\n\n return LightboxKeyboardNavigationService;\n\n })(taiga.Service);\n\n module.service(\"lightboxKeyboardNavigationService\", LightboxKeyboardNavigationService);\n\n LightboxDirective = function(lightboxService) {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n };\n return {\n restrict: \"C\",\n link: link\n };\n };\n\n module.directive(\"lightbox\", [\"lightboxService\", LightboxDirective]);\n\n BlockLightboxDirective = function($rootscope, $tgrepo, $confirm, lightboxService, $loading, $qqueue, $translate) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var block, title, unblock;\n title = $translate.instant($attrs.title);\n $el.find(\"h2.title\").text(title);\n unblock = $qqueue.bindAdd((function(_this) {\n return function(item, finishCallback) {\n var promise;\n promise = $tgrepo.save(item);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n $model.$setViewValue(item);\n return finishCallback();\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n promise[\"finally\"](function() {\n return finishCallback();\n });\n return promise;\n };\n })(this));\n block = $qqueue.bindAdd((function(_this) {\n return function(item) {\n var currentLoading, promise;\n $model.$setViewValue(item);\n currentLoading = $loading().target($el.find(\".button-green\")).start();\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"object:updated\");\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n return promise[\"finally\"](function() {\n currentLoading.finish();\n return lightboxService.close($el);\n });\n };\n })(this));\n $scope.$on(\"block\", function() {\n $el.find(\".reason\").val($model.$modelValue.blocked_note);\n return lightboxService.open($el);\n });\n $scope.$on(\"unblock\", (function(_this) {\n return function(event, model, finishCallback) {\n var item;\n item = $model.$modelValue.clone();\n item.is_blocked = false;\n item.blocked_note = \"\";\n return unblock(item, finishCallback);\n };\n })(this));\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n var item;\n event.preventDefault();\n item = $model.$modelValue.clone();\n item.is_blocked = true;\n item.blocked_note = $el.find(\".reason\").val();\n return block(item);\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-block.html\",\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgLbBlock\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"lightboxService\", \"$tgLoading\", \"$tgQqueue\", \"$translate\", BlockLightboxDirective]);\n\n BlockingMessageInputDirective = function($log, $template, $compile) {\n var link, template, templateFn;\n template = $template.get(\"common/lightbox/lightbox-blocking-message-input.html\", true);\n link = function($scope, $el, $attrs, $model) {\n if (!$attrs.watch) {\n return $log.error(\"No watch attribute on tg-blocking-message-input directive\");\n }\n return $scope.$watch($attrs.watch, function(value) {\n if (value === !void 0 && value === true) {\n return $el.find(\".blocked-note\").removeClass(\"hidden\");\n } else {\n return $el.find(\".blocked-note\").addClass(\"hidden\");\n }\n });\n };\n templateFn = function($el, $attrs) {\n return template({\n ngmodel: $attrs.ngModel\n });\n };\n return {\n template: templateFn,\n link: link,\n require: \"ngModel\",\n restrict: \"EA\"\n };\n };\n\n module.directive(\"tgBlockingMessageInput\", [\"$log\", \"$tgTemplate\", \"$compile\", BlockingMessageInputDirective]);\n\n CreateEditUserstoryDirective = function($repo, $model, $rs, $rootScope, lightboxService, $loading, $translate, $confirm, $q, attachmentsService) {\n var link;\n link = function($scope, $el, attrs) {\n var attachmentsToAdd, attachmentsToDelete, createAttachments, deleteAttachments, form, resetAttachments, submit, submitButton;\n form = null;\n $scope.createEditUs = {};\n $scope.isNew = true;\n attachmentsToAdd = Immutable.List();\n attachmentsToDelete = Immutable.List();\n resetAttachments = function() {\n attachmentsToAdd = Immutable.List();\n return attachmentsToDelete = Immutable.List();\n };\n $scope.addAttachment = function(attachment) {\n return attachmentsToAdd = attachmentsToAdd.push(attachment);\n };\n $scope.deleteAttachment = function(attachment) {\n return attachmentsToDelete = attachmentsToDelete.push(attachment);\n };\n $scope.$on(\"usform:new\", function(ctx, projectId, status, statusList) {\n if (form) {\n form.reset();\n }\n $scope.isNew = true;\n $scope.usStatusList = statusList;\n $scope.attachments = Immutable.List();\n resetAttachments();\n $scope.us = $model.make_model(\"userstories\", {\n project: projectId,\n points: {},\n status: status,\n is_archived: false,\n tags: []\n });\n $el.find(\".button-green\").html($translate.instant(\"COMMON.CREATE\"));\n $el.find(\".title\").html($translate.instant(\"LIGHTBOX.CREATE_EDIT_US.NEW_US\"));\n $el.find(\".tag-input\").val(\"\");\n $el.find(\".blocked-note\").addClass(\"hidden\");\n $el.find(\"label.blocked\").removeClass(\"selected\");\n $el.find(\"label.team-requirement\").removeClass(\"selected\");\n $el.find(\"label.client-requirement\").removeClass(\"selected\");\n return lightboxService.open($el);\n });\n $scope.$on(\"usform:edit\", function(ctx, us, attachments) {\n if (form) {\n form.reset();\n }\n $scope.us = us;\n $scope.attachments = Immutable.fromJS(attachments);\n $scope.isNew = false;\n resetAttachments();\n $el.find(\".button-green\").html($translate.instant(\"COMMON.SAVE\"));\n $el.find(\".title\").html($translate.instant(\"LIGHTBOX.CREATE_EDIT_US.EDIT_US\"));\n $el.find(\".tag-input\").val(\"\");\n if (us.is_blocked) {\n $el.find(\".blocked-note\").removeClass(\"hidden\");\n $el.find(\"label.blocked\").addClass(\"selected\");\n } else {\n $el.find(\".blocked-note\").addClass(\"hidden\");\n $el.find(\"label.blocked\").removeClass(\"selected\");\n }\n if (us.team_requirement) {\n $el.find(\"label.team-requirement\").addClass(\"selected\");\n } else {\n $el.find(\"label.team-requirement\").removeClass(\"selected\");\n }\n if (us.client_requirement) {\n $el.find(\"label.client-requirement\").addClass(\"selected\");\n } else {\n $el.find(\"label.client-requirement\").removeClass(\"selected\");\n }\n return lightboxService.open($el);\n });\n createAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToAdd.toJS(), function(attachment) {\n return attachmentsService.upload(attachment.file, obj.id, $scope.us.project, 'us');\n });\n return $q.all(promises);\n };\n deleteAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToDelete.toJS(), function(attachment) {\n return attachmentsService[\"delete\"](\"us\", attachment.id);\n });\n return $q.all(promises);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, currentLoading, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n if ($scope.isNew) {\n promise = $repo.create(\"userstories\", $scope.us);\n broadcastEvent = \"usform:new:success\";\n } else {\n promise = $repo.save($scope.us);\n broadcastEvent = \"usform:edit:success\";\n }\n promise.then(function(data) {\n deleteAttachments(data).then((function(_this) {\n return function() {\n return createAttachments(data);\n };\n })(this));\n return data;\n });\n promise.then(function(data) {\n currentLoading.finish();\n lightboxService.close($el);\n return $rootScope.$broadcast(broadcastEvent, data);\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n $scope.$apply(function() {\n return $scope.us.revert();\n });\n return lightboxService.close($el);\n });\n $el.keydown(function(event) {\n var code;\n code = event.keyCode ? event.keyCode : event.which;\n if (code === 27) {\n lightboxService.close($el);\n return $scope.$apply(function() {\n return $scope.us.revert();\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateEditUserstory\", [\"$tgRepo\", \"$tgModel\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$translate\", \"$tgConfirm\", \"$q\", \"tgAttachmentsService\", CreateEditUserstoryDirective]);\n\n CreateBulkUserstoriesDirective = function($repo, $rs, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var form, submit, submitButton;\n form = null;\n $scope.$on(\"usform:bulk\", function(ctx, projectId, status) {\n if (form) {\n form.reset();\n }\n $scope[\"new\"] = {\n projectId: projectId,\n statusId: status,\n bulk: \"\"\n };\n return lightboxService.open($el);\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $rs.userstories.bulkCreate($scope[\"new\"].projectId, $scope[\"new\"].statusId, $scope[\"new\"].bulk);\n promise.then(function(result) {\n currentLoading.finish();\n $rootscope.$broadcast(\"usform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateBulkUserstories\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", CreateBulkUserstoriesDirective]);\n\n AssignedToLightboxDirective = function(lightboxService, lightboxKeyboardNavigationService, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs) {\n var closeLightbox, filterUsers, normalizeString, render, selectedItem, selectedUser, usersTemplate;\n selectedUser = null;\n selectedItem = null;\n usersTemplate = $template.get(\"common/lightbox/lightbox-assigned-to-users.html\", true);\n normalizeString = function(string) {\n var normalizedString;\n normalizedString = string;\n normalizedString = normalizedString.replace(\"Á\", \"A\").replace(\"Ä\", \"A\").replace(\"À\", \"A\");\n normalizedString = normalizedString.replace(\"É\", \"E\").replace(\"Ë\", \"E\").replace(\"È\", \"E\");\n normalizedString = normalizedString.replace(\"Í\", \"I\").replace(\"Ï\", \"I\").replace(\"Ì\", \"I\");\n normalizedString = normalizedString.replace(\"Ó\", \"O\").replace(\"Ö\", \"O\").replace(\"Ò\", \"O\");\n normalizedString = normalizedString.replace(\"Ú\", \"U\").replace(\"Ü\", \"U\").replace(\"Ù\", \"U\");\n return normalizedString;\n };\n filterUsers = function(text, user) {\n var username;\n username = user.full_name_display.toUpperCase();\n username = normalizeString(username);\n text = text.toUpperCase();\n text = normalizeString(text);\n return _.includes(username, text);\n };\n render = function(selected, text) {\n var ctx, html, users;\n users = _.clone($scope.activeUsers, true);\n if (selected != null) {\n users = _.reject(users, {\n \"id\": selected.id\n });\n }\n if (text != null) {\n users = _.filter(users, _.partial(filterUsers, text));\n }\n ctx = {\n selected: selected,\n users: _.slice(users, 0, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n html = $compile(html)($scope);\n return $el.find(\".assigned-to-list\").html(html);\n };\n closeLightbox = function() {\n lightboxKeyboardNavigationService.stop();\n return lightboxService.close($el);\n };\n $scope.$on(\"assigned-to:add\", function(ctx, item) {\n var assignedToId;\n selectedItem = item;\n assignedToId = item.assigned_to;\n selectedUser = $scope.usersById[assignedToId];\n render(selectedUser);\n return lightboxService.open($el).then(function() {\n $el.find('input').focus();\n return lightboxKeyboardNavigationService.init($el);\n });\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n if (searchingText != null) {\n render(selectedUser, searchingText);\n return $el.find('input').focus();\n }\n });\n $el.on(\"click\", \".user-list-single\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n closeLightbox();\n return $scope.$apply(function() {\n $scope.$broadcast(\"assigned-to:added\", target.data(\"user-id\"), selectedItem);\n return $scope.usersSearch = null;\n });\n });\n $el.on(\"click\", \".remove-assigned-to\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n closeLightbox();\n return $scope.$apply(function() {\n $scope.usersSearch = null;\n return $scope.$broadcast(\"assigned-to:added\", null, selectedItem);\n });\n });\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n closeLightbox();\n return $scope.$apply(function() {\n return $scope.usersSearch = null;\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-assigned-to.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbAssignedto\", [\"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", AssignedToLightboxDirective]);\n\n WatchersLightboxDirective = function($repo, lightboxService, lightboxKeyboardNavigationService, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs) {\n var closeLightbox, getFilteredUsers, render, selectedItem, usersTemplate;\n selectedItem = null;\n usersTemplate = $template.get(\"common/lightbox/lightbox-assigned-to-users.html\", true);\n getFilteredUsers = function(text) {\n var _filterUsers, users;\n if (text == null) {\n text = \"\";\n }\n _filterUsers = function(text, user) {\n var username;\n if (selectedItem && _.find(selectedItem.watchers, function(x) {\n return x === user.id;\n })) {\n return false;\n }\n username = user.full_name_display.toUpperCase();\n text = text.toUpperCase();\n return _.includes(username, text);\n };\n users = _.clone($scope.activeUsers, true);\n users = _.filter(users, _.partial(_filterUsers, text));\n return users;\n };\n render = function(users) {\n var ctx, html;\n ctx = {\n selected: false,\n users: _.slice(users, 0, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n html = $compile(html)($scope);\n return $el.find(\".ticket-watchers\").html(html);\n };\n closeLightbox = function() {\n lightboxKeyboardNavigationService.stop();\n return lightboxService.close($el);\n };\n $scope.$on(\"watcher:add\", function(ctx, item) {\n var users;\n selectedItem = item;\n users = getFilteredUsers();\n render(users);\n return lightboxService.open($el).then(function() {\n $el.find(\"input\").focus();\n return lightboxKeyboardNavigationService.init($el);\n });\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n var users;\n if (searchingText == null) {\n return;\n }\n users = getFilteredUsers(searchingText);\n render(users);\n return $el.find(\"input\").focus();\n });\n $el.on(\"click\", \".user-list-single\", debounce(2000, function(event) {\n var target;\n closeLightbox();\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return $scope.$apply(function() {\n $scope.usersSearch = null;\n return $scope.$broadcast(\"watcher:added\", target.data(\"user-id\"));\n });\n }));\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n closeLightbox();\n return $scope.$apply(function() {\n return $scope.usersSearch = null;\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-users.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbWatchers\", [\"$tgRepo\", \"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", WatchersLightboxDirective]);\n\n AttachmentPreviewLightboxDirective = function(lightboxService, $template, $compile) {\n var link;\n link = function($scope, $el, attrs) {\n return lightboxService.open($el);\n };\n return {\n templateUrl: 'common/lightbox/lightbox-attachment-preview.html',\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgLbAttachmentPreview\", [\"lightboxService\", \"$tgTemplate\", \"$compile\", AttachmentPreviewLightboxDirective]);\n\n LightboxLeaveProjectWarningDirective = function(lightboxService, $template, $compile) {\n var link;\n link = function($scope, $el, attrs) {\n return lightboxService.open($el);\n };\n return {\n templateUrl: 'common/lightbox/lightbox-leave-project-warning.html',\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgLightboxLeaveProjectWarning\", [\"lightboxService\", LightboxLeaveProjectWarningDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/loader.coffee\n */\n\n(function() {\n var Loader, LoaderDirective, module, sizeFormat, taiga, timeout;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaCommon\");\n\n LoaderDirective = function(tgLoader, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n tgLoader.onStart(function() {\n $(document.body).addClass(\"loader-active\");\n return $el.addClass(\"active\");\n });\n return tgLoader.onEnd(function() {\n $(document.body).removeClass(\"loader-active\");\n return $el.removeClass(\"active\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLoader\", [\"tgLoader\", \"$rootScope\", LoaderDirective]);\n\n Loader = function($rootscope) {\n var autoClose, config, lastResponseDate, open, pageLoaded, requestCount, start, startLoadTime;\n config = {\n minTime: 300\n };\n open = false;\n startLoadTime = 0;\n requestCount = 0;\n lastResponseDate = 0;\n pageLoaded = function(force) {\n var diff, endTime, timeoutValue;\n if (force == null) {\n force = false;\n }\n if (startLoadTime) {\n timeoutValue = 0;\n if (!force) {\n endTime = new Date().getTime();\n diff = endTime - startLoadTime;\n if (diff < config.minTime) {\n timeoutValue = config.minTime - diff;\n }\n }\n timeout(timeoutValue, function() {\n $rootscope.$broadcast(\"loader:end\");\n open = false;\n return window.prerenderReady = true;\n });\n }\n startLoadTime = 0;\n requestCount = 0;\n return lastResponseDate = 0;\n };\n autoClose = function() {\n var intervalAuto;\n return intervalAuto = setInterval((function() {\n if (lastResponseDate && requestCount === 0) {\n pageLoaded();\n return clearInterval(intervalAuto);\n }\n }), 50);\n };\n start = function() {\n startLoadTime = new Date().getTime();\n $rootscope.$broadcast(\"loader:start\");\n return open = true;\n };\n return {\n pageLoaded: pageLoaded,\n start: function(auto) {\n if (auto == null) {\n auto = false;\n }\n if (!open) {\n start();\n if (auto) {\n return autoClose();\n }\n }\n },\n onStart: function(fn) {\n return $rootscope.$on(\"loader:start\", fn);\n },\n onEnd: function(fn) {\n return $rootscope.$on(\"loader:end\", fn);\n },\n logRequest: function() {\n return requestCount++;\n },\n logResponse: function() {\n requestCount--;\n return lastResponseDate = new Date().getTime();\n }\n };\n };\n\n Loader.$inject = [\"$rootScope\"];\n\n module.factory(\"tgLoader\", Loader);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/lightboxes.coffee\n */\n\n(function() {\n var LoadingDirective, TgLoadingService, module,\n slice = [].slice;\n\n module = angular.module(\"taigaCommon\");\n\n TgLoadingService = function($compile) {\n var spinner;\n spinner = \"loading...\";\n return function() {\n var service;\n service = {\n settings: {\n target: null,\n scope: null,\n classes: [],\n timeout: 0,\n template: null\n },\n target: function(target) {\n service.settings.target = target;\n return service;\n },\n scope: function(scope) {\n service.settings.scope = scope;\n return service;\n },\n template: function(template) {\n service.settings.template = template;\n return service;\n },\n removeClasses: function() {\n var classess;\n classess = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n service.settings.classes = classess;\n return service;\n },\n timeout: function(timeout) {\n service.settings.timeout = timeout;\n return service;\n },\n start: function() {\n var target, timeoutId;\n target = service.settings.target;\n service.settings.classes.map(function(className) {\n return target.removeClass(className);\n });\n if (!target.hasClass('loading') && !service.settings.template) {\n service.settings.template = target.html();\n }\n timeoutId = setTimeout((function() {\n if (!target.hasClass('loading')) {\n target.addClass('loading');\n return target.html(spinner);\n }\n }), service.settings.timeout);\n service.settings.timeoutId = timeoutId;\n return service;\n },\n finish: function() {\n var removeClasses, target, timeoutId;\n target = service.settings.target;\n timeoutId = service.settings.timeoutId;\n if (timeoutId) {\n clearTimeout(timeoutId);\n removeClasses = service.settings.classes;\n removeClasses.map(function(className) {\n return service.settings.target.addClass(className);\n });\n target.html(service.settings.template);\n target.removeClass('loading');\n if (service.settings.scope) {\n $compile(target.contents())(service.settings.scope);\n }\n }\n return service;\n }\n };\n return service;\n };\n };\n\n TgLoadingService.$inject = [\"$compile\"];\n\n module.factory(\"$tgLoading\", TgLoadingService);\n\n LoadingDirective = function($loading) {\n var link;\n link = function($scope, $el, attr) {\n var currentLoading, template;\n currentLoading = null;\n template = $el.html();\n return $scope.$watch(attr.tgLoading, (function(_this) {\n return function(showLoading) {\n if (showLoading) {\n return currentLoading = $loading().target($el).timeout(100).template(template).scope($scope).start();\n } else if (currentLoading) {\n return currentLoading.finish();\n }\n };\n })(this));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLoading\", [\"$tgLoading\", LoadingDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/popovers.coffee\n */\n\n(function() {\n var RelatedTaskStatusDirective, UsStatusDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n UsStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a US and a popover to change it.\n - tg-us-status: The user story\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-us-status=\"us\" on-update=\"ctrl.loadSprintState()\")\n a.us-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'usStatusById' and 'project'.\n */\n var link, template;\n template = $template.get(\"common/popover/popover-us-status.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render, us;\n $ctrl = $el.controller();\n render = function(us) {\n var usStatusById, usStatusDom, usStatusDomParent;\n usStatusDomParent = $el.find(\".us-status\");\n usStatusDom = $el.find(\".us-status .us-status-bind\");\n usStatusById = $scope.usStatusById;\n if (usStatusById[us.status]) {\n usStatusDom.text(usStatusById[us.status].name);\n return usStatusDomParent.css(\"color\", usStatusById[us.status].color);\n }\n };\n $el.on(\"click\", \".us-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target, us;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgUsStatus);\n us.status = target.data(\"status-id\");\n render(us);\n $el.find(\".pop-status\").popover().close();\n return $scope.$apply(function() {\n return $repo.save(us).then(function() {\n return $scope.$eval($attrs.onUpdate);\n });\n });\n }));\n $scope.$on(\"userstories:loaded\", function() {\n return render($scope.$eval($attrs.tgUsStatus));\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n us = $scope.$eval($attrs.tgUsStatus);\n render(us);\n return bindOnce($scope, \"project\", function(project) {\n var html;\n html = template({\n \"statuses\": project.us_statuses\n });\n $el.append(html);\n if ($scope.project.my_permissions.indexOf(\"modify_us\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsStatus\", [\"$tgRepo\", \"$tgTemplate\", UsStatusDirective]);\n\n RelatedTaskStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a related task and a popover to change it.\n - tg-related-task-status: The related task\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-related-task-status=\"task\" on-update=\"ctrl.loadSprintState()\")\n a.task-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'taskStatusById' and 'project'.\n */\n var link, selectionTemplate, updateTaskStatus;\n selectionTemplate = $template.get(\"common/popover/popover-related-task-status.html\", true);\n updateTaskStatus = function($el, task, taskStatusById) {\n var taskStatusDom, taskStatusDomParent;\n taskStatusDomParent = $el.find(\".us-status\");\n taskStatusDom = $el.find(\".task-status .task-status-bind\");\n if (taskStatusById[task.status]) {\n taskStatusDom.text(taskStatusById[task.status].name);\n return taskStatusDomParent.css('color', taskStatusById[task.status].color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task;\n $ctrl = $el.controller();\n task = $scope.$eval($attrs.tgRelatedTaskStatus);\n notAutoSave = $scope.$eval($attrs.notAutoSave);\n autoSave = !notAutoSave;\n $el.on(\"click\", \".task-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n task.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (autoSave) {\n return $scope.$apply(function() {\n return $repo.save(task).then(function() {\n $scope.$eval($attrs.onUpdate);\n return $scope.$emit(\"related-tasks:status-changed\");\n });\n });\n }\n }));\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.task_statuses\n }));\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (project.my_permissions.indexOf(\"modify_task\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskStatus\", [\"$tgRepo\", \"$tgTemplate\", RelatedTaskStatusDirective]);\n\n $.fn.popover = function() {\n var $el, close, closeAll, closePopover, isVisible, open;\n $el = this;\n isVisible = (function(_this) {\n return function() {\n var docViewBottom, docViewLeft, docViewRight, docViewTop, docViewWidth, elemBottom, elemLeft, elemRight, elemTop, elemWidth;\n $el.css({\n \"display\": \"block\",\n \"visibility\": \"hidden\"\n });\n docViewTop = $(window).scrollTop();\n docViewBottom = docViewTop + $(window).height();\n docViewWidth = $(window).width();\n docViewRight = docViewWidth;\n docViewLeft = 0;\n elemTop = $el.offset().top;\n elemBottom = elemTop + $el.height();\n elemWidth = $el.width();\n elemLeft = $el.offset().left;\n elemRight = $el.offset().left + elemWidth;\n $el.css({\n \"display\": \"none\",\n \"visibility\": \"visible\"\n });\n return (elemBottom <= docViewBottom) && (elemTop >= docViewTop) && (elemLeft >= docViewLeft) && (elemRight <= docViewRight);\n };\n })(this);\n closePopover = (function(_this) {\n return function(onClose) {\n if (onClose) {\n onClose.call($el);\n }\n $el.fadeOut(function() {\n return $el.removeClass(\"active\").removeClass(\"fix\");\n });\n return $el.off(\"popup:close\");\n };\n })(this);\n closeAll = (function(_this) {\n return function() {\n return $(\".popover.active\").each(function() {\n return $(this).trigger(\"popup:close\");\n });\n };\n })(this);\n open = (function(_this) {\n return function(onClose) {\n if ($el.hasClass(\"active\")) {\n return close();\n } else {\n closeAll();\n if (!isVisible()) {\n $el.addClass(\"fix\");\n }\n $el.fadeIn(function() {\n $el.addClass(\"active\");\n $(document.body).off(\"popover\");\n return $(document.body).one(\"click.popover\", function() {\n return closeAll();\n });\n });\n return $el.on(\"popup:close\", function(e) {\n return closePopover(onClose);\n });\n }\n };\n })(this);\n close = (function(_this) {\n return function() {\n return $el.trigger(\"popup:close\");\n };\n })(this);\n return {\n open: open,\n close: close,\n closeAll: closeAll\n };\n };\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/raven-logger.coffee\n */\n\n(function() {\n var ExceptionHandlerFactory, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n ExceptionHandlerFactory = function($log, config) {\n var ravenConfig;\n this.config = config;\n ravenConfig = this.config.get(\"ravenConfig\", null);\n if (ravenConfig) {\n $log.debug(\"Using the RavenJS exception handler.\");\n Raven.config(ravenConfig).install();\n return function(exception, cause) {\n $log.error.apply($log, arguments);\n return Raven.captureException(exception);\n };\n } else {\n $log.debug(\"Using the default logging exception handler.\");\n return function(exception, cause) {\n return $log.error.apply($log, arguments);\n };\n }\n };\n\n module.factory(\"$exceptionHandler\", [\"$log\", \"$tgConfig\", ExceptionHandlerFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/tags.coffee\n */\n\n(function() {\n var ColorizeTagsDirective, LbTagLineDirective, TagLineDirective, TagsDirective, bindOnce, module, taiga, trim,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n TagsDirective = function() {\n var formatter, link, parser;\n formatter = function(v) {\n if (_.isArray(v)) {\n return v.join(\", \");\n }\n return \"\";\n };\n parser = function(v) {\n var result;\n if (!v) {\n return [];\n }\n result = _(v.split(\",\")).map(function(x) {\n return _.trim(x);\n });\n return result.value();\n };\n link = function($scope, $el, $attrs, $ctrl) {\n $ctrl.$formatters.push(formatter);\n $ctrl.$parsers.push(parser);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n require: \"ngModel\",\n link: link\n };\n };\n\n module.directive(\"tgTags\", TagsDirective);\n\n ColorizeTagsDirective = function() {\n var link, templates;\n templates = {\n backlog: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\"><%- tag.name %>\\n<% }) %>\"),\n kanban: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\"),\n taskboard: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\")\n };\n link = function($scope, $el, $attrs, $ctrl) {\n var render;\n render = function(srcTags) {\n var html, tags, template;\n template = templates[$attrs.tgColorizeTagsType];\n srcTags.sort();\n tags = _.map(srcTags, function(tag) {\n var color;\n color = $scope.project.tags_colors[tag];\n return {\n name: tag,\n color: color\n };\n });\n html = template({\n tags: tags\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.tgColorizeTags, function(tags) {\n if (tags != null) {\n return render(tags);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgColorizeTags\", ColorizeTagsDirective);\n\n LbTagLineDirective = function($rs, $template, $compile) {\n var COMMA_KEY, ENTER_KEY, link, templateTags;\n ENTER_KEY = 13;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/lb-tag-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideSaveButton, renderTags, resetInput, saveInputTag, showSaveButton;\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n })\n };\n _.map(ctx.tags, (function(_this) {\n return function(tag) {\n if (tag.color) {\n return tag.style = \"border-left: 5px solid \" + tag.color;\n }\n };\n })(this));\n html = $compile(templateTags(ctx))($scope);\n return $el.find(\".tags-container\").html(html);\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n if (tags == null) {\n tags = [];\n }\n if (indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n return hideSaveButton();\n };\n deleteValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n tags = _.pull(tags, value);\n return $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n };\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n $el.on(\"keypress\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n event.preventDefault();\n return saveInputTag();\n } else if (String.fromCharCode(event.keyCode) === ',') {\n event.preventDefault();\n return saveInputTag();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".remove-tag\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project\", function(project) {\n var positioningFunction;\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(project.tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(tags) {\n var ref, tagsColors;\n tagsColors = ((ref = $scope.project) != null ? ref.tags_colors : void 0) || [];\n return renderTags(tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/lb-tag-line.html\"\n };\n };\n\n module.directive(\"tgLbTagLine\", [\"$tgResources\", \"$tgTemplate\", \"$compile\", LbTagLineDirective]);\n\n TagLineDirective = function($rootScope, $repo, $rs, $confirm, $qqueue, $template, $compile) {\n var COMMA_KEY, ENTER_KEY, ESC_KEY, link, templateTags;\n ENTER_KEY = 13;\n ESC_KEY = 27;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/tags-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideAddTagButton, hideAddTagButtonText, hideInput, hideSaveButton, isEditable, renderInReadModeOnly, renderTags, resetInput, saveInputTag, showAddTagButton, showAddTagButtonText, showInput, showSaveButton;\n isEditable = function() {\n if ($attrs.requiredPerm != null) {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n }\n return true;\n };\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n }),\n isEditable: isEditable()\n };\n html = $compile(templateTags(ctx))($scope);\n return $el.find(\"div.tags-container\").html(html);\n };\n renderInReadModeOnly = function() {\n $el.find(\".add-tag\").remove();\n $el.find(\"input\").remove();\n return $el.find(\".save\").remove();\n };\n showAddTagButton = function() {\n return $el.find(\".add-tag\").removeClass(\"hidden\");\n };\n hideAddTagButton = function() {\n return $el.find(\".add-tag\").addClass(\"hidden\");\n };\n showAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").removeClass(\"hidden\");\n };\n hideAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").addClass(\"hidden\");\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n showInput = function() {\n return $el.find(\"input\").removeClass(\"hidden\").focus();\n };\n hideInput = function() {\n return $el.find(\"input\").addClass(\"hidden\").blur();\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n if (tags == null) {\n tags = [];\n }\n if (indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"object:updated\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n hideSaveButton();\n return $repo.save(model).then(onSuccess, onError);\n });\n deleteValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n tags = _.pull(tags, value);\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"object:updated\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n return $repo.save(model).then(onSuccess, onError);\n });\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n $el.on(\"keypress\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n return saveInputTag();\n } else if (String.fromCharCode(event.keyCode) === ',') {\n event.preventDefault();\n return saveInputTag();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === ESC_KEY) {\n resetInput();\n hideInput();\n hideSaveButton();\n return showAddTagButton();\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".add-tag\", function(event) {\n event.preventDefault();\n hideAddTagButton();\n return showInput();\n });\n $el.on(\"click\", \".remove-tag\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project.tags_colors\", function(tags_colors) {\n var positioningFunction;\n if (!isEditable()) {\n renderInReadModeOnly();\n return;\n }\n showAddTagButton();\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(model) {\n var ref, ref1, tagsColors;\n if (!model) {\n return;\n }\n if ((ref = model.tags) != null ? ref.length : void 0) {\n hideAddTagButtonText();\n } else {\n showAddTagButtonText();\n }\n tagsColors = ((ref1 = $scope.project) != null ? ref1.tags_colors : void 0) || [];\n return renderTags(model.tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/tag-line.html\"\n };\n };\n\n module.directive(\"tgTagLine\", [\"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", TagLineDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/wisiwyg.coffee\n */\n\n(function() {\n var MarkitupDirective, bindOnce, module, taiga,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n MarkitupDirective = function($rootscope, $rs, $selectedText, $template, $compile, $translate) {\n var link, previewTemplate;\n previewTemplate = $template.get(\"common/wysiwyg/wysiwyg-markitup-preview.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addLine, cancelablePromise, closePreviewMode, element, markdownTitle, prepareUrlFormatting, preview, previewDomNode, previewInProgress, renderMarkItUp, setCaretPosition, unbind, urlFormatting;\n element = angular.element($el);\n previewDomNode = $(\"
\", {\n \"class\": \"preview\"\n });\n closePreviewMode = function() {\n element.parents(\".markdown\").find(\".preview\").remove();\n return element.parents(\".markItUp\").show();\n };\n $scope.$on(\"markdown-editor:submit\", function() {\n return closePreviewMode();\n });\n cancelablePromise = null;\n previewInProgress = false;\n preview = function() {\n var markItUpDomNode, markdownDomNode;\n if (previewInProgress) {\n return;\n }\n previewInProgress = true;\n markdownDomNode = element.parents(\".markdown\");\n markItUpDomNode = element.parents(\".markItUp\");\n return $rs.mdrender.render($scope.projectId, $model.$modelValue).then(function(data) {\n var html, markdown;\n html = previewTemplate({\n data: data.data\n });\n html = $compile(html)($scope);\n markdownDomNode.append(html);\n markItUpDomNode.hide();\n previewInProgress = false;\n markdown = element.closest(\".markdown\");\n return markdown.on(\"mouseup.preview\", \".preview\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.target);\n if (!target.is('a') && $selectedText.get().length) {\n return;\n }\n markdown.off(\".preview\");\n return closePreviewMode();\n });\n });\n };\n setCaretPosition = function(textarea, caretPosition) {\n var line, range, scrollRelation, totalLines;\n if (textarea.createTextRange) {\n range = textarea.createTextRange();\n range.move(\"character\", caretPosition);\n range.select();\n } else if (textarea.selectionStart) {\n textarea.focus();\n textarea.setSelectionRange(caretPosition, caretPosition);\n }\n totalLines = textarea.value.split(\"\\n\").length;\n line = textarea.value.slice(0, +(caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n scrollRelation = line / totalLines;\n return $el.scrollTop((scrollRelation * $el[0].scrollHeight) - ($el.height() / 2));\n };\n addLine = function(textarea, nline, replace) {\n var cursorPosition, j, key, len, line, lines;\n lines = textarea.value.split(\"\\n\");\n if (replace) {\n lines[nline] = replace + lines[nline];\n } else {\n lines[nline] = \"\";\n }\n cursorPosition = 0;\n for (key = j = 0, len = lines.length; j < len; key = ++j) {\n line = lines[key];\n cursorPosition += line.length + 1 || 1;\n if (key === nline) {\n break;\n }\n }\n textarea.value = lines.join(\"\\n\");\n if (replace) {\n return cursorPosition - lines[nline].length + replace.length - 1;\n } else {\n return cursorPosition;\n }\n };\n prepareUrlFormatting = function(markItUp) {\n var indices, regex, result;\n regex = /(<<<|>>>)/gi;\n result = 0;\n indices = [];\n while ((result = regex.exec(markItUp.textarea.value))) {\n indices.push(result.index);\n }\n return markItUp.donotparse = indices;\n };\n urlFormatting = function(markItUp) {\n var endIndex, ref, ref1, regex, result, startIndex, url, value;\n regex = /<<>>/gi;\n endIndex = 0;\n while (true) {\n result = regex.exec(markItUp.textarea.value);\n if (!result) {\n break;\n }\n if (ref1 = result.index, indexOf.call(markItUp.donotparse, ref1) < 0) {\n endIndex = result.index;\n break;\n }\n }\n value = markItUp.textarea.value;\n url = value.substring(startIndex, endIndex).replace('<<<', '').replace('>>>', '');\n url = url.replace('(', '%28').replace(')', '%29');\n url = url.replace('[', '%5B').replace(']', '%5D');\n value = value.substring(0, startIndex) + url + value.substring(endIndex + 3, value.length);\n markItUp.textarea.value = value;\n return markItUp.donotparse = void 0;\n };\n markdownTitle = function(markItUp, char) {\n var heading, i, j, n, ref;\n heading = \"\";\n n = $.trim(markItUp.selection || markItUp.placeHolder).length;\n for (i = j = 0, ref = n - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {\n heading += char;\n }\n return \"\\n\" + heading + \"\\n\";\n };\n renderMarkItUp = function() {\n var markdownSettings;\n markdownSettings = {\n nameSpace: \"markdown\",\n onShiftEnter: {\n keepDefault: false,\n openWith: \"\\n\\n\"\n },\n onEnter: {\n keepDefault: false,\n replaceWith: function() {\n if (!$('.textcomplete-dropdown').is(':visible')) {\n return \"\\n\";\n }\n },\n afterInsert: function(data) {\n var cursorLine, emptyListItem, lastLine, lines, markdownCaretPositon, match, newLineContent, nline, replace;\n lines = data.textarea.value.split(\"\\n\");\n if (data.caretPosition > 0) {\n cursorLine = data.textarea.value.slice(0, +(data.caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n } else {\n cursorLine = 1;\n }\n newLineContent = data.textarea.value.slice(data.caretPosition).split(\"\\n\")[0];\n lastLine = lines[cursorLine - 1];\n match = lastLine.match(/^(\\s*- ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)\\-\\s$/);\n if (emptyListItem) {\n nline = cursorLine - 1;\n replace = null;\n } else {\n nline = cursorLine;\n replace = \"\" + match[1];\n }\n markdownCaretPositon = addLine(data.textarea, nline, replace);\n }\n match = lastLine.match(/^(\\s*\\* ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*\\* )$/);\n if (emptyListItem) {\n nline = cursorLine - 1;\n replace = null;\n } else {\n nline = cursorLine;\n replace = \"\" + match[1];\n }\n markdownCaretPositon = addLine(data.textarea, nline, replace);\n }\n match = lastLine.match(/^(\\s*)(\\d+)\\.\\s/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)(\\d+)\\.\\s$/);\n if (emptyListItem) {\n nline = cursorLine - 1;\n replace = null;\n } else {\n nline = cursorLine;\n replace = (match[1] + (parseInt(match[2], 10) + 1)) + \". \";\n }\n markdownCaretPositon = addLine(data.textarea, nline, replace);\n }\n if (markdownCaretPositon) {\n return setCaretPosition(data.textarea, markdownCaretPositon);\n }\n }\n },\n markupSet: [\n {\n name: $translate.instant(\"COMMON.WYSIWYG.H1_BUTTON\"),\n key: \"1\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.H1_SAMPLE_TEXT\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"=\");\n }\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.H2_BUTTON\"),\n key: \"2\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.H2_SAMPLE_TEXT\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"-\");\n }\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.H3_BUTTON\"),\n key: \"3\",\n openWith: \"### \",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.H3_SAMPLE_TEXT\")\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.BOLD_BUTTON\"),\n key: \"B\",\n openWith: \"**\",\n closeWith: \"**\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.BOLD_BUTTON_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.ITALIC_SAMPLE_TEXT\"),\n key: \"I\",\n openWith: \"_\",\n closeWith: \"_\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.ITALIC_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.STRIKE_BUTTON\"),\n key: \"S\",\n openWith: \"~~\",\n closeWith: \"~~\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.STRIKE_SAMPLE_TEXT\")\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.BULLETED_LIST_BUTTON\"),\n openWith: \"- \",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.BULLETED_LIST_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.NUMERIC_LIST_BUTTON\"),\n openWith: function(markItUp) {\n return markItUp.line + \". \";\n },\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.NUMERIC_LIST_SAMPLE_TEXT\")\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.PICTURE_BUTTON\"),\n key: \"P\",\n openWith: \"![\",\n closeWith: '](<<<[![Url:!:http://]!]>>> \"[![Title]!]\")',\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.PICTURE_SAMPLE_TEXT\"),\n beforeInsert: function(markItUp) {\n return prepareUrlFormatting(markItUp);\n },\n afterInsert: function(markItUp) {\n return urlFormatting(markItUp);\n }\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.LINK_BUTTON\"),\n key: \"L\",\n openWith: \"[\",\n closeWith: '](<<<[![Url:!:http://]!]>>> \"[![Title]!]\")',\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.LINK_SAMPLE_TEXT\"),\n beforeInsert: function(markItUp) {\n return prepareUrlFormatting(markItUp);\n },\n afterInsert: function(markItUp) {\n return urlFormatting(markItUp);\n }\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.QUOTE_BLOCK_BUTTON\"),\n openWith: \"> \",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.QUOTE_BLOCK_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.CODE_BLOCK_BUTTON\"),\n openWith: \"```\\n\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.CODE_BLOCK_SAMPLE_TEXT\"),\n closeWith: \"\\n```\"\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.PREVIEW_BUTTON\"),\n call: preview,\n className: \"preview-icon\"\n }\n ],\n afterInsert: function(event) {\n var target;\n target = angular.element(event.textarea);\n return $model.$setViewValue(target.val());\n }\n };\n return element.markItUpRemove().markItUp(markdownSettings).textcomplete([\n {\n cache: true,\n match: /(^|\\s)#([a-z0-9]+)$/i,\n search: function(term, callback) {\n var filter, searchProps, searchTypes;\n term = taiga.slugify(term);\n searchTypes = ['issues', 'tasks', 'userstories'];\n searchProps = ['ref', 'subject'];\n filter = (function(_this) {\n return function(item) {\n var j, len, prop;\n for (j = 0, len = searchProps.length; j < len; j++) {\n prop = searchProps[j];\n if (taiga.slugify(item[prop]).indexOf(term) >= 0) {\n return true;\n }\n }\n return false;\n };\n })(this);\n if (cancelablePromise) {\n cancelablePromise.abort();\n }\n cancelablePromise = $rs.search[\"do\"]($scope.projectId, term);\n cancelablePromise.then((function(_this) {\n return function(res) {\n var j, len, results, type;\n if (res.count < 1 || res.count === res.wikipages.length) {\n return callback([]);\n } else {\n results = [];\n for (j = 0, len = searchTypes.length; j < len; j++) {\n type = searchTypes[j];\n if (res[type] && res[type].length > 0) {\n results.push(callback(res[type].filter(filter), true));\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n };\n })(this));\n return callback([]);\n },\n replace: function(res) {\n return \"$1\\#\" + res.ref + \" \";\n },\n template: function(res, term) {\n return \"\\#\" + res.ref + \" - \" + res.subject;\n }\n }, {\n cache: true,\n match: /(^|\\s)@([a-z0-9\\-\\._]{2,})$/i,\n search: function(term, callback) {\n var searchProps, username;\n username = taiga.slugify(term);\n searchProps = ['username', 'full_name', 'full_name_display'];\n if ($scope.project.members.length < 1) {\n return callback([]);\n } else {\n return callback($scope.project.members.filter((function(_this) {\n return function(user) {\n var j, len, prop;\n for (j = 0, len = searchProps.length; j < len; j++) {\n prop = searchProps[j];\n if (taiga.slugify(user[prop]).indexOf(username) >= 0) {\n return true;\n }\n }\n return false;\n };\n })(this)));\n }\n },\n replace: function(user) {\n return \"$1@\" + user.username + \" \";\n },\n template: function(user) {\n return user.username + \" - \" + user.full_name_display;\n }\n }, {\n cache: true,\n match: /(^|\\s)\\[\\[([a-z0-9\\-]+)$/i,\n search: function(term, callback) {\n term = taiga.slugify(term);\n return $rs.search[\"do\"]($scope.projectId, term).then((function(_this) {\n return function(res) {\n if (res.count < 1) {\n callback([]);\n }\n if (res.count < 1 || !res.wikipages || res.wikipages.length <= 0) {\n callback([]);\n } else {\n callback(res.wikipages.filter(function(page) {\n return taiga.slugify(page['slug']).indexOf(term) >= 0;\n }), true);\n }\n return callback([]);\n };\n })(this));\n },\n replace: function(res) {\n return \"$1[[\" + res.slug + \"]]\";\n },\n template: function(res, term) {\n return res.slug;\n }\n }\n ], {\n debounce: 200\n });\n };\n renderMarkItUp();\n unbind = $rootscope.$on(\"$translateChangeEnd\", renderMarkItUp);\n element.on(\"keypress\", function(event) {\n return $scope.$apply();\n });\n return $scope.$on(\"$destroy\", function() {\n $el.off();\n return unbind();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgMarkitup\", [\"$rootScope\", \"$tgResources\", \"$selectedText\", \"$tgTemplate\", \"$compile\", \"$translate\", MarkitupDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/main.coffee\n */\n\n(function() {\n var BacklogFiltersDirective, bindOnce, debounceLeading, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n debounceLeading = this.taiga.debounceLeading;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogFiltersDirective = function($q, $log, $location, $templates) {\n var link, template, templateSelected;\n template = $templates.get(\"backlog/filters.html\", true);\n templateSelected = $templates.get(\"backlog/filter-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, currentFiltersType, getFiltersType, initializeSelectedFilters, reloadUserstories, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection;\n currentFiltersType = '';\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\"h2.breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 a.subfilter span.title\").html(title);\n $el.find(\"h2 a.subfilter span.title\").prop(\"data-type\", type);\n return currentFiltersType = getFiltersType();\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\"h2.breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function() {\n var i, len, name, ref, val, values;\n showCategories();\n selectedFilters = [];\n ref = $scope.filters;\n for (name in ref) {\n values = ref[name];\n for (i = 0, len = values.length; i < len; i++) {\n val = values[i];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters();\n };\n renderSelectedFilters = function() {\n var html;\n _.map(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n return $el.find(\".filters-applied\").html(html);\n };\n renderFilters = function(filters) {\n var html;\n _.map(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n return $el.find(\".filter-list\").html(html);\n };\n getFiltersType = function() {\n return $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n };\n reloadUserstories = function() {\n currentFiltersType = getFiltersType();\n return $q.all([$ctrl.loadUserstories(), $ctrl.generateFilters()]).then(function() {\n var currentFilters;\n currentFilters = $scope.filters[currentFiltersType];\n return renderFilters(_.reject(currentFilters, \"selected\"));\n });\n };\n toggleFilterSelection = function(type, id) {\n var filter, filters;\n currentFiltersType = getFiltersType();\n filters = $scope.filters[type];\n filter = _.find(filters, {\n id: id\n });\n filter.selected = !filter.selected;\n if (filter.selected) {\n selectedFilters.push(filter);\n $scope.$apply(function() {\n return $ctrl.selectFilter(type, id);\n });\n } else {\n selectedFilters = _.reject(selectedFilters, function(selected) {\n return filter.type === selected.type && filter.id === selected.id;\n });\n $ctrl.unselectFilter(type, id);\n }\n renderSelectedFilters(selectedFilters);\n if (type === currentFiltersType) {\n renderFilters(_.reject(filters, \"selected\"));\n }\n return reloadUserstories();\n };\n selectQFilter = debounceLeading(100, function(value) {\n if (value === void 0) {\n return;\n }\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n } else {\n $ctrl.replaceFilter(\"q\", value);\n }\n return reloadUserstories();\n });\n $scope.$watch(\"filtersQ\", selectQFilter);\n $scope.$on(\"backlog:loaded\", function(ctx) {\n return initializeSelectedFilters();\n });\n $scope.$on(\"filters:update\", function(ctx) {\n return $ctrl.generateFilters().then(function() {\n var filters;\n filters = $scope.filters[currentFiltersType];\n if (currentFiltersType) {\n return renderFilters(_.reject(filters, \"selected\"));\n }\n });\n });\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data('type'));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories();\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n return $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.hasClass(\"active\")) {\n target.removeClass(\"active\");\n } else {\n target.addClass(\"active\");\n }\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogFilters\", [\"$q\", \"$log\", \"$tgLocation\", \"$tgTemplate\", BacklogFiltersDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/lightboxes.coffee\n */\n\n(function() {\n var CreateEditSprint, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaBacklog\");\n\n CreateEditSprint = function($repo, $confirm, $rs, $rootscope, lightboxService, $loading, $translate) {\n var link;\n link = function($scope, $el, attrs) {\n var createSprint, form, getLastSprint, hasErrors, remove, resetSprint, submit;\n hasErrors = false;\n createSprint = true;\n form = null;\n resetSprint = function() {\n if (form) {\n form.reset();\n }\n return $scope.sprint = {\n project: null,\n name: null,\n estimated_start: null,\n estimated_finish: null\n };\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, currentLoading, newSprint, prettyDate, promise, submitButton, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n submitButton = $el.find(\".submit-button\");\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n hasErrors = true;\n $el.find(\".last-sprint-name\").addClass(\"disappear\");\n return;\n }\n hasErrors = false;\n newSprint = angular.copy($scope.sprint);\n broadcastEvent = null;\n if (createSprint) {\n newSprint.estimated_start = moment(newSprint.estimated_start, prettyDate).format(\"YYYY-MM-DD\");\n newSprint.estimated_finish = moment(newSprint.estimated_finish, prettyDate).format(\"YYYY-MM-DD\");\n promise = $repo.create(\"milestones\", newSprint);\n broadcastEvent = \"sprintform:create:success\";\n } else {\n newSprint.setAttr(\"estimated_start\", moment(newSprint.estimated_start, prettyDate).format(\"YYYY-MM-DD\"));\n newSprint.setAttr(\"estimated_finish\", moment(newSprint.estimated_finish, prettyDate).format(\"YYYY-MM-DD\"));\n promise = $repo.save(newSprint);\n broadcastEvent = \"sprintform:edit:success\";\n }\n currentLoading = $loading().target(submitButton).start();\n promise.then(function(data) {\n currentLoading.finish();\n if (createSprint) {\n $scope.sprintsCounter += 1;\n }\n $rootscope.$broadcast(broadcastEvent, data);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"light-error\", data._error_message);\n } else if (data.__all__) {\n return $confirm.notify(\"light-error\", data.__all__[0]);\n }\n });\n };\n })(this));\n remove = function() {\n var message, title;\n title = $translate.instant(\"LIGHTBOX.DELETE_SPRINT.TITLE\");\n message = $scope.sprint.name;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSuccess;\n onSuccess = function() {\n askResponse.finish();\n $scope.milestonesCounter -= 1;\n lightboxService.close($el);\n return $rootscope.$broadcast(\"sprintform:remove:success\", $scope.sprint);\n };\n onError = function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove($scope.sprint).then(onSuccess, onError);\n };\n })(this));\n };\n getLastSprint = function() {\n var openSprints, sortedSprints;\n openSprints = _.filter($scope.sprints, function(sprint) {\n return !sprint.closed;\n });\n sortedSprints = _.sortBy(openSprints, function(sprint) {\n return moment(sprint.estimated_finish, 'YYYY-MM-DD').format('X');\n });\n return sortedSprints[sortedSprints.length - 1];\n };\n $scope.$on(\"sprintform:create\", function(event, projectId) {\n var estimatedFinish, estimatedStart, lastSprint, lastSprintNameDom, prettyDate, text;\n resetSprint();\n form = $el.find(\"form\").checksley();\n form.reset();\n createSprint = true;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n $scope.sprint.project = projectId;\n $scope.sprint.name = null;\n $scope.sprint.slug = null;\n lastSprint = getLastSprint();\n estimatedStart = moment();\n if (lastSprint) {\n estimatedStart = moment(lastSprint.estimated_finish);\n } else if ($scope.sprint.estimated_start) {\n estimatedStart = moment($scope.sprint.estimated_start);\n }\n $scope.sprint.estimated_start = estimatedStart.format(prettyDate);\n estimatedFinish = moment().add(2, \"weeks\");\n if (lastSprint) {\n estimatedFinish = moment(lastSprint.estimated_finish).add(2, \"weeks\");\n } else if ($scope.sprint.estimated_finish) {\n estimatedFinish = moment($scope.sprint.estimated_finish);\n }\n $scope.sprint.estimated_finish = estimatedFinish.format(prettyDate);\n lastSprintNameDom = $el.find(\".last-sprint-name\");\n if ((lastSprint != null ? lastSprint.name : void 0) != null) {\n text = $translate.instant(\"LIGHTBOX.ADD_EDIT_SPRINT.LAST_SPRINT_NAME\", {\n lastSprint: lastSprint.name\n });\n lastSprintNameDom.html(text);\n }\n $el.find(\".delete-sprint\").addClass(\"hidden\");\n text = $translate.instant(\"LIGHTBOX.ADD_EDIT_SPRINT.TITLE\");\n $el.find(\".title\").text(text);\n text = $translate.instant(\"COMMON.CREATE\");\n $el.find(\".button-green\").text(text);\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus();\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n });\n $scope.$on(\"sprintform:edit\", function(ctx, sprint) {\n var editSprint, prettyDate, save;\n resetSprint();\n createSprint = false;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n $scope.$apply(function() {\n $scope.sprint = sprint;\n $scope.sprint.estimated_start = moment($scope.sprint.estimated_start).format(prettyDate);\n return $scope.sprint.estimated_finish = moment($scope.sprint.estimated_finish).format(prettyDate);\n });\n $el.find(\".delete-sprint\").removeClass(\"hidden\");\n editSprint = $translate.instant(\"BACKLOG.EDIT_SPRINT\");\n $el.find(\".title\").text(editSprint);\n save = $translate.instant(\"COMMON.SAVE\");\n $el.find(\".button-green\").text(save);\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus().select();\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n });\n $el.on(\"keyup\", \".sprint-name\", function(event) {\n if ($el.find(\".sprint-name\").val().length > 0 || hasErrors) {\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n } else {\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n }\n });\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".delete-sprint\", function(event) {\n event.preventDefault();\n return remove();\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return resetSprint();\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateEditSprint\", [\"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$translate\", CreateEditSprint]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/main.coffee\n */\n\n(function() {\n var BacklogController, BacklogDirective, BurndownBacklogGraphDirective, TgBacklogProgressBarDirective, ToggleBurndownVisibility, UsPointsDirective, UsRolePointsSelectorDirective, bindMethods, bindOnce, generateHash, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n generateHash = this.taiga.generateHash;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogController = (function(superClass) {\n extend(BacklogController, superClass);\n\n BacklogController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\", \"$tgLoading\", \"tgResources\"];\n\n function BacklogController(scope1, rootscope, repo, confirm, rs, params1, q, location, appMetaService, navUrls, events, analytics, translate, loading, rs2) {\n var promise;\n this.scope = scope1;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params1;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n this.loading = loading;\n this.rs2 = rs2;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"BACKLOG.SECTION_NAME\");\n this.showTags = false;\n this.activeFilters = false;\n this.scope.showGraphPlaceholder = null;\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"BACKLOG.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"BACKLOG.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n _this.appMetaService.setAll(title, description);\n if (_this.rs.userstories.getShowTags(_this.scope.projectId)) {\n _this.showTags = true;\n return _this.scope.$broadcast(\"showTags\", _this.showTags);\n }\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n BacklogController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:create:success\", (function(_this) {\n return function() {\n _this.loadSprints();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"sprint\", \"create\", \"create sprint on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n _this.rootscope.$broadcast(\"filters:update\");\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:edit:success\", (function(_this) {\n return function() {\n return _this.loadProjectStats();\n };\n })(this));\n this.scope.$on(\"sprintform:remove:success\", (function(_this) {\n return function(event, sprint) {\n _this.loadSprints();\n _this.loadProjectStats();\n _this.loadUserstories();\n if (sprint.closed) {\n _this.loadClosedSprints();\n }\n return _this.rootscope.$broadcast(\"filters:update\");\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.rootscope.$broadcast(\"filters:update\");\n };\n })(this));\n this.scope.$on(\"sprint:us:move\", this.moveUs);\n this.scope.$on(\"sprint:us:moved\", this.loadSprints);\n this.scope.$on(\"sprint:us:moved\", this.loadProjectStats);\n this.scope.$on(\"backlog:load-closed-sprints\", this.loadClosedSprints);\n return this.scope.$on(\"backlog:unload-closed-sprints\", this.unloadClosedSprints);\n };\n\n BacklogController.prototype.initializeSubscription = function() {\n var routingKey1, routingKey2;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.loadUserstories();\n return _this.loadSprints();\n };\n })(this));\n routingKey2 = \"changes.project.\" + this.scope.projectId + \".milestones\";\n return this.events.subscribe(this.scope, routingKey2, (function(_this) {\n return function(message) {\n return _this.loadSprints();\n };\n })(this));\n };\n\n BacklogController.prototype.toggleShowTags = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n _this.showTags = !_this.showTags;\n return _this.rs.userstories.storeShowTags(_this.scope.projectId, _this.showTags);\n };\n })(this));\n };\n\n BacklogController.prototype.toggleActiveFilters = function() {\n return this.activeFilters = !this.activeFilters;\n };\n\n BacklogController.prototype.loadProjectStats = function() {\n return this.rs.projects.stats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n var totalPoints;\n _this.scope.stats = stats;\n totalPoints = stats.total_points ? stats.total_points : stats.defined_points;\n if (totalPoints) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.closed_points / totalPoints);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n _this.scope.showGraphPlaceholder = !((stats.total_points != null) && (stats.total_milestones != null));\n return stats;\n };\n })(this));\n };\n\n BacklogController.prototype.unloadClosedSprints = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n _this.scope.closedSprints = [];\n return _this.rootscope.$broadcast(\"closed-sprints:reloaded\", []);\n };\n })(this));\n };\n\n BacklogController.prototype.loadClosedSprints = function() {\n var params;\n params = {\n closed: true\n };\n return this.rs.sprints.list(this.scope.projectId, params).then((function(_this) {\n return function(result) {\n var j, len, sprint, sprints;\n sprints = result.milestones;\n _this.scope.totalClosedMilestones = result.closed;\n for (j = 0, len = sprints.length; j < len; j++) {\n sprint = sprints[j];\n sprint.user_stories = _.sortBy(sprint.user_stories, \"sprint_order\");\n }\n _this.scope.closedSprints = sprints;\n _this.scope.closedSprintsById = groupBy(sprints, function(x) {\n return x.id;\n });\n _this.rootscope.$broadcast(\"closed-sprints:reloaded\", sprints);\n return sprints;\n };\n })(this));\n };\n\n BacklogController.prototype.loadSprints = function() {\n var params;\n params = {\n closed: false\n };\n return this.rs.sprints.list(this.scope.projectId, params).then((function(_this) {\n return function(result) {\n var j, len, sprint, sprints;\n sprints = result.milestones;\n _this.scope.totalMilestones = sprints;\n _this.scope.totalClosedMilestones = result.closed;\n _this.scope.totalOpenMilestones = result.open;\n _this.scope.totalMilestones = _this.scope.totalOpenMilestones + _this.scope.totalClosedMilestones;\n for (j = 0, len = sprints.length; j < len; j++) {\n sprint = sprints[j];\n sprint.user_stories = _.sortBy(sprint.user_stories, \"sprint_order\");\n }\n _this.scope.sprints = sprints;\n _this.scope.openSprints = _.filter(sprints, function(sprint) {\n return !sprint.closed;\n }).reverse();\n if (!_this.scope.closedSprints) {\n _this.scope.closedSprints = [];\n }\n _this.scope.sprintsCounter = sprints.length;\n _this.scope.sprintsById = groupBy(sprints, function(x) {\n return x.id;\n });\n _this.rootscope.$broadcast(\"sprints:loaded\", sprints);\n _this.scope.currentSprint = _this.findCurrentSprint();\n return sprints;\n };\n })(this));\n };\n\n BacklogController.prototype.restoreFilters = function() {\n var selectedStatuses, selectedTags;\n selectedTags = this.scope.oldSelectedTags;\n selectedStatuses = this.scope.oldSelectedStatuses;\n if (!selectedStatuses && !selectedStatuses) {\n return;\n }\n this.scope.filtersQ = this.scope.filtersQOld;\n this.replaceFilter(\"q\", this.scope.filtersQ);\n _.each([selectedTags, selectedStatuses], (function(_this) {\n return function(filterGrp) {\n return _.each(filterGrp, function(item) {\n var filter, filters;\n filters = _this.scope.filters[item.type];\n filter = _.find(filters, {\n id: item.id\n });\n filter.selected = true;\n return _this.selectFilter(item.type, item.id);\n });\n };\n })(this));\n return this.loadUserstories();\n };\n\n BacklogController.prototype.resetFilters = function() {\n var selectedStatuses, selectedTags;\n selectedTags = _.filter(this.scope.filters.tags, \"selected\");\n selectedStatuses = _.filter(this.scope.filters.status, \"selected\");\n this.scope.oldSelectedTags = selectedTags;\n this.scope.oldSelectedStatuses = selectedStatuses;\n this.scope.filtersQOld = this.scope.filtersQ;\n this.scope.filtersQ = void 0;\n this.replaceFilter(\"q\", this.scope.filtersQ);\n _.each([selectedTags, selectedStatuses], (function(_this) {\n return function(filterGrp) {\n return _.each(filterGrp, function(item) {\n var filter, filters;\n filters = _this.scope.filters[item.type];\n filter = _.find(filters, {\n id: item.id\n });\n filter.selected = false;\n return _this.unselectFilter(item.type, item.id);\n });\n };\n })(this));\n return this.loadUserstories();\n };\n\n BacklogController.prototype.loadUserstories = function() {\n var promise;\n this.scope.httpParams = this.getUrlFilters();\n this.rs.userstories.storeQueryParams(this.scope.projectId, this.scope.httpParams);\n promise = this.rs.userstories.listUnassigned(this.scope.projectId, this.scope.httpParams);\n return promise.then((function(_this) {\n return function(userstories) {\n _this.scope.userstories = _.sortBy(userstories, \"backlog_order\");\n _this.setSearchDataFilters();\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\");\n });\n return userstories;\n };\n })(this));\n };\n\n BacklogController.prototype.loadBacklog = function() {\n return this.q.all([this.loadProjectStats(), this.loadSprints(), this.loadUserstories()]);\n };\n\n BacklogController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_backlog_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.closedMilestones = !!project.total_closed_milestones;\n _this.scope.$emit('project:loaded', project);\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"id\");\n return project;\n };\n })(this));\n };\n\n BacklogController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.initializeSubscription();\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadBacklog();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.generateFilters();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.scope.$emit(\"backlog:loaded\");\n };\n })(this));\n };\n\n BacklogController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"backlog_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n BacklogController.prototype.resortUserStories = function(uses, field) {\n var index, item, items, j, len;\n if (field == null) {\n field = \"backlog_order\";\n }\n items = [];\n for (index = j = 0, len = uses.length; j < len; index = ++j) {\n item = uses[index];\n item[field] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n BacklogController.prototype.moveUs = function(ctx, usList, newUsIndex, newSprintId) {\n var data, items, j, l, len, len1, len2, m, movedFromClosedSprint, movedToClosedSprint, newSprint, oldSprintId, project, promise, promises, sprint, us, userstories;\n oldSprintId = usList[0].milestone;\n project = usList[0].project;\n movedFromClosedSprint = false;\n movedToClosedSprint = false;\n sprint = this.scope.sprintsById[oldSprintId];\n if (!sprint && this.scope.closedSprintsById) {\n sprint = this.scope.closedSprintsById[oldSprintId];\n if (sprint) {\n movedFromClosedSprint = true;\n }\n }\n newSprint = this.scope.sprintsById[newSprintId];\n if (!newSprint && newSprintId) {\n newSprint = this.scope.closedSprintsById[newSprintId];\n if (newSprint) {\n movedToClosedSprint = true;\n }\n }\n if (newSprintId === oldSprintId) {\n items = null;\n userstories = null;\n if (newSprintId === null) {\n userstories = this.scope.userstories;\n } else {\n userstories = newSprint.user_stories;\n }\n this.scope.$apply(function() {\n var args, j, key, len, r, us;\n for (key = j = 0, len = usList.length; j < len; key = ++j) {\n us = usList[key];\n r = userstories.indexOf(us);\n userstories.splice(r, 1);\n }\n args = [newUsIndex, 0].concat(usList);\n return Array.prototype.splice.apply(userstories, args);\n });\n if (newSprintId === null) {\n items = this.resortUserStories(userstories, \"backlog_order\");\n data = this.prepareBulkUpdateData(items, \"backlog_order\");\n this.rs.userstories.bulkUpdateBacklogOrder(project, data).then((function(_this) {\n return function() {\n var j, len, results, us;\n results = [];\n for (j = 0, len = usList.length; j < len; j++) {\n us = usList[j];\n results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return results;\n };\n })(this));\n } else {\n items = this.resortUserStories(userstories, \"sprint_order\");\n data = this.prepareBulkUpdateData(items, \"sprint_order\");\n this.rs.userstories.bulkUpdateSprintOrder(project, data).then((function(_this) {\n return function() {\n var j, len, results, us;\n results = [];\n for (j = 0, len = usList.length; j < len; j++) {\n us = usList[j];\n results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return results;\n };\n })(this));\n }\n return promise;\n }\n if (newSprintId === null) {\n for (j = 0, len = usList.length; j < len; j++) {\n us = usList[j];\n us.milestone = null;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, l, len1, r, results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(_this.scope.userstories, args);\n results = [];\n for (key = l = 0, len1 = usList.length; l < len1; key = ++l) {\n us = usList[key];\n r = sprint.user_stories.indexOf(us);\n results.push(sprint.user_stories.splice(r, 1));\n }\n return results;\n };\n })(this));\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n items = _this.resortUserStories(_this.scope.userstories, \"backlog_order\");\n data = _this.prepareBulkUpdateData(items, \"backlog_order\");\n return _this.rs.userstories.bulkUpdateBacklogOrder(us.project, data).then(function() {\n _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n if (movedFromClosedSprint) {\n return _this.rootscope.$broadcast(\"backlog:load-closed-sprints\");\n }\n });\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n }\n if (oldSprintId === null) {\n for (l = 0, len1 = usList.length; l < len1; l++) {\n us = usList[l];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, len2, m, r, results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n results = [];\n for (key = m = 0, len2 = usList.length; m < len2; key = ++m) {\n us = usList[key];\n r = _this.scope.userstories.indexOf(us);\n results.push(_this.scope.userstories.splice(r, 1));\n }\n return results;\n };\n })(this));\n } else {\n for (m = 0, len2 = usList.length; m < len2; m++) {\n us = usList[m];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, len3, n, r, results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n results = [];\n for (n = 0, len3 = usList.length; n < len3; n++) {\n us = usList[n];\n r = sprint.user_stories.indexOf(us);\n results.push(sprint.user_stories.splice(r, 1));\n }\n return results;\n };\n })(this));\n }\n promises = _.map(usList, (function(_this) {\n return function(us) {\n return _this.repo.save(us);\n };\n })(this));\n promise = this.q.all(promises).then((function(_this) {\n return function() {\n items = _this.resortUserStories(newSprint.user_stories, \"sprint_order\");\n data = _this.prepareBulkUpdateData(items, \"sprint_order\");\n _this.rs.userstories.bulkUpdateSprintOrder(project, data).then(function(result) {\n return _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n });\n _this.rs.userstories.bulkUpdateBacklogOrder(project, data).then(function() {\n var len3, n, results;\n results = [];\n for (n = 0, len3 = usList.length; n < len3; n++) {\n us = usList[n];\n results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return results;\n });\n if (movedToClosedSprint || movedFromClosedSprint) {\n return _this.scope.$broadcast(\"backlog:load-closed-sprints\");\n }\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n };\n\n BacklogController.prototype.isFilterSelected = function(type, id) {\n if ((this.searchdata[type] != null) && this.searchdata[type][id]) {\n return true;\n }\n return false;\n };\n\n BacklogController.prototype.setSearchDataFilters = function() {\n var name, results, urlfilters, val, value;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = this.scope.filtersQ || urlfilters.q;\n }\n this.searchdata = {};\n results = [];\n for (name in urlfilters) {\n value = urlfilters[name];\n if (this.searchdata[name] == null) {\n this.searchdata[name] = {};\n }\n results.push((function() {\n var j, len, ref1, results1;\n ref1 = taiga.toString(value).split(\",\");\n results1 = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n val = ref1[j];\n results1.push(this.searchdata[name][val] = true);\n }\n return results1;\n }).call(this));\n }\n return results;\n };\n\n BacklogController.prototype.getUrlFilters = function() {\n return _.pick(this.location.search(), \"status\", \"tags\", \"q\");\n };\n\n BacklogController.prototype.generateFilters = function() {\n var loadFilters, urlfilters;\n urlfilters = this.getUrlFilters();\n this.scope.filters = {};\n loadFilters = {};\n loadFilters.project = this.scope.projectId;\n loadFilters.tags = urlfilters.tags;\n loadFilters.status = urlfilters.status;\n loadFilters.q = urlfilters.q;\n loadFilters.milestone = 'null';\n return this.rs.userstories.filtersData(loadFilters).then((function(_this) {\n return function(data) {\n var choicesFiltersFormat, selectedStatuses, selectedTags, tagsFilterFormat;\n choicesFiltersFormat = function(choices, type, byIdObject) {\n return _.map(choices, function(t) {\n t.type = type;\n return t;\n });\n };\n tagsFilterFormat = function(tags) {\n return _.map(tags, function(t) {\n t.id = t.name;\n t.type = 'tags';\n return t;\n });\n };\n _this.scope.filters.status = choicesFiltersFormat(data.statuses, \"status\", _this.scope.usStatusById);\n _this.scope.filters.tags = tagsFilterFormat(data.tags);\n selectedTags = _.filter(_this.scope.filters.tags, \"selected\");\n selectedTags = _.map(selectedTags, \"id\");\n selectedStatuses = _.filter(_this.scope.filters.status, \"selected\");\n selectedStatuses = _.map(selectedStatuses, \"id\");\n _this.markSelectedFilters(_this.scope.filters, urlfilters);\n return _this.rs.userstories.storeQueryParams(_this.scope.projectId, {\n \"status\": selectedStatuses,\n \"tags\": selectedTags,\n \"project\": _this.scope.projectId,\n \"milestone\": null\n });\n };\n })(this));\n };\n\n BacklogController.prototype.markSelectedFilters = function(filters, urlfilters) {\n var isSelected, j, key, len, name, obj, ref1, ref2, results, searchdata, val, value;\n searchdata = {};\n ref1 = _.omit(urlfilters, \"page\", \"orderBy\");\n for (name in ref1) {\n value = ref1[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n ref2 = (\"\" + value).split(\",\");\n for (j = 0, len = ref2.length; j < len; j++) {\n val = ref2[j];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n results = [];\n for (key in filters) {\n value = filters[key];\n results.push((function() {\n var l, len1, results1;\n results1 = [];\n for (l = 0, len1 = value.length; l < len1; l++) {\n obj = value[l];\n results1.push(obj.selected = isSelected(obj.type, obj.id) ? true : void 0);\n }\n return results1;\n })());\n }\n return results;\n };\n\n BacklogController.prototype.updateUserStoryStatus = function() {\n this.setSearchDataFilters();\n return this.generateFilters().then((function(_this) {\n return function() {\n _this.rootscope.$broadcast(\"filters:update\");\n return _this.loadProjectStats();\n };\n })(this));\n };\n\n BacklogController.prototype.editUserStory = function(projectId, ref, $event) {\n var currentLoading, target;\n target = $($event.target);\n currentLoading = this.loading().target(target).removeClasses(\"edit-story\").timeout(200).start();\n return this.rs.userstories.getByRef(projectId, ref).then((function(_this) {\n return function(us) {\n return _this.rs2.attachments.list(\"us\", us.id, projectId).then(function(attachments) {\n _this.rootscope.$broadcast(\"usform:edit\", us, attachments.toJS());\n return currentLoading.finish();\n });\n };\n })(this));\n };\n\n BacklogController.prototype.deleteUserStory = function(us) {\n var message, title;\n title = this.translate.instant(\"US.TITLE_DELETE_ACTION\");\n message = us.subject;\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var promise;\n _this.scope.userstories = _.without(_this.scope.userstories, us);\n promise = _this.repo.remove(us);\n promise.then(function() {\n askResponse.finish();\n return _this.loadBacklog();\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return _this.confirm.notify(\"error\");\n });\n };\n })(this));\n };\n\n BacklogController.prototype.addNewUs = function(type) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, this.scope.project.default_us_status, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, this.scope.project.default_us_status);\n }\n };\n\n BacklogController.prototype.addNewSprint = function() {\n return this.rootscope.$broadcast(\"sprintform:create\", this.scope.projectId);\n };\n\n BacklogController.prototype.findCurrentSprint = function() {\n var currentDate;\n currentDate = new Date().getTime();\n return _.find(this.scope.sprints, function(sprint) {\n var end, start;\n start = moment(sprint.estimated_start, 'YYYY-MM-DD').format('x');\n end = moment(sprint.estimated_finish, 'YYYY-MM-DD').format('x');\n return currentDate >= start && currentDate <= end;\n });\n };\n\n return BacklogController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BacklogController\", BacklogController);\n\n BacklogDirective = function($repo, $rootscope, $translate) {\n var doomLineTemplate, link, linkDoomLine, linkFilters, linkToolbar, showHideFilter, showHideTags;\n doomLineTemplate = _.template(\"
<%- text %>
\");\n linkDoomLine = function($scope, $el, $attrs, $ctrl) {\n var addDoomLineDom, getUsItems, reloadDoomLine, removeDoomlineDom;\n reloadDoomLine = function() {\n var current_sum, domElement, i, j, len, ref1, results, stats, total_points, us;\n if (($scope.stats != null) && ($scope.stats.total_points != null) && $scope.stats.total_points !== 0) {\n removeDoomlineDom();\n stats = $scope.stats;\n total_points = stats.total_points;\n current_sum = stats.assigned_points;\n if (!$scope.userstories) {\n return;\n }\n ref1 = $scope.userstories;\n results = [];\n for (i = j = 0, len = ref1.length; j < len; i = ++j) {\n us = ref1[i];\n current_sum += us.total_points;\n if (current_sum > total_points) {\n domElement = $el.find('.backlog-table-body .us-item-row')[i];\n addDoomLineDom(domElement);\n break;\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n };\n removeDoomlineDom = function() {\n return $el.find(\".doom-line\").remove();\n };\n addDoomLineDom = function(element) {\n var text;\n text = $translate.instant(\"BACKLOG.DOOMLINE\");\n return $(element).before(doomLineTemplate({\n \"text\": text\n }));\n };\n getUsItems = function() {\n var rowElements;\n rowElements = $el.find('.backlog-table-body .us-item-row');\n return _.map(rowElements, function(x) {\n return angular.element(x);\n });\n };\n $scope.$on(\"userstories:loaded\", reloadDoomLine);\n return $scope.$watch(\"stats\", reloadDoomLine);\n };\n linkToolbar = function($scope, $el, $attrs, $ctrl) {\n var checkSelected, getUsToMove, lastChecked, moveToCurrentSprint, moveToLatestSprint, moveUssToSprint, shiftPressed;\n getUsToMove = function() {\n var ussDom;\n ussDom = $el.find(\".backlog-table-body input:checkbox:checked\");\n return _.map(ussDom, function(item) {\n var itemScope;\n item = $(item).closest('.tg-scope');\n itemScope = item.scope();\n itemScope.us.milestone = $scope.sprints[0].id;\n return itemScope.us;\n });\n };\n moveUssToSprint = function(selectedUss, sprint) {\n var extraPoints, totalExtraPoints, ussCurrent;\n ussCurrent = _($scope.userstories);\n $scope.userstories = ussCurrent.without.apply(ussCurrent, selectedUss).value();\n extraPoints = _.map(selectedUss, function(v, k) {\n return v.total_points;\n });\n totalExtraPoints = _.reduce(extraPoints, function(acc, num) {\n return acc + num;\n });\n sprint.user_stories = _.union(sprint.user_stories, selectedUss);\n sprint.total_points += totalExtraPoints;\n $repo.saveAll(selectedUss).then(function() {\n $ctrl.loadSprints();\n return $ctrl.loadProjectStats();\n });\n return $el.find(\".move-to-sprint\").hide();\n };\n moveToCurrentSprint = function(selectedUss) {\n return moveUssToSprint(selectedUss, $scope.currentSprint);\n };\n moveToLatestSprint = function(selectedUss) {\n return moveUssToSprint(selectedUss, $scope.sprints[0]);\n };\n shiftPressed = false;\n lastChecked = null;\n checkSelected = function(target) {\n var moveToSprintDom, selectedUsDom;\n lastChecked = target.closest(\".us-item-row\");\n target.closest('.us-item-row').toggleClass('ui-multisortable-multiple');\n moveToSprintDom = $el.find(\".move-to-sprint\");\n selectedUsDom = $el.find(\".backlog-table-body input:checkbox:checked\");\n if (selectedUsDom.length > 0 && $scope.sprints.length > 0) {\n return moveToSprintDom.show();\n } else {\n return moveToSprintDom.hide();\n }\n };\n $(window).on(\"keydown.shift-pressed keyup.shift-pressed\", function(event) {\n shiftPressed = !!event.shiftKey;\n return true;\n });\n $el.on(\"change\", \".backlog-table-body input:checkbox\", function(event) {\n var current, elements, nextAll, prevAll, target;\n if (lastChecked && shiftPressed) {\n elements = [];\n current = $(event.currentTarget).closest(\".us-item-row\");\n nextAll = lastChecked.nextAll();\n prevAll = lastChecked.prevAll();\n if (_.some(nextAll, function(next) {\n return next === current[0];\n })) {\n elements = lastChecked.nextUntil(current);\n } else if (_.some(prevAll, function(prev) {\n return prev === current[0];\n })) {\n elements = lastChecked.prevUntil(current);\n }\n _.map(elements, function(elm) {\n var input;\n input = $(elm).find(\"input:checkbox\");\n input.prop('checked', true);\n return checkSelected(input);\n });\n }\n target = angular.element(event.currentTarget);\n target.closest(\".us-item-row\").toggleClass('is-checked');\n return checkSelected(target);\n });\n $el.on(\"click\", \"#move-to-latest-sprint\", (function(_this) {\n return function(event) {\n var ussToMove;\n ussToMove = getUsToMove();\n return $scope.$apply(_.partial(moveToLatestSprint, ussToMove));\n };\n })(this));\n $el.on(\"click\", \"#move-to-current-sprint\", (function(_this) {\n return function(event) {\n var ussToMove;\n ussToMove = getUsToMove();\n return $scope.$apply(_.partial(moveToCurrentSprint, ussToMove));\n };\n })(this));\n return $el.on(\"click\", \"#show-tags\", function(event) {\n event.preventDefault();\n $ctrl.toggleShowTags();\n return showHideTags($ctrl);\n });\n };\n showHideTags = function($ctrl) {\n var elm, text;\n elm = angular.element(\"#show-tags\");\n if ($ctrl.showTags) {\n elm.addClass(\"active\");\n text = $translate.instant(\"BACKLOG.TAGS.HIDE\");\n return elm.text(text);\n } else {\n elm.removeClass(\"active\");\n text = $translate.instant(\"BACKLOG.TAGS.SHOW\");\n return elm.text(text);\n }\n };\n showHideFilter = function($scope, $el, $ctrl) {\n var hideText, showText, sidebar, target;\n sidebar = $el.find(\"sidebar.filters-bar\");\n sidebar.one(\"transitionend\", function() {\n return timeout(150, function() {\n $rootscope.$broadcast(\"resize\");\n return $('.burndown').css(\"visibility\", \"visible\");\n });\n });\n target = angular.element(\"#show-filters-button\");\n $('.burndown').css(\"visibility\", \"hidden\");\n sidebar.toggleClass(\"active\");\n target.toggleClass(\"active\");\n hideText = $translate.instant(\"BACKLOG.FILTERS.HIDE\");\n showText = $translate.instant(\"BACKLOG.FILTERS.SHOW\");\n toggleText(target, [hideText, showText]);\n if (!sidebar.hasClass(\"active\")) {\n $ctrl.resetFilters();\n } else {\n $ctrl.restoreFilters();\n }\n return $ctrl.toggleActiveFilters();\n };\n linkFilters = function($scope, $el, $attrs, $ctrl) {\n $scope.filtersSearch = {};\n return $el.on(\"click\", \"#show-filters-button\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n return showHideFilter($scope, $el, $ctrl);\n });\n });\n };\n link = function($scope, $el, $attrs, $rootscope) {\n var $ctrl, filters;\n $ctrl = $el.controller();\n linkToolbar($scope, $el, $attrs, $ctrl);\n linkFilters($scope, $el, $attrs, $ctrl);\n linkDoomLine($scope, $el, $attrs, $ctrl);\n $el.find(\".backlog-table-body\").disableSelection();\n filters = $ctrl.getUrlFilters();\n if (filters.status || filters.tags || filters.q) {\n showHideFilter($scope, $el, $ctrl);\n }\n $scope.$on(\"showTags\", function() {\n return showHideTags($ctrl);\n });\n return $scope.$on(\"$destroy\", function() {\n $el.off();\n return $(window).off(\".shift-pressed\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklog\", [\"$tgRepo\", \"$rootScope\", \"$translate\", BacklogDirective]);\n\n UsRolePointsSelectorDirective = function($rootscope, $template, $compile, $translate) {\n var link, selectionTemplate;\n selectionTemplate = $template.get(\"backlog/us-role-points-popover.html\", true);\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var numberOfRoles, roles;\n roles = _.filter(project.roles, \"computable\");\n numberOfRoles = _.size(roles);\n if (numberOfRoles > 1) {\n return $el.append($compile(selectionTemplate({\n \"roles\": roles\n }))($scope));\n } else {\n $el.find(\".icon-arrow-bottom\").remove();\n return $el.find(\".header-points\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n $el.find(\".popover\").popover().close();\n return $el.find(\".header-points\").html(roleName + \"/Total\");\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx, roleId) {\n var text;\n $el.find(\".popover\").popover().close();\n text = $translate.instant(\"COMMON.FIELDS.POINTS\");\n return $el.find(\".header-points\").text(text);\n });\n $el.on(\"click\", function(event) {\n var target;\n target = angular.element(event.target);\n if (target.is(\"span\") || target.is(\"div\")) {\n event.stopPropagation();\n }\n return $el.find(\".popover\").popover().open();\n });\n $el.on(\"click\", \".clear-selection\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $rootscope.$broadcast(\"uspoints:clear-selection\");\n });\n $el.on(\"click\", \".role\", function(event) {\n var rolScope, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n rolScope = target.scope();\n return $rootscope.$broadcast(\"uspoints:select\", target.data(\"role-id\"), target.text());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsRolePointsSelector\", [\"$rootScope\", \"$tgTemplate\", \"$compile\", \"$translate\", UsRolePointsSelectorDirective]);\n\n UsPointsDirective = function($tgEstimationsService, $repo, $tgTemplate) {\n var link, rolesTemplate;\n rolesTemplate = $tgTemplate.get(\"common/estimation/us-points-roles-popover.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, bindClickElements, estimationProcess, filteringRoleId, renderRolesSelector, selectedRoleId, updatingSelectedRoleId;\n $ctrl = $el.controller();\n updatingSelectedRoleId = null;\n selectedRoleId = null;\n filteringRoleId = null;\n estimationProcess = null;\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n var us;\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n selectedRoleId = roleId;\n return estimationProcess.render();\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx) {\n var us;\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n selectedRoleId = null;\n return estimationProcess.render();\n });\n $scope.$watch($attrs.tgBacklogUsPoints, function(us) {\n var roles;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n roles = estimationProcess.calculateRoles();\n if (roles.length === 0) {\n $el.find(\".icon-arrow-bottom\").remove();\n $el.find(\"a.us-points\").addClass(\"not-clickable\");\n } else if (roles.length === 1) {\n selectedRoleId = _.keys(us.points)[0];\n }\n if (estimationProcess.isEditable) {\n bindClickElements();\n }\n estimationProcess.onSelectedPointForRole = function(roleId, pointId) {\n return this.save(roleId, pointId).then(function() {\n return $ctrl.loadProjectStats();\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, pointId, pointObj, template, text, title, totalPoints;\n totalPoints = this.calculateTotalPoints();\n if ((selectedRoleId == null) || roles.length === 1) {\n text = totalPoints;\n title = totalPoints;\n } else {\n pointId = this.us.points[selectedRoleId];\n pointObj = this.pointsById[pointId];\n text = pointObj.name + \" / \" + totalPoints + \"\";\n title = pointObj.name + \" / \" + totalPoints;\n }\n ctx = {\n totalPoints: totalPoints,\n roles: this.calculateRoles(),\n editable: this.isEditable,\n text: text,\n title: title\n };\n mainTemplate = \"common/estimation/us-estimation-total.html\";\n template = $tgTemplate.get(mainTemplate, true);\n html = template(ctx);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n renderRolesSelector = function() {\n var html, roles;\n roles = estimationProcess.calculateRoles();\n html = rolesTemplate({\n \"roles\": roles\n });\n $el.append(html);\n return $el.find(\".pop-role\").popover().open(function() {\n return $(this).remove();\n });\n };\n bindClickElements = function() {\n $el.on(\"click\", \"a.us-points\", function(event) {\n var us;\n event.preventDefault();\n event.stopPropagation();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = selectedRoleId;\n if (selectedRoleId != null) {\n return estimationProcess.renderPointsSelector(selectedRoleId);\n } else {\n return renderRolesSelector();\n }\n });\n return $el.on(\"click\", \".role\", function(event) {\n var popRolesDom, target, us;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = target.data(\"role-id\");\n popRolesDom = $el.find(\".pop-role\");\n popRolesDom.find(\"a\").removeClass(\"active\");\n popRolesDom.find(\"a[data-role-id='\" + updatingSelectedRoleId + \"']\").addClass(\"active\");\n return estimationProcess.renderPointsSelector(updatingSelectedRoleId);\n });\n };\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogUsPoints\", [\"$tgEstimationsService\", \"$tgRepo\", \"$tgTemplate\", UsPointsDirective]);\n\n ToggleBurndownVisibility = function($storage) {\n var hide, link, show;\n hide = function() {\n $(\".js-burndown-graph\").removeClass(\"shown\");\n $(\".js-toggle-burndown-visibility-button\").removeClass(\"active\");\n return $(\".js-burndown-graph\").removeClass(\"open\");\n };\n show = function(firstLoad) {\n $(\".js-toggle-burndown-visibility-button\").addClass(\"active\");\n if (firstLoad) {\n return $(\".js-burndown-graph\").addClass(\"shown\");\n } else {\n return $(\".js-burndown-graph\").addClass(\"open\");\n }\n };\n link = function($scope, $el, $attrs) {\n var firstLoad, hash, toggleGraph;\n firstLoad = true;\n hash = generateHash([\"is-burndown-grpahs-collapsed\"]);\n $scope.isBurndownGraphCollapsed = $storage.get(hash) || false;\n toggleGraph = function() {\n if ($scope.isBurndownGraphCollapsed) {\n hide(firstLoad);\n } else {\n show(firstLoad);\n }\n return firstLoad = false;\n };\n $scope.$watch(\"showGraphPlaceholder\", function() {\n if ($scope.showGraphPlaceholder != null) {\n $scope.isBurndownGraphCollapsed = $scope.isBurndownGraphCollapsed || $scope.showGraphPlaceholder;\n return toggleGraph();\n }\n });\n $el.on(\"click\", \".js-toggle-burndown-visibility-button\", function() {\n $scope.isBurndownGraphCollapsed = !$scope.isBurndownGraphCollapsed;\n $storage.set(hash, $scope.isBurndownGraphCollapsed);\n return toggleGraph();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgToggleBurndownVisibility\", [\"$tgStorage\", ToggleBurndownVisibility]);\n\n BurndownBacklogGraphDirective = function($translate) {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var client_increment_line, colors, data, evolution_line, j, milestonesRange, optimal_line, options, ref1, results, team_increment_line, width, zero_line;\n width = element.width();\n element.height(width / 6);\n milestonesRange = (function() {\n results = [];\n for (var j = 0, ref1 = dataToDraw.milestones.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; 0 <= ref1 ? j++ : j--){ results.push(j); }\n return results;\n }).apply(this);\n data = [];\n zero_line = _.map(dataToDraw.milestones, function(ml) {\n return 0;\n });\n data.push({\n data: _.zip(milestonesRange, zero_line),\n lines: {\n fillColor: \"rgba(0,0,0,0)\"\n },\n points: {\n show: false\n }\n });\n optimal_line = _.map(dataToDraw.milestones, function(ml) {\n return ml.optimal;\n });\n data.push({\n data: _.zip(milestonesRange, optimal_line),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n evolution_line = _.filter(_.map(dataToDraw.milestones, function(ml) {\n return ml.evolution;\n }), function(evolution) {\n return evolution != null;\n });\n data.push({\n data: _.zip(milestonesRange, evolution_line),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n client_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"] - ml[\"client-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, client_increment_line),\n lines: {\n fillColor: \"rgba(255,51,51,0.3)\"\n }\n });\n team_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, team_increment_line),\n lines: {\n fillColor: \"rgba(153,51,51,0.3)\"\n }\n });\n colors = [\"rgba(0,0,0,1)\", \"rgba(120,120,120,0.2)\", \"rgba(102,153,51,1)\", \"rgba(153,51,51,1)\", \"rgba(255,51,51,1)\"];\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: \"#ccc\",\n hoverable: true\n },\n xaxis: {\n ticks: dataToDraw.milestones.length,\n axisLabel: $translate.instant(\"BACKLOG.CHART.XAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: \"Verdana, Arial, Helvetica, Tahoma, sans-serif\",\n axisLabelPadding: 5,\n tickFormatter: function(val, axis) {\n return \"\";\n }\n },\n yaxis: {\n axisLabel: $translate.instant(\"BACKLOG.CHART.YAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: \"Verdana, Arial, Helvetica, Tahoma, sans-serif\",\n axisLabelPadding: 5\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: colors,\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n var ctx;\n if (flotItem.seriesIndex === 1) {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.OPTIMAL\", ctx);\n } else if (flotItem.seriesIndex === 2) {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.REAL\", ctx);\n } else if (flotItem.seriesIndex === 3) {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.INCREMENT_CLIENT\", ctx);\n } else {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.INCREMENT_TEAM\", ctx);\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch(\"stats\", function(value) {\n if ($scope.stats != null) {\n redrawChart(element, $scope.stats);\n return $scope.$on(\"resize\", function() {\n return redrawChart(element, $scope.stats);\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBurndownBacklogGraph\", [\"$translate\", BurndownBacklogGraphDirective]);\n\n TgBacklogProgressBarDirective = function($template, $compile) {\n var adjustPercentaje, link, render, template;\n template = $template.get(\"backlog/progress-bar.html\", true);\n render = function(scope, el, projectPointsPercentaje, closedPointsPercentaje) {\n var html;\n html = template({\n projectPointsPercentaje: projectPointsPercentaje,\n closedPointsPercentaje: closedPointsPercentaje\n });\n html = $compile(html)(scope);\n return el.html(html);\n };\n adjustPercentaje = function(percentage) {\n var adjusted;\n adjusted = _.max([0, percentage]);\n adjusted = _.min([100, adjusted]);\n return Math.round(adjusted);\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch($attrs.tgBacklogProgressBar, function(stats) {\n var closedPoints, closedPointsPercentaje, definedPoints, projectPointsPercentaje, totalPoints;\n if (stats != null) {\n totalPoints = stats.total_points ? stats.total_points : stats.defined_points;\n definedPoints = stats.defined_points;\n closedPoints = stats.closed_points;\n if (definedPoints > totalPoints) {\n projectPointsPercentaje = totalPoints * 100 / definedPoints;\n closedPointsPercentaje = closedPoints * 100 / definedPoints;\n } else {\n projectPointsPercentaje = 100;\n closedPointsPercentaje = closedPoints * 100 / totalPoints;\n }\n projectPointsPercentaje = adjustPercentaje(projectPointsPercentaje - 3);\n closedPointsPercentaje = adjustPercentaje(closedPointsPercentaje - 3);\n return render($scope, $el, projectPointsPercentaje, closedPointsPercentaje);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogProgressBar\", [\"$tgTemplate\", \"$compile\", TgBacklogProgressBarDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/sortable.coffee\n */\n\n(function() {\n var BacklogEmptySortableDirective, BacklogSortableDirective, SprintSortableDirective, bindOnce, deleteElement, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n deleteElement = function(el) {\n el.scope().$destroy();\n el.off();\n return el.remove();\n };\n\n BacklogSortableDirective = function($repo, $rs, $rootscope, $tgConfirm, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var getUsIndex;\n getUsIndex = (function(_this) {\n return function(us) {\n return $(us).index(\".backlog-table-body .row\");\n };\n })(this);\n bindOnce($scope, \"project\", function(project) {\n var filterError;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n filterError = function() {\n var text;\n text = $translate.instant(\"BACKLOG.SORTABLE_FILTER_ERROR\");\n return $tgConfirm.notify(\"error\", text);\n };\n $el.sortable({\n items: \".us-item-row\",\n cancel: \".popover\",\n connectWith: \".sprint\",\n dropOnEmpty: true,\n placeholder: \"row us-item-row us-item-drag sortable-placeholder\",\n scroll: true,\n disableHorizontalScroll: true,\n tolerance: \"pointer\",\n revert: false,\n start: function() {\n return $(document.body).addClass(\"drag-active\");\n },\n stop: function() {\n $(document.body).removeClass(\"drag-active\");\n if ($el.hasClass(\"active-filters\")) {\n $el.sortable(\"cancel\");\n return filterError();\n }\n }\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n if ($el.hasClass(\"active-filters\")) {\n ui.source.sortable(\"cancel\");\n filterError();\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = getUsIndex(ui.item);\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var index, items, us;\n if ($(ui.items[0]).parent().length === 0) {\n return;\n }\n if ($el.hasClass(\"active-filters\")) {\n return;\n }\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return getUsIndex(item);\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n setTimeout(((function(_this) {\n return function() {\n return item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, null);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n BacklogEmptySortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n items: \".us-item-row\",\n dropOnEmpty: true\n });\n return $el.on(\"sortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n SprintSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n scroll: true,\n dropOnEmpty: true,\n items: \".sprint-table .milestone-us-item-row\",\n disableHorizontalScroll: true,\n connectWith: \".sprint,.backlog-table-body,.empty-backlog\",\n placeholder: \"row us-item-row sortable-placeholder\",\n forcePlaceholderSize: true\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var index, items, us;\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return $(item).index();\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n deleteElement(item);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, $scope.sprint.id);\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var itemIndex, itemUs;\n if (ui.item.parent().length === 0) {\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n setTimeout(((function(_this) {\n return function() {\n return ui.item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, $scope.sprint.id);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgConfirm\", \"$translate\", BacklogSortableDirective]);\n\n module.directive(\"tgBacklogEmptySortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", BacklogEmptySortableDirective]);\n\n module.directive(\"tgSprintSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", SprintSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/sprints.coffee\n */\n\n(function() {\n var BacklogSprintDirective, BacklogSprintHeaderDirective, ToggleExcludeClosedSprintsVisualization, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogSprintDirective = function($repo, $rootscope) {\n var link, slideOptions, sprintTableMinHeight, toggleSprint;\n sprintTableMinHeight = 50;\n slideOptions = {\n duration: 500,\n easing: 'linear'\n };\n toggleSprint = (function(_this) {\n return function($el) {\n var sprintArrow, sprintTable;\n sprintTable = $el.find(\".sprint-table\");\n sprintArrow = $el.find(\".compact-sprint\");\n sprintArrow.toggleClass('active');\n return sprintTable.toggleClass('open');\n };\n })(this);\n link = function($scope, $el, $attrs) {\n $scope.$watch($attrs.tgBacklogSprint, function(sprint) {\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n if (sprint.closed) {\n return $el.addClass(\"sprint-closed\");\n } else {\n return toggleSprint($el);\n }\n });\n $el.on(\"click\", \".sprint-name > .compact-sprint\", function(event) {\n event.preventDefault();\n toggleSprint($el);\n return $el.find(\".sprint-table\").slideToggle(slideOptions);\n });\n $el.on(\"click\", \".sprint-name > .icon-edit\", function(event) {\n var sprint;\n event.preventDefault();\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n return $rootscope.$broadcast(\"sprintform:edit\", sprint);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSprint\", [\"$tgRepo\", \"$rootScope\", BacklogSprintDirective]);\n\n BacklogSprintHeaderDirective = function($navUrls, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"backlog/sprint-header.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, isVisible, prettyDate, render;\n prettyDate = $translate.instant(\"BACKLOG.SPRINTS.DATE\");\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_milestone\") !== -1;\n };\n isVisible = function() {\n return $scope.project.my_permissions.indexOf(\"view_milestones\") !== -1;\n };\n render = function(sprint) {\n var compiledTemplate, ctx, estimatedDateRange, finish, start, taskboardUrl, templateScope;\n taskboardUrl = $navUrls.resolve(\"project-taskboard\", {\n project: $scope.project.slug,\n sprint: sprint.slug\n });\n start = moment(sprint.estimated_start).format(prettyDate);\n finish = moment(sprint.estimated_finish).format(prettyDate);\n estimatedDateRange = start + \"-\" + finish;\n ctx = {\n name: sprint.name,\n taskboardUrl: taskboardUrl,\n estimatedDateRange: estimatedDateRange,\n closedPoints: sprint.closed_points || 0,\n totalPoints: sprint.total_points || 0,\n isVisible: isVisible(),\n isEditable: isEditable()\n };\n templateScope = $scope.$new();\n _.assign(templateScope, ctx);\n compiledTemplate = $compile(template)(templateScope);\n return $el.html(compiledTemplate);\n };\n $scope.$watch($attrs.ngModel, function(sprint) {\n return render(sprint);\n });\n $scope.$on(\"sprintform:edit:success\", function() {\n return render($model.$modelValue);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgBacklogSprintHeader\", [\"$tgNavUrls\", \"$tgTemplate\", \"$compile\", \"$translate\", BacklogSprintHeaderDirective]);\n\n ToggleExcludeClosedSprintsVisualization = function($rootscope, $loading, $translate) {\n var excludeClosedSprints, link;\n excludeClosedSprints = true;\n link = function($scope, $el, $attrs) {\n var currentLoading, loadingElm;\n loadingElm = $(\"
\");\n $el.after(loadingElm);\n currentLoading = null;\n $el.on(\"click\", function(event) {\n event.preventDefault();\n excludeClosedSprints = !excludeClosedSprints;\n currentLoading = $loading().target(loadingElm).start();\n if (excludeClosedSprints) {\n return $rootscope.$broadcast(\"backlog:unload-closed-sprints\");\n } else {\n return $rootscope.$broadcast(\"backlog:load-closed-sprints\");\n }\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $scope.$on(\"closed-sprints:reloaded\", (function(_this) {\n return function(ctx, sprints) {\n var key, text;\n currentLoading.finish();\n if (sprints.length > 0) {\n key = \"BACKLOG.SPRINTS.ACTION_HIDE_CLOSED_SPRINTS\";\n } else {\n key = \"BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS\";\n }\n text = $translate.instant(key);\n return $el.find(\".text\").text(text);\n };\n })(this));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogToggleClosedSprintsVisualization\", [\"$rootScope\", \"$tgLoading\", \"$translate\", ToggleExcludeClosedSprintsVisualization]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard/charts.coffee\n */\n\n(function() {\n var SprintGraphDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaTaskboard\");\n\n SprintGraphDirective = function($translate) {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var data, days, options, width;\n width = element.width();\n element.height(240);\n days = _.map(dataToDraw, function(x) {\n return moment(x.day);\n });\n data = [];\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.optimal_points;\n })),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.open_points;\n })),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: '#ccc',\n hoverable: true\n },\n xaxis: {\n tickSize: [1, \"day\"],\n min: days[0],\n max: _.last(days),\n mode: \"time\",\n daysNames: days,\n axisLabel: $translate.instant(\"TASKBOARD.CHARTS.XAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',\n axisLabelPadding: 5\n },\n yaxis: {\n min: 0,\n axisLabel: $translate.instant(\"TASKBOARD.CHARTS.YAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',\n axisLabelPadding: 5\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: [\"rgba(102,153,51,1)\", \"rgba(120,120,120,0.2)\"],\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n var formattedDate, roundedValue;\n formattedDate = moment(xval).format($translate.instant(\"TASKBOARD.CHARTS.DATE\"));\n roundedValue = Math.round(yval);\n if (flotItem.seriesIndex === 1) {\n return $translate.instant(\"TASKBOARD.CHARTS.OPTIMAL\", {\n formattedDate: formattedDate,\n roundedValue: roundedValue\n });\n } else {\n return $translate.instant(\"TASKBOARD.CHARTS.REAL\", {\n formattedDate: formattedDate,\n roundedValue: roundedValue\n });\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$on(\"resize\", function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n $scope.$on(\"taskboard:graph:toggle-visibility\", function() {\n $el.parent().toggleClass('open');\n return timeout(100, function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n });\n $scope.$watch('stats', function(value) {\n if ($scope.stats == null) {\n return;\n }\n return redrawChart(element, $scope.stats.days);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintGraph\", [\"$translate\", SprintGraphDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkTasksDirective, CreateEditTaskDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n CreateEditTaskDirective = function($repo, $model, $rs, $rootscope, $loading, lightboxService, $translate, $q, attachmentsService) {\n var link;\n link = function($scope, $el, attrs) {\n var attachmentsToAdd, attachmentsToDelete, createAttachments, deleteAttachments, resetAttachments, submit, submitButton;\n $scope.isNew = true;\n attachmentsToAdd = Immutable.List();\n attachmentsToDelete = Immutable.List();\n resetAttachments = function() {\n attachmentsToAdd = Immutable.List();\n return attachmentsToDelete = Immutable.List();\n };\n $scope.addAttachment = function(attachment) {\n return attachmentsToAdd = attachmentsToAdd.push(attachment);\n };\n $scope.deleteAttachment = function(attachment) {\n return attachmentsToDelete = attachmentsToDelete.push(attachment);\n };\n createAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToAdd.toJS(), function(attachment) {\n return attachmentsService.upload(attachment.file, obj.id, $scope.task.project, 'task');\n });\n return $q.all(promises);\n };\n deleteAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToDelete.toJS(), function(attachment) {\n return attachmentsService[\"delete\"](\"task\", attachment.id);\n });\n return $q.all(promises);\n };\n $scope.$on(\"taskform:new\", function(ctx, sprintId, usId) {\n var create, newTask;\n $scope.task = {\n project: $scope.projectId,\n milestone: sprintId,\n user_story: usId,\n is_archived: false,\n status: $scope.project.default_task_status,\n assigned_to: null,\n tags: []\n };\n $scope.isNew = true;\n $scope.attachments = Immutable.List();\n resetAttachments();\n create = $translate.instant(\"COMMON.CREATE\");\n $el.find(\".button-green\").html(create);\n newTask = $translate.instant(\"LIGHTBOX.CREATE_EDIT_TASK.TITLE\");\n $el.find(\".title\").html(newTask + \" \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n $scope.$on(\"taskform:edit\", function(ctx, task, attachments) {\n var edit, save;\n $scope.task = task;\n $scope.isNew = false;\n $scope.attachments = Immutable.fromJS(attachments);\n resetAttachments();\n save = $translate.instant(\"COMMON.SAVE\");\n edit = $translate.instant(\"LIGHTBOX.CREATE_EDIT_TASK.ACTION_EDIT\");\n $el.find(\".button-green\").html(save);\n $el.find(\".title\").html(edit + \" \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n submitButton = $el.find(\".submit-button\");\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, currentLoading, form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n if ($scope.isNew) {\n promise = $repo.create(\"tasks\", $scope.task);\n broadcastEvent = \"taskform:new:success\";\n } else {\n promise = $repo.save($scope.task);\n broadcastEvent = \"taskform:edit:success\";\n }\n promise.then(function(data) {\n createAttachments(data);\n deleteAttachments(data);\n return data;\n });\n currentLoading = $loading().target(submitButton).start();\n return promise.then(function(data) {\n currentLoading.finish();\n lightboxService.close($el);\n return $rootscope.$broadcast(broadcastEvent, data);\n });\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n CreateBulkTasksDirective = function($repo, $rs, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.form = {\n data: \"\",\n usId: null\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, data, form, projectId, promise, sprintId, usId;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n data = $scope.form.data;\n projectId = $scope.projectId;\n sprintId = $scope.form.sprintId;\n usId = $scope.form.usId;\n promise = $rs.tasks.bulkCreate(projectId, sprintId, usId, data);\n promise.then(function(result) {\n currentLoading.finish();\n $rootscope.$broadcast(\"taskform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return console.log(\"FAIL\");\n });\n };\n })(this));\n $scope.$on(\"taskform:bulk\", function(ctx, sprintId, usId) {\n lightboxService.open($el);\n return $scope.form = {\n data: \"\",\n sprintId: sprintId,\n usId: usId\n };\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaTaskboard\");\n\n module.directive(\"tgLbCreateEditTask\", [\"$tgRepo\", \"$tgModel\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", \"$translate\", \"$q\", \"tgAttachmentsService\", CreateEditTaskDirective]);\n\n module.directive(\"tgLbCreateBulkTasks\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkTasksDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard.coffee\n */\n\n(function() {\n var TaskboardController, TaskboardDirective, TaskboardSquishColumnDirective, TaskboardTaskDirective, TaskboardUserDirective, bindMethods, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n toggleText = this.taiga.toggleText;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n scopeDefer = this.taiga.scopeDefer;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaTaskboard\");\n\n TaskboardController = (function(superClass) {\n extend(TaskboardController, superClass);\n\n TaskboardController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"tgAppMetaService\", \"$tgLocation\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\"];\n\n function TaskboardController(scope, rootscope, repo, confirm, rs1, params1, q, appMetaService, location, navUrls, events, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs1;\n this.params = params1;\n this.q = q;\n this.appMetaService = appMetaService;\n this.location = location;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"TASKBOARD.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this._setMeta();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n TaskboardController.prototype._setMeta = function() {\n var description, prettyDate, title;\n prettyDate = this.translate.instant(\"BACKLOG.SPRINTS.DATE\");\n title = this.translate.instant(\"TASKBOARD.PAGE_TITLE\", {\n projectName: this.scope.project.name,\n sprintName: this.scope.sprint.name\n });\n description = this.translate.instant(\"TASKBOARD.PAGE_DESCRIPTION\", {\n projectName: this.scope.project.name,\n sprintName: this.scope.sprint.name,\n startDate: moment(this.scope.sprint.estimated_start).format(prettyDate),\n endDate: moment(this.scope.sprint.estimated_finish).format(prettyDate),\n completedPercentage: this.scope.stats.completedPercentage || \"0\",\n completedPoints: this.scope.stats.completedPointsSum || \"--\",\n totalPoints: this.scope.stats.totalPointsSum || \"--\",\n openTasks: this.scope.stats.openTasks || \"--\",\n totalTasks: this.scope.stats.total_tasks || \"--\"\n });\n return this.appMetaService.setAll(title, description);\n };\n\n TaskboardController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"taskform:bulk:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"bulk create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:new:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:edit:success\", (function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n this.scope.$on(\"taskboard:task:move\", this.taskMove);\n return this.scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, task) {\n var promise;\n task.assigned_to = userId;\n promise = _this.repo.save(task);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n })(this));\n };\n\n TaskboardController.prototype.initializeSubscription = function() {\n var routingKey, routingKey1;\n routingKey = \"changes.project.\" + this.scope.projectId + \".tasks\";\n this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadTaskboard();\n };\n })(this));\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.refreshTagsColors();\n _this.loadSprintStats();\n return _this.loadSprint();\n };\n })(this));\n };\n\n TaskboardController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n if (!project.is_backlog_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(e) {\n return e.id;\n });\n _this.scope.roleById = groupBy(project.roles, function(e) {\n return e.id;\n });\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.usStatusById = groupBy(project.us_statuses, function(e) {\n return e.id;\n });\n _this.scope.$emit('project:loaded', project);\n _this.fillUsersAndRoles(project.members, project.roles);\n return project;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprintStats = function() {\n return this.rs.sprints.stats(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(stats) {\n var completedPointsSum, remainingPointsSum, remainingTasks, totalPointsSum;\n totalPointsSum = _.reduce(_.values(stats.total_points), (function(res, n) {\n return res + n;\n }), 0);\n completedPointsSum = _.reduce(_.values(stats.completed_points), (function(res, n) {\n return res + n;\n }), 0);\n remainingPointsSum = totalPointsSum - completedPointsSum;\n remainingTasks = stats.total_tasks - stats.completed_tasks;\n _this.scope.stats = stats;\n _this.scope.stats.totalPointsSum = totalPointsSum;\n _this.scope.stats.completedPointsSum = completedPointsSum;\n _this.scope.stats.remainingPointsSum = remainingPointsSum;\n _this.scope.stats.remainingTasks = remainingTasks;\n if (stats.totalPointsSum) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.completedPointsSum / stats.totalPointsSum);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n _this.scope.stats.openTasks = stats.total_tasks - stats.completed_tasks;\n return stats;\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprint = function() {\n return this.rs.sprints.get(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n _this.scope.userstories = _.sortBy(sprint.user_stories, \"sprint_order\");\n return sprint;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(tasks) {\n var i, j, k, len, len1, len2, ref, ref1, ref2, status, task, us, usId;\n _this.scope.tasks = _.sortBy(tasks, 'taskboard_order');\n _this.scope.usTasks = {};\n ref = _.union(_this.scope.userstories, [\n {\n id: null\n }\n ]);\n for (i = 0, len = ref.length; i < len; i++) {\n us = ref[i];\n _this.scope.usTasks[us.id] = {};\n ref1 = _this.scope.taskStatusList;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n status = ref1[j];\n _this.scope.usTasks[us.id][status.id] = [];\n }\n }\n ref2 = _this.scope.tasks;\n for (k = 0, len2 = ref2.length; k < len2; k++) {\n task = ref2[k];\n if ((_this.scope.usTasks[task.user_story] != null) && (_this.scope.usTasks[task.user_story][task.status] != null)) {\n _this.scope.usTasks[task.user_story][task.status].push(task);\n }\n }\n if (tasks.length === 0) {\n if (_this.scope.userstories.length > 0) {\n usId = _this.scope.userstories[0].id;\n } else {\n usId = null;\n }\n _this.scope.usTasks[usId][_this.scope.taskStatusList[0].id].push({\n isPlaceholder: true\n });\n }\n return tasks;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTaskboard = function() {\n return this.q.all([\n this.refreshTagsColors(), this.loadSprintStats(), this.loadSprint().then((function(_this) {\n return function() {\n return _this.loadTasks();\n };\n })(this))\n ]);\n };\n\n TaskboardController.prototype.loadInitialData = function() {\n var params, promise;\n params = {\n pslug: this.params.pslug,\n sslug: this.params.sslug\n };\n promise = this.repo.resolve(params).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n _this.scope.sprintId = data.milestone;\n _this.initializeSubscription();\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTasksOrder = function(tasks) {\n var data, items;\n items = this.resortTasks(tasks);\n data = this.prepareBulkUpdateData(items);\n return this.rs.tasks.bulkUpdateTaskTaskboardOrder(this.scope.project.id, data);\n };\n\n TaskboardController.prototype.resortTasks = function(tasks) {\n var i, index, item, items, len;\n items = [];\n for (index = i = 0, len = tasks.length; i < len; index = ++i) {\n item = tasks[index];\n item[\"taskboard_order\"] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n TaskboardController.prototype.prepareBulkUpdateData = function(uses) {\n return _.map(uses, function(x) {\n return {\n \"task_id\": x.id,\n \"order\": x[\"taskboard_order\"]\n };\n });\n };\n\n TaskboardController.prototype.taskMove = function(ctx, task, usId, statusId, order) {\n var promise, r, tasks;\n r = this.scope.usTasks[task.user_story][task.status].indexOf(task);\n this.scope.usTasks[task.user_story][task.status].splice(r, 1);\n tasks = this.scope.usTasks[usId][statusId];\n tasks.splice(order, 0, task);\n task.user_story = usId;\n task.status = statusId;\n task.taskboard_order = order;\n promise = this.repo.save(task);\n this.rootscope.$broadcast(\"sprint:task:moved\", task);\n promise.then((function(_this) {\n return function() {\n _this.refreshTasksOrder(tasks);\n return _this.loadSprintStats();\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function() {\n return console.log(\"FAIL TASK SAVE\");\n };\n })(this));\n };\n\n TaskboardController.prototype.addNewTask = function(type, us) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"taskform:new\", this.scope.sprintId, us != null ? us.id : void 0);\n case \"bulk\":\n return this.rootscope.$broadcast(\"taskform:bulk\", this.scope.sprintId, us != null ? us.id : void 0);\n }\n };\n\n TaskboardController.prototype.editTaskAssignedTo = function(task) {\n return this.rootscope.$broadcast(\"assigned-to:add\", task);\n };\n\n return TaskboardController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskboardController\", TaskboardController);\n\n TaskboardDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, tableBodyDom;\n $ctrl = $el.controller();\n $el.on(\"click\", \".toggle-analytics-visibility\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass('active');\n return $rootscope.$broadcast(\"taskboard:graph:toggle-visibility\");\n });\n tableBodyDom = $el.find(\".taskboard-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".taskboard-table-header .taskboard-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboard\", [\"$rootScope\", TaskboardDirective]);\n\n TaskboardTaskDirective = function($rootscope, $loading, $rs, $rs2) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"task\", function(task) {\n if (task.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!task.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n return $el.find(\".icon-edit\").on(\"click\", function(event) {\n if ($el.find('.icon-edit').hasClass('noclick')) {\n return;\n }\n return $scope.$apply(function() {\n var currentLoading, target, task;\n target = $(event.target);\n currentLoading = $loading().target(target).timeout(200).removeClasses(\"icon-edit\").start();\n task = $scope.task;\n return $rs.tasks.getByRef(task.project, task.ref).then((function(_this) {\n return function(editingTask) {\n return $rs2.attachments.list(\"task\", editingTask.id, editingTask.project).then(function(attachments) {\n $rootscope.$broadcast(\"taskform:edit\", editingTask, attachments.toJS());\n return currentLoading.finish();\n });\n };\n })(this));\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardTask\", [\"$rootScope\", \"$tgLoading\", \"$tgResources\", \"tgResources\", TaskboardTaskDirective]);\n\n TaskboardSquishColumnDirective = function(rs) {\n var avatarWidth, link, maxColumnWidth;\n avatarWidth = 40;\n maxColumnWidth = 300;\n link = function($scope, $el, $attrs) {\n var getCeilWidth, recalculateStatusColumnWidth, recalculateTaskboardWidth, refreshTaskboardTableWidth, setStatusColumnWidth;\n $scope.$on(\"sprint:task:moved\", (function(_this) {\n return function() {\n return recalculateTaskboardWidth();\n };\n })(this));\n bindOnce($scope, \"usTasks\", function(project) {\n $scope.statusesFolded = rs.tasks.getStatusColumnModes($scope.project.id);\n $scope.usFolded = rs.tasks.getUsRowModes($scope.project.id, $scope.sprintId);\n return recalculateTaskboardWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.statusesFolded[status.id] = !!!$scope.statusesFolded[status.id];\n rs.tasks.storeStatusColumnModes($scope.projectId, $scope.statusesFolded);\n return recalculateTaskboardWidth();\n };\n $scope.foldUs = function(us) {\n if (!us) {\n $scope.usFolded[null] = !!!$scope.usFolded[null];\n } else {\n $scope.usFolded[us.id] = !!!$scope.usFolded[us.id];\n }\n rs.tasks.storeUsRowModes($scope.projectId, $scope.sprintId, $scope.usFolded);\n return recalculateTaskboardWidth();\n };\n getCeilWidth = (function(_this) {\n return function(usId, statusId) {\n var tasks, tasksMatrixSize, width;\n tasks = $scope.usTasks[usId][statusId].length;\n if ($scope.statusesFolded[statusId]) {\n if (tasks && $scope.usFolded[usId]) {\n tasksMatrixSize = Math.round(Math.sqrt(tasks));\n width = avatarWidth * tasksMatrixSize;\n } else {\n width = avatarWidth;\n }\n return width;\n }\n return 0;\n };\n })(this);\n setStatusColumnWidth = (function(_this) {\n return function(statusId, width) {\n var column;\n column = $el.find(\".squish-status-\" + statusId);\n if (width) {\n return column.css('max-width', width);\n } else {\n return column.css(\"max-width\", maxColumnWidth);\n }\n };\n })(this);\n refreshTaskboardTableWidth = (function(_this) {\n return function() {\n var columnWidths, columns, totalWidth;\n columnWidths = [];\n columns = $el.find(\".task-colum-name\");\n columnWidths = _.map(columns, function(column) {\n return $(column).outerWidth(true);\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.taskboard-table-inner').css(\"width\", totalWidth);\n };\n })(this);\n recalculateStatusColumnWidth = (function(_this) {\n return function(statusId) {\n var statusFoldedWidth;\n statusFoldedWidth = getCeilWidth(null, statusId);\n _.forEach($scope.userstories, function(us) {\n var width;\n width = getCeilWidth(us.id, statusId);\n if (width > statusFoldedWidth) {\n return statusFoldedWidth = width;\n }\n });\n return setStatusColumnWidth(statusId, statusFoldedWidth);\n };\n })(this);\n return recalculateTaskboardWidth = (function(_this) {\n return function() {\n _.forEach($scope.taskStatusList, function(status) {\n return recalculateStatusColumnWidth(status.id);\n });\n refreshTaskboardTableWidth();\n };\n })(this);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSquishColumn\", [\"$tgResources\", TaskboardSquishColumnDirective]);\n\n TaskboardUserDirective = function($log, $translate) {\n var clickable, link;\n clickable = false;\n link = function($scope, $el, $attrs) {\n var username_label;\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.addClass(\"not-clickable\");\n $scope.$watch('task.assigned_to', function(assigned_to) {\n var user;\n user = $scope.usersById[assigned_to];\n if (user === void 0) {\n _.assign($scope, {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\",\n clickable: clickable\n });\n } else {\n _.assign($scope, {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n });\n }\n return username_label.text($scope.name);\n });\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_task\") > -1) {\n clickable = true;\n $el.find(\".avatar-assigned-to\").on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n };\n })(this));\n username_label.removeClass(\"not-clickable\");\n return username_label.on(\"click\", function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n });\n }\n });\n };\n return {\n link: link,\n templateUrl: \"taskboard/taskboard-user.html\",\n scope: {\n \"usersById\": \"=users\",\n \"project\": \"=\",\n \"task\": \"=\"\n }\n };\n };\n\n module.directive(\"tgTaskboardUserAvatar\", [\"$log\", \"$translate\", TaskboardUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard/sortable.coffee\n */\n\n(function() {\n var TaskboardSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n TaskboardSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".taskboard-task-inner\",\n dropOnEmpty: true,\n connectWith: \".taskboard-tasks-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemTask, newStatusId, newUsId, oldStatusId, oldUsId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemTask = itemEl.scope().task;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n oldUsId = oldParentScope.us ? oldParentScope.us.id : null;\n oldStatusId = oldParentScope.st.id;\n newUsId = newParentScope.us ? newParentScope.us.id : null;\n newStatusId = newParentScope.st.id;\n if (newStatusId !== oldStatusId || newUsId !== oldUsId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"taskboard:task:move\", itemTask, newUsId, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n return tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", TaskboardSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/kanban/main.coffee\n */\n\n(function() {\n var KanbanArchivedStatusHeaderDirective, KanbanArchivedStatusIntroDirective, KanbanController, KanbanDirective, KanbanSquishColumnDirective, KanbanUserDirective, KanbanUserstoryDirective, KanbanWipLimitDirective, bindMethods, bindOnce, defaultViewMode, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText, viewModes,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaKanban\");\n\n defaultViewMode = \"maximized\";\n\n viewModes = [\"maximized\", \"minimized\"];\n\n KanbanController = (function(superClass) {\n extend(KanbanController, superClass);\n\n KanbanController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\"];\n\n function KanbanController(scope, rootscope, repo, confirm, rs1, params1, q, location, appMetaService, navUrls, events, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs1;\n this.params = params1;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"KANBAN.SECTION_NAME\");\n this.scope.statusViewModes = {};\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"KANBAN.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"KANBAN.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n KanbanController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.refreshTagsColors();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.refreshTagsColors();\n };\n })(this));\n this.scope.$on(\"assigned-to:added\", this.onAssignedToChanged);\n this.scope.$on(\"kanban:us:move\", this.moveUs);\n this.scope.$on(\"kanban:show-userstories-for-status\", this.loadUserStoriesForStatus);\n return this.scope.$on(\"kanban:hide-userstories-for-status\", this.hideUserStoriesForStatus);\n };\n\n KanbanController.prototype.addNewUs = function(type, statusId) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, statusId, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, statusId);\n }\n };\n\n KanbanController.prototype.changeUsAssignedTo = function(us) {\n return this.rootscope.$broadcast(\"assigned-to:add\", us);\n };\n\n KanbanController.prototype.onAssignedToChanged = function(ctx, userid, us) {\n var promise;\n us.assigned_to = userid;\n promise = this.repo.save(us);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n\n KanbanController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n KanbanController.prototype.loadUserstories = function() {\n var params, promise;\n params = {\n status__is_archived: false\n };\n promise = this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n var i, j, k, len, len1, len2, ref, ref1, ref2, status, us, usByStatus, us_archived;\n _this.scope.userstories = userstories;\n usByStatus = _.groupBy(userstories, \"status\");\n us_archived = [];\n ref = _this.scope.usStatusList;\n for (i = 0, len = ref.length; i < len; i++) {\n status = ref[i];\n if (usByStatus[status.id] == null) {\n usByStatus[status.id] = [];\n }\n if (_this.scope.usByStatus != null) {\n ref1 = _this.scope.usByStatus[status.id];\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n us = ref1[j];\n if (us.status !== status.id) {\n us_archived.push(us);\n }\n }\n }\n if (status.is_archived && (_this.scope.usByStatus != null) && _this.scope.usByStatus[status.id].length !== 0) {\n ref2 = _this.scope.usByStatus[status.id].concat(us_archived);\n for (k = 0, len2 = ref2.length; k < len2; k++) {\n us = ref2[k];\n if (us.status === status.id) {\n usByStatus[status.id].push(us);\n }\n }\n }\n usByStatus[status.id] = _.sortBy(usByStatus[status.id], \"kanban_order\");\n }\n if (userstories.length === 0) {\n status = _this.scope.usStatusList[0];\n usByStatus[status.id].push({\n isPlaceholder: true\n });\n }\n _this.scope.usByStatus = usByStatus;\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\", userstories);\n });\n return userstories;\n };\n })(this));\n promise.then((function(_this) {\n return function() {\n return _this.scope.$broadcast(\"redraw:wip\");\n };\n })(this));\n return promise;\n };\n\n KanbanController.prototype.loadUserStoriesForStatus = function(ctx, statusId) {\n var params;\n params = {\n status: statusId\n };\n return this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n _this.scope.usByStatus[statusId] = _.sortBy(userstories, \"kanban_order\");\n _this.scope.$broadcast(\"kanban:shown-userstories-for-status\", statusId, userstories);\n return userstories;\n };\n })(this));\n };\n\n KanbanController.prototype.hideUserStoriesForStatus = function(ctx, statusId) {\n this.scope.usByStatus[statusId] = [];\n return this.scope.$broadcast(\"kanban:hidden-userstories-for-status\", statusId);\n };\n\n KanbanController.prototype.loadKanban = function() {\n return this.q.all([this.refreshTagsColors(), this.loadUserstories()]);\n };\n\n KanbanController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_kanban_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.projectId = project.id;\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.generateStatusViewModes();\n _this.scope.$emit(\"project:loaded\", project);\n return project;\n };\n })(this));\n };\n\n KanbanController.prototype.initializeSubscription = function() {\n var routingKey1;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n return _this.loadUserstories();\n };\n })(this));\n };\n\n KanbanController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n _this.initializeSubscription();\n return _this.loadKanban();\n };\n })(this));\n };\n\n KanbanController.prototype.generateStatusViewModes = function() {\n var i, len, mode, ref, status, storedStatusViewModes;\n storedStatusViewModes = this.rs.kanban.getStatusViewModes(this.scope.projectId);\n this.scope.statusViewModes = {};\n ref = this.scope.usStatusList;\n for (i = 0, len = ref.length; i < len; i++) {\n status = ref[i];\n mode = storedStatusViewModes[status.id] || defaultViewMode;\n this.scope.statusViewModes[status.id] = mode;\n }\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.storeStatusViewModes = function() {\n return this.rs.kanban.storeStatusViewModes(this.scope.projectId, this.scope.statusViewModes);\n };\n\n KanbanController.prototype.updateStatusViewMode = function(statusId, newViewMode) {\n this.scope.statusViewModes[statusId] = newViewMode;\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.isMaximized = function(statusId) {\n var mode;\n mode = this.scope.statusViewModes[statusId] || defaultViewMode;\n return mode === 'maximized';\n };\n\n KanbanController.prototype.isMinimized = function(statusId) {\n var mode;\n mode = this.scope.statusViewModes[statusId] || defaultViewMode;\n return mode === 'minimized';\n };\n\n KanbanController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"kanban_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n KanbanController.prototype.resortUserStories = function(uses) {\n var i, index, item, items, len;\n items = [];\n for (index = i = 0, len = uses.length; i < len; index = ++i) {\n item = uses[index];\n item.kanban_order = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n KanbanController.prototype.moveUs = function(ctx, us, oldStatusId, newStatusId, index) {\n var itemsToSave, promise, r;\n if (oldStatusId !== newStatusId) {\n r = this.scope.usByStatus[oldStatusId].indexOf(us);\n this.scope.usByStatus[oldStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n us.status = newStatusId;\n } else {\n r = this.scope.usByStatus[newStatusId].indexOf(us);\n this.scope.usByStatus[newStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n }\n itemsToSave = this.resortUserStories(this.scope.usByStatus[newStatusId]);\n this.scope.usByStatus[newStatusId] = _.sortBy(this.scope.usByStatus[newStatusId], \"kanban_order\");\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n var data;\n itemsToSave = _.reject(itemsToSave, {\n \"id\": us.id\n });\n data = _this.prepareBulkUpdateData(itemsToSave);\n return _this.rs.userstories.bulkUpdateKanbanOrder(us.project, data).then(function() {\n return itemsToSave;\n });\n };\n })(this));\n return promise;\n };\n\n return KanbanController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"KanbanController\", KanbanController);\n\n KanbanDirective = function($repo, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var tableBodyDom;\n tableBodyDom = $el.find(\".kanban-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".kanban-table-header .kanban-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanban\", [\"$tgRepo\", \"$rootScope\", KanbanDirective]);\n\n KanbanArchivedStatusHeaderDirective = function($rootscope, $translate) {\n var hideArchivedText, link, showArchivedText;\n showArchivedText = $translate.instant(\"KANBAN.ACTION_SHOW_ARCHIVED\");\n hideArchivedText = $translate.instant(\"KANBAN.ACTION_HIDE_ARCHIVED\");\n link = function($scope, $el, $attrs) {\n var hidden, status;\n status = $scope.$eval($attrs.tgKanbanArchivedStatusHeader);\n hidden = true;\n $scope[\"class\"] = \"icon-open-eye\";\n $scope.title = showArchivedText;\n $el.on(\"click\", function(event) {\n hidden = !hidden;\n return $scope.$apply(function() {\n if (hidden) {\n $scope[\"class\"] = \"icon-open-eye\";\n $scope.title = showArchivedText;\n return $rootscope.$broadcast(\"kanban:hide-userstories-for-status\", status.id);\n } else {\n $scope[\"class\"] = \"icon-closed-eye\";\n $scope.title = hideArchivedText;\n return $rootscope.$broadcast(\"kanban:show-userstories-for-status\", status.id);\n }\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanArchivedStatusHeader\", [\"$rootScope\", \"$translate\", KanbanArchivedStatusHeaderDirective]);\n\n KanbanArchivedStatusIntroDirective = function($translate) {\n var link, userStories;\n userStories = [];\n link = function($scope, $el, $attrs) {\n var hiddenUserStoriexText, status, updateIntroText;\n hiddenUserStoriexText = $translate.instant(\"KANBAN.HIDDEN_USER_STORIES\");\n status = $scope.$eval($attrs.tgKanbanArchivedStatusIntro);\n $el.text(hiddenUserStoriexText);\n updateIntroText = function() {\n if (userStories.length > 0) {\n return $el.text(\"\");\n } else {\n return $el.text(hiddenUserStoriexText);\n }\n };\n $scope.$on(\"kanban:us:move\", function(ctx, itemUs, oldStatusId, newStatusId, itemIndex) {\n var r;\n if (status.id === newStatusId) {\n if (status.id === oldStatusId) {\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n userStories.splice(itemIndex, 0, itemUs);\n } else {\n itemUs.isArchived = true;\n userStories.splice(itemIndex, 0, itemUs);\n }\n } else if (status.id === oldStatusId) {\n itemUs.isArchived = false;\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n }\n return updateIntroText();\n });\n $scope.$on(\"kanban:shown-userstories-for-status\", function(ctx, statusId, userStoriesLoaded) {\n if (statusId === status.id) {\n userStories = _.filter(userStoriesLoaded, function(us) {\n return us.status === status.id;\n });\n return updateIntroText();\n }\n });\n $scope.$on(\"kanban:hidden-userstories-for-status\", function(ctx, statusId) {\n if (statusId === status.id) {\n userStories = [];\n return updateIntroText();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanArchivedStatusIntro\", [\"$translate\", KanbanArchivedStatusIntroDirective]);\n\n KanbanUserstoryDirective = function($rootscope, $loading, $rs, $rs2) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"us\", function(us) {\n if (us.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!us.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n $el.on('click', '.icon-edit', function(event) {\n var currentLoading, target, us;\n if ($el.find(\".icon-edit\").hasClass(\"noclick\")) {\n return;\n }\n target = $(event.target);\n currentLoading = $loading().target(target).timeout(200).removeClasses(\"icon-edit\").start();\n us = $model.$modelValue;\n return $rs.userstories.getByRef(us.project, us.ref).then((function(_this) {\n return function(editingUserStory) {\n return $rs2.attachments.list(\"us\", us.id, us.project).then(function(attachments) {\n $rootscope.$broadcast(\"usform:edit\", editingUserStory, attachments.toJS());\n return currentLoading.finish();\n });\n };\n })(this));\n });\n $scope.getTemplateUrl = function() {\n if ($scope.us.isPlaceholder) {\n return \"common/components/kanban-placeholder.html\";\n } else {\n return \"kanban/kanban-task.html\";\n }\n };\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n template: '',\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgKanbanUserstory\", [\"$rootScope\", \"$tgLoading\", \"$tgResources\", \"tgResources\", KanbanUserstoryDirective]);\n\n KanbanSquishColumnDirective = function(rs) {\n var link;\n link = function($scope, $el, $attrs) {\n var updateTableWidth;\n $scope.$on(\"project:loaded\", function(event, project) {\n $scope.folds = rs.kanban.getStatusColumnModes(project.id);\n return updateTableWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.folds[status.id] = !!!$scope.folds[status.id];\n rs.kanban.storeStatusColumnModes($scope.projectId, $scope.folds);\n updateTableWidth();\n };\n return updateTableWidth = function() {\n var columnWidths, totalWidth;\n columnWidths = _.map($scope.usStatusList, function(status) {\n if ($scope.folds[status.id]) {\n return 40;\n } else {\n return 310;\n }\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.kanban-table-inner').css(\"width\", totalWidth);\n };\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanSquishColumn\", [\"$tgResources\", KanbanSquishColumnDirective]);\n\n KanbanWipLimitDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var redrawWipLimit, status;\n $el.disableSelection();\n status = $scope.$eval($attrs.tgKanbanWipLimit);\n redrawWipLimit = (function(_this) {\n return function() {\n $el.find(\".kanban-wip-limit\").remove();\n return timeout(200, function() {\n var element;\n element = $el.find(\".kanban-task\")[status.wip_limit];\n if (element) {\n return angular.element(element).before(\"
\");\n }\n });\n };\n })(this);\n if (status && !status.is_archived) {\n $scope.$on(\"redraw:wip\", redrawWipLimit);\n $scope.$on(\"kanban:us:move\", redrawWipLimit);\n $scope.$on(\"usform:new:success\", redrawWipLimit);\n $scope.$on(\"usform:bulk:success\", redrawWipLimit);\n }\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanWipLimit\", KanbanWipLimitDirective);\n\n KanbanUserDirective = function($log, $compile, $translate) {\n var clickable, link, template;\n template = _.template(\"
\\n class=\\\"not-clickable\\\"<% } %>>\\n \\\" alt=\\\"<%- name %>\\\" class=\\\"avatar\\\">\\n \\n
\");\n clickable = false;\n link = function($scope, $el, $attrs, $model) {\n var render, username_label, wtid;\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.addClass(\"not-clickable\");\n if (!$attrs.tgKanbanUserAvatar) {\n return $log.error(\"KanbanUserDirective: no attr is defined\");\n }\n wtid = $scope.$watch($attrs.tgKanbanUserAvatar, function(v) {\n var user;\n if ($scope.usersById == null) {\n $log.error(\"KanbanUserDirective requires userById set in scope.\");\n return wtid();\n } else {\n user = $scope.usersById[v];\n return render(user);\n }\n });\n render = function(user) {\n var ctx, html;\n if (user === void 0) {\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\",\n clickable: clickable\n };\n } else {\n ctx = {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n };\n }\n html = $compile(template(ctx))($scope);\n $el.html(html);\n return username_label.text(ctx.name);\n };\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n clickable = true;\n $el.on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n };\n })(this));\n username_label.removeClass(\"not-clickable\");\n return username_label.on(\"click\", function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgKanbanUserAvatar\", [\"$log\", \"$compile\", \"$translate\", KanbanUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/kanban/sortable.coffee\n */\n\n(function() {\n var KanbanSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaKanban\");\n\n KanbanSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".kanban-task-inner\",\n dropOnEmpty: true,\n connectWith: \".kanban-uses-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemUs, newStatusId, oldStatusId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemUs = itemEl.scope().us;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n newStatusId = newParentScope.s.id;\n oldStatusId = oldParentScope.s.id;\n if (newStatusId !== oldStatusId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"kanban:us:move\", itemUs, itemUs.status, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n return tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", KanbanSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/detail.coffee\n */\n\n(function() {\n var IssueDetailController, IssuePriorityButtonDirective, IssueSeverityButtonDirective, IssueStatusButtonDirective, IssueStatusDisplayDirective, IssueTypeButtonDirective, PromoteIssueToUsButtonDirective, bindMethods, bindOnce, groupBy, joinStr, mixOf, module, taiga, toString,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaIssues\");\n\n IssueDetailController = (function(superClass) {\n extend(IssueDetailController, superClass);\n\n IssueDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"tgAppMetaService\", \"$tgAnalytics\", \"$tgNavUrls\", \"$translate\"];\n\n function IssueDetailController(scope, rootscope, repo, confirm, rs, params, q, location, log, appMetaService, analytics, navUrls, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.log = log;\n this.appMetaService = appMetaService;\n this.analytics = analytics;\n this.navUrls = navUrls;\n this.translate = translate;\n bindMethods(this);\n this.scope.issueRef = this.params.issueref;\n this.scope.sectionName = this.translate.instant(\"ISSUES.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this._setMeta();\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n IssueDetailController.prototype._setMeta = function() {\n var description, ref, ref1, ref2, ref3, title;\n title = this.translate.instant(\"ISSUE.PAGE_TITLE\", {\n issueRef: \"#\" + this.scope.issue.ref,\n issueSubject: this.scope.issue.subject,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"ISSUE.PAGE_DESCRIPTION\", {\n issueStatus: ((ref = this.scope.statusById[this.scope.issue.status]) != null ? ref.name : void 0) || \"--\",\n issueType: ((ref1 = this.scope.typeById[this.scope.issue.type]) != null ? ref1.name : void 0) || \"--\",\n issueSeverity: ((ref2 = this.scope.severityById[this.scope.issue.severity]) != null ? ref2.name : void 0) || \"--\",\n issuePriority: ((ref3 = this.scope.priorityById[this.scope.issue.priority]) != null ? ref3.name : void 0) || \"--\",\n issueDescription: angular.element(this.scope.issue.description_html || \"\").text()\n });\n return this.appMetaService.setAll(title, description);\n };\n\n IssueDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on issue\", 1);\n };\n })(this));\n this.scope.$on(\"promote-issue-to-us:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"promoteToUserstory\", \"promote issue to userstory\", 1);\n _this.rootscope.$broadcast(\"object:updated\");\n return _this.loadIssue();\n };\n })(this));\n this.scope.$on(\"comment:new\", (function(_this) {\n return function() {\n return _this.loadIssue();\n };\n })(this));\n return this.scope.$on(\"custom-attributes-values:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this));\n };\n\n IssueDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n if (this.scope.project.is_issues_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-issues\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n }\n };\n\n IssueDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.issue_statuses;\n _this.scope.statusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.typeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n _this.scope.typeList = _.sortBy(project.issue_types, \"order\");\n _this.scope.severityList = project.severities;\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = project.priorities;\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadIssue = function() {\n return this.rs.issues.getByRef(this.scope.projectId, this.params.issueref).then((function(_this) {\n return function(issue) {\n var ctx, ref, ref1;\n _this.scope.issue = issue;\n _this.scope.issueId = issue.id;\n _this.scope.commentModel = issue;\n if (((ref = _this.scope.issue.neighbors.previous) != null ? ref.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n if (((ref1 = _this.scope.issue.neighbors.next) != null ? ref1.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.next.ref\n };\n return _this.scope.nextUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.loadIssue();\n };\n })(this));\n };\n\n\n /*\n * Note: This methods (onUpvote() and onDownvote()) are related to tg-vote-button.\n * See app/modules/components/vote-button for more info\n */\n\n IssueDetailController.prototype.onUpvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.upvote(this.scope.issueId).then(onSuccess, onError);\n };\n\n IssueDetailController.prototype.onDownvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.downvote(this.scope.issueId).then(onSuccess, onError);\n };\n\n\n /*\n * Note: This methods (onWatch() and onUnwatch()) are related to tg-watch-button.\n * See app/modules/components/watch-button for more info\n */\n\n IssueDetailController.prototype.onWatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.watch(this.scope.issueId).then(onSuccess, onError);\n };\n\n IssueDetailController.prototype.onUnwatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.unwatch(this.scope.issueId).then(onSuccess, onError);\n };\n\n return IssueDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"IssueDetailController\", IssueDetailController);\n\n IssueStatusDisplayDirective = function($template, $compile) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(issue) {\n var html, status;\n status = $scope.statusById[issue.status];\n html = template({\n is_closed: status.is_closed,\n status: status\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue != null) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueStatusDisplay\", [\"$tgTemplate\", \"$compile\", IssueStatusDisplayDirective]);\n\n IssueStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issues-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, status;\n status = $scope.statusById[issue.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(statusId) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.status = statusId;\n currentLoading = $loading().target($el).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".js-edit-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssueStatusButtonDirective]);\n\n IssueTypeButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issue-type-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, type;\n type = $scope.typeById[issue.type];\n html = template({\n type: type,\n typees: $scope.typeList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(type) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.type = type;\n currentLoading = $loading().target($el.find(\".level-name\")).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".type-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-type\").popover().open();\n });\n $el.on(\"click\", \".type\", function(event) {\n var target, type;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n type = target.data(\"type-id\");\n return save(type);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueTypeButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssueTypeButtonDirective]);\n\n IssueSeverityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issue-severity-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, severity;\n severity = $scope.severityById[issue.severity];\n html = template({\n severity: severity,\n severityes: $scope.severityList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(severity) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.severity = severity;\n currentLoading = $loading().target($el.find(\".level-name\")).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".severity-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-severity\").popover().open();\n });\n $el.on(\"click\", \".severity\", function(event) {\n var severity, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n severity = target.data(\"severity-id\");\n return save(severity);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueSeverityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssueSeverityButtonDirective]);\n\n IssuePriorityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issue-priority-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, priority;\n priority = $scope.priorityById[issue.priority];\n html = template({\n priority: priority,\n priorityes: $scope.priorityList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(priority) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.priority = priority;\n currentLoading = $loading().target($el.find(\".level-name\")).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".priority-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-priority\").popover().open();\n });\n $el.on(\"click\", \".priority\", function(event) {\n var priority, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n priority = target.data(\"priority-id\");\n return save(priority);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssuePriorityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssuePriorityButtonDirective]);\n\n PromoteIssueToUsButtonDirective = function($rootScope, $repo, $confirm, $qqueue, $translate) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var save;\n save = $qqueue.bindAdd((function(_this) {\n return function(issue, askResponse) {\n var data, onError, onSuccess;\n data = {\n generated_from_issue: issue.id,\n project: issue.project,\n subject: issue.subject,\n description: issue.description,\n tags: issue.tags,\n is_blocked: issue.is_blocked,\n blocked_note: issue.blocked_note\n };\n onSuccess = function() {\n askResponse.finish();\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"promote-issue-to-us:success\");\n };\n onError = function() {\n askResponse.finish();\n return $confirm.notify(\"error\");\n };\n return $repo.create(\"userstories\", data).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \"a\", function(event) {\n var issue, message, subtitle, title;\n event.preventDefault();\n issue = $model.$modelValue;\n title = $translate.instant(\"ISSUES.CONFIRM_PROMOTE.TITLE\");\n message = $translate.instant(\"ISSUES.CONFIRM_PROMOTE.MESSAGE\");\n subtitle = issue.subject;\n return $confirm.ask(title, subtitle, message).then((function(_this) {\n return function(response) {\n return save(issue, response);\n };\n })(this));\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n restrict: \"AE\",\n require: \"ngModel\",\n templateUrl: \"issue/promote-issue-to-us-button.html\",\n link: link\n };\n };\n\n module.directive(\"tgPromoteIssueToUsButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgQqueue\", \"$translate\", PromoteIssueToUsButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkIssuesDirective, CreateIssueDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaIssues\");\n\n CreateIssueDirective = function($repo, $confirm, $rootscope, lightboxService, $loading, $q, attachmentsService) {\n var link;\n link = function($scope, $el, $attrs) {\n var attachmentsToAdd, createAttachments, form, resetAttachments, submit, submitButton;\n form = $el.find(\"form\").checksley();\n $scope.issue = {};\n $scope.attachments = Immutable.List();\n $scope.$on(\"issueform:new\", function(ctx, project) {\n form.reset();\n resetAttachments();\n $el.find(\".tag-input\").val(\"\");\n lightboxService.open($el);\n return $scope.issue = {\n project: project.id,\n subject: \"\",\n status: project.default_issue_status,\n type: project.default_issue_type,\n priority: project.default_priority,\n severity: project.default_severity,\n tags: []\n };\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n createAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToAdd.toJS(), function(attachment) {\n return attachmentsService.upload(attachment.file, obj.id, $scope.issue.project, 'issue');\n });\n return $q.all(promises);\n };\n attachmentsToAdd = Immutable.List();\n resetAttachments = function() {\n attachmentsToAdd = Immutable.List();\n return $scope.attachments = Immutable.List();\n };\n $scope.addAttachment = function(attachment) {\n return attachmentsToAdd = attachmentsToAdd.push(attachment);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.create(\"issues\", $scope.issue);\n promise.then(function(data) {\n return createAttachments(data);\n });\n promise.then(function(data) {\n currentLoading.finish();\n $rootscope.$broadcast(\"issueform:new:success\", data);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateIssue\", [\"$tgRepo\", \"$tgConfirm\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$q\", \"tgAttachmentsService\", CreateIssueDirective]);\n\n CreateBulkIssuesDirective = function($repo, $rs, $confirm, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var form, submit, submitButton;\n form = null;\n $scope.$on(\"issueform:bulk\", function(ctx, projectId, status) {\n if (form) {\n form.reset();\n }\n lightboxService.open($el);\n return $scope[\"new\"] = {\n projectId: projectId,\n bulk: \"\"\n };\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, data, projectId, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n data = $scope[\"new\"].bulk;\n projectId = $scope[\"new\"].projectId;\n promise = $rs.issues.bulkCreate(projectId, data);\n promise.then(function(result) {\n currentLoading.finish();\n $rootscope.$broadcast(\"issueform:new:success\", result);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateBulkIssues\", [\"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkIssuesDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/list.coffee\n */\n\n(function() {\n var IssueAssignedToInlineEditionDirective, IssueStatusInlineEditionDirective, IssuesController, IssuesDirective, IssuesFiltersDirective, bindOnce, debounceLeading, groupBy, joinStr, mixOf, module, startswith, taiga, toString, trim,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounceLeading = this.taiga.debounceLeading;\n\n startswith = this.taiga.startswith;\n\n module = angular.module(\"taigaIssues\");\n\n IssuesController = (function(superClass) {\n extend(IssuesController, superClass);\n\n IssuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$tgUrls\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\"];\n\n function IssuesController(scope, rootscope, repo, confirm, rs, urls, params, q, location, appMetaService, navUrls, events, analytics, translate) {\n var filters, promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.urls = urls;\n this.params = params;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n this.loadIssues = bind(this.loadIssues, this);\n this.scope.sectionName = \"Issues\";\n this.scope.filters = {};\n if (_.isEmpty(this.location.search())) {\n filters = this.rs.issues.getFilters(this.params.pslug);\n filters.page = 1;\n this.location.search(filters);\n this.location.replace();\n return;\n }\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ISSUES.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"ISSUES.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"issueform:new:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"create\", \"create issue on issues list\", 1);\n return _this.loadIssues();\n };\n })(this));\n }\n\n IssuesController.prototype.initializeSubscription = function() {\n var routingKey;\n routingKey = \"changes.project.\" + this.scope.projectId + \".issues\";\n return this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadIssues();\n };\n })(this));\n };\n\n IssuesController.prototype.storeFilters = function() {\n return this.rs.issues.storeFilters(this.params.pslug, this.location.search());\n };\n\n IssuesController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_issues_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issueStatusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.severityList = _.sortBy(project.severities, \"order\");\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = _.sortBy(project.priorities, \"order\");\n _this.scope.issueTypes = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueTypeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n IssuesController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\", \"tags\", \"status\", \"types\", \"q\", \"severities\", \"priorities\", \"assignedTo\", \"createdBy\", \"orderBy\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n IssuesController.prototype.getUrlFilter = function(name) {\n var filters;\n filters = _.pick(this.location.search(), name);\n return filters[name];\n };\n\n IssuesController.prototype.loadMyFilters = function() {\n return this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n return _.map(filters, function(value, key) {\n return {\n id: key,\n name: key,\n type: \"myFilters\",\n selected: false\n };\n });\n };\n })(this));\n };\n\n IssuesController.prototype.removeNotExistingFiltersFromUrl = function() {\n var currentSearch, existingValues, filterName, filterValue, splittedValues, urlfilters;\n currentSearch = this.location.search();\n urlfilters = this.getUrlFilters();\n for (filterName in urlfilters) {\n filterValue = urlfilters[filterName];\n if (filterName === \"page\" || filterName === \"orderBy\" || filterName === \"q\") {\n continue;\n }\n if (filterName === \"tags\") {\n splittedValues = _.map((\"\" + filterValue).split(\",\"));\n } else {\n splittedValues = _.map((\"\" + filterValue).split(\",\"), function(x) {\n if (x === \"null\") {\n return null;\n } else {\n return parseInt(x);\n }\n });\n }\n existingValues = _.intersection(splittedValues, _.map(this.scope.filters[filterName], \"id\"));\n if (splittedValues.length !== existingValues.length) {\n this.location.search(filterName, existingValues.join());\n }\n }\n if (currentSearch !== this.location.search()) {\n return this.location.replace();\n }\n };\n\n IssuesController.prototype.markSelectedFilters = function(filters, urlfilters) {\n var isSelected, j, key, len, name, obj, ref, ref1, results, searchdata, val, value;\n searchdata = {};\n ref = _.omit(urlfilters, \"page\", \"orderBy\");\n for (name in ref) {\n value = ref[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n ref1 = (\"\" + value).split(\",\");\n for (j = 0, len = ref1.length; j < len; j++) {\n val = ref1[j];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n results = [];\n for (key in filters) {\n value = filters[key];\n results.push((function() {\n var k, len1, results1;\n results1 = [];\n for (k = 0, len1 = value.length; k < len1; k++) {\n obj = value[k];\n results1.push(obj.selected = isSelected(obj.type, obj.id) ? true : void 0);\n }\n return results1;\n })());\n }\n return results;\n };\n\n IssuesController.prototype.loadFilters = function() {\n var loadFilters, promise, urlfilters;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = urlfilters.q;\n }\n promise = this.loadMyFilters().then((function(_this) {\n return function(myFilters) {\n _this.scope.filters.myFilters = myFilters;\n return myFilters;\n };\n })(this));\n loadFilters = {};\n loadFilters.project = this.scope.projectId;\n loadFilters.tags = urlfilters.tags;\n loadFilters.status = urlfilters.status;\n loadFilters.q = urlfilters.q;\n loadFilters.types = urlfilters.types;\n loadFilters.severities = urlfilters.severities;\n loadFilters.priorities = urlfilters.priorities;\n loadFilters.assigned_to = urlfilters.assignedTo;\n loadFilters.owner = urlfilters.createdBy;\n promise = promise.then((function(_this) {\n return function() {\n return _this.rs.issues.filtersData(loadFilters);\n };\n })(this));\n return promise.then((function(_this) {\n return function(data) {\n var choicesFiltersFormat, tagsFilterFormat, usersFiltersFormat;\n usersFiltersFormat = function(users, type, unknownOption) {\n var reformatedUsers, unknownItem;\n reformatedUsers = _.map(users, function(t) {\n t.type = type;\n t.name = t.full_name ? t.full_name : unknownOption;\n return t;\n });\n unknownItem = _.remove(reformatedUsers, function(u) {\n return !u.id;\n });\n reformatedUsers = _.sortBy(reformatedUsers, function(u) {\n return u.name.toUpperCase();\n });\n if (unknownItem.length > 0) {\n reformatedUsers.unshift(unknownItem[0]);\n }\n return reformatedUsers;\n };\n choicesFiltersFormat = function(choices, type, byIdObject) {\n return _.map(choices, function(t) {\n t.type = type;\n return t;\n });\n };\n tagsFilterFormat = function(tags) {\n return _.map(tags, function(t) {\n t.id = t.name;\n t.type = 'tags';\n return t;\n });\n };\n _this.scope.filters.status = choicesFiltersFormat(data.statuses, \"status\", _this.scope.issueStatusById);\n _this.scope.filters.severities = choicesFiltersFormat(data.severities, \"severities\", _this.scope.severityById);\n _this.scope.filters.priorities = choicesFiltersFormat(data.priorities, \"priorities\", _this.scope.priorityById);\n _this.scope.filters.assignedTo = usersFiltersFormat(data.assigned_to, \"assignedTo\", \"Unassigned\");\n _this.scope.filters.createdBy = usersFiltersFormat(data.owners, \"createdBy\", \"Unknown\");\n _this.scope.filters.types = choicesFiltersFormat(data.types, \"types\", _this.scope.issueTypeById);\n _this.scope.filters.tags = tagsFilterFormat(data.tags);\n _this.removeNotExistingFiltersFromUrl();\n _this.markSelectedFilters(_this.scope.filters, urlfilters);\n return _this.rootscope.$broadcast(\"filters:loaded\", _this.scope.filters);\n };\n })(this));\n };\n\n IssuesController.prototype.loadIssuesRequests = 0;\n\n IssuesController.prototype.loadIssues = function() {\n var name, promise, ref, values;\n this.scope.urlFilters = this.getUrlFilters();\n this.scope.httpParams = {};\n ref = this.scope.urlFilters;\n for (name in ref) {\n values = ref[name];\n if (name === \"severities\") {\n name = \"severity\";\n } else if (name === \"orderBy\") {\n name = \"order_by\";\n } else if (name === \"priorities\") {\n name = \"priority\";\n } else if (name === \"assignedTo\") {\n name = \"assigned_to\";\n } else if (name === \"createdBy\") {\n name = \"owner\";\n } else if (name === \"status\") {\n name = \"status\";\n } else if (name === \"types\") {\n name = \"type\";\n }\n this.scope.httpParams[name] = values;\n }\n promise = this.rs.issues.list(this.scope.projectId, this.scope.httpParams);\n this.loadIssuesRequests += 1;\n promise.index = this.loadIssuesRequests;\n promise.then((function(_this) {\n return function(data) {\n if (promise.index === _this.loadIssuesRequests) {\n _this.scope.issues = data.models;\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n }\n return data;\n };\n })(this));\n return promise;\n };\n\n IssuesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n _this.initializeSubscription();\n _this.loadFilters();\n return _this.loadIssues();\n };\n })(this));\n };\n\n IssuesController.prototype.saveCurrentFiltersTo = function(newFilter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n filters[newFilter] = _this.location.search();\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.deleteMyFilter = function(filter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n delete filters[filter];\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.addNewIssue = function() {\n return this.rootscope.$broadcast(\"issueform:new\", this.scope.project);\n };\n\n IssuesController.prototype.addIssuesInBulk = function() {\n return this.rootscope.$broadcast(\"issueform:bulk\", this.scope.projectId);\n };\n\n return IssuesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"IssuesController\", IssuesController);\n\n IssuesDirective = function($log, $location, $template, $compile) {\n var link, linkOrdering, linkPagination, template;\n template = $template.get(\"issue/issue-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".issues-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, html, i, j, numPages, options, pages, ref;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n $pagEl.show();\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = j = 1, ref = numPages; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n html = template(options);\n html = $compile(html)($scope);\n return $pagEl.html(html);\n };\n $scope.$watch(\"issues\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".issues-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadIssues();\n });\n });\n $el.on(\"click\", \".issues-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadIssues();\n });\n });\n return $el.on(\"click\", \".issues-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadIssues();\n });\n });\n };\n linkOrdering = function($scope, $el, $attrs, $ctrl) {\n var colHeadElement, currentOrder, icon;\n currentOrder = $ctrl.getUrlFilter(\"orderBy\") || \"created_date\";\n if (currentOrder) {\n icon = startswith(currentOrder, \"-\") ? \"icon-arrow-up\" : \"icon-arrow-bottom\";\n colHeadElement = $el.find(\".row.title > div[data-fieldname='\" + (trim(currentOrder, \"-\")) + \"']\");\n colHeadElement.html((colHeadElement.html()) + \"\");\n }\n return $el.on(\"click\", \".row.title > div\", function(event) {\n var finalOrder, newOrder, target;\n target = angular.element(event.currentTarget);\n currentOrder = $ctrl.getUrlFilter(\"orderBy\");\n newOrder = target.data(\"fieldname\");\n finalOrder = currentOrder === newOrder ? \"-\" + newOrder : newOrder;\n return $scope.$apply(function() {\n $ctrl.replaceFilter(\"orderBy\", finalOrder);\n $ctrl.storeFilters();\n return $ctrl.loadIssues().then(function() {\n $el.find(\".row.title > div > span.icon\").remove();\n icon = startswith(finalOrder, \"-\") ? \"icon-arrow-up\" : \"icon-arrow-bottom\";\n return target.html((target.html()) + \"\");\n });\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkOrdering($scope, $el, $attrs, $ctrl);\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssues\", [\"$log\", \"$tgLocation\", \"$tgTemplate\", \"$compile\", IssuesDirective]);\n\n IssuesFiltersDirective = function($q, $log, $location, $rs, $confirm, $loading, $template, $translate, $compile, $auth) {\n var link, template, templateSelected;\n template = $template.get(\"issue/issues-filters.html\", true);\n templateSelected = $template.get(\"issue/issues-filters-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, getFiltersType, initializeSelectedFilters, reloadIssues, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection, unwatchIssues;\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\".breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 .subfilter .title\").html(title);\n return $el.find(\"h2 .subfilter .title\").prop(\"data-type\", type);\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\".breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function(filters) {\n var j, len, name, val, values;\n selectedFilters = [];\n for (name in filters) {\n values = filters[name];\n for (j = 0, len = values.length; j < len; j++) {\n val = values[j];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters(selectedFilters);\n };\n renderSelectedFilters = function(selectedFilters) {\n var html;\n _.filter(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n html = $compile(html)($scope);\n $el.find(\".filters-applied\").html(html);\n if ($auth.isAuthenticated() && selectedFilters.length > 0) {\n return $el.find(\".save-filters\").show();\n } else {\n return $el.find(\".save-filters\").hide();\n }\n };\n renderFilters = function(filters) {\n var html;\n _.filter(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n html = $compile(html)($scope);\n return $el.find(\".filter-list\").html(html);\n };\n getFiltersType = function() {\n return $el.find(\".subfilter .title\").prop('data-type');\n };\n reloadIssues = function() {\n var currentFiltersType;\n currentFiltersType = getFiltersType();\n return $q.all([$ctrl.loadIssues(), $ctrl.loadFilters()]).then(function() {\n var filters;\n filters = $scope.filters[currentFiltersType];\n return renderFilters(_.reject(filters, \"selected\"));\n });\n };\n toggleFilterSelection = function(type, id) {\n var currentFiltersType, filter, filterId, filters;\n if (type === \"myFilters\") {\n $rs.issues.getMyFilters($scope.projectId).then(function(data) {\n var filters, myFilters;\n myFilters = data;\n filters = myFilters[id];\n filters.page = 1;\n $ctrl.replaceAllFilters(filters);\n $ctrl.storeFilters();\n $ctrl.loadIssues();\n $ctrl.markSelectedFilters($scope.filters, filters);\n return initializeSelectedFilters($scope.filters);\n });\n return null;\n }\n filters = $scope.filters[type];\n filterId = type === 'tags' ? taiga.toString(id) : id;\n filter = _.find(filters, {\n id: filterId\n });\n filter.selected = !filter.selected;\n if (id === null) {\n id = \"null\";\n }\n if (filter.selected) {\n selectedFilters.push(filter);\n $ctrl.selectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n } else {\n selectedFilters = _.reject(selectedFilters, function(f) {\n return f.id === filter.id && f.type === filter.type;\n });\n $ctrl.unselectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n }\n reloadIssues();\n renderSelectedFilters(selectedFilters);\n currentFiltersType = getFiltersType();\n if (type === currentFiltersType) {\n return renderFilters(_.reject(filters, \"selected\"));\n }\n };\n $scope.$on(\"filters:loaded\", function(ctx, filters) {\n return initializeSelectedFilters(filters);\n });\n $scope.$on(\"filters:issueupdate\", function(ctx, filters) {\n var html;\n html = template({\n filters: filters.status\n });\n html = $compile(html)($scope);\n return $el.find(\".filter-list\").html(html);\n });\n selectQFilter = debounceLeading(100, function(value, oldValue) {\n if (value === void 0 || value === oldValue) {\n return;\n }\n $ctrl.replaceFilter(\"page\", null, true);\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n $ctrl.storeFilters();\n } else {\n $ctrl.replaceFilter(\"q\", value);\n $ctrl.storeFilters();\n }\n return reloadIssues();\n });\n unwatchIssues = $scope.$watch(\"issues\", function(newValue) {\n if (!_.isUndefined(newValue)) {\n $scope.$watch(\"filtersQ\", selectQFilter);\n return unwatchIssues();\n }\n });\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data(\"type\"));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories($el);\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass(\"active\");\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n if (type === \"myFilters\") {\n target.removeClass(\"active\");\n }\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter .remove-filter\", function(event) {\n var customFilterName, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n customFilterName = target.parent().data('id');\n title = $translate.instant(\"ISSUES.FILTERS.CONFIRM_DELETE.TITLE\");\n message = $translate.instant(\"ISSUES.FILTERS.CONFIRM_DELETE.MESSAGE\", {\n customFilterName: customFilterName\n });\n return $confirm.askOnDelete(title, message).then(function(askResponse) {\n var promise;\n promise = $ctrl.deleteMyFilter(customFilterName);\n promise.then(function() {\n promise = $ctrl.loadMyFilters();\n promise.then(function(filters) {\n askResponse.finish();\n $scope.filters.myFilters = filters;\n return renderFilters($scope.filters.myFilters);\n });\n return promise.then(null, function() {\n return askResponse.finish();\n });\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n });\n });\n $el.on(\"click\", \".save-filters\", function(event) {\n event.preventDefault();\n renderFilters($scope.filters[\"myFilters\"]);\n showFilters(\"My filters\", \"myFilters\");\n $el.find('.save-filters').hide();\n $el.find('.my-filter-name').removeClass(\"hidden\");\n $el.find('.my-filter-name').focus();\n return $scope.$apply();\n });\n return $el.on(\"keyup\", \".my-filter-name\", function(event) {\n var currentLoading, newFilter, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newFilter = target.val();\n currentLoading = $loading().target($el.find(\".new\")).start();\n promise = $ctrl.saveCurrentFiltersTo(newFilter);\n promise.then(function() {\n var loadPromise;\n loadPromise = $ctrl.loadMyFilters();\n loadPromise.then(function(filters) {\n var currentfilterstype;\n currentLoading.finish();\n $scope.filters.myFilters = filters;\n currentfilterstype = $el.find(\"h2 .subfilter .title\").prop('data-type');\n if (currentfilterstype === \"myFilters\") {\n renderFilters($scope.filters.myFilters);\n }\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n });\n return loadPromise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\", \"Error loading custom filters\");\n });\n });\n return promise.then(null, function() {\n currentLoading.finish();\n $el.find(\".my-filter-name\").val(newFilter).focus().select();\n return $confirm.notify(\"error\", \"Filter not saved\");\n });\n } else if (event.keyCode === 27) {\n $el.find('.my-filter-name').val('');\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssuesFilters\", [\"$q\", \"$log\", \"$tgLocation\", \"$tgResources\", \"$tgConfirm\", \"$tgLoading\", \"$tgTemplate\", \"$translate\", \"$compile\", \"$tgAuth\", IssuesFiltersDirective]);\n\n IssueStatusInlineEditionDirective = function($repo, $template, $rootscope) {\n\n /*\n Print the status of an Issue and a popover to change it.\n - tg-issue-status-inline-edition: The issue\n \n Example:\n \n div.status(tg-issue-status-inline-edition=\"issue\")\n a.issue-status(href=\"\")\n \n NOTE: This directive need 'issueStatusById' and 'project'.\n */\n var link, selectionTemplate, updateIssueStatus;\n selectionTemplate = $template.get(\"issue/issue-status-inline-edition-selection.html\", true);\n updateIssueStatus = function($el, issue, issueStatusById) {\n var issueStatusDom, issueStatusDomParent, status;\n issueStatusDomParent = $el.find(\".issue-status\");\n issueStatusDom = $el.find(\".issue-status .issue-status-bind\");\n status = issueStatusById[issue.status];\n if (status) {\n issueStatusDom.text(status.name);\n issueStatusDom.prop(\"title\", status.name);\n return issueStatusDomParent.css('color', status.color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, issue;\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueStatusInlineEdition);\n $el.on(\"click\", \".issue-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var filter, j, len, ref, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n ref = $scope.filters.status;\n for (j = 0, len = ref.length; j < len; j++) {\n filter = ref[j];\n if (filter.id === issue.status) {\n filter.count--;\n }\n }\n issue.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateIssueStatus($el, issue, $scope.issueStatusById);\n return $scope.$apply(function() {\n var k, len1, ref1;\n $repo.save(issue).then(function() {\n return $ctrl.loadIssues();\n });\n ref1 = $scope.filters.status;\n for (k = 0, len1 = ref1.length; k < len1; k++) {\n filter = ref1[k];\n if (filter.id === issue.status) {\n filter.count++;\n }\n }\n return $rootscope.$broadcast(\"filters:issueupdate\", $scope.filters);\n });\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.issue_statuses\n }));\n updateIssueStatus($el, issue, $scope.issueStatusById);\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$watch($attrs.tgIssueStatusInlineEdition, (function(_this) {\n return function(val) {\n return updateIssueStatus($el, val, $scope.issueStatusById);\n };\n })(this));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssueStatusInlineEdition\", [\"$tgRepo\", \"$tgTemplate\", \"$rootScope\", IssueStatusInlineEditionDirective]);\n\n IssueAssignedToInlineEditionDirective = function($repo, $rootscope, $translate) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, issue, updateIssue;\n updateIssue = function(issue) {\n var ctx, member;\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\"\n };\n member = $scope.usersById[issue.assigned_to];\n if (member) {\n ctx.name = member.full_name_display;\n ctx.imgurl = member.photo;\n }\n $el.find(\".avatar\").html(template(ctx));\n return $el.find(\".issue-assignedto\").attr('title', ctx.name);\n };\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueAssignedToInlineEdition);\n updateIssue(issue);\n $el.on(\"click\", \".issue-assignedto\", function(event) {\n return $rootscope.$broadcast(\"assigned-to:add\", issue);\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, updatedIssue) {\n if (updatedIssue.id === issue.id) {\n updatedIssue.assigned_to = userId;\n $repo.save(updatedIssue);\n return updateIssue(updatedIssue);\n }\n };\n })(this));\n $scope.$watch($attrs.tgIssueAssignedToInlineEdition, (function(_this) {\n return function(val) {\n return updateIssue(val);\n };\n })(this));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssueAssignedToInlineEdition\", [\"$tgRepo\", \"$rootScope\", \"$translate\", IssueAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/userstories/detail.coffee\n */\n\n(function() {\n var UsClientRequirementButtonDirective, UsStatusButtonDirective, UsStatusDisplayDirective, UsTeamRequirementButtonDirective, UserStoryDetailController, bindMethods, bindOnce, groupBy, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaUserStories\");\n\n UserStoryDetailController = (function(superClass) {\n extend(UserStoryDetailController, superClass);\n\n UserStoryDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\"];\n\n function UserStoryDetailController(scope, rootscope, repo, confirm, rs, params, q, location, log, appMetaService, navUrls, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.log = log;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.usRef = this.params.usref;\n this.scope.sectionName = this.translate.instant(\"US.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this._setMeta();\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserStoryDetailController.prototype._setMeta = function() {\n var closedTasks, description, progressPercentage, ref, title, totalTasks;\n totalTasks = this.scope.tasks.length;\n closedTasks = _.filter(this.scope.tasks, (function(_this) {\n return function(t) {\n return _this.scope.taskStatusById[t.status].is_closed;\n };\n })(this)).length;\n progressPercentage = totalTasks > 0 ? Math.round(100 * closedTasks / totalTasks) : 0;\n title = this.translate.instant(\"US.PAGE_TITLE\", {\n userStoryRef: \"#\" + this.scope.us.ref,\n userStorySubject: this.scope.us.subject,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"US.PAGE_DESCRIPTION\", {\n userStoryStatus: ((ref = this.scope.statusById[this.scope.us.status]) != null ? ref.name : void 0) || \"--\",\n userStoryPoints: this.scope.us.total_points,\n userStoryDescription: angular.element(this.scope.us.description_html || \"\").text(),\n userStoryClosedTasks: closedTasks,\n userStoryTotalTasks: totalTasks,\n userStoryProgressPercentage: progressPercentage\n });\n return this.appMetaService.setAll(title, description);\n };\n\n UserStoryDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"related-tasks:update\", (function(_this) {\n return function() {\n var allClosed;\n _this.scope.tasks = _.clone(_this.scope.tasks, false);\n allClosed = _.every(_this.scope.tasks, function(task) {\n return task.is_closed;\n });\n if (_this.scope.us.is_closed !== allClosed) {\n return _this.loadUs();\n }\n };\n })(this));\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on userstory\", 1);\n };\n })(this));\n return this.scope.$on(\"comment:new\", (function(_this) {\n return function() {\n return _this.loadUs();\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.us.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-backlog\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-kanban\", ctx);\n }\n };\n\n UserStoryDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.us_statuses;\n _this.scope.statusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.taskStatusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(_this.scope.pointsList, function(e) {\n return e.id;\n });\n return project;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadUs = function() {\n var httpParams, kanbanStaus, milestone, noMilestone;\n httpParams = _.pick(this.location.search(), \"milestone\", \"no-milestone\", \"kanban-status\");\n milestone = httpParams.milestone;\n if (milestone) {\n this.rs.userstories.storeQueryParams(this.scope.projectId, {\n milestone: milestone,\n order_by: \"sprint_order\"\n });\n }\n noMilestone = httpParams[\"no-milestone\"];\n if (noMilestone) {\n this.rs.userstories.storeQueryParams(this.scope.projectId, {\n milestone: \"null\",\n order_by: \"backlog_order\"\n });\n }\n kanbanStaus = httpParams[\"kanban-status\"];\n if (kanbanStaus) {\n this.rs.userstories.storeQueryParams(this.scope.projectId, {\n status: kanbanStaus,\n order_by: \"kanban_order\"\n });\n }\n return this.rs.userstories.getByRef(this.scope.projectId, this.params.usref).then((function(_this) {\n return function(us) {\n var ctx, ref, ref1;\n _this.scope.us = us;\n _this.scope.usId = us.id;\n _this.scope.commentModel = us;\n if (((ref = _this.scope.us.neighbors.previous) != null ? ref.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n if (((ref1 = _this.scope.us.neighbors.next) != null ? ref1.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n return us;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadSprint = function() {\n if (this.scope.us.milestone) {\n return this.rs.sprints.get(this.scope.us.project, this.scope.us.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n UserStoryDetailController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, null, this.scope.usId).then((function(_this) {\n return function(tasks) {\n _this.scope.tasks = tasks;\n return tasks;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.loadUs().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadTasks()]);\n });\n };\n })(this));\n };\n\n\n /*\n * Note: This methods (onUpvote() and onDownvote()) are related to tg-vote-button.\n * See app/modules/components/vote-button for more info\n */\n\n UserStoryDetailController.prototype.onUpvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.upvote(this.scope.usId).then(onSuccess, onError);\n };\n\n UserStoryDetailController.prototype.onDownvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.downvote(this.scope.usId).then(onSuccess, onError);\n };\n\n\n /*\n * Note: This methods (onWatch() and onUnwatch()) are related to tg-watch-button.\n * See app/modules/components/watch-button for more info\n */\n\n UserStoryDetailController.prototype.onWatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.watch(this.scope.usId).then(onSuccess, onError);\n };\n\n UserStoryDetailController.prototype.onUnwatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.unwatch(this.scope.usId).then(onSuccess, onError);\n };\n\n return UserStoryDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserStoryDetailController\", UserStoryDetailController);\n\n UsStatusDisplayDirective = function($template, $compile) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(us) {\n var html, status;\n status = $scope.statusById[us.status];\n html = template({\n is_closed: us.is_closed,\n status: status\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(us) {\n if (us != null) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsStatusDisplay\", [\"$tgTemplate\", \"$compile\", UsStatusDisplayDirective]);\n\n UsStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = (function(_this) {\n return function(us) {\n var html, status;\n status = $scope.statusById[us.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var currentLoading, onError, onSuccess, us;\n us = $model.$modelValue.clone();\n us.status = status;\n $.fn.popover().closeAll();\n currentLoading = $loading().target($el).start();\n onSuccess = function() {\n $model.$setViewValue(us);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n return currentLoading.finish();\n };\n return $repo.save(us).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".js-edit-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var status, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n status = target.data(\"status-id\");\n return save(status);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsStatusButtonDirective]);\n\n UsTeamRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"us/us-team-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n ctx = {\n canEdit: canEdit(),\n isRequired: us.team_requirement\n };\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(team_requirement) {\n var currentLoading, promise, us;\n us = $model.$modelValue.clone();\n us.team_requirement = team_requirement;\n currentLoading = $loading().target($el.find(\"label\")).start();\n promise = $tgrepo.save(us);\n promise.then(function() {\n $model.$setViewValue(us);\n currentLoading.finish();\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n $el.on(\"click\", \".team-requirement\", function(event) {\n var team_requirement;\n if (!canEdit()) {\n return;\n }\n team_requirement = !$model.$modelValue.team_requirement;\n return save(team_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsTeamRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", UsTeamRequirementButtonDirective]);\n\n UsClientRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"us/us-client-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n ctx = {\n canEdit: canEdit(),\n isRequired: us.client_requirement\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(client_requirement) {\n var currentLoading, promise, us;\n us = $model.$modelValue.clone();\n us.client_requirement = client_requirement;\n currentLoading = $loading().target($el.find(\"label\")).start();\n promise = $tgrepo.save(us);\n promise.then(function() {\n $model.$setViewValue(us);\n currentLoading.finish();\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n $el.on(\"click\", \".client-requirement\", function(event) {\n var client_requirement;\n if (!canEdit()) {\n return;\n }\n client_requirement = !$model.$modelValue.client_requirement;\n return save(client_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsClientRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", UsClientRequirementButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/tasks/detail.coffee\n */\n\n(function() {\n var TaskDetailController, TaskIsIocaineButtonDirective, TaskStatusButtonDirective, TaskStatusDisplayDirective, bindMethods, groupBy, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaTasks\");\n\n TaskDetailController = (function(superClass) {\n extend(TaskDetailController, superClass);\n\n TaskDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\"];\n\n function TaskDetailController(scope, rootscope, repo, confirm, rs, params, q, location, log, appMetaService, navUrls, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.log = log;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.taskRef = this.params.taskref;\n this.scope.sectionName = this.translate.instant(\"TASK.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this._setMeta();\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n TaskDetailController.prototype._setMeta = function() {\n var description, ref, title;\n title = this.translate.instant(\"TASK.PAGE_TITLE\", {\n taskRef: \"#\" + this.scope.task.ref,\n taskSubject: this.scope.task.subject,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"TASK.PAGE_DESCRIPTION\", {\n taskStatus: ((ref = this.scope.statusById[this.scope.task.status]) != null ? ref.name : void 0) || \"--\",\n taskDescription: angular.element(this.scope.task.description_html || \"\").text()\n });\n return this.appMetaService.setAll(title, description);\n };\n\n TaskDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on task\", 1);\n };\n })(this));\n this.scope.$on(\"custom-attributes-values:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this));\n return this.scope.$on(\"comment:new\", (function(_this) {\n return function() {\n return _this.loadTask();\n };\n })(this));\n };\n\n TaskDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.task.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else if (this.scope.task.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n if (this.scope.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n }\n };\n\n TaskDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.task_statuses;\n _this.scope.statusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadTask = function() {\n return this.rs.tasks.getByRef(this.scope.projectId, this.params.taskref).then((function(_this) {\n return function(task) {\n var ctx, ref, ref1;\n _this.scope.task = task;\n _this.scope.taskId = task.id;\n _this.scope.commentModel = task;\n if (((ref = _this.scope.task.neighbors.previous) != null ? ref.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n if (((ref1 = _this.scope.task.neighbors.next) != null ? ref1.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n return task;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadSprint = function() {\n if (this.scope.task.milestone) {\n return this.rs.sprints.get(this.scope.task.project, this.scope.task.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadUserStory = function() {\n if (this.scope.task.user_story) {\n return this.rs.userstories.get(this.scope.task.project, this.scope.task.user_story).then((function(_this) {\n return function(us) {\n _this.scope.us = us;\n return us;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.loadTask().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadUserStory()]);\n });\n };\n })(this));\n };\n\n\n /*\n * Note: This methods (onUpvote() and onDownvote()) are related to tg-vote-button.\n * See app/modules/components/vote-button for more info\n */\n\n TaskDetailController.prototype.onUpvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.upvote(this.scope.taskId).then(onSuccess, onError);\n };\n\n TaskDetailController.prototype.onDownvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.downvote(this.scope.taskId).then(onSuccess, onError);\n };\n\n\n /*\n * Note: This methods (onWatch() and onUnwatch()) are related to tg-watch-button.\n * See app/modules/components/watch-button for more info\n */\n\n TaskDetailController.prototype.onWatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.watch(this.scope.taskId).then(onSuccess, onError);\n };\n\n TaskDetailController.prototype.onUnwatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.unwatch(this.scope.taskId).then(onSuccess, onError);\n };\n\n return TaskDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskDetailController\", TaskDetailController);\n\n TaskStatusDisplayDirective = function($template, $compile) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(task) {\n var html, status;\n status = $scope.statusById[task.status];\n html = template({\n is_closed: status.is_closed,\n status: status\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(task) {\n if (task != null) {\n return render(task);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgTaskStatusDisplay\", [\"$tgTemplate\", \"$compile\", TaskStatusDisplayDirective]);\n\n TaskStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $compile, $translate, $template) {\n var link, template;\n template = $template.get(\"us/us-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = (function(_this) {\n return function(task) {\n var html, status;\n status = $scope.statusById[task.status];\n html = $compile(template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n }))($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var currentLoading, onError, onSuccess, task;\n task = $model.$modelValue.clone();\n task.status = status;\n currentLoading = $loading().target($el).start();\n onSuccess = function() {\n $model.$setViewValue(task);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n return currentLoading.finish();\n };\n return $repo.save(task).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".js-edit-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n $.fn.popover().closeAll();\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgTaskStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$compile\", \"$translate\", \"$tgTemplate\", TaskStatusButtonDirective]);\n\n TaskIsIocaineButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $compile, $template) {\n var link, template;\n template = $template.get(\"issue/iocaine-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = function(task) {\n var ctx, html;\n if (!isEditable() && !task.is_iocaine) {\n $el.html(\"\");\n return;\n }\n ctx = {\n isIocaine: task.is_iocaine,\n isEditable: isEditable()\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(is_iocaine) {\n var currentLoading, promise, task;\n task = $model.$modelValue.clone();\n task.is_iocaine = is_iocaine;\n currentLoading = $loading().target($el.find('label')).start();\n promise = $tgrepo.save(task);\n promise.then(function() {\n $model.$setViewValue(task);\n return $rootscope.$broadcast(\"object:updated\");\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n };\n })(this));\n $el.on(\"click\", \".is-iocaine\", function(event) {\n var is_iocaine;\n if (!isEditable()) {\n return;\n }\n is_iocaine = !$model.$modelValue.is_iocaine;\n return save(is_iocaine);\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgTaskIsIocaineButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$compile\", \"$tgTemplate\", TaskIsIocaineButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/team/main.coffee\n */\n\n(function() {\n var LeaveProjectDirective, TeamController, TeamFiltersDirective, TeamMemberCurrentUserDirective, TeamMemberStatsDirective, TeamMembersDirective, membersFilter, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n module = angular.module(\"taigaTeam\");\n\n TeamController = (function(superClass) {\n extend(TeamController, superClass);\n\n TeamController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$location\", \"$tgNavUrls\", \"tgAppMetaService\", \"$tgAuth\", \"$translate\", \"tgProjectService\"];\n\n function TeamController(scope, rootscope, repo, rs, params, q, location, navUrls, appMetaService, auth, translate, projectService) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.auth = auth;\n this.translate = translate;\n this.projectService = projectService;\n this.scope.sectionName = \"TEAM.SECTION_NAME\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"TEAM.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"TEAM.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n TeamController.prototype.setRole = function(role) {\n if (role) {\n return this.scope.filtersRole = role;\n } else {\n return this.scope.filtersRole = null;\n }\n };\n\n TeamController.prototype.loadMembers = function() {\n var i, len, member, ref, user;\n user = this.auth.getUser();\n this.scope.totals = {};\n ref = this.scope.activeUsers;\n for (i = 0, len = ref.length; i < len; i++) {\n member = ref[i];\n this.scope.totals[member.id] = 0;\n }\n this.scope.currentUser = _.find(this.scope.activeUsers, {\n id: user != null ? user.id : void 0\n });\n return this.scope.memberships = _.reject(this.scope.activeUsers, {\n id: user != null ? user.id : void 0\n });\n };\n\n TeamController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issuesEnabled = project.is_issues_activated;\n _this.scope.tasksEnabled = project.is_kanban_activated || project.is_backlog_activated;\n _this.scope.wikiEnabled = project.is_wiki_activated;\n _this.scope.owner = project.owner.id;\n return project;\n };\n })(this));\n };\n\n TeamController.prototype.loadMemberStats = function() {\n return this.rs.projects.memberStats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n var totals;\n totals = {};\n _.forEach(_this.scope.totals, function(total, userId) {\n var vals;\n vals = _.map(stats, function(memberStats, statsKey) {\n return memberStats[userId];\n });\n total = _.reduce(vals, function(sum, el) {\n return sum + el;\n });\n return _this.scope.totals[userId] = total;\n });\n _this.scope.stats = _this._processStats(stats);\n return _this.scope.stats.totals = _this.scope.totals;\n };\n })(this));\n };\n\n TeamController.prototype._processStat = function(stat) {\n var key, max, min, singleStat, value;\n max = _.max(_.toArray(stat));\n min = _.min(_.toArray(stat));\n singleStat = Object();\n for (key in stat) {\n if (!hasProp.call(stat, key)) continue;\n value = stat[key];\n if (value === min) {\n singleStat[key] = 0.1;\n } else if (value === max) {\n singleStat[key] = 1;\n } else {\n singleStat[key] = (value * 0.5) / max;\n }\n }\n return singleStat;\n };\n\n TeamController.prototype._processStats = function(stats) {\n var key, value;\n for (key in stats) {\n value = stats[key];\n stats[key] = this._processStat(value);\n }\n return stats;\n };\n\n TeamController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n var userRoles;\n _this.fillUsersAndRoles(project.members, project.roles);\n _this.loadMembers();\n userRoles = _.map(_this.scope.users, function(user) {\n return user.role;\n });\n _this.scope.roles = _.filter(_this.scope.roles, function(role) {\n return userRoles.indexOf(role.id) !== -1;\n });\n return _this.loadMemberStats();\n };\n })(this));\n };\n\n return TeamController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TeamController\", TeamController);\n\n TeamFiltersDirective = function() {\n return {\n templateUrl: \"team/team-filter.html\"\n };\n };\n\n module.directive(\"tgTeamFilters\", [TeamFiltersDirective]);\n\n TeamMemberStatsDirective = function() {\n return {\n templateUrl: \"team/team-member-stats.html\",\n scope: {\n stats: \"=\",\n userId: \"=user\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamMemberStats\", TeamMemberStatsDirective);\n\n TeamMemberCurrentUserDirective = function() {\n return {\n templateUrl: \"team/team-member-current-user.html\",\n scope: {\n project: \"=project\",\n currentUser: \"=currentuser\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\",\n owner: \"=owner\"\n }\n };\n };\n\n module.directive(\"tgTeamCurrentUser\", TeamMemberCurrentUserDirective);\n\n TeamMembersDirective = function() {\n var template;\n template = \"team/team-members.html\";\n return {\n templateUrl: template,\n scope: {\n memberships: \"=\",\n filtersQ: \"=filtersq\",\n filtersRole: \"=filtersrole\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\",\n owner: \"=owner\"\n }\n };\n };\n\n module.directive(\"tgTeamMembers\", TeamMembersDirective);\n\n LeaveProjectDirective = function($repo, $confirm, $location, $rs, $navurls, $translate, lightboxFactory, currentUserService) {\n var link;\n link = function($scope, $el, $attrs) {\n var leaveConfirm;\n leaveConfirm = function() {\n var confirm_leave_project_text, leave_project_text;\n leave_project_text = $translate.instant(\"TEAM.ACTION_LEAVE_PROJECT\");\n confirm_leave_project_text = $translate.instant(\"TEAM.CONFIRM_LEAVE_PROJECT\");\n return $confirm.ask(leave_project_text, confirm_leave_project_text).then((function(_this) {\n return function(response) {\n var promise;\n promise = $rs.projects.leave($scope.project.id);\n promise.then(function() {\n return currentUserService.loadProjects().then(function() {\n response.finish();\n $confirm.notify(\"success\");\n return $location.path($navurls.resolve(\"home\"));\n });\n });\n return promise.then(null, function(response) {\n response.finish();\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n };\n return $scope.leave = function() {\n if ($scope.project.owner.id === $scope.user.id) {\n return lightboxFactory.create(\"tg-lightbox-leave-project-warning\", {\n \"class\": \"lightbox lightbox-leave-project-warning\"\n }, {\n isCurrentUser: true,\n project: $scope.project\n });\n } else {\n return leaveConfirm();\n }\n };\n };\n return {\n scope: {\n user: \"=\",\n project: \"=\"\n },\n templateUrl: \"team/leave-project.html\",\n link: link\n };\n };\n\n module.directive(\"tgLeaveProject\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"$tgResources\", \"$tgNavUrls\", \"$translate\", \"tgLightboxFactory\", \"tgCurrentUserService\", LeaveProjectDirective]);\n\n membersFilter = function() {\n return function(members, filtersQ, filtersRole) {\n return _.filter(members, function(m) {\n return (!filtersRole || m.role === filtersRole.id) && (!filtersQ || m.full_name.search(new RegExp(filtersQ, \"i\")) >= 0);\n });\n };\n };\n\n module.filter('membersFilter', membersFilter);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/wiki/detail.coffee\n */\n\n(function() {\n var EditableWikiContentDirective, WikiDetailController, WikiSummaryDirective, bindOnce, debounce, groupBy, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaWiki\");\n\n WikiDetailController = (function(superClass) {\n extend(WikiDetailController, superClass);\n\n WikiDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgModel\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$filter\", \"$log\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\"];\n\n function WikiDetailController(scope, rootscope, repo, model, confirm, rs, params, q, location, filter, log, appMetaService, navUrls, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.model = model;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.filter = filter;\n this.log = log;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.translate = translate;\n this.scope.projectSlug = this.params.pslug;\n this.scope.wikiSlug = this.params.slug;\n this.scope.wikiTitle = this.scope.wikiSlug;\n this.scope.sectionName = \"Wiki\";\n this.scope.linksVisible = false;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this._setMeta();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n WikiDetailController.prototype._setMeta = function() {\n var description, ref, ref1, ref2, title;\n title = this.translate.instant(\"WIKI.PAGE_TITLE\", {\n wikiPageName: this.scope.wikiTitle,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"WIKI.PAGE_DESCRIPTION\", {\n wikiPageContent: angular.element(((ref = this.scope.wiki) != null ? ref.html : void 0) || \"\").text(),\n totalEditions: ((ref1 = this.scope.wiki) != null ? ref1.editions : void 0) || 0,\n lastModifiedDate: moment((ref2 = this.scope.wiki) != null ? ref2.modified_date : void 0).format(this.translate.instant(\"WIKI.DATETIME\"))\n });\n return this.appMetaService.setAll(title, description);\n };\n\n WikiDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_wiki_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWiki = function() {\n var promise;\n promise = this.rs.wiki.getBySlug(this.scope.projectId, this.params.slug);\n promise.then((function(_this) {\n return function(wiki) {\n _this.scope.wiki = wiki;\n _this.scope.wikiId = wiki.id;\n return _this.scope.wiki;\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function(xhr) {\n var data;\n _this.scope.wikiId = null;\n if (_this.scope.project.my_permissions.indexOf(\"add_wiki_page\") === -1) {\n return null;\n }\n data = {\n project: _this.scope.projectId,\n slug: _this.scope.wikiSlug,\n content: \"\"\n };\n _this.scope.wiki = _this.model.make_model(\"wiki\", data);\n return _this.scope.wiki;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWikiLinks = function() {\n return this.rs.wiki.listLinks(this.scope.projectId).then((function(_this) {\n return function(wikiLinks) {\n var selectedWikiLink;\n _this.scope.wikiLinks = wikiLinks;\n selectedWikiLink = _.find(wikiLinks, {\n href: _this.scope.wikiSlug\n });\n if (selectedWikiLink != null) {\n return _this.scope.wikiTitle = selectedWikiLink.title;\n }\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.q.all([_this.loadWikiLinks(), _this.loadWiki()]).then(_this.checkLinksPerms.bind(_this));\n };\n })(this));\n };\n\n WikiDetailController.prototype.checkLinksPerms = function() {\n if (this.scope.project.my_permissions.indexOf(\"modify_wiki_link\") !== -1 || (this.scope.project.my_permissions.indexOf(\"view_wiki_links\") !== -1 && this.scope.wikiLinks.length)) {\n return this.scope.linksVisible = true;\n }\n };\n\n WikiDetailController.prototype[\"delete\"] = function() {\n var message, title;\n title = this.translate.instant(\"WIKI.DELETE_LIGHTBOX_TITLE\");\n message = this.scope.wikiTitle;\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSuccess;\n onSuccess = function() {\n var ctx;\n askResponse.finish();\n ctx = {\n project: _this.scope.projectSlug\n };\n _this.location.path(_this.navUrls.resolve(\"project-wiki\", ctx));\n return _this.confirm.notify(\"success\");\n };\n onError = function() {\n askResponse.finish(false);\n return _this.confirm.notify(\"error\");\n };\n return _this.repo.remove(_this.scope.wiki).then(onSuccess, onError);\n };\n })(this));\n };\n\n return WikiDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"WikiDetailController\", WikiDetailController);\n\n WikiSummaryDirective = function($log, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"wiki/wiki-summary.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var render;\n render = function(wiki) {\n var ctx, html, user;\n if ($scope.usersById == null) {\n $log.error(\"WikiSummaryDirective requires userById set in scope.\");\n } else {\n user = $scope.usersById[wiki.last_modifier];\n }\n if (user === void 0) {\n user = {\n name: \"unknown\",\n imgUrl: \"/\" + window._version + \"/images/user-noimage.png\"\n };\n } else {\n user = {\n name: user.full_name_display,\n imgUrl: user.photo\n };\n }\n ctx = {\n totalEditions: wiki.editions,\n lastModifiedDate: moment(wiki.modified_date).format($translate.instant(\"WIKI.DATETIME\")),\n user: user\n };\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n return render(wikiPage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgWikiSummary\", [\"$log\", \"$tgTemplate\", \"$compile\", \"$translate\", WikiSummaryDirective]);\n\n EditableWikiContentDirective = function($window, $document, $repo, $confirm, $loading, $analytics, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var cancelEdition, disableEdition, getSelectedText, isEditable, save, switchToEditMode, switchToReadMode;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_wiki_page\") !== -1;\n };\n switchToEditMode = function() {\n $el.find('.edit-wiki-content').show();\n $el.find('.view-wiki-content').hide();\n return $el.find('textarea').focus();\n };\n switchToReadMode = function() {\n $el.find('.edit-wiki-content').hide();\n return $el.find('.view-wiki-content').show();\n };\n disableEdition = function() {\n $el.find(\".view-wiki-content .edit\").remove();\n return $el.find(\".edit-wiki-content\").remove();\n };\n cancelEdition = function() {\n if (!$model.$modelValue.id) {\n return;\n }\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n return switchToReadMode();\n };\n getSelectedText = function() {\n if ($window.getSelection) {\n return $window.getSelection().toString();\n } else if ($document.selection) {\n return $document.selection.createRange().text;\n }\n return null;\n };\n save = $qqueue.bindAdd(function(wiki) {\n var currentLoading, onError, onSuccess, promise;\n onSuccess = function(wikiPage) {\n if (wiki.id == null) {\n $analytics.trackEvent(\"wikipage\", \"create\", \"create wiki page\", 1);\n }\n $model.$setViewValue(wikiPage.clone());\n $confirm.notify(\"success\");\n return switchToReadMode();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n currentLoading = $loading().removeClasses(\"icon-floppy\").target($el.find('.icon-floppy')).start();\n if (wiki.id != null) {\n promise = $repo.save(wiki).then(onSuccess, onError);\n } else {\n promise = $repo.create(\"wiki\", wiki).then(onSuccess, onError);\n }\n return promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n });\n $el.on(\"click\", \"a\", function(event) {\n var href, target;\n target = angular.element(event.target);\n href = target.attr('href');\n if (href.indexOf(\"#\") === 0) {\n event.preventDefault();\n return $('body').scrollTop($(href).offset().top);\n }\n });\n $el.on(\"mousedown\", \".view-wiki-content\", function(event) {\n var target;\n target = angular.element(event.target);\n if (!isEditable()) {\n return;\n }\n if (event.button === 2) {\n\n }\n });\n $el.on(\"mouseup\", \".view-wiki-content\", function(event) {\n var target;\n target = angular.element(event.target);\n if (getSelectedText()) {\n return;\n }\n if (!isEditable()) {\n return;\n }\n if (target.is('a')) {\n return;\n }\n if (target.is('pre')) {\n return;\n }\n return switchToEditMode();\n });\n $el.on(\"click\", \".save\", debounce(2000, function() {\n return save($scope.wiki);\n }));\n $el.on(\"click\", \".cancel\", function() {\n return cancelEdition();\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n return cancelEdition();\n }\n });\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n if (isEditable()) {\n $el.addClass('editable');\n if ((wikiPage.id == null) || $.trim(wikiPage.content).length === 0) {\n return switchToEditMode();\n }\n } else {\n return disableEdition();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n templateUrl: \"wiki/editable-wiki-content.html\"\n };\n };\n\n module.directive(\"tgEditableWikiContent\", [\"$window\", \"$document\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgAnalytics\", \"$tgQqueue\", EditableWikiContentDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/wiki/detail.coffee\n */\n\n(function() {\n var WikiNavDirective, bindOnce, groupBy, mixOf, module, taiga;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaWiki\");\n\n WikiNavDirective = function($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $loading, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"wiki/wiki-nav.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render;\n $ctrl = $el.controller();\n if ($attrs.ngModel == null) {\n return $log.error(\"WikiNavDirective: no ng-model attr is defined\");\n }\n render = function(wikiLinks) {\n var addWikiLinkPermission, deleteWikiLinkPermission, html;\n addWikiLinkPermission = $scope.project.my_permissions.indexOf(\"add_wiki_link\") > -1;\n deleteWikiLinkPermission = $scope.project.my_permissions.indexOf(\"delete_wiki_link\") > -1;\n html = template({\n wikiLinks: wikiLinks,\n projectSlug: $scope.projectSlug,\n addWikiLinkPermission: addWikiLinkPermission,\n deleteWikiLinkPermission: deleteWikiLinkPermission\n });\n html = $compile(html)($scope);\n $el.off();\n $el.html(html);\n $el.on(\"click\", \".wiki-link .link-title\", function(event) {\n var linkId, linkSlug, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n linkSlug = $scope.wikiLinks[linkId].href;\n return $scope.$apply(function() {\n var ctx;\n ctx = {\n project: $scope.projectSlug,\n slug: linkSlug\n };\n return $location.path($navUrls.resolve(\"project-wiki-page\", ctx));\n });\n });\n $el.on(\"click\", \".add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new input\").focus();\n return $el.find(\".add-button\").hide();\n });\n $el.on(\"click\", \".wiki-link .icon-delete\", function(event) {\n var linkId, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n title = $translate.instant(\"WIKI.DELETE_LIGHTBOX_TITLE\");\n message = $scope.wikiLinks[linkId].title;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var promise;\n promise = $tgrepo.remove($scope.wikiLinks[linkId]);\n promise.then(function() {\n promise = $ctrl.loadWikiLinks();\n promise.then(function() {\n askResponse.finish();\n return render($scope.wikiLinks);\n });\n return promise.then(null, function() {\n return askResponse.finish();\n });\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n });\n return $el.on(\"keyup\", \".new input\", function(event) {\n var currentLoading, newLink, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newLink = target.val();\n currentLoading = $loading().target($el.find(\".new\")).start();\n promise = $tgrepo.create(\"wiki-links\", {\n project: $scope.projectId,\n title: newLink\n });\n promise.then(function() {\n var loadPromise;\n $analytics.trackEvent(\"wikilink\", \"create\", \"create wiki link\", 1);\n loadPromise = $ctrl.loadWikiLinks();\n loadPromise.then(function() {\n currentLoading.finish();\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return render($scope.wikiLinks);\n });\n return loadPromise.then(null, function() {\n currentLoading.finish();\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return $confirm.notify(\"error\", \"Error loading wiki links\");\n });\n });\n return promise.then(null, function(error) {\n var ref;\n currentLoading.finish();\n $el.find(\".new input\").val(newLink);\n $el.find(\".new input\").focus().select();\n if ((error != null ? (ref = error.__all__) != null ? ref[0] : void 0 : void 0) != null) {\n return $confirm.notify(\"error\", \"The link already exists\");\n } else {\n return $confirm.notify(\"error\");\n }\n });\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWikiNav\", [\"$tgRepo\", \"$log\", \"$tgLocation\", \"$tgConfirm\", \"$tgNavUrls\", \"$tgAnalytics\", \"$tgLoading\", \"$tgTemplate\", \"$compile\", \"$translate\", WikiNavDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/lightboxes.coffee\n */\n\n(function() {\n var ChangeOwnerLightboxController, ChangeOwnerLightboxDirective, LbRequestOwnershipDirective, LightboxAddMembersController, LightboxAddMembersDirective, LightboxAddMembersWarningMessageDirective, TransferProjectStartSuccessDirective, debounce, module, taiga;\n\n taiga = this.taiga;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaKanban\");\n\n LightboxAddMembersController = (function() {\n LightboxAddMembersController.$inject = [\"$scope\", \"lightboxService\", \"tgLoader\", \"$tgConfirm\", \"$tgResources\", \"$rootScope\"];\n\n function LightboxAddMembersController(scope1, lightboxService1, tgLoader, confirm, rs1, rootScope) {\n var pendingMembersCount;\n this.scope = scope1;\n this.lightboxService = lightboxService1;\n this.tgLoader = tgLoader;\n this.confirm = confirm;\n this.rs = rs1;\n this.rootScope = rootScope;\n this._defaultMaxInvites = 4;\n this._defaultRole = this.project.roles[0].id;\n this.form = null;\n this.submitInvites = false;\n this.canAddUsers = true;\n this.memberInvites = [];\n if (this.project.max_memberships === null) {\n this.membersLimit = this._defaultMaxInvites;\n } else {\n pendingMembersCount = Math.max(this.project.max_memberships - this.project.total_memberships, 0);\n this.membersLimit = Math.min(pendingMembersCount, this._defaultMaxInvites);\n }\n this.addSingleMember();\n }\n\n LightboxAddMembersController.prototype.addSingleMember = function() {\n this.memberInvites.push({\n email: '',\n role_id: this._defaultRole\n });\n if (this.memberInvites.length >= this.membersLimit) {\n this.canAddUsers = false;\n }\n return this.showWarningMessage = !this.canAddUsers && this.project.total_memberships + this.memberInvites.length === this.project.max_memberships;\n };\n\n LightboxAddMembersController.prototype.removeSingleMember = function(index) {\n this.memberInvites.splice(index, 1);\n this.canAddUsers = true;\n return this.showWarningMessage = this.membersLimit === 1;\n };\n\n LightboxAddMembersController.prototype.submit = function() {\n var promise;\n this.form.initializeFields();\n this.form.reset();\n if (!this.form.validate()) {\n return;\n }\n this.memberInvites = _.filter(this.memberInvites, function(invites) {\n return invites.email !== \"\";\n });\n this.submitInvites = true;\n promise = this.rs.memberships.bulkCreateMemberships(this.project.id, this.memberInvites, this.invitationText);\n return promise.then(this._onSuccessInvite.bind(this), this._onErrorInvite.bind(this));\n };\n\n LightboxAddMembersController.prototype._onSuccessInvite = function() {\n this.submitInvites = false;\n this.rootScope.$broadcast(\"membersform:new:success\");\n this.lightboxService.closeAll();\n return this.confirm.notify(\"success\");\n };\n\n LightboxAddMembersController.prototype._onErrorInvite = function(response) {\n this.submitInvites = false;\n this.form.setErrors(response.data);\n if (response.data._error_message) {\n return this.confirm.notify(\"error\", response.data._error_message);\n }\n };\n\n return LightboxAddMembersController;\n\n })();\n\n module.controller(\"LbAddMembersController\", LightboxAddMembersController);\n\n LightboxAddMembersDirective = function(lightboxService) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n lightboxService.open(el);\n return ctrl.form = el.find(\"form\").checksley();\n };\n return {\n scope: {},\n bindToController: {\n project: '='\n },\n controller: 'LbAddMembersController',\n controllerAs: 'vm',\n templateUrl: 'admin/lightbox-add-members.html',\n link: link\n };\n };\n\n module.directive(\"tgLbAddMembers\", [\"lightboxService\", LightboxAddMembersDirective]);\n\n LightboxAddMembersWarningMessageDirective = function() {\n return {\n templateUrl: \"admin/lightbox-add-members-no-more=memberships-warning-message.html\",\n scope: {\n project: \"=\"\n }\n };\n };\n\n module.directive(\"tgLightboxAddMembersWarningMessage\", [LightboxAddMembersWarningMessageDirective]);\n\n LbRequestOwnershipDirective = function(lightboxService, rs, confirmService, $translate) {\n return {\n link: function(scope, el) {\n lightboxService.open(el);\n return scope.request = function() {\n scope.loading = true;\n return rs.projects.transferRequest(scope.projectId).then(function() {\n scope.loading = false;\n lightboxService.close(el);\n return confirmService.notify(\"success\", $translate.instant(\"ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP_SUCCESS\"));\n });\n };\n },\n templateUrl: \"common/lightbox/lightbox-request-ownership.html\"\n };\n };\n\n module.directive('tgLbRequestOwnership', [\"lightboxService\", \"tgResources\", \"$tgConfirm\", \"$translate\", LbRequestOwnershipDirective]);\n\n ChangeOwnerLightboxController = (function() {\n function ChangeOwnerLightboxController(rs1, lightboxService1, confirm, translate) {\n this.rs = rs1;\n this.lightboxService = lightboxService1;\n this.confirm = confirm;\n this.translate = translate;\n this.users = [];\n this.q = \"\";\n this.commentOpen = false;\n }\n\n ChangeOwnerLightboxController.prototype.limit = 3;\n\n ChangeOwnerLightboxController.prototype.normalizeString = function(normalizedString) {\n normalizedString = normalizedString.replace(\"Á\", \"A\").replace(\"Ä\", \"A\").replace(\"À\", \"A\");\n normalizedString = normalizedString.replace(\"É\", \"E\").replace(\"Ë\", \"E\").replace(\"È\", \"E\");\n normalizedString = normalizedString.replace(\"Í\", \"I\").replace(\"Ï\", \"I\").replace(\"Ì\", \"I\");\n normalizedString = normalizedString.replace(\"Ó\", \"O\").replace(\"Ö\", \"O\").replace(\"Ò\", \"O\");\n normalizedString = normalizedString.replace(\"Ú\", \"U\").replace(\"Ü\", \"U\").replace(\"Ù\", \"U\");\n return normalizedString;\n };\n\n ChangeOwnerLightboxController.prototype.filterUsers = function(user) {\n var text, username;\n username = user.full_name_display.toUpperCase();\n username = this.normalizeString(username);\n text = this.q.toUpperCase();\n text = this.normalizeString(text);\n return _.includes(username, text);\n };\n\n ChangeOwnerLightboxController.prototype.getUsers = function() {\n var users;\n if (!this.users.length && !this.q.length) {\n users = this.activeUsers;\n } else {\n users = this.users;\n }\n users = users.slice(0, this.limit);\n users = _.reject(users, {\n \"selected\": true\n });\n return _.reject(users, {\n \"id\": this.currentOwnerId\n });\n };\n\n ChangeOwnerLightboxController.prototype.userSearch = function() {\n this.users = this.activeUsers;\n this.selected = _.find(this.users, {\n \"selected\": true\n });\n if (this.q) {\n return this.users = _.filter(this.users, this.filterUsers.bind(this));\n }\n };\n\n ChangeOwnerLightboxController.prototype.selectUser = function(user) {\n this.activeUsers = _.map(this.activeUsers, function(user) {\n user.selected = false;\n return user;\n });\n user.selected = true;\n return this.userSearch();\n };\n\n ChangeOwnerLightboxController.prototype.submit = function() {\n this.loading = true;\n return this.rs.projects.transferStart(this.projectId, this.selected.id, this.comment).then((function(_this) {\n return function() {\n var desc, title;\n _this.loading = false;\n _this.lightboxService.closeAll();\n title = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_TITLE\");\n desc = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_DESC\");\n return _this.confirm.success(title, desc, {\n type: \"svg\",\n name: \"icon-speak-up\"\n });\n };\n })(this));\n };\n\n return ChangeOwnerLightboxController;\n\n })();\n\n ChangeOwnerLightboxController.$inject = [\"tgResources\", \"lightboxService\", \"$tgConfirm\", \"$translate\"];\n\n module.controller('ChangeOwnerLightbox', ChangeOwnerLightboxController);\n\n ChangeOwnerLightboxDirective = function(lightboxService, lightboxKeyboardNavigationService, $template, $compile) {\n var link;\n link = function(scope, el) {\n return lightboxService.open(el);\n };\n return {\n scope: true,\n controller: \"ChangeOwnerLightbox\",\n controllerAs: \"vm\",\n bindToController: {\n currentOwnerId: \"=\",\n projectId: \"=\",\n activeUsers: \"=\"\n },\n templateUrl: \"common/lightbox/lightbox-change-owner.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbChangeOwner\", [\"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", ChangeOwnerLightboxDirective]);\n\n TransferProjectStartSuccessDirective = function(lightboxService) {\n var link;\n link = function(scope, el) {\n scope.close = function() {\n return lightboxService.close(el);\n };\n return lightboxService.open(el);\n };\n return {\n templateUrl: \"common/lightbox/lightbox-transfer-project-start-success.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbTransferProjectStartSuccess\", [\"lightboxService\", TransferProjectStartSuccessDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/memberships.coffee\n */\n\n(function() {\n var MembershipsController, MembershipsDirective, MembershipsRowActionsDirective, MembershipsRowAdminCheckboxDirective, MembershipsRowAvatarDirective, MembershipsRowRoleSelectorDirective, NoMoreMembershipsExplanationDirective, bindMethods, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n MembershipsController = (function(superClass) {\n extend(MembershipsController, superClass);\n\n MembershipsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgAppMetaService\", \"$translate\", \"$tgAuth\", \"tgLightboxFactory\"];\n\n function MembershipsController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, analytics, appMetaService, translate, auth, lightboxFactory1) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.auth = auth;\n this.lightboxFactory = lightboxFactory1;\n bindMethods(this);\n this.scope.project = {};\n this.scope.filters = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.MEMBERSHIPS.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"membersform:new:success\", (function(_this) {\n return function() {\n _this.loadInitialData();\n return _this.analytics.trackEvent(\"membership\", \"create\", \"create memberships on admin\", 1);\n };\n })(this));\n }\n\n MembershipsController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.canAddUsers = project.max_memberships === null || project.max_memberships > project.total_memberships;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadMembers = function() {\n var httpFilters;\n httpFilters = this.getUrlFilters();\n return this.rs.memberships.list(this.scope.projectId, httpFilters).then((function(_this) {\n return function(data) {\n _this.scope.memberships = _.filter(data.models, function(membership) {\n return membership.user === null || membership.is_user_active;\n });\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n return data;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadInitialData = function() {\n return this.loadProject().then((function(_this) {\n return function() {\n return _this.q.all([_this.loadMembers(), _this.auth.refresh()]);\n };\n })(this));\n };\n\n MembershipsController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n MembershipsController.prototype.addNewMembers = function() {\n return this.lightboxFactory.create('tg-lb-add-members', {\n \"class\": \"lightbox lightbox-add-member\",\n \"project\": \"project\"\n }, {\n \"project\": this.scope.project\n });\n };\n\n MembershipsController.prototype.showLimitUsersWarningMessage = function() {\n var icon, message, title;\n title = this.translate.instant(\"ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING\");\n message = this.translate.instant(\"ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING_MESSAGE\", {\n members: this.scope.project.max_memberships\n });\n icon = \"/\" + window._version + \"/svg/icons/team-question.svg\";\n return this.confirm.success(title, message, {\n name: icon,\n type: \"img\"\n });\n };\n\n return MembershipsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"MembershipsController\", MembershipsController);\n\n MembershipsDirective = function($template, $compile) {\n var link, linkPagination, template;\n template = $template.get(\"admin/admin-membership-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".memberships-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, html, i, j, numPages, options, pages, ref;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = j = 1, ref = numPages; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n html = template(options);\n html = $compile(html)($scope);\n $pagEl.html(html);\n return $pagEl.show();\n };\n $scope.$watch(\"memberships\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".memberships-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadMembers();\n });\n });\n $el.on(\"click\", \".memberships-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadMembers();\n });\n });\n return $el.on(\"click\", \".memberships-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadMembers();\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMemberships\", [\"$tgTemplate\", \"$compile\", MembershipsDirective]);\n\n MembershipsRowAvatarDirective = function($log, $template, $translate) {\n var link, template;\n template = $template.get(\"admin/memberships-row-avatar.html\", true);\n link = function($scope, $el, $attrs) {\n var member, pending, render;\n pending = $translate.instant(\"ADMIN.MEMBERSHIP.STATUS_PENDING\");\n render = function(member) {\n var ctx, html;\n ctx = {\n full_name: member.full_name ? member.full_name : \"\",\n email: member.user_email ? member.user_email : member.email,\n imgurl: member.photo ? member.photo : \"/\" + window._version + \"/images/unnamed.png\",\n pending: !member.is_user_active ? pending : \"\",\n isOwner: member.is_owner\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowAvatar == null) {\n return $log.error(\"MembershipsRowAvatarDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAvatar);\n render(member);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowAvatar\", [\"$log\", \"$tgTemplate\", '$translate', MembershipsRowAvatarDirective]);\n\n MembershipsRowAdminCheckboxDirective = function($log, $repo, $confirm, $template, $compile) {\n var link, template;\n template = $template.get(\"admin/admin-memberships-row-checkbox.html\", true);\n link = function($scope, $el, $attrs) {\n var html, member, render;\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n if ($attrs.tgMembershipsRowAdminCheckbox == null) {\n return $log.error(\"MembershipsRowAdminCheckboxDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAdminCheckbox);\n if (member.is_owner) {\n $el.find(\".js-check\").remove();\n return;\n }\n render = function(member) {\n var ctx, html;\n ctx = {\n inputId: \"is-admin-\" + member.id\n };\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $el.on(\"click\", \":checkbox\", (function(_this) {\n return function(event) {\n var onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function(data) {\n member.revert();\n $el.find(\":checkbox\").prop(\"checked\", member.is_admin);\n return $confirm.notify(\"error\", data.is_admin[0]);\n };\n target = angular.element(event.currentTarget);\n member.is_admin = target.prop(\"checked\");\n return $repo.save(member).then(onSuccess, onError);\n };\n })(this));\n html = render(member);\n if (member.is_admin) {\n return $el.find(\":checkbox\").prop(\"checked\", true);\n }\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowAdminCheckbox\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgTemplate\", \"$compile\", MembershipsRowAdminCheckboxDirective]);\n\n MembershipsRowRoleSelectorDirective = function($log, $repo, $confirm) {\n var link, template;\n template = _.template(\"\");\n link = function($scope, $el, $attrs) {\n var $ctrl, html, member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n roleList: $scope.project.roles,\n selectedRole: member.role\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowRoleSelector == null) {\n return $log.error(\"MembershipsRowRoleSelectorDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowRoleSelector);\n html = render(member);\n $el.on(\"change\", \"select\", (function(_this) {\n return function(event) {\n var newRole, onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n target = angular.element(event.currentTarget);\n newRole = parseInt(target.val(), 10);\n if (member.role !== newRole) {\n member.role = newRole;\n return $repo.save(member).then(onSuccess, onError);\n }\n };\n })(this));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowRoleSelector\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", MembershipsRowRoleSelectorDirective]);\n\n MembershipsRowActionsDirective = function($log, $repo, $rs, $confirm, $compile, $translate, $location, $navUrls, lightboxFactory) {\n var activedTemplate, link, pendingTemplate;\n activedTemplate = \"
\\n
\\n\\n \\n \\n \\n\";\n pendingTemplate = \"\\n\\n\\n \\n \\n \\n\";\n link = function($scope, $el, $attrs) {\n var $ctrl, leaveConfirm, member, render;\n render = function(member) {\n var html;\n if (member.user) {\n html = $compile(activedTemplate)($scope);\n } else {\n html = $compile(pendingTemplate)($scope);\n }\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowActions == null) {\n return $log.error(\"MembershipsRowActionsDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowActions);\n render(member);\n $el.on(\"click\", \".js-resend\", function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function() {\n var text;\n text = $translate.instant(\"ADMIN.MEMBERSHIP.SUCCESS_SEND_INVITATION\", {\n email: $scope.member.email\n });\n return $confirm.notify(\"success\", text);\n };\n onError = function() {\n var text;\n text = $translate.instant(\"ADMIM.MEMBERSHIP.ERROR_SEND_INVITATION\");\n return $confirm.notify(\"error\", text);\n };\n return $rs.memberships.resendInvitation($scope.member.id).then(onSuccess, onError);\n });\n leaveConfirm = function() {\n var defaultMsg, message, title;\n title = $translate.instant(\"ADMIN.MEMBERSHIP.DELETE_MEMBER\");\n defaultMsg = $translate.instant(\"ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE\", {\n email: member.email\n });\n message = member.user ? member.full_name : defaultMsg;\n return $confirm.askOnDelete(title, message).then(function(askResponse) {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n var text;\n askResponse.finish();\n if (member.user !== $scope.user.id) {\n if ($scope.page > 1 && ($scope.count - 1) <= $scope.paginatedBy) {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n }\n $ctrl.loadInitialData();\n } else {\n $location.path($navUrls.resolve(\"home\"));\n }\n text = $translate.instant(\"ADMIN.MEMBERSHIP.SUCCESS_DELETE\", {\n message: message\n });\n return $confirm.notify(\"success\", text, null, 5000);\n };\n })(this);\n onError = (function(_this) {\n return function() {\n var text;\n askResponse.finish(false);\n text = $translate.instant(\"ADMIN.MEMBERSHIP.ERROR_DELETE\", {\n message: message\n });\n return $confirm.notify(\"error\", text);\n };\n })(this);\n return $repo.remove(member).then(onSuccess, onError);\n });\n };\n $el.on(\"click\", \".delete\", function(event) {\n var isCurrentUser;\n event.preventDefault();\n if ($scope.project.owner.id === member.user) {\n isCurrentUser = $scope.user.id === member.user;\n return lightboxFactory.create(\"tg-lightbox-leave-project-warning\", {\n \"class\": \"lightbox lightbox-leave-project-warning\"\n }, {\n isCurrentUser: isCurrentUser,\n project: $scope.project\n });\n } else {\n return leaveConfirm();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowActions\", [\"$log\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$compile\", \"$translate\", \"$tgLocation\", \"$tgNavUrls\", \"tgLightboxFactory\", MembershipsRowActionsDirective]);\n\n NoMoreMembershipsExplanationDirective = function() {\n return {\n templateUrl: \"admin/no-more-memberships-explanation.html\",\n scope: {\n project: \"=\"\n }\n };\n };\n\n module.directive(\"tgNoMoreMembershipsExplanation\", [NoMoreMembershipsExplanationDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/nav.coffee\n */\n\n(function() {\n var AdminNavigationDirective, module;\n\n AdminNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgAdminNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#adminmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaAdmin\");\n\n module.directive(\"tgAdminNavigation\", AdminNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/project-profile.coffee\n */\n\n(function() {\n var AdminProjectChangeOwnerDirective, AdminProjectRequestOwnershipDirective, AdminProjectRestrictionsDirective, CsvExporterController, CsvExporterIssuesController, CsvExporterTasksController, CsvExporterUserstoriesController, CsvIssueDirective, CsvTaskDirective, CsvUsDirective, ProjectDefaultValuesDirective, ProjectExportDirective, ProjectLogoDirective, ProjectLogoModelDirective, ProjectModulesDirective, ProjectProfileController, ProjectProfileDirective, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectProfileController = (function(superClass) {\n extend(ProjectProfileController, superClass);\n\n ProjectProfileController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\", \"$tgAuth\", \"tgCurrentUserService\"];\n\n function ProjectProfileController(scope1, rootscope, repo, confirm, rs, params, q, location, navUrls, appMetaService, translate, tgAuth, currentUserService1) {\n var promise;\n this.scope = scope1;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.tgAuth = tgAuth;\n this.currentUserService = currentUserService1;\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, sectionName, title;\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.PAGE_TITLE\", {\n sectionName: sectionName,\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n _this.appMetaService.setAll(title, description);\n return _this.fillUsersAndRoles(_this.scope.project.members, _this.scope.project.roles);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:loaded\", (function(_this) {\n return function() {\n var description, sectionName, title;\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.PAGE_TITLE\", {\n sectionName: sectionName,\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n }\n\n ProjectProfileController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.prioritiesList = _.sortBy(project.priorities, \"order\");\n _this.scope.severitiesList = _.sortBy(project.severities, \"order\");\n _this.scope.issueTypesList = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectProfileController.prototype.loadInitialData = function() {\n return this.q.all([this.loadProject(), this.tgAuth.refresh()]);\n };\n\n ProjectProfileController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.project);\n };\n\n return ProjectProfileController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectProfileController\", ProjectProfileController);\n\n ProjectProfileDirective = function($repo, $confirm, $loading, $navurls, $location, projectService, currentUserService) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, form, submit, submitButton;\n $ctrl = $el.controller();\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.save($scope.project);\n promise.then(function() {\n var newUrl;\n currentLoading.finish();\n $confirm.notify(\"success\");\n newUrl = $navurls.resolve(\"project-admin-project-profile-details\", {\n project: $scope.project.slug\n });\n $location.path(newUrl);\n $ctrl.loadInitialData();\n projectService.fetchProject();\n return currentUserService.loadProjects();\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectProfile\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgNavUrls\", \"$tgLocation\", \"tgProjectService\", \"tgCurrentUserService\", ProjectProfileDirective]);\n\n ProjectDefaultValuesDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.save($scope.project);\n promise.then(function() {\n currentLoading.finish();\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectDefaultValues\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", ProjectDefaultValuesDirective]);\n\n ProjectModulesDirective = function($repo, $confirm, $loading, projectService) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n submit = (function(_this) {\n return function() {\n var form, promise;\n form = $el.find(\"form\").checksley();\n form.initializeFields();\n form.reset();\n if (!form.validate()) {\n return;\n }\n promise = $repo.save($scope.project);\n promise.then(function() {\n $scope.$emit(\"project:loaded\", $scope.project);\n $confirm.notify(\"success\");\n return projectService.fetchProject();\n });\n return promise.then(null, function(data) {\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this);\n $el.on(\"change\", \".module-activation.module-direct-active input\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"submit\", \"form\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \".icon-save\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"keydown\", \".videoconference-attributes input\", function(e) {\n return e.which !== 32;\n });\n $scope.$watch(\"project.videoconferences\", function(newVal, oldVal) {\n if ((newVal != null) && (oldVal != null) && newVal !== oldVal) {\n return $scope.project.videoconferences_extra_data = \"\";\n }\n });\n $scope.$watch(\"isVideoconferenceActivated\", function(newValue, oldValue) {\n if (newValue === false) {\n $scope.project.videoconferences = null;\n $scope.project.videoconferences_extra_data = \"\";\n if (oldValue === true) {\n return submit();\n }\n }\n });\n return $scope.$watch(\"project\", function(project) {\n if (project.videoconferences != null) {\n return $scope.isVideoconferenceActivated = true;\n } else {\n return $scope.isVideoconferenceActivated = false;\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectModules\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"tgProjectService\", ProjectModulesDirective]);\n\n ProjectExportDirective = function($window, $rs, $confirm, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var asyn_message, buttonsEl, dump_ready_text, hideButtons, hideResult, hideSpinner, loading_msg, loading_title, resultEl, resultMessageEl, resultTitleEl, setAsyncMessage, setAsyncTitle, setLoadingMessage, setLoadingTitle, setSyncMessage, setSyncTitle, showButtons, showErrorMode, showExportResultAsyncMode, showExportResultSyncMode, showLoadingMode, showResult, showSpinner, spinnerEl, syn_message;\n buttonsEl = $el.find(\".admin-project-export-buttons\");\n showButtons = function() {\n return buttonsEl.removeClass(\"hidden\");\n };\n hideButtons = function() {\n return buttonsEl.addClass(\"hidden\");\n };\n resultEl = $el.find(\".admin-project-export-result\");\n showResult = function() {\n return resultEl.removeClass(\"hidden\");\n };\n hideResult = function() {\n return resultEl.addClass(\"hidden\");\n };\n spinnerEl = $el.find(\".spin\");\n showSpinner = function() {\n return spinnerEl.removeClass(\"hidden\");\n };\n hideSpinner = function() {\n return spinnerEl.addClass(\"hidden\");\n };\n resultTitleEl = $el.find(\".result-title\");\n loading_title = $translate.instant(\"ADMIN.PROJECT_EXPORT.LOADING_TITLE\");\n loading_msg = $translate.instant(\"ADMIN.PROJECT_EXPORT.LOADING_MESSAGE\");\n dump_ready_text = function() {\n return resultTitleEl.html($translate.instant(\"ADMIN.PROJECT_EXPORT.DUMP_READY\"));\n };\n asyn_message = function() {\n return resultTitleEl.html($translate.instant(\"ADMIN.PROJECT_EXPORT.ASYNC_MESSAGE\"));\n };\n syn_message = function(url) {\n return resultTitleEl.html($translate.instant(\"ADMIN.PROJECT_EXPORT.SYNC_MESSAGE\", {\n url: url\n }));\n };\n setLoadingTitle = function() {\n return resultTitleEl.html(loading_title);\n };\n setAsyncTitle = function() {\n return resultTitleEl.html(loading_msg);\n };\n setSyncTitle = function() {\n return resultTitleEl.html(dump_ready_text);\n };\n resultMessageEl = $el.find(\".result-message \");\n setLoadingMessage = function() {\n return resultMessageEl.html(loading_msg);\n };\n setAsyncMessage = function() {\n return resultMessageEl.html(asyn_message);\n };\n setSyncMessage = function(url) {\n return resultMessageEl.html(syn_message(url));\n };\n showLoadingMode = function() {\n showSpinner();\n setLoadingTitle();\n setLoadingMessage();\n hideButtons();\n return showResult();\n };\n showExportResultAsyncMode = function() {\n hideSpinner();\n setAsyncTitle();\n return setAsyncMessage();\n };\n showExportResultSyncMode = function(url) {\n hideSpinner();\n setSyncTitle();\n return setSyncMessage(url);\n };\n showErrorMode = function() {\n hideSpinner();\n hideResult();\n return showButtons();\n };\n return $el.on(\"click\", \"a.button-export\", debounce(2000, (function(_this) {\n return function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function(result) {\n var dumpUrl;\n if (result.status === 202) {\n return showExportResultAsyncMode();\n } else {\n dumpUrl = result.data.url;\n showExportResultSyncMode(dumpUrl);\n return $window.open(dumpUrl, \"_blank\");\n }\n };\n onError = function(result) {\n var errorMsg, ref;\n showErrorMode();\n errorMsg = $translate.instant(\"ADMIN.PROJECT_EXPORT.ERROR\");\n if (result.status === 429) {\n errorMsg = $translate.instant(\"ADMIN.PROJECT_EXPORT.ERROR_BUSY\");\n } else if ((ref = result.data) != null ? ref._error_message : void 0) {\n errorMsg = $translate.instant(\"ADMIN.PROJECT_EXPORT.ERROR_BUSY\", {\n message: result.data._error_message\n });\n }\n return $confirm.notify(\"error\", errorMsg);\n };\n showLoadingMode();\n return $rs.projects[\"export\"]($scope.projectId).then(onSuccess, onError);\n };\n })(this)));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectExport\", [\"$window\", \"$tgResources\", \"$tgConfirm\", \"$translate\", ProjectExportDirective]);\n\n CsvExporterController = (function(superClass) {\n extend(CsvExporterController, superClass);\n\n CsvExporterController.$inject = [\"$scope\", \"$rootScope\", \"$tgUrls\", \"$tgConfirm\", \"$tgResources\", \"$translate\"];\n\n function CsvExporterController(scope1, rootscope, urls, confirm, rs, translate) {\n this.scope = scope1;\n this.rootscope = rootscope;\n this.urls = urls;\n this.confirm = confirm;\n this.rs = rs;\n this.translate = translate;\n this._generateUuid = bind(this._generateUuid, this);\n this.setCsvUuid = bind(this.setCsvUuid, this);\n this.rootscope.$on(\"project:loaded\", this.setCsvUuid);\n this.scope.$watch(\"csvUuid\", (function(_this) {\n return function(value) {\n if (value) {\n return _this.scope.csvUrl = _this.urls.resolveAbsolute(_this.type + \"-csv\", value);\n } else {\n return _this.scope.csvUrl = \"\";\n }\n };\n })(this));\n }\n\n CsvExporterController.prototype.setCsvUuid = function() {\n return this.scope.csvUuid = this.scope.project[this.type + \"_csv_uuid\"];\n };\n\n CsvExporterController.prototype._generateUuid = function(response) {\n var promise;\n if (response == null) {\n response = null;\n }\n promise = this.rs.projects[\"regenerate_\" + this.type + \"_csv_uuid\"](this.scope.projectId);\n promise.then((function(_this) {\n return function(data) {\n var ref;\n return _this.scope.csvUuid = (ref = data.data) != null ? ref.uuid : void 0;\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n promise[\"finally\"](function() {\n if (response) {\n return response.finish();\n }\n });\n return promise;\n };\n\n CsvExporterController.prototype.regenerateUuid = function() {\n var subtitle, title;\n if (this.scope.csvUuid) {\n title = this.translate.instant(\"ADMIN.REPORTS.REGENERATE_TITLE\");\n subtitle = this.translate.instant(\"ADMIN.REPORTS.REGENERATE_SUBTITLE\");\n return this.confirm.ask(title, subtitle).then(this._generateUuid);\n } else {\n return this._generateUuid();\n }\n };\n\n return CsvExporterController;\n\n })(taiga.Controller);\n\n CsvExporterUserstoriesController = (function(superClass) {\n extend(CsvExporterUserstoriesController, superClass);\n\n function CsvExporterUserstoriesController() {\n return CsvExporterUserstoriesController.__super__.constructor.apply(this, arguments);\n }\n\n CsvExporterUserstoriesController.prototype.type = \"userstories\";\n\n return CsvExporterUserstoriesController;\n\n })(CsvExporterController);\n\n CsvExporterTasksController = (function(superClass) {\n extend(CsvExporterTasksController, superClass);\n\n function CsvExporterTasksController() {\n return CsvExporterTasksController.__super__.constructor.apply(this, arguments);\n }\n\n CsvExporterTasksController.prototype.type = \"tasks\";\n\n return CsvExporterTasksController;\n\n })(CsvExporterController);\n\n CsvExporterIssuesController = (function(superClass) {\n extend(CsvExporterIssuesController, superClass);\n\n function CsvExporterIssuesController() {\n return CsvExporterIssuesController.__super__.constructor.apply(this, arguments);\n }\n\n CsvExporterIssuesController.prototype.type = \"issues\";\n\n return CsvExporterIssuesController;\n\n })(CsvExporterController);\n\n module.controller(\"CsvExporterUserstoriesController\", CsvExporterUserstoriesController);\n\n module.controller(\"CsvExporterTasksController\", CsvExporterTasksController);\n\n module.controller(\"CsvExporterIssuesController\", CsvExporterIssuesController);\n\n CsvUsDirective = function($translate) {\n var link;\n link = function($scope) {\n return $scope.sectionTitle = \"ADMIN.CSV.SECTION_TITLE_US\";\n };\n return {\n controller: \"CsvExporterUserstoriesController\",\n controllerAs: \"ctrl\",\n templateUrl: \"admin/project-csv.html\",\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgCsvUs\", [\"$translate\", CsvUsDirective]);\n\n CsvTaskDirective = function($translate) {\n var link;\n link = function($scope) {\n return $scope.sectionTitle = \"ADMIN.CSV.SECTION_TITLE_TASK\";\n };\n return {\n controller: \"CsvExporterTasksController\",\n controllerAs: \"ctrl\",\n templateUrl: \"admin/project-csv.html\",\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgCsvTask\", [\"$translate\", CsvTaskDirective]);\n\n CsvIssueDirective = function($translate) {\n var link;\n link = function($scope) {\n return $scope.sectionTitle = \"ADMIN.CSV.SECTION_TITLE_ISSUE\";\n };\n return {\n controller: \"CsvExporterIssuesController\",\n controllerAs: \"ctrl\",\n templateUrl: \"admin/project-csv.html\",\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgCsvIssue\", [\"$translate\", CsvIssueDirective]);\n\n ProjectLogoDirective = function($auth, $model, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, showSizeInfo;\n showSizeInfo = function() {\n return $el.find(\".size-info\").addClass(\"active\");\n };\n onSuccess = function(response) {\n var project;\n project = $model.make_model(\"projects\", response.data);\n $scope.project = project;\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('success');\n };\n onError = function(response) {\n if (response.status === 413) {\n showSizeInfo();\n }\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('error', response.data._error_message);\n };\n $el.on(\"click\", \".js-change-logo\", function() {\n return $el.find(\"#logo-field\").click();\n });\n $el.on(\"change\", \"#logo-field\", function(event) {\n if ($scope.logoAttachment) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.projects.changeLogo($scope.project.id, $scope.logoAttachment).then(onSuccess, onError);\n }\n });\n $el.on(\"click\", \"a.js-use-default-logo\", function(event) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.projects.removeLogo($scope.project.id).then(onSuccess, onError);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectLogo\", [\"$tgAuth\", \"$tgModel\", \"$tgResources\", \"$tgConfirm\", ProjectLogoDirective]);\n\n ProjectLogoModelDirective = function($parse) {\n var link;\n link = function($scope, $el, $attrs) {\n var model, modelSetter;\n model = $parse($attrs.tgProjectLogoModel);\n modelSetter = model.assign;\n return $el.bind('change', function() {\n return $scope.$apply(function() {\n return modelSetter($scope, $el[0].files[0]);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive('tgProjectLogoModel', ['$parse', ProjectLogoModelDirective]);\n\n AdminProjectRestrictionsDirective = function() {\n return {\n scope: {\n \"project\": \"=\"\n },\n templateUrl: \"admin/admin-project-restrictions.html\"\n };\n };\n\n module.directive('tgAdminProjectRestrictions', [AdminProjectRestrictionsDirective]);\n\n AdminProjectRequestOwnershipDirective = function(lightboxFactory) {\n return {\n link: function(scope) {\n return scope.requestOwnership = function() {\n return lightboxFactory.create(\"tg-lb-request-ownership\", {\n \"class\": \"lightbox lightbox-request-ownership\"\n }, {\n projectId: scope.projectId\n });\n };\n },\n scope: {\n \"projectId\": \"=\",\n \"owner\": \"=\"\n },\n templateUrl: \"admin/admin-project-request-ownership.html\"\n };\n };\n\n module.directive('tgAdminProjectRequestOwnership', [\"tgLightboxFactory\", AdminProjectRequestOwnershipDirective]);\n\n AdminProjectChangeOwnerDirective = function(lightboxFactory) {\n return {\n link: function(scope) {\n return scope.changeOwner = function() {\n return lightboxFactory.create(\"tg-lb-change-owner\", {\n \"class\": \"lightbox lightbox-select-user\",\n \"project-id\": \"projectId\",\n \"active-users\": \"activeUsers\",\n \"current-owner-id\": \"currentOwnerId\"\n }, {\n projectId: scope.projectId,\n activeUsers: scope.activeUsers,\n currentOwnerId: scope.owner.id,\n members: scope.members\n });\n };\n },\n scope: {\n \"activeUsers\": \"=\",\n \"projectId\": \"=\",\n \"owner\": \"=\",\n \"members\": \"=\"\n },\n templateUrl: \"admin/admin-project-change-owner.html\"\n };\n };\n\n module.directive('tgAdminProjectChangeOwner', [\"tgLightboxFactory\", AdminProjectChangeOwnerDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/project-profile.coffee\n */\n\n(function() {\n var ColorSelectionDirective, DATE_TYPE, MULTILINE_TYPE, ProjectCustomAttributesController, ProjectCustomAttributesDirective, ProjectValuesController, ProjectValuesDirective, ProjectValuesSectionController, TEXT_TYPE, TYPE_CHOICES, URL_TYPE, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectValuesSectionController = (function(superClass) {\n extend(ProjectValuesSectionController, superClass);\n\n ProjectValuesSectionController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function ProjectValuesSectionController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, sectionName, title;\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.PROJECT_VALUES.PAGE_TITLE\", {\n \"sectionName\": sectionName,\n \"projectName\": _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n ProjectValuesSectionController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectValuesSectionController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise;\n };\n\n return ProjectValuesSectionController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectValuesSectionController\", ProjectValuesSectionController);\n\n ProjectValuesController = (function(superClass) {\n extend(ProjectValuesController, superClass);\n\n ProjectValuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\"];\n\n function ProjectValuesController(scope, rootscope, repo, confirm, rs) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.moveValue = bind(this.moveValue, this);\n this.loadValues = bind(this.loadValues, this);\n this.scope.$on(\"admin:project-values:move\", this.moveValue);\n this.rootscope.$on(\"project:loaded\", this.loadValues);\n }\n\n ProjectValuesController.prototype.loadValues = function() {\n return this.rs[this.scope.resource].listValues(this.scope.projectId, this.scope.type).then((function(_this) {\n return function(values) {\n _this.scope.values = values;\n _this.scope.maxValueOrder = _.maxBy(values, \"order\").order;\n return values;\n };\n })(this));\n };\n\n ProjectValuesController.prototype.moveValue = function(ctx, itemValue, itemIndex) {\n var r, values;\n values = this.scope.values;\n r = values.indexOf(itemValue);\n values.splice(r, 1);\n values.splice(itemIndex, 0, itemValue);\n _.each(values, function(value, index) {\n return value.order = index;\n });\n return this.repo.saveAll(values);\n };\n\n return ProjectValuesController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectValuesController\", ProjectValuesController);\n\n ProjectValuesDirective = function($log, $repo, $confirm, $location, animationFrame, $translate, $rootscope) {\n var link, linkDragAndDrop, linkValue;\n linkDragAndDrop = function($scope, $el, $attrs) {\n var itemEl, newParentScope, oldParentScope, tdom;\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el.find(\".sortable\");\n tdom.sortable({\n handle: \".row.table-main.visualization\",\n dropOnEmpty: true,\n connectWith: \".project-values-body\",\n revert: 400,\n axis: \"y\"\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemValue;\n itemEl = ui.item;\n itemValue = itemEl.scope().value;\n itemIndex = itemEl.index();\n return $scope.$broadcast(\"admin:project-values:move\", itemValue, itemIndex);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n linkValue = function($scope, $el, $attrs) {\n var $ctrl, cancel, goToBottomList, initializeNewValue, initializeTextTranslations, objName, saveNewValue, saveValue, valueType;\n $ctrl = $el.controller();\n valueType = $attrs.type;\n objName = $attrs.objname;\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"is_closed\": false,\n \"is_archived\": false\n };\n };\n initializeTextTranslations = function() {\n return $scope.addNewElementText = $translate.instant(\"ADMIN.PROJECT_VALUES_\" + (objName.toUpperCase()) + \".ACTION_ADD\");\n };\n initializeNewValue();\n initializeTextTranslations();\n $rootscope.$on(\"$translateChangeEnd\", function() {\n return $scope.$evalAsync(initializeTextTranslations);\n });\n goToBottomList = (function(_this) {\n return function(focus) {\n var table;\n if (focus == null) {\n focus = false;\n }\n table = $el.find(\".table-main\");\n $(document.body).scrollTop(table.offset().top + table.height());\n if (focus) {\n return $el.find(\".new-value input:visible\").first().focus();\n }\n };\n })(this);\n saveValue = function(target) {\n var form, formEl, promise, value;\n formEl = target.parents(\"form\");\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n value = formEl.scope().value;\n promise = $repo.save(value);\n promise.then((function(_this) {\n return function() {\n var row;\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n return row.siblings(\".visualization\").removeClass('hidden');\n };\n })(this));\n return promise.then(null, function(data) {\n return form.setErrors(data);\n });\n };\n saveNewValue = function(target) {\n var form, formEl, promise;\n formEl = target.parents(\"form\");\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n $scope.newValue.order = $scope.maxValueOrder ? $scope.maxValueOrder + 1 : 1;\n promise = $repo.create(valueType, $scope.newValue);\n promise.then((function(_this) {\n return function(data) {\n target.addClass(\"hidden\");\n $scope.values.push(data);\n $scope.maxValueOrder = data.order;\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n return form.setErrors(data);\n });\n };\n cancel = function(target) {\n var formEl, row, value;\n row = target.parents(\".row.table-main\");\n formEl = target.parents(\"form\");\n value = formEl.scope().value;\n return $scope.$apply(function() {\n row.addClass(\"hidden\");\n value.revert();\n return row.siblings(\".visualization\").removeClass('hidden');\n });\n };\n $el.on(\"click\", \".show-add-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").removeClass('hidden');\n return goToBottomList(true);\n });\n $el.on(\"click\", \".add-new\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n target = $el.find(\".new-value\");\n return saveNewValue(target);\n }));\n $el.on(\"click\", \".delete-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").addClass(\"hidden\");\n return initializeNewValue();\n });\n $el.on(\"click\", \".edit-value\", function(event) {\n var editionRow, row, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n editionRow = row.siblings(\".edition\");\n editionRow.removeClass('hidden');\n return editionRow.find('input:visible').first().focus().select();\n });\n $el.on(\"keyup\", \".edition input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return saveValue(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"keyup\", \".new-value input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = $el.find(\".new-value\");\n return saveNewValue(target);\n } else if (event.keyCode === 27) {\n $el.find(\".new-value\").addClass(\"hidden\");\n return initializeNewValue();\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return saveValue(target);\n });\n $el.on(\"click\", \".cancel\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return cancel(target);\n });\n return $el.on(\"click\", \".delete-value\", function(event) {\n var choices, formEl, subtitle, target, text, title, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.parents(\"form\");\n value = formEl.scope().value;\n choices = {};\n _.each($scope.values, function(option) {\n if (value.id !== option.id) {\n return choices[option.id] = option.name;\n }\n });\n subtitle = value.name;\n if (_.keys(choices).length === 0) {\n return $confirm.error($translate.instant(\"ADMIN.PROJECT_VALUES.ERROR_DELETE_ALL\"));\n }\n title = $translate.instant(\"ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE\");\n text = $translate.instant(\"ADMIN.PROJECT_VALUES.REPLACEMENT\");\n return $confirm.askChoice(title, subtitle, choices, text).then(function(response) {\n var onError, onSucces;\n onSucces = function() {\n return $ctrl.loadValues()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $repo.remove(value, {\n \"moveTo\": response.selected\n }).then(onSucces, onError);\n });\n });\n };\n link = function($scope, $el, $attrs) {\n linkDragAndDrop($scope, $el, $attrs);\n linkValue($scope, $el, $attrs);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectValues\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"animationFrame\", \"$translate\", \"$rootScope\", ProjectValuesDirective]);\n\n ColorSelectionDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$watch($attrs.ngModel, function(element) {\n return $scope.color = element.color;\n });\n $el.on(\"click\", \".current-color\", function(event) {\n var body, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n $el.find(\".select-color\").hide();\n target.siblings(\".select-color\").show();\n body = angular.element(\"body\");\n return body.on(\"click\", (function(_this) {\n return function(event) {\n if (angular.element(event.target).parent(\".select-color\").length === 0) {\n $el.find(\".select-color\").hide();\n return body.unbind(\"click\");\n }\n };\n })(this));\n });\n $el.on(\"click\", \".select-color .color\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n $scope.$apply(function() {\n return $model.$modelValue.color = target.data(\"color\");\n });\n return $el.find(\".select-color\").hide();\n });\n $el.on(\"click\", \".select-color .selected-color\", function(event) {\n event.preventDefault();\n $scope.$apply(function() {\n return $model.$modelValue.color = $scope.color;\n });\n return $el.find(\".select-color\").hide();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgColorSelection\", ColorSelectionDirective);\n\n TEXT_TYPE = \"text\";\n\n MULTILINE_TYPE = \"multiline\";\n\n DATE_TYPE = \"date\";\n\n URL_TYPE = \"url\";\n\n TYPE_CHOICES = [\n {\n key: TEXT_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT\"\n }, {\n key: MULTILINE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI\"\n }, {\n key: DATE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE\"\n }, {\n key: URL_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL\"\n }\n ];\n\n ProjectCustomAttributesController = (function(superClass) {\n extend(ProjectCustomAttributesController, superClass);\n\n ProjectCustomAttributesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function ProjectCustomAttributesController(scope, rootscope, repo, rs, params, q, location, navUrls, appMetaService, translate) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.moveCustomAttributes = bind(this.moveCustomAttributes, this);\n this.deleteCustomAttribute = bind(this.deleteCustomAttribute, this);\n this.saveCustomAttribute = bind(this.saveCustomAttribute, this);\n this.createCustomAttribute = bind(this.createCustomAttribute, this);\n this.loadCustomAttributes = bind(this.loadCustomAttributes, this);\n this.scope.TYPE_CHOICES = TYPE_CHOICES;\n this.scope.project = {};\n this.rootscope.$on(\"project:loaded\", (function(_this) {\n return function() {\n var description, sectionName, title;\n _this.loadCustomAttributes();\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.CUSTOM_ATTRIBUTES.PAGE_TITLE\", {\n \"sectionName\": sectionName,\n \"projectName\": _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n }\n\n ProjectCustomAttributesController.prototype.loadCustomAttributes = function() {\n return this.rs.customAttributes[this.scope.type].list(this.scope.projectId).then((function(_this) {\n return function(customAttributes) {\n _this.scope.customAttributes = customAttributes;\n _this.scope.maxOrder = _.maxBy(customAttributes, \"order\").order;\n return customAttributes;\n };\n })(this));\n };\n\n ProjectCustomAttributesController.prototype.createCustomAttribute = function(attrValues) {\n return this.repo.create(\"custom-attributes/\" + this.scope.type, attrValues);\n };\n\n ProjectCustomAttributesController.prototype.saveCustomAttribute = function(attrModel) {\n return this.repo.save(attrModel);\n };\n\n ProjectCustomAttributesController.prototype.deleteCustomAttribute = function(attrModel) {\n return this.repo.remove(attrModel);\n };\n\n ProjectCustomAttributesController.prototype.moveCustomAttributes = function(attrModel, newIndex) {\n var customAttributes, r;\n customAttributes = this.scope.customAttributes;\n r = customAttributes.indexOf(attrModel);\n customAttributes.splice(r, 1);\n customAttributes.splice(newIndex, 0, attrModel);\n _.each(customAttributes, function(val, idx) {\n return val.order = idx;\n });\n return this.repo.saveAll(customAttributes);\n };\n\n return ProjectCustomAttributesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectCustomAttributesController\", ProjectCustomAttributesController);\n\n ProjectCustomAttributesDirective = function($log, $confirm, animationFrame, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, cancelCreate, cancelUpdate, create, deleteCustomAttribute, hideAddButton, hideCancelButton, hideCreateForm, hideEditForm, resetNewAttr, revertChangesInCustomAttribute, showAddButton, showCancelButton, showCreateForm, showEditForm, sortableEl, update;\n $ctrl = $el.controller();\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n sortableEl = $el.find(\".js-sortable\");\n sortableEl.sortable({\n handle: \".js-view-custom-field\",\n dropOnEmpty: true,\n revert: 400,\n axis: \"y\"\n });\n sortableEl.on(\"sortstop\", function(event, ui) {\n var itemAttr, itemEl, itemIndex;\n itemEl = ui.item;\n itemAttr = itemEl.scope().attr;\n itemIndex = itemEl.index();\n return $ctrl.moveCustomAttributes(itemAttr, itemIndex);\n });\n showCreateForm = function() {\n $el.find(\".js-new-custom-field\").removeClass(\"hidden\");\n return $el.find(\".js-new-custom-field input:visible\").first().focus();\n };\n hideCreateForm = function() {\n return $el.find(\".js-new-custom-field\").addClass(\"hidden\");\n };\n showAddButton = function() {\n return $el.find(\".js-add-custom-field-button\").removeClass(\"hidden\");\n };\n hideAddButton = function() {\n return $el.find(\".js-add-custom-field-button\").addClass(\"hidden\");\n };\n showCancelButton = function() {\n return $el.find(\".js-cancel-new-custom-field-button\").removeClass(\"hidden\");\n };\n hideCancelButton = function() {\n return $el.find(\".js-cancel-new-custom-field-button\").addClass(\"hidden\");\n };\n resetNewAttr = function() {\n return $scope.newAttr = {};\n };\n create = function(formEl) {\n var attr, form, onError, onSucces;\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n onSucces = (function(_this) {\n return function() {\n $ctrl.loadCustomAttributes();\n hideCreateForm();\n resetNewAttr();\n return $confirm.notify(\"success\");\n };\n })(this);\n onError = (function(_this) {\n return function(data) {\n return form.setErrors(data);\n };\n })(this);\n attr = $scope.newAttr;\n attr.project = $scope.projectId;\n attr.order = $scope.maxOrder ? $scope.maxOrder + 1 : 1;\n return $ctrl.createCustomAttribute(attr).then(onSucces, onError);\n };\n cancelCreate = function() {\n hideCreateForm();\n return resetNewAttr();\n };\n $scope.$watch(\"customAttributes\", function(customAttributes) {\n if (!customAttributes) {\n return;\n }\n if (customAttributes.length === 0) {\n hideCancelButton();\n hideAddButton();\n return showCreateForm();\n } else {\n hideCreateForm();\n showAddButton();\n return showCancelButton();\n }\n });\n $el.on(\"click\", \".js-add-custom-field-button\", function(event) {\n event.preventDefault();\n return showCreateForm();\n });\n $el.on(\"click\", \".js-create-custom-field-button\", debounce(2000, function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return create(formEl);\n }));\n $el.on(\"click\", \".js-cancel-new-custom-field-button\", function(event) {\n event.preventDefault();\n return cancelCreate();\n });\n $el.on(\"keyup\", \".js-new-custom-field input\", function(event) {\n var formEl, target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return create(formEl);\n } else if (event.keyCode === 27) {\n return cancelCreate();\n }\n });\n showEditForm = function(formEl) {\n formEl.find(\".js-view-custom-field\").addClass(\"hidden\");\n formEl.find(\".js-edit-custom-field\").removeClass(\"hidden\");\n return formEl.find(\".js-edit-custom-field input:visible\").first().focus().select();\n };\n hideEditForm = function(formEl) {\n formEl.find(\".js-edit-custom-field\").addClass(\"hidden\");\n return formEl.find(\".js-view-custom-field\").removeClass(\"hidden\");\n };\n revertChangesInCustomAttribute = function(formEl) {\n return $scope.$apply(function() {\n return formEl.scope().attr.revert();\n });\n };\n update = function(formEl) {\n var attr, form, onError, onSucces;\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n onSucces = (function(_this) {\n return function() {\n $ctrl.loadCustomAttributes();\n hideEditForm(formEl);\n return $confirm.notify(\"success\");\n };\n })(this);\n onError = (function(_this) {\n return function(data) {\n return form.setErrors(data);\n };\n })(this);\n attr = formEl.scope().attr;\n return $ctrl.saveCustomAttribute(attr).then(onSucces, onError);\n };\n cancelUpdate = function(formEl) {\n hideEditForm(formEl);\n return revertChangesInCustomAttribute(formEl);\n };\n $el.on(\"click\", \".js-edit-custom-field-button\", function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return showEditForm(formEl);\n });\n $el.on(\"click\", \".js-update-custom-field-button\", debounce(2000, function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return update(formEl);\n }));\n $el.on(\"click\", \".js-cancel-edit-custom-field-button\", function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return cancelUpdate(formEl);\n });\n $el.on(\"keyup\", \".js-edit-custom-field input\", function(event) {\n var formEl, target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return update(formEl);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return cancelUpdate(formEl);\n }\n });\n deleteCustomAttribute = function(formEl) {\n var attr, message, text, title;\n attr = formEl.scope().attr;\n message = attr.name;\n title = $translate.instant(\"COMMON.CUSTOM_ATTRIBUTES.DELETE\");\n text = $translate.instant(\"COMMON.CUSTOM_ATTRIBUTES.CONFIRM_DELETE\");\n return $confirm.ask(title, text, message).then(function(response) {\n var onError, onSucces;\n onSucces = function() {\n return $ctrl.loadCustomAttributes()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return $confirm.notify(\"error\", null, \"We have not been able to delete '\" + message + \"'.\");\n };\n return $ctrl.deleteCustomAttribute(attr).then(onSucces, onError);\n });\n };\n return $el.on(\"click\", \".js-delete-custom-field-button\", debounce(2000, function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return deleteCustomAttribute(formEl);\n }));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectCustomAttributes\", [\"$log\", \"$tgConfirm\", \"animationFrame\", \"$translate\", ProjectCustomAttributesDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/memberships.coffee\n */\n\n(function() {\n var EditRoleDirective, NewRoleDirective, RolePermissionsDirective, RolesController, RolesDirective, bindMethods, bindOnce, debounce, mixOf, module, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n RolesController = (function(superClass) {\n extend(RolesController, superClass);\n\n RolesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function RolesController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this._disableComputable = bind(this._disableComputable, this);\n this._enableComputable = bind(this._enableComputable, this);\n bindMethods(this);\n this.scope.sectionName = \"ADMIN.MENU.PERMISSIONS\";\n this.scope.project = {};\n this.scope.anyComputableRole = true;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.ROLES.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n RolesController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.anyComputableRole = _.some(_.map(project.roles, function(point) {\n return point.computable;\n }));\n return project;\n };\n })(this));\n };\n\n RolesController.prototype.loadRoles = function() {\n return this.rs.roles.list(this.scope.projectId).then((function(_this) {\n return function(roles) {\n var public_permission;\n roles = roles.map(function(role) {\n role.external_user = false;\n return role;\n });\n public_permission = {\n \"name\": _this.translate.instant(\"ADMIN.ROLES.EXTERNAL_USER\"),\n \"permissions\": _this.scope.project.public_permissions,\n \"external_user\": true\n };\n roles.push(public_permission);\n _this.scope.roles = roles;\n _this.scope.role = _this.scope.roles[0];\n return roles;\n };\n })(this));\n };\n\n RolesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadRoles();\n };\n })(this));\n return promise;\n };\n\n RolesController.prototype.setRole = function(role) {\n this.scope.role = role;\n return this.scope.$broadcast(\"role:changed\", this.scope.role);\n };\n\n RolesController.prototype[\"delete\"] = function() {\n var choices, i, len, ref, replacement, role, subtitle, title, warning;\n choices = {};\n ref = this.scope.roles;\n for (i = 0, len = ref.length; i < len; i++) {\n role = ref[i];\n if (role.id !== this.scope.role.id) {\n choices[role.id] = role.name;\n }\n }\n if (_.keys(choices).length === 0) {\n return this.confirm.error(this.translate.instant(\"ADMIN.ROLES.ERROR_DELETE_ALL\"));\n }\n title = this.translate.instant(\"ADMIN.ROLES.TITLE_DELETE_ROLE\");\n subtitle = this.scope.role.name;\n replacement = this.translate.instant(\"ADMIN.ROLES.REPLACEMENT_ROLE\");\n warning = this.translate.instant(\"ADMIN.ROLES.WARNING_DELETE_ROLE\");\n return this.confirm.askChoice(title, subtitle, choices, replacement, warning).then((function(_this) {\n return function(response) {\n var onError, onSuccess;\n onSuccess = function() {\n _this.loadProject();\n return _this.loadRoles()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return _this.confirm.notify('error');\n };\n return _this.repo.remove(_this.scope.role, {\n moveTo: response.selected\n }).then(onSuccess, onError);\n };\n })(this));\n };\n\n RolesController.prototype._enableComputable = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.confirm.notify(\"success\");\n return _this.loadProject();\n };\n })(this);\n onError = (function(_this) {\n return function() {\n _this.confirm.notify(\"error\");\n return _this.scope.role.revert();\n };\n })(this);\n return this.repo.save(this.scope.role).then(onSuccess, onError);\n };\n\n RolesController.prototype._disableComputable = function() {\n var askOnError, askOnSuccess, message, subtitle, title;\n askOnSuccess = (function(_this) {\n return function(response) {\n var onError, onSuccess;\n onSuccess = function() {\n response.finish();\n _this.confirm.notify(\"success\");\n return _this.loadProject();\n };\n onError = function() {\n response.finish();\n _this.confirm.notify(\"error\");\n return _this.scope.role.revert();\n };\n return _this.repo.save(_this.scope.role).then(onSuccess, onError);\n };\n })(this);\n askOnError = (function(_this) {\n return function(response) {\n return _this.scope.role.revert();\n };\n })(this);\n title = this.translate.instant(\"ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_TITLE\");\n subtitle = this.translate.instant(\"ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_SUBTITLE\", {\n roleName: this.scope.role.name\n });\n message = this.translate.instant(\"ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_MESSAGE\");\n return this.confirm.ask(title, subtitle, message).then(askOnSuccess, askOnError);\n };\n\n RolesController.prototype.toggleComputable = debounce(2000, function() {\n if (!this.scope.role.computable) {\n return this._disableComputable();\n } else {\n return this._enableComputable();\n }\n });\n\n return RolesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"RolesController\", RolesController);\n\n EditRoleDirective = function($repo, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit, toggleView;\n toggleView = function() {\n $el.find('.total').toggle();\n return $el.find('.edit-role').toggle();\n };\n submit = function() {\n var promise;\n $scope.role.name = $el.find(\"input\").val();\n promise = $repo.save($scope.role);\n promise.then(function() {\n return $confirm.notify(\"success\");\n });\n promise.then(null, function(data) {\n return $confirm.notify(\"error\");\n });\n return toggleView();\n };\n $el.on(\"click\", \".edit-value\", function() {\n toggleView();\n $el.find(\"input\").focus();\n return $el.find(\"input\").val($scope.role.name);\n });\n $el.on(\"click\", \"a.save\", submit);\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return submit();\n } else if (event.keyCode === 27) {\n return toggleView();\n }\n });\n $scope.$on(\"role:changed\", function() {\n if ($el.find('.edit-role').is(\":visible\")) {\n return toggleView();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgEditRole\", [\"$tgRepo\", \"$tgConfirm\", EditRoleDirective]);\n\n RolesDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRoles\", RolesDirective);\n\n NewRoleDirective = function($tgrepo, $confirm) {\n var DEFAULT_PERMISSIONS, link;\n DEFAULT_PERMISSIONS = [\"view_project\", \"view_milestones\", \"view_us\", \"view_tasks\", \"view_issues\"];\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $el.on(\"click\", \"a.add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new\").focus();\n return $el.find(\".add-button\").hide();\n });\n return $el.on(\"keyup\", \".new\", function(event) {\n var newRole, onError, onSuccess, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newRole = {\n project: $scope.projectId,\n name: target.val(),\n permissions: DEFAULT_PERMISSIONS,\n order: _.maxBy($scope.roles, function(r) {\n return r.order;\n }).order + 1,\n computable: false\n };\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n onSuccess = function(role) {\n var insertPosition;\n insertPosition = $scope.roles.length - 1;\n $scope.roles.splice(insertPosition, 0, role);\n $ctrl.setRole(role);\n $el.find(\".add-button\").show();\n return $ctrl.loadProject();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $tgrepo.create(\"roles\", newRole).then(onSuccess, onError);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewRole\", [\"$tgRepo\", \"$tgConfirm\", NewRoleDirective]);\n\n RolePermissionsDirective = function($rootscope, $repo, $confirm, $compile) {\n var baseTemplate, categoryTemplate, link, resumeTemplate;\n resumeTemplate = _.template(\"
\\\">
\\n
\\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\\n <% _.each(category.permissions, function(permission) { %>\\n
active<% } %>\\\"\\n title=\\\"{{ '<%- permission.name %>' | translate }}\\\">
\\n <% }) %>\\n
\\n\\n \\n\");\n categoryTemplate = _.template(\"
\\\">\\n
\\n
\\n
\\n
\\n <% _.each(category.permissions, function(permission) { %>\\n
\\\">\\n \\\">\\n
\\n disabled=\\\"disabled\\\" <% } %>\\n <% if(permission.active) { %> checked=\\\"checked\\\" <% } %>/>\\n
\\n \\n \\n
\\n
\\n <% }) %>\\n
\\n
\\n
\");\n baseTemplate = _.template(\"
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, generateCategoriesFromRole, renderCategory, renderPermissions, renderResume;\n $ctrl = $el.controller();\n generateCategoriesFromRole = function(role) {\n var categories, isPermissionEditable, issuePermissions, milestonePermissions, setActivePermissions, setActivePermissionsPerCategory, taskPermissions, userStoryPermissions, wikiPermissions;\n setActivePermissions = function(permissions) {\n return _.map(permissions, function(x) {\n var ref;\n return _.extend({}, x, {\n active: (ref = x[\"key\"], indexOf.call(role.permissions, ref) >= 0)\n });\n });\n };\n isPermissionEditable = function(permission, role, project) {\n if (role.external_user && !project.is_private && permission.key.indexOf(\"view_\") === 0) {\n return false;\n } else {\n return true;\n }\n };\n setActivePermissionsPerCategory = function(category) {\n return _.map(category, function(cat) {\n cat.permissions = cat.permissions.map(function(permission) {\n permission.editable = isPermissionEditable(permission, role, $scope.project);\n return permission;\n });\n return _.extend({}, cat, {\n activePermissions: _.filter(cat[\"permissions\"], \"active\").length\n });\n });\n };\n categories = [];\n milestonePermissions = [\n {\n key: \"view_milestones\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.VIEW_SPRINTS\"\n }, {\n key: \"add_milestone\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.ADD_SPRINTS\"\n }, {\n key: \"modify_milestone\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.MODIFY_SPRINTS\"\n }, {\n key: \"delete_milestone\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.DELETE_SPRINTS\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.NAME\",\n permissions: setActivePermissions(milestonePermissions)\n });\n userStoryPermissions = [\n {\n key: \"view_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.VIEW_USER_STORIES\"\n }, {\n key: \"add_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.ADD_USER_STORIES\"\n }, {\n key: \"modify_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.MODIFY_USER_STORIES\"\n }, {\n key: \"delete_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.DELETE_USER_STORIES\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.NAME\",\n permissions: setActivePermissions(userStoryPermissions)\n });\n taskPermissions = [\n {\n key: \"view_tasks\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.VIEW_TASKS\"\n }, {\n key: \"add_task\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.ADD_TASKS\"\n }, {\n key: \"modify_task\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.MODIFY_TASKS\"\n }, {\n key: \"delete_task\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.DELETE_TASKS\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.NAME\",\n permissions: setActivePermissions(taskPermissions)\n });\n issuePermissions = [\n {\n key: \"view_issues\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.VIEW_ISSUES\"\n }, {\n key: \"add_issue\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.ADD_ISSUES\"\n }, {\n key: \"modify_issue\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.MODIFY_ISSUES\"\n }, {\n key: \"delete_issue\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.DELETE_ISSUES\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.NAME\",\n permissions: setActivePermissions(issuePermissions)\n });\n wikiPermissions = [\n {\n key: \"view_wiki_pages\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_PAGES\"\n }, {\n key: \"add_wiki_page\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_PAGES\"\n }, {\n key: \"modify_wiki_page\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.MODIFY_WIKI_PAGES\"\n }, {\n key: \"delete_wiki_page\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_PAGES\"\n }, {\n key: \"view_wiki_links\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_LINKS\"\n }, {\n key: \"add_wiki_link\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_LINKS\"\n }, {\n key: \"delete_wiki_link\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_LINKS\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.NAME\",\n permissions: setActivePermissions(wikiPermissions)\n });\n return setActivePermissionsPerCategory(categories);\n };\n renderResume = function(element, category) {\n return element.find(\".resume\").html($compile(resumeTemplate({\n category: category\n }))($scope));\n };\n renderCategory = function(category, index) {\n var html;\n html = categoryTemplate({\n category: category,\n index: index\n });\n html = angular.element(html);\n renderResume(html, category);\n return $compile(html)($scope);\n };\n renderPermissions = function() {\n var html;\n $el.off();\n html = baseTemplate();\n _.each(generateCategoriesFromRole($scope.role), function(category, index) {\n return html = angular.element(html).append(renderCategory(category, index));\n });\n $el.html(html);\n $el.on(\"click\", \".resume\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass(\"open-drawer\");\n return target.next().toggleClass(\"open\");\n });\n return $el.on(\"change\", \".category-item input\", function(event) {\n var getActivePermissions, onError, onSuccess, target;\n getActivePermissions = function() {\n var activePermissions;\n activePermissions = _.filter($el.find(\".category-item input\"), function(t) {\n return angular.element(t).is(\":checked\");\n });\n activePermissions = _.sortBy(_.map(activePermissions, function(t) {\n var permission;\n return permission = angular.element(t).parents(\".category-item\").data(\"id\");\n }));\n if (activePermissions.length) {\n activePermissions.push(\"view_project\");\n }\n return activePermissions;\n };\n target = angular.element(event.currentTarget);\n $scope.role.permissions = getActivePermissions();\n onSuccess = function() {\n var categories, categoryId;\n categories = generateCategoriesFromRole($scope.role);\n categoryId = target.parents(\".category-config\").data(\"id\");\n renderResume(target.parents(\".category-config\"), categories[categoryId]);\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\");\n return $ctrl.loadProject();\n };\n onError = function() {\n $confirm.notify(\"error\");\n target.prop(\"checked\", !target.prop(\"checked\"));\n return $scope.role.permissions = getActivePermissions();\n };\n if ($scope.role.external_user) {\n $scope.project.public_permissions = $scope.role.permissions;\n $scope.project.anon_permissions = $scope.role.permissions.filter(function(permission) {\n return permission.indexOf(\"view_\") === 0;\n });\n return $repo.save($scope.project).then(onSuccess, onError);\n } else {\n return $repo.save($scope.role).then(onSuccess, onError);\n }\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $scope.$on(\"role:changed\", function() {\n return renderPermissions();\n });\n return bindOnce($scope, $attrs.ngModel, renderPermissions);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRolePermissions\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$compile\", RolePermissionsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/third-parties.coffee\n */\n\n(function() {\n var BitbucketController, BitbucketWebhooksDirective, GithubController, GithubWebhooksDirective, GitlabController, GitlabWebhooksDirective, NewWebhookDirective, SelectInputText, ValidOriginIpsDirective, WebhookDirective, WebhooksController, bindMethods, debounce, mixOf, module, taiga, timeout,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n debounce = this.taiga.debounce;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaAdmin\");\n\n WebhooksController = (function(superClass) {\n extend(WebhooksController, superClass);\n\n WebhooksController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function WebhooksController(scope, repo, rs, params, location, navUrls, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = \"ADMIN.WEBHOOKS.SECTION_NAME\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.WEBHOOKS.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"webhooks:reload\", this.loadWebhooks);\n }\n\n WebhooksController.prototype.loadWebhooks = function() {\n return this.rs.webhooks.list(this.scope.projectId).then((function(_this) {\n return function(webhooks) {\n return _this.scope.webhooks = webhooks;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadWebhooks();\n };\n })(this));\n return promise;\n };\n\n return WebhooksController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"WebhooksController\", WebhooksController);\n\n WebhookDirective = function($rs, $repo, $confirm, $loading, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var cancel, openHistory, save, showEditMode, showVisualizationMode, updateLogs, updateShowHideHistoryText, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n updateLogs = function() {\n var prettyDate;\n prettyDate = $translate.instant(\"ADMIN.WEBHOOKS.DATE\");\n return $rs.webhooklogs.list(webhook.id).then((function(_this) {\n return function(webhooklogs) {\n var i, len, log, ref;\n for (i = 0, len = webhooklogs.length; i < len; i++) {\n log = webhooklogs[i];\n log.validStatus = (200 <= (ref = log.status) && ref < 300);\n log.prettySentHeaders = _.map(_.toPairs(log.request_headers), function(arg) {\n var header, value;\n header = arg[0], value = arg[1];\n return header + \": \" + value;\n }).join(\"\\n\");\n log.prettySentData = JSON.stringify(log.request_data);\n log.prettyDate = moment(log.created).format(prettyDate);\n }\n webhook.logs_counter = webhooklogs.length;\n webhook.logs = webhooklogs;\n return updateShowHideHistoryText();\n };\n })(this));\n };\n updateShowHideHistoryText = function() {\n var historyElement, text, textElement, title;\n textElement = $el.find(\".toggle-history\");\n historyElement = textElement.parents(\".single-webhook-wrapper\").find(\".webhooks-history\");\n if (historyElement.hasClass(\"open\")) {\n text = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY\");\n title = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY_TITLE\");\n } else {\n text = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY\");\n title = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY_TITLE\");\n }\n textElement.text(text);\n return textElement.prop(\"title\", title);\n };\n showVisualizationMode = function() {\n $el.find(\".edition-mode\").addClass(\"hidden\");\n return $el.find(\".visualization-mode\").removeClass(\"hidden\");\n };\n showEditMode = function() {\n $el.find(\".visualization-mode\").addClass(\"hidden\");\n return $el.find(\".edition-mode\").removeClass(\"hidden\");\n };\n openHistory = function() {\n return $el.find(\".webhooks-history\").addClass(\"open\");\n };\n cancel = function() {\n showVisualizationMode();\n return $scope.$apply(function() {\n return webhook.revert();\n });\n };\n save = debounce(2000, function(target) {\n var form, promise;\n form = target.parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n promise = $repo.save(webhook);\n promise.then((function(_this) {\n return function() {\n return showVisualizationMode();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n $el.on(\"click\", \".test-webhook\", function() {\n openHistory();\n return $rs.webhooks.test(webhook.id).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n $el.on(\"click\", \".edit-webhook\", function() {\n return showEditMode();\n });\n $el.on(\"click\", \".cancel-existing\", function() {\n return cancel();\n });\n $el.on(\"click\", \".edit-existing\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n });\n $el.on(\"keyup\", \".edition-mode input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return save(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"click\", \".delete-webhook\", function() {\n var message, title;\n title = $translate.instant(\"ADMIN.WEBHOOKS.DELETE\");\n message = $translate.instant(\"ADMIN.WEBHOOKS.WEBHOOK_NAME\", {\n name: webhook.name\n });\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSucces;\n onSucces = function() {\n askResponse.finish();\n return $scope.$emit(\"webhooks:reload\");\n };\n onError = function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove(webhook).then(onSucces, onError);\n };\n })(this));\n });\n $el.on(\"click\", \".toggle-history\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if ((webhook.logs == null) || webhook.logs.length === 0) {\n return updateLogs().then(function() {\n return timeout(0, function() {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return updateShowHideHistoryText();\n });\n });\n } else {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return $scope.$apply(function() {\n return updateShowHideHistoryText();\n });\n }\n });\n $el.on(\"click\", \".history-single\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n target.toggleClass(\"history-single-open\");\n return target.siblings(\".history-single-response\").toggleClass(\"open\");\n });\n return $el.on(\"click\", \".resend-request\", function(event) {\n var log, target;\n target = angular.element(event.currentTarget);\n log = target.data(\"log\");\n return $rs.webhooklogs.resend(log).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$translate\", WebhookDirective]);\n\n NewWebhookDirective = function($rs, $repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var addWebhookDOMNode, formDOMNode, initializeNewValue, save, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n formDOMNode = $el.find(\".new-webhook-form\");\n addWebhookDOMNode = $el.find(\".add-webhook\");\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"url\": \"\",\n \"key\": \"\"\n };\n };\n initializeNewValue();\n $scope.$watch(\"webhooks\", function(webhooks) {\n if (webhooks != null) {\n if (webhooks.length === 0) {\n formDOMNode.removeClass(\"hidden\");\n addWebhookDOMNode.addClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n } else {\n formDOMNode.addClass(\"hidden\");\n return addWebhookDOMNode.removeClass(\"hidden\");\n }\n }\n });\n save = debounce(2000, function() {\n var form, promise;\n form = formDOMNode.checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n promise = $repo.create(\"webhooks\", $scope.newValue);\n promise.then((function(_this) {\n return function() {\n $scope.$emit(\"webhooks:reload\");\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n formDOMNode.on(\"click\", \".add-new\", function(event) {\n event.preventDefault();\n return save();\n });\n formDOMNode.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return save();\n }\n });\n formDOMNode.on(\"click\", \".cancel-new\", function(event) {\n return $scope.$apply(function() {\n initializeNewValue();\n if ($scope.webhooks.length >= 1) {\n return formDOMNode.addClass(\"hidden\");\n }\n });\n });\n return addWebhookDOMNode.on(\"click\", function(event) {\n formDOMNode.removeClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", NewWebhookDirective]);\n\n GithubController = (function(superClass) {\n extend(GithubController, superClass);\n\n GithubController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"tgAppMetaService\", \"$translate\"];\n\n function GithubController(scope, repo, rs, params, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"ADMIN.GITHUB.SECTION_NAME\");\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.GITHUB.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n GithubController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"github\").then((function(_this) {\n return function(github) {\n return _this.scope.github = github;\n };\n })(this));\n };\n\n GithubController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GithubController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n return promise;\n };\n\n return GithubController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GithubController\", GithubController);\n\n GitlabController = (function(superClass) {\n extend(GitlabController, superClass);\n\n GitlabController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"tgAppMetaService\", \"$translate\"];\n\n function GitlabController(scope, repo, rs, params, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"ADMIN.GITLAB.SECTION_NAME\");\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.GITLAB.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n GitlabController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"gitlab\").then((function(_this) {\n return function(gitlab) {\n return _this.scope.gitlab = gitlab;\n };\n })(this));\n };\n\n GitlabController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GitlabController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n return promise;\n };\n\n return GitlabController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GitlabController\", GitlabController);\n\n BitbucketController = (function(superClass) {\n extend(BitbucketController, superClass);\n\n BitbucketController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"tgAppMetaService\", \"$translate\"];\n\n function BitbucketController(scope, repo, rs, params, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"ADMIN.BITBUCKET.SECTION_NAME\");\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.BITBUCKET.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n BitbucketController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"bitbucket\").then((function(_this) {\n return function(bitbucket) {\n return _this.scope.bitbucket = bitbucket;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n return promise;\n };\n\n return BitbucketController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BitbucketController\", BitbucketController);\n\n SelectInputText = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.on(\"click\", \".select-input-content\", function() {\n $el.find(\"input\").select();\n return $el.find(\".help-copy\").addClass(\"visible\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSelectInputText\", SelectInputText);\n\n GithubWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.saveAttribute($scope.github, \"github\");\n promise.then(function() {\n currentLoading.finish();\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGithubWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GithubWebhooksDirective]);\n\n GitlabWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.saveAttribute($scope.gitlab, \"gitlab\");\n promise.then(function() {\n currentLoading.finish();\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGitlabWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GitlabWebhooksDirective]);\n\n BitbucketWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.saveAttribute($scope.bitbucket, \"bitbucket\");\n promise.then(function() {\n currentLoading.finish();\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBitbucketWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", BitbucketWebhooksDirective]);\n\n ValidOriginIpsDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $ngModel) {\n return $ngModel.$parsers.push(function(value) {\n value = $.trim(value);\n if (value === \"\") {\n return [];\n }\n return value.split(\",\");\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgValidOriginIps\", ValidOriginIpsDirective);\n\n}).call(this);\n\n(function() {\n var createProjectRestrictionDirective, module;\n\n module = angular.module(\"taigaProject\");\n\n createProjectRestrictionDirective = function() {\n return {\n templateUrl: \"project/wizard-restrictions.html\"\n };\n };\n\n module.directive('tgCreateProjectRestriction', [createProjectRestrictionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/attachments.coffee\n */\n\n(function() {\n var CreateProject, DeleteProjectDirective, bindOnce, debounce, module, taiga, timeout;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaProject\");\n\n CreateProject = function($rootscope, $repo, $confirm, $location, $navurls, $rs, $projectUrl, $loading, lightboxService, $cacheFactory, $translate, currentUserService, $auth) {\n var directive, link;\n link = function($scope, $el, attrs) {\n var currentLoading, form, onErrorSubmit, onSuccessSubmit, openLightbox, submit, submitButton;\n $scope.data = {};\n $scope.templates = [];\n currentLoading = null;\n $auth.refresh();\n $scope.canCreatePrivateProjects = currentUserService.canCreatePrivateProjects();\n $scope.canCreatePublicProjects = currentUserService.canCreatePublicProjects();\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n onSuccessSubmit = function(response) {\n $cacheFactory.get('$http').removeAll();\n currentLoading.finish();\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\", $translate.instant(\"COMMON.SAVE\"));\n $location.url($projectUrl.get(response));\n lightboxService.close($el);\n return currentUserService.loadProjects();\n };\n onErrorSubmit = function(response) {\n var error_field, i, len, ref, results, selectors;\n currentLoading.finish();\n form.setErrors(response);\n selectors = [];\n ref = _.keys(response);\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n error_field = ref[i];\n results.push(selectors.push(\"[name=\" + error_field + \"]\"));\n }\n return results;\n };\n submit = (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.create(\"projects\", $scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this);\n openLightbox = function() {\n $scope.data = {\n is_private: false\n };\n if (!$scope.templates.length) {\n $rs.projects.templates().then((function(_this) {\n return function(result) {\n $scope.templates = result;\n return $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n };\n })(this));\n } else {\n $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n }\n return lightboxService.open($el);\n };\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return openLightbox();\n };\n directive = {\n link: link,\n templateUrl: \"project/wizard-create-project.html\",\n scope: {}\n };\n return directive;\n };\n\n module.directive(\"tgLbCreateProject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$location\", \"$tgNavUrls\", \"$tgResources\", \"$projectUrl\", \"$tgLoading\", \"lightboxService\", \"$cacheFactory\", \"$translate\", \"tgCurrentUserService\", \"$tgAuth\", CreateProject]);\n\n DeleteProjectDirective = function($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader, currentUserService) {\n var link;\n link = function($scope, $el, $attrs) {\n var projectToDelete, submit;\n projectToDelete = null;\n $scope.$on(\"deletelightbox:new\", function(ctx, project) {\n lightboxService.open($el);\n return projectToDelete = project;\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var promise;\n tgLoader.start();\n lightboxService.close($el);\n promise = $repo.remove(projectToDelete);\n promise.then(function(data) {\n tgLoader.pageLoaded();\n $rootscope.$broadcast(\"projects:reload\");\n $location.path($navUrls.resolve(\"home\"));\n $confirm.notify(\"success\");\n return currentUserService.loadProjects();\n });\n return promise.then(null, function() {\n $confirm.notify(\"error\");\n return lightboxService.close($el);\n });\n };\n $el.on(\"click\", \".button-red\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbDeleteProject\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfirm\", \"lightboxService\", \"tgLoader\", \"tgCurrentUserService\", DeleteProjectDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/bind.coffee\n */\n\n(function() {\n var BindHtmlDirective, BindOnceAltDirective, BindOnceBindDirective, BindOnceHrefDirective, BindOnceHtmlDirective, BindOnceRefDirective, BindOnceSrcDirective, BindOnceTitleDirective, BindTitleDirective, bindOnce, module;\n\n bindOnce = this.taiga.bindOnce;\n\n BindOnceBindDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoBind, function(val) {\n return $el.text(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHtml, function(val) {\n return $el.html(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceRefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoRef, function(val) {\n return $el.html(\"#\" + val + \" \");\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceSrcDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoSrc, function(val) {\n return $el.attr(\"src\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHrefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHref, function(val) {\n return $el.attr(\"href\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceAltDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoAlt, function(val) {\n return $el.attr(\"alt\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoTitle, function(val) {\n return $el.attr(\"title\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgTitleHtml, function(val) {\n if (val != null) {\n return $el.attr(\"title\", val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n BindHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgBindHtml, function(val) {\n if (val != null) {\n return $el.html(val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaBase\");\n\n module.directive(\"tgBoBind\", BindOnceBindDirective);\n\n module.directive(\"tgBoHtml\", BindOnceHtmlDirective);\n\n module.directive(\"tgBoRef\", BindOnceRefDirective);\n\n module.directive(\"tgBoSrc\", BindOnceSrcDirective);\n\n module.directive(\"tgBoHref\", BindOnceHrefDirective);\n\n module.directive(\"tgBoAlt\", BindOnceAltDirective);\n\n module.directive(\"tgBoTitle\", BindOnceTitleDirective);\n\n module.directive(\"tgBindTitle\", BindTitleDirective);\n\n module.directive(\"tgBindHtml\", BindHtmlDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/conf.coffee\n */\n\n(function() {\n var ConfigurationService, module;\n\n ConfigurationService = (function() {\n function ConfigurationService() {\n this.config = window.taigaConfig;\n }\n\n ConfigurationService.prototype.get = function(key, defaultValue) {\n if (defaultValue == null) {\n defaultValue = null;\n }\n if (_.has(this.config, key)) {\n return this.config[key];\n }\n return defaultValue;\n };\n\n return ConfigurationService;\n\n })();\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgConfig\", ConfigurationService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/contrib.coffee\n */\n\n(function() {\n var ContribController, ContribUserSettingsController, module,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n module = angular.module(\"taigaBase\");\n\n ContribController = (function(superClass) {\n extend(ContribController, superClass);\n\n ContribController.$inject = [\"$rootScope\", \"$scope\", \"$routeParams\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\"];\n\n function ContribController(rootScope, scope, params, repo, rs, confirm) {\n var promise;\n this.rootScope = rootScope;\n this.scope = scope;\n this.params = params;\n this.repo = repo;\n this.rs = rs;\n this.confirm = confirm;\n this.scope.currentPlugin = _.head(_.filter(this.rootScope.adminPlugins, {\n \"slug\": this.params.plugin\n }));\n this.scope.projectSlug = this.params.pslug;\n promise = this.loadInitialData();\n promise.then(null, (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n }\n\n ContribController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.$broadcast('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ContribController.prototype.loadInitialData = function() {\n return this.loadProject();\n };\n\n return ContribController;\n\n })(taiga.Controller);\n\n module.controller(\"ContribController\", ContribController);\n\n ContribUserSettingsController = (function(superClass) {\n extend(ContribUserSettingsController, superClass);\n\n ContribUserSettingsController.$inject = [\"$rootScope\", \"$scope\", \"$routeParams\"];\n\n function ContribUserSettingsController(rootScope, scope, params) {\n this.rootScope = rootScope;\n this.scope = scope;\n this.params = params;\n this.scope.currentPlugin = _.head(_.filter(this.rootScope.userSettingsPlugins, {\n \"slug\": this.params.plugin\n }));\n }\n\n return ContribUserSettingsController;\n\n })(taiga.Controller);\n\n module.controller(\"ContribUserSettingsController\", ContribUserSettingsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/filters.coffee\n */\n\n(function() {\n var FiltersStorageService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n FiltersStorageService = (function(superClass) {\n extend(FiltersStorageService, superClass);\n\n FiltersStorageService.$inject = [\"$tgStorage\", \"$routeParams\"];\n\n function FiltersStorageService(storage, params) {\n this.storage = storage;\n this.params = params;\n }\n\n FiltersStorageService.prototype.generateHash = function(components) {\n if (components == null) {\n components = [];\n }\n components = _.map(components, function(x) {\n return JSON.stringify(x);\n });\n return hex_sha1(components.join(\":\"));\n };\n\n return FiltersStorageService;\n\n })(taiga.Service);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/http.coffee\n */\n\n(function() {\n var HttpService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n HttpService = (function(superClass) {\n extend(HttpService, superClass);\n\n HttpService.$inject = [\"$http\", \"$q\", \"$tgStorage\", \"$rootScope\", \"$cacheFactory\", \"$translate\"];\n\n function HttpService(http, q, storage, rootScope, cacheFactory, translate) {\n this.http = http;\n this.q = q;\n this.storage = storage;\n this.rootScope = rootScope;\n this.cacheFactory = cacheFactory;\n this.translate = translate;\n HttpService.__super__.constructor.call(this);\n this.cache = this.cacheFactory(\"httpget\");\n }\n\n HttpService.prototype.headers = function() {\n var headers, lang, token;\n headers = {};\n token = this.storage.get('token');\n if (token) {\n headers[\"Authorization\"] = \"Bearer \" + token;\n }\n lang = this.translate.preferredLanguage();\n if (lang) {\n headers[\"Accept-Language\"] = lang;\n }\n return headers;\n };\n\n HttpService.prototype.request = function(options) {\n options.headers = _.assign({}, options.headers || {}, this.headers());\n return this.http(options);\n };\n\n HttpService.prototype.get = function(url, params, options) {\n options = _.assign({\n method: \"GET\",\n url: url\n }, options);\n if (params) {\n options.params = params;\n }\n options.cache = this.cache;\n return this.request(options)[\"finally\"]((function(_this) {\n return function(data) {\n return _this.cache.removeAll();\n };\n })(this));\n };\n\n HttpService.prototype.post = function(url, data, params, options) {\n options = _.assign({\n method: \"POST\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.put = function(url, data, params, options) {\n options = _.assign({\n method: \"PUT\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.patch = function(url, data, params, options) {\n options = _.assign({\n method: \"PATCH\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype[\"delete\"] = function(url, data, params, options) {\n options = _.assign({\n method: \"DELETE\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n return HttpService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgHttp\", HttpService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/location.coffee\n */\n\n(function() {\n var locationFactory, module;\n\n locationFactory = function($location, $route, $rootscope) {\n $location.noreload = function(scope) {\n var lastRoute, un;\n lastRoute = $route.current;\n un = scope.$on(\"$locationChangeSuccess\", function() {\n $route.current = lastRoute;\n return un();\n });\n return $location;\n };\n $location.isInCurrentRouteParams = function(name, value) {\n var params;\n params = $location.search() || {};\n return params[name] === value;\n };\n return $location;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgLocation\", [\"$location\", \"$route\", \"$rootScope\", locationFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/model.coffee\n */\n\n(function() {\n var Model, ModelService, module, provider, taiga,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n Model = (function() {\n function Model(name, data, dataTypes) {\n this._attrs = data;\n this._name = name;\n this._dataTypes = dataTypes;\n this.setAttrs(data);\n this.initialize();\n }\n\n Model.prototype.clone = function() {\n var instance;\n instance = new Model(this._name, this._attrs, this._dataTypes);\n instance._modifiedAttrs = this._modifiedAttrs;\n instance._isModified = this._isModified;\n return instance;\n };\n\n Model.prototype.applyCasts = function() {\n var attrName, castMethod, castName, ref, results;\n ref = this._dataTypes;\n results = [];\n for (attrName in ref) {\n castName = ref[attrName];\n castMethod = service.casts[castName];\n if (!castMethod) {\n continue;\n }\n results.push(this._attrs[attrName] = castMethod(this._attrs[attrName]));\n }\n return results;\n };\n\n Model.prototype.getIdAttrName = function() {\n return \"id\";\n };\n\n Model.prototype.getName = function() {\n return this._name;\n };\n\n Model.prototype.getAttrs = function(patch) {\n if (patch == null) {\n patch = false;\n }\n if (this._attrs.version != null) {\n this._modifiedAttrs.version = this._attrs.version;\n }\n if (patch) {\n return _.extend({}, this._modifiedAttrs);\n }\n return _.extend({}, this._attrs, this._modifiedAttrs);\n };\n\n Model.prototype.setAttrs = function(attrs) {\n this._attrs = attrs;\n this._modifiedAttrs = {};\n this.applyCasts();\n return this._isModified = false;\n };\n\n Model.prototype.setAttr = function(name, value) {\n this._modifiedAttrs[name] = value;\n return this._isModified = true;\n };\n\n Model.prototype.initialize = function() {\n var getter, self, setter;\n self = this;\n getter = function(name) {\n return function() {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n return self[name];\n }\n if (indexOf.call(_.keys(self._modifiedAttrs), name) < 0) {\n return self._attrs[name];\n }\n return self._modifiedAttrs[name];\n };\n };\n setter = function(name) {\n return function(value) {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n self[name] = value;\n return;\n }\n if (self._attrs[name] !== value) {\n self._modifiedAttrs[name] = value;\n self._isModified = true;\n } else {\n delete self._modifiedAttrs[name];\n }\n };\n };\n return _.each(this._attrs, function(value, name) {\n var options;\n options = {\n get: getter(name),\n set: setter(name),\n enumerable: true,\n configurable: true\n };\n return Object.defineProperty(self, name, options);\n });\n };\n\n Model.prototype.serialize = function() {\n var data;\n data = {\n \"data\": _.clone(this._attrs),\n \"name\": this._name\n };\n return JSON.stringify(data);\n };\n\n Model.prototype.isModified = function() {\n return this._isModified;\n };\n\n Model.prototype.isAttributeModified = function(attribute) {\n return this._modifiedAttrs[attribute] != null;\n };\n\n Model.prototype.markSaved = function() {\n this._isModified = false;\n this._attrs = this.getAttrs();\n return this._modifiedAttrs = {};\n };\n\n Model.prototype.revert = function() {\n this._modifiedAttrs = {};\n return this._isModified = false;\n };\n\n Model.desSerialize = function(sdata) {\n var ddata, model;\n ddata = JSON.parse(sdata);\n model = new Model(ddata.url, ddata.data);\n return model;\n };\n\n return Model;\n\n })();\n\n taiga = this.taiga;\n\n ModelService = (function(superClass) {\n extend(ModelService, superClass);\n\n ModelService.$inject = [\"$q\", \"$tgUrls\", \"$tgStorage\", \"$tgHttp\"];\n\n function ModelService(q, urls, storage, http) {\n this.q = q;\n this.urls = urls;\n this.storage = storage;\n this.http = http;\n ModelService.__super__.constructor.call(this);\n }\n\n return ModelService;\n\n })(taiga.Service);\n\n provider = function($q, $http, $gmUrls, $gmStorage) {\n var service;\n service = {};\n service.make_model = function(name, data, cls, dataTypes) {\n if (cls == null) {\n cls = Model;\n }\n if (dataTypes == null) {\n dataTypes = {};\n }\n return new cls(name, data, dataTypes);\n };\n service.cls = Model;\n service.casts = {\n int: function(value) {\n return parseInt(value, 10);\n },\n float: function(value) {\n return parseFloat(value, 10);\n }\n };\n return service;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgModel\", [\"$q\", \"$http\", \"$tgUrls\", \"$tgStorage\", provider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/navurl.coffee\n */\n\n(function() {\n var NavigationUrlsDirective, NavigationUrlsService, bindOnce, module, taiga, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaBase\");\n\n NavigationUrlsService = (function(superClass) {\n extend(NavigationUrlsService, superClass);\n\n function NavigationUrlsService() {\n this.urls = {};\n }\n\n NavigationUrlsService.prototype.update = function(urls) {\n return this.urls = _.merge({}, this.urls, urls || {});\n };\n\n NavigationUrlsService.prototype.formatUrl = function(url, ctx) {\n var replacer;\n if (ctx == null) {\n ctx = {};\n }\n replacer = function(match) {\n match = trim(match, \":\");\n return ctx[match] || \"undefined\";\n };\n return url.replace(/(:\\w+)/g, replacer);\n };\n\n NavigationUrlsService.prototype.resolve = function(name, ctx) {\n var url;\n url = this.urls[name];\n if (!url) {\n return \"\";\n }\n if (ctx) {\n return this.formatUrl(url, ctx);\n }\n return url;\n };\n\n return NavigationUrlsService;\n\n })(taiga.Service);\n\n module.service(\"$tgNavUrls\", NavigationUrlsService);\n\n NavigationUrlsDirective = function($navurls, $auth, $q, $location, lightboxService) {\n var bindOnceP, link, parseNav;\n bindOnceP = function($scope, attr) {\n var defered;\n defered = $q.defer();\n bindOnce($scope, attr, function(v) {\n return defered.resolve(v);\n });\n return defered.promise;\n };\n parseNav = function(data, $scope) {\n var index, name, obj, params, promises, ref, result, values;\n ref = _.map(data.split(\":\"), trim), name = ref[0], params = ref[1];\n if (params) {\n result = params.split(/(\\w+)=/);\n result = _.filter(result, function(str) {\n return str.length;\n });\n result = _.map(result, function(str) {\n return trim(str.replace(/,$/g, ''));\n });\n params = [];\n index = 0;\n while (index < result.length) {\n obj = {};\n obj[result[index]] = result[index + 1];\n params.push(obj);\n index = index + 2;\n }\n } else {\n params = [];\n }\n values = _.map(params, function(param) {\n return _.values(param)[0];\n });\n promises = _.map(values, function(x) {\n return bindOnceP($scope, x);\n });\n return $q.all(promises).then(function() {\n var i, key, len, options, param, value;\n options = {};\n for (i = 0, len = params.length; i < len; i++) {\n param = params[i];\n key = Object.keys(param)[0];\n value = param[key];\n options[key] = $scope.$eval(value);\n }\n return [name, options];\n });\n };\n link = function($scope, $el, $attrs) {\n if ($el.is(\"a\")) {\n $el.attr(\"href\", \"#\");\n }\n $el.on(\"mouseenter\", function(event) {\n var target;\n target = $(event.currentTarget);\n if (!target.data(\"fullUrl\") || $attrs.tgNavGetParams !== target.data(\"params\")) {\n return parseNav($attrs.tgNav, $scope).then(function(result) {\n var fullUrl, getURLParams, getURLParamsStr, name, options, url, user;\n name = result[0], options = result[1];\n user = $auth.getUser();\n if (user) {\n options.user = user.username;\n }\n url = $navurls.resolve(name);\n fullUrl = $navurls.formatUrl(url, options);\n if ($attrs.tgNavGetParams) {\n getURLParams = JSON.parse($attrs.tgNavGetParams);\n getURLParamsStr = $.param(getURLParams);\n fullUrl = fullUrl + \"?\" + getURLParamsStr;\n target.data(\"params\", $attrs.tgNavGetParams);\n }\n target.data(\"fullUrl\", fullUrl);\n if (target.is(\"a\")) {\n target.attr(\"href\", fullUrl);\n }\n return $el.on(\"click\", function(event) {\n if (event.metaKey || event.ctrlKey) {\n return;\n }\n event.preventDefault();\n target = $(event.currentTarget);\n if (target.hasClass('noclick')) {\n return;\n }\n fullUrl = target.data(\"fullUrl\");\n switch (event.which) {\n case 1:\n $location.url(fullUrl);\n $scope.$apply();\n break;\n case 2:\n window.open(fullUrl);\n }\n return lightboxService.closeAll();\n });\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNav\", [\"$tgNavUrls\", \"$tgAuth\", \"$q\", \"$tgLocation\", \"lightboxService\", NavigationUrlsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/repository.coffee\n */\n\n(function() {\n var RepositoryService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n RepositoryService = (function(superClass) {\n extend(RepositoryService, superClass);\n\n RepositoryService.$inject = [\"$q\", \"$tgModel\", \"$tgStorage\", \"$tgHttp\", \"$tgUrls\"];\n\n function RepositoryService(q, model1, storage, http, urls) {\n this.q = q;\n this.model = model1;\n this.storage = storage;\n this.http = http;\n this.urls = urls;\n RepositoryService.__super__.constructor.call(this);\n }\n\n RepositoryService.prototype.resolveUrlForModel = function(model) {\n var idAttrName;\n idAttrName = model.getIdAttrName();\n return (this.urls.resolve(model.getName())) + \"/\" + model[idAttrName];\n };\n\n RepositoryService.prototype.resolveUrlForAttributeModel = function(model) {\n return this.urls.resolve(model.getName(), model.parent);\n };\n\n RepositoryService.prototype.create = function(name, data, dataTypes, extraParams) {\n var defered, promise, url;\n if (dataTypes == null) {\n dataTypes = {};\n }\n if (extraParams == null) {\n extraParams = {};\n }\n defered = this.q.defer();\n url = this.urls.resolve(name);\n promise = this.http.post(url, JSON.stringify(data));\n promise.success((function(_this) {\n return function(_data, _status) {\n return defered.resolve(_this.model.make_model(name, _data, null, dataTypes));\n };\n })(this));\n promise.error((function(_this) {\n return function(data, status) {\n return defered.reject(data);\n };\n })(this));\n return defered.promise;\n };\n\n RepositoryService.prototype.remove = function(model, params) {\n var defered, promise, url;\n if (params == null) {\n params = {};\n }\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http[\"delete\"](url, {}, params);\n promise.success(function(data, status) {\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(model);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAll = function(models, patch) {\n var promises;\n if (patch == null) {\n patch = true;\n }\n promises = _.map(models, (function(_this) {\n return function(x) {\n return _this.save(x, true);\n };\n })(this));\n return this.q.all(promises);\n };\n\n RepositoryService.prototype.save = function(model, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForModel(model);\n data = JSON.stringify(model.getAttrs(patch));\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAttribute = function(model, attribute, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForAttributeModel(model);\n data = {};\n data[attribute] = model.getAttrs();\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.refresh = function(model) {\n var defered, promise, url;\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http.get(url);\n promise.success(function(data, status) {\n model._modifiedAttrs = {};\n model._attrs = data;\n model._isModified = false;\n model.applyCasts();\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.queryMany = function(name, params, options, headers) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n if (headers == null) {\n headers = false;\n }\n url = this.urls.resolve(name);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var result;\n result = _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n if (headers) {\n return [result, data.headers];\n }\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneAttribute = function(name, id, attribute, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name, id);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var model;\n model = _this.model.make_model(name, data.data[attribute]);\n model.parent = id;\n return model;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOne = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return _this.model.make_model(name, data.data);\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneRaw = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = _.merge({\n headers: {}\n }, options);\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryPaginated = function(name, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n httpOptions = _.merge({\n headers: {}\n }, options);\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var headers, result;\n headers = data.headers();\n result = {};\n result.models = _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n result.count = parseInt(headers[\"x-pagination-count\"], 10);\n result.current = parseInt(headers[\"x-pagination-current\"] || 1, 10);\n result.paginatedBy = parseInt(headers[\"x-paginated-by\"], 10);\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOnePaginatedRaw = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = _.merge({\n headers: {}\n }, options);\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var headers, result;\n headers = data.headers();\n result = {};\n result.data = data.data;\n result.count = parseInt(headers[\"x-pagination-count\"], 10);\n result.current = parseInt(headers[\"x-pagination-current\"] || 1, 10);\n result.paginatedBy = parseInt(headers[\"x-paginated-by\"], 10);\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.resolve = function(options) {\n var cache, params;\n params = {};\n if (options.pslug != null) {\n params.project = options.pslug;\n }\n if (options.usref != null) {\n params.us = options.usref;\n }\n if (options.taskref != null) {\n params.task = options.taskref;\n }\n if (options.issueref != null) {\n params.issue = options.issueref;\n }\n if (options.sslug != null) {\n params.milestone = options.sslug;\n }\n if (options.wikipage != null) {\n params.wikipage = options.wikipage;\n }\n cache = !(options.wikipage || options.sslug);\n return this.queryOneRaw(\"resolver\", null, params, {\n cache: cache\n });\n };\n\n return RepositoryService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgRepo\", RepositoryService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/storage.coffee\n */\n\n(function() {\n var StorageService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n StorageService = (function(superClass) {\n extend(StorageService, superClass);\n\n StorageService.$inject = [\"$rootScope\"];\n\n function StorageService($rootScope) {\n StorageService.__super__.constructor.call(this);\n }\n\n StorageService.prototype.get = function(key, _default) {\n var serializedValue;\n serializedValue = localStorage.getItem(key);\n if (serializedValue === null) {\n return _default || null;\n }\n return JSON.parse(serializedValue);\n };\n\n StorageService.prototype.set = function(key, val) {\n if (_.isObject(key)) {\n return _.each(key, (function(_this) {\n return function(val, key) {\n return _this.set(key, val);\n };\n })(this));\n } else {\n return localStorage.setItem(key, JSON.stringify(val));\n }\n };\n\n StorageService.prototype.contains = function(key) {\n var value;\n value = this.get(key);\n return value !== null;\n };\n\n StorageService.prototype.remove = function(key) {\n return localStorage.removeItem(key);\n };\n\n StorageService.prototype.clear = function() {\n return localStorage.clear();\n };\n\n return StorageService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgStorage\", StorageService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/http.coffee\n */\n\n(function() {\n var UrlsService, format, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n format = function(fmt, obj) {\n obj = _.clone(obj);\n return fmt.replace(/%s/g, function(match) {\n return String(obj.shift());\n });\n };\n\n taiga = this.taiga;\n\n UrlsService = (function(superClass) {\n extend(UrlsService, superClass);\n\n UrlsService.$inject = [\"$tgConfig\"];\n\n function UrlsService(config) {\n this.config = config;\n this.urls = {};\n this.mainUrl = this.config.get(\"api\");\n }\n\n UrlsService.prototype.update = function(urls) {\n return this.urls = _.merge(this.urls, urls);\n };\n\n UrlsService.prototype.resolve = function() {\n var args, name, url;\n args = _.toArray(arguments);\n if (args.length === 0) {\n throw Error(\"wrong arguments to setUrls\");\n }\n name = args.slice(0, 1)[0];\n url = format(this.urls[name], args.slice(1));\n return format(\"%s/%s\", [_.trimEnd(this.mainUrl, \"/\"), _.trimStart(url, \"/\")]);\n };\n\n UrlsService.prototype.resolveAbsolute = function() {\n var url;\n url = this.resolve.apply(this, arguments);\n if (/^https?:\\/\\//i.test(url)) {\n return url;\n }\n if (/^\\//.test(url)) {\n return window.location.protocol + \"//\" + window.location.host + url;\n }\n return window.location.protocol + \"//\" + window.location.host + \"/\" + url;\n };\n\n return UrlsService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service('$tgUrls', UrlsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/custom-field-values.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo) {\n var _get, service;\n _get = function(objectId, resource) {\n return $repo.queryOne(resource, objectId);\n };\n service = {\n userstory: {\n get: function(objectId) {\n return _get(objectId, \"custom-attributes-values/userstory\");\n }\n },\n task: {\n get: function(objectId) {\n return _get(objectId, \"custom-attributes-values/task\");\n }\n },\n issue: {\n get: function(objectId) {\n return _get(objectId, \"custom-attributes-values/issue\");\n }\n }\n };\n return function(instance) {\n return instance.customAttributesValues = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgCustomAttributesValuesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($repo) {\n var _list, service;\n _list = function(projectId, resource) {\n return $repo.queryMany(resource, {\n project: projectId\n });\n };\n service = {\n userstory: {\n list: function(projectId) {\n return _list(projectId, \"custom-attributes/userstory\");\n }\n },\n task: {\n list: function(projectId) {\n return _list(projectId, \"custom-attributes/task\");\n }\n },\n issue: {\n list: function(projectId) {\n return _list(projectId, \"custom-attributes/issue\");\n }\n }\n };\n return function(instance) {\n return instance.customAttributes = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgCustomAttributesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/history.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(type, objectId) {\n return $repo.queryOneRaw(\"history/\" + type, objectId);\n };\n service.deleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/delete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n service.undeleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/undelete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.history = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgHistoryResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.get = function(token) {\n return $repo.queryOne(\"invitations\", token);\n };\n return function(instance) {\n return instance.invitations = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgInvitationsResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/issues.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage, $q) {\n var filtersHashSuffix, hashSuffix, myFiltersHashSuffix, service;\n service = {};\n hashSuffix = \"issues-queryparams\";\n filtersHashSuffix = \"issues-filters\";\n myFiltersHashSuffix = \"issues-my-filters\";\n service.get = function(projectId, issueId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"issues\", issueId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"issues\", \"by_ref\", params);\n };\n service.listInAllProjects = function(filters) {\n return $repo.queryMany(\"issues\", filters);\n };\n service.list = function(projectId, filters, options) {\n var params;\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryPaginated(\"issues\", params, options);\n };\n service.bulkCreate = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-issues\");\n params = {\n project_id: projectId,\n bulk_issues: data\n };\n return $http.post(url, params);\n };\n service.upvote = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-upvote\", issueId);\n return $http.post(url);\n };\n service.downvote = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-downvote\", issueId);\n return $http.post(url);\n };\n service.watch = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-watch\", issueId);\n return $http.post(url);\n };\n service.unwatch = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-unwatch\", issueId);\n return $http.post(url);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/issues_stats\");\n };\n service.filtersData = function(params) {\n return $repo.queryOneRaw(\"issues-filters\", null, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeFilters = function(projectSlug, params) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.set(hash, params);\n };\n service.getFilters = function(projectSlug) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.get(hash) || {};\n };\n service.storeMyFilters = function(projectId, myFilters) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n if (_.isEmpty(myFilters)) {\n promise = $http[\"delete\"](url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function() {\n return deferred.resolve();\n });\n promise.then(null, function() {\n return deferred.reject();\n });\n } else {\n promise = $http.put(url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function(data) {\n return deferred.resolve();\n });\n promise.then(null, function(data) {\n var innerPromise;\n innerPromise = $http.post(\"\" + url, {\n key: hash,\n value: myFilters\n });\n innerPromise.then(function() {\n return deferred.resolve();\n });\n return innerPromise.then(null, function() {\n return deferred.reject();\n });\n });\n }\n return deferred.promise;\n };\n service.getMyFilters = function(projectId) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n promise = $http.get(url + \"/\" + hash);\n promise.then(function(data) {\n return deferred.resolve(data.data.value);\n });\n promise.then(null, function(data) {\n return deferred.resolve({});\n });\n return deferred.promise;\n };\n return function(instance) {\n return instance.issues = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgIssuesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/kanban.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($storage) {\n var hashSuffixStatusColumnModes, hashSuffixStatusViewModes, service;\n service = {};\n hashSuffixStatusViewModes = \"kanban-statusviewmodels\";\n hashSuffixStatusColumnModes = \"kanban-statuscolumnmodels\";\n service.storeStatusViewModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusViewModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.kanban = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgKanbanResourcesProvider\", [\"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/locales.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($repo) {\n var service;\n service = {\n list: function() {\n return $repo.queryMany(\"locales\");\n }\n };\n return function(instance) {\n return instance.locales = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgLocalesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/mdrender.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.render = function(projectId, content) {\n var params, url;\n if ((content == null) || content === \"\") {\n content = ' ';\n }\n params = {\n project_id: projectId,\n content: content\n };\n url = $urls.resolve(\"wiki\");\n return $http.post(url + \"/render\", params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.mdrender = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMdRenderResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"memberships\", id);\n };\n service.list = function(projectId, filters, enablePagination) {\n var options, params;\n if (enablePagination == null) {\n enablePagination = true;\n }\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n if (enablePagination) {\n return $repo.queryPaginated(\"memberships\", params);\n }\n return $repo.queryMany(\"memberships\", params, options = {\n enablePagination: enablePagination\n });\n };\n service.listByUser = function(userId, filters) {\n var params;\n params = {\n user: userId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryPaginated(\"memberships\", params);\n };\n service.resendInvitation = function(id) {\n var url;\n url = $urls.resolve(\"memberships\");\n return $http.post(url + \"/\" + id + \"/resend_invitation\", {});\n };\n service.bulkCreateMemberships = function(projectId, data, invitation_extra_text) {\n var params, url;\n url = $urls.resolve(\"bulk-create-memberships\");\n params = {\n project_id: projectId,\n bulk_memberships: data,\n invitation_extra_text: invitation_extra_text\n };\n return $http.post(url, params);\n };\n return function(instance) {\n return instance.memberships = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMembershipsResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules.coffee\n */\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.list = function(projectId, module) {\n return $repo.queryOneAttribute(\"project-modules\", projectId, module);\n };\n return function(instance) {\n return instance.modules = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgModulesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"notify-policies\", id);\n };\n service.list = function(filters) {\n var params;\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"notify-policies\", params);\n };\n return function(instance) {\n return instance.notifyPolicies = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgNotifyPoliciesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $auth, $q, $translate) {\n var service;\n service = {};\n service.get = function(projectId) {\n return $repo.queryOne(\"projects\", projectId);\n };\n service.getBySlug = function(projectSlug) {\n return $repo.queryOne(\"projects\", \"by_slug?slug=\" + projectSlug);\n };\n service.list = function() {\n return $repo.queryMany(\"projects\");\n };\n service.listByMember = function(memberId) {\n var params;\n params = {\n \"member\": memberId,\n \"order_by\": \"memberships__user_order\"\n };\n return $repo.queryMany(\"projects\", params);\n };\n service.templates = function() {\n return $repo.queryMany(\"project-templates\");\n };\n service.usersList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"users\", params);\n };\n service.rolesList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"roles\", params);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/stats\");\n };\n service.bulkUpdateOrder = function(bulkData) {\n var url;\n url = $urls.resolve(\"bulk-update-projects-order\");\n return $http.post(url, bulkData);\n };\n service.regenerate_userstories_csv_uuid = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/regenerate_userstories_csv_uuid\";\n return $http.post(url);\n };\n service.regenerate_issues_csv_uuid = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/regenerate_issues_csv_uuid\";\n return $http.post(url);\n };\n service.regenerate_tasks_csv_uuid = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/regenerate_tasks_csv_uuid\";\n return $http.post(url);\n };\n service.leave = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/leave\";\n return $http.post(url);\n };\n service.memberStats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/member_stats\");\n };\n service.tagsColors = function(projectId) {\n return $repo.queryOne(\"projects\", projectId + \"/tags_colors\");\n };\n service[\"export\"] = function(projectId) {\n var url;\n url = ($urls.resolve(\"exporter\")) + \"/\" + projectId;\n return $http.get(url);\n };\n service[\"import\"] = function(file, statusUpdater) {\n var complete, data, defered, errorMsg, failed, maxFileSize, response, uploadComplete, uploadFailed, uploadProgress, xhr;\n defered = $q.defer();\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_MAX_SIZE_EXCEEDED\", {\n fileName: file.name,\n fileSize: sizeFormat(file.size),\n maxFileSize: sizeFormat(maxFileSize)\n });\n response = {\n status: 413,\n data: {\n _error_message: errorMsg\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n var message, percent;\n percent = Math.round((evt.loaded / evt.total) * 100);\n message = $translate.instant(\"PROJECT.IMPORT.UPLOAD_IN_PROGRESS_MESSAGE\", {\n uploadedSize: sizeFormat(evt.loaded),\n totalSize: sizeFormat(evt.total)\n });\n return statusUpdater(\"in-progress\", null, message, percent);\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return statusUpdater(\"done\", $translate.instant(\"PROJECT.IMPORT.TITLE\"), $translate.instant(\"PROJECT.IMPORT.DESCRIPTION\"));\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return statusUpdater(\"error\");\n };\n })(this);\n complete = (function(_this) {\n return function(evt) {\n var error, ref;\n response = {};\n try {\n response.data = JSON.parse(evt.target.responseText);\n } catch (error) {\n response.data = {};\n }\n response.status = evt.target.status;\n if (evt.target.getResponseHeader('Taiga-Info-Project-Is-Private')) {\n response.headers = {\n isPrivate: evt.target.getResponseHeader('Taiga-Info-Project-Is-Private') === 'True',\n memberships: parseInt(evt.target.getResponseHeader('Taiga-Info-Project-Memberships'))\n };\n }\n if ((ref = response.status) === 201 || ref === 202) {\n defered.resolve(response);\n }\n return defered.reject(response);\n };\n })(this);\n failed = (function(_this) {\n return function(evt) {\n return defered.reject(\"fail\");\n };\n })(this);\n data = new FormData();\n data.append('dump', file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.upload.addEventListener(\"load\", uploadComplete, false);\n xhr.upload.addEventListener(\"error\", uploadFailed, false);\n xhr.upload.addEventListener(\"abort\", uploadFailed, false);\n xhr.addEventListener(\"load\", complete, false);\n xhr.addEventListener(\"error\", failed, false);\n xhr.open(\"POST\", $urls.resolve(\"importer\"));\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + ($auth.getToken()));\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n service.changeLogo = function(projectId, file) {\n var data, defered, maxFileSize, options, response, url;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered = $q.defer();\n defered.reject(response);\n return defered.promise;\n }\n data = new FormData();\n data.append('logo', file);\n options = {\n transformRequest: angular.identity,\n headers: {\n 'Content-Type': void 0\n }\n };\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/change_logo\";\n return $http.post(url, data, {}, options);\n };\n service.removeLogo = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/remove_logo\";\n return $http.post(url);\n };\n return function(instance) {\n return instance.projects = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgProjectsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgAuth\", \"$q\", \"$translate\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"roles\", id);\n };\n service.list = function(projectId) {\n return $repo.queryMany(\"roles\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.roles = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgRolesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/search.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http, $q) {\n var service;\n service = {};\n service[\"do\"] = function(projectId, term) {\n var deferredAbort, params, request, url;\n deferredAbort = $q.defer();\n url = $urls.resolve(\"search\");\n params = {\n url: url,\n method: \"GET\",\n timeout: deferredAbort.promise,\n cancelable: true,\n params: {\n project: projectId,\n text: term,\n get_all: false\n }\n };\n request = $http.request(params).then(function(data) {\n return data.data;\n });\n request.abort = function() {\n return deferredAbort.resolve();\n };\n request[\"finally\"] = function() {\n request.abort = angular.noop;\n return deferredAbort = request = null;\n };\n return request;\n };\n return function(instance) {\n return instance.search = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSearchResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/sprints.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $model, $storage) {\n var service;\n service = {};\n service.get = function(projectId, sprintId) {\n return $repo.queryOne(\"milestones\", sprintId).then(function(sprint) {\n var uses;\n uses = sprint.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n sprint._attrs.user_stories = uses;\n return sprint;\n });\n };\n service.stats = function(projectId, sprintId) {\n return $repo.queryOneRaw(\"milestones\", sprintId + \"/stats\");\n };\n service.list = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"milestones\", params, {}, true).then((function(_this) {\n return function(result) {\n var headers, i, len, m, milestones, uses;\n milestones = result[0];\n headers = result[1];\n for (i = 0, len = milestones.length; i < len; i++) {\n m = milestones[i];\n uses = m.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n m._attrs.user_stories = uses;\n }\n return {\n milestones: milestones,\n closed: parseInt(headers(\"Taiga-Info-Total-Closed-Milestones\"), 10),\n open: parseInt(headers(\"Taiga-Info-Total-Opened-Milestones\"), 10)\n };\n };\n })(this));\n };\n return function(instance) {\n return instance.sprints = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSprintsResourcesProvider\", [\"$tgRepo\", \"$tgModel\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/tasks.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, hashSuffixStatusColumnModes, hashSuffixUsRowModes, service;\n service = {};\n hashSuffix = \"tasks-queryparams\";\n hashSuffixStatusColumnModes = \"tasks-statuscolumnmodels\";\n hashSuffixUsRowModes = \"tasks-usrowmodels\";\n service.get = function(projectId, taskId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"tasks\", taskId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"tasks\", \"by_ref\", params);\n };\n service.listInAllProjects = function(filters) {\n return $repo.queryMany(\"tasks\", filters);\n };\n service.list = function(projectId, sprintId, userStoryId) {\n var params;\n if (sprintId == null) {\n sprintId = null;\n }\n if (userStoryId == null) {\n userStoryId = null;\n }\n params = {\n project: projectId\n };\n if (sprintId) {\n params.milestone = sprintId;\n }\n if (userStoryId) {\n params.user_story = userStoryId;\n }\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"tasks\", params);\n };\n service.bulkCreate = function(projectId, sprintId, usId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-tasks\");\n params = {\n project_id: projectId,\n sprint_id: sprintId,\n us_id: usId,\n bulk_tasks: data\n };\n return $http.post(url, params).then(function(result) {\n return result.data;\n });\n };\n service.upvote = function(taskId) {\n var url;\n url = $urls.resolve(\"task-upvote\", taskId);\n return $http.post(url);\n };\n service.downvote = function(taskId) {\n var url;\n url = $urls.resolve(\"task-downvote\", taskId);\n return $http.post(url);\n };\n service.watch = function(taskId) {\n var url;\n url = $urls.resolve(\"task-watch\", taskId);\n return $http.post(url);\n };\n service.unwatch = function(taskId) {\n var url;\n url = $urls.resolve(\"task-unwatch\", taskId);\n return $http.post(url);\n };\n service.bulkUpdateTaskTaskboardOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-task-taskboard-order\");\n params = {\n project_id: projectId,\n bulk_tasks: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeUsRowModes = function(projectId, sprintId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.set(hash, params);\n };\n service.getUsRowModes = function(projectId, sprintId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.tasks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgTasksResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $q) {\n var service;\n service = {};\n service.changeAvatar = function(file) {\n var data, defered, maxFileSize, options, response, url;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered = $q.defer();\n defered.reject(response);\n return defered.promise;\n }\n data = new FormData();\n data.append('avatar', file);\n options = {\n transformRequest: angular.identity,\n headers: {\n 'Content-Type': void 0\n }\n };\n url = ($urls.resolve(\"users\")) + \"/change_avatar\";\n return $http.post(url, data, {}, options);\n };\n service.removeAvatar = function() {\n var url;\n url = ($urls.resolve(\"users\")) + \"/remove_avatar\";\n return $http.post(url);\n };\n service.changePassword = function(currentPassword, newPassword) {\n var data, url;\n url = ($urls.resolve(\"users\")) + \"/change_password\";\n data = {\n current_password: currentPassword,\n password: newPassword\n };\n return $http.post(url, data);\n };\n return function(instance) {\n return instance.userSettings = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserSettingsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/user.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($http, $urls) {\n var service;\n service = {};\n service.contacts = function(userId, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = $urls.resolve(\"user-contacts\", userId);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return $http.get(url, {}, httpOptions).then(function(result) {\n return result.data;\n });\n };\n return function(instance) {\n return instance.users = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUsersResourcesProvider\", [\"$tgHttp\", \"$tgUrls\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/userstories.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, service;\n service = {};\n hashSuffix = \"userstories-queryparams\";\n service.get = function(projectId, usId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"userstories\", usId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"userstories\", \"by_ref\", params);\n };\n service.listInAllProjects = function(filters) {\n return $repo.queryMany(\"userstories\", filters);\n };\n service.filtersData = function(params) {\n return $repo.queryOneRaw(\"userstories-filters\", null, params);\n };\n service.listUnassigned = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId,\n \"milestone\": \"null\"\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.listAll = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.bulkCreate = function(projectId, status, bulk) {\n var data, url;\n data = {\n project_id: projectId,\n status_id: status,\n bulk_stories: bulk\n };\n url = $urls.resolve(\"bulk-create-us\");\n return $http.post(url, data);\n };\n service.upvote = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-upvote\", userStoryId);\n return $http.post(url);\n };\n service.downvote = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-downvote\", userStoryId);\n return $http.post(url);\n };\n service.watch = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-watch\", userStoryId);\n return $http.post(url);\n };\n service.unwatch = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-unwatch\", userStoryId);\n return $http.post(url);\n };\n service.bulkUpdateBacklogOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-backlog-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateSprintOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-sprint-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateKanbanOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-kanban-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeShowTags = function(projectId, showTags) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.set(hash, showTags);\n };\n service.getShowTags = function(projectId) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.get(hash) || null;\n };\n return function(instance) {\n return instance.userstories = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserstoriesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: webhooklogs.coffee\n */\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(webhookId) {\n var params;\n params = {\n webhook: webhookId\n };\n return $repo.queryMany(\"webhooklogs\", params);\n };\n service.resend = function(webhooklogId) {\n var url;\n url = $urls.resolve(\"webhooklogs-resend\", webhooklogId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooklogs = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhookLogsResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: webhooks.coffee\n */\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(projectId) {\n var params;\n params = {\n project: projectId\n };\n return $repo.queryMany(\"webhooks\", params);\n };\n service.test = function(webhookId) {\n var url;\n url = $urls.resolve(\"webhooks-test\", webhookId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhooksResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/wikis.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(wikiId) {\n return $repo.queryOne(\"wiki\", wikiId);\n };\n service.getBySlug = function(projectId, slug) {\n return $repo.queryOne(\"wiki\", \"by_slug?project=\" + projectId + \"&slug=\" + slug);\n };\n service.listLinks = function(projectId) {\n return $repo.queryMany(\"wiki-links\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.wiki = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWikiResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/main.coffee\n */\n\n(function() {\n var UserChangePasswordController, UserChangePasswordDirective, debounce, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserChangePasswordController = (function(superClass) {\n extend(UserChangePasswordController, superClass);\n\n UserChangePasswordController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\", \"$translate\"];\n\n function UserChangePasswordController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, auth, translate) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.auth = auth;\n this.translate = translate;\n this.scope.sectionName = this.translate.instant(\"CHANGE_PASSWORD.SECTION_NAME\");\n this.scope.user = this.auth.getUser();\n }\n\n return UserChangePasswordController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserChangePasswordController\", UserChangePasswordController);\n\n UserChangePasswordDirective = function($rs, $confirm, $loading, $translate) {\n var link;\n link = function($scope, $el, $attrs, ctrl) {\n var form, submit, submitButton;\n form = new checksley.Form($el.find(\"form\"));\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n if ($scope.newPassword1 !== $scope.newPassword2) {\n $confirm.notify('error', $translate.instant(\"CHANGE_PASSWORD.ERROR_PASSWORD_MATCH\"));\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $rs.userSettings.changePassword($scope.currentPassword, $scope.newPassword1);\n promise.then(function() {\n currentLoading.finish();\n return $confirm.notify('success');\n });\n return promise.then(null, function(response) {\n currentLoading.finish();\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserChangePassword\", [\"$tgResources\", \"$tgConfirm\", \"$tgLoading\", \"$translate\", UserChangePasswordDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/lightboxes.coffee\n */\n\n(function() {\n var DeleteUserDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n DeleteUserDirective = function($repo, $rootscope, $auth, $location, $navUrls, lightboxService, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit, submitButton;\n $scope.$on(\"deletelightbox:new\", function(ctx, user) {\n return lightboxService.open($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var currentLoading, promise;\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.remove($scope.user);\n promise.then(function(data) {\n currentLoading.finish();\n lightboxService.close($el);\n $auth.logout();\n return $location.path($navUrls.resolve(\"login\"));\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return console.log(\"FAIL\");\n });\n };\n $el.on(\"click\", \".button-green\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n $el.on(\"click\", \".button-red\", debounce(2000, function(event) {\n event.preventDefault();\n return submit();\n }));\n return submitButton = $el.find(\".button-red\");\n };\n return {\n link: link,\n templateUrl: \"user/lightbox/lightbox-delete-account.html\"\n };\n };\n\n module.directive(\"tgLbDeleteUser\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"lightboxService\", \"$tgLoading\", DeleteUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/main.coffee\n */\n\n(function() {\n var TaigaAvatarModelDirective, UserAvatarDirective, UserProfileDirective, UserSettingsController, debounce, mixOf, module, sizeFormat, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n sizeFormat = this.taiga.sizeFormat;\n\n module = angular.module(\"taigaUserSettings\");\n\n debounce = this.taiga.debounce;\n\n UserSettingsController = (function(superClass) {\n extend(UserSettingsController, superClass);\n\n UserSettingsController.$inject = [\"$scope\", \"$rootScope\", \"$tgConfig\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\", \"$translate\"];\n\n function UserSettingsController(scope, rootscope, config, repo, confirm, rs, params, q, location, navUrls, auth, translate) {\n var maxFileSize, promise, text;\n this.scope = scope;\n this.rootscope = rootscope;\n this.config = config;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.auth = auth;\n this.translate = translate;\n this.scope.sectionName = \"USER_SETTINGS.MENU.SECTION_TITLE\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n if (!this.scope.user) {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n this.location.replace();\n }\n this.scope.lang = this.getLan();\n this.scope.theme = this.getTheme();\n maxFileSize = this.config.get(\"maxUploadFileSize\", null);\n if (maxFileSize) {\n text = this.translate.instant(\"USER_SETTINGS.AVATAR_MAX_SIZE\", {\n \"maxFileSize\": sizeFormat(maxFileSize)\n });\n this.scope.maxFileSizeMsg = text;\n }\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserSettingsController.prototype.loadInitialData = function() {\n this.scope.availableThemes = this.config.get(\"themes\", []);\n return this.rs.locales.list().then((function(_this) {\n return function(locales) {\n _this.scope.locales = locales;\n return locales;\n };\n })(this));\n };\n\n UserSettingsController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.user);\n };\n\n UserSettingsController.prototype.getLan = function() {\n return this.scope.user.lang || this.translate.preferredLanguage();\n };\n\n UserSettingsController.prototype.getTheme = function() {\n return this.scope.user.theme || this.config.get(\"defaultTheme\") || \"taiga\";\n };\n\n return UserSettingsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserSettingsController\", UserSettingsController);\n\n UserProfileDirective = function($confirm, $auth, $repo, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var changeEmail, form, onError, onSuccess;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n changeEmail = $scope.user.isAttributeModified(\"email\");\n $scope.user.lang = $scope.lang;\n $scope.user.theme = $scope.theme;\n onSuccess = function(data) {\n var text;\n $auth.setUser(data);\n if (changeEmail) {\n text = $translate.instant(\"USER_PROFILE.CHANGE_EMAIL_SUCCESS\");\n return $confirm.success(text);\n } else {\n return $confirm.notify('success');\n }\n };\n onError = function(data) {\n form.setErrors(data);\n return $confirm.notify('error', data._error_message);\n };\n return $repo.save($scope.user).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserProfile\", [\"$tgConfirm\", \"$tgAuth\", \"$tgRepo\", \"$translate\", UserProfileDirective]);\n\n UserAvatarDirective = function($auth, $model, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, showSizeInfo;\n showSizeInfo = function() {\n return $el.find(\".size-info\").removeClass(\"hidden\");\n };\n onSuccess = function(response) {\n var user;\n user = $model.make_model(\"users\", response.data);\n $auth.setUser(user);\n $scope.user = user;\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('success');\n };\n onError = function(response) {\n if (response.status === 413) {\n showSizeInfo();\n }\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('error', response.data._error_message);\n };\n $el.on(\"click\", \".js-change-avatar\", function() {\n return $el.find(\"#avatar-field\").click();\n });\n $el.on(\"change\", \"#avatar-field\", function(event) {\n if ($scope.avatarAttachment) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.userSettings.changeAvatar($scope.avatarAttachment).then(onSuccess, onError);\n }\n });\n $el.on(\"click\", \"a.js-use-gravatar\", function(event) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.userSettings.removeAvatar().then(onSuccess, onError);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserAvatar\", [\"$tgAuth\", \"$tgModel\", \"$tgResources\", \"$tgConfirm\", UserAvatarDirective]);\n\n TaigaAvatarModelDirective = function($parse) {\n var link;\n link = function($scope, $el, $attrs) {\n var model, modelSetter;\n model = $parse($attrs.tgAvatarModel);\n modelSetter = model.assign;\n return $el.bind('change', function() {\n return $scope.$apply(function() {\n return modelSetter($scope, $el[0].files[0]);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive('tgAvatarModel', ['$parse', TaigaAvatarModelDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/nav.coffee\n */\n\n(function() {\n var UserSettingsNavigationDirective, module;\n\n UserSettingsNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgUserSettingsNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#usersettingsmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaUserSettings\");\n\n module.directive(\"tgUserSettingsNavigation\", UserSettingsNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/notifications.coffee\n */\n\n(function() {\n var UserNotificationsController, UserNotificationsDirective, UserNotificationsListDirective, bindOnce, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserNotificationsController = (function(superClass) {\n extend(UserNotificationsController, superClass);\n\n UserNotificationsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserNotificationsController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, auth) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.auth = auth;\n this.scope.sectionName = \"USER_SETTINGS.NOTIFICATIONS.SECTION_NAME\";\n this.scope.user = this.auth.getUser();\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserNotificationsController.prototype.loadInitialData = function() {\n return this.rs.notifyPolicies.list().then((function(_this) {\n return function(notifyPolicies) {\n _this.scope.notifyPolicies = notifyPolicies;\n return notifyPolicies;\n };\n })(this));\n };\n\n return UserNotificationsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserNotificationsController\", UserNotificationsController);\n\n UserNotificationsDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotifications\", UserNotificationsDirective);\n\n UserNotificationsListDirective = function($repo, $confirm, $compile) {\n var link, template;\n template = _.template(\"<% _.each(notifyPolicies, function (notifyPolicy, index) { %>\\n
\\\">\\n
<%- notifyPolicy.project_name %>
\\n
\\n
\\n \\\" id=\\\"policy-all-<%- notifyPolicy.id %>\\\"\\n value=\\\"2\\\" <% if (notifyPolicy.notify_level == 2) { %>checked=\\\"checked\\\"<% } %>/>\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-involved-<%- notifyPolicy.id %>\\\"\\n value=\\\"1\\\" <% if (notifyPolicy.notify_level == 1) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-none-<%- notifyPolicy.id %>\\\"\\n value=\\\"3\\\" <% if (notifyPolicy.notify_level == 3) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n<% }) %>\");\n link = function($scope, $el, $attrs) {\n var render;\n render = function() {\n var ctx, html;\n $el.off();\n ctx = {\n notifyPolicies: $scope.notifyPolicies\n };\n html = template(ctx);\n $el.html($compile(html)($scope));\n return $el.on(\"change\", \"input[type=radio]\", function(event) {\n var onError, onSuccess, policy, policyIndex, prev_level, target;\n target = angular.element(event.currentTarget);\n policyIndex = target.parents(\".policy-table-row\").data('index');\n policy = $scope.notifyPolicies[policyIndex];\n prev_level = policy.notify_level;\n policy.notify_level = parseInt(target.val(), 10);\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n return target.parents(\".policy-table-row\").find(\"input[value=\" + prev_level + \"]\").prop(\"checked\", true);\n };\n return $repo.save(policy).then(onSuccess, onError);\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotificationsList\", [\"$tgRepo\", \"$tgConfirm\", \"$compile\", UserNotificationsListDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: components.module.coffee\n */\n\n(function() {\n angular.module(\"taigaComponents\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaDiscover\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-apps.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaExternalApps\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaHome\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: navigation-bar.module.coffee\n */\n\n(function() {\n angular.module(\"taigaNavigationBar\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaProfile\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects.module.coffee\n */\n\n(function() {\n angular.module(\"taigaProjects\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: resources.module.coffee\n */\n\n(function() {\n angular.module(\"taigaResources2\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline.module.coffee\n */\n\n(function() {\n angular.module(\"taigaUserTimeline\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachment-link.directive.coffee\n */\n\n(function() {\n var AttachmentLinkDirective;\n\n AttachmentLinkDirective = function($parse, lightboxFactory) {\n var link;\n link = function(scope, el, attrs) {\n var attachment;\n attachment = $parse(attrs.tgAttachmentLink)(scope);\n el.on(\"click\", function(event) {\n if (taiga.isImage(attachment.getIn(['file', 'name']))) {\n event.preventDefault();\n return scope.$apply(function() {\n return lightboxFactory.create('tg-lb-attachment-preview', {\n \"class\": 'lightbox lightbox-block'\n }, {\n file: attachment.get('file')\n });\n });\n }\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n link: link\n };\n };\n\n AttachmentLinkDirective.$inject = [\"$parse\", \"tgLightboxFactory\"];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentLink\", AttachmentLinkDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachment-gallery.directive.coffee\n */\n\n(function() {\n var AttachmentGalleryDirective;\n\n AttachmentGalleryDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n scope: {},\n bindToController: {\n attachment: \"=\",\n onDelete: \"&\",\n onUpdate: \"&\",\n type: \"=\"\n },\n controller: \"Attachment\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachment/attachment-gallery.html\",\n link: link\n };\n };\n\n AttachmentGalleryDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentGallery\", AttachmentGalleryDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchment.controller.coffee\n */\n\n(function() {\n var AttachmentController;\n\n AttachmentController = (function() {\n AttachmentController.$inject = ['tgAttachmentsService', '$translate'];\n\n function AttachmentController(attachmentsService, translate) {\n this.attachmentsService = attachmentsService;\n this.translate = translate;\n this.form = {};\n this.form.description = this.attachment.getIn(['file', 'description']);\n this.form.is_deprecated = this.attachment.get(['file', 'is_deprecated']);\n this.title = this.translate.instant(\"ATTACHMENT.TITLE\", {\n fileName: this.attachment.get('name'),\n date: moment(this.attachment.get('created_date')).format(this.translate.instant(\"ATTACHMENT.DATE\"))\n });\n }\n\n AttachmentController.prototype.editMode = function(mode) {\n var attachment;\n attachment = this.attachment.set('editable', mode);\n return this.onUpdate({\n attachment: attachment\n });\n };\n\n AttachmentController.prototype[\"delete\"] = function() {\n return this.onDelete({\n attachment: this.attachment\n });\n };\n\n AttachmentController.prototype.save = function() {\n var attachment;\n attachment = this.attachment.set('loading', true);\n this.onUpdate({\n attachment: attachment\n });\n attachment = this.attachment.merge({\n editable: false,\n loading: false\n });\n attachment = attachment.mergeIn(['file'], {\n description: this.form.description,\n is_deprecated: !!this.form.is_deprecated\n });\n return this.onUpdate({\n attachment: attachment\n });\n };\n\n return AttachmentController;\n\n })();\n\n angular.module('taigaComponents').controller('Attachment', AttachmentController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachment.directive.coffee\n */\n\n(function() {\n var AttachmentDirective;\n\n AttachmentDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n scope: {},\n bindToController: {\n attachment: \"=\",\n onDelete: \"&\",\n onUpdate: \"&\",\n type: \"=\"\n },\n controller: \"Attachment\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachment/attachment.html\",\n link: link\n };\n };\n\n AttachmentDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachment\", AttachmentDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-drop.directive.coffee\n */\n\n(function() {\n var AttachmentsDropDirective;\n\n AttachmentsDropDirective = function($parse) {\n var link;\n link = function(scope, el, attrs) {\n var eventAttr;\n eventAttr = $parse(attrs.tgAttachmentsDrop);\n el.on('dragover', function(e) {\n e.preventDefault();\n return false;\n });\n el.on('drop', function(e) {\n var dataTransfer;\n e.stopPropagation();\n e.preventDefault();\n dataTransfer = e.dataTransfer || (e.originalEvent && e.originalEvent.dataTransfer);\n return scope.$apply(function() {\n return eventAttr(scope, {\n files: dataTransfer.files\n });\n });\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n link: link\n };\n };\n\n AttachmentsDropDirective.$inject = [\"$parse\"];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsDrop\", AttachmentsDropDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-full.controller.coffee\n */\n\n(function() {\n var AttachmentsFullController, sizeFormat;\n\n sizeFormat = this.taiga.sizeFormat;\n\n AttachmentsFullController = (function() {\n AttachmentsFullController.$inject = [\"$translate\", \"$tgConfirm\", \"$tgConfig\", \"$tgStorage\", \"tgAttachmentsFullService\", \"tgProjectService\"];\n\n function AttachmentsFullController(translate, confirm, config, storage, attachmentsFullService, projectService) {\n this.translate = translate;\n this.confirm = confirm;\n this.config = config;\n this.storage = storage;\n this.attachmentsFullService = attachmentsFullService;\n this.projectService = projectService;\n this.mode = this.storage.get('attachment-mode', 'list');\n this.maxFileSize = this.config.get(\"maxUploadFileSize\", null);\n if (this.maxFileSize) {\n this.maxFileSize = sizeFormat(this.maxFileSize);\n }\n this.maxFileSizeMsg = this.maxFileSize ? this.translate.instant(\"ATTACHMENT.MAX_UPLOAD_SIZE\", {\n maxFileSize: this.maxFileSize\n }) : \"\";\n taiga.defineImmutableProperty(this, 'attachments', (function(_this) {\n return function() {\n return _this.attachmentsFullService.attachments;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsCount', (function(_this) {\n return function() {\n return _this.attachmentsFullService.deprecatedsCount;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'attachmentsVisible', (function(_this) {\n return function() {\n return _this.attachmentsFullService.attachmentsVisible;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsVisible', (function(_this) {\n return function() {\n return _this.attachmentsFullService.deprecatedsVisible;\n };\n })(this));\n }\n\n AttachmentsFullController.prototype.uploadingAttachments = function() {\n return this.attachmentsFullService.uploadingAttachments;\n };\n\n AttachmentsFullController.prototype.addAttachment = function(file) {\n var editable;\n editable = this.mode === 'list';\n return this.attachmentsFullService.addAttachment(this.projectId, this.objId, this.type, file, editable);\n };\n\n AttachmentsFullController.prototype.setMode = function(mode) {\n this.mode = mode;\n return this.storage.set('attachment-mode', mode);\n };\n\n AttachmentsFullController.prototype.toggleDeprecatedsVisible = function() {\n return this.attachmentsFullService.toggleDeprecatedsVisible();\n };\n\n AttachmentsFullController.prototype.addAttachments = function(files) {\n return _.forEach(files, (function(_this) {\n return function(file) {\n return _this.addAttachment(file);\n };\n })(this));\n };\n\n AttachmentsFullController.prototype.loadAttachments = function() {\n return this.attachmentsFullService.loadAttachments(this.type, this.objId, this.projectId);\n };\n\n AttachmentsFullController.prototype.deleteAttachment = function(toDeleteAttachment) {\n var message, title;\n title = this.translate.instant(\"ATTACHMENT.TITLE_LIGHTBOX_DELETE_ATTACHMENT\");\n message = this.translate.instant(\"ATTACHMENT.MSG_LIGHTBOX_DELETE_ATTACHMENT\", {\n fileName: toDeleteAttachment.getIn(['file', 'name'])\n });\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSuccess;\n onError = function() {\n message = _this.translate.instant(\"ATTACHMENT.ERROR_DELETE_ATTACHMENT\", {\n errorMessage: message\n });\n _this.confirm.notify(\"error\", null, message);\n return askResponse.finish(false);\n };\n onSuccess = function() {\n return askResponse.finish();\n };\n return _this.attachmentsFullService.deleteAttachment(toDeleteAttachment, _this.type).then(onSuccess, onError);\n };\n })(this));\n };\n\n AttachmentsFullController.prototype.reorderAttachment = function(attachment, newIndex) {\n return this.attachmentsFullService.reorderAttachment(this.type, attachment, newIndex);\n };\n\n AttachmentsFullController.prototype.updateAttachment = function(toUpdateAttachment) {\n return this.attachmentsFullService.updateAttachment(toUpdateAttachment, this.type);\n };\n\n AttachmentsFullController.prototype._isEditable = function() {\n if (this.projectService.project) {\n return this.projectService.hasPermission(this.editPermission);\n }\n return false;\n };\n\n AttachmentsFullController.prototype.showAttachments = function() {\n return this._isEditable() || this.attachmentsFullService.attachments.size;\n };\n\n return AttachmentsFullController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"AttachmentsFull\", AttachmentsFullController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-full.directive.coffee\n */\n\n(function() {\n var AttachmentsFullDirective, bindOnce;\n\n bindOnce = this.taiga.bindOnce;\n\n AttachmentsFullDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return bindOnce(scope, 'vm.objId', function(value) {\n return ctrl.loadAttachments();\n });\n };\n return {\n scope: {},\n bindToController: {\n type: \"@\",\n objId: \"=\",\n projectId: \"=\",\n editPermission: \"@\"\n },\n controller: \"AttachmentsFull\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachments-full/attachments-full.html\",\n link: link\n };\n };\n\n AttachmentsFullDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsFull\", AttachmentsFullDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-full.service.coffee\n */\n\n(function() {\n var AttachmentsFullService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n AttachmentsFullService = (function(superClass) {\n extend(AttachmentsFullService, superClass);\n\n AttachmentsFullService.$inject = [\"tgAttachmentsService\", \"$rootScope\"];\n\n function AttachmentsFullService(attachmentsService, rootScope) {\n this.attachmentsService = attachmentsService;\n this.rootScope = rootScope;\n this._attachments = Immutable.List();\n this._deprecatedsCount = 0;\n this._attachmentsVisible = Immutable.List();\n this._deprecatedsVisible = false;\n this.uploadingAttachments = [];\n taiga.defineImmutableProperty(this, 'attachments', (function(_this) {\n return function() {\n return _this._attachments;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsCount', (function(_this) {\n return function() {\n return _this._deprecatedsCount;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'attachmentsVisible', (function(_this) {\n return function() {\n return _this._attachmentsVisible;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsVisible', (function(_this) {\n return function() {\n return _this._deprecatedsVisible;\n };\n })(this));\n }\n\n AttachmentsFullService.prototype.toggleDeprecatedsVisible = function() {\n this._deprecatedsVisible = !this._deprecatedsVisible;\n return this.regenerate();\n };\n\n AttachmentsFullService.prototype.regenerate = function() {\n this._deprecatedsCount = this._attachments.count(function(it) {\n return it.getIn(['file', 'is_deprecated']);\n });\n if (this._deprecatedsVisible) {\n return this._attachmentsVisible = this._attachments;\n } else {\n return this._attachmentsVisible = this._attachments.filter(function(it) {\n return !it.getIn(['file', 'is_deprecated']);\n });\n }\n };\n\n AttachmentsFullService.prototype.addAttachment = function(projectId, objId, type, file, editable) {\n if (editable == null) {\n editable = true;\n }\n return new Promise((function(_this) {\n return function(resolve, reject) {\n var promise;\n if (_this.attachmentsService.validate(file)) {\n _this.uploadingAttachments.push(file);\n promise = _this.attachmentsService.upload(file, objId, projectId, type);\n return promise.then(function(file) {\n var attachment;\n _this.uploadingAttachments = _this.uploadingAttachments.filter(function(uploading) {\n return uploading.name !== file.get('name');\n });\n attachment = Immutable.Map();\n attachment = attachment.merge({\n file: file,\n editable: editable,\n loading: false\n });\n _this._attachments = _this._attachments.push(attachment);\n _this.regenerate();\n _this.rootScope.$broadcast(\"attachment:create\");\n return resolve(attachment);\n });\n } else {\n return reject(file);\n }\n };\n })(this));\n };\n\n AttachmentsFullService.prototype.loadAttachments = function(type, objId, projectId) {\n return this.attachmentsService.list(type, objId, projectId).then((function(_this) {\n return function(files) {\n _this._attachments = files.map(function(file) {\n var attachment;\n attachment = Immutable.Map();\n return attachment.merge({\n loading: false,\n editable: false,\n file: file\n });\n });\n return _this.regenerate();\n };\n })(this));\n };\n\n AttachmentsFullService.prototype.deleteAttachment = function(toDeleteAttachment, type) {\n var onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this._attachments = _this._attachments.filter(function(attachment) {\n return attachment !== toDeleteAttachment;\n });\n return _this.regenerate();\n };\n })(this);\n return this.attachmentsService[\"delete\"](type, toDeleteAttachment.getIn(['file', 'id'])).then(onSuccess);\n };\n\n AttachmentsFullService.prototype.reorderAttachment = function(type, attachment, newIndex) {\n var attachments, oldIndex, promises;\n oldIndex = this.attachments.findIndex(function(it) {\n return it === attachment;\n });\n if (oldIndex === newIndex) {\n return;\n }\n attachments = this.attachments.remove(oldIndex);\n attachments = attachments.splice(newIndex, 0, attachment);\n attachments = attachments.map(function(x, i) {\n return x.setIn(['file', 'order'], i + 1);\n });\n promises = [];\n attachments.forEach((function(_this) {\n return function(attachment) {\n var patch;\n patch = {\n order: attachment.getIn(['file', 'order'])\n };\n return promises.push(_this.attachmentsService.patch(attachment.getIn(['file', 'id']), type, patch));\n };\n })(this));\n return Promise.all(promises).then((function(_this) {\n return function() {\n _this._attachments = attachments;\n return _this.regenerate();\n };\n })(this));\n };\n\n AttachmentsFullService.prototype.updateAttachment = function(toUpdateAttachment, type) {\n var index, oldAttachment, patch;\n index = this._attachments.findIndex(function(attachment) {\n return attachment.getIn(['file', 'id']) === toUpdateAttachment.getIn(['file', 'id']);\n });\n oldAttachment = this._attachments.get(index);\n patch = taiga.patch(oldAttachment.get('file'), toUpdateAttachment.get('file'));\n if (toUpdateAttachment.get('loading')) {\n this._attachments = this._attachments.set(index, toUpdateAttachment);\n return this.regenerate();\n } else {\n return this.attachmentsService.patch(toUpdateAttachment.getIn(['file', 'id']), type, patch).then((function(_this) {\n return function() {\n _this._attachments = _this._attachments.set(index, toUpdateAttachment);\n return _this.regenerate();\n };\n })(this));\n }\n };\n\n return AttachmentsFullService;\n\n })(taiga.Service);\n\n angular.module(\"taigaComponents\").service(\"tgAttachmentsFullService\", AttachmentsFullService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-simple.controller.coffee\n */\n\n(function() {\n var AttachmentsSimpleController;\n\n AttachmentsSimpleController = (function() {\n AttachmentsSimpleController.$inject = [\"tgAttachmentsService\"];\n\n function AttachmentsSimpleController(attachmentsService) {\n this.attachmentsService = attachmentsService;\n }\n\n AttachmentsSimpleController.prototype.addAttachment = function(file) {\n var attachment;\n attachment = Immutable.fromJS({\n file: file,\n name: file.name,\n size: file.size\n });\n if (this.attachmentsService.validate(file)) {\n this.attachments = this.attachments.push(attachment);\n if (this.onAdd) {\n return this.onAdd({\n attachment: attachment\n });\n }\n }\n };\n\n AttachmentsSimpleController.prototype.addAttachments = function(files) {\n return _.forEach(files, this.addAttachment.bind(this));\n };\n\n AttachmentsSimpleController.prototype.deleteAttachment = function(toDeleteAttachment) {\n this.attachments = this.attachments.filter(function(attachment) {\n return attachment !== toDeleteAttachment;\n });\n if (this.onDelete) {\n return this.onDelete({\n attachment: toDeleteAttachment\n });\n }\n };\n\n return AttachmentsSimpleController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"AttachmentsSimple\", AttachmentsSimpleController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-simple.directive.coffee\n */\n\n(function() {\n var AttachmentsSimpleDirective;\n\n AttachmentsSimpleDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n scope: {},\n bindToController: {\n attachments: \"=\",\n onAdd: \"&\",\n onDelete: \"&\"\n },\n controller: \"AttachmentsSimple\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachments-simple/attachments-simple.html\",\n link: link\n };\n };\n\n AttachmentsSimpleDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsSimple\", AttachmentsSimpleDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-sortable.directive.coffee\n */\n\n(function() {\n var AttachmentSortableDirective;\n\n AttachmentSortableDirective = function($parse) {\n var link;\n link = function(scope, el, attrs) {\n var callback;\n callback = $parse(attrs.tgAttachmentsSortable);\n el.sortable({\n items: \"div[tg-bind-scope]\",\n handle: \".settings .icon\",\n containment: \".attachments\",\n dropOnEmpty: true,\n helper: 'clone',\n scroll: false,\n tolerance: \"pointer\",\n placeholder: \"sortable-placeholder single-attachment\"\n });\n el.on(\"sortstop\", function(event, ui) {\n var attachment, newIndex;\n attachment = ui.item.scope().attachment;\n newIndex = ui.item.index();\n return scope.$apply(function() {\n return callback(scope, {\n attachment: attachment,\n index: newIndex\n });\n });\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n link: link\n };\n };\n\n AttachmentSortableDirective.$inject = [\"$parse\"];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsSortable\", AttachmentSortableDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: auto-select.directive.coffee\n */\n\n(function() {\n var AutoSelectDirective;\n\n AutoSelectDirective = function($timeout) {\n return {\n link: function(scope, elm) {\n return $timeout(function() {\n return elm[0].select();\n });\n }\n };\n };\n\n AutoSelectDirective.$inject = ['$timeout'];\n\n angular.module(\"taigaComponents\").directive(\"tgAutoSelect\", AutoSelectDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: file-change.directive.coffee\n */\n\n(function() {\n var FileChangeDirective;\n\n FileChangeDirective = function($parse) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var eventAttr;\n eventAttr = $parse(attrs.tgFileChange);\n el.on('change', function(event) {\n return scope.$apply(function() {\n return eventAttr(scope, {\n files: event.currentTarget.files\n });\n });\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n require: \"ngModel\",\n restrict: \"A\",\n link: link\n };\n };\n\n FileChangeDirective.$inject = [\"$parse\"];\n\n angular.module(\"taigaComponents\").directive(\"tgFileChange\", FileChangeDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: joy-ride.directive.coffee\n */\n\n(function() {\n var JoyRideDirective, taiga;\n\n taiga = this.taiga;\n\n JoyRideDirective = function($rootScope, currentUserService, joyRideService, $location, $translate) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var initJoyrRide, intro, unsuscribe;\n unsuscribe = null;\n intro = introJs();\n intro.oncomplete(function() {\n return $('html,body').scrollTop(0);\n });\n intro.onexit(function() {\n return currentUserService.disableJoyRide();\n });\n initJoyrRide = function(next, config) {\n if (!config[next.joyride]) {\n return;\n }\n intro.setOptions({\n exitOnEsc: false,\n exitOnOverlayClick: false,\n showStepNumbers: false,\n nextLabel: $translate.instant('JOYRIDE.NAV.NEXT') + ' →',\n prevLabel: '← ' + $translate.instant('JOYRIDE.NAV.BACK'),\n skipLabel: $translate.instant('JOYRIDE.NAV.SKIP'),\n doneLabel: $translate.instant('JOYRIDE.NAV.DONE'),\n disableInteraction: true\n });\n intro.setOption('steps', joyRideService.get(next.joyride));\n return intro.start();\n };\n return $rootScope.$on('$routeChangeSuccess', function(event, next) {\n if (!next.joyride || !currentUserService.isAuthenticated()) {\n intro.exit();\n if (unsuscribe) {\n unsuscribe();\n }\n return;\n }\n intro.oncomplete(function() {\n return currentUserService.disableJoyRide(next.joyride);\n });\n if (next.loader) {\n return unsuscribe = $rootScope.$on('loader:end', function() {\n currentUserService.loadJoyRideConfig().then(function(config) {\n return initJoyrRide(next, config);\n });\n return unsuscribe();\n });\n } else {\n return currentUserService.loadJoyRideConfig().then(function(config) {\n return initJoyrRide(next, config);\n });\n }\n });\n };\n return {\n scope: {},\n link: link\n };\n };\n\n JoyRideDirective.$inject = [\"$rootScope\", \"tgCurrentUserService\", \"tgJoyRideService\", \"$location\", \"$translate\"];\n\n angular.module(\"taigaComponents\").directive(\"tgJoyRide\", JoyRideDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: joy-ride.service.coffee\n */\n\n(function() {\n var JoyRideService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n JoyRideService = (function(superClass) {\n extend(JoyRideService, superClass);\n\n JoyRideService.$inject = ['$translate', 'tgCheckPermissionsService'];\n\n function JoyRideService(translate, checkPermissionsService) {\n this.translate = translate;\n this.checkPermissionsService = checkPermissionsService;\n }\n\n JoyRideService.prototype.getConfig = function() {\n return {\n dashboard: (function(_this) {\n return function() {\n var steps;\n steps = [\n {\n element: '.project-list > section:not(.ng-hide)',\n position: 'left',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP1.TITLE'),\n text: _this.translate.instant('JOYRIDE.DASHBOARD.STEP1.TEXT')\n }\n }, {\n element: '.working-on-container',\n position: 'right',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP2.TITLE'),\n text: _this.translate.instant('JOYRIDE.DASHBOARD.STEP2.TEXT')\n }\n }, {\n element: '.watching-container',\n position: 'right',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP3.TITLE'),\n text: [_this.translate.instant('JOYRIDE.DASHBOARD.STEP3.TEXT1'), _this.translate.instant('JOYRIDE.DASHBOARD.STEP3.TEXT2')]\n }\n }\n ];\n if (!$('.project-list .create-project-button').is(':hidden')) {\n steps.push({\n element: '.project-list .create-project-button',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP4.TITLE'),\n text: [_this.translate.instant('JOYRIDE.DASHBOARD.STEP4.TEXT1'), _this.translate.instant('JOYRIDE.DASHBOARD.STEP4.TEXT2')]\n }\n });\n }\n return steps;\n };\n })(this),\n backlog: (function(_this) {\n return function() {\n var steps;\n steps = [\n {\n element: '.summary',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP1.TITLE'),\n text: [_this.translate.instant('JOYRIDE.BACKLOG.STEP1.TEXT1'), _this.translate.instant('JOYRIDE.BACKLOG.STEP1.TEXT2')]\n }\n }, {\n element: '.backlog-table-empty',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP2.TITLE'),\n text: _this.translate.instant('JOYRIDE.BACKLOG.STEP2.TEXT')\n }\n }, {\n element: '.sprints',\n position: 'left',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP3.TITLE'),\n text: _this.translate.instant('JOYRIDE.BACKLOG.STEP3.TEXT')\n }\n }\n ];\n if (_this.checkPermissionsService.check('add_us')) {\n steps.push({\n element: '.new-us',\n position: 'rigth',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP4.TITLE'),\n text: _this.translate.instant('JOYRIDE.BACKLOG.STEP4.TEXT')\n }\n });\n }\n return steps;\n };\n })(this),\n kanban: (function(_this) {\n return function() {\n var steps;\n steps = [\n {\n element: '.kanban-table-inner',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.KANBAN.STEP1.TITLE'),\n text: _this.translate.instant('JOYRIDE.KANBAN.STEP1.TEXT')\n }\n }, {\n element: '.card-placeholder',\n position: 'right',\n joyride: {\n title: _this.translate.instant('JOYRIDE.KANBAN.STEP2.TITLE'),\n text: _this.translate.instant('JOYRIDE.KANBAN.STEP2.TEXT')\n }\n }\n ];\n if (_this.checkPermissionsService.check('add_us')) {\n steps.push({\n element: '.icon-plus',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.KANBAN.STEP3.TITLE'),\n text: [_this.translate.instant('JOYRIDE.KANBAN.STEP3.TEXT1'), _this.translate.instant('JOYRIDE.KANBAN.STEP3.TEXT2')]\n }\n });\n }\n return steps;\n };\n })(this)\n };\n };\n\n JoyRideService.prototype.get = function(name) {\n var joyRide, joyRides;\n joyRides = this.getConfig();\n joyRide = joyRides[name].call(this);\n return _.map(joyRide, function(item) {\n var html;\n html = \"\";\n if (item.joyride.title) {\n html += \"

\" + item.joyride.title + \"

\";\n }\n if (_.isArray(item.joyride.text)) {\n _.forEach(item.joyride.text, function(text) {\n return html += \"

\" + text + \"

\";\n });\n } else {\n html += \"

\" + item.joyride.text + \"

\";\n }\n item.intro = html;\n return item;\n });\n };\n\n return JoyRideService;\n\n })(taiga.Service);\n\n angular.module(\"taigaComponents\").service(\"tgJoyRideService\", JoyRideService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Andrey Antukh \n * Copyright (C) 2014-2015 Jesús Espino Garcia \n * Copyright (C) 2014-2015 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: live-announcement.directive.coffee\n */\n\n(function() {\n var LiveAnnouncementDirective;\n\n LiveAnnouncementDirective = function(liveAnnouncementService) {\n var link;\n link = function(scope, el, attrs) {};\n return {\n restrict: \"AE\",\n scope: {},\n controllerAs: 'vm',\n controller: function() {\n this.close = function() {\n return liveAnnouncementService.open = false;\n };\n return Object.defineProperties(this, {\n open: {\n get: function() {\n return liveAnnouncementService.open;\n }\n },\n title: {\n get: function() {\n return liveAnnouncementService.title;\n }\n },\n desc: {\n get: function() {\n return liveAnnouncementService.desc;\n }\n }\n });\n },\n link: link,\n templateUrl: \"components/live-announcement/live-announcement.html\"\n };\n };\n\n LiveAnnouncementDirective.$inject = [\"tgLiveAnnouncementService\"];\n\n angular.module(\"taigaComponents\").directive(\"tgLiveAnnouncement\", LiveAnnouncementDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: notification.service.coffee\n */\n\n(function() {\n var LiveAnnouncementService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n LiveAnnouncementService = (function(superClass) {\n extend(LiveAnnouncementService, superClass);\n\n function LiveAnnouncementService() {\n this.open = false;\n this.title = \"\";\n this.desc = \"\";\n }\n\n LiveAnnouncementService.prototype.show = function(title, desc) {\n this.open = true;\n this.title = title;\n return this.desc = desc;\n };\n\n return LiveAnnouncementService;\n\n })(taiga.Service);\n\n angular.module(\"taigaComponents\").service(\"tgLiveAnnouncementService\", LiveAnnouncementService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-logo-big-src.directive.coffee\n */\n\n(function() {\n var ProjectLogoBigSrcDirective;\n\n ProjectLogoBigSrcDirective = function(projectLogoService) {\n var link;\n link = function(scope, el, attrs) {\n return scope.$watch('project', function(project) {\n var logo, projectLogo;\n project = Immutable.fromJS(project);\n if (!project) {\n return;\n }\n projectLogo = project.get('logo_big_url');\n if (projectLogo) {\n el.attr('src', projectLogo);\n return el.css('background', \"\");\n } else {\n logo = projectLogoService.getDefaultProjectLogo(project.get('slug'), project.get('id'));\n el.attr('src', logo.src);\n return el.css('background', logo.color);\n }\n });\n };\n return {\n link: link,\n scope: {\n project: \"=tgProjectLogoBigSrc\"\n }\n };\n };\n\n ProjectLogoBigSrcDirective.$inject = [\"tgProjectLogoService\"];\n\n angular.module(\"taigaComponents\").directive(\"tgProjectLogoBigSrc\", ProjectLogoBigSrcDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-logo-small-src.directive.coffee\n */\n\n(function() {\n var ProjectLogoSmallSrcDirective;\n\n ProjectLogoSmallSrcDirective = function(projectLogoService) {\n var link;\n link = function(scope, el, attrs) {\n return scope.$watch('project', function(project) {\n var logo, projectLogo;\n project = Immutable.fromJS(project);\n if (!project) {\n return;\n }\n projectLogo = project.get('logo_small_url');\n if (projectLogo) {\n el.attr('src', projectLogo);\n return el.css('background', \"\");\n } else {\n logo = projectLogoService.getDefaultProjectLogo(project.get('slug'), project.get('id'));\n el.attr('src', logo.src);\n return el.css('background', logo.color);\n }\n });\n };\n return {\n link: link,\n scope: {\n project: \"=tgProjectLogoSmallSrc\"\n }\n };\n };\n\n ProjectLogoSmallSrcDirective.$inject = [\"tgProjectLogoService\"];\n\n angular.module(\"taigaComponents\").directive(\"tgProjectLogoSmallSrc\", ProjectLogoSmallSrcDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-menu.controller.coffee\n */\n\n(function() {\n var ProjectMenuController;\n\n ProjectMenuController = (function() {\n ProjectMenuController.$inject = [\"tgProjectService\", \"tgLightboxFactory\"];\n\n function ProjectMenuController(projectService, lightboxFactory) {\n this.projectService = projectService;\n this.lightboxFactory = lightboxFactory;\n this.project = null;\n this.menu = Immutable.Map();\n }\n\n ProjectMenuController.prototype.show = function() {\n this.project = this.projectService.project;\n this.active = this._getActiveSection();\n this._setVideoConference();\n return this._setMenuPermissions();\n };\n\n ProjectMenuController.prototype.hide = function() {\n this.project = null;\n return this.menu = {};\n };\n\n ProjectMenuController.prototype.search = function() {\n return this.lightboxFactory.create(\"tg-search-box\", {\n \"class\": \"lightbox lightbox-search\"\n });\n };\n\n ProjectMenuController.prototype._setVideoConference = function() {\n var videoconferenceUrl;\n videoconferenceUrl = this._videoConferenceUrl();\n if (videoconferenceUrl) {\n return this.project = this.project.set(\"videoconferenceUrl\", videoconferenceUrl);\n }\n };\n\n ProjectMenuController.prototype._setMenuPermissions = function() {\n this.menu = Immutable.Map({\n backlog: false,\n kanban: false,\n issues: false,\n wiki: false\n });\n if (this.project.get(\"is_backlog_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_us\") !== -1) {\n this.menu = this.menu.set(\"backlog\", true);\n }\n if (this.project.get(\"is_kanban_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_us\") !== -1) {\n this.menu = this.menu.set(\"kanban\", true);\n }\n if (this.project.get(\"is_issues_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_issues\") !== -1) {\n this.menu = this.menu.set(\"issues\", true);\n }\n if (this.project.get(\"is_wiki_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_wiki_pages\") !== -1) {\n return this.menu = this.menu.set(\"wiki\", true);\n }\n };\n\n ProjectMenuController.prototype._getActiveSection = function() {\n var indexBacklog, indexKanban, oldSectionName, sectionName, sectionsBreadcrumb;\n sectionName = this.projectService.section;\n sectionsBreadcrumb = this.projectService.sectionsBreadcrumb;\n indexBacklog = sectionsBreadcrumb.lastIndexOf(\"backlog\");\n indexKanban = sectionsBreadcrumb.lastIndexOf(\"kanban\");\n if (indexBacklog !== -1 || indexKanban !== -1) {\n if (indexKanban === -1 || indexBacklog > indexKanban) {\n oldSectionName = \"backlog\";\n } else {\n oldSectionName = \"kanban\";\n }\n }\n if (sectionName === \"backlog-kanban\") {\n if (oldSectionName === \"backlog\" || oldSectionName === \"kanban\") {\n sectionName = oldSectionName;\n } else if (this.project.get(\"is_backlog_activated\") && !this.project.get(\"is_kanban_activated\")) {\n sectionName = \"backlog\";\n } else if (!this.project.get(\"is_backlog_activated\") && this.project.get(\"is_kanban_activated\")) {\n sectionName = \"kanban\";\n }\n }\n return sectionName;\n };\n\n ProjectMenuController.prototype._videoConferenceUrl = function() {\n var baseUrl, url;\n if (this.project.get(\"videoconferences\") === \"appear-in\") {\n baseUrl = \"https://appear.in/\";\n } else if (this.project.get(\"videoconferences\") === \"talky\") {\n baseUrl = \"https://talky.io/\";\n } else if (this.project.get(\"videoconferences\") === \"jitsi\") {\n baseUrl = \"https://meet.jit.si/\";\n } else if (this.project.get(\"videoconferences\") === \"custom\") {\n return this.project.get(\"videoconferences_extra_data\");\n } else {\n return \"\";\n }\n if (this.project.get(\"videoconferences_extra_data\")) {\n url = this.project.get(\"slug\") + \"-\" + taiga.slugify(this.project.get(\"videoconferences_extra_data\"));\n } else {\n url = this.project.get(\"slug\");\n }\n if (this.project.get(\"videoconferences\") === \"jitsi\") {\n url = url.replace(/-/g, \"\");\n }\n return baseUrl + url;\n };\n\n return ProjectMenuController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"ProjectMenu\", ProjectMenuController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-menu.directive.coffee\n */\n\n(function() {\n var ProjectMenuDirective, taiga;\n\n taiga = this.taiga;\n\n ProjectMenuDirective = function(projectService, lightboxFactory) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var projectChange;\n projectChange = function() {\n if (projectService.project) {\n return ctrl.show();\n } else {\n return ctrl.hide();\n }\n };\n scope.$watch((function() {\n return projectService.project;\n }), projectChange);\n scope.vm.fixed = false;\n return $(window).on(\"scroll\", function() {\n var position;\n position = $(window).scrollTop();\n if (position > 100 && scope.vm.fixed === false) {\n scope.vm.fixed = true;\n return scope.$digest();\n } else if (position < 100 && scope.vm.fixed === true) {\n scope.vm.fixed = false;\n return scope.$digest();\n }\n });\n };\n return {\n scope: {},\n controller: \"ProjectMenu\",\n controllerAs: \"vm\",\n templateUrl: \"components/project-menu/project-menu.html\",\n link: link\n };\n };\n\n ProjectMenuDirective.$inject = [\"tgProjectService\", \"tgLightboxFactory\"];\n\n angular.module(\"taigaComponents\").directive(\"tgProjectMenu\", ProjectMenuDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/components/terms-of-service-and-privacy-policy-notice/terms-of-service-and-privacy-policy-notice.directive.coffee\n */\n\n(function() {\n var TermsOfServiceAndPrivacyPolicyNoticeDirective;\n\n TermsOfServiceAndPrivacyPolicyNoticeDirective = function($config) {\n var link;\n link = function(scope, el, attrs) {\n scope.privacyPolicyUrl = $config.get(\"privacyPolicyUrl\");\n return scope.termsOfServiceUrl = $config.get(\"termsOfServiceUrl\");\n };\n return {\n restrict: \"AE\",\n scope: {},\n link: link,\n templateUrl: \"components/terms-of-service-and-privacy-policy-notice/terms-of-service-and-privacy-policy-notice.html\"\n };\n };\n\n angular.module(\"taigaComponents\").directive(\"tgTermsOfServiceAndPrivacyPolicyNotice\", [\"$tgConfig\", TermsOfServiceAndPrivacyPolicyNoticeDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: vote-button.controller.coffee\n */\n\n(function() {\n var VoteButtonController;\n\n VoteButtonController = (function() {\n VoteButtonController.$inject = [\"tgCurrentUserService\"];\n\n function VoteButtonController(currentUserService) {\n this.currentUserService = currentUserService;\n this.user = this.currentUserService.getUser();\n this.isMouseOver = false;\n this.loading = false;\n }\n\n VoteButtonController.prototype.showTextWhenMouseIsOver = function() {\n return this.isMouseOver = true;\n };\n\n VoteButtonController.prototype.showTextWhenMouseIsLeave = function() {\n return this.isMouseOver = false;\n };\n\n VoteButtonController.prototype.toggleVote = function() {\n var promise;\n this.loading = true;\n if (!this.item.is_voter) {\n promise = this._upvote();\n } else {\n promise = this._downvote();\n }\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n return promise;\n };\n\n VoteButtonController.prototype._upvote = function() {\n return this.onUpvote().then((function(_this) {\n return function() {\n return _this.showTextWhenMouseIsLeave();\n };\n })(this));\n };\n\n VoteButtonController.prototype._downvote = function() {\n return this.onDownvote();\n };\n\n return VoteButtonController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"VoteButton\", VoteButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: vote-button.directive.coffee\n */\n\n(function() {\n var VoteButtonDirective;\n\n VoteButtonDirective = function() {\n return {\n scope: {},\n controller: \"VoteButton\",\n bindToController: {\n item: \"=\",\n onUpvote: \"=\",\n onDownvote: \"=\"\n },\n controllerAs: \"vm\",\n templateUrl: \"components/vote-button/vote-button.html\"\n };\n };\n\n angular.module(\"taigaComponents\").directive(\"tgVoteButton\", VoteButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-button.controller.coffee\n */\n\n(function() {\n var WatchButtonController;\n\n WatchButtonController = (function() {\n WatchButtonController.$inject = [\"tgCurrentUserService\", \"$rootScope\"];\n\n function WatchButtonController(currentUserService, rootScope) {\n this.currentUserService = currentUserService;\n this.rootScope = rootScope;\n this.user = this.currentUserService.getUser();\n this.isMouseOver = false;\n this.loading = false;\n }\n\n WatchButtonController.prototype.showTextWhenMouseIsOver = function() {\n return this.isMouseOver = true;\n };\n\n WatchButtonController.prototype.showTextWhenMouseIsLeave = function() {\n return this.isMouseOver = false;\n };\n\n WatchButtonController.prototype.openWatchers = function() {\n return this.rootScope.$broadcast(\"watcher:add\", this.item);\n };\n\n WatchButtonController.prototype.getPerms = function() {\n var name, perms;\n if (!this.item) {\n return \"\";\n }\n name = this.item._name;\n perms = {\n userstories: 'modify_us',\n issues: 'modify_issue',\n tasks: 'modify_task'\n };\n return perms[name];\n };\n\n WatchButtonController.prototype.toggleWatch = function() {\n var promise;\n this.loading = true;\n if (!this.item.is_watcher) {\n promise = this._watch();\n } else {\n promise = this._unwatch();\n }\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n return promise;\n };\n\n WatchButtonController.prototype._watch = function() {\n return this.onWatch().then((function(_this) {\n return function() {\n return _this.showTextWhenMouseIsLeave();\n };\n })(this));\n };\n\n WatchButtonController.prototype._unwatch = function() {\n return this.onUnwatch();\n };\n\n return WatchButtonController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"WatchButton\", WatchButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-button.directive.coffee\n */\n\n(function() {\n var WatchButtonDirective;\n\n WatchButtonDirective = function() {\n return {\n scope: {},\n controller: \"WatchButton\",\n bindToController: {\n item: \"=\",\n onWatch: \"=\",\n onUnwatch: \"=\"\n },\n controllerAs: \"vm\",\n templateUrl: function(item, attributes) {\n return \"components/watch-button/watch-button-\" + attributes.environment + \".html\";\n }\n };\n };\n\n angular.module(\"taigaComponents\").directive(\"tgWatchButton\", WatchButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-home-order-by.controller.coffee\n */\n\n(function() {\n var DiscoverHomeOrderByController;\n\n DiscoverHomeOrderByController = (function() {\n DiscoverHomeOrderByController.$inject = ['$translate'];\n\n function DiscoverHomeOrderByController(translate) {\n this.translate = translate;\n this.is_open = false;\n this.texts = {\n week: this.translate.instant('DISCOVER.FILTERS.WEEK'),\n month: this.translate.instant('DISCOVER.FILTERS.MONTH'),\n year: this.translate.instant('DISCOVER.FILTERS.YEAR'),\n all: this.translate.instant('DISCOVER.FILTERS.ALL_TIME')\n };\n }\n\n DiscoverHomeOrderByController.prototype.currentText = function() {\n return this.texts[this.currentOrderBy];\n };\n\n DiscoverHomeOrderByController.prototype.open = function() {\n return this.is_open = true;\n };\n\n DiscoverHomeOrderByController.prototype.close = function() {\n return this.is_open = false;\n };\n\n DiscoverHomeOrderByController.prototype.orderBy = function(type) {\n this.currentOrderBy = type;\n this.is_open = false;\n return this.onChange({\n orderBy: this.currentOrderBy\n });\n };\n\n return DiscoverHomeOrderByController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverHomeOrderBy\", DiscoverHomeOrderByController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-home-order-by.directive.coffee\n */\n\n(function() {\n var DiscoverHomeOrderByDirective;\n\n DiscoverHomeOrderByDirective = function() {\n var link;\n link = function(scope, el, attrs) {};\n return {\n controller: \"DiscoverHomeOrderBy\",\n controllerAs: \"vm\",\n bindToController: true,\n templateUrl: \"discover/components/discover-home-order-by/discover-home-order-by.html\",\n scope: {\n currentOrderBy: \"=orderBy\",\n onChange: \"&\"\n },\n link: link\n };\n };\n\n DiscoverHomeOrderByDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgDiscoverHomeOrderBy\", DiscoverHomeOrderByDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search-bar.controller.coffee\n */\n\n(function() {\n var DiscoverSearchBarController;\n\n DiscoverSearchBarController = (function() {\n DiscoverSearchBarController.$inject = ['tgDiscoverProjectsService'];\n\n function DiscoverSearchBarController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, 'projects', (function(_this) {\n return function() {\n return _this.discoverProjectsService.projectsCount;\n };\n })(this));\n this.discoverProjectsService.fetchStats();\n }\n\n DiscoverSearchBarController.prototype.selectFilter = function(filter) {\n return this.onChange({\n filter: filter,\n q: this.q\n });\n };\n\n DiscoverSearchBarController.prototype.submitFilter = function() {\n return this.onChange({\n filter: this.filter,\n q: this.q\n });\n };\n\n return DiscoverSearchBarController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverSearchBar\", DiscoverSearchBarController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search.directive.coffee\n */\n\n(function() {\n var DiscoverSearchBarDirective;\n\n DiscoverSearchBarDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n controller: \"DiscoverSearchBar\",\n controllerAs: \"vm\",\n templateUrl: 'discover/components/discover-search-bar/discover-search-bar.html',\n bindToController: true,\n scope: {\n q: \"=\",\n filter: \"=\",\n onChange: \"&\"\n },\n link: link\n };\n };\n\n DiscoverSearchBarDirective.$inject = [];\n\n angular.module('taigaDiscover').directive('tgDiscoverSearchBar', DiscoverSearchBarDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search-list-header.controller.coffee\n */\n\n(function() {\n var DiscoverSearchListHeaderController;\n\n DiscoverSearchListHeaderController = (function() {\n DiscoverSearchListHeaderController.$inject = [];\n\n function DiscoverSearchListHeaderController() {\n this.like_is_open = this.orderBy.indexOf('-total_fans') === 0;\n this.activity_is_open = this.orderBy.indexOf('-total_activity') === 0;\n }\n\n DiscoverSearchListHeaderController.prototype.openLike = function() {\n this.like_is_open = true;\n this.activity_is_open = false;\n return this.setOrderBy('-total_fans_last_week');\n };\n\n DiscoverSearchListHeaderController.prototype.openActivity = function() {\n this.activity_is_open = true;\n this.like_is_open = false;\n return this.setOrderBy('-total_activity_last_week');\n };\n\n DiscoverSearchListHeaderController.prototype.setOrderBy = function(type) {\n if (type == null) {\n type = '';\n }\n if (!type) {\n this.like_is_open = false;\n this.activity_is_open = false;\n }\n return this.onChange({\n orderBy: type\n });\n };\n\n return DiscoverSearchListHeaderController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverSearchListHeader\", DiscoverSearchListHeaderController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search-list-header.directive.coffee\n */\n\n(function() {\n var DiscoverSearchListHeaderDirective;\n\n DiscoverSearchListHeaderDirective = function() {\n var link;\n link = function(scope, el, attrs) {};\n return {\n controller: \"DiscoverSearchListHeader\",\n controllerAs: \"vm\",\n bindToController: true,\n templateUrl: \"discover/components/discover-search-list-header/discover-search-list-header.html\",\n scope: {\n onChange: \"&\",\n orderBy: \"=\"\n },\n link: link\n };\n };\n\n DiscoverSearchListHeaderDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgDiscoverSearchListHeader\", DiscoverSearchListHeaderDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: featured-projects.controller.coffee\n */\n\n(function() {\n var FeaturedProjectsController;\n\n FeaturedProjectsController = (function() {\n FeaturedProjectsController.$inject = [\"tgDiscoverProjectsService\"];\n\n function FeaturedProjectsController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, \"featured\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.featured;\n };\n })(this));\n this.discoverProjectsService.fetchFeatured();\n }\n\n return FeaturedProjectsController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"FeaturedProjects\", FeaturedProjectsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: featured-projects.directive.coffee\n */\n\n(function() {\n var FeaturedProjectsDirective;\n\n FeaturedProjectsDirective = function() {\n var link;\n link = function(scope, el, attrs) {};\n return {\n controller: \"FeaturedProjects\",\n controllerAs: \"vm\",\n templateUrl: \"discover/components/featured-projects/featured-projects.html\",\n scope: {},\n link: link\n };\n };\n\n FeaturedProjectsDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgFeaturedProjects\", FeaturedProjectsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: highlighted.directive.coffee\n */\n\n(function() {\n var HighlightedDirective;\n\n HighlightedDirective = function() {\n return {\n templateUrl: \"discover/components/highlighted/highlighted.html\",\n scope: {\n loading: \"=\",\n highlighted: \"=\",\n orderBy: \"=\"\n }\n };\n };\n\n HighlightedDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgHighlighted\", HighlightedDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: most-active.controller.coffee\n */\n\n(function() {\n var MostActiveController;\n\n MostActiveController = (function() {\n MostActiveController.$inject = [\"tgDiscoverProjectsService\"];\n\n function MostActiveController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, \"highlighted\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.mostActive;\n };\n })(this));\n this.currentOrderBy = 'week';\n this.order_by = this.getOrderBy();\n }\n\n MostActiveController.prototype.fetch = function() {\n this.loading = true;\n this.order_by = this.getOrderBy();\n return this.discoverProjectsService.fetchMostActive({\n order_by: this.order_by\n }).then((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n MostActiveController.prototype.orderBy = function(type) {\n this.currentOrderBy = type;\n return this.fetch();\n };\n\n MostActiveController.prototype.getOrderBy = function(type) {\n if (this.currentOrderBy === 'all') {\n return '-total_activity';\n } else {\n return '-total_activity_last_' + this.currentOrderBy;\n }\n };\n\n return MostActiveController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"MostActive\", MostActiveController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: most-active.directive.coffee\n */\n\n(function() {\n var MostActiveDirective;\n\n MostActiveDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return ctrl.fetch();\n };\n return {\n controller: \"MostActive\",\n controllerAs: \"vm\",\n templateUrl: \"discover/components/most-active/most-active.html\",\n scope: {},\n link: link\n };\n };\n\n MostActiveDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgMostActive\", MostActiveDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: msot-liked.controller.coffee\n */\n\n(function() {\n var MostLikedController;\n\n MostLikedController = (function() {\n MostLikedController.$inject = [\"tgDiscoverProjectsService\"];\n\n function MostLikedController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, \"highlighted\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.mostLiked;\n };\n })(this));\n this.currentOrderBy = 'week';\n this.order_by = this.getOrderBy();\n }\n\n MostLikedController.prototype.fetch = function() {\n this.loading = true;\n this.order_by = this.getOrderBy();\n return this.discoverProjectsService.fetchMostLiked({\n order_by: this.order_by\n }).then((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n MostLikedController.prototype.orderBy = function(type) {\n this.currentOrderBy = type;\n return this.fetch();\n };\n\n MostLikedController.prototype.getOrderBy = function() {\n if (this.currentOrderBy === 'all') {\n return '-total_fans';\n } else {\n return '-total_fans_last_' + this.currentOrderBy;\n }\n };\n\n return MostLikedController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"MostLiked\", MostLikedController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: most-liked.directive.coffee\n */\n\n(function() {\n var MostLikedDirective;\n\n MostLikedDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return ctrl.fetch();\n };\n return {\n controller: \"MostLiked\",\n controllerAs: \"vm\",\n templateUrl: \"discover/components/most-liked/most-liked.html\",\n scope: {},\n link: link\n };\n };\n\n MostLikedDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgMostLiked\", MostLikedDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-home.controller.coffee\n */\n\n(function() {\n var DiscoverHomeController;\n\n DiscoverHomeController = (function() {\n DiscoverHomeController.$inject = ['$tgLocation', '$tgNavUrls', 'tgAppMetaService', '$translate'];\n\n function DiscoverHomeController(location, navUrls, appMetaService, translate) {\n var description, title;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n title = this.translate.instant(\"DISCOVER.PAGE_TITLE\");\n description = this.translate.instant(\"DISCOVER.PAGE_DESCRIPTION\");\n this.appMetaService.setAll(title, description);\n }\n\n DiscoverHomeController.prototype.onSubmit = function(q) {\n var url;\n url = this.navUrls.resolve('discover-search');\n return this.location.search('text', q).path(url);\n };\n\n return DiscoverHomeController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverHome\", DiscoverHomeController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search.controller.coffee\n */\n\n(function() {\n var DiscoverSearchController;\n\n DiscoverSearchController = (function() {\n DiscoverSearchController.$inject = ['$routeParams', 'tgDiscoverProjectsService', '$route', 'tgAppMetaService', '$translate'];\n\n function DiscoverSearchController(routeParams, discoverProjectsService, route, appMetaService, translate) {\n var description, title;\n this.routeParams = routeParams;\n this.discoverProjectsService = discoverProjectsService;\n this.route = route;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.page = 1;\n taiga.defineImmutableProperty(this, \"searchResult\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.searchResult;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"nextSearchPage\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.nextSearchPage;\n };\n })(this));\n this.q = this.routeParams.text;\n this.filter = this.routeParams.filter || 'all';\n this.orderBy = this.routeParams['order_by'] || '';\n this.loadingGlobal = false;\n this.loadingList = false;\n this.loadingPagination = false;\n title = this.translate.instant(\"DISCOVER.SEARCH.PAGE_TITLE\");\n description = this.translate.instant(\"DISCOVER.SEARCH.PAGE_DESCRIPTION\");\n this.appMetaService.setAll(title, description);\n }\n\n DiscoverSearchController.prototype.fetch = function() {\n this.page = 1;\n this.discoverProjectsService.resetSearchList();\n return this.search();\n };\n\n DiscoverSearchController.prototype.fetchByGlobalSearch = function() {\n if (this.loadingGlobal) {\n return;\n }\n this.loadingGlobal = true;\n return this.fetch().then((function(_this) {\n return function() {\n return _this.loadingGlobal = false;\n };\n })(this));\n };\n\n DiscoverSearchController.prototype.fetchByOrderBy = function() {\n if (this.loadingList) {\n return;\n }\n this.loadingList = true;\n return this.fetch().then((function(_this) {\n return function() {\n return _this.loadingList = false;\n };\n })(this));\n };\n\n DiscoverSearchController.prototype.showMore = function() {\n if (this.loadingPagination) {\n return;\n }\n this.loadingPagination = true;\n this.page++;\n return this.search().then((function(_this) {\n return function() {\n return _this.loadingPagination = false;\n };\n })(this));\n };\n\n DiscoverSearchController.prototype.search = function() {\n var filter, params;\n filter = this.getFilter();\n params = {\n page: this.page,\n q: this.q,\n order_by: this.orderBy\n };\n _.assign(params, filter);\n return this.discoverProjectsService.fetchSearch(params);\n };\n\n DiscoverSearchController.prototype.getFilter = function() {\n if (this.filter === 'people') {\n return {\n is_looking_for_people: true\n };\n } else if (this.filter === 'scrum') {\n return {\n is_backlog_activated: true\n };\n } else if (this.filter === 'kanban') {\n return {\n is_kanban_activated: true\n };\n }\n return {};\n };\n\n DiscoverSearchController.prototype.onChangeFilter = function(filter, q) {\n this.filter = filter;\n this.q = q;\n this.route.updateParams({\n filter: this.filter,\n text: this.q\n });\n return this.fetchByGlobalSearch();\n };\n\n DiscoverSearchController.prototype.onChangeOrder = function(orderBy) {\n this.orderBy = orderBy;\n this.route.updateParams({\n order_by: orderBy\n });\n return this.fetchByOrderBy();\n };\n\n return DiscoverSearchController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverSearch\", DiscoverSearchController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search.directive.coffee\n */\n\n(function() {\n var DiscoverSearchDirective;\n\n DiscoverSearchDirective = function() {\n var link;\n link = function(scope, element, attrs, ctrl) {\n return ctrl.fetch();\n };\n return {\n controller: \"DiscoverSearch\",\n controllerAs: \"vm\",\n link: link\n };\n };\n\n DiscoverSearchDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgDiscoverSearch\", DiscoverSearchDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-projects.service.coffee\n */\n\n(function() {\n var DiscoverProjectsService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n DiscoverProjectsService = (function(superClass) {\n var _discoverParams;\n\n extend(DiscoverProjectsService, superClass);\n\n DiscoverProjectsService.$inject = [\"tgResources\", \"tgProjectsService\"];\n\n _discoverParams = {\n discover_mode: true\n };\n\n function DiscoverProjectsService(rs, projectsService) {\n this.rs = rs;\n this.projectsService = projectsService;\n this._mostLiked = Immutable.List();\n this._mostActive = Immutable.List();\n this._featured = Immutable.List();\n this._searchResult = Immutable.List();\n this._projectsCount = 0;\n this.decorate = this.projectsService._decorate.bind(this.projectsService);\n taiga.defineImmutableProperty(this, \"mostLiked\", (function(_this) {\n return function() {\n return _this._mostLiked;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"mostActive\", (function(_this) {\n return function() {\n return _this._mostActive;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"featured\", (function(_this) {\n return function() {\n return _this._featured;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"searchResult\", (function(_this) {\n return function() {\n return _this._searchResult;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"nextSearchPage\", (function(_this) {\n return function() {\n return _this._nextSearchPage;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"projectsCount\", (function(_this) {\n return function() {\n return _this._projectsCount;\n };\n })(this));\n }\n\n DiscoverProjectsService.prototype.fetchMostLiked = function(params) {\n var _params;\n _params = _.extend({}, _discoverParams, params);\n return this.rs.projects.getProjects(_params, false).then((function(_this) {\n return function(result) {\n var data, projects;\n data = result.data.slice(0, 5);\n projects = Immutable.fromJS(data);\n projects = projects.map(_this.decorate);\n return _this._mostLiked = projects;\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.fetchMostActive = function(params) {\n var _params;\n _params = _.extend({}, _discoverParams, params);\n return this.rs.projects.getProjects(_params, false).then((function(_this) {\n return function(result) {\n var data, projects;\n data = result.data.slice(0, 5);\n projects = Immutable.fromJS(data);\n projects = projects.map(_this.decorate);\n return _this._mostActive = projects;\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.fetchFeatured = function() {\n var _params;\n _params = _.extend({}, _discoverParams);\n _params.is_featured = true;\n return this.rs.projects.getProjects(_params, false).then((function(_this) {\n return function(result) {\n var data, projects;\n data = result.data.slice(0, 4);\n projects = Immutable.fromJS(data);\n projects = projects.map(_this.decorate);\n return _this._featured = projects;\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.resetSearchList = function() {\n return this._searchResult = Immutable.List();\n };\n\n DiscoverProjectsService.prototype.fetchStats = function() {\n return this.rs.stats.discover().then((function(_this) {\n return function(discover) {\n return _this._projectsCount = discover.getIn(['projects', 'total']);\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.fetchSearch = function(params) {\n var _params;\n _params = _.extend({}, _discoverParams, params);\n return this.rs.projects.getProjects(_params).then((function(_this) {\n return function(result) {\n var projects;\n _this._nextSearchPage = !!result.headers('X-Pagination-Next');\n projects = Immutable.fromJS(result.data);\n projects = projects.map(_this.decorate);\n return _this._searchResult = _this._searchResult.concat(projects);\n };\n })(this));\n };\n\n return DiscoverProjectsService;\n\n })(taiga.Service);\n\n angular.module(\"taigaDiscover\").service(\"tgDiscoverProjectsService\", DiscoverProjectsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-app.controller.coffee\n */\n\n(function() {\n var ExternalAppController, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n ExternalAppController = (function(superClass) {\n extend(ExternalAppController, superClass);\n\n ExternalAppController.$inject = [\"$routeParams\", \"tgExternalAppsService\", \"$window\", \"tgCurrentUserService\", \"$location\", \"$tgNavUrls\", \"tgXhrErrorService\", \"tgLoader\"];\n\n function ExternalAppController(routeParams, externalAppsService, window, currentUserService, location, navUrls, xhrError, loader) {\n var loginUrl, nextUrl;\n this.routeParams = routeParams;\n this.externalAppsService = externalAppsService;\n this.window = window;\n this.currentUserService = currentUserService;\n this.location = location;\n this.navUrls = navUrls;\n this.xhrError = xhrError;\n this.loader = loader;\n this.createApplicationToken = bind(this.createApplicationToken, this);\n this._getApplicationToken = bind(this._getApplicationToken, this);\n this._redirect = bind(this._redirect, this);\n this.loader.start(false);\n this._applicationId = this.routeParams.application;\n this._state = this.routeParams.state;\n this._getApplicationToken();\n this._user = this.currentUserService.getUser();\n this._application = null;\n nextUrl = encodeURIComponent(this.location.url());\n loginUrl = this.navUrls.resolve(\"login\");\n this.loginWithAnotherUserUrl = loginUrl + \"?next=\" + nextUrl;\n taiga.defineImmutableProperty(this, \"user\", (function(_this) {\n return function() {\n return _this._user;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"application\", (function(_this) {\n return function() {\n return _this._application;\n };\n })(this));\n }\n\n ExternalAppController.prototype._redirect = function(applicationToken) {\n var nextUrl;\n nextUrl = applicationToken.get(\"next_url\");\n return this.window.open(nextUrl, \"_self\");\n };\n\n ExternalAppController.prototype._getApplicationToken = function() {\n return this.externalAppsService.getApplicationToken(this._applicationId, this._state).then((function(_this) {\n return function(data) {\n _this._application = data.get(\"application\");\n if (data.get(\"auth_code\")) {\n return _this._redirect(data);\n } else {\n return _this.loader.pageLoaded();\n }\n };\n })(this))[\"catch\"]((function(_this) {\n return function(xhr) {\n _this.loader.pageLoaded();\n return _this.xhrError.response(xhr);\n };\n })(this));\n };\n\n ExternalAppController.prototype.cancel = function() {\n return this.window.history.back();\n };\n\n ExternalAppController.prototype.createApplicationToken = function() {\n return this.externalAppsService.authorizeApplicationToken(this._applicationId, this._state).then((function(_this) {\n return function(data) {\n return _this._redirect(data);\n };\n })(this))[\"catch\"]((function(_this) {\n return function(xhr) {\n return _this.xhrError.response(xhr);\n };\n })(this));\n };\n\n return ExternalAppController;\n\n })(taiga.Controller);\n\n angular.module(\"taigaExternalApps\").controller(\"ExternalApp\", ExternalAppController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-app.service.coffee\n */\n\n(function() {\n var ExternalAppsService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n ExternalAppsService = (function(superClass) {\n extend(ExternalAppsService, superClass);\n\n ExternalAppsService.$inject = [\"tgResources\"];\n\n function ExternalAppsService(rs) {\n this.rs = rs;\n }\n\n ExternalAppsService.prototype.getApplicationToken = function(applicationId, state) {\n return this.rs.externalapps.getApplicationToken(applicationId, state);\n };\n\n ExternalAppsService.prototype.authorizeApplicationToken = function(applicationId, state) {\n return this.rs.externalapps.authorizeApplicationToken(applicationId, state);\n };\n\n return ExternalAppsService;\n\n })(taiga.Service);\n\n angular.module(\"taigaExternalApps\").service(\"tgExternalAppsService\", ExternalAppsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: feedback.service.coffee\n */\n\n(function() {\n var FeedbackService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n FeedbackService = (function(superClass) {\n extend(FeedbackService, superClass);\n\n FeedbackService.$inject = [\"tgLightboxFactory\"];\n\n function FeedbackService(lightboxFactory) {\n this.lightboxFactory = lightboxFactory;\n }\n\n FeedbackService.prototype.sendFeedback = function() {\n return this.lightboxFactory.create(\"tg-lb-feedback\", {\n \"class\": \"lightbox lightbox-feedback lightbox-generic-form\"\n });\n };\n\n return FeedbackService;\n\n })(taiga.Service);\n\n angular.module(\"taigaFeedback\").service(\"tgFeedbackService\", FeedbackService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: duty.directive.coffee\n */\n\n(function() {\n var DutyDirective;\n\n DutyDirective = function(navurls, $translate) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n scope.vm.duty = scope.duty;\n return scope.vm.getDutyType = function() {\n if (scope.vm.duty) {\n if (scope.vm.duty.get('_name') === \"userstories\") {\n return $translate.instant(\"COMMON.USER_STORY\");\n }\n if (scope.vm.duty.get('_name') === \"tasks\") {\n return $translate.instant(\"COMMON.TASK\");\n }\n if (scope.vm.duty.get('_name') === \"issues\") {\n return $translate.instant(\"COMMON.ISSUE\");\n }\n }\n };\n };\n return {\n templateUrl: \"home/duties/duty.html\",\n scope: {\n \"duty\": \"=tgDuty\"\n },\n link: link\n };\n };\n\n DutyDirective.$inject = [\"$tgNavUrls\", \"$translate\"];\n\n angular.module(\"taigaHome\").directive(\"tgDuty\", DutyDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home.controller.coffee\n */\n\n(function() {\n var HomeController;\n\n HomeController = (function() {\n HomeController.$inject = [\"tgCurrentUserService\", \"$location\", \"$tgNavUrls\"];\n\n function HomeController(currentUserService, location, navUrls) {\n this.currentUserService = currentUserService;\n this.location = location;\n this.navUrls = navUrls;\n if (!this.currentUserService.getUser()) {\n this.location.path(this.navUrls.resolve(\"discover\"));\n }\n }\n\n return HomeController;\n\n })();\n\n angular.module(\"taigaHome\").controller(\"Home\", HomeController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home.service.coffee\n */\n\n(function() {\n var HomeService, groupBy,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n groupBy = this.taiga.groupBy;\n\n HomeService = (function(superClass) {\n extend(HomeService, superClass);\n\n HomeService.$inject = [\"$tgNavUrls\", \"tgResources\", \"tgProjectsService\"];\n\n function HomeService(navurls, rs, projectsService) {\n this.navurls = navurls;\n this.rs = rs;\n this.projectsService = projectsService;\n }\n\n HomeService.prototype._attachProjectInfoToWorkInProgress = function(workInProgress, projectsById) {\n var _attachProjectInfoToDuty, _duties, assignedTo, watching;\n _attachProjectInfoToDuty = (function(_this) {\n return function(duty, objType) {\n var ctx, project, url;\n project = projectsById.get(String(duty.get('project')));\n ctx = {\n project: project.get('slug'),\n ref: duty.get('ref')\n };\n url = _this.navurls.resolve(\"project-\" + objType + \"-detail\", ctx);\n duty = duty.set('url', url);\n duty = duty.set('projectName', project.get('name'));\n duty = duty.set('blockedProject', project.get('blocked_code'));\n duty = duty.set(\"_name\", objType);\n return duty;\n };\n })(this);\n assignedTo = workInProgress.get(\"assignedTo\");\n if (assignedTo.get(\"userStories\")) {\n _duties = assignedTo.get(\"userStories\").map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"userstories\");\n });\n assignedTo = assignedTo.set(\"userStories\", _duties);\n }\n if (assignedTo.get(\"tasks\")) {\n _duties = assignedTo.get(\"tasks\").map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"tasks\");\n });\n assignedTo = assignedTo.set(\"tasks\", _duties);\n }\n if (assignedTo.get(\"issues\")) {\n _duties = assignedTo.get(\"issues\").map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"issues\");\n });\n assignedTo = assignedTo.set(\"issues\", _duties);\n }\n watching = workInProgress.get(\"watching\");\n if (watching.get(\"userStories\")) {\n _duties = watching.get(\"userStories\").filter(function(duty) {\n return !!projectsById.get(String(duty.get('project')));\n });\n _duties = _duties.map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"userstories\");\n });\n watching = watching.set(\"userStories\", _duties);\n }\n if (watching.get(\"tasks\")) {\n _duties = watching.get(\"tasks\").filter(function(duty) {\n return !!projectsById.get(String(duty.get('project')));\n });\n _duties = _duties.map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"tasks\");\n });\n watching = watching.set(\"tasks\", _duties);\n }\n if (watching.get(\"issues\")) {\n _duties = watching.get(\"issues\").filter(function(duty) {\n return !!projectsById.get(String(duty.get('project')));\n });\n _duties = _duties.map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"issues\");\n });\n watching = watching.set(\"issues\", _duties);\n }\n workInProgress = workInProgress.set(\"assignedTo\", assignedTo);\n return workInProgress = workInProgress.set(\"watching\", watching);\n };\n\n HomeService.prototype.getWorkInProgress = function(userId) {\n var assignedIssuesPromise, assignedTasksPromise, assignedTo, assignedUserStoriesPromise, params, params_us, projectsById, projectsPromise, watching, watchingIssuesPromise, watchingTasksPromise, watchingUserStoriesPromise, workInProgress;\n projectsById = Immutable.Map();\n projectsPromise = this.projectsService.getProjectsByUserId(userId).then(function(projects) {\n return projectsById = Immutable.fromJS(groupBy(projects.toJS(), function(p) {\n return p.id;\n }));\n });\n assignedTo = Immutable.Map();\n params = {\n status__is_closed: false,\n assigned_to: userId\n };\n params_us = {\n is_closed: false,\n assigned_to: userId\n };\n assignedUserStoriesPromise = this.rs.userstories.listInAllProjects(params_us).then(function(userstories) {\n return assignedTo = assignedTo.set(\"userStories\", userstories);\n });\n assignedTasksPromise = this.rs.tasks.listInAllProjects(params).then(function(tasks) {\n return assignedTo = assignedTo.set(\"tasks\", tasks);\n });\n assignedIssuesPromise = this.rs.issues.listInAllProjects(params).then(function(issues) {\n return assignedTo = assignedTo.set(\"issues\", issues);\n });\n params = {\n status__is_closed: false,\n watchers: userId\n };\n params_us = {\n is_closed: false,\n watchers: userId\n };\n watching = Immutable.Map();\n watchingUserStoriesPromise = this.rs.userstories.listInAllProjects(params_us).then(function(userstories) {\n return watching = watching.set(\"userStories\", userstories);\n });\n watchingTasksPromise = this.rs.tasks.listInAllProjects(params).then(function(tasks) {\n return watching = watching.set(\"tasks\", tasks);\n });\n watchingIssuesPromise = this.rs.issues.listInAllProjects(params).then(function(issues) {\n return watching = watching.set(\"issues\", issues);\n });\n workInProgress = Immutable.Map();\n return Promise.all([projectsPromise, assignedUserStoriesPromise, assignedTasksPromise, assignedIssuesPromise, watchingUserStoriesPromise, watchingTasksPromise, watchingIssuesPromise]).then((function(_this) {\n return function() {\n workInProgress = workInProgress.set(\"assignedTo\", assignedTo);\n workInProgress = workInProgress.set(\"watching\", watching);\n workInProgress = _this._attachProjectInfoToWorkInProgress(workInProgress, projectsById);\n return workInProgress;\n };\n })(this));\n };\n\n return HomeService;\n\n })(taiga.Service);\n\n angular.module(\"taigaHome\").service(\"tgHomeService\", HomeService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home-project-list.directive.coffee\n */\n\n(function() {\n var HomeProjectListDirective;\n\n HomeProjectListDirective = function(currentUserService, projectsService) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n taiga.defineImmutableProperty(scope.vm, \"projects\", function() {\n return currentUserService.projects.get(\"recents\");\n });\n return scope.vm.newProject = function() {\n return projectsService.newProject();\n };\n };\n directive = {\n templateUrl: \"home/projects/home-project-list.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n HomeProjectListDirective.$inject = [\"tgCurrentUserService\", \"tgProjectsService\"];\n\n angular.module(\"taigaHome\").directive(\"tgHomeProjectList\", HomeProjectListDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: working-on.controller.coffee\n */\n\n(function() {\n var WorkingOnController;\n\n WorkingOnController = (function() {\n WorkingOnController.$inject = [\"tgHomeService\"];\n\n function WorkingOnController(homeService) {\n this.homeService = homeService;\n this.assignedTo = Immutable.Map();\n this.watching = Immutable.Map();\n }\n\n WorkingOnController.prototype._setAssignedTo = function(workInProgress) {\n var issues, tasks, userStories;\n userStories = workInProgress.get(\"assignedTo\").get(\"userStories\");\n tasks = workInProgress.get(\"assignedTo\").get(\"tasks\");\n issues = workInProgress.get(\"assignedTo\").get(\"issues\");\n this.assignedTo = userStories.concat(tasks).concat(issues);\n if (this.assignedTo.size > 0) {\n return this.assignedTo = this.assignedTo.sortBy(function(elem) {\n return elem.get(\"modified_date\");\n }).reverse();\n }\n };\n\n WorkingOnController.prototype._setWatching = function(workInProgress) {\n var issues, tasks, userStories;\n userStories = workInProgress.get(\"watching\").get(\"userStories\");\n tasks = workInProgress.get(\"watching\").get(\"tasks\");\n issues = workInProgress.get(\"watching\").get(\"issues\");\n this.watching = userStories.concat(tasks).concat(issues);\n if (this.watching.size > 0) {\n return this.watching = this.watching.sortBy(function(elem) {\n return elem.get(\"modified_date\");\n }).reverse();\n }\n };\n\n WorkingOnController.prototype.getWorkInProgress = function(userId) {\n return this.homeService.getWorkInProgress(userId).then((function(_this) {\n return function(workInProgress) {\n _this._setAssignedTo(workInProgress);\n return _this._setWatching(workInProgress);\n };\n })(this));\n };\n\n return WorkingOnController;\n\n })();\n\n angular.module(\"taigaHome\").controller(\"WorkingOn\", WorkingOnController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: working-on.directive.coffee\n */\n\n(function() {\n var WorkingOnDirective;\n\n WorkingOnDirective = function(homeService, currentUserService) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var user, userId;\n user = currentUserService.getUser();\n if (user) {\n userId = user.get(\"id\");\n return ctrl.getWorkInProgress(userId);\n }\n };\n return {\n controller: \"WorkingOn\",\n controllerAs: \"vm\",\n templateUrl: \"home/working-on/working-on.html\",\n scope: {},\n link: link\n };\n };\n\n WorkingOnDirective.$inject = [\"tgHomeService\", \"tgCurrentUserService\"];\n\n angular.module(\"taigaHome\").directive(\"tgWorkingOn\", WorkingOnDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: dropdown-project-list.directive.coffee\n */\n\n(function() {\n var DropdownProjectListDirective;\n\n DropdownProjectListDirective = function(currentUserService, projectsService) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n taiga.defineImmutableProperty(scope.vm, \"projects\", function() {\n return currentUserService.projects.get(\"recents\");\n });\n return scope.vm.newProject = function() {\n return projectsService.newProject();\n };\n };\n directive = {\n templateUrl: \"navigation-bar/dropdown-project-list/dropdown-project-list.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n DropdownProjectListDirective.$inject = [\"tgCurrentUserService\", \"tgProjectsService\"];\n\n angular.module(\"taigaNavigationBar\").directive(\"tgDropdownProjectList\", DropdownProjectListDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: dropdown-user.directive.coffee\n */\n\n(function() {\n var DropdownUserDirective;\n\n DropdownUserDirective = function(authService, configService, locationService, navUrlsService, feedbackService, $rootScope) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n scope.vm.isFeedbackEnabled = configService.get(\"feedbackEnabled\");\n taiga.defineImmutableProperty(scope.vm, \"user\", function() {\n return authService.userData;\n });\n scope.vm.logout = function() {\n authService.logout();\n locationService.url(navUrlsService.resolve(\"discover\"));\n return locationService.search({});\n };\n scope.vm.sendFeedback = function() {\n return feedbackService.sendFeedback();\n };\n return scope.vm.userSettingsPlugins = _.filter($rootScope.userSettingsPlugins, {\n userMenu: true\n });\n };\n directive = {\n templateUrl: \"navigation-bar/dropdown-user/dropdown-user.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n DropdownUserDirective.$inject = [\"$tgAuth\", \"$tgConfig\", \"$tgLocation\", \"$tgNavUrls\", \"tgFeedbackService\", \"$rootScope\"];\n\n angular.module(\"taigaNavigationBar\").directive(\"tgDropdownUser\", DropdownUserDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: navigation-bar.directive.coffee\n */\n\n(function() {\n var NavigationBarDirective;\n\n NavigationBarDirective = function(currentUserService, navigationBarService, locationService, navUrlsService, config) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n taiga.defineImmutableProperty(scope.vm, \"projects\", function() {\n return currentUserService.projects.get(\"recents\");\n });\n taiga.defineImmutableProperty(scope.vm, \"isAuthenticated\", function() {\n return currentUserService.isAuthenticated();\n });\n taiga.defineImmutableProperty(scope.vm, \"isEnabledHeader\", function() {\n return navigationBarService.isEnabledHeader();\n });\n scope.vm.publicRegisterEnabled = config.get(\"publicRegisterEnabled\");\n scope.vm.login = function() {\n var nextUrl;\n nextUrl = encodeURIComponent(locationService.url());\n locationService.url(navUrlsService.resolve(\"login\"));\n return locationService.search({\n next: nextUrl\n });\n };\n scope.vm.register = function() {\n var nextUrl;\n nextUrl = encodeURIComponent(locationService.url());\n locationService.url(navUrlsService.resolve(\"register\"));\n return locationService.search({\n next: nextUrl\n });\n };\n return scope.$on(\"$routeChangeSuccess\", function() {\n if (locationService.path() === \"/\") {\n return scope.vm.active = true;\n } else {\n return scope.vm.active = false;\n }\n });\n };\n directive = {\n templateUrl: \"navigation-bar/navigation-bar.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n NavigationBarDirective.$inject = [\"tgCurrentUserService\", \"tgNavigationBarService\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\"];\n\n angular.module(\"taigaNavigationBar\").directive(\"tgNavigationBar\", NavigationBarDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: navigation-bar.service.coffee\n */\n\n(function() {\n var NavigationBarService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n NavigationBarService = (function(superClass) {\n extend(NavigationBarService, superClass);\n\n function NavigationBarService() {\n this.disableHeader();\n }\n\n NavigationBarService.prototype.enableHeader = function() {\n return this.enabledHeader = true;\n };\n\n NavigationBarService.prototype.disableHeader = function() {\n return this.enabledHeader = false;\n };\n\n NavigationBarService.prototype.isEnabledHeader = function() {\n return this.enabledHeader;\n };\n\n return NavigationBarService;\n\n })(taiga.Service);\n\n angular.module(\"taigaNavigationBar\").service(\"tgNavigationBarService\", NavigationBarService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-bar.controller.coffee\n */\n\n(function() {\n var ProfileBarController;\n\n ProfileBarController = (function() {\n ProfileBarController.$inject = [\"tgUserService\"];\n\n function ProfileBarController(userService) {\n this.userService = userService;\n this.loadStats();\n }\n\n ProfileBarController.prototype.loadStats = function() {\n return this.userService.getStats(this.user.get(\"id\")).then((function(_this) {\n return function(stats) {\n return _this.stats = stats;\n };\n })(this));\n };\n\n return ProfileBarController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileBar\", ProfileBarController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-bar.directive.coffee\n */\n\n(function() {\n var ProfileBarDirective;\n\n ProfileBarDirective = function() {\n return {\n templateUrl: \"profile/profile-bar/profile-bar.html\",\n controller: \"ProfileBar\",\n controllerAs: \"vm\",\n scope: {\n user: \"=user\",\n isCurrentUser: \"=iscurrentuser\"\n },\n bindToController: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileBar\", ProfileBarDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-contacts.controller.coffee\n */\n\n(function() {\n var ProfileContactsController;\n\n ProfileContactsController = (function() {\n ProfileContactsController.$inject = [\"tgUserService\", \"tgCurrentUserService\"];\n\n function ProfileContactsController(userService, currentUserService) {\n this.userService = userService;\n this.currentUserService = currentUserService;\n this.currentUser = this.currentUserService.getUser();\n this.isCurrentUser = false;\n if (this.currentUser && this.currentUser.get(\"id\") === this.user.get(\"id\")) {\n this.isCurrentUser = true;\n }\n }\n\n ProfileContactsController.prototype.loadContacts = function() {\n return this.userService.getContacts(this.user.get(\"id\")).then((function(_this) {\n return function(contacts) {\n return _this.contacts = contacts;\n };\n })(this));\n };\n\n return ProfileContactsController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileContacts\", ProfileContactsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-contacts.directive.coffee\n */\n\n(function() {\n var ProfileContactsDirective;\n\n ProfileContactsDirective = function() {\n var link;\n link = function(scope, elm, attrs, ctrl) {\n return ctrl.loadContacts();\n };\n return {\n templateUrl: \"profile/profile-contacts/profile-contacts.html\",\n scope: {\n user: \"=\"\n },\n controllerAs: \"vm\",\n controller: \"ProfileContacts\",\n link: link,\n bindToController: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileContacts\", ProfileContactsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: items.directive.coffee\n */\n\n(function() {\n var FavItemDirective;\n\n FavItemDirective = function() {\n var link, templateUrl;\n link = function(scope, el, attrs, ctrl) {\n return scope.vm = {\n item: scope.item\n };\n };\n templateUrl = function(el, attrs) {\n if (attrs.itemType === \"project\") {\n return \"profile/profile-favs/items/project.html\";\n } else {\n return \"profile/profile-favs/items/ticket.html\";\n }\n };\n return {\n scope: {\n \"item\": \"=tgFavItem\"\n },\n link: link,\n templateUrl: templateUrl\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgFavItem\", FavItemDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-favs.controller.coffee\n */\n\n(function() {\n var FavsBaseController, ProfileLikedController, ProfileVotedController, ProfileWatchedController, debounceLeading,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n debounceLeading = this.taiga.debounceLeading;\n\n FavsBaseController = (function() {\n function FavsBaseController() {\n this._init();\n }\n\n FavsBaseController.prototype._init = function() {\n this.enableFilterByAll = true;\n this.enableFilterByProjects = true;\n this.enableFilterByUserStories = true;\n this.enableFilterByTasks = true;\n this.enableFilterByIssues = true;\n this.enableFilterByTextQuery = true;\n this._resetList();\n this.q = null;\n return this.type = null;\n };\n\n FavsBaseController.prototype._resetList = function() {\n this.items = Immutable.List();\n this.scrollDisabled = false;\n return this._page = 1;\n };\n\n FavsBaseController.prototype._enableLoadingSpinner = function() {\n return this.isLoading = true;\n };\n\n FavsBaseController.prototype._disableLoadingSpinner = function() {\n return this.isLoading = false;\n };\n\n FavsBaseController.prototype._enableScroll = function() {\n return this.scrollDisabled = false;\n };\n\n FavsBaseController.prototype._disableScroll = function() {\n return this.scrollDisabled = true;\n };\n\n FavsBaseController.prototype._checkIfHasMorePages = function(hasNext) {\n if (hasNext) {\n this._page += 1;\n return this._enableScroll();\n } else {\n return this._disableScroll();\n }\n };\n\n FavsBaseController.prototype._checkIfHasNoResults = function() {\n return this.hasNoResults = this.items.size === 0;\n };\n\n FavsBaseController.prototype.loadItems = function() {\n this._enableLoadingSpinner();\n this._disableScroll();\n return this._getItems(this.user.get(\"id\"), this._page, this.type, this.q).then((function(_this) {\n return function(response) {\n _this.items = _this.items.concat(response.get(\"data\"));\n _this._checkIfHasMorePages(response.get(\"next\"));\n _this._checkIfHasNoResults();\n _this._disableLoadingSpinner();\n return _this.items;\n };\n })(this))[\"catch\"]((function(_this) {\n return function() {\n _this._disableLoadingSpinner();\n return _this.items;\n };\n })(this));\n };\n\n FavsBaseController.prototype.filterByTextQuery = debounceLeading(500, function() {\n this._resetList();\n return this.loadItems();\n });\n\n FavsBaseController.prototype.showAll = function() {\n if (this.type !== null) {\n this.type = null;\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showProjectsOnly = function() {\n if (this.type !== \"project\") {\n this.type = \"project\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showUserStoriesOnly = function() {\n if (this.type !== \"userstory\") {\n this.type = \"userstory\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showTasksOnly = function() {\n if (this.type !== \"task\") {\n this.type = \"task\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showIssuesOnly = function() {\n if (this.type !== \"issue\") {\n this.type = \"issue\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n return FavsBaseController;\n\n })();\n\n ProfileLikedController = (function(superClass) {\n extend(ProfileLikedController, superClass);\n\n ProfileLikedController.$inject = [\"tgUserService\"];\n\n function ProfileLikedController(userService) {\n this.userService = userService;\n ProfileLikedController.__super__.constructor.call(this);\n this.enableFilterByAll = false;\n this.enableFilterByProjects = false;\n this.enableFilterByUserStories = false;\n this.enableFilterByTasks = false;\n this.enableFilterByIssues = false;\n this.enableFilterByTextQuery = true;\n this._getItems = this.userService.getLiked;\n }\n\n return ProfileLikedController;\n\n })(FavsBaseController);\n\n angular.module(\"taigaProfile\").controller(\"ProfileLiked\", ProfileLikedController);\n\n ProfileVotedController = (function(superClass) {\n extend(ProfileVotedController, superClass);\n\n ProfileVotedController.$inject = [\"tgUserService\"];\n\n function ProfileVotedController(userService) {\n this.userService = userService;\n ProfileVotedController.__super__.constructor.call(this);\n this.enableFilterByAll = true;\n this.enableFilterByProjects = false;\n this.enableFilterByUserStories = true;\n this.enableFilterByTasks = true;\n this.enableFilterByIssues = true;\n this.enableFilterByTextQuery = true;\n this._getItems = this.userService.getVoted;\n }\n\n return ProfileVotedController;\n\n })(FavsBaseController);\n\n angular.module(\"taigaProfile\").controller(\"ProfileVoted\", ProfileVotedController);\n\n ProfileWatchedController = (function(superClass) {\n extend(ProfileWatchedController, superClass);\n\n ProfileWatchedController.$inject = [\"tgUserService\"];\n\n function ProfileWatchedController(userService) {\n this.userService = userService;\n ProfileWatchedController.__super__.constructor.call(this);\n this._getItems = this.userService.getWatched;\n }\n\n return ProfileWatchedController;\n\n })(FavsBaseController);\n\n angular.module(\"taigaProfile\").controller(\"ProfileWatched\", ProfileWatchedController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-favs.directive.coffee\n */\n\n(function() {\n var ProfileLikedDirective, ProfileVotedDirective, ProfileWatchedDirective, base;\n\n base = {\n scope: {},\n bindToController: {\n user: \"=\",\n type: \"@\",\n q: \"@\",\n scrollDisabled: \"@\",\n isLoading: \"@\",\n hasNoResults: \"@\"\n },\n controller: null,\n controllerAs: \"vm\",\n templateUrl: \"profile/profile-favs/profile-favs.html\"\n };\n\n ProfileLikedDirective = function() {\n return _.extend({}, base, {\n controller: \"ProfileLiked\"\n });\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileLiked\", ProfileLikedDirective);\n\n ProfileVotedDirective = function() {\n return _.extend({}, base, {\n controller: \"ProfileVoted\"\n });\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileVoted\", ProfileVotedDirective);\n\n ProfileWatchedDirective = function() {\n return _.extend({}, base, {\n controller: \"ProfileWatched\"\n });\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileWatched\", ProfileWatchedDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-hints.controller.coffee\n */\n\n(function() {\n var ProfileHints;\n\n ProfileHints = (function() {\n ProfileHints.prototype.HINTS = [\n {\n url: \"https://taiga.io/support/import-export-projects/\"\n }, {\n url: \"https://taiga.io/support/custom-fields/\"\n }, {}, {}\n ];\n\n function ProfileHints(translate) {\n var hintKey;\n this.translate = translate;\n hintKey = Math.floor(Math.random() * this.HINTS.length) + 1;\n this.hint = this.HINTS[hintKey - 1];\n this.hint.linkText = this.hint.linkText || 'HINTS.LINK';\n this.hint.title = this.translate.instant(\"HINTS.HINT\" + hintKey + \"_TITLE\");\n this.hint.text = this.translate.instant(\"HINTS.HINT\" + hintKey + \"_TEXT\");\n }\n\n return ProfileHints;\n\n })();\n\n ProfileHints.$inject = [\"$translate\"];\n\n angular.module(\"taigaProfile\").controller(\"ProfileHints\", ProfileHints);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-hints.directive.coffee\n */\n\n(function() {\n var ProfileHints;\n\n ProfileHints = function($translate) {\n return {\n scope: {},\n controller: \"ProfileHints\",\n controllerAs: \"vm\",\n templateUrl: \"profile/profile-hints/profile-hints.html\"\n };\n };\n\n ProfileHints.$inject = [\"$translate\"];\n\n angular.module(\"taigaProfile\").directive(\"tgProfileHints\", ProfileHints);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-projects.controller.coffee\n */\n\n(function() {\n var ProfileProjectsController;\n\n ProfileProjectsController = (function() {\n ProfileProjectsController.$inject = [\"tgProjectsService\", \"tgUserService\"];\n\n function ProfileProjectsController(projectsService, userService) {\n this.projectsService = projectsService;\n this.userService = userService;\n }\n\n ProfileProjectsController.prototype.loadProjects = function() {\n return this.projectsService.getProjectsByUserId(this.user.get(\"id\")).then((function(_this) {\n return function(projects) {\n return _this.userService.attachUserContactsToProjects(_this.user.get(\"id\"), projects);\n };\n })(this)).then((function(_this) {\n return function(projects) {\n return _this.projects = projects;\n };\n })(this));\n };\n\n return ProfileProjectsController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileProjects\", ProfileProjectsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-projects.directive.coffee\n */\n\n(function() {\n var ProfileProjectsDirective;\n\n ProfileProjectsDirective = function() {\n var link;\n link = function(scope, elm, attr, ctrl) {\n return ctrl.loadProjects();\n };\n return {\n templateUrl: \"profile/profile-projects/profile-projects.html\",\n scope: {\n user: \"=\"\n },\n link: link,\n bindToController: true,\n controllerAs: \"vm\",\n controller: \"ProfileProjects\"\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileProjects\", ProfileProjectsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-tab.directive.coffee\n */\n\n(function() {\n var ProfileTabDirective;\n\n ProfileTabDirective = function() {\n var link;\n link = function(scope, element, attrs, ctrl, transclude) {\n scope.tab = {};\n attrs.$observe(\"tgProfileTab\", function(name) {\n return scope.tab.name = name;\n });\n attrs.$observe(\"tabTitle\", function(title) {\n return scope.tab.title = title;\n });\n scope.tab.icon = attrs.tabIcon;\n scope.tab.iconName = '#' + attrs.tabIcon;\n scope.tab.active = !!attrs.tabActive;\n if (scope.$eval(attrs.tabDisabled) !== true) {\n return ctrl.addTab(scope.tab);\n }\n };\n return {\n templateUrl: \"profile/profile-tab/profile-tab.html\",\n scope: {},\n require: \"^tgProfileTabs\",\n link: link,\n transclude: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileTab\", ProfileTabDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-tabs.controller.coffee\n */\n\n(function() {\n var ProfileTabsController;\n\n ProfileTabsController = (function() {\n function ProfileTabsController() {\n this.tabs = [];\n }\n\n ProfileTabsController.prototype.addTab = function(tab) {\n return this.tabs.push(tab);\n };\n\n ProfileTabsController.prototype.toggleTab = function(tab) {\n _.map(this.tabs, function(tab) {\n return tab.active = false;\n });\n return tab.active = true;\n };\n\n return ProfileTabsController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileTabs\", ProfileTabsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-tabs.directive.coffee\n */\n\n(function() {\n var ProfileTabsDirective;\n\n ProfileTabsDirective = function() {\n return {\n scope: {},\n controller: \"ProfileTabs\",\n controllerAs: \"vm\",\n templateUrl: \"profile/profile-tabs/profile-tabs.html\",\n transclude: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileTabs\", ProfileTabsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile.controller.coffee\n */\n\n(function() {\n var ProfileController;\n\n ProfileController = (function() {\n ProfileController.$inject = [\"tgAppMetaService\", \"tgCurrentUserService\", \"$routeParams\", \"tgUserService\", \"tgXhrErrorService\", \"$translate\"];\n\n function ProfileController(appMetaService, currentUserService, routeParams, userService, xhrError, translate) {\n this.appMetaService = appMetaService;\n this.currentUserService = currentUserService;\n this.routeParams = routeParams;\n this.userService = userService;\n this.xhrError = xhrError;\n this.translate = translate;\n this.isCurrentUser = false;\n if (this.routeParams.slug) {\n this.userService.getUserByUserName(this.routeParams.slug).then((function(_this) {\n return function(user) {\n if (!user.get('is_active')) {\n return _this.xhrError.notFound();\n } else {\n _this.user = user;\n _this.isCurrentUser = false;\n _this._setMeta(_this.user);\n return user;\n }\n };\n })(this))[\"catch\"]((function(_this) {\n return function(xhr) {\n return _this.xhrError.response(xhr);\n };\n })(this));\n } else {\n this.user = this.currentUserService.getUser();\n this.isCurrentUser = true;\n this._setMeta(this.user);\n }\n }\n\n ProfileController.prototype._setMeta = function(user) {\n var ctx, description, title;\n ctx = {\n userFullName: user.get(\"full_name_display\"),\n userUsername: user.get(\"username\")\n };\n title = this.translate.instant(\"USER.PROFILE.PAGE_TITLE\", ctx);\n description = user.get(\"bio\");\n return this.appMetaService.setAll(title, description);\n };\n\n return ProfileController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"Profile\", ProfileController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: blocked-project-explanation.directive.coffee\n */\n\n(function() {\n var BlockedProjectExplanationDirective;\n\n BlockedProjectExplanationDirective = function() {\n return {\n templateUrl: \"projects/project/blocked-project-explanation.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgBlockedProjectExplanation\", BlockedProjectExplanationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: like-project-button.controller.coffee\n */\n\n(function() {\n var LikeProjectButtonController;\n\n LikeProjectButtonController = (function() {\n LikeProjectButtonController.$inject = [\"$tgConfirm\", \"tgLikeProjectButtonService\"];\n\n function LikeProjectButtonController(confirm, likeButtonService) {\n this.confirm = confirm;\n this.likeButtonService = likeButtonService;\n this.isMouseOver = false;\n this.loading = false;\n }\n\n LikeProjectButtonController.prototype.showTextWhenMouseIsOver = function() {\n return this.isMouseOver = true;\n };\n\n LikeProjectButtonController.prototype.showTextWhenMouseIsLeave = function() {\n return this.isMouseOver = false;\n };\n\n LikeProjectButtonController.prototype.toggleLike = function() {\n var promise;\n this.loading = true;\n if (!this.project.get(\"is_fan\")) {\n promise = this._like();\n } else {\n promise = this._unlike();\n }\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n return promise;\n };\n\n LikeProjectButtonController.prototype._like = function() {\n return this.likeButtonService.like(this.project.get('id')).then((function(_this) {\n return function() {\n return _this.showTextWhenMouseIsLeave();\n };\n })(this))[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n };\n\n LikeProjectButtonController.prototype._unlike = function() {\n return this.likeButtonService.unlike(this.project.get('id'))[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n };\n\n return LikeProjectButtonController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"LikeProjectButton\", LikeProjectButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: like-project-button.directive.coffee\n */\n\n(function() {\n var LikeProjectButtonDirective;\n\n LikeProjectButtonDirective = function() {\n return {\n scope: {},\n controller: \"LikeProjectButton\",\n bindToController: {\n project: '='\n },\n controllerAs: \"vm\",\n templateUrl: \"projects/components/like-project-button/like-project-button.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgLikeProjectButton\", LikeProjectButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: like-project-button.service.coffee\n */\n\n(function() {\n var LikeProjectButtonService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n LikeProjectButtonService = (function(superClass) {\n extend(LikeProjectButtonService, superClass);\n\n LikeProjectButtonService.$inject = [\"tgResources\", \"tgCurrentUserService\", \"tgProjectService\"];\n\n function LikeProjectButtonService(rs, currentUserService, projectService) {\n this.rs = rs;\n this.currentUserService = currentUserService;\n this.projectService = projectService;\n }\n\n LikeProjectButtonService.prototype._getProjectIndex = function(projectId) {\n return this.currentUserService.projects.get('all').findIndex(function(project) {\n return project.get('id') === projectId;\n });\n };\n\n LikeProjectButtonService.prototype._updateProjects = function(projectId, isFan) {\n var projectIndex, projects;\n projectIndex = this._getProjectIndex(projectId);\n if (projectIndex === -1) {\n return;\n }\n projects = this.currentUserService.projects.get('all').update(projectIndex, function(project) {\n var totalFans;\n totalFans = project.get(\"total_fans\");\n if (isFan) {\n totalFans++;\n } else {\n totalFans--;\n }\n return project.merge({\n is_fan: isFan,\n total_fans: totalFans\n });\n });\n return this.currentUserService.setProjects(projects);\n };\n\n LikeProjectButtonService.prototype._updateCurrentProject = function(isFan) {\n var project, totalFans;\n totalFans = this.projectService.project.get(\"total_fans\");\n if (isFan) {\n totalFans++;\n } else {\n totalFans--;\n }\n project = this.projectService.project.merge({\n is_fan: isFan,\n total_fans: totalFans\n });\n return this.projectService.setProject(project);\n };\n\n LikeProjectButtonService.prototype.like = function(projectId) {\n return this.rs.projects.likeProject(projectId).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, true);\n return _this._updateCurrentProject(true);\n };\n })(this));\n };\n\n LikeProjectButtonService.prototype.unlike = function(projectId) {\n return this.rs.projects.unlikeProject(projectId).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, false);\n return _this._updateCurrentProject(false);\n };\n })(this));\n };\n\n return LikeProjectButtonService;\n\n })(taiga.Service);\n\n angular.module(\"taigaProjects\").service(\"tgLikeProjectButtonService\", LikeProjectButtonService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: sort-projects.directive.coffee\n */\n\n(function() {\n var SortProjectsDirective;\n\n SortProjectsDirective = function(currentUserService) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n var itemEl;\n itemEl = null;\n el.sortable({\n dropOnEmpty: true,\n revert: 200,\n axis: \"y\",\n opacity: .95,\n placeholder: 'placeholder',\n cancel: '.project-name'\n });\n return el.on(\"sortstop\", function(event, ui) {\n var i, index, len, project, sortData, sorted_project_ids, value;\n itemEl = ui.item;\n project = itemEl.scope().project;\n index = itemEl.index();\n sorted_project_ids = _.map(scope.projects.toJS(), function(p) {\n return p.id;\n });\n sorted_project_ids = _.without(sorted_project_ids, project.get(\"id\"));\n sorted_project_ids.splice(index, 0, project.get('id'));\n sortData = [];\n for (index = i = 0, len = sorted_project_ids.length; i < len; index = ++i) {\n value = sorted_project_ids[index];\n sortData.push({\n \"project_id\": value,\n \"order\": index\n });\n }\n return currentUserService.bulkUpdateProjectsOrder(sortData);\n });\n };\n directive = {\n scope: {\n projects: \"=tgSortProjects\"\n },\n link: link\n };\n return directive;\n };\n\n angular.module(\"taigaProjects\").directive(\"tgSortProjects\", [\"tgCurrentUserService\", SortProjectsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-project-button.controller.coffee\n */\n\n(function() {\n var WatchProjectButtonController;\n\n WatchProjectButtonController = (function() {\n WatchProjectButtonController.$inject = [\"$tgConfirm\", \"tgWatchProjectButtonService\"];\n\n function WatchProjectButtonController(confirm, watchButtonService) {\n this.confirm = confirm;\n this.watchButtonService = watchButtonService;\n this.showWatchOptions = false;\n this.loading = false;\n }\n\n WatchProjectButtonController.prototype.toggleWatcherOptions = function() {\n return this.showWatchOptions = !this.showWatchOptions;\n };\n\n WatchProjectButtonController.prototype.closeWatcherOptions = function() {\n return this.showWatchOptions = false;\n };\n\n WatchProjectButtonController.prototype.watch = function(notifyLevel) {\n if (notifyLevel === this.project.get('notify_level')) {\n return;\n }\n this.loading = true;\n this.closeWatcherOptions();\n return this.watchButtonService.watch(this.project.get('id'), notifyLevel)[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this))[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n WatchProjectButtonController.prototype.unwatch = function() {\n this.loading = true;\n this.closeWatcherOptions();\n return this.watchButtonService.unwatch(this.project.get('id'))[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this))[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n return WatchProjectButtonController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"WatchProjectButton\", WatchProjectButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-project-button.directive.coffee\n */\n\n(function() {\n var WatchProjectButtonDirective;\n\n WatchProjectButtonDirective = function() {\n return {\n scope: {},\n controller: \"WatchProjectButton\",\n bindToController: {\n project: \"=\"\n },\n controllerAs: \"vm\",\n templateUrl: \"projects/components/watch-project-button/watch-project-button.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgWatchProjectButton\", WatchProjectButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-project-button.service.coffee\n */\n\n(function() {\n var WatchProjectButtonService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n WatchProjectButtonService = (function(superClass) {\n extend(WatchProjectButtonService, superClass);\n\n WatchProjectButtonService.$inject = [\"tgResources\", \"tgCurrentUserService\", \"tgProjectService\"];\n\n function WatchProjectButtonService(rs, currentUserService, projectService) {\n this.rs = rs;\n this.currentUserService = currentUserService;\n this.projectService = projectService;\n }\n\n WatchProjectButtonService.prototype._getProjectIndex = function(projectId) {\n return this.currentUserService.projects.get('all').findIndex(function(project) {\n return project.get('id') === projectId;\n });\n };\n\n WatchProjectButtonService.prototype._updateProjects = function(projectId, notifyLevel, isWatcher) {\n var projectIndex, projects;\n projectIndex = this._getProjectIndex(projectId);\n if (projectIndex === -1) {\n return;\n }\n projects = this.currentUserService.projects.get('all').update(projectIndex, (function(_this) {\n return function(project) {\n var totalWatchers;\n totalWatchers = project.get('total_watchers');\n if (!_this.projectService.project.get('is_watcher') && isWatcher) {\n totalWatchers++;\n } else if (_this.projectService.project.get('is_watcher') && !isWatcher) {\n totalWatchers--;\n }\n return project.merge({\n is_watcher: isWatcher,\n total_watchers: totalWatchers,\n notify_level: notifyLevel\n });\n };\n })(this));\n return this.currentUserService.setProjects(projects);\n };\n\n WatchProjectButtonService.prototype._updateCurrentProject = function(notifyLevel, isWatcher) {\n var project, totalWatchers;\n totalWatchers = this.projectService.project.get(\"total_watchers\");\n if (!this.projectService.project.get('is_watcher') && isWatcher) {\n totalWatchers++;\n } else if (this.projectService.project.get('is_watcher') && !isWatcher) {\n totalWatchers--;\n }\n project = this.projectService.project.merge({\n is_watcher: isWatcher,\n notify_level: notifyLevel,\n total_watchers: totalWatchers\n });\n return this.projectService.setProject(project);\n };\n\n WatchProjectButtonService.prototype.watch = function(projectId, notifyLevel) {\n return this.rs.projects.watchProject(projectId, notifyLevel).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, notifyLevel, true);\n return _this._updateCurrentProject(notifyLevel, true);\n };\n })(this));\n };\n\n WatchProjectButtonService.prototype.unwatch = function(projectId) {\n return this.rs.projects.unwatchProject(projectId).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, null, false);\n return _this._updateCurrentProject(null, false);\n };\n })(this));\n };\n\n return WatchProjectButtonService;\n\n })(taiga.Service);\n\n angular.module(\"taigaProjects\").service(\"tgWatchProjectButtonService\", WatchProjectButtonService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects-listing.controller.coffee\n */\n\n(function() {\n var ProjectsListingController;\n\n ProjectsListingController = (function() {\n ProjectsListingController.$inject = [\"tgCurrentUserService\", \"tgProjectsService\"];\n\n function ProjectsListingController(currentUserService, projectsService) {\n this.currentUserService = currentUserService;\n this.projectsService = projectsService;\n taiga.defineImmutableProperty(this, \"projects\", (function(_this) {\n return function() {\n return _this.currentUserService.projects.get(\"all\");\n };\n })(this));\n }\n\n ProjectsListingController.prototype.newProject = function() {\n return this.projectsService.newProject();\n };\n\n return ProjectsListingController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"ProjectsListing\", ProjectsListingController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project.controller.coffee\n */\n\n(function() {\n var ProjectController;\n\n ProjectController = (function() {\n ProjectController.$inject = [\"$routeParams\", \"tgAppMetaService\", \"$tgAuth\", \"$translate\", \"tgProjectService\"];\n\n function ProjectController(routeParams, appMetaService, auth, translate, projectService) {\n var projectSlug;\n this.routeParams = routeParams;\n this.appMetaService = appMetaService;\n this.auth = auth;\n this.translate = translate;\n this.projectService = projectService;\n projectSlug = this.routeParams.pslug;\n this.user = this.auth.userData;\n taiga.defineImmutableProperty(this, \"project\", (function(_this) {\n return function() {\n return _this.projectService.project;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"members\", (function(_this) {\n return function() {\n return _this.projectService.activeMembers;\n };\n })(this));\n this.appMetaService.setfn(this._setMeta.bind(this));\n }\n\n ProjectController.prototype._setMeta = function(project) {\n var ctx, metas;\n if (!this.project) {\n return null;\n }\n metas = {};\n ctx = {\n projectName: this.project.get(\"name\")\n };\n metas.title = this.translate.instant(\"PROJECT.PAGE_TITLE\", ctx);\n metas.description = this.project.get(\"description\");\n return metas;\n };\n\n return ProjectController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"Project\", ProjectController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects.service.coffee\n */\n\n(function() {\n var ProjectsService, groupBy, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n ProjectsService = (function(superClass) {\n extend(ProjectsService, superClass);\n\n ProjectsService.$inject = [\"tgResources\", \"$projectUrl\", \"tgLightboxFactory\"];\n\n function ProjectsService(rs, projectUrl, lightboxFactory) {\n this.rs = rs;\n this.projectUrl = projectUrl;\n this.lightboxFactory = lightboxFactory;\n }\n\n ProjectsService.prototype.getProjectBySlug = function(projectSlug) {\n return this.rs.projects.getProjectBySlug(projectSlug).then((function(_this) {\n return function(project) {\n return _this._decorate(project);\n };\n })(this));\n };\n\n ProjectsService.prototype.getProjectStats = function(projectId) {\n return this.rs.projects.getProjectStats(projectId);\n };\n\n ProjectsService.prototype.getProjectsByUserId = function(userId, paginate) {\n return this.rs.projects.getProjectsByUserId(userId, paginate).then((function(_this) {\n return function(projects) {\n return projects.map(_this._decorate.bind(_this));\n };\n })(this));\n };\n\n ProjectsService.prototype._decorate = function(project) {\n var colorized_tags, tags, url;\n url = this.projectUrl.get(project.toJS());\n project = project.set(\"url\", url);\n colorized_tags = [];\n if (project.get(\"tags\")) {\n tags = project.get(\"tags\").sort();\n colorized_tags = tags.map(function(tag) {\n var color;\n color = project.get(\"tags_colors\").get(tag);\n return Immutable.fromJS({\n name: tag,\n color: color\n });\n });\n project = project.set(\"colorized_tags\", colorized_tags);\n }\n return project;\n };\n\n ProjectsService.prototype.newProject = function() {\n return this.lightboxFactory.create(\"tg-lb-create-project\", {\n \"class\": \"wizard-create-project lightbox\"\n });\n };\n\n ProjectsService.prototype.bulkUpdateProjectsOrder = function(sortData) {\n return this.rs.projects.bulkUpdateOrder(sortData);\n };\n\n ProjectsService.prototype.transferValidateToken = function(projectId, token) {\n return this.rs.projects.transferValidateToken(projectId, token);\n };\n\n ProjectsService.prototype.transferAccept = function(projectId, token, reason) {\n return this.rs.projects.transferAccept(projectId, token, reason);\n };\n\n ProjectsService.prototype.transferReject = function(projectId, token, reason) {\n return this.rs.projects.transferReject(projectId, token, reason);\n };\n\n return ProjectsService;\n\n })(taiga.Service);\n\n angular.module(\"taigaProjects\").service(\"tgProjectsService\", ProjectsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: cant-own-project-explanation.directive.coffee\n */\n\n(function() {\n var CantOwnProjectExplanationDirective;\n\n CantOwnProjectExplanationDirective = function() {\n return {\n templateUrl: \"projects/transfer/cant-own-project-explanation.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgCantOwnProjectExplanation\", CantOwnProjectExplanationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: transfer-project.directive.coffee\n */\n\n(function() {\n var TransferProject, module;\n\n module = angular.module('taigaProjects');\n\n TransferProject = (function() {\n TransferProject.$inject = [\"$routeParams\", \"tgProjectsService\", \"$location\", \"$tgAuth\", \"tgCurrentUserService\", \"$tgNavUrls\", \"$translate\", \"$tgConfirm\"];\n\n function TransferProject(routeParams, projectService, location, authService, currentUserService, navUrls, translate, confirmService) {\n this.routeParams = routeParams;\n this.projectService = projectService;\n this.location = location;\n this.authService = authService;\n this.currentUserService = currentUserService;\n this.navUrls = navUrls;\n this.translate = translate;\n this.confirmService = confirmService;\n }\n\n TransferProject.prototype.initialize = function() {\n this.projectId = this.project.get(\"id\");\n this.token = this.routeParams.token;\n this.showAddComment = false;\n return this._refreshUserData();\n };\n\n TransferProject.prototype._validateToken = function() {\n return this.projectService.transferValidateToken(this.projectId, this.token).then(null, (function(_this) {\n return function(data, status) {\n return _this.location.path(_this.navUrls.resolve(\"not-found\"));\n };\n })(this));\n };\n\n TransferProject.prototype._refreshUserData = function() {\n return this.authService.refresh().then((function(_this) {\n return function() {\n _this._validateToken();\n _this._setProjectData();\n return _this._checkOwnerData();\n };\n })(this));\n };\n\n TransferProject.prototype._setProjectData = function() {\n return this.canBeOwnedByUser = this.currentUserService.canOwnProject(this.project);\n };\n\n TransferProject.prototype._checkOwnerData = function() {\n var currentUser, maxMemberships;\n currentUser = this.currentUserService.getUser();\n if (this.project.get('is_private')) {\n this.ownerMessage = 'ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PRIVATE';\n this.maxProjects = currentUser.get('max_private_projects');\n if (this.maxProjects === null) {\n this.maxProjects = this.translate.instant('ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS');\n }\n this.currentProjects = currentUser.get('total_private_projects');\n maxMemberships = currentUser.get('max_memberships_private_projects');\n } else {\n this.ownerMessage = 'ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PUBLIC';\n this.maxProjects = currentUser.get('max_public_projects');\n if (this.maxProjects === null) {\n this.maxProjects = this.translate.instant('ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS');\n }\n this.currentProjects = currentUser.get('total_public_projects');\n maxMemberships = currentUser.get('max_memberships_public_projects');\n }\n return this.validNumberOfMemberships = maxMemberships === null || this.project.get('total_memberships') <= maxMemberships;\n };\n\n TransferProject.prototype.transferAccept = function(token, reason) {\n return this.projectService.transferAccept(this.project.get(\"id\"), token, reason).then((function(_this) {\n return function() {\n var newUrl;\n newUrl = _this.navUrls.resolve(\"project-admin-project-profile-details\", {\n project: _this.project.get(\"slug\")\n });\n _this.location.path(newUrl);\n _this.confirmService.notify(\"success\", _this.translate.instant(\"ADMIN.PROJECT_TRANSFER.ACCEPTED_PROJECT_OWNERNSHIP\"), '', 5000);\n };\n })(this));\n };\n\n TransferProject.prototype.transferReject = function(token, reason) {\n return this.projectService.transferReject(this.project.get(\"id\"), token, reason).then((function(_this) {\n return function() {\n var newUrl;\n newUrl = _this.navUrls.resolve(\"project-admin-project-profile-details\", {\n project: _this.project.get(\"slug\")\n });\n _this.location.path(newUrl);\n _this.confirmService.notify(\"success\", _this.translate.instant(\"ADMIN.PROJECT_TRANSFER.REJECTED_PROJECT_OWNERNSHIP\"), '', 5000);\n };\n })(this));\n };\n\n TransferProject.prototype.addComment = function() {\n return this.showAddComment = true;\n };\n\n TransferProject.prototype.hideComment = function() {\n this.showAddComment = false;\n return this.reason = '';\n };\n\n return TransferProject;\n\n })();\n\n module.controller(\"TransferProjectController\", TransferProject);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: transfer-project.directive.coffee\n */\n\n(function() {\n var TransferProjectDirective, module;\n\n module = angular.module('taigaProjects');\n\n TransferProjectDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return ctrl.initialize();\n };\n return {\n link: link,\n scope: {},\n bindToController: {\n project: \"=\"\n },\n templateUrl: \"projects/transfer/transfer-project.html\",\n controller: 'TransferProjectController',\n controllerAs: 'vm'\n };\n };\n\n module.directive('tgTransferProject', TransferProjectDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-resource.service.coffee\n */\n\n(function() {\n var Resource, module, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n Resource = function(urlsService, http, config, $rootScope, $q, storage) {\n var service;\n service = {};\n service.list = function(type, objectId, projectId) {\n var httpOptions, params, url, urlname;\n urlname = \"attachments/\" + type;\n params = {\n object_id: objectId,\n project: projectId\n };\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n url = urlsService.resolve(urlname);\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service[\"delete\"] = function(type, id) {\n var url, urlname;\n urlname = \"attachments/\" + type;\n url = urlsService.resolve(urlname) + (\"/\" + id);\n return http[\"delete\"](url);\n };\n service.patch = function(type, id, patch) {\n var url, urlname;\n urlname = \"attachments/\" + type;\n url = urlsService.resolve(urlname) + (\"/\" + id);\n return http.patch(url, patch);\n };\n service.create = function(type, projectId, objectId, file) {\n var data, defered, maxFileSize, response, token, uploadComplete, uploadFailed, uploadProgress, url, urlname, xhr;\n urlname = \"attachments/\" + type;\n url = urlsService.resolve(urlname);\n defered = $q.defer();\n if (file === void 0) {\n defered.reject(null);\n return defered.promise;\n }\n maxFileSize = config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"in-progress\";\n file.size = sizeFormat(evt.total);\n file.progressMessage = \"upload \" + (sizeFormat(evt.loaded)) + \" of \" + (sizeFormat(evt.total));\n return file.progressPercent = (Math.round((evt.loaded / evt.total) * 100)) + \"%\";\n });\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n var attachment, error, ref, status;\n file.status = \"done\";\n status = evt.target.status;\n try {\n attachment = JSON.parse(evt.target.responseText);\n } catch (error) {\n attachment = {};\n }\n if (status >= 200 && status < 400) {\n attachment = Immutable.fromJS(attachment);\n return defered.resolve(attachment);\n } else {\n response = {\n status: status,\n data: {\n _error_message: (ref = data['attached_file']) != null ? ref[0] : void 0\n }\n };\n return defered.reject(response);\n }\n });\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"error\";\n return defered.reject(\"fail\");\n });\n };\n })(this);\n data = new FormData();\n data.append(\"project\", projectId);\n data.append(\"object_id\", objectId);\n data.append(\"attached_file\", file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.addEventListener(\"load\", uploadComplete, false);\n xhr.addEventListener(\"error\", uploadFailed, false);\n token = storage.get('token');\n xhr.open(\"POST\", url);\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + token);\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n return function() {\n return {\n \"attachments\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\", \"$tgConfig\", \"$rootScope\", \"$q\", \"$tgStorage\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgAttachmentsResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-apps-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.getApplicationToken = function(applicationId, state) {\n var url;\n url = urlsService.resolve(\"applications\");\n url = url + \"/\" + applicationId + \"/token?state=\" + state;\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.authorizeApplicationToken = function(applicationId, state) {\n var data, url;\n url = urlsService.resolve(\"application-tokens\");\n url = url + \"/authorize\";\n data = {\n \"state\": state,\n \"application\": applicationId\n };\n return http.post(url, data).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"externalapps\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgExternalAppsResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: issues-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.listInAllProjects = function(params) {\n var httpOptions, url;\n url = urlsService.resolve(\"issues\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"issues\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgIssuesResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects-resource.service.coffee\n */\n\n(function() {\n var Resource, module, pagination;\n\n pagination = function() {};\n\n Resource = function(urlsService, http, paginateResponseService) {\n var service;\n service = {};\n service.getProjects = function(params, pagination) {\n var httpOptions, url;\n if (params == null) {\n params = {};\n }\n if (pagination == null) {\n pagination = true;\n }\n url = urlsService.resolve(\"projects\");\n httpOptions = {};\n if (!pagination) {\n httpOptions = {\n headers: {\n \"x-lazy-pagination\": true\n }\n };\n }\n return http.get(url, params, httpOptions);\n };\n service.getProjectBySlug = function(projectSlug) {\n var url;\n url = urlsService.resolve(\"projects\");\n url = url + \"/by_slug?slug=\" + projectSlug;\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getProjectsByUserId = function(userId, paginate) {\n var httpOptions, params, url;\n if (paginate == null) {\n paginate = false;\n }\n url = urlsService.resolve(\"projects\");\n httpOptions = {};\n if (!paginate) {\n httpOptions.headers = {\n \"x-disable-pagination\": \"1\"\n };\n }\n params = {\n \"member\": userId,\n \"order_by\": \"memberships__user_order\"\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getProjectStats = function(projectId) {\n var url;\n url = urlsService.resolve(\"projects\");\n url = url + \"/\" + projectId;\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.bulkUpdateOrder = function(bulkData) {\n var url;\n url = urlsService.resolve(\"bulk-update-projects-order\");\n return http.post(url, bulkData);\n };\n service.getTimeline = function(projectId, page) {\n var params, url;\n params = {\n page: page,\n only_relevant: true\n };\n url = urlsService.resolve(\"timeline-project\");\n url = url + \"/\" + projectId;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.likeProject = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-like\", projectId);\n return http.post(url);\n };\n service.unlikeProject = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-unlike\", projectId);\n return http.post(url);\n };\n service.watchProject = function(projectId, notifyLevel) {\n var data, url;\n data = {\n notify_level: notifyLevel\n };\n url = urlsService.resolve(\"project-watch\", projectId);\n return http.post(url, data);\n };\n service.unwatchProject = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-unwatch\", projectId);\n return http.post(url);\n };\n service.transferValidateToken = function(projectId, token) {\n var data, url;\n data = {\n token: token\n };\n url = urlsService.resolve(\"project-transfer-validate-token\", projectId);\n return http.post(url, data);\n };\n service.transferAccept = function(projectId, token, reason) {\n var data, url;\n data = {\n token: token,\n reason: reason\n };\n url = urlsService.resolve(\"project-transfer-accept\", projectId);\n return http.post(url, data);\n };\n service.transferReject = function(projectId, token, reason) {\n var data, url;\n data = {\n token: token,\n reason: reason\n };\n url = urlsService.resolve(\"project-transfer-reject\", projectId);\n return http.post(url, data);\n };\n service.transferRequest = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-transfer-request\", projectId);\n return http.post(url);\n };\n service.transferStart = function(projectId, userId, reason) {\n var data, url;\n data = {\n user: userId,\n reason: reason\n };\n url = urlsService.resolve(\"project-transfer-start\", projectId);\n return http.post(url, data);\n };\n return function() {\n return {\n \"projects\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\", \"tgPaginateResponseService\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgProjectsResources\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: resources.coffee\n */\n\n(function() {\n var Resources, services;\n\n services = [\"tgProjectsResources\", \"tgUserResources\", \"tgUsersResources\", \"tgUserstoriesResource\", \"tgTasksResource\", \"tgIssuesResource\", \"tgExternalAppsResource\", \"tgAttachmentsResource\", \"tgStatsResource\"];\n\n Resources = function($injector) {\n var i, j, len, len1, ref, service, serviceFn, serviceName, serviceProperty;\n for (i = 0, len = services.length; i < len; i++) {\n serviceName = services[i];\n serviceFn = $injector.get(serviceName);\n service = $injector.invoke(serviceFn);\n ref = Object.keys(service);\n for (j = 0, len1 = ref.length; j < len1; j++) {\n serviceProperty = ref[j];\n if (this[serviceProperty]) {\n console.warm(\"repeated resource \" + serviceProperty);\n }\n this[serviceProperty] = service[serviceProperty];\n }\n }\n return this;\n };\n\n Resources.$inject = [\"$injector\"];\n\n angular.module(\"taigaResources2\").service(\"tgResources\", Resources);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: stats-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.discover = function(applicationId, state) {\n var url;\n url = urlsService.resolve(\"stats-discover\");\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"stats\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgStatsResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: tasks-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.listInAllProjects = function(params) {\n var httpOptions, url;\n url = urlsService.resolve(\"tasks\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"tasks\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgTasksResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http, paginateResponseService) {\n var service;\n service = {};\n service.getUserStorage = function(key) {\n var httpOptions, url;\n url = urlsService.resolve(\"user-storage\");\n if (key) {\n url += '/' + key;\n }\n httpOptions = {};\n return http.get(url, {}).then(function(response) {\n return response.data.value;\n });\n };\n service.setUserStorage = function(key, value) {\n var params, url;\n url = urlsService.resolve(\"user-storage\") + '/' + key;\n params = {\n key: key,\n value: value\n };\n return http.put(url, params);\n };\n service.createUserStorage = function(key, value) {\n var params, url;\n url = urlsService.resolve(\"user-storage\");\n params = {\n key: key,\n value: value\n };\n return http.post(url, params);\n };\n return function() {\n return {\n \"user\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgUserResources\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: users-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http, paginateResponseService) {\n var service;\n service = {};\n service.getUserByUsername = function(username) {\n var httpOptions, params, url;\n url = urlsService.resolve(\"by_username\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n params = {\n username: username\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getStats = function(userId) {\n var httpOptions, url;\n url = urlsService.resolve(\"user-stats\", userId);\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, {}, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getContacts = function(userId) {\n var httpOptions, url;\n url = urlsService.resolve(\"user-contacts\", userId);\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, {}, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getLiked = function(userId, page, type, q) {\n var params, url;\n url = urlsService.resolve(\"user-liked\", userId);\n params = {};\n if (page != null) {\n params.page = page;\n }\n if (type != null) {\n params.type = type;\n }\n if (q != null) {\n params.q = q;\n }\n params.only_relevant = true;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getVoted = function(userId, page, type, q) {\n var params, url;\n url = urlsService.resolve(\"user-voted\", userId);\n params = {};\n if (page != null) {\n params.page = page;\n }\n if (type != null) {\n params.type = type;\n }\n if (q != null) {\n params.q = q;\n }\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getWatched = function(userId, page, type, q) {\n var params, url;\n url = urlsService.resolve(\"user-watched\", userId);\n params = {};\n if (page != null) {\n params.page = page;\n }\n if (type != null) {\n params.type = type;\n }\n if (q != null) {\n params.q = q;\n }\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getProfileTimeline = function(userId, page) {\n var params, url;\n params = {\n page: page\n };\n url = urlsService.resolve(\"timeline-profile\");\n url = url + \"/\" + userId;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getUserTimeline = function(userId, page) {\n var params, url;\n params = {\n page: page,\n only_relevant: true\n };\n url = urlsService.resolve(\"timeline-user\");\n url = url + \"/\" + userId;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n return function() {\n return {\n \"users\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\", \"tgPaginateResponseService\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgUsersResources\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: userstories-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.listInAllProjects = function(params) {\n var httpOptions, url;\n url = urlsService.resolve(\"userstories\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"userstories\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgUserstoriesResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: app-meta.service.coffee\n */\n\n(function() {\n var AppMetaService, taiga, truncate;\n\n taiga = this.taiga;\n\n truncate = taiga.truncate;\n\n AppMetaService = (function() {\n AppMetaService.$inject = [\"$rootScope\"];\n\n function AppMetaService(rootScope) {\n this.rootScope = rootScope;\n }\n\n AppMetaService.prototype._set = function(key, value) {\n var meta;\n if (!key) {\n return;\n }\n if (key === \"title\") {\n meta = $(\"head title\");\n if (meta.length === 0) {\n meta = $(\"\");\n $(\"head\").append(meta);\n }\n return meta.text(value || \"\");\n } else if (key.indexOf(\"og:\") === 0) {\n meta = $(\"head meta[property='\" + key + \"']\");\n if (meta.length === 0) {\n meta = $(\"\");\n $(\"head\").append(meta);\n }\n return meta.attr(\"content\", value || \"\");\n } else {\n meta = $(\"head meta[name='\" + key + \"']\");\n if (meta.length === 0) {\n meta = $(\"\");\n $(\"head\").append(meta);\n }\n return meta.attr(\"content\", value || \"\");\n }\n };\n\n AppMetaService.prototype.setTitle = function(title) {\n return this._set('title', title);\n };\n\n AppMetaService.prototype.setDescription = function(description) {\n return this._set(\"description\", truncate(description, 250));\n };\n\n AppMetaService.prototype.setTwitterMetas = function(title, description) {\n this._set(\"twitter:card\", \"summary\");\n this._set(\"twitter:site\", \"@taigaio\");\n this._set(\"twitter:title\", title);\n this._set(\"twitter:description\", truncate(description, 300));\n return this._set(\"twitter:image\", window.location.origin + \"/\" + window._version + \"/images/logo-color.png\");\n };\n\n AppMetaService.prototype.setOpenGraphMetas = function(title, description) {\n this._set(\"og:type\", \"object\");\n this._set(\"og:site_name\", \"Taiga - Love your projects\");\n this._set(\"og:title\", title);\n this._set(\"og:description\", truncate(description, 300));\n this._set(\"og:image\", window.location.origin + \"/\" + window._version + \"/images/logo-color.png\");\n return this._set(\"og:url\", window.location.href);\n };\n\n AppMetaService.prototype.setAll = function(title, description) {\n this.setTitle(title);\n this.setDescription(description);\n this.setTwitterMetas(title, description);\n return this.setOpenGraphMetas(title, description);\n };\n\n AppMetaService.prototype.addMobileViewport = function() {\n return $(\"head\").append(\"\");\n };\n\n AppMetaService.prototype.removeMobileViewport = function() {\n return $(\"head meta[name=\\\"viewport\\\"]\").remove();\n };\n\n AppMetaService.prototype.setfn = function(fn) {\n if (this.listener) {\n this._listener();\n }\n return this._listener = this.rootScope.$watchCollection(fn, (function(_this) {\n return function(metas) {\n if (metas) {\n _this.setAll(metas.title, metas.description);\n return _this._listener();\n }\n };\n })(this));\n };\n\n return AppMetaService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgAppMetaService\", AppMetaService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments.service.coffee\n */\n\n(function() {\n var AttachmentsService, sizeFormat;\n\n sizeFormat = this.taiga.sizeFormat;\n\n AttachmentsService = (function() {\n AttachmentsService.$inject = [\"$tgConfirm\", \"$tgConfig\", \"$translate\", \"tgResources\"];\n\n function AttachmentsService(confirm, config, translate, rs) {\n this.confirm = confirm;\n this.config = config;\n this.translate = translate;\n this.rs = rs;\n this.maxFileSize = this.getMaxFileSize();\n if (this.maxFileSize) {\n this.maxFileSizeFormated = sizeFormat(this.maxFileSize);\n }\n }\n\n AttachmentsService.prototype.sizeError = function(file) {\n var message;\n message = this.translate.instant(\"ATTACHMENT.ERROR_MAX_SIZE_EXCEEDED\", {\n fileName: file.name,\n fileSize: sizeFormat(file.size),\n maxFileSize: this.maxFileSizeFormated\n });\n return this.confirm.notify(\"error\", message);\n };\n\n AttachmentsService.prototype.validate = function(file) {\n if (this.maxFileSize && file.size > this.maxFileSize) {\n this.sizeError(file);\n return false;\n }\n return true;\n };\n\n AttachmentsService.prototype.getMaxFileSize = function() {\n return this.config.get(\"maxUploadFileSize\", null);\n };\n\n AttachmentsService.prototype.list = function(type, objId, projectId) {\n return this.rs.attachments.list(type, objId, projectId).then((function(_this) {\n return function(attachments) {\n return attachments.sortBy(function(attachment) {\n return attachment.get('order');\n });\n };\n })(this));\n };\n\n AttachmentsService.prototype[\"delete\"] = function(type, id) {\n return this.rs.attachments[\"delete\"](type, id);\n };\n\n AttachmentsService.prototype.saveError = function(file, data) {\n var message;\n message = \"\";\n if (file) {\n message = this.translate.instant(\"ATTACHMENT.ERROR_UPLOAD_ATTACHMENT\", {\n fileName: file.name,\n errorMessage: data.data._error_message\n });\n }\n return this.confirm.notify(\"error\", message);\n };\n\n AttachmentsService.prototype.upload = function(file, objId, projectId, type) {\n var promise;\n promise = this.rs.attachments.create(type, projectId, objId, file);\n promise.then(null, this.saveError.bind(this, file));\n return promise;\n };\n\n AttachmentsService.prototype.patch = function(id, type, patch) {\n var promise;\n promise = this.rs.attachments.patch(type, id, patch);\n promise.then(null, this.saveError.bind(this, null));\n return promise;\n };\n\n return AttachmentsService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgAttachmentsService\", AttachmentsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: check-permissions.service.coffee\n */\n\n(function() {\n var ChekcPermissionsService, taiga;\n\n taiga = this.taiga;\n\n ChekcPermissionsService = (function() {\n ChekcPermissionsService.$inject = [\"tgProjectService\"];\n\n function ChekcPermissionsService(projectService) {\n this.projectService = projectService;\n }\n\n ChekcPermissionsService.prototype.check = function(permission) {\n if (!this.projectService.project) {\n return false;\n }\n return this.projectService.project.get('my_permissions').indexOf(permission) !== -1;\n };\n\n return ChekcPermissionsService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgCheckPermissionsService\", ChekcPermissionsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: current-user.service.coffee\n */\n\n(function() {\n var CurrentUserService, groupBy, taiga;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n CurrentUserService = (function() {\n CurrentUserService.$inject = [\"tgProjectsService\", \"$tgStorage\", \"tgResources\"];\n\n function CurrentUserService(projectsService, storageService, rs) {\n this.projectsService = projectsService;\n this.storageService = storageService;\n this.rs = rs;\n this._user = null;\n this._projects = Immutable.Map();\n this._projectsById = Immutable.Map();\n this._joyride = null;\n taiga.defineImmutableProperty(this, \"projects\", (function(_this) {\n return function() {\n return _this._projects;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"projectsById\", (function(_this) {\n return function() {\n return _this._projectsById;\n };\n })(this));\n }\n\n CurrentUserService.prototype.isAuthenticated = function() {\n if (this.getUser() !== null) {\n return true;\n }\n return false;\n };\n\n CurrentUserService.prototype.getUser = function() {\n var userData;\n if (!this._user) {\n userData = this.storageService.get(\"userInfo\");\n if (userData) {\n userData = Immutable.fromJS(userData);\n this.setUser(userData);\n }\n }\n return this._user;\n };\n\n CurrentUserService.prototype.removeUser = function() {\n this._user = null;\n this._projects = Immutable.Map();\n this._projectsById = Immutable.Map();\n return this._joyride = null;\n };\n\n CurrentUserService.prototype.setUser = function(user) {\n this._user = user;\n return this._loadUserInfo();\n };\n\n CurrentUserService.prototype.bulkUpdateProjectsOrder = function(sortData) {\n return this.projectsService.bulkUpdateProjectsOrder(sortData).then((function(_this) {\n return function() {\n return _this.loadProjects();\n };\n })(this));\n };\n\n CurrentUserService.prototype.loadProjects = function() {\n return this.projectsService.getProjectsByUserId(this._user.get(\"id\")).then((function(_this) {\n return function(projects) {\n return _this.setProjects(projects);\n };\n })(this));\n };\n\n CurrentUserService.prototype.disableJoyRide = function(section) {\n if (section) {\n this._joyride[section] = false;\n } else {\n this._joyride = {\n backlog: false,\n kanban: false,\n dashboard: false\n };\n }\n return this.rs.user.setUserStorage('joyride', this._joyride);\n };\n\n CurrentUserService.prototype.loadJoyRideConfig = function() {\n return new Promise((function(_this) {\n return function(resolve) {\n if (_this._joyride !== null) {\n resolve(_this._joyride);\n return;\n }\n return _this.rs.user.getUserStorage('joyride').then(function(config) {\n _this._joyride = config;\n return resolve(_this._joyride);\n })[\"catch\"](function() {\n _this._joyride = {\n backlog: true,\n kanban: true,\n dashboard: true\n };\n _this.rs.user.createUserStorage('joyride', _this._joyride);\n return resolve(_this._joyride);\n });\n };\n })(this));\n };\n\n CurrentUserService.prototype._loadUserInfo = function() {\n return Promise.all([this.loadProjects()]);\n };\n\n CurrentUserService.prototype.setProjects = function(projects) {\n this._projects = this._projects.set(\"all\", projects);\n this._projects = this._projects.set(\"recents\", projects.slice(0, 10));\n this._projectsById = Immutable.fromJS(groupBy(projects.toJS(), function(p) {\n return p.id;\n }));\n return this.projects;\n };\n\n CurrentUserService.prototype.canCreatePrivateProjects = function() {\n var user;\n user = this.getUser();\n if (user.get('max_private_projects') !== null && user.get('total_private_projects') >= user.get('max_private_projects')) {\n return {\n valid: false,\n reason: 'max_private_projects',\n type: 'private_project'\n };\n }\n return {\n valid: true\n };\n };\n\n CurrentUserService.prototype.canCreatePublicProjects = function() {\n var user;\n user = this.getUser();\n if (user.get('max_public_projects') !== null && user.get('total_public_projects') >= user.get('max_public_projects')) {\n return {\n valid: false,\n reason: 'max_public_projects',\n type: 'public_project'\n };\n }\n return {\n valid: true\n };\n };\n\n CurrentUserService.prototype.canOwnProject = function(project) {\n var result, user;\n user = this.getUser();\n if (project.get('is_private')) {\n result = this.canCreatePrivateProjects();\n if (!result.valid) {\n return result;\n }\n if (user.get('max_memberships_private_projects') !== null && project.get('total_memberships') > user.get('max_memberships_private_projects')) {\n return {\n valid: false,\n reason: 'max_members_private_projects',\n type: 'private_project'\n };\n }\n } else {\n result = this.canCreatePublicProjects();\n if (!result.valid) {\n return result;\n }\n if (user.get('max_memberships_public_projects') !== null && project.get('total_memberships') > user.get('max_memberships_public_projects')) {\n return {\n valid: false,\n reason: 'max_members_public_projects',\n type: 'public_project'\n };\n }\n }\n return {\n valid: true\n };\n };\n\n return CurrentUserService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgCurrentUserService\", CurrentUserService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: lightbox-factory.service.coffee\n */\n\n(function() {\n var LightboxFactory;\n\n LightboxFactory = (function() {\n LightboxFactory.$inject = [\"$rootScope\", \"$compile\"];\n\n function LightboxFactory(rootScope, compile) {\n this.rootScope = rootScope;\n this.compile = compile;\n }\n\n LightboxFactory.prototype.create = function(name, attrs, scopeAttrs) {\n var elm, html, scope;\n scope = this.rootScope.$new();\n scope = _.merge(scope, scopeAttrs);\n elm = $(\"
\").attr(name, true).attr(\"tg-bind-scope\", true);\n if (attrs) {\n elm.attr(attrs);\n }\n elm.addClass(\"remove-on-close\");\n html = this.compile(elm)(scope);\n $(document.body).append(html);\n };\n\n return LightboxFactory;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgLightboxFactory\", LightboxFactory);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: paginate-response.service.coffee\n */\n\n(function() {\n var PaginateResponse;\n\n PaginateResponse = function() {\n return function(result) {\n var paginateResponse;\n paginateResponse = Immutable.Map({\n \"data\": result.get(\"data\"),\n \"next\": !!result.get(\"headers\")(\"x-pagination-next\"),\n \"prev\": !!result.get(\"headers\")(\"x-pagination-prev\"),\n \"current\": result.get(\"headers\")(\"x-pagination-current\"),\n \"count\": result.get(\"headers\")(\"x-pagination-count\")\n });\n return paginateResponse;\n };\n };\n\n angular.module(\"taigaCommon\").factory(\"tgPaginateResponseService\", PaginateResponse);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-logo.service.coffee\n */\n\n(function() {\n var ProjectLogoService,\n modulo = function(a, b) { return (+a % (b = +b) + b) % b; };\n\n ProjectLogoService = (function() {\n function ProjectLogoService() {\n var COLORS, IMAGES;\n IMAGES = [\"/\" + window._version + \"/images/project-logos/project-logo-01.png\", \"/\" + window._version + \"/images/project-logos/project-logo-02.png\", \"/\" + window._version + \"/images/project-logos/project-logo-03.png\", \"/\" + window._version + \"/images/project-logos/project-logo-04.png\", \"/\" + window._version + \"/images/project-logos/project-logo-05.png\"];\n COLORS = [\"rgba( 153, 214, 220, 1 )\", \"rgba( 213, 156, 156, 1 )\", \"rgba( 214, 161, 212, 1 )\", \"rgba( 164, 162, 219, 1 )\", \"rgba( 152, 224, 168, 1 )\"];\n this.logos = _.cartesianProduct(IMAGES, COLORS);\n }\n\n ProjectLogoService.prototype.getDefaultProjectLogo = function(slug, id) {\n var idx, key, logo;\n key = slug + \"-\" + id;\n idx = modulo(murmurhash3_32_gc(key, 42), this.logos.length);\n logo = this.logos[idx];\n return {\n src: logo[0],\n color: logo[1]\n };\n };\n\n return ProjectLogoService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgProjectLogoService\", ProjectLogoService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project.service.coffee\n */\n\n(function() {\n var ProjectService, taiga;\n\n taiga = this.taiga;\n\n ProjectService = (function() {\n ProjectService.$inject = [\"tgProjectsService\", \"tgXhrErrorService\"];\n\n function ProjectService(projectsService, xhrError) {\n this.projectsService = projectsService;\n this.xhrError = xhrError;\n this._project = null;\n this._section = null;\n this._sectionsBreadcrumb = Immutable.List();\n this._activeMembers = Immutable.List();\n taiga.defineImmutableProperty(this, \"project\", (function(_this) {\n return function() {\n return _this._project;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"section\", (function(_this) {\n return function() {\n return _this._section;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"sectionsBreadcrumb\", (function(_this) {\n return function() {\n return _this._sectionsBreadcrumb;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"activeMembers\", (function(_this) {\n return function() {\n return _this._activeMembers;\n };\n })(this));\n }\n\n ProjectService.prototype.setSection = function(section) {\n this._section = section;\n if (section) {\n return this._sectionsBreadcrumb = this._sectionsBreadcrumb.push(this._section);\n } else {\n return this._sectionsBreadcrumb = Immutable.List();\n }\n };\n\n ProjectService.prototype.setProjectBySlug = function(pslug) {\n return new Promise((function(_this) {\n return function(resolve, reject) {\n if (!_this.project || _this.project.get('slug') !== pslug) {\n return _this.projectsService.getProjectBySlug(pslug).then(function(project) {\n _this.setProject(project);\n return resolve();\n })[\"catch\"](function(xhr) {\n return _this.xhrError.response(xhr);\n });\n } else {\n return resolve();\n }\n };\n })(this));\n };\n\n ProjectService.prototype.setProject = function(project) {\n this._project = project;\n return this._activeMembers = this._project.get('members').filter(function(member) {\n return member.get('is_active');\n });\n };\n\n ProjectService.prototype.cleanProject = function() {\n this._project = null;\n this._activeMembers = Immutable.List();\n this._section = null;\n return this._sectionsBreadcrumb = Immutable.List();\n };\n\n ProjectService.prototype.hasPermission = function(permission) {\n return this._project.get('my_permissions').indexOf(permission) !== -1;\n };\n\n ProjectService.prototype.fetchProject = function() {\n var pslug;\n pslug = this.project.get('slug');\n return this.projectsService.getProjectBySlug(pslug).then((function(_this) {\n return function(project) {\n return _this.setProject(project);\n };\n })(this));\n };\n\n return ProjectService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgProjectService\", ProjectService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: scope-event.service.coffee\n */\n\n(function() {\n var ScopeEvent;\n\n ScopeEvent = (function() {\n function ScopeEvent() {}\n\n ScopeEvent.prototype.scopes = {};\n\n ScopeEvent.prototype._searchDuplicatedScopes = function(id) {\n return _.find(Object.keys(this.scopes), (function(_this) {\n return function(key) {\n return _this.scopes[key].$id === id;\n };\n })(this));\n };\n\n ScopeEvent.prototype._create = function(name, scope) {\n var duplicatedScopeName;\n duplicatedScopeName = this._searchDuplicatedScopes(scope.$id);\n if (duplicatedScopeName) {\n throw new Error(\"scopeEvent: this scope is already register with the name \\\"\" + duplicatedScopeName + \"\\\"\");\n }\n if (this.scopes[name]) {\n throw new Error(\"scopeEvent: \\\"\" + name + \"\\\" already in use\");\n } else {\n scope._tgEmitter = new EventEmitter2();\n scope.$on(\"$destroy\", (function(_this) {\n return function() {\n scope._tgEmitter.removeAllListeners();\n return delete _this.scopes[name];\n };\n })(this));\n return this.scopes[name] = scope;\n }\n };\n\n ScopeEvent.prototype.emitter = function(name, scope) {\n if (scope) {\n scope = this._create(name, scope);\n } else if (this.scopes[name]) {\n scope = this.scopes[name];\n } else {\n throw new Error(\"scopeEvent: \\\"\" + name + \"\\\" scope doesn't exist'\");\n }\n return scope._tgEmitter;\n };\n\n return ScopeEvent;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgScopeEvent\", ScopeEvent);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: theme.service.coffee\n */\n\n(function() {\n var ThemeService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n ThemeService = (function(superClass) {\n extend(ThemeService, superClass);\n\n function ThemeService() {\n return ThemeService.__super__.constructor.apply(this, arguments);\n }\n\n return ThemeService;\n\n })(taiga.Service = function() {\n return {\n use: function(themeName) {\n var stylesheetEl;\n stylesheetEl = $(\"link[rel='stylesheet']:first\");\n if (stylesheetEl.length === 0) {\n stylesheetEl = $(\"\");\n $(\"head\").append(stylesheetEl);\n }\n return stylesheetEl.attr(\"href\", \"/\" + window._version + \"/styles/theme-\" + themeName + \".css\");\n }\n };\n });\n\n angular.module(\"taigaCommon\").service(\"tgThemeService\", ThemeService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user.service.coffee\n */\n\n(function() {\n var UserService, bindMethods, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n bindMethods = taiga.bindMethods;\n\n UserService = (function(superClass) {\n extend(UserService, superClass);\n\n UserService.$inject = [\"tgResources\"];\n\n function UserService(rs) {\n this.rs = rs;\n bindMethods(this);\n }\n\n UserService.prototype.getUserByUserName = function(username) {\n return this.rs.users.getUserByUsername(username);\n };\n\n UserService.prototype.getContacts = function(userId) {\n return this.rs.users.getContacts(userId);\n };\n\n UserService.prototype.getLiked = function(userId, pageNumber, objectType, textQuery) {\n return this.rs.users.getLiked(userId, pageNumber, objectType, textQuery);\n };\n\n UserService.prototype.getVoted = function(userId, pageNumber, objectType, textQuery) {\n return this.rs.users.getVoted(userId, pageNumber, objectType, textQuery);\n };\n\n UserService.prototype.getWatched = function(userId, pageNumber, objectType, textQuery) {\n return this.rs.users.getWatched(userId, pageNumber, objectType, textQuery);\n };\n\n UserService.prototype.getStats = function(userId) {\n return this.rs.users.getStats(userId);\n };\n\n UserService.prototype.attachUserContactsToProjects = function(userId, projects) {\n return this.getContacts(userId).then(function(contacts) {\n projects = projects.map(function(project) {\n var contactsFiltered;\n contactsFiltered = contacts.filter(function(contact) {\n var contactId;\n contactId = contact.get(\"id\");\n return project.get('members').indexOf(contactId) !== -1;\n });\n project = project.set(\"contacts\", contactsFiltered);\n return project;\n });\n return projects;\n });\n };\n\n return UserService;\n\n })(taiga.Service);\n\n angular.module(\"taigaCommon\").service(\"tgUserService\", UserService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: xhrError.service.coffee\n */\n\n(function() {\n var xhrError,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n xhrError = (function(superClass) {\n extend(xhrError, superClass);\n\n xhrError.$inject = [\"$q\", \"$location\", \"$tgNavUrls\"];\n\n function xhrError(q, location, navUrls) {\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n }\n\n xhrError.prototype.notFound = function() {\n this.location.path(this.navUrls.resolve(\"not-found\"));\n return this.location.replace();\n };\n\n xhrError.prototype.permissionDenied = function() {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n return this.location.replace();\n };\n\n xhrError.prototype.response = function(xhr) {\n if (xhr) {\n if (xhr.status === 404) {\n this.notFound();\n } else if (xhr.status === 403) {\n this.permissionDenied();\n }\n }\n return this.q.reject(xhr);\n };\n\n return xhrError;\n\n })(taiga.Service);\n\n angular.module(\"taigaCommon\").service(\"tgXhrErrorService\", xhrError);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-attachment.directive.coffee\n */\n\n(function() {\n var UserTimelineAttachmentDirective;\n\n UserTimelineAttachmentDirective = function(template, $compile) {\n var isImage, link, validFileExtensions;\n validFileExtensions = [\".jpg\", \".jpeg\", \".bmp\", \".gif\", \".png\"];\n isImage = function(url) {\n url = url.toLowerCase();\n return _.some(validFileExtensions, function(extension) {\n return url.indexOf(extension, url - extension.length) !== -1;\n });\n };\n link = function(scope, el) {\n var is_image, templateHtml;\n is_image = isImage(scope.attachment.get('url'));\n if (is_image) {\n templateHtml = template.get(\"user-timeline/user-timeline-attachment/user-timeline-attachment-image.html\");\n } else {\n templateHtml = template.get(\"user-timeline/user-timeline-attachment/user-timeline-attachment.html\");\n }\n el.html(templateHtml);\n $compile(el.contents())(scope);\n return el.find(\"img\").error(function() {\n return this.remove();\n });\n };\n return {\n link: link,\n scope: {\n attachment: \"=tgUserTimelineAttachment\"\n }\n };\n };\n\n UserTimelineAttachmentDirective.$inject = [\"$tgTemplate\", \"$compile\"];\n\n angular.module(\"taigaUserTimeline\").directive(\"tgUserTimelineAttachment\", UserTimelineAttachmentDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-item-title.service.coffee\n */\n\n(function() {\n var UserTimelineItemTitle, unslugify;\n\n unslugify = this.taiga.unslugify;\n\n UserTimelineItemTitle = (function() {\n UserTimelineItemTitle.$inject = [\"$translate\", \"$sce\"];\n\n UserTimelineItemTitle.prototype._fieldTranslationKey = {\n 'status': 'COMMON.FIELDS.STATUS',\n 'subject': 'COMMON.FIELDS.SUBJECT',\n 'description_diff': 'COMMON.FIELDS.DESCRIPTION',\n 'points': 'COMMON.FIELDS.POINTS',\n 'assigned_to': 'COMMON.FIELDS.ASSIGNED_TO',\n 'severity': 'ISSUES.FIELDS.SEVERITY',\n 'priority': 'ISSUES.FIELDS.PRIORITY',\n 'type': 'ISSUES.FIELDS.TYPE',\n 'is_iocaine': 'TASK.FIELDS.IS_IOCAINE',\n 'is_blocked': 'COMMON.FIELDS.IS_BLOCKED'\n };\n\n UserTimelineItemTitle.prototype._params = {\n username: function(timeline, event) {\n var title_attr, url, user;\n user = timeline.getIn(['data', 'user']);\n if (user.get('is_profile_visible')) {\n title_attr = this.translate.instant('COMMON.SEE_USER_PROFILE', {\n username: user.get('username')\n });\n url = \"user-profile:username=timeline.getIn(['data', 'user', 'username'])\";\n return this._getLink(url, user.get('name'), title_attr);\n } else {\n return this._getUsernameSpan(user.get('name'));\n }\n },\n field_name: function(timeline, event) {\n var field_name;\n field_name = timeline.getIn(['data', 'value_diff', 'key']);\n return this.translate.instant(this._fieldTranslationKey[field_name]);\n },\n project_name: function(timeline, event) {\n var url;\n url = \"project:project=timeline.getIn(['data', 'project', 'slug'])\";\n return this._getLink(url, timeline.getIn([\"data\", \"project\", \"name\"]));\n },\n new_value: function(timeline, event) {\n var new_value, value;\n if (_.isArray(timeline.getIn([\"data\", \"value_diff\", \"value\"]).toJS())) {\n value = timeline.getIn([\"data\", \"value_diff\", \"value\"]).get(1);\n if (value === null && timeline.getIn([\"data\", \"value_diff\", \"key\"]) === 'assigned_to') {\n value = this.translate.instant('ACTIVITY.VALUES.UNASSIGNED');\n }\n new_value = value;\n } else {\n new_value = timeline.getIn([\"data\", \"value_diff\", \"value\"]).first().get(1);\n }\n return _.escape(new_value);\n },\n sprint_name: function(timeline, event) {\n var url;\n url = \"project-taskboard:project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['data', 'milestone', 'slug'])\";\n return this._getLink(url, timeline.getIn(['data', 'milestone', 'name']));\n },\n us_name: function(timeline, event) {\n var event_us, obj, text, url;\n obj = this._getTimelineObj(timeline, event).get('userstory');\n event_us = {\n obj: 'parent_userstory'\n };\n url = this._getDetailObjUrl(event_us);\n text = '#' + obj.get('ref') + ' ' + obj.get('subject');\n return this._getLink(url, text);\n },\n obj_name: function(timeline, event) {\n var obj, text, url;\n obj = this._getTimelineObj(timeline, event);\n url = this._getDetailObjUrl(event);\n if (event.obj === 'wikipage') {\n text = unslugify(obj.get('slug'));\n } else if (event.obj === 'milestone') {\n text = obj.get('name');\n } else {\n text = '#' + obj.get('ref') + ' ' + obj.get('subject');\n }\n return this._getLink(url, text);\n },\n role_name: function(timeline, event) {\n return _.escape(timeline.getIn(['data', 'value_diff', 'value']).keySeq().first());\n }\n };\n\n function UserTimelineItemTitle(translate, sce) {\n this.translate = translate;\n this.sce = sce;\n }\n\n UserTimelineItemTitle.prototype._translateTitleParams = function(param, timeline, event) {\n return this._params[param].call(this, timeline, event);\n };\n\n UserTimelineItemTitle.prototype._getTimelineObj = function(timeline, event) {\n return timeline.getIn(['data', event.obj]);\n };\n\n UserTimelineItemTitle.prototype._getDetailObjUrl = function(event) {\n var url;\n url = {\n \"issue\": [\"project-issues-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])\"],\n \"wikipage\": [\"project-wiki-page\", \":project=timeline.getIn(['data', 'project', 'slug']),slug=timeline.getIn(['obj', 'slug'])\"],\n \"task\": [\"project-tasks-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])\"],\n \"userstory\": [\"project-userstories-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])\"],\n \"parent_userstory\": [\"project-userstories-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'userstory', 'ref'])\"],\n \"milestone\": [\"project-taskboard\", \":project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['obj', 'slug'])\"]\n };\n return url[event.obj][0] + url[event.obj][1];\n };\n\n UserTimelineItemTitle.prototype._getLink = function(url, text, title) {\n title = title || text;\n return $('').attr('tg-nav', url).text(text).attr('title', title).prop('outerHTML');\n };\n\n UserTimelineItemTitle.prototype._getUsernameSpan = function(text) {\n var title;\n title = title || text;\n return $('').addClass('username').text(text).prop('outerHTML');\n };\n\n UserTimelineItemTitle.prototype._getParams = function(timeline, event, timeline_type) {\n var params;\n params = {};\n timeline_type.translate_params.forEach((function(_this) {\n return function(param) {\n return params[param] = _this._translateTitleParams(param, timeline, event);\n };\n })(this));\n return params;\n };\n\n UserTimelineItemTitle.prototype.getTitle = function(timeline, event, type) {\n var params, paramsKeys, translation;\n params = this._getParams(timeline, event, type);\n paramsKeys = {};\n Object.keys(params).forEach(function(key) {\n return paramsKeys[key] = '{{' + key + '}}';\n });\n translation = this.translate.instant(type.key, paramsKeys);\n Object.keys(params).forEach(function(key) {\n var find;\n find = '{{' + key + '}}';\n return translation = translation.replace(new RegExp(find, 'g'), params[key]);\n });\n return translation;\n };\n\n return UserTimelineItemTitle;\n\n })();\n\n angular.module(\"taigaUserTimeline\").service(\"tgUserTimelineItemTitle\", UserTimelineItemTitle);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-item-type.service.coffee\n */\n\n(function() {\n var UserTimelineType, timelineType;\n\n timelineType = function(timeline, event) {\n var types;\n types = [\n {\n check: function(timeline, event) {\n return event.obj === 'membership';\n },\n key: 'TIMELINE.NEW_MEMBER',\n translate_params: ['project_name'],\n member: function(timeline) {\n return Immutable.Map({\n user: timeline.getIn(['data', 'user']),\n role: timeline.getIn(['data', 'role'])\n });\n }\n }, {\n check: function(timeline, event) {\n return event.obj === 'project' && event.type === 'create';\n },\n key: 'TIMELINE.NEW_PROJECT',\n translate_params: ['username', 'project_name'],\n description: function(timeline) {\n return timeline.getIn(['data', 'project', 'description']);\n }\n }, {\n check: function(timeline, event) {\n return event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'attachments';\n },\n key: 'TIMELINE.UPLOAD_ATTACHMENT',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'create';\n },\n key: 'TIMELINE.US_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'issue' && event.type === 'create';\n },\n key: 'TIMELINE.ISSUE_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'wikipage' && event.type === 'create';\n },\n key: 'TIMELINE.WIKI_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'create' && !timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'create' && timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_CREATED_WITH_US',\n translate_params: ['username', 'project_name', 'obj_name', 'us_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'milestone' && event.type === 'create';\n },\n key: 'TIMELINE.MILESTONE_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return timeline.getIn(['data', 'comment']) && event.obj === 'userstory';\n },\n key: 'TIMELINE.NEW_COMMENT_US',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n text = timeline.getIn(['data', 'comment_html']);\n return $($.parseHTML(text)).text();\n }\n }, {\n check: function(timeline, event) {\n return timeline.getIn(['data', 'comment']) && event.obj === 'issue';\n },\n key: 'TIMELINE.NEW_COMMENT_ISSUE',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n text = timeline.getIn(['data', 'comment_html']);\n return $($.parseHTML(text)).text();\n }\n }, {\n check: function(timeline, event) {\n return timeline.getIn(['data', 'comment']) && event.obj === 'task';\n },\n key: 'TIMELINE.NEW_COMMENT_TASK',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n text = timeline.getIn(['data', 'comment_html']);\n return $($.parseHTML(text)).text();\n }\n }, {\n check: function(timeline, event) {\n return timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'moveInBacklog' && timeline.hasIn(['data', 'value_diff', 'value', 'backlog_order']) && event.type === 'change';\n },\n key: 'TIMELINE.US_MOVED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n if (timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'moveInBacklog' && event.type === 'change' && event.obj === 'userstory') {\n return timeline.getIn(['data', 'value_diff', 'value', 'milestone']).get(1) === null;\n }\n return false;\n },\n key: 'TIMELINE.US_REMOVED_FROM_MILESTONE',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'moveInBacklog' && event.type === 'change' && event.obj === 'userstory';\n },\n key: 'TIMELINE.US_ADDED_MILESTONE',\n translate_params: ['username', 'obj_name', 'sprint_name']\n }, {\n check: function(timeline, event) {\n if (timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'blocked' && event.type === 'change') {\n return timeline.getIn(['data', 'value_diff', 'value', 'is_blocked']).get(1) === true;\n }\n return false;\n },\n key: 'TIMELINE.BLOCKED',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n if (timeline.hasIn(['data', 'value_diff', 'value', 'blocked_note_html'])) {\n text = timeline.getIn(['data', 'value_diff', 'value', 'blocked_note_html']).get(1);\n return $($.parseHTML(text)).text();\n } else {\n return false;\n }\n }\n }, {\n check: function(timeline, event) {\n if (timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'blocked' && event.type === 'change') {\n return timeline.getIn(['data', 'value_diff', 'value', 'is_blocked']).get(1) === false;\n }\n return false;\n },\n key: 'TIMELINE.UNBLOCKED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'milestone' && event.type === 'change';\n },\n key: 'TIMELINE.MILESTONE_UPDATED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'wikipage' && event.type === 'change';\n },\n key: 'TIMELINE.WIKI_UPDATED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'points';\n },\n key: 'TIMELINE.US_UPDATED_POINTS',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value', 'role_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.US_UPDATED',\n translate_params: ['username', 'field_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'change';\n },\n key: 'TIMELINE.US_UPDATED_WITH_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'issue' && event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.ISSUE_UPDATED',\n translate_params: ['username', 'field_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'issue' && event.type === 'change';\n },\n key: 'TIMELINE.ISSUE_UPDATED_WITH_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && !timeline.getIn(['data', 'task', 'userstory']) && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.TASK_UPDATED',\n translate_params: ['username', 'field_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && timeline.getIn(['data', 'task', 'userstory']) && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.TASK_UPDATED_WITH_US',\n translate_params: ['username', 'field_name', 'obj_name', 'us_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && !timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_UPDATED_WITH_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_UPDATED_WITH_US_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'us_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'user' && event.type === 'create';\n },\n key: 'TIMELINE.NEW_USER',\n translate_params: ['username']\n }\n ];\n return _.find(types, function(obj) {\n return obj.check(timeline, event);\n });\n };\n\n UserTimelineType = (function() {\n function UserTimelineType() {}\n\n UserTimelineType.prototype.getType = function(timeline, event) {\n return timelineType(timeline, event);\n };\n\n return UserTimelineType;\n\n })();\n\n angular.module(\"taigaUserTimeline\").service(\"tgUserTimelineItemType\", UserTimelineType);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-item.directive.coffee\n */\n\n(function() {\n var UserTimelineItemDirective;\n\n UserTimelineItemDirective = function() {\n return {\n templateUrl: \"user-timeline/user-timeline-item/user-timeline-item.html\",\n scope: {\n timeline: \"=tgUserTimelineItem\"\n }\n };\n };\n\n angular.module(\"taigaUserTimeline\").directive(\"tgUserTimelineItem\", UserTimelineItemDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-pagination-sequence.service.coffee\n */\n\n(function() {\n var UserTimelinePaginationSequence;\n\n UserTimelinePaginationSequence = function() {\n var obj;\n obj = {};\n obj.generate = function(config) {\n var getContent, items, next, page;\n page = 1;\n items = Immutable.List();\n config.minItems = config.minItems || 20;\n next = function() {\n items = Immutable.List();\n return getContent();\n };\n getContent = function() {\n return config.fetch(page).then(function(response) {\n var data;\n page++;\n data = response.get(\"data\");\n if (config.filter) {\n data = config.filter(data);\n }\n if (config.map) {\n data = data.map(config.map);\n }\n items = items.concat(data);\n if (items.size < config.minItems && response.get(\"next\")) {\n return getContent();\n }\n return Immutable.Map({\n items: items,\n next: response.get(\"next\")\n });\n });\n };\n return {\n next: function() {\n return next();\n }\n };\n };\n return obj;\n };\n\n angular.module(\"taigaUserTimeline\").factory(\"tgUserTimelinePaginationSequenceService\", UserTimelinePaginationSequence);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/profile/profile-timeline/profile-timeline.controller.coffee\n */\n\n(function() {\n var UserTimelineController, mixOf, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n UserTimelineController = (function(superClass) {\n extend(UserTimelineController, superClass);\n\n UserTimelineController.$inject = [\"tgUserTimelineService\"];\n\n function UserTimelineController(userTimelineService) {\n this.userTimelineService = userTimelineService;\n this.timelineList = Immutable.List();\n this.scrollDisabled = false;\n this.timeline = null;\n if (this.projectId) {\n this.timeline = this.userTimelineService.getProjectTimeline(this.projectId);\n } else if (this.currentUser) {\n this.timeline = this.userTimelineService.getProfileTimeline(this.user.get(\"id\"));\n } else {\n this.timeline = this.userTimelineService.getUserTimeline(this.user.get(\"id\"));\n }\n }\n\n UserTimelineController.prototype.loadTimeline = function() {\n this.scrollDisabled = true;\n return this.timeline.next().then((function(_this) {\n return function(response) {\n _this.timelineList = _this.timelineList.concat(response.get(\"items\"));\n if (response.get(\"next\")) {\n _this.scrollDisabled = false;\n }\n return _this.timelineList;\n };\n })(this));\n };\n\n return UserTimelineController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n angular.module(\"taigaUserTimeline\").controller(\"UserTimeline\", UserTimelineController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline.directive.coffee\n */\n\n(function() {\n var UserTimelineDirective;\n\n UserTimelineDirective = function() {\n return {\n templateUrl: \"user-timeline/user-timeline/user-timeline.html\",\n controller: \"UserTimeline\",\n controllerAs: \"vm\",\n scope: {\n projectId: \"=projectid\",\n user: \"=\",\n currentUser: \"=\"\n },\n bindToController: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgUserTimeline\", UserTimelineDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline.service.coffee\n */\n\n(function() {\n var UserTimelineService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n UserTimelineService = (function(superClass) {\n extend(UserTimelineService, superClass);\n\n UserTimelineService.$inject = [\"tgResources\", \"tgUserTimelinePaginationSequenceService\", \"tgUserTimelineItemType\", \"tgUserTimelineItemTitle\"];\n\n function UserTimelineService(rs, userTimelinePaginationSequenceService, userTimelineItemType, userTimelineItemTitle) {\n this.rs = rs;\n this.userTimelinePaginationSequenceService = userTimelinePaginationSequenceService;\n this.userTimelineItemType = userTimelineItemType;\n this.userTimelineItemTitle = userTimelineItemTitle;\n }\n\n UserTimelineService.prototype._valid_fields = ['status', 'subject', 'description_diff', 'assigned_to', 'points', 'severity', 'priority', 'type', 'attachments', 'is_iocaine', 'content_diff', 'name', 'estimated_finish', 'estimated_start', 'blocked', 'moveInBacklog', 'milestone'];\n\n UserTimelineService.prototype._invalid = [\n {\n check: function(timeline) {\n var fieldKey, value_diff;\n value_diff = timeline.get(\"data\").get(\"value_diff\");\n if (value_diff) {\n fieldKey = value_diff.get('key');\n if (this._valid_fields.indexOf(fieldKey) === -1) {\n return true;\n } else if (fieldKey === 'attachments' && value_diff.get('value').get('new').size === 0) {\n return true;\n }\n }\n return false;\n }\n }, {\n check: function(timeline) {\n var event, value_diff;\n event = timeline.get('event_type').split(\".\");\n value_diff = timeline.get(\"data\").get(\"value_diff\");\n return event[2] === 'change' && value_diff === void 0;\n }\n }, {\n check: function(timeline) {\n var event;\n event = timeline.get('event_type').split(\".\");\n return event[2] === 'delete';\n }\n }, {\n check: function(timeline) {\n var event;\n event = timeline.get('event_type').split(\".\");\n return event[1] === 'project' && event[2] === 'change';\n }\n }, {\n check: function(timeline) {\n return !!timeline.get(\"data\").get(\"comment_deleted\");\n }\n }, {\n check: function(timeline) {\n var event, value_diff;\n event = timeline.get('event_type').split(\".\");\n value_diff = timeline.get(\"data\").get(\"value_diff\");\n if (value_diff && event[1] === \"task\" && event[2] === \"change\" && value_diff.get(\"key\") === \"milestone\") {\n return timeline.get(\"data\").get(\"value_diff\").get(\"value\");\n }\n return false;\n }\n }\n ];\n\n UserTimelineService.prototype._isInValidTimeline = function(timeline) {\n return _.some(this._invalid, (function(_this) {\n return function(invalid) {\n return invalid.check.call(_this, timeline);\n };\n })(this));\n };\n\n UserTimelineService.prototype._parseEventType = function(event_type) {\n event_type = event_type.split(\".\");\n return {\n section: event_type[0],\n obj: event_type[1],\n type: event_type[2]\n };\n };\n\n UserTimelineService.prototype._getTimelineObject = function(timeline, event) {\n if (timeline.get('data').get(event.obj)) {\n return timeline.get('data').get(event.obj);\n }\n };\n\n UserTimelineService.prototype._attachExtraInfoToTimelineEntry = function(timeline, event, type) {\n var title;\n title = this.userTimelineItemTitle.getTitle(timeline, event, type);\n timeline = timeline.set('title_html', title);\n timeline = timeline.set('obj', this._getTimelineObject(timeline, event));\n if (type.description) {\n timeline = timeline.set('description', type.description(timeline));\n }\n if (type.member) {\n timeline = timeline.set('member', type.member(timeline));\n }\n if (timeline.getIn(['data', 'value_diff', 'key']) === 'attachments' && timeline.hasIn(['data', 'value_diff', 'value', 'new'])) {\n timeline = timeline.set('attachments', timeline.getIn(['data', 'value_diff', 'value', 'new']));\n }\n return timeline;\n };\n\n UserTimelineService.prototype._parseTimeline = function(response) {\n var newdata;\n newdata = Immutable.List();\n response.get('data').forEach((function(_this) {\n return function(item) {\n var data, event, newItem, values_diff;\n event = _this._parseEventType(item.get('event_type'));\n data = item.get('data');\n values_diff = data.get('values_diff');\n if (values_diff && values_diff.count()) {\n if (values_diff.has('is_blocked')) {\n values_diff = Immutable.Map({\n 'blocked': values_diff\n });\n }\n if (values_diff.has('milestone')) {\n if (event.obj === 'userstory') {\n values_diff = Immutable.Map({\n 'moveInBacklog': values_diff\n });\n } else {\n values_diff = values_diff.deleteIn(['values_diff', 'milestone']);\n }\n } else if (event.obj === 'milestone') {\n values_diff = Immutable.Map({\n 'milestone': values_diff\n });\n }\n return values_diff.forEach(function(value, key) {\n var newItem, obj;\n obj = Immutable.Map({\n key: key,\n value: value\n });\n newItem = item.setIn(['data', 'value_diff'], obj);\n newItem = newItem.deleteIn(['data', 'values_diff']);\n return newdata = newdata.push(newItem);\n });\n } else {\n newItem = item.deleteIn(['data', 'values_diff']);\n return newdata = newdata.push(newItem);\n }\n };\n })(this));\n return response.set('data', newdata);\n };\n\n UserTimelineService.prototype._addEntyAttributes = function(item) {\n var event, type;\n event = this._parseEventType(item.get('event_type'));\n type = this.userTimelineItemType.getType(item, event);\n return this._attachExtraInfoToTimelineEntry(item, event, type);\n };\n\n UserTimelineService.prototype.getProfileTimeline = function(userId) {\n var config;\n config = {};\n config.fetch = (function(_this) {\n return function(page) {\n return _this.rs.users.getProfileTimeline(userId, page).then(function(response) {\n return _this._parseTimeline(response);\n });\n };\n })(this);\n config.map = (function(_this) {\n return function(obj) {\n return _this._addEntyAttributes(obj);\n };\n })(this);\n config.filter = (function(_this) {\n return function(items) {\n return items.filterNot(function(item) {\n return _this._isInValidTimeline(item);\n });\n };\n })(this);\n return this.userTimelinePaginationSequenceService.generate(config);\n };\n\n UserTimelineService.prototype.getUserTimeline = function(userId) {\n var config;\n config = {};\n config.fetch = (function(_this) {\n return function(page) {\n return _this.rs.users.getUserTimeline(userId, page).then(function(response) {\n return _this._parseTimeline(response);\n });\n };\n })(this);\n config.map = (function(_this) {\n return function(obj) {\n return _this._addEntyAttributes(obj);\n };\n })(this);\n config.filter = (function(_this) {\n return function(items) {\n return items.filterNot(function(item) {\n return _this._isInValidTimeline(item);\n });\n };\n })(this);\n return this.userTimelinePaginationSequenceService.generate(config);\n };\n\n UserTimelineService.prototype.getProjectTimeline = function(projectId) {\n var config;\n config = {};\n config.fetch = (function(_this) {\n return function(page) {\n return _this.rs.projects.getTimeline(projectId, page).then(function(response) {\n return _this._parseTimeline(response);\n });\n };\n })(this);\n config.map = (function(_this) {\n return function(obj) {\n return _this._addEntyAttributes(obj);\n };\n })(this);\n config.filter = (function(_this) {\n return function(items) {\n return items.filterNot(function(item) {\n return _this._isInValidTimeline(item);\n });\n };\n })(this);\n return this.userTimelinePaginationSequenceService.generate(config);\n };\n\n return UserTimelineService;\n\n })(taiga.Service);\n\n angular.module(\"taigaUserTimeline\").service(\"tgUserTimelineService\", UserTimelineService);\n\n}).call(this);\n\n//# sourceMappingURL=maps/app.js.map\n"]} \ No newline at end of file +{"version":3,"sources":["app.js"],"names":["configure","i18nInit","init","module","modules","pluginsWithModule","taiga","this","taigaContribPlugins","window","generateHash","components","_","map","x","JSON","stringify","hex_sha1","join","generateUniqueSessionIdentifier","date","randomNumber","Date","getTime","Math","floor","random","sessionId","$routeProvider","$locationProvider","$httpProvider","$provide","$tgEventsProvider","$compileProvider","$translateProvider","$translatePartialLoaderProvider","$animateProvider","authHttpIntercept","blockingIntercept","decorators","defaultHeaders","loaderIntercept","originalWhen","preferedLangCode","userInfo","versionCheckHttpIntercept","classNameFilter","when","path","route","resolve","angular","extend","languageLoad","$q","$translate","deferred","defer","then","promise","call","templateUrl","controller","controllerAs","loader","title","description","joyride","reloadOnSearch","access","requiresLogin","section","redirectTo","params","pslug","disableHeader","mobileViewport","otherwise","html5Mode","enabled","requireBase","Content-Type","Accept-Language","taigaConfig","defaultLanguage","X-Session-Id","defaults","headers","patch","post","put","get","useApplyAsync","setSessionId","$location","$navUrls","$lightboxService","httpResponseError","response","nextUrl","status","config","cancelable","closeAll","replace","url","indexOf","encodeURIComponent","search","reject","responseError","factory","interceptors","push","loaderService","request","logRequest","requestError","rejection","logResponse","$injector","data","version","element","injector","invoke","_this","$confirm","versionErrorMsg","instant","notify","$routeParams","redirectToBlockedPage","responseOk","blockedUrl","currentUrl","project","blocked_code","debugInfoEnabled","debugInfo","localStorage","parse","lang","addPart","useLoader","urlTemplate","_version","useSanitizeValueStrategy","addInterpolation","preferredLanguage","fallbackLanguage","getDecorators","each","decorator","provider","messages","moment","locale","defaultMessage","type","email","urlstrict","number","digits","dateIso","alphanum","phone","notnull","notblank","required","regexp","min","max","range","minlength","maxlength","rangelength","mincheck","maxcheck","rangecheck","equalto","linewidth","pikaday","checksley","updateMessages","$log","$rootscope","$auth","$events","$analytics","appMetaService","projectService","navigationBarService","un","user","validators","debug","$on","refresh","val","width","lines","valid","nl2br","split","every","line","length","prettyDate","isValid","updateValidators","contribPlugins","adminPlugins","filter","userSettingsPlugins","e","ctx","language","Promise","setScheduler","cb","$evalAsync","setupConnection","isAuthenticated","getUser","initialize","event","next","start","setSection","setProjectBySlug","cleanProject","setAll","addMobileViewport","removeMobileViewport","enableHeader","plugin","value","concat","run","TaigaBase","TaigaController","TaigaService","child","parent","ctor","constructor","key","hasProp","prototype","__super__","hasOwnProperty","bind","fn","me","apply","arguments","superClass","onInitialDataError","xhr","location","navUrls","q","Base","Service","Controller","bindMethods","bindOnce","cancelTimeout","debounce","debounceLeading","defineImmutableProperty","groupBy","isImage","joinStr","mixOf","replaceTags","scopeDefer","sizeFormat","slugify","startswith","stripTags","timeout","toString","toggleText","trim","truncate","unslugify","item","i","l","slice","str","breakTag","object","dependencies","methods","keys","forIn","bindAll","scope","attr","continuation","delBind","$eval","$watch","Mixed","base","method","mixin","mixins","name","ref","char","toLowerCase","capitalize","texts","nextTextPosition","text","coll","pred","len","result","wait","setTimeout","timeoutVar","clearTimeout","func","$apply","isNumber","isString","isPlainObject","isUndefined","leading","trailing","str1","str2","startsWith","maxLength","suffix","out","String","substring","lastIndexOf","input","precision","size","units","isNaN","parseFloat","isFinite","log","pow","toFixed","exception","pattern","RegExp","tags","obj","Object","defineProperty","fn_result","isFunction","isObject","removeKeys","chain","flatten","reduce","cartesianProduct","reduceRight","a","b","y","match","oldImmutable","newImmutable","pathObj","forEach","newValue","toJS","FiltersMixin","PageMixin","fillUsersAndRoles","users","roles","activeUsers","computableRoles","is_active","sortBy","activeUsersById","id","usersById","members","uniq","includes","loadUsersAndRoles","all","rs","projects","usersList","projectId","rolesList","results","selectFilter","load","existing","compact","isInCurrentRouteParams","noreload","replaceFilter","replaceAllFilters","filters","unselectFilter","newValues","parsedValues","isEmpty","AuthService","CancelAccountDirective","ChangeEmailDirective","ChangePasswordFromRecoveryDirective","ForgotPasswordDirective","InvitationDirective","LoginDirective","LoginPage","PublicRegisterMessageDirective","RegisterDirective","currentUserService","$inject","rootscope","storage","model","http","urls","translate","currentUserService1","themeService","userModel","_currentTheme","_getUserTheme","setUserdata","userData","Immutable","fromJS","getAttrs","setUser","theme","_setTheme","newTheme","use","_setLocales","make_model","auth","set","clear","remove","setToken","token","getToken","removeToken","auth_token","login","clone","logout","removeUser","register","getInvitation","invitations","acceptInvitiationWithNewUser","acceptInvitiationWithExistingUser","forgotPassword","changePasswordFromRecovery","changeEmail","cancelAccount","service","$config","templates","template","templateFn","publicRegisterEnabled","restrict","directive","link","$scope","$el","$attrs","form","onError","onSuccess","submit","Form","find","decodeURIComponent","loginFormType","preventDefault","validate","username","password","on","prerenderReady","off","onErrorSubmit","onSuccessSubmit","onlyOneErrorElement","trackEvent","_error_message","error","setErrors","message","success","$params","tokenInParams","loginForm","onErrorSubmitLogin","onErrorSubmitRegister","onSuccessSubmitLogin","onSuccessSubmitRegister","registerForm","submitLogin","submitRegister","invitation","dataLogin","project_slug","project_name","dataRegister","escape","$repo","$model","email_token","queryOne","cancel_token","TaigaMainDirective","$window","onresize","$broadcast","home","not-found","permission-denied","discover","discover-search","forgot-password","change-password","change-email","cancel-account","create-project","profile","user-profile","blocked-project","project-backlog","project-taskboard","project-kanban","project-issues","project-search","project-userstories-detail","project-tasks-detail","project-issues-detail","project-wiki","project-wiki-page","project-team","project-admin-home","project-admin-project-profile-details","project-admin-project-profile-default-values","project-admin-project-profile-modules","project-admin-project-profile-export","project-admin-project-profile-reports","project-admin-project-values-status","project-admin-project-values-points","project-admin-project-values-priorities","project-admin-project-values-severities","project-admin-project-values-types","project-admin-project-values-custom-fields","project-admin-memberships","project-admin-roles","project-admin-third-parties-webhooks","project-admin-third-parties-github","project-admin-third-parties-gitlab","project-admin-third-parties-bitbucket","project-admin-contrib","user-settings-user-profile","user-settings-user-change-password","user-settings-user-avatar","user-settings-mail-notifications","user-settings-contrib","$navurls","update","AnimationFrame","Capslock","CheckPermissionDirective","ClassPermissionDirective","DataPickerConfig","ProjectUrl","Qqueue","SelectedText","Template","ToggleCommentDirective","i18n","previousMonth","nextMonth","months","weekdays","weekdaysShort","isRTL","firstDay","parseInt","format","$document","getSelection","selection","createRange","render","permission","removeClass","unObserve","unwatch","addClass","tgCheckPermission","$observe","checkPermissions","tgClassPermissionWatchAction","unbindWatcher","className","negation","my_permissions","classes","add","animationFrame","performAnimation","tail","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","time","shift","slug","is_backlog_activated","is_kanban_activated","is_wiki_activated","is_issues_activated","lastPromise","qqueue","bindAdd","args","$templateCache","lodash","tmp","hideIcon","open","showIcon","warningIcon","$","fadeOut","currentTarget","append","fadeIn","EventsProvider","EventsService","win","liveAnnouncementService1","rootScope","liveAnnouncementService","processMessage","subscriptions","connected","pendingMessages","missedHeartbeats","heartbeatInterval","WebSocket","info","loc","scheme","stopExistingConnection","protocol","trimStart","host","ws","addEventListener","onOpen","onMessage","onClose","removeEventListener","stopHeartBeatMessages","close","notifications","subscribe","show","desc","$digest","startHeartBeatMessages","heartbeatIntervalTime","maxMissedHeartbeats","setInterval","error1","Error","sendMessage","cmd","clearInterval","processHeartBeatPongMessage","serialize","msg","send","routingKey","subscription","routing_key","callback","unsubscribe","$get","$win","$conf","$rootScope","FeedbackDirective","$loading","feedbackService","openLightbox","submitButton","currentLoading","target","create","feedback","finish","focus","RelatedTaskAssignedToInlineEditionDirective","RelatedTaskCreateButtonDirective","RelatedTaskCreateFormDirective","RelatedTaskRowDirective","RelatedTasksDirective","$compile","$template","templateEdit","templateView","renderEdit","renderView","saveTask","task","subject","save","html","keyCode","$modelValue","perms","modify_task","delete_task","select","askOnDelete","askResponse","$emit","ngModel","require","$tgmodel","newTask","assigned_to","createTask","default_task_status","newRelatedTaskFormOpen","us","$rs","_isEditable","_isVisible","loadTasks","tasks","list","usId","showRelatedTasks","$ctrl","autoSave","notAutoSave","updateRelatedTask","member","imgurl","photo","full_name_display","tgRelatedTaskAssignedToInlineEdition","unbind","userId","updatedRelatedTask","ResourcesService","initResources","initUrls","auth-register","by_username","users-password-recovery","users-change-password-from-recovery","users-change-password","users-change-email","users-cancel-account","user-stats","user-liked","user-voted","user-watched","user-contacts","user-me","permissions","notify-policies","user-storage","memberships","bulk-create-memberships","resolver","project-templates","project-modules","bulk-update-projects-order","project-like","project-unlike","project-watch","project-unwatch","project-transfer-validate-token","project-transfer-accept","project-transfer-reject","project-transfer-request","project-transfer-start","userstory-statuses","points","task-statuses","issue-statuses","issue-types","priorities","severities","milestones","userstories","bulk-create-us","bulk-update-us-backlog-order","bulk-update-us-sprint-order","bulk-update-us-kanban-order","userstories-filters","userstory-upvote","userstory-downvote","userstory-watch","userstory-unwatch","bulk-create-tasks","bulk-update-task-taskboard-order","task-upvote","task-downvote","task-watch","task-unwatch","issues","bulk-create-issues","issues-filters","issue-upvote","issue-downvote","issue-watch","issue-unwatch","wiki","wiki-restore","wiki-links","history/us","history/issue","history/task","history/wiki","attachments/us","attachments/issue","attachments/task","attachments/wiki_page","custom-attributes/userstory","custom-attributes/issue","custom-attributes/task","custom-attributes-values/userstory","custom-attributes-values/issue","custom-attributes-values/task","webhooks","webhooks-test","webhooklogs","webhooklogs-resend","userstories-csv","tasks-csv","issues-csv","timeline-profile","timeline-user","timeline-project","exporter","importer","locales","applications","application-tokens","stats-discover","$urls","providers","toArray","SearchBoxDirective","SearchController","SearchDirective","scope1","repo","loadSearchData","sectionName","loadInitialData","projectName","projectDescription","searchTerm","t","searchResults","term","loadFilters","defered","loadProject","getBySlug","issueStatusById","issue_statuses","taskStatusById","task_statuses","severityById","priorityById","usStatusById","us_statuses","loading","_loadSearchData","_promise","abort","$route","reload","$templatecache","$routeparams","linkTable","activeSectionName","applyAutoTab","getActiveSection","lastSearchResults","markSectionTabActive","renderFilterTabs","renderTableContent","tabsDom","maxVal","selectedSection","wikipages","oldElements","oldScope","children","$destroy","$new","parseHTML","activeSection","sectionData","searchText","AnalyticsService","doc","conf","initialized","accountId","pageEvent","trackRoutes","ignoreFirstPageLoad","injectAnalytics","ga","getUrl","trackPage","s","o","g","r","m","createElement","getElementsByTagName","async","src","parentNode","insertBefore","document","page","category","action","label","BindScope","jQuery","CompileHtmlDirective","attrs","tgCompileHtml","oldValue","contents","AssignedToDirective","BlockButtonDirective","CreatedByDisplayDirective","DateRangeDirective","DateSelectorDirective","DeleteButtonDirective","EditableDescriptionDirective","EditableSubjectDirective","EditableWysiwyg","ListItemAssignedtoDirective","ListItemIssueStatusDirective","ListItemPriorityDirective","ListItemSeverityDirective","ListItemTaskStatusDirective","ListItemTypeDirective","ListItemUsStatusDirective","SprintProgressBarDirective","TgMainTitleDirective","TgProgressBarDirective","WatchersDirective","renderRange","first","second","endDate","initDate","tgDateRange","valFirst","valSecond","datePickerConfigService","selectedDate","datePickerConfig","merge","field","onSelect","picker","setDate","Pikaday","renderProgress","percentage","visual_percentage","hasClass","css","tgSprintProgressbar","sprint","closedPoints","totalPoints","closed_points","total_points","round","owner","owner_extra_info","created_date","$qqueue","deleteWatcher","isEditable","renderWatchers","ref1","requiredPerm","watchers","$setViewValue","watcherId","revert","watcherIds","pull","$currentUserService","renderAssignedTo","assignedObject","fullName","isIocaine","isUnassigned","assigned_to_extra_info","is_iocaine","fullNameVisible","ask","instance","is_blocked","onDeleteGoToUrl","onDeleteTitle","subtitle","hide","click","$selectedText","noDescriptionMegEditMode","noDescriptionMegReadMode","is","href","scrollTop","offset","top","noDescriptionMsg","attachmentsService","attachmentsFullService","isInEditMode","uploadFile","file","addAttachment","getIn","textarea","dataTransfer","promises","stopPropagation","originalEvent","files","markItUp","replaceWith","tgListitemUsStatus","tgListitemTaskStatus","tgListitemAssignedto","issue","tgListitemIssueStatus","issueTypeById","domNode","color","tgListitemType","priority","tgListitemPriority","severity","tgListitemSeverity","el","tgProgressBar","i18nSectionName","ConfirmService","NOTIFICATION_MSG","light-error","lightboxService","lightboxSelector","ok","askChoice","choices","replacement","warning","choicesField","selected","icon","detailImage","useSVG","createElementNS","setAttributeNS","classList","appendChild","prepend","stop","percent","body","selector","tsem","one","CustomAttributeValueDirective","CustomAttributesValuesController","CustomAttributesValuesDirective","DATE_TYPE","MULTILINE_TYPE","TEXT_TYPE","TYPE_CHOICES","URL_TYPE","confirm","objectId","customAttributes","customAttributesValues","loadCustomAttributesValues","getAttributeValue","attribute","attributeValue","attributes_values","updateAttributeValue","attributesValues","$templates","$storage","collapsedHash","$ctrls","collapsed","hash","requiredEditionPerm","setFocusAndSelectOnInputField","edit","editable","tgCustomAttributeValue","EstimationsService","LbUsEstimationDirective","UsEstimationDirective","$tgEstimationsService","estimationProcess","onSelectedPointForRole","roleId","pointId","mainTemplate","calculateTotalPoints","calculateRoles","EstimationProcess","pointsTemplate","$el1","us1","project1","bindClickEvents","pointsById","notNullValues","values","v","k","acc","num","role","pointObj","renderPointsSelector","siblings","popover","horizontalList","maxPointLength","pop","point","some","horizontal","closest","height","clientHeight","defaultFilter","momentFormat","momentFromNow","yesNoFilter","defaultValue","without_suffix","fromNow","HistoryController","HistoryDirective","IGNORED_FIELDS","userstories.userstory","tasks.task","issues.issue","loadHistory","history","changeModel","historyEntry","historyResult","j","len1","values_diff","description_diff","description_html","blocked_note_diff","blocked_note","blocked_note_html","comments","comment","deleteComment","activityId","undeleteComment","checkPermissionsService","templateActivity","templateBase","templateBaseEntries","templateChangeAttachment","templateChangeDiff","templateChangeGeneric","templateChangeList","templateChangePoints","templateDeletedComment","countChanges","formatChange","getHumanizedFieldName","getPrettyDateFormat","renderActivity","renderAttachmentEntry","renderBase","renderChange","renderChangeEntries","renderChangeEntry","renderChangesHelperText","renderComment","renderComments","renderCustomAttributesEntry","renderHistory","rerender","showAllActivity","showAllComments","humanizedFieldNames","content","is_closed","finish_date","milestone","user_story","client_requirement","team_requirement","attachments","is_deprecated","order","backlog_order","sprint_order","kanban_order","taskboard_order","us_order","change","isArray","changes","diff","filename","from","to","outerHTML","customAttrsChanges","added","removed","difference","ref2","delete_comment_date","delete_comment_user","deleteCommentDate","deleteCommentUser","comment_html","canRestoreComment","pk","avatar","userFullName","userProfileUrl","creationDate","created_at","changesText","mode","deleteCommentActionTitle","canDeleteComment","entries","totalEntries","showMore","commentsVisible","historyVisible","check","ngmodel","totalComments","takeRight","totalChanges","parents","toggleClass","ImportProjectButtonDirective","LbImportErrorDirective","$lightboxFactory","$tgAuth","getRestrictionError","errorKey","maxMemberships","membersError","privateError","publicError","isPrivate","canCreatePrivateProjects","canCreatePublicProjects","max_memberships","trigger","loadProjects","errorMsg","restrictionError","class","error_message","AssignedToLightboxDirective","AttachmentPreviewLightboxDirective","BlockLightboxDirective","BlockingMessageInputDirective","CreateBulkUserstoriesDirective","CreateEditUserstoryDirective","LightboxDirective","LightboxKeyboardNavigationService","LightboxLeaveProjectWarningDirective","LightboxService","WatchersLightboxDirective","docEl","lightboxContent","not","code","which","removeAttr","lightboxEl","dispatch","activeElement","prev","$tgrepo","block","unblock","finishCallback","watch","attachmentsToAdd","attachmentsToDelete","createAttachments","deleteAttachments","resetAttachments","createEditUs","isNew","List","attachment","deleteAttachment","statusList","reset","usStatusList","is_archived","upload","broadcastEvent","keydown","statusId","bulk","bulkCreate","lightboxKeyboardNavigationService","closeLightbox","filterUsers","normalizeString","selectedItem","selectedUser","usersTemplate","string","normalizedString","toUpperCase","partial","assignedToId","searchingText","usersSearch","getFilteredUsers","_filterUsers","Loader","LoaderDirective","tgLoader","onStart","onEnd","autoClose","lastResponseDate","pageLoaded","requestCount","startLoadTime","minTime","force","endTime","timeoutValue","intervalAuto","auto","LoadingDirective","TgLoadingService","spinner","settings","removeClasses","classess","timeoutId","tgLoading","showLoading","RelatedTaskStatusDirective","UsStatusDirective","usStatusDom","usStatusDomParent","tgUsStatus","onUpdate","statuses","selectionTemplate","updateTaskStatus","taskStatusDom","taskStatusDomParent","tgRelatedTaskStatus","closePopover","isVisible","docViewBottom","docViewLeft","docViewRight","docViewTop","docViewWidth","elemBottom","elemLeft","elemRight","elemTop","elemWidth","display","visibility","left","ExceptionHandlerFactory","ravenConfig","Raven","install","cause","captureException","ColorizeTagsDirective","LbTagLineDirective","TagLineDirective","TagsDirective","formatter","parser","$formatters","$parsers","backlog","kanban","taskboard","srcTags","tgColorizeTagsType","sort","tag","tags_colors","tgColorizeTags","COMMA_KEY","ENTER_KEY","templateTags","addValue","deleteValue","hideSaveButton","renderTags","resetInput","saveInputTag","showSaveButton","tagsColors","style","autocomplete","fromCharCode","positioningFunction","position","elements","menu","source","my","using","ui","ESC_KEY","hideAddTagButton","hideAddTagButtonText","hideInput","renderInReadModeOnly","showAddTagButton","showAddTagButtonText","showInput","blur","MarkitupDirective","previewTemplate","addLine","cancelablePromise","closePreviewMode","markdownTitle","prepareUrlFormatting","preview","previewDomNode","previewInProgress","renderMarkItUp","setCaretPosition","urlFormatting","markItUpDomNode","markdownDomNode","mdrender","markdown","caretPosition","scrollRelation","totalLines","createTextRange","move","selectionStart","setSelectionRange","scrollHeight","nline","cursorPosition","indices","regex","exec","index","donotparse","endIndex","startIndex","heading","n","placeHolder","markdownSettings","nameSpace","onShiftEnter","keepDefault","openWith","onEnter","afterInsert","cursorLine","emptyListItem","lastLine","markdownCaretPositon","newLineContent","markupSet","closeWith","separator","beforeInsert","markItUpRemove","textcomplete","cache","searchProps","searchTypes","prop","res","count","BacklogFiltersDirective","templateSelected","currentFiltersType","getFiltersType","initializeSelectedFilters","reloadUserstories","renderFilters","renderSelectedFilters","selectQFilter","selectedFilters","showCategories","showFilters","toggleFilterSelection","f","loadUserstories","generateFilters","currentFilters","CreateEditSprint","createSprint","getLastSprint","hasErrors","resetSprint","estimated_start","estimated_finish","newSprint","copy","setAttr","sprintsCounter","__all__","milestonesCounter","openSprints","sortedSprints","sprints","closed","estimatedFinish","estimatedStart","lastSprint","lastSprintNameDom","editSprint","BacklogController","BacklogDirective","BurndownBacklogGraphDirective","TgBacklogProgressBarDirective","ToggleBurndownVisibility","UsPointsDirective","UsRolePointsSelectorDirective","params1","events","analytics","rs2","showTags","activeFilters","showGraphPlaceholder","initializeEventHandlers","getShowTags","loadProjectStats","loadSprints","loadClosedSprints","moveUs","unloadClosedSprints","initializeSubscription","routingKey1","routingKey2","toggleShowTags","storeShowTags","toggleActiveFilters","stats","defined_points","completedPercentage","total_milestones","closedSprints","totalClosedMilestones","user_stories","closedSprintsById","totalMilestones","totalOpenMilestones","reverse","sprintsById","currentSprint","findCurrentSprint","restoreFilters","selectedStatuses","selectedTags","oldSelectedTags","oldSelectedStatuses","filtersQ","filtersQOld","filterGrp","resetFilters","httpParams","getUrlFilters","storeQueryParams","listUnassigned","setSearchDataFilters","loadBacklog","closedMilestones","total_closed_milestones","prepareBulkUpdateData","uses","us_id","resortUserStories","items","isModified","usList","newUsIndex","newSprintId","len2","movedFromClosedSprint","movedToClosedSprint","oldSprintId","splice","Array","bulkUpdateBacklogOrder","bulkUpdateSprintOrder","console","len3","isFilterSelected","searchdata","urlfilters","results1","pick","filtersData","choicesFiltersFormat","tagsFilterFormat","byIdObject","markSelectedFilters","isSelected","omit","updateUserStoryStatus","editUserStory","$event","getByRef","deleteUserStory","without","addNewUs","default_us_status","addNewSprint","currentDate","end","doomLineTemplate","linkDoomLine","linkFilters","linkToolbar","showHideFilter","showHideTags","addDoomLineDom","getUsItems","reloadDoomLine","removeDoomlineDom","current_sum","domElement","assigned_points","before","rowElements","checkSelected","getUsToMove","lastChecked","moveToCurrentSprint","moveToLatestSprint","moveUssToSprint","shiftPressed","ussDom","itemScope","selectedUss","extraPoints","totalExtraPoints","ussCurrent","union","saveAll","moveToSprintDom","selectedUsDom","shiftKey","current","nextAll","prevAll","nextUntil","prevUntil","elm","ussToMove","hideText","showText","sidebar","filtersSearch","disableSelection","numberOfRoles","roleName","rolScope","$tgTemplate","rolesTemplate","bindClickElements","filteringRoleId","renderRolesSelector","selectedRoleId","updatingSelectedRoleId","tgBacklogUsPoints","popRolesDom","firstLoad","toggleGraph","isBurndownGraphCollapsed","redrawChart","dataToDraw","client_increment_line","colors","evolution_line","milestonesRange","optimal_line","options","team_increment_line","zero_line","ml","zip","fillColor","optimal","evolution","grid","borderWidth","right","bottom","borderColor","hoverable","xaxis","ticks","axisLabel","axisLabelUseCanvas","axisLabelFontSizePixels","axisLabelFontFamily","axisLabelPadding","tickFormatter","axis","yaxis","series","shadowSize","fill","radius","lineWidth","tooltip","tooltipOpts","xval","yval","flotItem","seriesIndex","sprintName","abs","empty","plot","adjustPercentaje","projectPointsPercentaje","closedPointsPercentaje","adjusted","tgBacklogProgressBar","definedPoints","BacklogEmptySortableDirective","BacklogSortableDirective","SprintSortableDirective","deleteElement","$tgConfirm","getUsIndex","filterError","sortable","cancel","connectWith","dropOnEmpty","placeholder","scroll","disableHorizontalScroll","tolerance","itemIndex","itemUs","forcePlaceholderSize","BacklogSprintDirective","BacklogSprintHeaderDirective","ToggleExcludeClosedSprintsVisualization","slideOptions","sprintTableMinHeight","toggleSprint","duration","easing","sprintArrow","sprintTable","tgBacklogSprint","slideToggle","compiledTemplate","estimatedDateRange","taskboardUrl","templateScope","assign","excludeClosedSprints","loadingElm","after","SprintGraphDirective","days","day","unshift","d","optimal_points","open_points","tickSize","last","daysNames","formattedDate","roundedValue","CreateBulkTasksDirective","CreateEditTaskDirective","sprintId","TaskboardController","TaskboardDirective","TaskboardSquishColumnDirective","TaskboardTaskDirective","TaskboardUserDirective","rs1","_setMeta","startDate","completedPoints","completedPointsSum","totalPointsSum","openTasks","totalTasks","total_tasks","loadTaskboard","taskMove","refreshTagsColors","loadSprintStats","loadSprint","pointsList","roleById","taskStatusList","remainingPointsSum","remainingTasks","completed_points","completed_tasks","usTasks","isPlaceholder","sslug","refreshTasksOrder","resortTasks","bulkUpdateTaskTaskboardOrder","task_id","addNewTask","editTaskAssignedTo","tableBodyDom","tableHeaderDom","scrollLeft","$rs2","editingTask","avatarWidth","maxColumnWidth","getCeilWidth","recalculateStatusColumnWidth","recalculateTaskboardWidth","refreshTaskboardTableWidth","setStatusColumnWidth","statusesFolded","getStatusColumnModes","usFolded","getUsRowModes","foldStatus","storeStatusColumnModes","foldUs","storeUsRowModes","tasksMatrixSize","sqrt","column","columnWidths","columns","totalWidth","outerWidth","total","statusFoldedWidth","clickable","username_label","TaskboardSortableDirective","itemEl","newParentScope","oldParentScope","tdom","handle","itemTask","newStatusId","newUsId","oldStatusId","oldUsId","parentEl","st","KanbanArchivedStatusHeaderDirective","KanbanArchivedStatusIntroDirective","KanbanController","KanbanDirective","KanbanSquishColumnDirective","KanbanUserDirective","KanbanUserstoryDirective","KanbanWipLimitDirective","defaultViewMode","viewModes","statusViewModes","onAssignedToChanged","loadUserStoriesForStatus","hideUserStoriesForStatus","changeUsAssignedTo","userid","status__is_archived","listAll","usByStatus","us_archived","loadKanban","generateStatusViewModes","storedStatusViewModes","getStatusViewModes","storeStatusViewModes","updateStatusViewMode","newViewMode","isMaximized","isMinimized","itemsToSave","bulkUpdateKanbanOrder","hideArchivedText","showArchivedText","hidden","tgKanbanArchivedStatusHeader","userStories","hiddenUserStoriexText","updateIntroText","tgKanbanArchivedStatusIntro","isArchived","userStoriesLoaded","editingUserStory","getTemplateUrl","updateTableWidth","folds","redrawWipLimit","tgKanbanWipLimit","wip_limit","wtid","tgKanbanUserAvatar","KanbanSortableDirective","IssueDetailController","IssuePriorityButtonDirective","IssueSeverityButtonDirective","IssueStatusButtonDirective","IssueStatusDisplayDirective","IssueTypeButtonDirective","PromoteIssueToUsButtonDirective","issueRef","issueref","initializeOnDeleteGoToUrl","ref3","issueSubject","issueStatus","statusById","issueType","typeById","issueSeverity","issuePriority","issueDescription","loadIssue","issue_types","typeList","severityList","priorityList","issueId","commentModel","neighbors","previous","previousUrl","onUpvote","upvote","onDownvote","downvote","onWatch","onUnwatch","typees","severityes","priorityes","generated_from_issue","CreateBulkIssuesDirective","CreateIssueDirective","default_issue_status","default_issue_type","default_priority","default_severity","IssueAssignedToInlineEditionDirective","IssueStatusInlineEditionDirective","IssuesController","IssuesDirective","IssuesFiltersDirective","loadIssues","getFilters","storeFilters","issueStatusList","issueTypes","getUrlFilter","loadMyFilters","getMyFilters","removeNotExistingFiltersFromUrl","currentSearch","existingValues","filterName","filterValue","splittedValues","intersection","myFilters","types","assignedTo","createdBy","usersFiltersFormat","unknownOption","reformatedUsers","unknownItem","full_name","u","owners","loadIssuesRequests","urlFilters","models","paginatedBy","saveCurrentFiltersTo","newFilter","storeMyFilters","deleteMyFilter","addNewIssue","addIssuesInBulk","linkOrdering","linkPagination","$pagEl","afterCurrent","atBegin","atEnd","beforeCurrent","getNumPages","renderPagination","numPages","cpage","pages","showPrevious","showNext","pagenum","colHeadElement","currentOrder","finalOrder","newOrder","reloadIssues","unwatchIssues","filterId","customFilterName","loadPromise","currentfilterstype","updateIssueStatus","issueStatusDom","issueStatusDomParent","tgIssueStatusInlineEdition","updateIssue","tgIssueAssignedToInlineEdition","updatedIssue","UsClientRequirementButtonDirective","UsStatusButtonDirective","UsStatusDisplayDirective","UsTeamRequirementButtonDirective","UserStoryDetailController","usRef","usref","closedTasks","progressPercentage","userStoryRef","userStorySubject","userStoryStatus","userStoryPoints","userStoryDescription","userStoryClosedTasks","userStoryTotalTasks","userStoryProgressPercentage","allClosed","loadUs","kanbanStaus","noMilestone","order_by","canEdit","isRequired","TaskDetailController","TaskIsIocaineButtonDirective","TaskStatusButtonDirective","TaskStatusDisplayDirective","taskRef","taskref","taskSubject","taskStatus","taskDescription","loadTask","taskId","loadUserStory","LeaveProjectDirective","TeamController","TeamFiltersDirective","TeamMemberCurrentUserDirective","TeamMemberStatsDirective","TeamMembersDirective","membersFilter","setRole","filtersRole","loadMembers","totals","currentUser","issuesEnabled","tasksEnabled","wikiEnabled","loadMemberStats","memberStats","vals","statsKey","sum","_processStats","_processStat","stat","singleStat","userRoles","lightboxFactory","leaveConfirm","confirm_leave_project_text","leave_project_text","leave","isCurrentUser","EditableWikiContentDirective","WikiDetailController","WikiSummaryDirective","projectSlug","wikiSlug","wikiTitle","linksVisible","wikiPageName","wikiPageContent","totalEditions","editions","lastModifiedDate","modified_date","loadWiki","wikiId","loadWikiLinks","listLinks","wikiLinks","selectedWikiLink","checkLinksPerms","last_modifier","imgUrl","wikiPage","cancelEdition","disableEdition","getSelectedText","switchToEditMode","switchToReadMode","button","WikiNavDirective","addWikiLinkPermission","deleteWikiLinkPermission","linkId","linkSlug","newLink","ChangeOwnerLightboxController","ChangeOwnerLightboxDirective","LbRequestOwnershipDirective","LightboxAddMembersController","LightboxAddMembersDirective","LightboxAddMembersWarningMessageDirective","TransferProjectStartSuccessDirective","lightboxService1","pendingMembersCount","_defaultMaxInvites","_defaultRole","submitInvites","canAddUsers","memberInvites","membersLimit","total_memberships","addSingleMember","role_id","showWarningMessage","removeSingleMember","initializeFields","invites","bulkCreateMemberships","invitationText","_onSuccessInvite","_onErrorInvite","ctrl","bindToController","confirmService","transferRequest","commentOpen","limit","getUsers","currentOwnerId","userSearch","selectUser","transferStart","MembershipsController","MembershipsDirective","MembershipsRowActionsDirective","MembershipsRowAdminCheckboxDirective","MembershipsRowAvatarDirective","MembershipsRowRoleSelectorDirective","NoMoreMembershipsExplanationDirective","lightboxFactory1","i_am_admin","httpFilters","membership","is_user_active","addNewMembers","showLimitUsersWarningMessage","pending","user_email","isOwner","is_owner","tgMembershipsRowAvatar","tgMembershipsRowAdminCheckbox","inputId","is_admin","roleList","selectedRole","tgMembershipsRowRoleSelector","newRole","activedTemplate","pendingTemplate","tgMembershipsRowActions","resendInvitation","defaultMsg","AdminNavigationDirective","tgAdminNavigation","AdminProjectChangeOwnerDirective","AdminProjectRequestOwnershipDirective","AdminProjectRestrictionsDirective","CsvExporterController","CsvExporterIssuesController","CsvExporterTasksController","CsvExporterUserstoriesController","CsvIssueDirective","CsvTaskDirective","CsvUsDirective","ProjectDefaultValuesDirective","ProjectExportDirective","ProjectLogoDirective","ProjectLogoModelDirective","ProjectModulesDirective","ProjectProfileController","ProjectProfileDirective","tgAuth","prioritiesList","severitiesList","issueTypesList","openDeleteLightbox","newUrl","fetchProject","newVal","oldVal","videoconferences_extra_data","videoconferences","isVideoconferenceActivated","asyn_message","buttonsEl","dump_ready_text","hideButtons","hideResult","hideSpinner","loading_msg","loading_title","resultEl","resultMessageEl","resultTitleEl","setAsyncMessage","setAsyncTitle","setLoadingMessage","setLoadingTitle","setSyncMessage","setSyncTitle","showButtons","showErrorMode","showExportResultAsyncMode","showExportResultSyncMode","showLoadingMode","showResult","showSpinner","spinnerEl","syn_message","dumpUrl","_generateUuid","setCsvUuid","csvUrl","resolveAbsolute","csvUuid","uuid","regenerateUuid","sectionTitle","showSizeInfo","logoAttachment","changeLogo","removeLogo","$parse","modelSetter","tgProjectLogoModel","requestOwnership","changeOwner","project-id","active-users","current-owner-id","ColorSelectionDirective","ProjectCustomAttributesController","ProjectCustomAttributesDirective","ProjectValuesController","ProjectValuesDirective","ProjectValuesSectionController","moveValue","loadValues","resource","listValues","maxValueOrder","maxBy","itemValue","linkDragAndDrop","linkValue","goToBottomList","initializeNewValue","initializeTextTranslations","objName","saveNewValue","saveValue","valueType","objname","addNewElementText","table","formEl","row","editionRow","option","onSucces","moveTo","moveCustomAttributes","deleteCustomAttribute","saveCustomAttribute","createCustomAttribute","loadCustomAttributes","maxOrder","attrValues","attrModel","newIndex","idx","cancelCreate","cancelUpdate","hideAddButton","hideCancelButton","hideCreateForm","hideEditForm","resetNewAttr","revertChangesInCustomAttribute","showAddButton","showCancelButton","showCreateForm","showEditForm","sortableEl","itemAttr","newAttr","EditRoleDirective","NewRoleDirective","RolePermissionsDirective","RolesController","RolesDirective","_disableComputable","_enableComputable","anyComputableRole","computable","loadRoles","public_permission","external_user","public_permissions","askOnError","askOnSuccess","toggleComputable","toggleView","toggle","DEFAULT_PERMISSIONS","insertPosition","baseTemplate","categoryTemplate","resumeTemplate","generateCategoriesFromRole","renderCategory","renderPermissions","renderResume","categories","isPermissionEditable","issuePermissions","milestonePermissions","setActivePermissions","setActivePermissionsPerCategory","taskPermissions","userStoryPermissions","wikiPermissions","active","is_private","cat","activePermissions","getActivePermissions","categoryId","anon_permissions","BitbucketController","BitbucketWebhooksDirective","GithubController","GithubWebhooksDirective","GitlabController","GitlabWebhooksDirective","NewWebhookDirective","SelectInputText","ValidOriginIpsDirective","WebhookDirective","WebhooksController","loadWebhooks","openHistory","showEditMode","showVisualizationMode","updateLogs","updateShowHideHistoryText","webhook","tgWebhook","validStatus","prettySentHeaders","toPairs","request_headers","arg","header","prettySentData","request_data","created","logs_counter","logs","historyElement","textElement","test","resend","addWebhookDOMNode","formDOMNode","loadModules","github","gitlab","bitbucket","saveAttribute","$ngModel","createProjectRestrictionDirective","CreateProject","DeleteProjectDirective","$projectUrl","$cacheFactory","removeAll","error_field","selectors","creation_template","head","projectToDelete","BindHtmlDirective","BindOnceAltDirective","BindOnceBindDirective","BindOnceHrefDirective","BindOnceHtmlDirective","BindOnceRefDirective","BindOnceSrcDirective","BindOnceTitleDirective","BindTitleDirective","tgBoBind","tgBoHtml","tgBoRef","tgBoSrc","tgBoHref","tgBoAlt","tgBoTitle","tgTitleHtml","tgBindHtml","ConfigurationService","has","ContribController","ContribUserSettingsController","currentPlugin","FiltersStorageService","HttpService","cacheFactory","locationFactory","lastRoute","Model","ModelService","dataTypes","_attrs","_name","_dataTypes","setAttrs","_modifiedAttrs","_isModified","applyCasts","attrName","castMethod","castName","casts","getIdAttrName","getName","getter","self","setter","substr","enumerable","configurable","isAttributeModified","markSaved","desSerialize","sdata","ddata","$http","$gmUrls","$gmStorage","cls","int","float","NavigationUrlsDirective","NavigationUrlsService","formatUrl","replacer","bindOnceP","parseNav","param","tgNavGetParams","tgNav","fullUrl","getURLParams","getURLParamsStr","metaKey","ctrlKey","RepositoryService","model1","resolveUrlForModel","idAttrName","resolveUrlForAttributeModel","extraParams","_data","_status","queryMany","httpOptions","enablePagination","queryOneAttribute","queryOneRaw","queryPaginated","queryOnePaginatedRaw","wikipage","StorageService","_default","serializedValue","getItem","setItem","contains","removeItem","UrlsService","fmt","mainUrl","trimEnd","resourceProvider","_get","userstory","_list","filtersHashSuffix","hashSuffix","myFiltersHashSuffix","getQueryParams","listInAllProjects","project_id","bulk_issues","ns","innerPromise","hashSuffixStatusColumnModes","hashSuffixStatusViewModes","listByUser","invitation_extra_text","bulk_memberships","notifyPolicies","listByMember","memberId","bulkUpdateOrder","bulkData","regenerate_userstories_csv_uuid","regenerate_issues_csv_uuid","regenerate_tasks_csv_uuid","statusUpdater","complete","failed","maxFileSize","uploadComplete","uploadFailed","uploadProgress","fileName","fileSize","evt","loaded","uploadedSize","totalSize","responseText","getResponseHeader","FormData","XMLHttpRequest","setRequestHeader","transformRequest","identity","deferredAbort","get_all","noop","hashSuffixUsRowModes","userStoryId","sprint_id","bulk_tasks","changeAvatar","removeAvatar","changePassword","currentPassword","newPassword","current_password","userSettings","contacts","status_id","bulk_stories","webhookId","webhooklogId","UserChangePasswordController","UserChangePasswordDirective","newPassword1","newPassword2","DeleteUserDirective","TaigaAvatarModelDirective","UserAvatarDirective","UserProfileDirective","UserSettingsController","getLan","getTheme","maxFileSizeMsg","availableThemes","avatarAttachment","tgAvatarModel","UserSettingsNavigationDirective","tgUserSettingsNavigation","UserNotificationsController","UserNotificationsDirective","UserNotificationsListDirective","policy","policyIndex","prev_level","notify_level","AttachmentLinkDirective","tgAttachmentLink","AttachmentGalleryDirective","onDelete","AttachmentController","editMode","mergeIn","AttachmentDirective","AttachmentsDropDirective","eventAttr","tgAttachmentsDrop","AttachmentsFullController","deprecatedsCount","attachmentsVisible","deprecatedsVisible","uploadingAttachments","objId","setMode","toggleDeprecatedsVisible","addAttachments","loadAttachments","toDeleteAttachment","errorMessage","reorderAttachment","updateAttachment","toUpdateAttachment","hasPermission","editPermission","showAttachments","AttachmentsFullDirective","AttachmentsFullService","_attachments","_deprecatedsCount","_attachmentsVisible","_deprecatedsVisible","regenerate","it","uploading","Map","oldIndex","findIndex","setIn","oldAttachment","AttachmentsSimpleController","onAdd","AttachmentsSimpleDirective","AttachmentSortableDirective","tgAttachmentsSortable","containment","helper","AutoSelectDirective","$timeout","FileChangeDirective","tgFileChange","JoyRideDirective","joyRideService","initJoyrRide","intro","unsuscribe","introJs","oncomplete","onexit","disableJoyRide","setOptions","exitOnEsc","exitOnOverlayClick","showStepNumbers","nextLabel","prevLabel","skipLabel","doneLabel","disableInteraction","setOption","loadJoyRideConfig","exit","JoyRideService","getConfig","dashboard","steps","joyRide","joyRides","LiveAnnouncementDirective","defineProperties","LiveAnnouncementService","ProjectLogoBigSrcDirective","projectLogoService","logo","projectLogo","getDefaultProjectLogo","ProjectLogoSmallSrcDirective","ProjectMenuController","_getActiveSection","_setVideoConference","_setMenuPermissions","videoconferenceUrl","_videoConferenceUrl","indexBacklog","indexKanban","oldSectionName","sectionsBreadcrumb","baseUrl","ProjectMenuDirective","projectChange","vm","fixed","TermsOfServiceAndPrivacyPolicyNoticeDirective","privacyPolicyUrl","termsOfServiceUrl","VoteButtonController","isMouseOver","showTextWhenMouseIsOver","showTextWhenMouseIsLeave","toggleVote","is_voter","_downvote","_upvote","VoteButtonDirective","WatchButtonController","openWatchers","getPerms","toggleWatch","is_watcher","_unwatch","_watch","WatchButtonDirective","attributes","environment","DiscoverHomeOrderByController","is_open","week","month","year","currentText","currentOrderBy","orderBy","onChange","DiscoverHomeOrderByDirective","DiscoverSearchBarController","discoverProjectsService","projectsCount","fetchStats","submitFilter","DiscoverSearchBarDirective","DiscoverSearchListHeaderController","like_is_open","activity_is_open","openLike","setOrderBy","openActivity","DiscoverSearchListHeaderDirective","FeaturedProjectsController","featured","fetchFeatured","FeaturedProjectsDirective","HighlightedDirective","highlighted","MostActiveController","mostActive","getOrderBy","fetch","fetchMostActive","MostActiveDirective","MostLikedController","mostLiked","fetchMostLiked","MostLikedDirective","DiscoverHomeController","onSubmit","DiscoverSearchController","routeParams","searchResult","nextSearchPage","loadingGlobal","loadingList","loadingPagination","resetSearchList","fetchByGlobalSearch","fetchByOrderBy","getFilter","fetchSearch","is_looking_for_people","onChangeFilter","updateParams","onChangeOrder","DiscoverSearchDirective","DiscoverProjectsService","projectsService","_mostLiked","_mostActive","_featured","_searchResult","_projectsCount","decorate","_decorate","_nextSearchPage","_discoverParams","discover_mode","_params","getProjects","is_featured","ExternalAppController","externalAppsService","xhrError","loginUrl","createApplicationToken","_getApplicationToken","_redirect","_applicationId","application","_state","state","_user","_application","loginWithAnotherUserUrl","applicationToken","getApplicationToken","back","authorizeApplicationToken","ExternalAppsService","applicationId","externalapps","FeedbackService","sendFeedback","DutyDirective","navurls","duty","getDutyType","HomeController","HomeService","_attachProjectInfoToWorkInProgress","workInProgress","projectsById","_attachProjectInfoToDuty","_duties","watching","objType","getWorkInProgress","assignedIssuesPromise","assignedTasksPromise","assignedUserStoriesPromise","params_us","projectsPromise","watchingIssuesPromise","watchingTasksPromise","watchingUserStoriesPromise","getProjectsByUserId","p","status__is_closed","HomeProjectListDirective","newProject","WorkingOnController","homeService","_setAssignedTo","elem","_setWatching","WorkingOnDirective","DropdownProjectListDirective","DropdownUserDirective","authService","configService","locationService","navUrlsService","isFeedbackEnabled","userMenu","NavigationBarDirective","isEnabledHeader","NavigationBarService","enabledHeader","ProfileBarController","userService","loadStats","getStats","ProfileBarDirective","ProfileContactsController","loadContacts","getContacts","ProfileContactsDirective","FavItemDirective","itemType","FavsBaseController","ProfileLikedController","ProfileVotedController","ProfileWatchedController","_init","enableFilterByAll","enableFilterByProjects","enableFilterByUserStories","enableFilterByTasks","enableFilterByIssues","enableFilterByTextQuery","_resetList","scrollDisabled","_page","_enableLoadingSpinner","isLoading","_disableLoadingSpinner","_enableScroll","_disableScroll","_checkIfHasMorePages","hasNext","_checkIfHasNoResults","hasNoResults","loadItems","_getItems","filterByTextQuery","showAll","showProjectsOnly","showUserStoriesOnly","showTasksOnly","showIssuesOnly","getLiked","getVoted","getWatched","ProfileLikedDirective","ProfileVotedDirective","ProfileWatchedDirective","ProfileHints","hintKey","HINTS","hint","linkText","ProfileProjectsController","attachUserContactsToProjects","ProfileProjectsDirective","ProfileTabDirective","transclude","tab","tabIcon","iconName","tabActive","tabDisabled","addTab","ProfileTabsController","tabs","toggleTab","ProfileTabsDirective","ProfileController","getUserByUserName","notFound","userUsername","BlockedProjectExplanationDirective","LikeProjectButtonController","likeButtonService","toggleLike","_unlike","_like","like","unlike","LikeProjectButtonDirective","LikeProjectButtonService","_getProjectIndex","_updateProjects","isFan","projectIndex","totalFans","is_fan","total_fans","setProjects","_updateCurrentProject","setProject","likeProject","unlikeProject","SortProjectsDirective","opacity","sortData","sorted_project_ids","bulkUpdateProjectsOrder","WatchProjectButtonController","watchButtonService","showWatchOptions","toggleWatcherOptions","closeWatcherOptions","notifyLevel","WatchProjectButtonDirective","WatchProjectButtonService","isWatcher","totalWatchers","total_watchers","watchProject","unwatchProject","ProjectsListingController","ProjectController","activeMembers","setfn","metas","ProjectsService","projectUrl","getProjectBySlug","getProjectStats","paginate","colorized_tags","transferValidateToken","transferAccept","reason","transferReject","CantOwnProjectExplanationDirective","TransferProject","showAddComment","_refreshUserData","_validateToken","_setProjectData","_checkOwnerData","canBeOwnedByUser","canOwnProject","ownerMessage","maxProjects","currentProjects","validNumberOfMemberships","addComment","hideComment","TransferProjectDirective","Resource","urlsService","urlname","object_id","x-disable-pagination","progressMessage","progressPercent","pagination","paginateResponseService","x-lazy-pagination","getTimeline","only_relevant","Resources","services","serviceFn","serviceName","serviceProperty","warm","getUserStorage","setUserStorage","createUserStorage","getUserByUsername","getProfileTimeline","getUserTimeline","AppMetaService","_set","meta","setTitle","setDescription","setTwitterMetas","origin","setOpenGraphMetas","listener","_listener","$watchCollection","AttachmentsService","getMaxFileSize","maxFileSizeFormated","sizeError","saveError","ChekcPermissionsService","CurrentUserService","storageService","_projects","_projectsById","_joyride","_loadUserInfo","LightboxFactory","compile","scopeAttrs","PaginateResponse","paginateResponse","ProjectLogoService","modulo","COLORS","IMAGES","logos","murmurhash3_32_gc","ProjectService","_project","_section","_sectionsBreadcrumb","_activeMembers","ScopeEvent","scopes","_searchDuplicatedScopes","$id","_create","duplicatedScopeName","_tgEmitter","EventEmitter2","removeAllListeners","emitter","ThemeService","themeName","stylesheetEl","UserService","pageNumber","objectType","textQuery","contactsFiltered","contact","contactId","permissionDenied","UserTimelineAttachmentDirective","validFileExtensions","extension","is_image","templateHtml","UserTimelineItemTitle","sce","_fieldTranslationKey","timeline","title_attr","_getLink","_getUsernameSpan","field_name","new_value","sprint_name","us_name","event_us","_getTimelineObj","_getDetailObjUrl","obj_name","role_name","keySeq","_translateTitleParams","parent_userstory","_getParams","timeline_type","translate_params","getTitle","paramsKeys","translation","UserTimelineType","timelineType","hasIn","getType","UserTimelineItemDirective","UserTimelinePaginationSequence","generate","getContent","minItems","UserTimelineController","userTimelineService","timelineList","getProjectTimeline","loadTimeline","UserTimelineDirective","UserTimelineService","userTimelinePaginationSequenceService","userTimelineItemType","userTimelineItemTitle","_valid_fields","_invalid","fieldKey","value_diff","_isInValidTimeline","invalid","_parseEventType","event_type","_getTimelineObject","_attachExtraInfoToTimelineEntry","_parseTimeline","newdata","newItem","blocked","moveInBacklog","deleteIn","_addEntyAttributes","filterNot"],"mappings":"CAyBA,WACE,GAAIA,WAAWC,SAAUC,KAAMC,OAAQC,QAASC,kBAAmBC,KAEnEC,MAAKD,MAAQA,SAEbC,KAAKC,oBAAsBD,KAAKC,qBAAuBC,OAAOD,wBAE9DF,MAAMI,aAAe,SAASC,YAO5B,MANkB,OAAdA,aACFA,eAEFA,WAAaC,EAAEC,IAAIF,WAAY,SAASG,GACtC,MAAOC,MAAKC,UAAUF,KAEjBG,SAASN,WAAWO,KAAK,OAGlCZ,MAAMa,gCAAkC,WACtC,GAAIC,MAAMC,YAGV,OAFAD,OAA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CzR,MACIA,KAAKqpG,sCAAsCV,SAAS7iG,SAG7DsjG,oBAAoBl6F,UAAU+5F,mBAAqB,SAASxwF,WAC1D,GAAI3S,OAqBJ,OApBAA,WACAA,OAAOyrF,MAAQ,SAAUhqF,OACvB,MAAO,UAAS2zB,MACd,MAAO3zB,OAAM+Q,GAAGC,SAASspF,YAAYppF,UAAWyiB,MAAM/3B,KAAK,SAASwC,UAClE,MAAO4B,OAAM2iG,eAAevkG,cAG/B3F,MACH8F,OAAOxF,IAAM,SAAUiH,OACrB,MAAO,UAASwO,KACd,MAAOxO,OAAMijG,mBAAmBz0F,OAEjC/V,MACH8F,OAAOgH,OAAS,SAAUvF,OACxB,MAAO,UAAS++C,OACd,MAAOA,OAAMmkD,UAAU,SAASh5F,MAC9B,MAAOlK,OAAMqiG,mBAAmBn4F,UAGnCzR,MACIA,KAAKqpG,sCAAsCV,SAAS7iG,SAGtDsjG,qBAENrpG,MAAMkQ,SAETrN,QAAQhD,OAAO,qBAAqBsd,QAAQ,wBAAyBksF,sBAEpE/lG,KAAKrD","file":"app.js","sourceRoot":"/source/","sourcesContent":["\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: app.coffee\n */\n\n(function() {\n var configure, i18nInit, init, module, modules, pluginsWithModule, taiga;\n\n this.taiga = taiga = {};\n\n this.taigaContribPlugins = this.taigaContribPlugins || window.taigaContribPlugins || [];\n\n taiga.generateHash = function(components) {\n if (components == null) {\n components = [];\n }\n components = _.map(components, function(x) {\n return JSON.stringify(x);\n });\n return hex_sha1(components.join(\":\"));\n };\n\n taiga.generateUniqueSessionIdentifier = function() {\n var date, randomNumber;\n date = (new Date()).getTime();\n randomNumber = Math.floor(Math.random() * 0x9000000);\n return taiga.generateHash([date, randomNumber]);\n };\n\n taiga.sessionId = taiga.generateUniqueSessionIdentifier();\n\n configure = function($routeProvider, $locationProvider, $httpProvider, $provide, $tgEventsProvider, $compileProvider, $translateProvider, $translatePartialLoaderProvider, $animateProvider) {\n var authHttpIntercept, blockingIntercept, decorators, defaultHeaders, loaderIntercept, originalWhen, preferedLangCode, userInfo, versionCheckHttpIntercept;\n $animateProvider.classNameFilter(/^(?:(?!ng-animate-disabled).)*$/);\n originalWhen = $routeProvider.when;\n $routeProvider.when = function(path, route) {\n route.resolve || (route.resolve = {});\n angular.extend(route.resolve, {\n languageLoad: [\n \"$q\", \"$translate\", function($q, $translate) {\n var deferred;\n deferred = $q.defer();\n $translate().then(function() {\n return deferred.resolve();\n });\n return deferred.promise;\n }\n ]\n });\n return originalWhen.call($routeProvider, path, route);\n };\n $routeProvider.when(\"/\", {\n templateUrl: \"home/home.html\",\n controller: \"Home\",\n controllerAs: \"vm\",\n loader: true,\n title: \"HOME.PAGE_TITLE\",\n loader: true,\n description: \"HOME.PAGE_DESCRIPTION\",\n joyride: \"dashboard\"\n });\n $routeProvider.when(\"/discover\", {\n templateUrl: \"discover/discover-home/discover-home.html\",\n controller: \"DiscoverHome\",\n controllerAs: \"vm\",\n title: \"PROJECT.NAVIGATION.DISCOVER\",\n loader: true\n });\n $routeProvider.when(\"/discover/search\", {\n templateUrl: \"discover/discover-search/discover-search.html\",\n title: \"PROJECT.NAVIGATION.DISCOVER\",\n loader: true,\n controller: \"DiscoverSearch\",\n controllerAs: \"vm\",\n reloadOnSearch: false\n });\n $routeProvider.when(\"/projects/\", {\n templateUrl: \"projects/listing/projects-listing.html\",\n access: {\n requiresLogin: true\n },\n title: \"PROJECTS.PAGE_TITLE\",\n description: \"PROJECTS.PAGE_DESCRIPTION\",\n loader: true,\n controller: \"ProjectsListing\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/blocked-project/:pslug/\", {\n templateUrl: \"projects/project/blocked-project.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/project/:pslug/\", {\n templateUrl: \"projects/project/project.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\",\n section: \"project-timeline\"\n });\n $routeProvider.when(\"/project/:pslug/search\", {\n templateUrl: \"search/search.html\",\n reloadOnSearch: false,\n section: \"search\",\n loader: true\n });\n $routeProvider.when(\"/project/:pslug/backlog\", {\n templateUrl: \"backlog/backlog.html\",\n loader: true,\n section: \"backlog\",\n joyride: \"backlog\"\n });\n $routeProvider.when(\"/project/:pslug/kanban\", {\n templateUrl: \"kanban/kanban.html\",\n loader: true,\n section: \"kanban\",\n joyride: \"kanban\"\n });\n $routeProvider.when(\"/project/:pslug/taskboard/:sslug\", {\n templateUrl: \"taskboard/taskboard.html\",\n loader: true,\n section: \"backlog\"\n });\n $routeProvider.when(\"/project/:pslug/us/:usref\", {\n templateUrl: \"us/us-detail.html\",\n loader: true,\n section: \"backlog-kanban\"\n });\n $routeProvider.when(\"/project/:pslug/task/:taskref\", {\n templateUrl: \"task/task-detail.html\",\n loader: true,\n section: \"backlog-kanban\"\n });\n $routeProvider.when(\"/project/:pslug/wiki\", {\n redirectTo: function(params) {\n return \"/project/\" + params.pslug + \"/wiki/home\";\n }\n });\n $routeProvider.when(\"/project/:pslug/wiki/:slug\", {\n templateUrl: \"wiki/wiki.html\",\n loader: true,\n section: \"wiki\"\n });\n $routeProvider.when(\"/project/:pslug/team\", {\n templateUrl: \"team/team.html\",\n loader: true,\n section: \"team\"\n });\n $routeProvider.when(\"/project/:pslug/issues\", {\n templateUrl: \"issue/issues.html\",\n loader: true,\n section: \"issues\"\n });\n $routeProvider.when(\"/project/:pslug/issue/:issueref\", {\n templateUrl: \"issue/issues-detail.html\",\n loader: true,\n section: \"issues\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/details\", {\n templateUrl: \"admin/admin-project-profile.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/default-values\", {\n templateUrl: \"admin/admin-project-default-values.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/modules\", {\n templateUrl: \"admin/admin-project-modules.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/export\", {\n templateUrl: \"admin/admin-project-export.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/reports\", {\n templateUrl: \"admin/admin-project-reports.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/status\", {\n templateUrl: \"admin/admin-project-values-status.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/points\", {\n templateUrl: \"admin/admin-project-values-points.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/priorities\", {\n templateUrl: \"admin/admin-project-values-priorities.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/severities\", {\n templateUrl: \"admin/admin-project-values-severities.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/types\", {\n templateUrl: \"admin/admin-project-values-types.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/custom-fields\", {\n templateUrl: \"admin/admin-project-values-custom-fields.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/memberships\", {\n templateUrl: \"admin/admin-memberships.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/roles\", {\n templateUrl: \"admin/admin-roles.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/webhooks\", {\n templateUrl: \"admin/admin-third-parties-webhooks.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/github\", {\n templateUrl: \"admin/admin-third-parties-github.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/gitlab\", {\n templateUrl: \"admin/admin-third-parties-gitlab.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/bitbucket\", {\n templateUrl: \"admin/admin-third-parties-bitbucket.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/contrib/:plugin\", {\n templateUrl: \"contrib/main.html\"\n });\n $routeProvider.when(\"/project/:pslug/transfer/:token\", {\n templateUrl: \"projects/transfer/transfer-page.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/user-settings/user-profile\", {\n templateUrl: \"user/user-profile.html\"\n });\n $routeProvider.when(\"/user-settings/user-change-password\", {\n templateUrl: \"user/user-change-password.html\"\n });\n $routeProvider.when(\"/user-settings/mail-notifications\", {\n templateUrl: \"user/mail-notifications.html\"\n });\n $routeProvider.when(\"/change-email/:email_token\", {\n templateUrl: \"user/change-email.html\"\n });\n $routeProvider.when(\"/cancel-account/:cancel_token\", {\n templateUrl: \"user/cancel-account.html\"\n });\n $routeProvider.when(\"/user-settings/contrib/:plugin\", {\n templateUrl: \"contrib/user-settings.html\"\n });\n $routeProvider.when(\"/profile\", {\n templateUrl: \"profile/profile.html\",\n loader: true,\n access: {\n requiresLogin: true\n },\n controller: \"Profile\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/profile/:slug\", {\n templateUrl: \"profile/profile.html\",\n loader: true,\n controller: \"Profile\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/login\", {\n templateUrl: \"auth/login.html\",\n title: \"LOGIN.PAGE_TITLE\",\n description: \"LOGIN.PAGE_DESCRIPTION\",\n disableHeader: true,\n controller: \"LoginPage\"\n });\n $routeProvider.when(\"/register\", {\n templateUrl: \"auth/register.html\",\n title: \"REGISTER.PAGE_TITLE\",\n description: \"REGISTER.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/forgot-password\", {\n templateUrl: \"auth/forgot-password.html\",\n title: \"FORGOT_PASSWORD.PAGE_TITLE\",\n description: \"FORGOT_PASSWORD.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/change-password/:token\", {\n templateUrl: \"auth/change-password-from-recovery.html\",\n title: \"CHANGE_PASSWORD.PAGE_TITLE\",\n description: \"CHANGE_PASSWORD.PAGE_TITLE\",\n disableHeader: true\n });\n $routeProvider.when(\"/invitation/:token\", {\n templateUrl: \"auth/invitation.html\",\n title: \"INVITATION.PAGE_TITLE\",\n description: \"INVITATION.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/external-apps\", {\n templateUrl: \"external-apps/external-app.html\",\n title: \"EXTERNAL_APP.PAGE_TITLE\",\n description: \"EXTERNAL_APP.PAGE_DESCRIPTION\",\n controller: \"ExternalApp\",\n controllerAs: \"vm\",\n disableHeader: true,\n mobileViewport: true\n });\n $routeProvider.when(\"/error\", {\n templateUrl: \"error/error.html\"\n });\n $routeProvider.when(\"/not-found\", {\n templateUrl: \"error/not-found.html\"\n });\n $routeProvider.when(\"/permission-denied\", {\n templateUrl: \"error/permission-denied.html\"\n });\n $routeProvider.otherwise({\n redirectTo: \"/not-found\"\n });\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false\n });\n defaultHeaders = {\n \"Content-Type\": \"application/json\",\n \"Accept-Language\": window.taigaConfig.defaultLanguage || \"en\",\n \"X-Session-Id\": taiga.sessionId\n };\n $httpProvider.defaults.headers[\"delete\"] = defaultHeaders;\n $httpProvider.defaults.headers.patch = defaultHeaders;\n $httpProvider.defaults.headers.post = defaultHeaders;\n $httpProvider.defaults.headers.put = defaultHeaders;\n $httpProvider.defaults.headers.get = {\n \"X-Session-Id\": taiga.sessionId\n };\n $httpProvider.useApplyAsync(true);\n $tgEventsProvider.setSessionId(taiga.sessionId);\n authHttpIntercept = function($q, $location, $navUrls, $lightboxService) {\n var httpResponseError;\n httpResponseError = function(response) {\n var nextUrl;\n if (response.status === 0 || (response.status === -1 && !response.config.cancelable)) {\n $lightboxService.closeAll();\n $location.path($navUrls.resolve(\"error\"));\n $location.replace();\n } else if (response.status === 401 && $location.url().indexOf('/login') === -1) {\n nextUrl = encodeURIComponent($location.url());\n $location.url($navUrls.resolve(\"login\")).search(\"next=\" + nextUrl);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"authHttpIntercept\", [\"$q\", \"$location\", \"$tgNavUrls\", \"lightboxService\", authHttpIntercept]);\n $httpProvider.interceptors.push(\"authHttpIntercept\");\n loaderIntercept = function($q, loaderService) {\n return {\n request: function(config) {\n loaderService.logRequest();\n return config;\n },\n requestError: function(rejection) {\n loaderService.logResponse();\n return $q.reject(rejection);\n },\n responseError: function(rejection) {\n loaderService.logResponse();\n return $q.reject(rejection);\n },\n response: function(response) {\n loaderService.logResponse();\n return response;\n }\n };\n };\n $provide.factory(\"loaderIntercept\", [\"$q\", \"tgLoader\", loaderIntercept]);\n $httpProvider.interceptors.push(\"loaderIntercept\");\n versionCheckHttpIntercept = function($q) {\n var httpResponseError;\n httpResponseError = function(response) {\n var $injector;\n if (response.status === 400 && response.data.version) {\n $injector = angular.element(\"body\").injector();\n $injector.invoke([\n \"$tgConfirm\", \"$translate\", (function(_this) {\n return function($confirm, $translate) {\n var versionErrorMsg;\n versionErrorMsg = $translate.instant(\"ERROR.VERSION_ERROR\");\n return $confirm.notify(\"error\", versionErrorMsg, null, 10000);\n };\n })(this)\n ]);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"versionCheckHttpIntercept\", [\"$q\", versionCheckHttpIntercept]);\n $httpProvider.interceptors.push(\"versionCheckHttpIntercept\");\n blockingIntercept = function($q, $routeParams, $location, $navUrls) {\n var redirectToBlockedPage, responseError, responseOk;\n redirectToBlockedPage = function() {\n var blockedUrl, currentUrl, pslug;\n pslug = $routeParams.pslug;\n blockedUrl = $navUrls.resolve(\"blocked-project\", {\n project: pslug\n });\n currentUrl = $location.url();\n if (currentUrl.indexOf(blockedUrl) === -1) {\n return $location.replace().path(blockedUrl);\n }\n };\n responseOk = function(response) {\n if (response.data.blocked_code) {\n redirectToBlockedPage();\n }\n return response;\n };\n responseError = function(response) {\n if (response.status === 451) {\n redirectToBlockedPage();\n }\n return $q.reject(response);\n };\n return {\n response: responseOk,\n responseError: responseError\n };\n };\n $provide.factory(\"blockingIntercept\", [\"$q\", \"$routeParams\", \"$location\", \"$tgNavUrls\", blockingIntercept]);\n $httpProvider.interceptors.push(\"blockingIntercept\");\n $compileProvider.debugInfoEnabled(window.taigaConfig.debugInfo || false);\n if (localStorage.userInfo) {\n userInfo = JSON.parse(localStorage.userInfo);\n }\n preferedLangCode = (userInfo != null ? userInfo.lang : void 0) || window.taigaConfig.defaultLanguage || \"en\";\n $translatePartialLoaderProvider.addPart('taiga');\n $translateProvider.useLoader('$translatePartialLoader', {\n urlTemplate: '/' + window._version + '/locales/{part}/locale-{lang}.json'\n }).useSanitizeValueStrategy('escapeParameters').addInterpolation('$translateMessageFormatInterpolation').preferredLanguage(preferedLangCode);\n $translateProvider.fallbackLanguage(preferedLangCode);\n decorators = window.getDecorators();\n return _.each(decorators, function(decorator) {\n return $provide.decorator(decorator.provider, decorator.decorator);\n });\n };\n\n i18nInit = function(lang, $translate) {\n var messages;\n moment.locale(lang);\n messages = {\n defaultMessage: $translate.instant(\"COMMON.FORM_ERRORS.DEFAULT_MESSAGE\"),\n type: {\n email: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_EMAIL\"),\n url: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_URL\"),\n urlstrict: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_URLSTRICT\"),\n number: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_NUMBER\"),\n digits: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_DIGITS\"),\n dateIso: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_DATEISO\"),\n alphanum: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_ALPHANUM\"),\n phone: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_PHONE\")\n },\n notnull: $translate.instant(\"COMMON.FORM_ERRORS.NOTNULL\"),\n notblank: $translate.instant(\"COMMON.FORM_ERRORS.NOT_BLANK\"),\n required: $translate.instant(\"COMMON.FORM_ERRORS.REQUIRED\"),\n regexp: $translate.instant(\"COMMON.FORM_ERRORS.REGEXP\"),\n min: $translate.instant(\"COMMON.FORM_ERRORS.MIN\"),\n max: $translate.instant(\"COMMON.FORM_ERRORS.MAX\"),\n range: $translate.instant(\"COMMON.FORM_ERRORS.RANGE\"),\n minlength: $translate.instant(\"COMMON.FORM_ERRORS.MIN_LENGTH\"),\n maxlength: $translate.instant(\"COMMON.FORM_ERRORS.MAX_LENGTH\"),\n rangelength: $translate.instant(\"COMMON.FORM_ERRORS.RANGE_LENGTH\"),\n mincheck: $translate.instant(\"COMMON.FORM_ERRORS.MIN_CHECK\"),\n maxcheck: $translate.instant(\"COMMON.FORM_ERRORS.MAX_CHECK\"),\n rangecheck: $translate.instant(\"COMMON.FORM_ERRORS.RANGE_CHECK\"),\n equalto: $translate.instant(\"COMMON.FORM_ERRORS.EQUAL_TO\"),\n linewidth: $translate.instant(\"COMMON.FORM_ERRORS.LINEWIDTH\"),\n pikaday: $translate.instant(\"COMMON.FORM_ERRORS.PIKADAY\")\n };\n return checksley.updateMessages('default', messages);\n };\n\n init = function($log, $rootscope, $auth, $events, $analytics, $translate, $location, $navUrls, appMetaService, projectService, loaderService, navigationBarService) {\n var un, user, validators;\n $log.debug(\"Initialize application\");\n $rootscope.$on('$translatePartialLoaderStructureChanged', function() {\n return $translate.refresh();\n });\n validators = {\n linewidth: function(val, width) {\n var lines, valid;\n lines = taiga.nl2br(val).split(\"
\");\n valid = _.every(lines, function(line) {\n return line.length < width;\n });\n return valid;\n },\n pikaday: function(val) {\n var prettyDate;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n return moment(val, prettyDate).isValid();\n }\n };\n checksley.updateValidators(validators);\n $rootscope.contribPlugins = this.taigaContribPlugins;\n $rootscope.adminPlugins = _.filter(this.taigaContribPlugins, {\n \"type\": \"admin\"\n });\n $rootscope.userSettingsPlugins = _.filter(this.taigaContribPlugins, {\n \"type\": \"userSettings\"\n });\n $rootscope.$on(\"$translateChangeEnd\", function(e, ctx) {\n var lang;\n lang = ctx.language;\n return i18nInit(lang, $translate);\n });\n Promise.setScheduler(function(cb) {\n return $rootscope.$evalAsync(cb);\n });\n $events.setupConnection();\n if ($auth.isAuthenticated()) {\n user = $auth.getUser();\n }\n $analytics.initialize();\n un = $rootscope.$on('$routeChangeStart', function(event, next) {\n if (next.loader) {\n loaderService.start(true);\n }\n return un();\n });\n return $rootscope.$on('$routeChangeSuccess', function(event, next) {\n var description, title;\n if (next.loader) {\n loaderService.start(true);\n }\n if (next.access && next.access.requiresLogin) {\n if (!$auth.isAuthenticated()) {\n $location.path($navUrls.resolve(\"login\"));\n }\n }\n projectService.setSection(next.section);\n if (next.params.pslug) {\n projectService.setProjectBySlug(next.params.pslug);\n } else {\n projectService.cleanProject();\n }\n if (next.title || next.description) {\n title = $translate.instant(next.title || \"\");\n description = $translate.instant(next.description || \"\");\n appMetaService.setAll(title, description);\n }\n if (next.mobileViewport) {\n appMetaService.addMobileViewport();\n } else {\n appMetaService.removeMobileViewport();\n }\n if (next.disableHeader) {\n return navigationBarService.disableHeader();\n } else {\n return navigationBarService.enableHeader();\n }\n });\n };\n\n pluginsWithModule = _.filter(this.taigaContribPlugins, function(plugin) {\n return plugin.module;\n });\n\n angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 500);\n\n modules = [\"taigaBase\", \"taigaCommon\", \"taigaResources\", \"taigaResources2\", \"taigaAuth\", \"taigaEvents\", \"taigaHome\", \"taigaNavigationBar\", \"taigaProjects\", \"taigaRelatedTasks\", \"taigaBacklog\", \"taigaTaskboard\", \"taigaKanban\", \"taigaIssues\", \"taigaUserStories\", \"taigaTasks\", \"taigaTeam\", \"taigaWiki\", \"taigaSearch\", \"taigaAdmin\", \"taigaProject\", \"taigaUserSettings\", \"taigaFeedback\", \"taigaPlugins\", \"taigaIntegrations\", \"taigaComponents\", \"taigaProfile\", \"taigaHome\", \"taigaUserTimeline\", \"taigaExternalApps\", \"taigaDiscover\", \"templates\", \"ngSanitize\", \"ngRoute\", \"ngAnimate\", \"ngAria\", \"pascalprecht.translate\", \"infinite-scroll\", \"tgRepeat\"].concat(_.map(pluginsWithModule, function(plugin) {\n return plugin.module;\n }));\n\n module = angular.module(\"taiga\", modules);\n\n module.config([\"$routeProvider\", \"$locationProvider\", \"$httpProvider\", \"$provide\", \"$tgEventsProvider\", \"$compileProvider\", \"$translateProvider\", \"$translatePartialLoaderProvider\", \"$animateProvider\", configure]);\n\n module.run([\"$log\", \"$rootScope\", \"$tgAuth\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"tgProjectService\", \"tgLoader\", \"tgNavigationBarService\", \"$route\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: classes.coffee\n */\n\n(function() {\n var TaigaBase, TaigaController, TaigaService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n TaigaBase = (function() {\n function TaigaBase() {}\n\n return TaigaBase;\n\n })();\n\n TaigaService = (function(superClass) {\n extend(TaigaService, superClass);\n\n function TaigaService() {\n return TaigaService.__super__.constructor.apply(this, arguments);\n }\n\n return TaigaService;\n\n })(TaigaBase);\n\n TaigaController = (function(superClass) {\n extend(TaigaController, superClass);\n\n function TaigaController() {\n this.onInitialDataError = bind(this.onInitialDataError, this);\n return TaigaController.__super__.constructor.apply(this, arguments);\n }\n\n TaigaController.prototype.onInitialDataError = function(xhr) {\n if (xhr) {\n if (xhr.status === 404) {\n this.location.path(this.navUrls.resolve(\"not-found\"));\n this.location.replace();\n } else if (xhr.status === 403) {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n this.location.replace();\n }\n }\n return this.q.reject(xhr);\n };\n\n return TaigaController;\n\n })(TaigaBase);\n\n this.taiga.Base = TaigaBase;\n\n this.taiga.Service = TaigaService;\n\n this.taiga.Controller = TaigaController;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: utils.coffee\n */\n\n(function() {\n var bindMethods, bindOnce, cancelTimeout, debounce, debounceLeading, defineImmutableProperty, groupBy, isImage, joinStr, mixOf, nl2br, patch, replaceTags, scopeDefer, sizeFormat, slugify, startswith, stripTags, taiga, timeout, toString, toggleText, trim, truncate, unslugify,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },\n slice = [].slice,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n nl2br = (function(_this) {\n return function(str) {\n var breakTag;\n breakTag = '
';\n return (str + '').replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1' + breakTag + '$2');\n };\n })(this);\n\n bindMethods = (function(_this) {\n return function(object) {\n var dependencies, methods;\n dependencies = _.keys(object);\n methods = [];\n _.forIn(object, function(value, key) {\n if (indexOf.call(dependencies, key) < 0) {\n return methods.push(key);\n }\n });\n return _.bindAll(object, methods);\n };\n })(this);\n\n bindOnce = (function(_this) {\n return function(scope, attr, continuation) {\n var delBind, val;\n val = scope.$eval(attr);\n if (val !== void 0) {\n return continuation(val);\n }\n delBind = null;\n return delBind = scope.$watch(attr, function(val) {\n if (val === void 0) {\n return;\n }\n continuation(val);\n if (delBind) {\n return delBind();\n }\n });\n };\n })(this);\n\n mixOf = function() {\n var Mixed, base, i, method, mixin, mixins, name, ref;\n base = arguments[0], mixins = 2 <= arguments.length ? slice.call(arguments, 1) : [];\n Mixed = (function(superClass) {\n extend(Mixed, superClass);\n\n function Mixed() {\n return Mixed.__super__.constructor.apply(this, arguments);\n }\n\n return Mixed;\n\n })(base);\n for (i = mixins.length - 1; i >= 0; i += -1) {\n mixin = mixins[i];\n ref = mixin.prototype;\n for (name in ref) {\n method = ref[name];\n Mixed.prototype[name] = method;\n }\n }\n return Mixed;\n };\n\n trim = function(data, char) {\n return _.trim(data, char);\n };\n\n slugify = function(data) {\n return data.toString().toLowerCase().trim().replace(/\\s+/g, '-').replace(/&/g, '-and-').replace(/[^\\w\\-]+/g, '').replace(/\\-\\-+/g, '-');\n };\n\n unslugify = function(data) {\n if (data) {\n return _.capitalize(data.replace(/-/g, ' '));\n }\n return data;\n };\n\n toggleText = function(element, texts) {\n var nextTextPosition, text;\n nextTextPosition = element.data('nextTextPosition');\n if ((nextTextPosition == null) || nextTextPosition >= texts.length) {\n nextTextPosition = 0;\n }\n text = texts[nextTextPosition];\n element.data('nextTextPosition', nextTextPosition + 1);\n return element.text(text);\n };\n\n groupBy = function(coll, pred) {\n var i, item, len, result;\n result = {};\n for (i = 0, len = coll.length; i < len; i++) {\n item = coll[i];\n result[pred(item)] = item;\n }\n return result;\n };\n\n timeout = function(wait, continuation) {\n return window.setTimeout(continuation, wait);\n };\n\n cancelTimeout = function(timeoutVar) {\n return window.clearTimeout(timeoutVar);\n };\n\n scopeDefer = function(scope, func) {\n return _.defer((function(_this) {\n return function() {\n return scope.$apply(func);\n };\n })(this));\n };\n\n toString = function(value) {\n if (_.isNumber(value)) {\n return value + \"\";\n } else if (_.isString(value)) {\n return value;\n } else if (_.isPlainObject(value)) {\n return JSON.stringify(value);\n } else if (_.isUndefined(value)) {\n return \"\";\n }\n return value.toString();\n };\n\n joinStr = function(str, coll) {\n return coll.join(str);\n };\n\n debounce = function(wait, func) {\n return _.debounce(func, wait, {\n leading: true,\n trailing: false\n });\n };\n\n debounceLeading = function(wait, func) {\n return _.debounce(func, wait, {\n leading: false,\n trailing: true\n });\n };\n\n startswith = function(str1, str2) {\n return _.startsWith(str1, str2);\n };\n\n truncate = function(str, maxLength, suffix) {\n var out;\n if (suffix == null) {\n suffix = \"...\";\n }\n if ((typeof str !== \"string\") && !(str instanceof String)) {\n return str;\n }\n out = str.slice(0);\n if (out.length > maxLength) {\n out = out.substring(0, maxLength + 1);\n out = out.substring(0, Math.min(out.length, out.lastIndexOf(\" \")));\n out = out + suffix;\n }\n return out;\n };\n\n sizeFormat = function(input, precision) {\n var number, size, units;\n if (precision == null) {\n precision = 1;\n }\n if (isNaN(parseFloat(input)) || !isFinite(input)) {\n return \"-\";\n }\n if (input === 0) {\n return \"0 bytes\";\n }\n units = [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n number = Math.floor(Math.log(input) / Math.log(1024));\n if (number > 5) {\n number = 5;\n }\n size = (input / Math.pow(1024, number)).toFixed(precision);\n return size + \" \" + units[number];\n };\n\n stripTags = function(str, exception) {\n var pattern;\n if (exception) {\n pattern = new RegExp('<(?!' + exception + '\\s*\\/?)[^>]+>', 'gi');\n return String(str).replace(pattern, '');\n } else {\n return String(str).replace(/<\\/?[^>]+>/g, '');\n }\n };\n\n replaceTags = function(str, tags, replace) {\n var pattern;\n pattern = new RegExp('<(' + tags + ')>', 'gi');\n str = str.replace(pattern, '<' + replace + '>');\n pattern = new RegExp('<\\/(' + tags + ')>', 'gi');\n str = str.replace(pattern, '');\n return str;\n };\n\n defineImmutableProperty = (function(_this) {\n return function(obj, name, fn) {\n return Object.defineProperty(obj, name, {\n get: function() {\n var fn_result;\n if (!_.isFunction(fn)) {\n throw \"defineImmutableProperty third param must be a function\";\n }\n fn_result = fn();\n if (fn_result && _.isObject(fn_result)) {\n if (fn_result.size === void 0) {\n throw \"defineImmutableProperty must return immutable data\";\n }\n }\n return fn_result;\n }\n });\n };\n })(this);\n\n _.mixin({\n removeKeys: function(obj, keys) {\n return _.chain([keys]).flatten().reduce(function(obj, key) {\n delete obj[key];\n return obj;\n }, obj).value();\n },\n cartesianProduct: function() {\n return _.reduceRight(arguments, function(a, b) {\n return _.flatten(_.map(a, function(x) {\n return _.map(b, function(y) {\n return [y].concat(x);\n });\n }), true);\n }, [[]]);\n }\n });\n\n isImage = function(name) {\n return name.match(/\\.(jpe?g|png|gif|gifv|webm)/i) !== null;\n };\n\n patch = function(oldImmutable, newImmutable) {\n var pathObj;\n pathObj = {};\n newImmutable.forEach(function(newValue, key) {\n if (newValue !== oldImmutable.get(key)) {\n if (newValue.toJS) {\n return pathObj[key] = newValue.toJS();\n } else {\n return pathObj[key] = newValue;\n }\n }\n });\n return pathObj;\n };\n\n taiga = this.taiga;\n\n taiga.nl2br = nl2br;\n\n taiga.bindMethods = bindMethods;\n\n taiga.bindOnce = bindOnce;\n\n taiga.mixOf = mixOf;\n\n taiga.trim = trim;\n\n taiga.slugify = slugify;\n\n taiga.unslugify = unslugify;\n\n taiga.toggleText = toggleText;\n\n taiga.groupBy = groupBy;\n\n taiga.timeout = timeout;\n\n taiga.cancelTimeout = cancelTimeout;\n\n taiga.scopeDefer = scopeDefer;\n\n taiga.toString = toString;\n\n taiga.joinStr = joinStr;\n\n taiga.truncate = truncate;\n\n taiga.debounce = debounce;\n\n taiga.debounceLeading = debounceLeading;\n\n taiga.startswith = startswith;\n\n taiga.sizeFormat = sizeFormat;\n\n taiga.stripTags = stripTags;\n\n taiga.replaceTags = replaceTags;\n\n taiga.defineImmutableProperty = defineImmutableProperty;\n\n taiga.isImage = isImage;\n\n taiga.patch = patch;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/controllerMixins.coffee\n */\n\n(function() {\n var FiltersMixin, PageMixin, groupBy, joinStr, taiga, toString, trim;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n joinStr = this.taiga.joinStr;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n PageMixin = (function() {\n function PageMixin() {}\n\n PageMixin.prototype.fillUsersAndRoles = function(users, roles) {\n var activeUsers, computableRoles;\n activeUsers = _.filter(users, (function(_this) {\n return function(user) {\n return user.is_active;\n };\n })(this));\n this.scope.activeUsers = _.sortBy(activeUsers, \"full_name_display\");\n this.scope.activeUsersById = groupBy(this.scope.activeUsers, function(e) {\n return e.id;\n });\n this.scope.users = _.sortBy(users, \"full_name_display\");\n this.scope.usersById = groupBy(this.scope.users, function(e) {\n return e.id;\n });\n this.scope.roles = _.sortBy(roles, \"order\");\n computableRoles = _(this.scope.project.members).map(\"role\").uniq().value();\n return this.scope.computableRoles = _(roles).filter(\"computable\").filter(function(x) {\n return _.includes(computableRoles, x.id);\n }).value();\n };\n\n PageMixin.prototype.loadUsersAndRoles = function() {\n var promise;\n promise = this.q.all([this.rs.projects.usersList(this.scope.projectId), this.rs.projects.rolesList(this.scope.projectId)]);\n return promise.then((function(_this) {\n return function(results) {\n var roles, users;\n users = results[0], roles = results[1];\n _this.fillUsersAndRoles(users, roles);\n return results;\n };\n })(this));\n };\n\n return PageMixin;\n\n })();\n\n taiga.PageMixin = PageMixin;\n\n FiltersMixin = (function() {\n function FiltersMixin() {}\n\n FiltersMixin.prototype.selectFilter = function(name, value, load) {\n var existing, location, params;\n if (load == null) {\n load = false;\n }\n params = this.location.search();\n if (params[name] !== void 0 && name !== \"page\") {\n existing = _.map(taiga.toString(params[name]).split(\",\"), function(x) {\n return trim(x);\n });\n existing.push(taiga.toString(value));\n existing = _.compact(existing);\n value = joinStr(\",\", _.uniq(existing));\n }\n if (!this.location.isInCurrentRouteParams(name, value)) {\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n }\n };\n\n FiltersMixin.prototype.replaceFilter = function(name, value, load) {\n var location;\n if (load == null) {\n load = false;\n }\n if (!this.location.isInCurrentRouteParams(name, value)) {\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n }\n };\n\n FiltersMixin.prototype.replaceAllFilters = function(filters, load) {\n var location;\n if (load == null) {\n load = false;\n }\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(filters);\n };\n\n FiltersMixin.prototype.unselectFilter = function(name, value, load) {\n var location, newValues, params, parsedValues;\n if (load == null) {\n load = false;\n }\n params = this.location.search();\n if (params[name] === void 0) {\n return;\n }\n if (value === void 0 || value === null) {\n delete params[name];\n }\n parsedValues = _.map(taiga.toString(params[name]).split(\",\"), function(x) {\n return trim(x);\n });\n newValues = _.reject(parsedValues, function(x) {\n return x === taiga.toString(value);\n });\n newValues = _.compact(newValues);\n if (_.isEmpty(newValues)) {\n value = null;\n } else {\n value = joinStr(\",\", _.uniq(newValues));\n }\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n };\n\n return FiltersMixin;\n\n })();\n\n taiga.FiltersMixin = FiltersMixin;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaAdmin\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/auth.coffee\n */\n\n(function() {\n var AuthService, CancelAccountDirective, ChangeEmailDirective, ChangePasswordFromRecoveryDirective, ForgotPasswordDirective, InvitationDirective, LoginDirective, LoginPage, PublicRegisterMessageDirective, RegisterDirective, debounce, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAuth\", [\"taigaResources\"]);\n\n LoginPage = (function() {\n LoginPage.$inject = ['tgCurrentUserService', '$location', '$tgNavUrls', '$routeParams'];\n\n function LoginPage(currentUserService, $location, $navUrls, $routeParams) {\n var url;\n if (currentUserService.isAuthenticated()) {\n url = $navUrls.resolve(\"home\");\n if ($routeParams['next']) {\n url = $routeParams['next'];\n $location.search('next', null);\n }\n $location.path(url);\n }\n }\n\n return LoginPage;\n\n })();\n\n module.controller('LoginPage', LoginPage);\n\n AuthService = (function(superClass) {\n extend(AuthService, superClass);\n\n AuthService.$inject = [\"$rootScope\", \"$tgStorage\", \"$tgModel\", \"$tgResources\", \"$tgHttp\", \"$tgUrls\", \"$tgConfig\", \"$translate\", \"tgCurrentUserService\", \"tgThemeService\"];\n\n function AuthService(rootscope, storage, model, rs, http, urls, config, translate, currentUserService1, themeService) {\n var userModel;\n this.rootscope = rootscope;\n this.storage = storage;\n this.model = model;\n this.rs = rs;\n this.http = http;\n this.urls = urls;\n this.config = config;\n this.translate = translate;\n this.currentUserService = currentUserService1;\n this.themeService = themeService;\n AuthService.__super__.constructor.call(this);\n userModel = this.getUser();\n this._currentTheme = this._getUserTheme();\n this.setUserdata(userModel);\n }\n\n AuthService.prototype.setUserdata = function(userModel) {\n if (userModel) {\n this.userData = Immutable.fromJS(userModel.getAttrs());\n return this.currentUserService.setUser(this.userData);\n } else {\n return this.userData = null;\n }\n };\n\n AuthService.prototype._getUserTheme = function() {\n var ref;\n return ((ref = this.rootscope.user) != null ? ref.theme : void 0) || this.config.get(\"defaultTheme\") || \"taiga\";\n };\n\n AuthService.prototype._setTheme = function() {\n var newTheme;\n newTheme = this._getUserTheme();\n if (this._currentTheme !== newTheme) {\n this._currentTheme = newTheme;\n return this.themeService.use(this._currentTheme);\n }\n };\n\n AuthService.prototype._setLocales = function() {\n var lang, ref;\n lang = ((ref = this.rootscope.user) != null ? ref.lang : void 0) || this.config.get(\"defaultLanguage\") || \"en\";\n this.translate.preferredLanguage(lang);\n return this.translate.use(lang);\n };\n\n AuthService.prototype.getUser = function() {\n var user, userData;\n if (this.rootscope.user) {\n return this.rootscope.user;\n }\n userData = this.storage.get(\"userInfo\");\n if (userData) {\n user = this.model.make_model(\"users\", userData);\n this.rootscope.user = user;\n this._setLocales();\n this._setTheme();\n return user;\n } else {\n this._setTheme();\n }\n return null;\n };\n\n AuthService.prototype.setUser = function(user) {\n this.rootscope.auth = user;\n this.storage.set(\"userInfo\", user.getAttrs());\n this.rootscope.user = user;\n this.setUserdata(user);\n this._setLocales();\n return this._setTheme();\n };\n\n AuthService.prototype.clear = function() {\n this.rootscope.auth = null;\n this.rootscope.user = null;\n return this.storage.remove(\"userInfo\");\n };\n\n AuthService.prototype.setToken = function(token) {\n return this.storage.set(\"token\", token);\n };\n\n AuthService.prototype.getToken = function() {\n return this.storage.get(\"token\");\n };\n\n AuthService.prototype.removeToken = function() {\n return this.storage.remove(\"token\");\n };\n\n AuthService.prototype.isAuthenticated = function() {\n if (this.getUser() !== null) {\n return true;\n }\n return false;\n };\n\n AuthService.prototype.refresh = function() {\n var url;\n url = this.urls.resolve(\"user-me\");\n return this.http.get(url).then((function(_this) {\n return function(data, status) {\n var user;\n user = data.data;\n user.token = _this.getUser().auth_token;\n user = _this.model.make_model(\"users\", user);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.login = function(data, type) {\n var url;\n url = this.urls.resolve(\"auth\");\n data = _.clone(data, false);\n data.type = type ? type : \"normal\";\n this.removeToken();\n return this.http.post(url, data).then((function(_this) {\n return function(data, status) {\n var user;\n user = _this.model.make_model(\"users\", data.data);\n _this.setToken(user.auth_token);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.logout = function() {\n this.removeToken();\n this.clear();\n this.currentUserService.removeUser();\n this._setTheme();\n return this._setLocales();\n };\n\n AuthService.prototype.register = function(data, type, existing) {\n var url;\n url = this.urls.resolve(\"auth-register\");\n data = _.clone(data, false);\n data.type = type ? type : \"public\";\n if (type === \"private\") {\n data.existing = existing ? existing : false;\n }\n this.removeToken();\n return this.http.post(url, data).then((function(_this) {\n return function(response) {\n var user;\n user = _this.model.make_model(\"users\", response.data);\n _this.setToken(user.auth_token);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.getInvitation = function(token) {\n return this.rs.invitations.get(token);\n };\n\n AuthService.prototype.acceptInvitiationWithNewUser = function(data) {\n return this.register(data, \"private\", false);\n };\n\n AuthService.prototype.acceptInvitiationWithExistingUser = function(data) {\n return this.register(data, \"private\", true);\n };\n\n AuthService.prototype.forgotPassword = function(data) {\n var url;\n url = this.urls.resolve(\"users-password-recovery\");\n data = _.clone(data, false);\n this.removeToken();\n return this.http.post(url, data);\n };\n\n AuthService.prototype.changePasswordFromRecovery = function(data) {\n var url;\n url = this.urls.resolve(\"users-change-password-from-recovery\");\n data = _.clone(data, false);\n this.removeToken();\n return this.http.post(url, data);\n };\n\n AuthService.prototype.changeEmail = function(data) {\n var url;\n url = this.urls.resolve(\"users-change-email\");\n data = _.clone(data, false);\n return this.http.post(url, data);\n };\n\n AuthService.prototype.cancelAccount = function(data) {\n var url;\n url = this.urls.resolve(\"users-cancel-account\");\n data = _.clone(data, false);\n return this.http.post(url, data);\n };\n\n return AuthService;\n\n })(taiga.Service);\n\n module.service(\"$tgAuth\", AuthService);\n\n PublicRegisterMessageDirective = function($config, $navUrls, $routeParams, templates) {\n var template, templateFn;\n template = templates.get(\"auth/login-text.html\", true);\n templateFn = function() {\n var nextUrl, publicRegisterEnabled, url;\n publicRegisterEnabled = $config.get(\"publicRegisterEnabled\");\n if (!publicRegisterEnabled) {\n return \"\";\n }\n url = $navUrls.resolve(\"register\");\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"register\")) {\n nextUrl = encodeURIComponent($routeParams['next']);\n url += \"?next=\" + nextUrl;\n }\n return template({\n url: url\n });\n };\n return {\n restrict: \"AE\",\n scope: {},\n template: templateFn\n };\n };\n\n module.directive(\"tgPublicRegisterMessage\", [\"$tgConfig\", \"$tgNavUrls\", \"$routeParams\", \"$tgTemplate\", PublicRegisterMessageDirective]);\n\n LoginDirective = function($auth, $confirm, $location, $config, $routeParams, $navUrls, $events, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onError, onSuccess, submit;\n form = new checksley.Form($el.find(\"form.login-form\"));\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"login\")) {\n $scope.nextUrl = decodeURIComponent($routeParams['next']);\n } else {\n $scope.nextUrl = $navUrls.resolve(\"home\");\n }\n onSuccess = function(response) {\n $events.setupConnection();\n return $location.url($scope.nextUrl);\n };\n onError = function(response) {\n return $confirm.notify(\"light-error\", $translate.instant(\"LOGIN_FORM.ERROR_AUTH_INCORRECT\"));\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, loginFormType, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n data = {\n \"username\": $el.find(\"form.login-form input[name=username]\").val(),\n \"password\": $el.find(\"form.login-form input[name=password]\").val()\n };\n loginFormType = $config.get(\"loginFormType\", \"normal\");\n promise = $auth.login(data, loginFormType);\n return promise.then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n window.prerenderReady = true;\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLogin\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgConfig\", \"$routeParams\", \"$tgNavUrls\", \"$tgEvents\", \"$translate\", LoginDirective]);\n\n RegisterDirective = function($auth, $confirm, $location, $navUrls, $config, $routeParams, $analytics, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n if (!$config.get(\"publicRegisterEnabled\")) {\n $location.path($navUrls.resolve(\"not-found\"));\n $location.replace();\n }\n $scope.data = {};\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n $scope.nextUrl = $navUrls.resolve(\"home\");\n onSuccessSubmit = function(response) {\n $analytics.trackEvent(\"auth\", \"register\", \"user registration\", 1);\n return $location.url($scope.nextUrl);\n };\n onErrorSubmit = function(response) {\n var text;\n if (response.data._error_message) {\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n $confirm.notify(\"light-error\", text);\n }\n return form.setErrors(response.data);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.register($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return window.prerenderReady = true;\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRegister\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\", \"$routeParams\", \"$tgAnalytics\", \"$translate\", RegisterDirective]);\n\n ForgotPasswordDirective = function($auth, $confirm, $location, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var message, title;\n $location.path($navUrls.resolve(\"login\"));\n title = $translate.instant(\"FORGOT_PASSWORD_FORM.SUCCESS_TITLE\");\n message = $translate.instant(\"FORGOT_PASSWORD_FORM.SUCCESS_TEXT\");\n return $confirm.success(title, message);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"FORGOT_PASSWORD_FORM.ERROR\");\n return $confirm.notify(\"light-error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.forgotPassword($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return window.prerenderReady = true;\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgForgotPassword\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$translate\", ForgotPasswordDirective]);\n\n ChangePasswordFromRecoveryDirective = function($auth, $confirm, $location, $params, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit, text;\n $scope.data = {};\n if ($params.token != null) {\n $scope.tokenInParams = true;\n $scope.data.token = $params.token;\n } else {\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.ERROR\");\n $confirm.notify(\"light-error\", text);\n }\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.ERROR\");\n return $confirm.notify(\"light-error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.changePasswordFromRecovery($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangePasswordFromRecovery\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$translate\", ChangePasswordFromRecoveryDirective]);\n\n InvitationDirective = function($auth, $confirm, $location, $params, $navUrls, $analytics, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var loginForm, onErrorSubmitLogin, onErrorSubmitRegister, onSuccessSubmitLogin, onSuccessSubmitRegister, promise, registerForm, submitLogin, submitRegister, token;\n token = $params.token;\n promise = $auth.getInvitation(token);\n promise.then(function(invitation) {\n return $scope.invitation = invitation;\n });\n promise.then(null, function(response) {\n var text;\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"INVITATION_LOGIN_FORM.NOT_FOUND\");\n return $confirm.notify(\"light-error\", text);\n });\n $scope.dataLogin = {\n token: token\n };\n loginForm = $el.find(\"form.login-form\").checksley({\n onlyOneErrorElement: true\n });\n onSuccessSubmitLogin = function(response) {\n var text;\n $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with existing user\", 1);\n $location.path($navUrls.resolve(\"project\", {\n project: $scope.invitation.project_slug\n }));\n text = $translate.instant(\"INVITATION_LOGIN_FORM.SUCCESS\", {\n \"project_name\": $scope.invitation.project_name\n });\n return $confirm.notify(\"success\", text);\n };\n onErrorSubmitLogin = function(response) {\n return $confirm.notify(\"light-error\", response.data._error_message);\n };\n submitLogin = debounce(2000, (function(_this) {\n return function(event) {\n event.preventDefault();\n if (!loginForm.validate()) {\n return;\n }\n promise = $auth.acceptInvitiationWithExistingUser($scope.dataLogin);\n return promise.then(onSuccessSubmitLogin, onErrorSubmitLogin);\n };\n })(this));\n $el.on(\"submit\", \"form.login-form\", submitLogin);\n $el.on(\"click\", \".button-login\", submitLogin);\n $scope.dataRegister = {\n token: token\n };\n registerForm = $el.find(\"form.register-form\").checksley({\n onlyOneErrorElement: true\n });\n onSuccessSubmitRegister = function(response) {\n $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with new user\", 1);\n $location.path($navUrls.resolve(\"project\", {\n project: $scope.invitation.project_slug\n }));\n return $confirm.notify(\"success\", \"You've successfully joined this project\", \"Welcome to \" + (_.escape($scope.invitation.project_name)));\n };\n onErrorSubmitRegister = function(response) {\n var text;\n if (response.data._error_message) {\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n $confirm.notify(\"light-error\", text);\n }\n return registerForm.setErrors(response.data);\n };\n submitRegister = debounce(2000, (function(_this) {\n return function(event) {\n event.preventDefault();\n if (!registerForm.validate()) {\n return;\n }\n promise = $auth.acceptInvitiationWithNewUser($scope.dataRegister);\n return promise.then(onSuccessSubmitRegister, onErrorSubmitRegister);\n };\n })(this));\n $el.on(\"submit\", \"form.register-form\", submitRegister);\n $el.on(\"click\", \".button-register\", submitRegister);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgInvitation\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\", InvitationDirective]);\n\n ChangeEmailDirective = function($repo, $model, $auth, $confirm, $location, $params, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n $scope.data.email_token = $params.email_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var text;\n if ($auth.isAuthenticated()) {\n $repo.queryOne(\"users\", $auth.getUser().id).then((function(_this) {\n return function(data) {\n $auth.setUser(data);\n return $location.path($navUrls.resolve(\"home\"));\n };\n })(this));\n } else {\n $location.path($navUrls.resolve(\"login\"));\n }\n text = $translate.instant(\"CHANGE_EMAIL_FORM.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n return $confirm.notify(\"light-error\", text);\n };\n submit = function() {\n var promise;\n if (!form.validate()) {\n return;\n }\n promise = $auth.changeEmail($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n $el.on(\"submit\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \"a.button-change-email\", function(event) {\n event.preventDefault();\n return submit();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangeEmail\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$translate\", ChangeEmailDirective]);\n\n CancelAccountDirective = function($repo, $model, $auth, $confirm, $location, $params, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n $scope.data.cancel_token = $params.cancel_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var text;\n $auth.logout();\n $location.path($navUrls.resolve(\"home\"));\n text = $translate.instant(\"CANCEL_ACCOUNT.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n return $confirm.notify(\"error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.cancelAccount($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgCancelAccount\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", CancelAccountDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaBacklog\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base.coffee\n */\n\n(function() {\n var TaigaMainDirective, bindOnce, groupBy, init, module, taiga, urls;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaBase\", []);\n\n TaigaMainDirective = function($rootscope, $window) {\n var link;\n link = function($scope, $el, $attrs) {\n return $window.onresize = function() {\n return $rootscope.$broadcast(\"resize\");\n };\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMain\", [\"$rootScope\", \"$window\", TaigaMainDirective]);\n\n urls = {\n \"home\": \"/\",\n \"projects\": \"/projects\",\n \"error\": \"/error\",\n \"not-found\": \"/not-found\",\n \"permission-denied\": \"/permission-denied\",\n \"discover\": \"/discover\",\n \"discover-search\": \"/discover/search\",\n \"login\": \"/login\",\n \"forgot-password\": \"/forgot-password\",\n \"change-password\": \"/change-password/:token\",\n \"change-email\": \"/change-email/:token\",\n \"cancel-account\": \"/cancel-account/:token\",\n \"register\": \"/register\",\n \"invitation\": \"/invitation/:token\",\n \"create-project\": \"/create-project\",\n \"profile\": \"/profile\",\n \"user-profile\": \"/profile/:username\",\n \"blocked-project\": \"/blocked-project/:project\",\n \"project\": \"/project/:project\",\n \"project-backlog\": \"/project/:project/backlog\",\n \"project-taskboard\": \"/project/:project/taskboard/:sprint\",\n \"project-kanban\": \"/project/:project/kanban\",\n \"project-issues\": \"/project/:project/issues\",\n \"project-search\": \"/project/:project/search\",\n \"project-userstories-detail\": \"/project/:project/us/:ref\",\n \"project-tasks-detail\": \"/project/:project/task/:ref\",\n \"project-issues-detail\": \"/project/:project/issue/:ref\",\n \"project-wiki\": \"/project/:project/wiki\",\n \"project-wiki-page\": \"/project/:project/wiki/:slug\",\n \"project-team\": \"/project/:project/team\",\n \"project-admin-home\": \"/project/:project/admin/project-profile/details\",\n \"project-admin-project-profile-details\": \"/project/:project/admin/project-profile/details\",\n \"project-admin-project-profile-default-values\": \"/project/:project/admin/project-profile/default-values\",\n \"project-admin-project-profile-modules\": \"/project/:project/admin/project-profile/modules\",\n \"project-admin-project-profile-export\": \"/project/:project/admin/project-profile/export\",\n \"project-admin-project-profile-reports\": \"/project/:project/admin/project-profile/reports\",\n \"project-admin-project-values-status\": \"/project/:project/admin/project-values/status\",\n \"project-admin-project-values-points\": \"/project/:project/admin/project-values/points\",\n \"project-admin-project-values-priorities\": \"/project/:project/admin/project-values/priorities\",\n \"project-admin-project-values-severities\": \"/project/:project/admin/project-values/severities\",\n \"project-admin-project-values-types\": \"/project/:project/admin/project-values/types\",\n \"project-admin-project-values-custom-fields\": \"/project/:project/admin/project-values/custom-fields\",\n \"project-admin-memberships\": \"/project/:project/admin/memberships\",\n \"project-admin-roles\": \"/project/:project/admin/roles\",\n \"project-admin-third-parties-webhooks\": \"/project/:project/admin/third-parties/webhooks\",\n \"project-admin-third-parties-github\": \"/project/:project/admin/third-parties/github\",\n \"project-admin-third-parties-gitlab\": \"/project/:project/admin/third-parties/gitlab\",\n \"project-admin-third-parties-bitbucket\": \"/project/:project/admin/third-parties/bitbucket\",\n \"project-admin-contrib\": \"/project/:project/admin/contrib/:plugin\",\n \"user-settings-user-profile\": \"/user-settings/user-profile\",\n \"user-settings-user-change-password\": \"/user-settings/user-change-password\",\n \"user-settings-user-avatar\": \"/user-settings/user-avatar\",\n \"user-settings-mail-notifications\": \"/user-settings/mail-notifications\",\n \"user-settings-contrib\": \"/user-settings/contrib/:plugin\"\n };\n\n init = function($log, $navurls) {\n $log.debug(\"Initialize navigation urls\");\n return $navurls.update(urls);\n };\n\n module.run([\"$log\", \"$tgNavUrls\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common.coffee\n */\n\n(function() {\n var AnimationFrame, Capslock, CheckPermissionDirective, ClassPermissionDirective, DataPickerConfig, ProjectUrl, Qqueue, SelectedText, Template, ToggleCommentDirective, module, taiga,\n slice = [].slice;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\", []);\n\n DataPickerConfig = function($translate) {\n return {\n get: function() {\n return {\n i18n: {\n previousMonth: $translate.instant(\"COMMON.PICKERDATE.PREV_MONTH\"),\n nextMonth: $translate.instant(\"COMMON.PICKERDATE.NEXT_MONTH\"),\n months: [$translate.instant(\"COMMON.PICKERDATE.MONTHS.JAN\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.FEB\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.MAR\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.APR\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.MAY\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.JUN\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.JUL\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.AUG\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.SEP\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.OCT\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.NOV\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.DEC\")],\n weekdays: [$translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.SUN\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.MON\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.TUE\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.WED\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.THU\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.FRI\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.SAT\")],\n weekdaysShort: [$translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.SUN\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.MON\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.TUE\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.WED\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.THU\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.FRI\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.SAT\")]\n },\n isRTL: $translate.instant(\"COMMON.PICKERDATE.IS_RTL\") === \"true\",\n firstDay: parseInt($translate.instant(\"COMMON.PICKERDATE.FIRST_DAY_OF_WEEK\"), 10),\n format: $translate.instant(\"COMMON.PICKERDATE.FORMAT\")\n };\n }\n };\n };\n\n module.factory(\"tgDatePickerConfigService\", [\"$translate\", DataPickerConfig]);\n\n SelectedText = function($window, $document) {\n var get;\n get = function() {\n if ($window.getSelection) {\n return $window.getSelection().toString();\n } else if ($document.selection) {\n return $document.selection.createRange().text;\n }\n return \"\";\n };\n return {\n get: get\n };\n };\n\n module.factory(\"$selectedText\", [\"$window\", \"$document\", SelectedText]);\n\n CheckPermissionDirective = function(projectService) {\n var link, render;\n render = function($el, project, permission) {\n if (project && permission) {\n if (project.get('my_permissions').indexOf(permission) > -1) {\n return $el.removeClass('hidden');\n }\n }\n };\n link = function($scope, $el, $attrs) {\n var permission, unObserve, unwatch;\n $el.addClass('hidden');\n permission = $attrs.tgCheckPermission;\n unwatch = $scope.$watch(function() {\n return projectService.project;\n }, function() {\n if (!projectService.project) {\n return;\n }\n render($el, projectService.project, permission);\n return unwatch();\n });\n unObserve = $attrs.$observe(\"tgCheckPermission\", function(permission) {\n if (!permission) {\n return;\n }\n render($el, projectService.project, permission);\n return unObserve();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n CheckPermissionDirective.$inject = [\"tgProjectService\"];\n\n module.directive(\"tgCheckPermission\", CheckPermissionDirective);\n\n ClassPermissionDirective = function() {\n var link, name;\n name = \"tgClassPermission\";\n link = function($scope, $el, $attrs) {\n var checkPermissions, tgClassPermissionWatchAction, unbindWatcher;\n checkPermissions = function(project, className, permission) {\n var negation;\n negation = permission[0] === \"!\";\n if (negation) {\n permission = permission.slice(1);\n }\n if (negation && project.my_permissions.indexOf(permission) === -1) {\n return $el.addClass(className);\n } else if (!negation && project.my_permissions.indexOf(permission) !== -1) {\n return $el.addClass(className);\n } else {\n return $el.removeClass(className);\n }\n };\n tgClassPermissionWatchAction = function(project) {\n var className, classes, permission, results;\n if (project) {\n unbindWatcher();\n classes = $scope.$eval($attrs[name]);\n results = [];\n for (className in classes) {\n permission = classes[className];\n results.push(checkPermissions(project, className, permission));\n }\n return results;\n }\n };\n return unbindWatcher = $scope.$watch(\"project\", tgClassPermissionWatchAction);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgClassPermission\", ClassPermissionDirective);\n\n AnimationFrame = function() {\n var add, animationFrame, performAnimation, tail;\n animationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;\n performAnimation = (function(_this) {\n return function(time) {\n var fn;\n fn = tail.shift();\n fn();\n if (tail.length) {\n return animationFrame(performAnimation);\n }\n };\n })(this);\n tail = [];\n add = function() {\n var fn, i, len, results;\n results = [];\n for (i = 0, len = arguments.length; i < len; i++) {\n fn = arguments[i];\n tail.push(fn);\n if (tail.length === 1) {\n results.push(animationFrame(performAnimation));\n } else {\n results.push(void 0);\n }\n }\n return results;\n };\n return {\n add: add\n };\n };\n\n module.factory(\"animationFrame\", AnimationFrame);\n\n ToggleCommentDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.find(\"textarea\").on(\"focus\", function() {\n return $el.addClass(\"active\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgToggleComment\", ToggleCommentDirective);\n\n ProjectUrl = function($navurls) {\n var get;\n get = function(project) {\n var ctx;\n ctx = {\n project: project.slug\n };\n if (project.is_backlog_activated && project.my_permissions.indexOf(\"view_us\") > -1) {\n return $navurls.resolve(\"project-backlog\", ctx);\n }\n if (project.is_kanban_activated && project.my_permissions.indexOf(\"view_us\") > -1) {\n return $navurls.resolve(\"project-kanban\", ctx);\n }\n if (project.is_wiki_activated && project.my_permissions.indexOf(\"view_wiki_pages\") > -1) {\n return $navurls.resolve(\"project-wiki\", ctx);\n }\n if (project.is_issues_activated && project.my_permissions.indexOf(\"view_issues\") > -1) {\n return $navurls.resolve(\"project-issues\", ctx);\n }\n return $navurls.resolve(\"project\", ctx);\n };\n return {\n get: get\n };\n };\n\n module.factory(\"$projectUrl\", [\"$tgNavUrls\", ProjectUrl]);\n\n Qqueue = function($q) {\n var deferred, lastPromise, qqueue;\n deferred = $q.defer();\n deferred.resolve();\n lastPromise = deferred.promise;\n qqueue = {\n bindAdd: (function(_this) {\n return function(fn) {\n return function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return lastPromise = lastPromise.then(function() {\n return fn.apply(_this, args);\n });\n };\n return qqueue;\n };\n })(this),\n add: (function(_this) {\n return function(fn) {\n if (!lastPromise) {\n lastPromise = fn();\n } else {\n lastPromise = lastPromise.then(fn);\n }\n return qqueue;\n };\n })(this)\n };\n return qqueue;\n };\n\n module.factory(\"$tgQqueue\", [\"$q\", Qqueue]);\n\n Template = function($templateCache) {\n return {\n get: (function(_this) {\n return function(name, lodash) {\n var tmp;\n if (lodash == null) {\n lodash = false;\n }\n tmp = $templateCache.get(name);\n if (lodash) {\n tmp = _.template(tmp);\n }\n return tmp;\n };\n })(this)\n };\n };\n\n module.factory(\"$tgTemplate\", [\"$templateCache\", Template]);\n\n Capslock = function($translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var hideIcon, open, showIcon, warningIcon;\n open = false;\n warningIcon = \"\";\n hideIcon = function() {\n return $('.icon-capslock').fadeOut(function() {\n open = false;\n return $(this).remove();\n });\n };\n showIcon = function(e) {\n var element;\n if (open) {\n return;\n }\n element = e.currentTarget;\n $(element).parent().append(warningIcon);\n $('.icon-capslock').fadeIn();\n return open = true;\n };\n $el.on('blur', function(e) {\n return hideIcon();\n });\n $el.on('keyup.capslock, focus', function(e) {\n if ($el.val() === $el.val().toLowerCase()) {\n return hideIcon(e);\n } else {\n return showIcon(e);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off('.capslock');\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgCapslock\", [\"$translate\", Capslock]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/events.coffee\n */\n\n(function() {\n var EventsProvider, EventsService, bindMethods, module, startswith, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n startswith = this.taiga.startswith;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaEvents\", []);\n\n EventsService = (function() {\n function EventsService(win, log, config, auth, liveAnnouncementService1, rootScope) {\n this.win = win;\n this.log = log;\n this.config = config;\n this.auth = auth;\n this.liveAnnouncementService = liveAnnouncementService1;\n this.rootScope = rootScope;\n this.processMessage = bind(this.processMessage, this);\n bindMethods(this);\n }\n\n EventsService.prototype.initialize = function(sessionId) {\n this.sessionId = sessionId;\n this.subscriptions = {};\n this.connected = false;\n this.error = false;\n this.pendingMessages = [];\n this.missedHeartbeats = 0;\n this.heartbeatInterval = null;\n if (this.win.WebSocket === void 0) {\n return this.log.info(\"WebSockets not supported on your browser\");\n }\n };\n\n EventsService.prototype.setupConnection = function() {\n var loc, path, scheme, url;\n this.stopExistingConnection();\n url = this.config.get(\"eventsUrl\");\n if (!url) {\n return;\n }\n if (!startswith(url, \"ws:\") && !startswith(url, \"wss:\")) {\n loc = this.win.location;\n scheme = loc.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n path = _.trimStart(url, \"/\");\n url = scheme + \"//\" + loc.host + \"/\" + path;\n }\n this.ws = new this.win.WebSocket(url);\n this.ws.addEventListener(\"open\", this.onOpen);\n this.ws.addEventListener(\"message\", this.onMessage);\n this.ws.addEventListener(\"error\", this.onError);\n return this.ws.addEventListener(\"close\", this.onClose);\n };\n\n EventsService.prototype.stopExistingConnection = function() {\n if (this.ws === void 0) {\n return;\n }\n this.ws.removeEventListener(\"open\", this.onOpen);\n this.ws.removeEventListener(\"close\", this.onClose);\n this.ws.removeEventListener(\"error\", this.onError);\n this.ws.removeEventListener(\"message\", this.onMessage);\n this.stopHeartBeatMessages();\n this.ws.close();\n return delete this.ws;\n };\n\n EventsService.prototype.notifications = function() {\n return this.subscribe(null, 'notifications', (function(_this) {\n return function(data) {\n _this.liveAnnouncementService.show(data.title, data.desc);\n return _this.rootScope.$digest();\n };\n })(this));\n };\n\n EventsService.prototype.startHeartBeatMessages = function() {\n var heartbeatIntervalTime, maxMissedHeartbeats;\n if (this.heartbeatInterval) {\n return;\n }\n maxMissedHeartbeats = this.config.get(\"eventsMaxMissedHeartbeats\", 5);\n heartbeatIntervalTime = this.config.get(\"eventsHeartbeatIntervalTime\", 60000);\n this.missedHeartbeats = 0;\n this.heartbeatInterval = setInterval((function(_this) {\n return function() {\n var e, error1;\n try {\n if (_this.missedHeartbeats >= maxMissedHeartbeats) {\n throw new Error(\"Too many missed heartbeats PINGs.\");\n }\n _this.missedHeartbeats++;\n _this.sendMessage({\n cmd: \"ping\"\n });\n return _this.log.debug(\"HeartBeat send PING\");\n } catch (error1) {\n e = error1;\n _this.log.error(\"HeartBeat error: \" + e.message);\n return _this.stopHeartBeatMessages();\n }\n };\n })(this), heartbeatIntervalTime);\n return this.log.debug(\"HeartBeat enabled\");\n };\n\n EventsService.prototype.stopHeartBeatMessages = function() {\n if (!this.heartbeatInterval) {\n return;\n }\n clearInterval(this.heartbeatInterval);\n this.heartbeatInterval = null;\n return this.log.debug(\"HeartBeat disabled\");\n };\n\n EventsService.prototype.processHeartBeatPongMessage = function(data) {\n this.missedHeartbeats = 0;\n return this.log.debug(\"HeartBeat recived PONG\");\n };\n\n EventsService.prototype.serialize = function(message) {\n if (_.isObject(message)) {\n return JSON.stringify(message);\n }\n return message;\n };\n\n EventsService.prototype.sendMessage = function(message) {\n var i, len, messages, msg, results;\n this.pendingMessages.push(message);\n if (!this.connected) {\n return;\n }\n messages = _.map(this.pendingMessages, this.serialize);\n this.pendingMessages = [];\n results = [];\n for (i = 0, len = messages.length; i < len; i++) {\n msg = messages[i];\n results.push(this.ws.send(msg));\n }\n return results;\n };\n\n EventsService.prototype.processMessage = function(data) {\n var routingKey, subscription;\n routingKey = data.routing_key;\n if (this.subscriptions[routingKey] == null) {\n return;\n }\n subscription = this.subscriptions[routingKey];\n if (subscription.scope) {\n return subscription.scope.$apply(function() {\n return subscription.callback(data.data);\n });\n } else {\n return subscription.callback(data.data);\n }\n };\n\n EventsService.prototype.subscribe = function(scope, routingKey, callback) {\n var message, subscription;\n if (this.error) {\n return;\n }\n this.log.debug(\"Subscribe to: \" + routingKey);\n subscription = {\n scope: scope,\n routingKey: routingKey,\n callback: _.debounce(callback, 500, {\n \"leading\": true,\n \"trailing\": false\n })\n };\n message = {\n \"cmd\": \"subscribe\",\n \"routing_key\": routingKey\n };\n this.subscriptions[routingKey] = subscription;\n this.sendMessage(message);\n if (scope) {\n return scope.$on(\"$destroy\", (function(_this) {\n return function() {\n return _this.unsubscribe(routingKey);\n };\n })(this));\n }\n };\n\n EventsService.prototype.unsubscribe = function(routingKey) {\n var message;\n if (this.error) {\n return;\n }\n this.log.debug(\"Unsubscribe from: \" + routingKey);\n message = {\n \"cmd\": \"unsubscribe\",\n \"routing_key\": routingKey\n };\n return this.sendMessage(message);\n };\n\n EventsService.prototype.onOpen = function() {\n var message, token;\n this.connected = true;\n this.startHeartBeatMessages();\n this.notifications();\n this.log.debug(\"WebSocket connection opened\");\n token = this.auth.getToken();\n message = {\n cmd: \"auth\",\n data: {\n token: token,\n sessionId: this.sessionId\n }\n };\n return this.sendMessage(message);\n };\n\n EventsService.prototype.onMessage = function(event) {\n var data;\n this.log.debug(\"WebSocket message received: \" + event.data);\n data = JSON.parse(event.data);\n if (data.cmd === \"pong\") {\n return this.processHeartBeatPongMessage(data);\n } else {\n return this.processMessage(data);\n }\n };\n\n EventsService.prototype.onError = function(error) {\n this.log.error(\"WebSocket error: \" + error);\n return this.error = true;\n };\n\n EventsService.prototype.onClose = function() {\n this.log.debug(\"WebSocket closed.\");\n this.connected = false;\n return this.stopHeartBeatMessages();\n };\n\n return EventsService;\n\n })();\n\n EventsProvider = (function() {\n function EventsProvider() {}\n\n EventsProvider.prototype.setSessionId = function(sessionId) {\n return this.sessionId = sessionId;\n };\n\n EventsProvider.prototype.$get = function($win, $log, $conf, $auth, liveAnnouncementService, $rootScope) {\n var service;\n service = new EventsService($win, $log, $conf, $auth, liveAnnouncementService, $rootScope);\n service.initialize(this.sessionId);\n return service;\n };\n\n EventsProvider.prototype.$get.$inject = [\"$window\", \"$log\", \"$tgConfig\", \"$tgAuth\", \"tgLiveAnnouncementService\", \"$rootScope\"];\n\n return EventsProvider;\n\n })();\n\n module.provider(\"$tgEvents\", EventsProvider);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/feedback.coffee\n */\n\n(function() {\n var FeedbackDirective, bindOnce, debounce, groupBy, mixOf, module, taiga, trim;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n mixOf = this.taiga.mixOf;\n\n debounce = this.taiga.debounce;\n\n trim = this.taiga.trim;\n\n module = angular.module(\"taigaFeedback\", []);\n\n FeedbackDirective = function($lightboxService, $repo, $confirm, $loading, feedbackService) {\n var directive, link;\n link = function($scope, $el, $attrs) {\n var form, openLightbox, submit, submitButton;\n form = $el.find(\"form\").checksley();\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.create(\"feedback\", $scope.feedback);\n promise.then(function(data) {\n currentLoading.finish();\n $lightboxService.close($el);\n return $confirm.notify(\"success\", \"\\\\o/ we'll be happy to read your\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n openLightbox = function() {\n $scope.feedback = {};\n $lightboxService.open($el);\n return $el.find(\"textarea\").focus();\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return openLightbox();\n };\n directive = {\n link: link,\n templateUrl: \"common/lightbox-feedback.html\",\n scope: {}\n };\n return directive;\n };\n\n module.directive(\"tgLbFeedback\", [\"lightboxService\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"tgFeedbackService\", FeedbackDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/integrations.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaIntegrations\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaIssues\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/kanban.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaKanban\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/projects.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaProject\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/related-tasks.coffee\n */\n\n(function() {\n var RelatedTaskAssignedToInlineEditionDirective, RelatedTaskCreateButtonDirective, RelatedTaskCreateFormDirective, RelatedTaskRowDirective, RelatedTasksDirective, debounce, module, taiga, trim;\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaRelatedTasks\", []);\n\n RelatedTaskRowDirective = function($repo, $compile, $confirm, $rootscope, $loading, $template, $translate) {\n var link, templateEdit, templateView;\n templateView = $template.get(\"task/related-task-row.html\", true);\n templateEdit = $template.get(\"task/related-task-row-edit.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var renderEdit, renderView, saveTask;\n saveTask = debounce(2000, function(task) {\n var currentLoading, promise;\n task.subject = $el.find('input').val();\n currentLoading = $loading().target($el.find('.task-name')).start();\n promise = $repo.save(task);\n promise.then((function(_this) {\n return function() {\n currentLoading.finish();\n return $rootscope.$broadcast(\"related-tasks:update\");\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n currentLoading.finish();\n $el.find('input').val(task.subject);\n return $confirm.notify(\"error\");\n };\n })(this));\n return promise;\n });\n renderEdit = function(task) {\n $el.html($compile(templateEdit({\n task: task\n }))($scope));\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return saveTask($model.$modelValue).then(function() {\n return renderView($model.$modelValue);\n });\n } else if (event.keyCode === 27) {\n return renderView($model.$modelValue);\n }\n });\n $el.on(\"click\", \".save-task\", function(event) {\n return saveTask($model.$modelValue).then(function() {\n return renderView($model.$modelValue);\n });\n });\n return $el.on(\"click\", \".cancel-edit\", function(event) {\n return renderView($model.$modelValue);\n });\n };\n renderView = function(task) {\n var perms;\n $el.off();\n perms = {\n modify_task: $scope.project.my_permissions.indexOf(\"modify_task\") !== -1,\n delete_task: $scope.project.my_permissions.indexOf(\"delete_task\") !== -1\n };\n $el.html($compile(templateView({\n task: task,\n perms: perms\n }))($scope));\n $el.on(\"click\", \".edit-task\", function() {\n renderEdit($model.$modelValue);\n return $el.find('input').focus().select();\n });\n return $el.on(\"click\", \".delete-task\", function(event) {\n var message, title;\n title = $translate.instant(\"TASK.TITLE_DELETE_ACTION\");\n task = $model.$modelValue;\n message = task.subject;\n return $confirm.askOnDelete(title, message).then(function(askResponse) {\n var promise;\n promise = $repo.remove(task);\n promise.then(function() {\n askResponse.finish();\n return $scope.$emit(\"related-tasks:delete\");\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n });\n });\n };\n $scope.$watch($attrs.ngModel, function(val) {\n if (!val) {\n return;\n }\n return renderView(val);\n });\n $scope.$on(\"related-tasks:assigned-to-changed\", function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n $scope.$on(\"related-tasks:status-changed\", function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgRelatedTaskRow\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$rootScope\", \"$tgLoading\", \"$tgTemplate\", \"$translate\", RelatedTaskRowDirective]);\n\n RelatedTaskCreateFormDirective = function($repo, $compile, $confirm, $tgmodel, $loading, $analytics, $template) {\n var link, newTask, template;\n template = $template.get(\"task/related-task-create-form.html\", true);\n newTask = {\n subject: \"\",\n assigned_to: null\n };\n link = function($scope, $el, $attrs) {\n var close, createTask, render;\n createTask = debounce(2000, function(task) {\n var currentLoading, promise;\n task.subject = $el.find('input').val();\n task.assigned_to = $scope.newTask.assigned_to;\n task.status = $scope.newTask.status;\n $scope.newTask.status = $scope.project.default_task_status;\n $scope.newTask.assigned_to = null;\n currentLoading = $loading().target($el.find('.task-name')).start();\n promise = $repo.create(\"tasks\", task);\n promise.then(function() {\n $analytics.trackEvent(\"task\", \"create\", \"create task on userstory\", 1);\n currentLoading.finish();\n return $scope.$emit(\"related-tasks:add\");\n });\n promise.then(null, function() {\n $el.find('input').val(task.subject);\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n return promise;\n });\n close = function() {\n $el.off();\n $el.html(\"\");\n return $scope.newRelatedTaskFormOpen = false;\n };\n render = function() {\n $scope.newRelatedTaskFormOpen = true;\n $el.html($compile(template())($scope));\n $el.find('input').focus().select();\n $el.addClass('active');\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return createTask(newTask).then(function() {\n return render();\n });\n } else if (event.keyCode === 27) {\n return $scope.$apply(function() {\n return close();\n });\n }\n });\n $el.on(\"click\", \".icon-close\", function(event) {\n return $scope.$apply(function() {\n return close();\n });\n });\n return $el.on(\"click\", \".icon-save\", function(event) {\n return createTask(newTask).then(function() {\n return close();\n });\n });\n };\n taiga.bindOnce($scope, \"us\", function(val) {\n newTask[\"status\"] = $scope.project.default_task_status;\n newTask[\"project\"] = $scope.project.id;\n newTask[\"user_story\"] = $scope.us.id;\n $scope.newTask = $tgmodel.make_model(\"tasks\", newTask);\n return $el.html(\"\");\n });\n $scope.$on(\"related-tasks:show-form\", function() {\n return render();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskCreateForm\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgLoading\", \"$tgAnalytics\", \"$tgTemplate\", RelatedTaskCreateFormDirective]);\n\n RelatedTaskCreateButtonDirective = function($repo, $compile, $confirm, $tgmodel, $template) {\n var link, template;\n template = $template.get(\"common/components/add-button.html\", true);\n link = function($scope, $el, $attrs) {\n $scope.$watch(\"project\", function(val) {\n if (!val) {\n return;\n }\n $el.off();\n if ($scope.project.my_permissions.indexOf(\"add_task\") !== -1) {\n $el.html($compile(template())($scope));\n } else {\n $el.html(\"\");\n }\n return $el.on(\"click\", \".add-button\", function(event) {\n return $scope.$emit(\"related-tasks:add-new-clicked\");\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskCreateButton\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgTemplate\", RelatedTaskCreateButtonDirective]);\n\n RelatedTasksDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var _isEditable, _isVisible, loadTasks;\n loadTasks = function() {\n return $rs.tasks.list($scope.projectId, null, $scope.usId).then((function(_this) {\n return function(tasks) {\n $scope.tasks = _.sortBy(tasks, 'ref');\n return tasks;\n };\n })(this));\n };\n _isVisible = function() {\n if ($scope.project) {\n return $scope.project.my_permissions.indexOf(\"view_tasks\") !== -1;\n }\n return false;\n };\n _isEditable = function() {\n if ($scope.project) {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n }\n return false;\n };\n $scope.showRelatedTasks = function() {\n var ref;\n return _isVisible() && (_isEditable() || ((ref = $scope.tasks) != null ? ref.length : void 0));\n };\n $scope.$on(\"related-tasks:add\", function() {\n return loadTasks().then(function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n });\n $scope.$on(\"related-tasks:delete\", function() {\n return loadTasks().then(function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n });\n $scope.$on(\"related-tasks:add-new-clicked\", function() {\n return $scope.$broadcast(\"related-tasks:show-form\");\n });\n taiga.bindOnce($scope, \"us\", function(val) {\n return loadTasks();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTasks\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", RelatedTasksDirective]);\n\n RelatedTaskAssignedToInlineEditionDirective = function($repo, $rootscope, $translate) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task, updateRelatedTask;\n updateRelatedTask = function(task) {\n var ctx, member;\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\"\n };\n member = $scope.usersById[task.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name_display;\n }\n $el.find(\".avatar\").html(template(ctx));\n return $el.find(\".task-assignedto\").attr('title', ctx.name);\n };\n $ctrl = $el.controller();\n task = $scope.$eval($attrs.tgRelatedTaskAssignedToInlineEdition);\n notAutoSave = $scope.$eval($attrs.notAutoSave);\n autoSave = !notAutoSave;\n updateRelatedTask(task);\n $el.on(\"click\", \".task-assignedto\", function(event) {\n return $rootscope.$broadcast(\"assigned-to:add\", task);\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_task\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"assigned-to:added\", debounce(2000, (function(_this) {\n return function(ctx, userId, updatedRelatedTask) {\n if (updatedRelatedTask.id === task.id) {\n updatedRelatedTask.assigned_to = userId;\n if (autoSave) {\n $repo.save(updatedRelatedTask).then(function() {\n return $scope.$emit(\"related-tasks:assigned-to-changed\");\n });\n }\n return updateRelatedTask(updatedRelatedTask);\n }\n };\n })(this)));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskAssignedToInlineEdition\", [\"$tgRepo\", \"$rootScope\", \"$translate\", RelatedTaskAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources.coffee\n */\n\n(function() {\n var ResourcesService, initResources, initUrls, module, taiga, urls,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n ResourcesService = (function(superClass) {\n extend(ResourcesService, superClass);\n\n function ResourcesService() {\n return ResourcesService.__super__.constructor.apply(this, arguments);\n }\n\n return ResourcesService;\n\n })(taiga.Service);\n\n urls = {\n \"auth\": \"/auth\",\n \"auth-register\": \"/auth/register\",\n \"invitations\": \"/invitations\",\n \"users\": \"/users\",\n \"by_username\": \"/users/by_username\",\n \"users-password-recovery\": \"/users/password_recovery\",\n \"users-change-password-from-recovery\": \"/users/change_password_from_recovery\",\n \"users-change-password\": \"/users/change_password\",\n \"users-change-email\": \"/users/change_email\",\n \"users-cancel-account\": \"/users/cancel\",\n \"user-stats\": \"/users/%s/stats\",\n \"user-liked\": \"/users/%s/liked\",\n \"user-voted\": \"/users/%s/voted\",\n \"user-watched\": \"/users/%s/watched\",\n \"user-contacts\": \"/users/%s/contacts\",\n \"user-me\": \"/users/me\",\n \"permissions\": \"/permissions\",\n \"notify-policies\": \"/notify-policies\",\n \"user-storage\": \"/user-storage\",\n \"memberships\": \"/memberships\",\n \"bulk-create-memberships\": \"/memberships/bulk_create\",\n \"roles\": \"/roles\",\n \"permissions\": \"/permissions\",\n \"resolver\": \"/resolver\",\n \"projects\": \"/projects\",\n \"project-templates\": \"/project-templates\",\n \"project-modules\": \"/projects/%s/modules\",\n \"bulk-update-projects-order\": \"/projects/bulk_update_order\",\n \"project-like\": \"/projects/%s/like\",\n \"project-unlike\": \"/projects/%s/unlike\",\n \"project-watch\": \"/projects/%s/watch\",\n \"project-unwatch\": \"/projects/%s/unwatch\",\n \"project-transfer-validate-token\": \"/projects/%s/transfer_validate_token\",\n \"project-transfer-accept\": \"/projects/%s/transfer_accept\",\n \"project-transfer-reject\": \"/projects/%s/transfer_reject\",\n \"project-transfer-request\": \"/projects/%s/transfer_request\",\n \"project-transfer-start\": \"/projects/%s/transfer_start\",\n \"userstory-statuses\": \"/userstory-statuses\",\n \"points\": \"/points\",\n \"task-statuses\": \"/task-statuses\",\n \"issue-statuses\": \"/issue-statuses\",\n \"issue-types\": \"/issue-types\",\n \"priorities\": \"/priorities\",\n \"severities\": \"/severities\",\n \"milestones\": \"/milestones\",\n \"userstories\": \"/userstories\",\n \"bulk-create-us\": \"/userstories/bulk_create\",\n \"bulk-update-us-backlog-order\": \"/userstories/bulk_update_backlog_order\",\n \"bulk-update-us-sprint-order\": \"/userstories/bulk_update_sprint_order\",\n \"bulk-update-us-kanban-order\": \"/userstories/bulk_update_kanban_order\",\n \"userstories-filters\": \"/userstories/filters_data\",\n \"userstory-upvote\": \"/userstories/%s/upvote\",\n \"userstory-downvote\": \"/userstories/%s/downvote\",\n \"userstory-watch\": \"/userstories/%s/watch\",\n \"userstory-unwatch\": \"/userstories/%s/unwatch\",\n \"tasks\": \"/tasks\",\n \"bulk-create-tasks\": \"/tasks/bulk_create\",\n \"bulk-update-task-taskboard-order\": \"/tasks/bulk_update_taskboard_order\",\n \"task-upvote\": \"/tasks/%s/upvote\",\n \"task-downvote\": \"/tasks/%s/downvote\",\n \"task-watch\": \"/tasks/%s/watch\",\n \"task-unwatch\": \"/tasks/%s/unwatch\",\n \"issues\": \"/issues\",\n \"bulk-create-issues\": \"/issues/bulk_create\",\n \"issues-filters\": \"/issues/filters_data\",\n \"issue-upvote\": \"/issues/%s/upvote\",\n \"issue-downvote\": \"/issues/%s/downvote\",\n \"issue-watch\": \"/issues/%s/watch\",\n \"issue-unwatch\": \"/issues/%s/unwatch\",\n \"wiki\": \"/wiki\",\n \"wiki-restore\": \"/wiki/%s/restore\",\n \"wiki-links\": \"/wiki-links\",\n \"history/us\": \"/history/userstory\",\n \"history/issue\": \"/history/issue\",\n \"history/task\": \"/history/task\",\n \"history/wiki\": \"/history/wiki\",\n \"attachments/us\": \"/userstories/attachments\",\n \"attachments/issue\": \"/issues/attachments\",\n \"attachments/task\": \"/tasks/attachments\",\n \"attachments/wiki_page\": \"/wiki/attachments\",\n \"custom-attributes/userstory\": \"/userstory-custom-attributes\",\n \"custom-attributes/issue\": \"/issue-custom-attributes\",\n \"custom-attributes/task\": \"/task-custom-attributes\",\n \"custom-attributes-values/userstory\": \"/userstories/custom-attributes-values\",\n \"custom-attributes-values/issue\": \"/issues/custom-attributes-values\",\n \"custom-attributes-values/task\": \"/tasks/custom-attributes-values\",\n \"webhooks\": \"/webhooks\",\n \"webhooks-test\": \"/webhooks/%s/test\",\n \"webhooklogs\": \"/webhooklogs\",\n \"webhooklogs-resend\": \"/webhooklogs/%s/resend\",\n \"userstories-csv\": \"/userstories/csv?uuid=%s\",\n \"tasks-csv\": \"/tasks/csv?uuid=%s\",\n \"issues-csv\": \"/issues/csv?uuid=%s\",\n \"timeline-profile\": \"/timeline/profile\",\n \"timeline-user\": \"/timeline/user\",\n \"timeline-project\": \"/timeline/project\",\n \"search\": \"/search\",\n \"exporter\": \"/exporter\",\n \"importer\": \"/importer/load_dump\",\n \"feedback\": \"/feedback\",\n \"locales\": \"/locales\",\n \"applications\": \"/applications\",\n \"application-tokens\": \"/application-tokens\",\n \"stats-discover\": \"/stats/discover\"\n };\n\n initUrls = function($log, $urls) {\n $log.debug(\"Initialize api urls\");\n return $urls.update(urls);\n };\n\n initResources = function($log, $rs) {\n var i, len, provider, providers, results;\n $log.debug(\"Initialize resources\");\n providers = _.toArray(arguments).slice(2);\n results = [];\n for (i = 0, len = providers.length; i < len; i++) {\n provider = providers[i];\n results.push(provider($rs));\n }\n return results;\n };\n\n module = angular.module(\"taigaResources\", [\"taigaBase\"]);\n\n module.service(\"$tgResources\", ResourcesService);\n\n module.run([\"$log\", \"$tgUrls\", initUrls]);\n\n module.run([\"$log\", \"$tgResources\", \"$tgProjectsResourcesProvider\", \"$tgCustomAttributesResourcesProvider\", \"$tgCustomAttributesValuesResourcesProvider\", \"$tgMembershipsResourcesProvider\", \"$tgNotifyPoliciesResourcesProvider\", \"$tgInvitationsResourcesProvider\", \"$tgRolesResourcesProvider\", \"$tgUserSettingsResourcesProvider\", \"$tgSprintsResourcesProvider\", \"$tgUserstoriesResourcesProvider\", \"$tgTasksResourcesProvider\", \"$tgIssuesResourcesProvider\", \"$tgWikiResourcesProvider\", \"$tgSearchResourcesProvider\", \"$tgMdRenderResourcesProvider\", \"$tgHistoryResourcesProvider\", \"$tgKanbanResourcesProvider\", \"$tgModulesResourcesProvider\", \"$tgWebhooksResourcesProvider\", \"$tgWebhookLogsResourcesProvider\", \"$tgLocalesResourcesProvider\", \"$tgUsersResourcesProvider\", initResources]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/search.coffee\n */\n\n(function() {\n var SearchBoxDirective, SearchController, SearchDirective, bindOnce, debounce, debounceLeading, groupBy, mixOf, module, taiga, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n mixOf = this.taiga.mixOf;\n\n debounceLeading = this.taiga.debounceLeading;\n\n trim = this.taiga.trim;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaSearch\", []);\n\n SearchController = (function(superClass) {\n extend(SearchController, superClass);\n\n SearchController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$translate\"];\n\n function SearchController(scope1, repo, rs, params, q, location, appMetaService, navUrls, translate) {\n var loadSearchData, promise;\n this.scope = scope1;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.translate = translate;\n this.scope.sectionName = \"Search\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"SEARCH.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"SEARCH.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.searchTerm = null;\n loadSearchData = debounceLeading(100, (function(_this) {\n return function(t) {\n return _this.loadSearchData(t);\n };\n })(this));\n bindOnce(this.scope, \"projectId\", (function(_this) {\n return function(projectId) {\n if (!_this.scope.searchResults && _this.scope.searchTerm) {\n return _this.loadSearchData();\n }\n };\n })(this));\n this.scope.$watch(\"searchTerm\", (function(_this) {\n return function(term) {\n if (term !== void 0 && _this.scope.projectId) {\n return _this.loadSearchData(term);\n }\n };\n })(this));\n }\n\n SearchController.prototype.loadFilters = function() {\n var defered;\n defered = this.q.defer();\n defered.resolve();\n return defered.promise;\n };\n\n SearchController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issueStatusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.taskStatusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n SearchController.prototype.loadSearchData = function(term) {\n if (term == null) {\n term = \"\";\n }\n this.scope.loading = true;\n return this._loadSearchData(term).then((function(_this) {\n return function(data) {\n _this.scope.searchResults = data;\n return _this.scope.loading = false;\n };\n })(this));\n };\n\n SearchController.prototype._loadSearchData = function(term) {\n if (term == null) {\n term = \"\";\n }\n if (this._promise) {\n this._promise.abort();\n }\n this._promise = this.rs.search[\"do\"](this.scope.projectId, term);\n return this._promise;\n };\n\n SearchController.prototype.loadInitialData = function() {\n return this.loadProject().then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n return _this.fillUsersAndRoles(project.members, project.roles);\n };\n })(this));\n };\n\n return SearchController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"SearchController\", SearchController);\n\n SearchBoxDirective = function(projectService, $lightboxService, $navurls, $location, $route) {\n var link;\n link = function($scope, $el, $attrs) {\n var openLightbox, project, submit;\n project = null;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, text, url;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n text = $el.find(\"#search-text\").val();\n url = $navurls.resolve(\"project-search\", {\n project: project.get(\"slug\")\n });\n return $scope.$apply(function() {\n $lightboxService.close($el);\n $location.path(url);\n $location.search(\"text\", text).path(url);\n return $route.reload();\n });\n };\n })(this));\n openLightbox = function() {\n project = projectService.project;\n return $lightboxService.open($el).then(function() {\n return $el.find(\"#search-text\").focus();\n });\n };\n $el.on(\"submit\", \"form\", submit);\n return openLightbox();\n };\n return {\n templateUrl: \"search/lightbox-search.html\",\n link: link\n };\n };\n\n SearchBoxDirective.$inject = [\"tgProjectService\", \"lightboxService\", \"$tgNavUrls\", \"$tgLocation\", \"$route\"];\n\n module.directive(\"tgSearchBox\", SearchBoxDirective);\n\n SearchDirective = function($log, $compile, $templatecache, $routeparams, $location) {\n var link, linkTable;\n linkTable = function($scope, $el, $attrs, $ctrl) {\n var activeSectionName, applyAutoTab, getActiveSection, lastSearchResults, markSectionTabActive, renderFilterTabs, renderTableContent, tabsDom, templates;\n applyAutoTab = true;\n activeSectionName = \"userstories\";\n tabsDom = $el.find(\".search-filter\");\n lastSearchResults = null;\n getActiveSection = function(data) {\n var i, len, maxVal, name, ref, selectedSection, value;\n maxVal = 0;\n selectedSection = {};\n selectedSection.name = \"userstories\";\n selectedSection.value = [];\n if (!applyAutoTab) {\n selectedSection.name = activeSectionName;\n selectedSection.value = data[activeSectionName];\n return selectedSection;\n }\n if (data) {\n ref = [\"userstories\", \"issues\", \"tasks\", \"wikipages\"];\n for (i = 0, len = ref.length; i < len; i++) {\n name = ref[i];\n value = data[name];\n if (value.length > maxVal) {\n maxVal = value.length;\n selectedSection.name = name;\n selectedSection.value = value;\n break;\n }\n }\n }\n if (maxVal === 0) {\n return selectedSection;\n }\n return selectedSection;\n };\n renderFilterTabs = function(data) {\n var name, results, value;\n results = [];\n for (name in data) {\n value = data[name];\n tabsDom.find(\"li.\" + name).show();\n results.push(tabsDom.find(\"li.\" + name + \" .num\").html(value.length));\n }\n return results;\n };\n markSectionTabActive = function(section) {\n tabsDom.find(\"a.active\").removeClass(\"active\");\n tabsDom.find(\"li.\" + section.name + \" a\").addClass(\"active\");\n applyAutoTab = false;\n return activeSectionName = section.name;\n };\n templates = {\n issues: $templatecache.get(\"search-issues\"),\n tasks: $templatecache.get(\"search-tasks\"),\n userstories: $templatecache.get(\"search-userstories\"),\n wikipages: $templatecache.get(\"search-wikipages\")\n };\n renderTableContent = function(section) {\n var element, oldElements, oldScope, scope, template;\n oldElements = $el.find(\".search-result-table\").children();\n oldScope = oldElements.scope();\n if (oldScope) {\n oldScope.$destroy();\n oldElements.remove();\n }\n scope = $scope.$new();\n scope[section.name] = section.value;\n template = angular.element.parseHTML(trim(templates[section.name]));\n element = $compile(template)(scope);\n return $el.find(\".search-result-table\").html(element);\n };\n $scope.$watch(\"searchResults\", function(data) {\n var activeSection;\n lastSearchResults = data;\n if (!lastSearchResults) {\n return;\n }\n activeSection = getActiveSection(data);\n renderFilterTabs(data);\n renderTableContent(activeSection);\n return markSectionTabActive(activeSection);\n });\n $scope.$watch(\"searchTerm\", function(searchTerm) {\n if (searchTerm !== void 0) {\n return $location.search(\"text\", searchTerm);\n }\n });\n return $el.on(\"click\", \".search-filter li > a\", function(event) {\n var section, sectionData, sectionName, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n sectionName = target.parent().data(\"name\");\n sectionData = !lastSearchResults ? [] : lastSearchResults[sectionName];\n section = {\n name: sectionName,\n value: sectionData\n };\n return $scope.$apply(function() {\n renderTableContent(section);\n return markSectionTabActive(section);\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, searchText;\n $ctrl = $el.controller();\n linkTable($scope, $el, $attrs, $ctrl);\n searchText = $routeparams.text;\n return $scope.$watch(\"projectId\", function(projectId) {\n if (projectId != null) {\n return $scope.searchTerm = searchText;\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSearch\", [\"$log\", \"$compile\", \"$templateCache\", \"$routeParams\", \"$tgLocation\", SearchDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTaskboard\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/tasks.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTasks\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/team.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTeam\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaUserSettings\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/userstories.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaUserStories\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/wiki.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaWiki\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/analytics.coffee\n */\n\n(function() {\n var AnalyticsService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n AnalyticsService = (function(superClass) {\n extend(AnalyticsService, superClass);\n\n AnalyticsService.$inject = [\"$rootScope\", \"$log\", \"$tgConfig\", \"$window\", \"$document\", \"$location\"];\n\n function AnalyticsService(rootscope, log, config, win, doc, location) {\n var conf;\n this.rootscope = rootscope;\n this.log = log;\n this.config = config;\n this.win = win;\n this.doc = doc;\n this.location = location;\n this.initialized = false;\n conf = this.config.get(\"analytics\", {});\n this.accountId = conf.accountId;\n this.pageEvent = conf.pageEvent || \"$routeChangeSuccess\";\n this.trackRoutes = conf.trackRoutes || true;\n this.ignoreFirstPageLoad = conf.ignoreFirstPageLoad || false;\n }\n\n AnalyticsService.prototype.initialize = function() {\n if (!this.accountId) {\n this.log.debug(\"Analytics: no acount id provided. Disabling.\");\n return;\n }\n this.injectAnalytics();\n this.win.ga(\"create\", this.accountId, \"auto\");\n this.win.ga(\"require\", \"displayfeatures\");\n if (this.trackRoutes && (!this.ignoreFirstPageLoad)) {\n this.win.ga(\"send\", \"pageview\", this.getUrl());\n }\n if (this.trackRoutes) {\n this.rootscope.$on(this.pageEvent, (function(_this) {\n return function() {\n return _this.trackPage(_this.getUrl(), \"Taiga\");\n };\n })(this));\n }\n return this.initialized = true;\n };\n\n AnalyticsService.prototype.getUrl = function() {\n return this.location.path();\n };\n\n AnalyticsService.prototype.injectAnalytics = function() {\n var fn;\n fn = (function(i,s,o,g,r,a,m){i[\"GoogleAnalyticsObject\"]=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments);},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);});\n return fn(window, document, \"script\", \"//www.google-analytics.com/analytics.js\", \"ga\");\n };\n\n AnalyticsService.prototype.trackPage = function(url, title) {\n if (!this.initialized) {\n return;\n }\n if (!this.win.ga) {\n return;\n }\n title = title || this.doc[0].title;\n return this.win.ga(\"send\", \"pageview\", {\n \"page\": url,\n \"title\": title\n });\n };\n\n AnalyticsService.prototype.trackEvent = function(category, action, label, value) {\n if (!this.initialized) {\n return;\n }\n if (!this.win.ga) {\n return;\n }\n return this.win.ga(\"send\", \"event\", category, action, label, value);\n };\n\n return AnalyticsService;\n\n })(taiga.Service);\n\n module.service(\"$tgAnalytics\", AnalyticsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: bind-scope.coffee\n */\n\n(function() {\n var BindScope, module;\n\n module = angular.module(\"taigaCommon\");\n\n BindScope = function(config) {\n var link;\n if (!config.debugInfo) {\n jQuery.fn.scope = function() {\n return this.data('scope');\n };\n }\n link = function($scope, $el) {\n if (!config.debugInfo) {\n return $el.data('scope', $scope).addClass('tg-scope');\n }\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBindScope\", [\"$tgConfig\", BindScope]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: compile-html.directive.coffee\n */\n\n(function() {\n var CompileHtmlDirective;\n\n CompileHtmlDirective = function($compile) {\n var link;\n link = function(scope, element, attrs) {\n return scope.$watch(attrs.tgCompileHtml, function(newValue, oldValue) {\n element.html(newValue);\n return $compile(element.contents())(scope);\n });\n };\n return {\n link: link\n };\n };\n\n CompileHtmlDirective.$inject = [\"$compile\"];\n\n angular.module(\"taigaCommon\").directive(\"tgCompileHtml\", CompileHtmlDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/components.coffee\n */\n\n(function() {\n var AssignedToDirective, BlockButtonDirective, CreatedByDisplayDirective, DateRangeDirective, DateSelectorDirective, DeleteButtonDirective, EditableDescriptionDirective, EditableSubjectDirective, EditableWysiwyg, ListItemAssignedtoDirective, ListItemIssueStatusDirective, ListItemPriorityDirective, ListItemSeverityDirective, ListItemTaskStatusDirective, ListItemTypeDirective, ListItemUsStatusDirective, SprintProgressBarDirective, TgMainTitleDirective, TgProgressBarDirective, WatchersDirective, bindOnce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n DateRangeDirective = function($translate) {\n var link, renderRange;\n renderRange = function($el, first, second) {\n var endDate, initDate, prettyDate;\n prettyDate = $translate.instant(\"BACKLOG.SPRINTS.DATE\");\n initDate = moment(first).format(prettyDate);\n endDate = moment(second).format(prettyDate);\n return $el.html(initDate + \"-\" + endDate);\n };\n link = function($scope, $el, $attrs) {\n var first, ref, second;\n ref = $attrs.tgDateRange.split(\",\"), first = ref[0], second = ref[1];\n return bindOnce($scope, first, function(valFirst) {\n return bindOnce($scope, second, function(valSecond) {\n return renderRange($el, valFirst, valSecond);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgDateRange\", [\"$translate\", DateRangeDirective]);\n\n DateSelectorDirective = function($rootscope, datePickerConfigService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var initialize, selectedDate, unbind;\n selectedDate = null;\n initialize = function() {\n var datePickerConfig;\n datePickerConfig = datePickerConfigService.get();\n _.merge(datePickerConfig, {\n field: $el[0],\n onSelect: (function(_this) {\n return function(date) {\n return selectedDate = date;\n };\n })(this),\n onOpen: (function(_this) {\n return function() {\n if (selectedDate != null) {\n return $el.picker.setDate(selectedDate);\n }\n };\n })(this)\n });\n return $el.picker = new Pikaday(datePickerConfig);\n };\n unbind = $rootscope.$on(\"$translateChangeEnd\", (function(_this) {\n return function(ctx) {\n return initialize();\n };\n })(this));\n $scope.$watch($attrs.ngModel, function(val) {\n if ((val != null) && !$el.picker) {\n initialize();\n }\n if (val != null) {\n return $el.picker.setDate(val);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n $el.off();\n return unbind();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgDateSelector\", [\"$rootScope\", \"tgDatePickerConfigService\", DateSelectorDirective]);\n\n SprintProgressBarDirective = function() {\n var link, renderProgress;\n renderProgress = function($el, percentage, visual_percentage) {\n if ($el.hasClass(\".current-progress\")) {\n return $el.css(\"width\", percentage + \"%\");\n } else {\n $el.find(\".current-progress\").css(\"width\", visual_percentage + \"%\");\n return $el.find(\".number\").html(percentage + \" %\");\n }\n };\n link = function($scope, $el, $attrs) {\n bindOnce($scope, $attrs.tgSprintProgressbar, function(sprint) {\n var closedPoints, percentage, totalPoints, visual_percentage;\n closedPoints = sprint.closed_points;\n totalPoints = sprint.total_points;\n percentage = 0;\n if (totalPoints !== 0) {\n percentage = Math.round(100 * (closedPoints / totalPoints));\n }\n visual_percentage = 0;\n if (totalPoints !== 0) {\n visual_percentage = Math.round(98 * (closedPoints / totalPoints));\n }\n return renderProgress($el, percentage, visual_percentage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintProgressbar\", SprintProgressBarDirective);\n\n CreatedByDisplayDirective = function($template, $compile, $translate, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, $attrs.ngModel, function(model) {\n var ref;\n if (model != null) {\n $scope.owner = model.owner_extra_info || {\n full_name_display: $translate.instant(\"COMMON.EXTERNAL_USER\"),\n photo: \"/\" + window._version + \"/images/user-noimage.png\"\n };\n $scope.url = ((ref = $scope.owner) != null ? ref.is_active : void 0) ? $navUrls.resolve(\"user-profile\", {\n username: $scope.owner.username\n }) : \"\";\n return $scope.date = moment(model.created_date).format($translate.instant(\"COMMON.DATETIME\"));\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n scope: true,\n templateUrl: \"common/components/created-by.html\"\n };\n };\n\n module.directive(\"tgCreatedByDisplay\", [\"$tgTemplate\", \"$compile\", \"$translate\", \"$tgNavUrls\", CreatedByDisplayDirective]);\n\n WatchersDirective = function($rootscope, $confirm, $repo, $qqueue, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"common/components/watchers.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var deleteWatcher, isEditable, renderWatchers, save;\n isEditable = function() {\n var ref, ref1;\n return ((ref = $scope.project) != null ? (ref1 = ref.my_permissions) != null ? ref1.indexOf($attrs.requiredPerm) : void 0 : void 0) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(watchers) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watchers;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n watchers = _.map(watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n $model.$modelValue.revert();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n deleteWatcher = $qqueue.bindAdd((function(_this) {\n return function(watcherIds) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watcherIds;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n var watchers;\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n item.revert();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n renderWatchers = function(watchers) {\n var ctx, html;\n ctx = {\n watchers: watchers,\n isEditable: isEditable()\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n $el.on(\"click\", \".js-delete-watcher\", function(event) {\n var message, target, title, watcherId;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n watcherId = target.data(\"watcher-id\");\n title = $translate.instant(\"COMMON.WATCHERS.TITLE_LIGHTBOX_DELETE_WARTCHER\");\n message = $scope.usersById[watcherId].full_name_display;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var watcherIds;\n askResponse.finish();\n watcherIds = _.clone($model.$modelValue.watchers, false);\n watcherIds = _.pull(watcherIds, watcherId);\n return deleteWatcher(watcherIds);\n };\n })(this));\n });\n $scope.$on(\"watcher:added\", function(ctx, watcherId) {\n var watchers;\n watchers = _.clone($model.$modelValue.watchers, false);\n watchers.push(watcherId);\n watchers = _.uniq(watchers);\n return save(watchers);\n });\n $scope.$watch($attrs.ngModel, function(item) {\n var watchers;\n if (item == null) {\n return;\n }\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n return renderWatchers(watchers);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgWatchers\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", \"$translate\", WatchersDirective]);\n\n AssignedToDirective = function($rootscope, $confirm, $repo, $loading, $qqueue, $template, $translate, $compile, $currentUserService) {\n var link, template;\n template = $template.get(\"common/components/assigned-to.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, renderAssignedTo, save;\n isEditable = function() {\n var ref, ref1;\n return ((ref = $scope.project) != null ? (ref1 = ref.my_permissions) != null ? ref1.indexOf($attrs.requiredPerm) : void 0 : void 0) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(userId) {\n var currentLoading, promise;\n $model.$modelValue.assigned_to = userId;\n currentLoading = $loading().target($el).start();\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n currentLoading.finish();\n renderAssignedTo($model.$modelValue);\n return $rootscope.$broadcast(\"object:updated\");\n });\n promise.then(null, function() {\n $model.$modelValue.revert();\n $confirm.notify(\"error\");\n return currentLoading.finish();\n });\n return promise;\n };\n })(this));\n renderAssignedTo = function(assignedObject) {\n var ctx, fullName, html, isIocaine, isUnassigned, photo;\n if ((assignedObject != null ? assignedObject.assigned_to : void 0) != null) {\n fullName = assignedObject.assigned_to_extra_info.full_name_display;\n photo = assignedObject.assigned_to_extra_info.photo;\n isUnassigned = false;\n } else {\n fullName = $translate.instant(\"COMMON.ASSIGNED_TO.ASSIGN\");\n photo = \"/\" + window._version + \"/images/unnamed.png\";\n isUnassigned = true;\n }\n isIocaine = assignedObject != null ? assignedObject.is_iocaine : void 0;\n ctx = {\n fullName: fullName,\n photo: photo,\n isUnassigned: isUnassigned,\n isEditable: isEditable(),\n isIocaine: isIocaine,\n fullNameVisible: !(isUnassigned && !$currentUserService.isAuthenticated())\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n $el.on(\"click\", \".user-assigned\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"assigned-to:add\", $model.$modelValue);\n });\n });\n $el.on(\"click\", \".assign-to-me\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n $model.$modelValue.assigned_to = $currentUserService.getUser().get('id');\n return save($currentUserService.getUser().get('id'));\n });\n $el.on(\"click\", \".remove-user\", function(event) {\n var title;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n title = $translate.instant(\"COMMON.ASSIGNED_TO.CONFIRM_UNASSIGNED\");\n return $confirm.ask(title).then((function(_this) {\n return function(response) {\n response.finish();\n $model.$modelValue.assigned_to = null;\n return save(null);\n };\n })(this));\n });\n $scope.$on(\"assigned-to:added\", function(ctx, userId, item) {\n if (item.id !== $model.$modelValue.id) {\n return;\n }\n return save(userId);\n });\n $scope.$watch($attrs.ngModel, function(instance) {\n return renderAssignedTo(instance);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgAssignedTo\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$translate\", \"$compile\", \"tgCurrentUserService\", AssignedToDirective]);\n\n BlockButtonDirective = function($rootscope, $loading, $template) {\n var link, template;\n template = $template.get(\"common/components/block-button.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n $scope.$watch($attrs.ngModel, function(item) {\n if (!item) {\n return;\n }\n if (isEditable()) {\n $el.find('.item-block').addClass('editable');\n }\n if (item.is_blocked) {\n $el.find('.item-block').removeClass('is-active');\n return $el.find('.item-unblock').addClass('is-active');\n } else {\n $el.find('.item-block').addClass('is-active');\n return $el.find('.item-unblock').removeClass('is-active');\n }\n });\n $el.on(\"click\", \".item-block\", function(event) {\n event.preventDefault();\n return $rootscope.$broadcast(\"block\", $model.$modelValue);\n });\n $el.on(\"click\", \".item-unblock\", function(event) {\n var currentLoading, finish;\n event.preventDefault();\n currentLoading = $loading().target($el.find(\".item-unblock\")).start();\n finish = function() {\n return currentLoading.finish();\n };\n return $rootscope.$broadcast(\"unblock\", $model.$modelValue, finish);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgBlockButton\", [\"$rootScope\", \"$tgLoading\", \"$tgTemplate\", BlockButtonDirective]);\n\n DeleteButtonDirective = function($log, $repo, $confirm, $location, $template) {\n var link, template;\n template = $template.get(\"common/components/delete-button.html\");\n link = function($scope, $el, $attrs, $model) {\n if (!$attrs.onDeleteGoToUrl) {\n return $log.error(\"DeleteButtonDirective requires on-delete-go-to-url set in scope.\");\n }\n if (!$attrs.onDeleteTitle) {\n return $log.error(\"DeleteButtonDirective requires on-delete-title set in scope.\");\n }\n $el.on(\"click\", \".button-delete\", function(event) {\n var subtitle, title;\n title = $attrs.onDeleteTitle;\n subtitle = $model.$modelValue.subject;\n return $confirm.askOnDelete(title, subtitle).then((function(_this) {\n return function(askResponse) {\n var promise;\n promise = $repo.remove($model.$modelValue);\n promise.then(function() {\n var url;\n askResponse.finish();\n url = $scope.$eval($attrs.onDeleteGoToUrl);\n return $location.path(url);\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgDeleteButton\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"$tgTemplate\", DeleteButtonDirective]);\n\n EditableSubjectDirective = function($rootscope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"common/components/editable-subject.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, save;\n $scope.$on(\"object:updated\", function() {\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n });\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(subject) {\n var currentLoading, promise;\n $model.$modelValue.subject = subject;\n currentLoading = $loading().target($el.find('.save-container')).start();\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n return promise;\n };\n })(this));\n $el.click(function() {\n if (!isEditable()) {\n return;\n }\n $el.find('.edit-subject').show();\n $el.find('.view-subject').hide();\n return $el.find('input').focus();\n });\n $el.on(\"click\", \".save\", function(e) {\n var subject;\n e.preventDefault();\n subject = $scope.item.subject;\n return save(subject);\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var subject;\n if (event.keyCode === 13) {\n subject = $scope.item.subject;\n return save(subject);\n } else if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n }\n });\n $el.find('.edit-subject').hide();\n $scope.$watch($attrs.ngModel, function(value) {\n if (!value) {\n return;\n }\n $scope.item = value;\n if (!isEditable()) {\n return $el.find('.view-subject .edit').remove();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgEditableSubject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", EditableSubjectDirective]);\n\n EditableDescriptionDirective = function($rootscope, $repo, $confirm, $compile, $loading, $selectedText, $qqueue, $template) {\n var link, noDescriptionMegEditMode, noDescriptionMegReadMode, template;\n template = $template.get(\"common/components/editable-description.html\");\n noDescriptionMegEditMode = $template.get(\"common/components/editable-description-msg-edit-mode.html\");\n noDescriptionMegReadMode = $template.get(\"common/components/editable-description-msg-read-mode.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, save;\n $el.find('.edit-description').hide();\n $el.find('.view-description .edit').hide();\n $scope.$on(\"object:updated\", function() {\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(description) {\n var currentLoading, promise;\n $model.$modelValue.description = description;\n currentLoading = $loading().target($el.find('.save-container')).start();\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n };\n })(this));\n $el.on(\"mouseup\", \".view-description\", function(event) {\n var target;\n target = angular.element(event.target);\n if (!isEditable()) {\n return;\n }\n if (target.is('a')) {\n return;\n }\n if ($selectedText.get().length) {\n return;\n }\n $el.find('.edit-description').show();\n $el.find('.view-description').hide();\n return $el.find('textarea').focus();\n });\n $el.on(\"click\", \"a\", function(event) {\n var href, target;\n target = angular.element(event.target);\n href = target.attr('href');\n if (href.indexOf(\"#\") === 0) {\n event.preventDefault();\n return $('body').scrollTop($(href).offset().top);\n }\n });\n $el.on(\"click\", \".save\", function(e) {\n var description;\n e.preventDefault();\n description = $scope.item.description;\n return save(description);\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $scope.item.revert();\n };\n })(this));\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n }\n });\n $scope.$watch($attrs.ngModel, function(value) {\n if (!value) {\n return;\n }\n $scope.item = value;\n if (isEditable()) {\n $el.find('.view-description .edit').show();\n $el.find('.view-description .us-content').addClass('editable');\n return $scope.noDescriptionMsg = $compile(noDescriptionMegEditMode)($scope);\n } else {\n return $scope.noDescriptionMsg = $compile(noDescriptionMegReadMode)($scope);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgEditableDescription\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$compile\", \"$tgLoading\", \"$selectedText\", \"$tgQqueue\", \"$tgTemplate\", EditableDescriptionDirective]);\n\n EditableWysiwyg = function(attachmentsService, attachmentsFullService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var isInEditMode, uploadFile;\n isInEditMode = function() {\n return $el.find('textarea').is(':visible');\n };\n uploadFile = function(file, type) {\n if (!attachmentsService.validate(file)) {\n return;\n }\n return attachmentsFullService.addAttachment($model.$modelValue.project, $model.$modelValue.id, type, file).then(function(result) {\n if (taiga.isImage(result.getIn(['file', 'name']))) {\n return '![' + result.getIn(['file', 'name']) + '](' + result.getIn(['file', 'url']) + ')';\n } else {\n return '[' + result.getIn(['file', 'name']) + '](' + result.getIn(['file', 'url']) + ')';\n }\n });\n };\n $el.on('dragover', function(e) {\n var textarea;\n textarea = $el.find('textarea').focus();\n return false;\n });\n return $el.on('drop', function(e) {\n var dataTransfer, promises, textarea, type;\n e.stopPropagation();\n e.preventDefault();\n if (isInEditMode()) {\n dataTransfer = e.dataTransfer || (e.originalEvent && e.originalEvent.dataTransfer);\n textarea = $el.find('textarea');\n textarea.addClass('in-progress');\n type = $model.$modelValue['_name'];\n if (type === \"userstories\") {\n type = \"us\";\n } else if (type === \"tasks\") {\n type = \"task\";\n } else if (type === \"issues\") {\n type = \"issue\";\n } else if (type === \"wiki\") {\n type = \"wiki_page\";\n }\n promises = _.map(dataTransfer.files, function(file) {\n return uploadFile(file, type);\n });\n return Promise.all(promises).then(function(result) {\n textarea = $el.find('textarea');\n $.markItUp({\n replaceWith: result.join(' ')\n });\n return textarea.removeClass('in-progress');\n });\n }\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgEditableWysiwyg\", [\"tgAttachmentsService\", \"tgAttachmentsFullService\", EditableWysiwyg]);\n\n ListItemUsStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var us;\n us = $scope.$eval($attrs.tgListitemUsStatus);\n return bindOnce($scope, \"usStatusById\", function(usStatusById) {\n return $el.html(usStatusById[us.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemUsStatus\", ListItemUsStatusDirective);\n\n ListItemTaskStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var task;\n task = $scope.$eval($attrs.tgListitemTaskStatus);\n return bindOnce($scope, \"taskStatusById\", function(taskStatusById) {\n return $el.html(taskStatusById[task.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemTaskStatus\", ListItemTaskStatusDirective);\n\n ListItemAssignedtoDirective = function($template, $translate) {\n var link, template;\n template = $template.get(\"common/components/list-item-assigned-to-avatar.html\", true);\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, \"usersById\", function(usersById) {\n var ctx, item, member;\n item = $scope.$eval($attrs.tgListitemAssignedto);\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\"\n };\n member = usersById[item.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name_display;\n }\n return $el.html(template(ctx));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemAssignedto\", [\"$tgTemplate\", \"$translate\", ListItemAssignedtoDirective]);\n\n ListItemIssueStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemIssueStatus);\n return bindOnce($scope, \"issueStatusById\", function(issueStatusById) {\n return $el.html(issueStatusById[issue.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemIssueStatus\", ListItemIssueStatusDirective);\n\n ListItemTypeDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(issueTypeById, issue) {\n var domNode, type;\n type = issueTypeById[issue.type];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", type.color);\n return domNode.attr(\"title\", type.name);\n };\n bindOnce($scope, \"issueTypeById\", function(issueTypeById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemType);\n return render(issueTypeById, issue);\n });\n return $scope.$watch($attrs.tgListitemType, function(issue) {\n return render($scope.issueTypeById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemType\", ListItemTypeDirective);\n\n ListItemPriorityDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(priorityById, issue) {\n var domNode, priority;\n priority = priorityById[issue.priority];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", priority.color);\n return domNode.attr(\"title\", priority.name);\n };\n bindOnce($scope, \"priorityById\", function(priorityById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemPriority);\n return render(priorityById, issue);\n });\n return $scope.$watch($attrs.tgListitemPriority, function(issue) {\n return render($scope.priorityById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemPriority\", ListItemPriorityDirective);\n\n ListItemSeverityDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(severityById, issue) {\n var domNode, severity;\n severity = severityById[issue.severity];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", severity.color);\n return domNode.attr(\"title\", severity.name);\n };\n bindOnce($scope, \"severityById\", function(severityById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemSeverity);\n return render(severityById, issue);\n });\n return $scope.$watch($attrs.tgListitemSeverity, function(issue) {\n return render($scope.severityById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemSeverity\", ListItemSeverityDirective);\n\n TgProgressBarDirective = function($template) {\n var link, render, template;\n template = $template.get(\"common/components/progress-bar.html\", true);\n render = function(el, percentage) {\n return el.html(template({\n percentage: percentage\n }));\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch($attrs.tgProgressBar, function(percentage) {\n percentage = _.max([0, percentage]);\n percentage = _.min([100, percentage]);\n return render($el, percentage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProgressBar\", [\"$tgTemplate\", TgProgressBarDirective]);\n\n TgMainTitleDirective = function($translate) {\n var link;\n link = function($scope, $el, $attrs) {\n $attrs.$observe(\"i18nSectionName\", function(i18nSectionName) {\n return $scope.sectionName = i18nSectionName;\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/main-title.html\",\n scope: {\n projectName: \"=projectName\"\n }\n };\n };\n\n module.directive(\"tgMainTitle\", [\"$translate\", TgMainTitleDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/confirm.coffee\n */\n\n(function() {\n var ConfirmService, NOTIFICATION_MSG, bindMethods, cancelTimeout, debounce, module, taiga, timeout,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n timeout = this.taiga.timeout;\n\n cancelTimeout = this.taiga.cancelTimeout;\n\n debounce = this.taiga.debounce;\n\n bindMethods = this.taiga.bindMethods;\n\n NOTIFICATION_MSG = {\n \"success\": {\n title: \"NOTIFICATION.OK\",\n message: \"NOTIFICATION.SAVED\"\n },\n \"error\": {\n title: \"NOTIFICATION.WARNING\",\n message: \"NOTIFICATION.WARNING_TEXT\"\n },\n \"light-error\": {\n title: \"NOTIFICATION.WARNING\",\n message: \"NOTIFICATION.WARNING_TEXT\"\n }\n };\n\n ConfirmService = (function(superClass) {\n extend(ConfirmService, superClass);\n\n ConfirmService.$inject = [\"$q\", \"lightboxService\", \"$tgLoading\", \"$translate\"];\n\n function ConfirmService(q, lightboxService, loading, translate) {\n this.q = q;\n this.lightboxService = lightboxService;\n this.loading = loading;\n this.translate = translate;\n bindMethods(this);\n }\n\n ConfirmService.prototype.hide = function(el) {\n if (el) {\n this.lightboxService.close(el);\n return el.off(\".confirm-dialog\");\n }\n };\n\n ConfirmService.prototype.ask = function(title, subtitle, message, lightboxSelector) {\n var defered, el;\n if (lightboxSelector == null) {\n lightboxSelector = \".lightbox-generic-ask\";\n }\n defered = this.q.defer();\n el = angular.element(lightboxSelector);\n el.find(\".title\").text(title);\n el.find(\".subtitle\").text(subtitle);\n el.find(\".message\").text(message);\n el.on(\"click.confirm-dialog\", \".button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n currentLoading = _this.loading().target(target).start();\n return defered.resolve({\n finish: function(ok) {\n if (ok == null) {\n ok = true;\n }\n currentLoading.finish();\n if (ok) {\n return _this.hide(el);\n }\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \".button-red\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.reject();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.askOnDelete = function(title, message) {\n return this.ask(title, this.translate.instant(\"NOTIFICATION.ASK_DELETE\"), message);\n };\n\n ConfirmService.prototype.askChoice = function(title, subtitle, choices, replacement, warning, lightboxSelector) {\n var choicesField, defered, el;\n if (lightboxSelector == null) {\n lightboxSelector = \".lightbox-ask-choice\";\n }\n defered = this.q.defer();\n el = angular.element(lightboxSelector);\n el.find(\".title\").text(title);\n el.find(\".subtitle\").text(subtitle);\n if (replacement) {\n el.find(\".replacement\").text(replacement);\n } else {\n el.find(\".replacement\").remove();\n }\n if (warning) {\n el.find(\".warning\").text(warning);\n } else {\n el.find(\".warning\").remove();\n }\n choicesField = el.find(\".choices\");\n choicesField.html('');\n _.each(choices, function(value, key) {\n value = _.escape(value);\n return choicesField.append(angular.element(\"\"));\n });\n el.on(\"click.confirm-dialog\", \"a.button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n currentLoading = _this.loading().target(target).start();\n return defered.resolve({\n selected: choicesField.val(),\n finish: function(ok) {\n if (ok == null) {\n ok = true;\n }\n currentLoading.finish();\n if (ok) {\n return _this.hide(el);\n }\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \".button-red\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.reject();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.error = function(message) {\n var defered, el;\n defered = this.q.defer();\n el = angular.element(\".lightbox-generic-error\");\n el.find(\".title\").html(message);\n el.on(\"click.confirm-dialog\", \".button-green\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n el.on(\"click.confirm-dialog\", \".close\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.success = function(title, message, icon) {\n var defered, detailImage, el, useSVG;\n defered = this.q.defer();\n el = angular.element(\".lightbox-generic-success\");\n el.find(\"img\").remove();\n el.find(\"svg\").remove();\n if (icon) {\n if (icon.type === \"img\") {\n detailImage = $('').addClass('lb-icon').attr('src', icon.name);\n } else if (icon.type === \"svg\") {\n useSVG = document.createElementNS('http://www.w3.org/2000/svg', 'use');\n useSVG.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + icon.name);\n detailImage = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n detailImage.classList.add(\"icon\");\n detailImage.classList.add(\"lb-icon\");\n detailImage.classList.add(icon.name);\n detailImage.appendChild(useSVG);\n }\n if (detailImage) {\n el.find('section').prepend(detailImage);\n }\n }\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n el.on(\"click.confirm-dialog\", \".button-green\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n el.on(\"click.confirm-dialog\", \".close\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.loader = function(title, message) {\n var el;\n el = angular.element(\".lightbox-generic-loading\");\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n return {\n start: (function(_this) {\n return function() {\n return _this.lightboxService.open(el);\n };\n })(this),\n stop: (function(_this) {\n return function() {\n return _this.lightboxService.close(el);\n };\n })(this),\n update: (function(_this) {\n return function(status, title, message, percent) {\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n if (percent) {\n el.find(\".spin\").addClass(\"hidden\");\n el.find(\".progress-bar-wrapper\").removeClass(\"hidden\");\n el.find(\".progress-bar-wrapper > .bar\").width(percent + '%');\n return el.find(\".progress-bar-wrapper > span\").html(percent + '%').css('left', (percent - 9) + '%');\n } else {\n el.find(\".spin\").removeClass(\"hidden\");\n return el.find(\".progress-bar-wrapper\").addClass(\"hidden\");\n }\n };\n })(this)\n };\n };\n\n ConfirmService.prototype.notify = function(type, message, title, time) {\n var body, el, selector;\n selector = \".notification-message-\" + type;\n el = angular.element(selector);\n if (el.hasClass(\"active\")) {\n return;\n }\n if (title) {\n el.find(\"h4\").html(title);\n } else {\n el.find(\"h4\").html(this.translate.instant(NOTIFICATION_MSG[type].title));\n }\n if (message) {\n el.find(\"p\").html(message);\n } else {\n el.find(\"p\").html(this.translate.instant(NOTIFICATION_MSG[type].message));\n }\n body = angular.element(\"body\");\n body.find(\".notification-message .notification-light\").removeClass('active').addClass('inactive');\n body.find(selector).removeClass('inactive').addClass('active');\n if (this.tsem) {\n cancelTimeout(this.tsem);\n }\n if (!time) {\n time = type === 'error' || type === 'light-error' ? 3500 : 1500;\n }\n this.tsem = timeout(time, (function(_this) {\n return function() {\n body.find(selector).removeClass('active').addClass('inactive').one('animationend', function() {\n return $(this).removeClass('inactive');\n });\n return delete _this.tsem;\n };\n })(this));\n return el.on(\"click\", \".icon-close, .close\", (function(_this) {\n return function(event) {\n return body.find(selector).removeClass('active').addClass('inactive');\n };\n })(this));\n };\n\n return ConfirmService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaCommon\");\n\n module.service(\"$tgConfirm\", ConfirmService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/custom-field-values.coffee\n */\n\n(function() {\n var CustomAttributeValueDirective, CustomAttributesValuesController, CustomAttributesValuesDirective, DATE_TYPE, MULTILINE_TYPE, TEXT_TYPE, TYPE_CHOICES, URL_TYPE, bindMethods, bindOnce, debounce, generateHash, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n bindMethods = this.taiga.bindMethods;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n generateHash = taiga.generateHash;\n\n module = angular.module(\"taigaCommon\");\n\n TEXT_TYPE = \"text\";\n\n MULTILINE_TYPE = \"multiline\";\n\n DATE_TYPE = \"date\";\n\n URL_TYPE = \"url\";\n\n TYPE_CHOICES = [\n {\n key: TEXT_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT\"\n }, {\n key: MULTILINE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI\"\n }, {\n key: DATE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE\"\n }, {\n key: URL_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL\"\n }\n ];\n\n CustomAttributesValuesController = (function(superClass) {\n extend(CustomAttributesValuesController, superClass);\n\n CustomAttributesValuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$q\"];\n\n function CustomAttributesValuesController(scope, rootscope, repo, rs, confirm, q) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.rs = rs;\n this.confirm = confirm;\n this.q = q;\n bindMethods(this);\n this.type = null;\n this.objectId = null;\n this.projectId = null;\n this.customAttributes = [];\n this.customAttributesValues = null;\n }\n\n CustomAttributesValuesController.prototype.initialize = function(type, objectId) {\n this.project = this.scope.project;\n this.type = type;\n this.objectId = objectId;\n return this.projectId = this.scope.projectId;\n };\n\n CustomAttributesValuesController.prototype.loadCustomAttributesValues = function() {\n if (!this.objectId) {\n return this.customAttributesValues;\n }\n return this.rs.customAttributesValues[this.type].get(this.objectId).then((function(_this) {\n return function(customAttributesValues) {\n _this.customAttributes = _this.project[_this.type + \"_custom_attributes\"];\n _this.customAttributesValues = customAttributesValues;\n return customAttributesValues;\n };\n })(this));\n };\n\n CustomAttributesValuesController.prototype.getAttributeValue = function(attribute) {\n var attributeValue;\n attributeValue = _.clone(attribute, false);\n attributeValue.value = this.customAttributesValues.attributes_values[attribute.id];\n return attributeValue;\n };\n\n CustomAttributesValuesController.prototype.updateAttributeValue = function(attributeValue) {\n var attributesValues, onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"custom-attributes-values:edit\");\n };\n })(this);\n onError = (function(_this) {\n return function(response) {\n _this.confirm.notify(\"error\");\n return _this.q.reject();\n };\n })(this);\n attributesValues = _.clone(this.customAttributesValues.attributes_values, true);\n attributesValues[attributeValue.id] = attributeValue.value;\n this.customAttributesValues.attributes_values = attributesValues;\n this.customAttributesValues.id = this.objectId;\n return this.repo.save(this.customAttributesValues).then(onSuccess, onError);\n };\n\n return CustomAttributesValuesController;\n\n })(taiga.Controller);\n\n CustomAttributesValuesDirective = function($templates, $storage) {\n var collapsedHash, link, template, templateFn;\n template = $templates.get(\"custom-attributes/custom-attributes-values.html\", true);\n collapsedHash = function(type) {\n return generateHash([\"custom-attributes-collapsed\", type]);\n };\n link = function($scope, $el, $attrs, $ctrls) {\n var $ctrl, $model;\n $ctrl = $ctrls[0];\n $model = $ctrls[1];\n bindOnce($scope, $attrs.ngModel, function(value) {\n $ctrl.initialize($attrs.type, value.id);\n return $ctrl.loadCustomAttributesValues();\n });\n $el.on(\"click\", \".custom-fields-header .icon\", function() {\n var collapsed, hash;\n hash = collapsedHash($attrs.type);\n collapsed = !($storage.get(hash) || false);\n $storage.set(hash, collapsed);\n if (collapsed) {\n $el.find(\".custom-fields-header .icon\").removeClass(\"open\");\n return $el.find(\".custom-fields-body\").removeClass(\"open\");\n } else {\n $el.find(\".custom-fields-header .icon\").addClass(\"open\");\n return $el.find(\".custom-fields-body\").addClass(\"open\");\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n templateFn = function($el, $attrs) {\n var collapsed;\n collapsed = $storage.get(collapsedHash($attrs.type)) || false;\n return template({\n requiredEditionPerm: $attrs.requiredEditionPerm,\n collapsed: collapsed\n });\n };\n return {\n require: [\"tgCustomAttributesValues\", \"ngModel\"],\n controller: CustomAttributesValuesController,\n controllerAs: \"ctrl\",\n restrict: \"AE\",\n scope: true,\n link: link,\n template: templateFn\n };\n };\n\n module.directive(\"tgCustomAttributesValues\", [\"$tgTemplate\", \"$tgStorage\", \"$translate\", CustomAttributesValuesDirective]);\n\n CustomAttributeValueDirective = function($template, $selectedText, $compile, $translate, datePickerConfigService) {\n var link, template, templateEdit;\n template = $template.get(\"custom-attributes/custom-attribute-value.html\", true);\n templateEdit = $template.get(\"custom-attributes/custom-attribute-value-edit.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var attributeValue, isEditable, prettyDate, render, setFocusAndSelectOnInputField, submit;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n render = function(attributeValue, edit) {\n var ctx, datePickerConfig, editable, html, value;\n if (edit == null) {\n edit = false;\n }\n if (attributeValue.type === DATE_TYPE && attributeValue.value) {\n value = moment(attributeValue.value, \"YYYY-MM-DD\").format(prettyDate);\n } else {\n value = attributeValue.value;\n }\n editable = isEditable();\n ctx = {\n id: attributeValue.id,\n name: attributeValue.name,\n description: attributeValue.description,\n value: value,\n isEditable: editable,\n type: attributeValue.type\n };\n if (editable && (edit || !value)) {\n html = templateEdit(ctx);\n html = $compile(html)($scope);\n $el.html(html);\n if (attributeValue.type === DATE_TYPE) {\n datePickerConfig = datePickerConfigService.get();\n _.merge(datePickerConfig, {\n field: $el.find(\"input[name=value]\")[0],\n onSelect: (function(_this) {\n return function(date) {\n var selectedDate;\n return selectedDate = date;\n };\n })(this),\n onOpen: (function(_this) {\n return function() {\n if (typeof selectedDate !== \"undefined\" && selectedDate !== null) {\n return $el.picker.setDate(selectedDate);\n }\n };\n })(this)\n });\n return $el.picker = new Pikaday(datePickerConfig);\n }\n } else {\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n }\n };\n isEditable = function() {\n var permissions, requiredEditionPerm;\n permissions = $scope.project.my_permissions;\n requiredEditionPerm = $attrs.requiredEditionPerm;\n return permissions.indexOf(requiredEditionPerm) > -1;\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, input;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n input = $el.find(\"input[name=value], textarea[name='value']\");\n attributeValue.value = input.val();\n if (attributeValue.type === DATE_TYPE) {\n if (moment(attributeValue.value, prettyDate).isValid()) {\n attributeValue.value = moment(attributeValue.value, prettyDate).format(\"YYYY-MM-DD\");\n }\n }\n return $scope.$apply(function() {\n return $ctrl.updateAttributeValue(attributeValue).then(function() {\n return render(attributeValue, false);\n });\n });\n };\n })(this));\n setFocusAndSelectOnInputField = function() {\n return $el.find(\"input[name='value'], textarea[name='value']\").focus().select();\n };\n attributeValue = $scope.$eval($attrs.tgCustomAttributeValue);\n render(attributeValue);\n $el.on(\"click\", \".js-value-view-mode span a\", function(event) {\n return event.stopPropagation();\n });\n $el.on(\"click\", \".js-value-view-mode\", function() {\n if (!isEditable()) {\n return;\n }\n if ($selectedText.get().length) {\n return;\n }\n render(attributeValue, true);\n return setFocusAndSelectOnInputField();\n });\n $el.on(\"click\", \".js-edit-description\", function(event) {\n event.preventDefault();\n render(attributeValue, true);\n return setFocusAndSelectOnInputField();\n });\n $el.on(\"keyup\", \"input[name=value], textarea[name='value']\", function(event) {\n if (event.keyCode === 13 && event.currentTarget.type !== \"textarea\") {\n return submit(event);\n } else if (event.keyCode === 27) {\n return render(attributeValue, false);\n }\n });\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".js-save-description\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"^tgCustomAttributesValues\",\n restrict: \"AE\"\n };\n };\n\n module.directive(\"tgCustomAttributeValue\", [\"$tgTemplate\", \"$selectedText\", \"$compile\", \"$translate\", \"tgDatePickerConfigService\", CustomAttributeValueDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/estimation.coffee\n */\n\n(function() {\n var EstimationsService, LbUsEstimationDirective, UsEstimationDirective, groupBy, module, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaCommon\");\n\n LbUsEstimationDirective = function($tgEstimationsService, $rootScope, $repo, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $scope.$watch($attrs.ngModel, function(us) {\n var estimationProcess;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n estimationProcess.onSelectedPointForRole = function(roleId, pointId) {\n return $scope.$apply(function() {\n return $model.$setViewValue(us);\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, template;\n ctx = {\n totalPoints: this.calculateTotalPoints(),\n roles: this.calculateRoles(),\n editable: this.isEditable\n };\n mainTemplate = \"common/estimation/us-estimation-points-per-role.html\";\n template = $template.get(mainTemplate, true);\n html = template(ctx);\n html = $compile(html)($scope);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgLbUsEstimation\", [\"$tgEstimationsService\", \"$rootScope\", \"$tgRepo\", \"$tgTemplate\", \"$compile\", LbUsEstimationDirective]);\n\n UsEstimationDirective = function($tgEstimationsService, $rootScope, $repo, $qqueue, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $scope.$watch($attrs.ngModel, function(us) {\n var estimationProcess;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n estimationProcess.onSelectedPointForRole = function(roleId, pointId) {\n return this.save(roleId, pointId).then(function() {\n return $rootScope.$broadcast(\"object:updated\");\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, template;\n ctx = {\n totalPoints: this.calculateTotalPoints(),\n roles: this.calculateRoles(),\n editable: this.isEditable\n };\n mainTemplate = \"common/estimation/us-estimation-points-per-role.html\";\n template = $template.get(mainTemplate, true);\n html = template(ctx);\n html = $compile(html)($scope);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsEstimation\", [\"$tgEstimationsService\", \"$rootScope\", \"$tgRepo\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", UsEstimationDirective]);\n\n EstimationsService = function($template, $qqueue, $repo, $confirm, $q) {\n var EstimationProcess, create, pointsTemplate;\n pointsTemplate = $template.get(\"common/estimation/us-estimation-points.html\", true);\n EstimationProcess = (function() {\n function EstimationProcess($el1, us1, project1) {\n this.$el = $el1;\n this.us = us1;\n this.project = project1;\n this.bindClickEvents = bind(this.bindClickEvents, this);\n this.isEditable = this.project.my_permissions.indexOf(\"modify_us\") !== -1;\n this.roles = this.project.roles;\n this.points = this.project.points;\n this.pointsById = groupBy(this.points, function(x) {\n return x.id;\n });\n this.onSelectedPointForRole = function(roleId, pointId) {};\n this.render = function() {};\n }\n\n EstimationProcess.prototype.save = function(roleId, pointId) {\n var deferred;\n deferred = $q.defer();\n $qqueue.add((function(_this) {\n return function() {\n var onError, onSuccess;\n onSuccess = function() {\n return deferred.resolve();\n };\n onError = function() {\n $confirm.notify(\"error\");\n _this.us.revert();\n _this.render();\n return deferred.reject();\n };\n return $repo.save(_this.us).then(onSuccess, onError);\n };\n })(this));\n return deferred.promise;\n };\n\n EstimationProcess.prototype.calculateTotalPoints = function() {\n var notNullValues, values;\n values = _.map(this.us.points, (function(_this) {\n return function(v, k) {\n var ref;\n return (ref = _this.pointsById[v]) != null ? ref.value : void 0;\n };\n })(this));\n if (values.length === 0) {\n return \"?\";\n }\n notNullValues = _.filter(values, function(v) {\n return v != null;\n });\n if (notNullValues.length === 0) {\n return \"?\";\n }\n return _.reduce(notNullValues, function(acc, num) {\n return acc + num;\n });\n };\n\n EstimationProcess.prototype.calculateRoles = function() {\n var computableRoles, roles;\n computableRoles = _.filter(this.project.roles, \"computable\");\n roles = _.map(computableRoles, (function(_this) {\n return function(role) {\n var pointId, pointObj;\n pointId = _this.us.points[role.id];\n pointObj = _this.pointsById[pointId];\n role = _.clone(role, true);\n role.points = (pointObj != null) && (pointObj.name != null) ? pointObj.name : \"?\";\n return role;\n };\n })(this));\n return roles;\n };\n\n EstimationProcess.prototype.bindClickEvents = function() {\n this.$el.on(\"click\", \".total.clickable\", (function(_this) {\n return function(event) {\n var roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n _this.renderPointsSelector(roleId, target);\n target.siblings().removeClass('active');\n return target.addClass('active');\n };\n })(this));\n return this.$el.on(\"click\", \".point\", (function(_this) {\n return function(event) {\n var pointId, points, roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n pointId = target.data(\"point-id\");\n _this.$el.find(\".popover\").popover().close();\n points = _.clone(_this.us.points, true);\n points[roleId] = pointId;\n _this.us.points = points;\n _this.render();\n return _this.onSelectedPointForRole(roleId, pointId);\n };\n })(this));\n };\n\n EstimationProcess.prototype.renderPointsSelector = function(roleId, target) {\n var horizontalList, html, maxPointLength, points, pop;\n points = _.map(this.points, (function(_this) {\n return function(point) {\n point = _.clone(point, true);\n point.selected = _this.us.points[roleId] === point.id ? false : true;\n return point;\n };\n })(this));\n maxPointLength = 5;\n horizontalList = _.some(points, (function(_this) {\n return function(point) {\n return point.name.length > maxPointLength;\n };\n })(this));\n html = pointsTemplate({\n \"points\": points,\n roleId: roleId,\n horizontal: horizontalList\n });\n this.$el.find(\".popover\").popover().close();\n this.$el.find(\".pop-points-open\").remove();\n if (target != null) {\n this.$el.find(target).append(html);\n } else {\n this.$el.append(html);\n }\n this.$el.find(\".pop-points-open\").popover().open(function() {\n return $(this).removeClass(\"active\").closest(\"li\").removeClass(\"active\");\n });\n this.$el.find(\".pop-points-open\").show();\n pop = this.$el.find(\".pop-points-open\");\n if (pop.offset().top + pop.height() > document.body.clientHeight) {\n return pop.addClass('pop-bottom');\n }\n };\n\n return EstimationProcess;\n\n })();\n create = function($el, us, project) {\n var estimationProcess;\n $el.unbind(\"click\");\n estimationProcess = new EstimationProcess($el, us, project);\n if (estimationProcess.isEditable) {\n estimationProcess.bindClickEvents();\n }\n return estimationProcess;\n };\n return {\n create: create\n };\n };\n\n module.factory(\"$tgEstimationsService\", [\"$tgTemplate\", \"$tgQqueue\", \"$tgRepo\", \"$tgConfirm\", \"$q\", EstimationsService]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/filters.coffee\n */\n\n(function() {\n var defaultFilter, module, momentFormat, momentFromNow, sizeFormat, taiga, unslugify, yesNoFilter;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n defaultFilter = function() {\n return function(value, defaultValue) {\n if (value === [null, void 0]) {\n return defaultValue;\n }\n return value;\n };\n };\n\n module.filter(\"default\", defaultFilter);\n\n yesNoFilter = function($translate) {\n return function(value) {\n if (value) {\n return $translate.instant(\"COMMON.YES\");\n }\n return $translate.instant(\"COMMON.NO\");\n };\n };\n\n module.filter(\"yesNo\", [\"$translate\", yesNoFilter]);\n\n unslugify = function() {\n return taiga.unslugify;\n };\n\n module.filter(\"unslugify\", unslugify);\n\n momentFormat = function() {\n return function(input, format) {\n if (input) {\n return moment(input).format(format);\n }\n return \"\";\n };\n };\n\n module.filter(\"momentFormat\", momentFormat);\n\n momentFromNow = function() {\n return function(input, without_suffix) {\n if (input) {\n return moment(input).fromNow(without_suffix || false);\n }\n return \"\";\n };\n };\n\n module.filter(\"momentFromNow\", momentFromNow);\n\n sizeFormat = (function(_this) {\n return function() {\n return _this.taiga.sizeFormat;\n };\n })(this);\n\n module.filter(\"sizeFormat\", sizeFormat);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/history.coffee\n */\n\n(function() {\n var HistoryController, HistoryDirective, IGNORED_FIELDS, bindOnce, debounce, module, taiga, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n IGNORED_FIELDS = {\n \"userstories.userstory\": [\"watchers\", \"kanban_order\", \"backlog_order\", \"sprint_order\", \"finish_date\", \"tribe_gig\"],\n \"tasks.task\": [\"watchers\", \"us_order\", \"taskboard_order\"],\n \"issues.issue\": [\"watchers\"]\n };\n\n HistoryController = (function(superClass) {\n extend(HistoryController, superClass);\n\n HistoryController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\"];\n\n function HistoryController(scope, repo, rs) {\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n }\n\n HistoryController.prototype.initialize = function(type, objectId) {\n this.type = type;\n return this.objectId = objectId;\n };\n\n HistoryController.prototype.loadHistory = function(type, objectId) {\n return this.rs.history.get(type, objectId).then((function(_this) {\n return function(history) {\n var changeModel, historyEntry, historyResult, i, j, len, len1;\n for (i = 0, len = history.length; i < len; i++) {\n historyResult = history[i];\n if (historyResult.values_diff.description_diff != null) {\n historyResult.values_diff.description = historyResult.values_diff.description_diff;\n }\n delete historyResult.values_diff.description_html;\n delete historyResult.values_diff.description_diff;\n if (historyResult.values_diff.blocked_note_diff != null) {\n historyResult.values_diff.blocked_note = historyResult.values_diff.blocked_note_diff;\n }\n delete historyResult.values_diff.blocked_note_html;\n delete historyResult.values_diff.blocked_note_diff;\n }\n for (j = 0, len1 = history.length; j < len1; j++) {\n historyEntry = history[j];\n changeModel = historyEntry.key.split(\":\")[0];\n if (IGNORED_FIELDS[changeModel] != null) {\n historyEntry.values_diff = _.removeKeys(historyEntry.values_diff, IGNORED_FIELDS[changeModel]);\n }\n }\n _this.scope.history = _.filter(history, function(item) {\n return Object.keys(item.values_diff).length > 0;\n });\n return _this.scope.comments = _.filter(history, function(item) {\n return item.comment !== \"\";\n });\n };\n })(this));\n };\n\n HistoryController.prototype.deleteComment = function(type, objectId, activityId) {\n return this.rs.history.deleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n HistoryController.prototype.undeleteComment = function(type, objectId, activityId) {\n return this.rs.history.undeleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n return HistoryController;\n\n })(taiga.Controller);\n\n HistoryDirective = function($log, $loading, $qqueue, $template, $confirm, $translate, $compile, $navUrls, $rootScope, checkPermissionsService) {\n var link, templateActivity, templateBase, templateBaseEntries, templateChangeAttachment, templateChangeDiff, templateChangeGeneric, templateChangeList, templateChangePoints, templateDeletedComment;\n templateChangeDiff = $template.get(\"common/history/history-change-diff.html\", true);\n templateChangePoints = $template.get(\"common/history/history-change-points.html\", true);\n templateChangeGeneric = $template.get(\"common/history/history-change-generic.html\", true);\n templateChangeAttachment = $template.get(\"common/history/history-change-attachment.html\", true);\n templateChangeList = $template.get(\"common/history/history-change-list.html\", true);\n templateDeletedComment = $template.get(\"common/history/history-deleted-comment.html\", true);\n templateActivity = $template.get(\"common/history/history-activity.html\", true);\n templateBaseEntries = $template.get(\"common/history/history-base-entries.html\", true);\n templateBase = $template.get(\"common/history/history-base.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var countChanges, formatChange, getHumanizedFieldName, getPrettyDateFormat, objectId, renderActivity, renderAttachmentEntry, renderBase, renderChange, renderChangeEntries, renderChangeEntry, renderChangesHelperText, renderComment, renderComments, renderCustomAttributesEntry, renderHistory, rerender, save, showAllActivity, showAllComments, type;\n type = $attrs.type;\n objectId = null;\n showAllComments = false;\n showAllActivity = false;\n getPrettyDateFormat = function() {\n return $translate.instant(\"ACTIVITY.DATETIME\");\n };\n bindOnce($scope, $attrs.ngModel, function(model) {\n type = $attrs.type;\n objectId = model.id;\n $ctrl.initialize(type, objectId);\n return $ctrl.loadHistory(type, objectId);\n });\n getHumanizedFieldName = function(field) {\n var humanizedFieldNames;\n humanizedFieldNames = {\n subject: $translate.instant(\"ACTIVITY.FIELDS.SUBJECT\"),\n name: $translate.instant(\"ACTIVITY.FIELDS.NAME\"),\n description: $translate.instant(\"ACTIVITY.FIELDS.DESCRIPTION\"),\n content: $translate.instant(\"ACTIVITY.FIELDS.CONTENT\"),\n status: $translate.instant(\"ACTIVITY.FIELDS.STATUS\"),\n is_closed: $translate.instant(\"ACTIVITY.FIELDS.IS_CLOSED\"),\n finish_date: $translate.instant(\"ACTIVITY.FIELDS.FINISH_DATE\"),\n type: $translate.instant(\"ACTIVITY.FIELDS.TYPE\"),\n priority: $translate.instant(\"ACTIVITY.FIELDS.PRIORITY\"),\n severity: $translate.instant(\"ACTIVITY.FIELDS.SEVERITY\"),\n assigned_to: $translate.instant(\"ACTIVITY.FIELDS.ASSIGNED_TO\"),\n watchers: $translate.instant(\"ACTIVITY.FIELDS.WATCHERS\"),\n milestone: $translate.instant(\"ACTIVITY.FIELDS.MILESTONE\"),\n user_story: $translate.instant(\"ACTIVITY.FIELDS.USER_STORY\"),\n project: $translate.instant(\"ACTIVITY.FIELDS.PROJECT\"),\n is_blocked: $translate.instant(\"ACTIVITY.FIELDS.IS_BLOCKED\"),\n blocked_note: $translate.instant(\"ACTIVITY.FIELDS.BLOCKED_NOTE\"),\n points: $translate.instant(\"ACTIVITY.FIELDS.POINTS\"),\n client_requirement: $translate.instant(\"ACTIVITY.FIELDS.CLIENT_REQUIREMENT\"),\n team_requirement: $translate.instant(\"ACTIVITY.FIELDS.TEAM_REQUIREMENT\"),\n is_iocaine: $translate.instant(\"ACTIVITY.FIELDS.IS_IOCAINE\"),\n tags: $translate.instant(\"ACTIVITY.FIELDS.TAGS\"),\n attachments: $translate.instant(\"ACTIVITY.FIELDS.ATTACHMENTS\"),\n is_deprecated: $translate.instant(\"ACTIVITY.FIELDS.IS_DEPRECATED\"),\n blocked_note: $translate.instant(\"ACTIVITY.FIELDS.BLOCKED_NOTE\"),\n is_blocked: $translate.instant(\"ACTIVITY.FIELDS.IS_BLOCKED\"),\n order: $translate.instant(\"ACTIVITY.FIELDS.ORDER\"),\n backlog_order: $translate.instant(\"ACTIVITY.FIELDS.BACKLOG_ORDER\"),\n sprint_order: $translate.instant(\"ACTIVITY.FIELDS.SPRINT_ORDER\"),\n kanban_order: $translate.instant(\"ACTIVITY.FIELDS.KANBAN_ORDER\"),\n taskboard_order: $translate.instant(\"ACTIVITY.FIELDS.TASKBOARD_ORDER\"),\n us_order: $translate.instant(\"ACTIVITY.FIELDS.US_ORDER\")\n };\n return humanizedFieldNames[field] || field;\n };\n countChanges = function(comment) {\n return _.keys(comment.values_diff).length;\n };\n formatChange = function(change) {\n if (_.isArray(change)) {\n if (change.length === 0) {\n return $translate.instant(\"ACTIVITY.VALUES.EMPTY\");\n }\n return change.join(\", \");\n }\n if (change === \"\") {\n return $translate.instant(\"ACTIVITY.VALUES.EMPTY\");\n }\n if ((change == null) || change === false) {\n return $translate.instant(\"ACTIVITY.VALUES.NO\");\n }\n if (change === true) {\n return $translate.instant(\"ACTIVITY.VALUES.YES\");\n }\n return change;\n };\n renderAttachmentEntry = function(value) {\n var attachments;\n attachments = _.map(value, function(changes, type) {\n if (type === \"new\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: $translate.instant(\"ACTIVITY.NEW_ATTACHMENT\"),\n diff: change.filename\n });\n });\n } else if (type === \"deleted\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: $translate.instant(\"ACTIVITY.DELETED_ATTACHMENT\"),\n diff: change.filename\n });\n });\n } else {\n return _.map(changes, function(change) {\n var diff, name;\n name = $translate.instant(\"ACTIVITY.UPDATED_ATTACHMENT\", {\n filename: change.filename\n });\n diff = _.map(change.changes, function(values, name) {\n return {\n name: getHumanizedFieldName(name),\n from: formatChange(values[0]),\n to: formatChange(values[1])\n };\n });\n return templateChangeAttachment({\n name: name,\n diff: diff\n });\n });\n }\n });\n return _.flatten(attachments).join(\"\\n\");\n };\n renderCustomAttributesEntry = function(value) {\n var customAttributes;\n customAttributes = _.map(value, function(changes, type) {\n if (type === \"new\") {\n return _.map(changes, function(change) {\n var html;\n html = templateChangeGeneric({\n name: change.name,\n from: formatChange(\"\"),\n to: formatChange(change.value)\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n });\n } else if (type === \"deleted\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: $translate.instant(\"ACTIVITY.DELETED_CUSTOM_ATTRIBUTE\"),\n diff: change.name\n });\n });\n } else {\n return _.map(changes, function(change) {\n var customAttrsChanges;\n customAttrsChanges = _.map(change.changes, function(values) {\n return templateChangeGeneric({\n name: change.name,\n from: formatChange(values[0]),\n to: formatChange(values[1])\n });\n });\n return _.flatten(customAttrsChanges).join(\"\\n\");\n });\n }\n });\n return _.flatten(customAttributes).join(\"\\n\");\n };\n renderChangeEntry = function(field, value) {\n var added, from, html, name, removed, to;\n if (field === \"description\") {\n return templateChangeDiff({\n name: getHumanizedFieldName(\"description\"),\n diff: value[1]\n });\n } else if (field === \"blocked_note\") {\n return templateChangeDiff({\n name: getHumanizedFieldName(\"blocked_note\"),\n diff: value[1]\n });\n } else if (field === \"points\") {\n html = templateChangePoints({\n points: value\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n } else if (field === \"attachments\") {\n return renderAttachmentEntry(value);\n } else if (field === \"custom_attributes\") {\n return renderCustomAttributesEntry(value);\n } else if (field === \"tags\" || field === \"watchers\") {\n name = getHumanizedFieldName(field);\n removed = _.difference(value[0], value[1]);\n added = _.difference(value[1], value[0]);\n html = templateChangeList({\n name: name,\n removed: removed,\n added: added\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n } else if (field === \"assigned_to\") {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0] || $translate.instant(\"ACTIVITY.VALUES.UNASSIGNED\"));\n to = formatChange(value[1] || $translate.instant(\"ACTIVITY.VALUES.UNASSIGNED\"));\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n } else {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0]);\n to = formatChange(value[1]);\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n }\n };\n renderChangeEntries = function(change) {\n return _.map(change.values_diff, function(value, field) {\n return renderChangeEntry(field, value);\n });\n };\n renderChangesHelperText = function(change) {\n var size;\n size = countChanges(change);\n return $translate.instant(\"ACTIVITY.SIZE_CHANGE\", {\n size: size\n }, 'messageformat');\n };\n renderComment = function(comment) {\n var html, ref, ref1, ref2;\n if (comment.delete_comment_date || ((ref = comment.delete_comment_user) != null ? ref.name : void 0)) {\n html = templateDeletedComment({\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(getPrettyDateFormat()) : void 0,\n deleteCommentUser: comment.delete_comment_user.name,\n deleteComment: comment.comment_html,\n activityId: comment.id,\n canRestoreComment: $scope.user && (comment.delete_comment_user.pk === $scope.user.id || $scope.project.my_permissions.indexOf(\"modify_project\") > -1)\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n }\n html = templateActivity({\n avatar: comment.user.photo,\n userFullName: comment.user.name,\n userProfileUrl: comment.user.is_active ? $navUrls.resolve(\"user-profile\", {\n username: comment.user.username\n }) : \"\",\n creationDate: moment(comment.created_at).format(getPrettyDateFormat()),\n comment: comment.comment_html,\n changesText: renderChangesHelperText(comment),\n changes: renderChangeEntries(comment),\n mode: \"comment\",\n deleteCommentActionTitle: $translate.instant(\"COMMENTS.DELETE\"),\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(getPrettyDateFormat()) : void 0,\n deleteCommentUser: ((ref1 = comment.delete_comment_user) != null ? ref1.name : void 0) ? comment.delete_comment_user.name : void 0,\n activityId: comment.id,\n canDeleteComment: comment.user.pk === ((ref2 = $scope.user) != null ? ref2.id : void 0) || $scope.project.my_permissions.indexOf(\"modify_project\") > -1\n });\n html = $compile(html)($scope);\n return html[0].outerHTML;\n };\n renderChange = function(change) {\n var ref;\n return templateActivity({\n avatar: change.user.photo,\n userFullName: change.user.name,\n userProfileUrl: change.user.is_active ? $navUrls.resolve(\"user-profile\", {\n username: change.user.username\n }) : \"\",\n creationDate: moment(change.created_at).format(getPrettyDateFormat()),\n comment: change.comment_html,\n changes: renderChangeEntries(change),\n changesText: \"\",\n mode: \"activity\",\n deleteCommentDate: change.delete_comment_date ? moment(change.delete_comment_date).format(getPrettyDateFormat()) : void 0,\n deleteCommentUser: ((ref = change.delete_comment_user) != null ? ref.name : void 0) ? change.delete_comment_user.name : void 0,\n activityId: change.id\n });\n };\n renderHistory = function(entries, totalEntries) {\n var html, showMore;\n if (entries.length === totalEntries) {\n showMore = 0;\n } else {\n showMore = totalEntries - entries.length;\n }\n html = templateBaseEntries({\n entries: entries,\n showMore: showMore\n });\n html = $compile(html)($scope);\n return html;\n };\n renderBase = function() {\n var changes, comments, commentsVisible, historyVisible, html;\n comments = $scope.comments || [];\n changes = $scope.history || [];\n historyVisible = !!changes.length;\n commentsVisible = (!!comments.length) || checkPermissionsService.check('modify_' + $attrs.type);\n html = templateBase({\n ngmodel: $attrs.ngModel,\n type: $attrs.type,\n mode: $attrs.mode,\n historyVisible: historyVisible,\n commentsVisible: commentsVisible\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n rerender = function() {\n renderBase();\n renderComments();\n return renderActivity();\n };\n renderComments = function() {\n var comments, html, totalComments;\n comments = $scope.comments || [];\n totalComments = comments.length;\n if (!showAllComments) {\n comments = _.takeRight(comments, 4);\n }\n comments = _.map(comments, function(x) {\n return renderComment(x);\n });\n html = renderHistory(comments, totalComments);\n return $el.find(\".comments-list\").html(html);\n };\n renderActivity = function() {\n var changes, html, totalChanges;\n changes = $scope.history || [];\n totalChanges = changes.length;\n if (!showAllActivity) {\n changes = _.takeRight(changes, 4);\n }\n changes = _.map(changes, function(x) {\n return renderChange(x);\n });\n html = renderHistory(changes, totalChanges);\n return $el.find(\".changes-list\").html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(target) {\n var currentLoading, model, onError, onSuccess;\n $scope.$broadcast(\"markdown-editor:submit\");\n $el.find(\".comment-list\").addClass(\"activeanimation\");\n currentLoading = $loading().target(target).start();\n onSuccess = function() {\n $rootScope.$broadcast(\"comment:new\");\n return $ctrl.loadHistory(type, objectId)[\"finally\"](function() {\n return currentLoading.finish();\n });\n };\n onError = function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n };\n model = $scope.$eval($attrs.ngModel);\n return $ctrl.repo.save(model).then(onSuccess, onError);\n };\n })(this));\n $scope.$watch(\"comments\", rerender);\n $scope.$watch(\"history\", rerender);\n $scope.$on(\"object:updated\", function() {\n return $ctrl.loadHistory(type, objectId);\n });\n $el.on(\"click\", \".add-comment button.button-green\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n }));\n $el.on(\"click\", \"a\", function(event) {\n var href, target;\n target = angular.element(event.target);\n href = target.attr('href');\n if (href && href.indexOf(\"#\") === 0) {\n event.preventDefault();\n return $('body').scrollTop($(href).offset().top);\n }\n });\n $el.on(\"click\", \".show-more\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.parent().is(\".changes-list\")) {\n showAllActivity = !showAllActivity;\n return renderActivity();\n } else {\n showAllComments = !showAllComments;\n return renderComments();\n }\n });\n $el.on(\"click\", \".show-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').show();\n target.parents('.activity-single').find('.show-deleted-comment').hide();\n return target.parents('.activity-single').find('.comment-body').show();\n });\n $el.on(\"click\", \".hide-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').hide();\n target.parents('.activity-single').find('.show-deleted-comment').show();\n return target.parents('.activity-single').find('.comment-body').hide();\n });\n $el.on(\"click\", \".changes-title\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return target.parent().find(\".change-entry\").toggleClass(\"active\");\n });\n $el.on(\"focus\", \".add-comment textarea\", function(event) {\n return $(this).addClass('active');\n });\n $el.on(\"click\", \".history-tabs li a\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n $el.find(\".history-tabs li a\").removeClass(\"active\");\n target.addClass(\"active\");\n $el.find(\".history section\").addClass(\"hidden\");\n return $el.find(\".history section.\" + (target.data('section-class'))).removeClass(\"hidden\");\n });\n $el.on(\"click\", \".comment-delete\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.deleteComment(type, objectId, activityId);\n }));\n $el.on(\"click\", \".comment-restore\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.undeleteComment(type, objectId, activityId);\n }));\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return renderBase();\n };\n return {\n controller: HistoryController,\n restrict: \"AE\",\n link: link\n };\n };\n\n module.directive(\"tgHistory\", [\"$log\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$tgConfirm\", \"$translate\", \"$compile\", \"$tgNavUrls\", \"$rootScope\", \"tgCheckPermissionsService\", HistoryDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/importer.coffee\n */\n\n(function() {\n var ImportProjectButtonDirective, LbImportErrorDirective, module;\n\n module = angular.module(\"taigaCommon\");\n\n ImportProjectButtonDirective = function($rs, $confirm, $location, $navUrls, $translate, $lightboxFactory, currentUserService, $tgAuth) {\n var link;\n link = function($scope, $el, $attrs) {\n var getRestrictionError;\n getRestrictionError = function(result) {\n var errorKey, maxMemberships, membersError, privateError, publicError, user;\n if (result.headers) {\n errorKey = '';\n user = currentUserService.getUser();\n maxMemberships = 0;\n if (result.headers.isPrivate) {\n privateError = !currentUserService.canCreatePrivateProjects().valid;\n maxMemberships = null;\n if (user.get('max_memberships_private_projects') !== null && result.headers.memberships >= user.get('max_memberships_private_projects')) {\n membersError = true;\n } else {\n membersError = false;\n }\n if (privateError && membersError) {\n errorKey = 'private-space-members';\n maxMemberships = user.get('max_memberships_private_projects');\n } else if (privateError) {\n errorKey = 'private-space';\n } else if (membersError) {\n errorKey = 'private-members';\n maxMemberships = user.get('max_memberships_private_projects');\n }\n } else {\n publicError = !currentUserService.canCreatePublicProjects().valid;\n if (user.get('max_memberships_public_projects') !== null && result.headers.memberships >= user.get('max_memberships_public_projects')) {\n membersError = true;\n } else {\n membersError = false;\n }\n if (publicError && membersError) {\n errorKey = 'public-space-members';\n maxMemberships = user.get('max_memberships_public_projects');\n } else if (publicError) {\n errorKey = 'public-space';\n } else if (membersError) {\n errorKey = 'public-members';\n maxMemberships = user.get('max_memberships_public_projects');\n }\n }\n return {\n key: errorKey,\n values: {\n max_memberships: maxMemberships,\n members: result.headers.memberships\n }\n };\n } else {\n return false;\n }\n };\n $el.on(\"click\", \".import-project-button\", function(event) {\n event.preventDefault();\n $el.find(\"input.import-file\").val(\"\");\n return $el.find(\"input.import-file\").trigger(\"click\");\n });\n return $el.on(\"change\", \"input.import-file\", function(event) {\n var file, loader, onError, onSuccess;\n event.preventDefault();\n file = event.target.files[0];\n if (!file) {\n return;\n }\n loader = $confirm.loader($translate.instant(\"PROJECT.IMPORT.UPLOADING_FILE\"));\n onSuccess = function(result) {\n return currentUserService.loadProjects().then(function() {\n var ctx, message, msg, title;\n loader.stop();\n if (result.status === 202) {\n title = $translate.instant(\"PROJECT.IMPORT.ASYNC_IN_PROGRESS_TITLE\");\n message = $translate.instant(\"PROJECT.IMPORT.ASYNC_IN_PROGRESS_MESSAGE\");\n return $confirm.success(title, message);\n } else {\n ctx = {\n project: result.data.slug\n };\n $location.path($navUrls.resolve(\"project-admin-project-profile-details\", ctx));\n msg = $translate.instant(\"PROJECT.IMPORT.SYNC_SUCCESS\");\n return $confirm.notify(\"success\", msg);\n }\n });\n };\n onError = function(result) {\n return $tgAuth.refresh().then(function() {\n var errorMsg, ref, restrictionError;\n restrictionError = getRestrictionError(result);\n loader.stop();\n if (restrictionError) {\n return $lightboxFactory.create('tg-lb-import-error', {\n \"class\": 'lightbox lightbox-import-error'\n }, restrictionError);\n } else {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR\");\n if (result.status === 429) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_TOO_MANY_REQUEST\");\n } else if ((ref = result.data) != null ? ref._error_message : void 0) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_MESSAGE\", {\n error_message: result.data._error_message\n });\n }\n return $confirm.notify(\"error\", errorMsg);\n }\n });\n };\n loader.start();\n return $rs.projects[\"import\"](file, loader.update).then(onSuccess, onError);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgImportProjectButton\", [\"$tgResources\", \"$tgConfirm\", \"$location\", \"$tgNavUrls\", \"$translate\", \"tgLightboxFactory\", \"tgCurrentUserService\", \"$tgAuth\", ImportProjectButtonDirective]);\n\n LbImportErrorDirective = function(lightboxService) {\n var link;\n link = function(scope, el, attrs) {\n lightboxService.open(el);\n return scope.close = function() {\n lightboxService.close(el);\n };\n };\n return {\n templateUrl: \"common/lightbox/lightbox-import-error.html\",\n link: link\n };\n };\n\n LbImportErrorDirective.$inject = [\"lightboxService\"];\n\n module.directive(\"tgLbImportError\", LbImportErrorDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/lightboxes.coffee\n */\n\n(function() {\n var AssignedToLightboxDirective, AttachmentPreviewLightboxDirective, BlockLightboxDirective, BlockingMessageInputDirective, CreateBulkUserstoriesDirective, CreateEditUserstoryDirective, LightboxDirective, LightboxKeyboardNavigationService, LightboxLeaveProjectWarningDirective, LightboxService, WatchersLightboxDirective, bindOnce, debounce, module, sizeFormat, timeout,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n module = angular.module(\"taigaCommon\");\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n sizeFormat = this.taiga.sizeFormat;\n\n LightboxService = (function(superClass) {\n extend(LightboxService, superClass);\n\n function LightboxService(animationFrame, q) {\n this.animationFrame = animationFrame;\n this.q = q;\n }\n\n LightboxService.prototype.open = function($el) {\n var defered, docEl, lightboxContent;\n if (_.isString($el)) {\n $el = $($el);\n }\n defered = this.q.defer();\n lightboxContent = $el.children().not(\".close\");\n lightboxContent.hide();\n this.animationFrame.add(function() {\n return $el.css('display', 'flex');\n });\n this.animationFrame.add(function() {\n $el.addClass(\"open\");\n return $el.one(\"transitionend\", (function(_this) {\n return function() {\n return $el.find('input,textarea').first().focus();\n };\n })(this));\n });\n this.animationFrame.add((function(_this) {\n return function() {\n lightboxContent.show();\n return defered.resolve();\n };\n })(this));\n docEl = angular.element(document);\n docEl.on(\"keydown.lightbox\", (function(_this) {\n return function(e) {\n var code;\n code = e.keyCode ? e.keyCode : e.which;\n if (code === 27) {\n return _this.close($el);\n }\n };\n })(this));\n return defered.promise;\n };\n\n LightboxService.prototype.close = function($el) {\n var docEl, scope;\n if (_.isString($el)) {\n $el = $($el);\n }\n docEl = angular.element(document);\n docEl.off(\".lightbox\");\n docEl.off(\".keyboard-navigation\");\n $el.one(\"transitionend\", (function(_this) {\n return function() {\n $el.removeAttr('style');\n return $el.removeClass(\"open\").removeClass('close');\n };\n })(this));\n this.animationFrame.add(function() {\n return $el.addClass('close');\n });\n if ($el.hasClass(\"remove-on-close\")) {\n scope = $el.data(\"scope\");\n scope.$destroy();\n return $el.remove();\n }\n };\n\n LightboxService.prototype.closeAll = function() {\n var docEl, i, len, lightboxEl, ref, results;\n docEl = angular.element(document);\n ref = docEl.find(\".lightbox.open\");\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n lightboxEl = ref[i];\n results.push(this.close($(lightboxEl)));\n }\n return results;\n };\n\n return LightboxService;\n\n })(taiga.Service);\n\n module.service(\"lightboxService\", [\"animationFrame\", \"$q\", LightboxService]);\n\n LightboxKeyboardNavigationService = (function(superClass) {\n extend(LightboxKeyboardNavigationService, superClass);\n\n function LightboxKeyboardNavigationService() {\n return LightboxKeyboardNavigationService.__super__.constructor.apply(this, arguments);\n }\n\n LightboxKeyboardNavigationService.prototype.stop = function() {\n var docEl;\n docEl = angular.element(document);\n return docEl.off(\".keyboard-navigation\");\n };\n\n LightboxKeyboardNavigationService.prototype.dispatch = function($el, code) {\n var activeElement, next, prev;\n activeElement = $el.find(\".selected\");\n if (code === 13) {\n if ($el.find(\".user-list-single\").length === 1) {\n return $el.find('.user-list-single:first').trigger(\"click\");\n } else {\n return activeElement.trigger(\"click\");\n }\n } else if (code === 40) {\n if (!activeElement.length) {\n return $el.find('.user-list-single:not(\".is-active\"):first').addClass('selected');\n } else {\n next = activeElement.next('.user-list-single');\n if (next.length) {\n activeElement.removeClass('selected');\n return next.addClass('selected');\n }\n }\n } else if (code === 38) {\n if (!activeElement.length) {\n return $el.find('.user-list-single:last').addClass('selected');\n } else {\n prev = activeElement.prev('.user-list-single:not(\".is-active\")');\n if (prev.length) {\n activeElement.removeClass('selected');\n return prev.addClass('selected');\n }\n }\n }\n };\n\n LightboxKeyboardNavigationService.prototype.init = function($el) {\n var docEl;\n this.stop();\n docEl = angular.element(document);\n return docEl.on(\"keydown.keyboard-navigation\", (function(_this) {\n return function(event) {\n var code;\n code = event.keyCode ? event.keyCode : event.which;\n if (code === 40 || code === 38 || code === 13) {\n event.preventDefault();\n return _this.dispatch($el, code);\n }\n };\n })(this));\n };\n\n return LightboxKeyboardNavigationService;\n\n })(taiga.Service);\n\n module.service(\"lightboxKeyboardNavigationService\", LightboxKeyboardNavigationService);\n\n LightboxDirective = function(lightboxService) {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n };\n return {\n restrict: \"C\",\n link: link\n };\n };\n\n module.directive(\"lightbox\", [\"lightboxService\", LightboxDirective]);\n\n BlockLightboxDirective = function($rootscope, $tgrepo, $confirm, lightboxService, $loading, $qqueue, $translate) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var block, title, unblock;\n title = $translate.instant($attrs.title);\n $el.find(\"h2.title\").text(title);\n unblock = $qqueue.bindAdd((function(_this) {\n return function(item, finishCallback) {\n var promise;\n promise = $tgrepo.save(item);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n $model.$setViewValue(item);\n return finishCallback();\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n promise[\"finally\"](function() {\n return finishCallback();\n });\n return promise;\n };\n })(this));\n block = $qqueue.bindAdd((function(_this) {\n return function(item) {\n var currentLoading, promise;\n $model.$setViewValue(item);\n currentLoading = $loading().target($el.find(\".button-green\")).start();\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"object:updated\");\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n return promise[\"finally\"](function() {\n currentLoading.finish();\n return lightboxService.close($el);\n });\n };\n })(this));\n $scope.$on(\"block\", function() {\n $el.find(\".reason\").val($model.$modelValue.blocked_note);\n return lightboxService.open($el);\n });\n $scope.$on(\"unblock\", (function(_this) {\n return function(event, model, finishCallback) {\n var item;\n item = $model.$modelValue.clone();\n item.is_blocked = false;\n item.blocked_note = \"\";\n return unblock(item, finishCallback);\n };\n })(this));\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n var item;\n event.preventDefault();\n item = $model.$modelValue.clone();\n item.is_blocked = true;\n item.blocked_note = $el.find(\".reason\").val();\n return block(item);\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-block.html\",\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgLbBlock\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"lightboxService\", \"$tgLoading\", \"$tgQqueue\", \"$translate\", BlockLightboxDirective]);\n\n BlockingMessageInputDirective = function($log, $template, $compile) {\n var link, template, templateFn;\n template = $template.get(\"common/lightbox/lightbox-blocking-message-input.html\", true);\n link = function($scope, $el, $attrs, $model) {\n if (!$attrs.watch) {\n return $log.error(\"No watch attribute on tg-blocking-message-input directive\");\n }\n return $scope.$watch($attrs.watch, function(value) {\n if (value === !void 0 && value === true) {\n return $el.find(\".blocked-note\").removeClass(\"hidden\");\n } else {\n return $el.find(\".blocked-note\").addClass(\"hidden\");\n }\n });\n };\n templateFn = function($el, $attrs) {\n return template({\n ngmodel: $attrs.ngModel\n });\n };\n return {\n template: templateFn,\n link: link,\n require: \"ngModel\",\n restrict: \"EA\"\n };\n };\n\n module.directive(\"tgBlockingMessageInput\", [\"$log\", \"$tgTemplate\", \"$compile\", BlockingMessageInputDirective]);\n\n CreateEditUserstoryDirective = function($repo, $model, $rs, $rootScope, lightboxService, $loading, $translate, $confirm, $q, attachmentsService) {\n var link;\n link = function($scope, $el, attrs) {\n var attachmentsToAdd, attachmentsToDelete, createAttachments, deleteAttachments, form, resetAttachments, submit, submitButton;\n form = null;\n $scope.createEditUs = {};\n $scope.isNew = true;\n attachmentsToAdd = Immutable.List();\n attachmentsToDelete = Immutable.List();\n resetAttachments = function() {\n attachmentsToAdd = Immutable.List();\n return attachmentsToDelete = Immutable.List();\n };\n $scope.addAttachment = function(attachment) {\n return attachmentsToAdd = attachmentsToAdd.push(attachment);\n };\n $scope.deleteAttachment = function(attachment) {\n return attachmentsToDelete = attachmentsToDelete.push(attachment);\n };\n $scope.$on(\"usform:new\", function(ctx, projectId, status, statusList) {\n if (form) {\n form.reset();\n }\n $scope.isNew = true;\n $scope.usStatusList = statusList;\n $scope.attachments = Immutable.List();\n resetAttachments();\n $scope.us = $model.make_model(\"userstories\", {\n project: projectId,\n points: {},\n status: status,\n is_archived: false,\n tags: []\n });\n $el.find(\".button-green\").html($translate.instant(\"COMMON.CREATE\"));\n $el.find(\".title\").html($translate.instant(\"LIGHTBOX.CREATE_EDIT_US.NEW_US\"));\n $el.find(\".tag-input\").val(\"\");\n $el.find(\".blocked-note\").addClass(\"hidden\");\n $el.find(\"label.blocked\").removeClass(\"selected\");\n $el.find(\"label.team-requirement\").removeClass(\"selected\");\n $el.find(\"label.client-requirement\").removeClass(\"selected\");\n return lightboxService.open($el);\n });\n $scope.$on(\"usform:edit\", function(ctx, us, attachments) {\n if (form) {\n form.reset();\n }\n $scope.us = us;\n $scope.attachments = Immutable.fromJS(attachments);\n $scope.isNew = false;\n resetAttachments();\n $el.find(\".button-green\").html($translate.instant(\"COMMON.SAVE\"));\n $el.find(\".title\").html($translate.instant(\"LIGHTBOX.CREATE_EDIT_US.EDIT_US\"));\n $el.find(\".tag-input\").val(\"\");\n if (us.is_blocked) {\n $el.find(\".blocked-note\").removeClass(\"hidden\");\n $el.find(\"label.blocked\").addClass(\"selected\");\n } else {\n $el.find(\".blocked-note\").addClass(\"hidden\");\n $el.find(\"label.blocked\").removeClass(\"selected\");\n }\n if (us.team_requirement) {\n $el.find(\"label.team-requirement\").addClass(\"selected\");\n } else {\n $el.find(\"label.team-requirement\").removeClass(\"selected\");\n }\n if (us.client_requirement) {\n $el.find(\"label.client-requirement\").addClass(\"selected\");\n } else {\n $el.find(\"label.client-requirement\").removeClass(\"selected\");\n }\n return lightboxService.open($el);\n });\n createAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToAdd.toJS(), function(attachment) {\n return attachmentsService.upload(attachment.file, obj.id, $scope.us.project, 'us');\n });\n return $q.all(promises);\n };\n deleteAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToDelete.toJS(), function(attachment) {\n return attachmentsService[\"delete\"](\"us\", attachment.id);\n });\n return $q.all(promises);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, currentLoading, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n if ($scope.isNew) {\n promise = $repo.create(\"userstories\", $scope.us);\n broadcastEvent = \"usform:new:success\";\n } else {\n promise = $repo.save($scope.us);\n broadcastEvent = \"usform:edit:success\";\n }\n promise.then(function(data) {\n deleteAttachments(data).then((function(_this) {\n return function() {\n return createAttachments(data);\n };\n })(this));\n return data;\n });\n promise.then(function(data) {\n currentLoading.finish();\n lightboxService.close($el);\n return $rootScope.$broadcast(broadcastEvent, data);\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n $scope.$apply(function() {\n return $scope.us.revert();\n });\n return lightboxService.close($el);\n });\n $el.keydown(function(event) {\n var code;\n code = event.keyCode ? event.keyCode : event.which;\n if (code === 27) {\n lightboxService.close($el);\n return $scope.$apply(function() {\n return $scope.us.revert();\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateEditUserstory\", [\"$tgRepo\", \"$tgModel\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$translate\", \"$tgConfirm\", \"$q\", \"tgAttachmentsService\", CreateEditUserstoryDirective]);\n\n CreateBulkUserstoriesDirective = function($repo, $rs, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var form, submit, submitButton;\n form = null;\n $scope.$on(\"usform:bulk\", function(ctx, projectId, status) {\n if (form) {\n form.reset();\n }\n $scope[\"new\"] = {\n projectId: projectId,\n statusId: status,\n bulk: \"\"\n };\n return lightboxService.open($el);\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $rs.userstories.bulkCreate($scope[\"new\"].projectId, $scope[\"new\"].statusId, $scope[\"new\"].bulk);\n promise.then(function(result) {\n currentLoading.finish();\n $rootscope.$broadcast(\"usform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateBulkUserstories\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", CreateBulkUserstoriesDirective]);\n\n AssignedToLightboxDirective = function(lightboxService, lightboxKeyboardNavigationService, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs) {\n var closeLightbox, filterUsers, normalizeString, render, selectedItem, selectedUser, usersTemplate;\n selectedUser = null;\n selectedItem = null;\n usersTemplate = $template.get(\"common/lightbox/lightbox-assigned-to-users.html\", true);\n normalizeString = function(string) {\n var normalizedString;\n normalizedString = string;\n normalizedString = normalizedString.replace(\"Á\", \"A\").replace(\"Ä\", \"A\").replace(\"À\", \"A\");\n normalizedString = normalizedString.replace(\"É\", \"E\").replace(\"Ë\", \"E\").replace(\"È\", \"E\");\n normalizedString = normalizedString.replace(\"Í\", \"I\").replace(\"Ï\", \"I\").replace(\"Ì\", \"I\");\n normalizedString = normalizedString.replace(\"Ó\", \"O\").replace(\"Ö\", \"O\").replace(\"Ò\", \"O\");\n normalizedString = normalizedString.replace(\"Ú\", \"U\").replace(\"Ü\", \"U\").replace(\"Ù\", \"U\");\n return normalizedString;\n };\n filterUsers = function(text, user) {\n var username;\n username = user.full_name_display.toUpperCase();\n username = normalizeString(username);\n text = text.toUpperCase();\n text = normalizeString(text);\n return _.includes(username, text);\n };\n render = function(selected, text) {\n var ctx, html, users;\n users = _.clone($scope.activeUsers, true);\n if (selected != null) {\n users = _.reject(users, {\n \"id\": selected.id\n });\n }\n if (text != null) {\n users = _.filter(users, _.partial(filterUsers, text));\n }\n ctx = {\n selected: selected,\n users: _.slice(users, 0, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n html = $compile(html)($scope);\n return $el.find(\".assigned-to-list\").html(html);\n };\n closeLightbox = function() {\n lightboxKeyboardNavigationService.stop();\n return lightboxService.close($el);\n };\n $scope.$on(\"assigned-to:add\", function(ctx, item) {\n var assignedToId;\n selectedItem = item;\n assignedToId = item.assigned_to;\n selectedUser = $scope.usersById[assignedToId];\n render(selectedUser);\n return lightboxService.open($el).then(function() {\n $el.find('input').focus();\n return lightboxKeyboardNavigationService.init($el);\n });\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n if (searchingText != null) {\n render(selectedUser, searchingText);\n return $el.find('input').focus();\n }\n });\n $el.on(\"click\", \".user-list-single\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n closeLightbox();\n return $scope.$apply(function() {\n $scope.$broadcast(\"assigned-to:added\", target.data(\"user-id\"), selectedItem);\n return $scope.usersSearch = null;\n });\n });\n $el.on(\"click\", \".remove-assigned-to\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n closeLightbox();\n return $scope.$apply(function() {\n $scope.usersSearch = null;\n return $scope.$broadcast(\"assigned-to:added\", null, selectedItem);\n });\n });\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n closeLightbox();\n return $scope.$apply(function() {\n return $scope.usersSearch = null;\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-assigned-to.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbAssignedto\", [\"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", AssignedToLightboxDirective]);\n\n WatchersLightboxDirective = function($repo, lightboxService, lightboxKeyboardNavigationService, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs) {\n var closeLightbox, getFilteredUsers, render, selectedItem, usersTemplate;\n selectedItem = null;\n usersTemplate = $template.get(\"common/lightbox/lightbox-assigned-to-users.html\", true);\n getFilteredUsers = function(text) {\n var _filterUsers, users;\n if (text == null) {\n text = \"\";\n }\n _filterUsers = function(text, user) {\n var username;\n if (selectedItem && _.find(selectedItem.watchers, function(x) {\n return x === user.id;\n })) {\n return false;\n }\n username = user.full_name_display.toUpperCase();\n text = text.toUpperCase();\n return _.includes(username, text);\n };\n users = _.clone($scope.activeUsers, true);\n users = _.filter(users, _.partial(_filterUsers, text));\n return users;\n };\n render = function(users) {\n var ctx, html;\n ctx = {\n selected: false,\n users: _.slice(users, 0, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n html = $compile(html)($scope);\n return $el.find(\".ticket-watchers\").html(html);\n };\n closeLightbox = function() {\n lightboxKeyboardNavigationService.stop();\n return lightboxService.close($el);\n };\n $scope.$on(\"watcher:add\", function(ctx, item) {\n var users;\n selectedItem = item;\n users = getFilteredUsers();\n render(users);\n return lightboxService.open($el).then(function() {\n $el.find(\"input\").focus();\n return lightboxKeyboardNavigationService.init($el);\n });\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n var users;\n if (searchingText == null) {\n return;\n }\n users = getFilteredUsers(searchingText);\n render(users);\n return $el.find(\"input\").focus();\n });\n $el.on(\"click\", \".user-list-single\", debounce(2000, function(event) {\n var target;\n closeLightbox();\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return $scope.$apply(function() {\n $scope.usersSearch = null;\n return $scope.$broadcast(\"watcher:added\", target.data(\"user-id\"));\n });\n }));\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n closeLightbox();\n return $scope.$apply(function() {\n return $scope.usersSearch = null;\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-users.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbWatchers\", [\"$tgRepo\", \"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", WatchersLightboxDirective]);\n\n AttachmentPreviewLightboxDirective = function(lightboxService, $template, $compile) {\n var link;\n link = function($scope, $el, attrs) {\n return lightboxService.open($el);\n };\n return {\n templateUrl: 'common/lightbox/lightbox-attachment-preview.html',\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgLbAttachmentPreview\", [\"lightboxService\", \"$tgTemplate\", \"$compile\", AttachmentPreviewLightboxDirective]);\n\n LightboxLeaveProjectWarningDirective = function(lightboxService, $template, $compile) {\n var link;\n link = function($scope, $el, attrs) {\n return lightboxService.open($el);\n };\n return {\n templateUrl: 'common/lightbox/lightbox-leave-project-warning.html',\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgLightboxLeaveProjectWarning\", [\"lightboxService\", LightboxLeaveProjectWarningDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/loader.coffee\n */\n\n(function() {\n var Loader, LoaderDirective, module, sizeFormat, taiga, timeout;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaCommon\");\n\n LoaderDirective = function(tgLoader, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n tgLoader.onStart(function() {\n $(document.body).addClass(\"loader-active\");\n return $el.addClass(\"active\");\n });\n return tgLoader.onEnd(function() {\n $(document.body).removeClass(\"loader-active\");\n return $el.removeClass(\"active\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLoader\", [\"tgLoader\", \"$rootScope\", LoaderDirective]);\n\n Loader = function($rootscope) {\n var autoClose, config, lastResponseDate, open, pageLoaded, requestCount, start, startLoadTime;\n config = {\n minTime: 300\n };\n open = false;\n startLoadTime = 0;\n requestCount = 0;\n lastResponseDate = 0;\n pageLoaded = function(force) {\n var diff, endTime, timeoutValue;\n if (force == null) {\n force = false;\n }\n if (startLoadTime) {\n timeoutValue = 0;\n if (!force) {\n endTime = new Date().getTime();\n diff = endTime - startLoadTime;\n if (diff < config.minTime) {\n timeoutValue = config.minTime - diff;\n }\n }\n timeout(timeoutValue, function() {\n $rootscope.$broadcast(\"loader:end\");\n open = false;\n return window.prerenderReady = true;\n });\n }\n startLoadTime = 0;\n requestCount = 0;\n return lastResponseDate = 0;\n };\n autoClose = function() {\n var intervalAuto;\n return intervalAuto = setInterval((function() {\n if (lastResponseDate && requestCount === 0) {\n pageLoaded();\n return clearInterval(intervalAuto);\n }\n }), 50);\n };\n start = function() {\n startLoadTime = new Date().getTime();\n $rootscope.$broadcast(\"loader:start\");\n return open = true;\n };\n return {\n pageLoaded: pageLoaded,\n start: function(auto) {\n if (auto == null) {\n auto = false;\n }\n if (!open) {\n start();\n if (auto) {\n return autoClose();\n }\n }\n },\n onStart: function(fn) {\n return $rootscope.$on(\"loader:start\", fn);\n },\n onEnd: function(fn) {\n return $rootscope.$on(\"loader:end\", fn);\n },\n logRequest: function() {\n return requestCount++;\n },\n logResponse: function() {\n requestCount--;\n return lastResponseDate = new Date().getTime();\n }\n };\n };\n\n Loader.$inject = [\"$rootScope\"];\n\n module.factory(\"tgLoader\", Loader);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/lightboxes.coffee\n */\n\n(function() {\n var LoadingDirective, TgLoadingService, module,\n slice = [].slice;\n\n module = angular.module(\"taigaCommon\");\n\n TgLoadingService = function($compile) {\n var spinner;\n spinner = \"loading...\";\n return function() {\n var service;\n service = {\n settings: {\n target: null,\n scope: null,\n classes: [],\n timeout: 0,\n template: null\n },\n target: function(target) {\n service.settings.target = target;\n return service;\n },\n scope: function(scope) {\n service.settings.scope = scope;\n return service;\n },\n template: function(template) {\n service.settings.template = template;\n return service;\n },\n removeClasses: function() {\n var classess;\n classess = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n service.settings.classes = classess;\n return service;\n },\n timeout: function(timeout) {\n service.settings.timeout = timeout;\n return service;\n },\n start: function() {\n var target, timeoutId;\n target = service.settings.target;\n service.settings.classes.map(function(className) {\n return target.removeClass(className);\n });\n if (!target.hasClass('loading') && !service.settings.template) {\n service.settings.template = target.html();\n }\n timeoutId = setTimeout((function() {\n if (!target.hasClass('loading')) {\n target.addClass('loading');\n return target.html(spinner);\n }\n }), service.settings.timeout);\n service.settings.timeoutId = timeoutId;\n return service;\n },\n finish: function() {\n var removeClasses, target, timeoutId;\n target = service.settings.target;\n timeoutId = service.settings.timeoutId;\n if (timeoutId) {\n clearTimeout(timeoutId);\n removeClasses = service.settings.classes;\n removeClasses.map(function(className) {\n return service.settings.target.addClass(className);\n });\n target.html(service.settings.template);\n target.removeClass('loading');\n if (service.settings.scope) {\n $compile(target.contents())(service.settings.scope);\n }\n }\n return service;\n }\n };\n return service;\n };\n };\n\n TgLoadingService.$inject = [\"$compile\"];\n\n module.factory(\"$tgLoading\", TgLoadingService);\n\n LoadingDirective = function($loading) {\n var link;\n link = function($scope, $el, attr) {\n var currentLoading, template;\n currentLoading = null;\n template = $el.html();\n return $scope.$watch(attr.tgLoading, (function(_this) {\n return function(showLoading) {\n if (showLoading) {\n return currentLoading = $loading().target($el).timeout(100).template(template).scope($scope).start();\n } else if (currentLoading) {\n return currentLoading.finish();\n }\n };\n })(this));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLoading\", [\"$tgLoading\", LoadingDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/popovers.coffee\n */\n\n(function() {\n var RelatedTaskStatusDirective, UsStatusDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n UsStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a US and a popover to change it.\n - tg-us-status: The user story\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-us-status=\"us\" on-update=\"ctrl.loadSprintState()\")\n a.us-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'usStatusById' and 'project'.\n */\n var link, template;\n template = $template.get(\"common/popover/popover-us-status.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render, us;\n $ctrl = $el.controller();\n render = function(us) {\n var usStatusById, usStatusDom, usStatusDomParent;\n usStatusDomParent = $el.find(\".us-status\");\n usStatusDom = $el.find(\".us-status .us-status-bind\");\n usStatusById = $scope.usStatusById;\n if (usStatusById[us.status]) {\n usStatusDom.text(usStatusById[us.status].name);\n return usStatusDomParent.css(\"color\", usStatusById[us.status].color);\n }\n };\n $el.on(\"click\", \".us-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target, us;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgUsStatus);\n us.status = target.data(\"status-id\");\n render(us);\n $el.find(\".pop-status\").popover().close();\n return $scope.$apply(function() {\n return $repo.save(us).then(function() {\n return $scope.$eval($attrs.onUpdate);\n });\n });\n }));\n $scope.$on(\"userstories:loaded\", function() {\n return render($scope.$eval($attrs.tgUsStatus));\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n us = $scope.$eval($attrs.tgUsStatus);\n render(us);\n return bindOnce($scope, \"project\", function(project) {\n var html;\n html = template({\n \"statuses\": project.us_statuses\n });\n $el.append(html);\n if ($scope.project.my_permissions.indexOf(\"modify_us\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsStatus\", [\"$tgRepo\", \"$tgTemplate\", UsStatusDirective]);\n\n RelatedTaskStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a related task and a popover to change it.\n - tg-related-task-status: The related task\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-related-task-status=\"task\" on-update=\"ctrl.loadSprintState()\")\n a.task-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'taskStatusById' and 'project'.\n */\n var link, selectionTemplate, updateTaskStatus;\n selectionTemplate = $template.get(\"common/popover/popover-related-task-status.html\", true);\n updateTaskStatus = function($el, task, taskStatusById) {\n var taskStatusDom, taskStatusDomParent;\n taskStatusDomParent = $el.find(\".us-status\");\n taskStatusDom = $el.find(\".task-status .task-status-bind\");\n if (taskStatusById[task.status]) {\n taskStatusDom.text(taskStatusById[task.status].name);\n return taskStatusDomParent.css('color', taskStatusById[task.status].color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task;\n $ctrl = $el.controller();\n task = $scope.$eval($attrs.tgRelatedTaskStatus);\n notAutoSave = $scope.$eval($attrs.notAutoSave);\n autoSave = !notAutoSave;\n $el.on(\"click\", \".task-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n task.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (autoSave) {\n return $scope.$apply(function() {\n return $repo.save(task).then(function() {\n $scope.$eval($attrs.onUpdate);\n return $scope.$emit(\"related-tasks:status-changed\");\n });\n });\n }\n }));\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.task_statuses\n }));\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (project.my_permissions.indexOf(\"modify_task\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskStatus\", [\"$tgRepo\", \"$tgTemplate\", RelatedTaskStatusDirective]);\n\n $.fn.popover = function() {\n var $el, close, closeAll, closePopover, isVisible, open;\n $el = this;\n isVisible = (function(_this) {\n return function() {\n var docViewBottom, docViewLeft, docViewRight, docViewTop, docViewWidth, elemBottom, elemLeft, elemRight, elemTop, elemWidth;\n $el.css({\n \"display\": \"block\",\n \"visibility\": \"hidden\"\n });\n docViewTop = $(window).scrollTop();\n docViewBottom = docViewTop + $(window).height();\n docViewWidth = $(window).width();\n docViewRight = docViewWidth;\n docViewLeft = 0;\n elemTop = $el.offset().top;\n elemBottom = elemTop + $el.height();\n elemWidth = $el.width();\n elemLeft = $el.offset().left;\n elemRight = $el.offset().left + elemWidth;\n $el.css({\n \"display\": \"none\",\n \"visibility\": \"visible\"\n });\n return (elemBottom <= docViewBottom) && (elemTop >= docViewTop) && (elemLeft >= docViewLeft) && (elemRight <= docViewRight);\n };\n })(this);\n closePopover = (function(_this) {\n return function(onClose) {\n if (onClose) {\n onClose.call($el);\n }\n $el.fadeOut(function() {\n return $el.removeClass(\"active\").removeClass(\"fix\");\n });\n return $el.off(\"popup:close\");\n };\n })(this);\n closeAll = (function(_this) {\n return function() {\n return $(\".popover.active\").each(function() {\n return $(this).trigger(\"popup:close\");\n });\n };\n })(this);\n open = (function(_this) {\n return function(onClose) {\n if ($el.hasClass(\"active\")) {\n return close();\n } else {\n closeAll();\n if (!isVisible()) {\n $el.addClass(\"fix\");\n }\n $el.fadeIn(function() {\n $el.addClass(\"active\");\n $(document.body).off(\"popover\");\n return $(document.body).one(\"click.popover\", function() {\n return closeAll();\n });\n });\n return $el.on(\"popup:close\", function(e) {\n return closePopover(onClose);\n });\n }\n };\n })(this);\n close = (function(_this) {\n return function() {\n return $el.trigger(\"popup:close\");\n };\n })(this);\n return {\n open: open,\n close: close,\n closeAll: closeAll\n };\n };\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/raven-logger.coffee\n */\n\n(function() {\n var ExceptionHandlerFactory, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n ExceptionHandlerFactory = function($log, config) {\n var ravenConfig;\n this.config = config;\n ravenConfig = this.config.get(\"ravenConfig\", null);\n if (ravenConfig) {\n $log.debug(\"Using the RavenJS exception handler.\");\n Raven.config(ravenConfig).install();\n return function(exception, cause) {\n $log.error.apply($log, arguments);\n return Raven.captureException(exception);\n };\n } else {\n $log.debug(\"Using the default logging exception handler.\");\n return function(exception, cause) {\n return $log.error.apply($log, arguments);\n };\n }\n };\n\n module.factory(\"$exceptionHandler\", [\"$log\", \"$tgConfig\", ExceptionHandlerFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/tags.coffee\n */\n\n(function() {\n var ColorizeTagsDirective, LbTagLineDirective, TagLineDirective, TagsDirective, bindOnce, module, taiga, trim,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n TagsDirective = function() {\n var formatter, link, parser;\n formatter = function(v) {\n if (_.isArray(v)) {\n return v.join(\", \");\n }\n return \"\";\n };\n parser = function(v) {\n var result;\n if (!v) {\n return [];\n }\n result = _(v.split(\",\")).map(function(x) {\n return _.trim(x);\n });\n return result.value();\n };\n link = function($scope, $el, $attrs, $ctrl) {\n $ctrl.$formatters.push(formatter);\n $ctrl.$parsers.push(parser);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n require: \"ngModel\",\n link: link\n };\n };\n\n module.directive(\"tgTags\", TagsDirective);\n\n ColorizeTagsDirective = function() {\n var link, templates;\n templates = {\n backlog: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\"><%- tag.name %>\\n<% }) %>\"),\n kanban: _.template(\"<% _.each(tags, function(tag) { %>\\n
\\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\"),\n taskboard: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\")\n };\n link = function($scope, $el, $attrs, $ctrl) {\n var render;\n render = function(srcTags) {\n var html, tags, template;\n template = templates[$attrs.tgColorizeTagsType];\n srcTags.sort();\n tags = _.map(srcTags, function(tag) {\n var color;\n color = $scope.project.tags_colors[tag];\n return {\n name: tag,\n color: color\n };\n });\n html = template({\n tags: tags\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.tgColorizeTags, function(tags) {\n if (tags != null) {\n return render(tags);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgColorizeTags\", ColorizeTagsDirective);\n\n LbTagLineDirective = function($rs, $template, $compile) {\n var COMMA_KEY, ENTER_KEY, link, templateTags;\n ENTER_KEY = 13;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/lb-tag-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideSaveButton, renderTags, resetInput, saveInputTag, showSaveButton;\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n })\n };\n _.map(ctx.tags, (function(_this) {\n return function(tag) {\n if (tag.color) {\n return tag.style = \"border-left: 5px solid \" + tag.color;\n }\n };\n })(this));\n html = $compile(templateTags(ctx))($scope);\n return $el.find(\".tags-container\").html(html);\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n if (tags == null) {\n tags = [];\n }\n if (indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n return hideSaveButton();\n };\n deleteValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n tags = _.pull(tags, value);\n return $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n };\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n $el.on(\"keypress\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n event.preventDefault();\n return saveInputTag();\n } else if (String.fromCharCode(event.keyCode) === ',') {\n event.preventDefault();\n return saveInputTag();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".remove-tag\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project\", function(project) {\n var positioningFunction;\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(project.tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(tags) {\n var ref, tagsColors;\n tagsColors = ((ref = $scope.project) != null ? ref.tags_colors : void 0) || [];\n return renderTags(tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/lb-tag-line.html\"\n };\n };\n\n module.directive(\"tgLbTagLine\", [\"$tgResources\", \"$tgTemplate\", \"$compile\", LbTagLineDirective]);\n\n TagLineDirective = function($rootScope, $repo, $rs, $confirm, $qqueue, $template, $compile) {\n var COMMA_KEY, ENTER_KEY, ESC_KEY, link, templateTags;\n ENTER_KEY = 13;\n ESC_KEY = 27;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/tags-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideAddTagButton, hideAddTagButtonText, hideInput, hideSaveButton, isEditable, renderInReadModeOnly, renderTags, resetInput, saveInputTag, showAddTagButton, showAddTagButtonText, showInput, showSaveButton;\n isEditable = function() {\n if ($attrs.requiredPerm != null) {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n }\n return true;\n };\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n }),\n isEditable: isEditable()\n };\n html = $compile(templateTags(ctx))($scope);\n return $el.find(\"div.tags-container\").html(html);\n };\n renderInReadModeOnly = function() {\n $el.find(\".add-tag\").remove();\n $el.find(\"input\").remove();\n return $el.find(\".save\").remove();\n };\n showAddTagButton = function() {\n return $el.find(\".add-tag\").removeClass(\"hidden\");\n };\n hideAddTagButton = function() {\n return $el.find(\".add-tag\").addClass(\"hidden\");\n };\n showAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").removeClass(\"hidden\");\n };\n hideAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").addClass(\"hidden\");\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n showInput = function() {\n return $el.find(\"input\").removeClass(\"hidden\").focus();\n };\n hideInput = function() {\n return $el.find(\"input\").addClass(\"hidden\").blur();\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n if (tags == null) {\n tags = [];\n }\n if (indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"object:updated\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n hideSaveButton();\n return $repo.save(model).then(onSuccess, onError);\n });\n deleteValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n tags = _.pull(tags, value);\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"object:updated\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n return $repo.save(model).then(onSuccess, onError);\n });\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n $el.on(\"keypress\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n return saveInputTag();\n } else if (String.fromCharCode(event.keyCode) === ',') {\n event.preventDefault();\n return saveInputTag();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === ESC_KEY) {\n resetInput();\n hideInput();\n hideSaveButton();\n return showAddTagButton();\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".add-tag\", function(event) {\n event.preventDefault();\n hideAddTagButton();\n return showInput();\n });\n $el.on(\"click\", \".remove-tag\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project.tags_colors\", function(tags_colors) {\n var positioningFunction;\n if (!isEditable()) {\n renderInReadModeOnly();\n return;\n }\n showAddTagButton();\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(model) {\n var ref, ref1, tagsColors;\n if (!model) {\n return;\n }\n if ((ref = model.tags) != null ? ref.length : void 0) {\n hideAddTagButtonText();\n } else {\n showAddTagButtonText();\n }\n tagsColors = ((ref1 = $scope.project) != null ? ref1.tags_colors : void 0) || [];\n return renderTags(model.tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/tag-line.html\"\n };\n };\n\n module.directive(\"tgTagLine\", [\"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", TagLineDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/wisiwyg.coffee\n */\n\n(function() {\n var MarkitupDirective, bindOnce, module, taiga,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n MarkitupDirective = function($rootscope, $rs, $selectedText, $template, $compile, $translate) {\n var link, previewTemplate;\n previewTemplate = $template.get(\"common/wysiwyg/wysiwyg-markitup-preview.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addLine, cancelablePromise, closePreviewMode, element, markdownTitle, prepareUrlFormatting, preview, previewDomNode, previewInProgress, renderMarkItUp, setCaretPosition, unbind, urlFormatting;\n element = angular.element($el);\n previewDomNode = $(\"
\", {\n \"class\": \"preview\"\n });\n closePreviewMode = function() {\n element.parents(\".markdown\").find(\".preview\").remove();\n return element.parents(\".markItUp\").show();\n };\n $scope.$on(\"markdown-editor:submit\", function() {\n return closePreviewMode();\n });\n cancelablePromise = null;\n previewInProgress = false;\n preview = function() {\n var markItUpDomNode, markdownDomNode;\n if (previewInProgress) {\n return;\n }\n previewInProgress = true;\n markdownDomNode = element.parents(\".markdown\");\n markItUpDomNode = element.parents(\".markItUp\");\n return $rs.mdrender.render($scope.projectId, $model.$modelValue).then(function(data) {\n var html, markdown;\n html = previewTemplate({\n data: data.data\n });\n html = $compile(html)($scope);\n markdownDomNode.append(html);\n markItUpDomNode.hide();\n previewInProgress = false;\n markdown = element.closest(\".markdown\");\n return markdown.on(\"mouseup.preview\", \".preview\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.target);\n if (!target.is('a') && $selectedText.get().length) {\n return;\n }\n markdown.off(\".preview\");\n return closePreviewMode();\n });\n });\n };\n setCaretPosition = function(textarea, caretPosition) {\n var line, range, scrollRelation, totalLines;\n if (textarea.createTextRange) {\n range = textarea.createTextRange();\n range.move(\"character\", caretPosition);\n range.select();\n } else if (textarea.selectionStart) {\n textarea.focus();\n textarea.setSelectionRange(caretPosition, caretPosition);\n }\n totalLines = textarea.value.split(\"\\n\").length;\n line = textarea.value.slice(0, +(caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n scrollRelation = line / totalLines;\n return $el.scrollTop((scrollRelation * $el[0].scrollHeight) - ($el.height() / 2));\n };\n addLine = function(textarea, nline, replace) {\n var cursorPosition, j, key, len, line, lines;\n lines = textarea.value.split(\"\\n\");\n if (replace) {\n lines[nline] = replace + lines[nline];\n } else {\n lines[nline] = \"\";\n }\n cursorPosition = 0;\n for (key = j = 0, len = lines.length; j < len; key = ++j) {\n line = lines[key];\n cursorPosition += line.length + 1 || 1;\n if (key === nline) {\n break;\n }\n }\n textarea.value = lines.join(\"\\n\");\n if (replace) {\n return cursorPosition - lines[nline].length + replace.length - 1;\n } else {\n return cursorPosition;\n }\n };\n prepareUrlFormatting = function(markItUp) {\n var indices, regex, result;\n regex = /(<<<|>>>)/gi;\n result = 0;\n indices = [];\n while ((result = regex.exec(markItUp.textarea.value))) {\n indices.push(result.index);\n }\n return markItUp.donotparse = indices;\n };\n urlFormatting = function(markItUp) {\n var endIndex, ref, ref1, regex, result, startIndex, url, value;\n regex = /<<>>/gi;\n endIndex = 0;\n while (true) {\n result = regex.exec(markItUp.textarea.value);\n if (!result) {\n break;\n }\n if (ref1 = result.index, indexOf.call(markItUp.donotparse, ref1) < 0) {\n endIndex = result.index;\n break;\n }\n }\n value = markItUp.textarea.value;\n url = value.substring(startIndex, endIndex).replace('<<<', '').replace('>>>', '');\n url = url.replace('(', '%28').replace(')', '%29');\n url = url.replace('[', '%5B').replace(']', '%5D');\n value = value.substring(0, startIndex) + url + value.substring(endIndex + 3, value.length);\n markItUp.textarea.value = value;\n return markItUp.donotparse = void 0;\n };\n markdownTitle = function(markItUp, char) {\n var heading, i, j, n, ref;\n heading = \"\";\n n = $.trim(markItUp.selection || markItUp.placeHolder).length;\n for (i = j = 0, ref = n - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {\n heading += char;\n }\n return \"\\n\" + heading + \"\\n\";\n };\n renderMarkItUp = function() {\n var markdownSettings;\n markdownSettings = {\n nameSpace: \"markdown\",\n onShiftEnter: {\n keepDefault: false,\n openWith: \"\\n\\n\"\n },\n onEnter: {\n keepDefault: false,\n replaceWith: function() {\n if (!$('.textcomplete-dropdown').is(':visible')) {\n return \"\\n\";\n }\n },\n afterInsert: function(data) {\n var cursorLine, emptyListItem, lastLine, lines, markdownCaretPositon, match, newLineContent, nline, replace;\n lines = data.textarea.value.split(\"\\n\");\n if (data.caretPosition > 0) {\n cursorLine = data.textarea.value.slice(0, +(data.caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n } else {\n cursorLine = 1;\n }\n newLineContent = data.textarea.value.slice(data.caretPosition).split(\"\\n\")[0];\n lastLine = lines[cursorLine - 1];\n match = lastLine.match(/^(\\s*- ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)\\-\\s$/);\n if (emptyListItem) {\n nline = cursorLine - 1;\n replace = null;\n } else {\n nline = cursorLine;\n replace = \"\" + match[1];\n }\n markdownCaretPositon = addLine(data.textarea, nline, replace);\n }\n match = lastLine.match(/^(\\s*\\* ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*\\* )$/);\n if (emptyListItem) {\n nline = cursorLine - 1;\n replace = null;\n } else {\n nline = cursorLine;\n replace = \"\" + match[1];\n }\n markdownCaretPositon = addLine(data.textarea, nline, replace);\n }\n match = lastLine.match(/^(\\s*)(\\d+)\\.\\s/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)(\\d+)\\.\\s$/);\n if (emptyListItem) {\n nline = cursorLine - 1;\n replace = null;\n } else {\n nline = cursorLine;\n replace = (match[1] + (parseInt(match[2], 10) + 1)) + \". \";\n }\n markdownCaretPositon = addLine(data.textarea, nline, replace);\n }\n if (markdownCaretPositon) {\n return setCaretPosition(data.textarea, markdownCaretPositon);\n }\n }\n },\n markupSet: [\n {\n name: $translate.instant(\"COMMON.WYSIWYG.H1_BUTTON\"),\n key: \"1\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.H1_SAMPLE_TEXT\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"=\");\n }\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.H2_BUTTON\"),\n key: \"2\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.H2_SAMPLE_TEXT\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"-\");\n }\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.H3_BUTTON\"),\n key: \"3\",\n openWith: \"### \",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.H3_SAMPLE_TEXT\")\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.BOLD_BUTTON\"),\n key: \"B\",\n openWith: \"**\",\n closeWith: \"**\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.BOLD_BUTTON_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.ITALIC_SAMPLE_TEXT\"),\n key: \"I\",\n openWith: \"_\",\n closeWith: \"_\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.ITALIC_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.STRIKE_BUTTON\"),\n key: \"S\",\n openWith: \"~~\",\n closeWith: \"~~\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.STRIKE_SAMPLE_TEXT\")\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.BULLETED_LIST_BUTTON\"),\n openWith: \"- \",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.BULLETED_LIST_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.NUMERIC_LIST_BUTTON\"),\n openWith: function(markItUp) {\n return markItUp.line + \". \";\n },\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.NUMERIC_LIST_SAMPLE_TEXT\")\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.PICTURE_BUTTON\"),\n key: \"P\",\n openWith: \"![\",\n closeWith: '](<<<[![Url:!:http://]!]>>> \"[![Title]!]\")',\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.PICTURE_SAMPLE_TEXT\"),\n beforeInsert: function(markItUp) {\n return prepareUrlFormatting(markItUp);\n },\n afterInsert: function(markItUp) {\n return urlFormatting(markItUp);\n }\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.LINK_BUTTON\"),\n key: \"L\",\n openWith: \"[\",\n closeWith: '](<<<[![Url:!:http://]!]>>> \"[![Title]!]\")',\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.LINK_SAMPLE_TEXT\"),\n beforeInsert: function(markItUp) {\n return prepareUrlFormatting(markItUp);\n },\n afterInsert: function(markItUp) {\n return urlFormatting(markItUp);\n }\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.QUOTE_BLOCK_BUTTON\"),\n openWith: \"> \",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.QUOTE_BLOCK_SAMPLE_TEXT\")\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.CODE_BLOCK_BUTTON\"),\n openWith: \"```\\n\",\n placeHolder: $translate.instant(\"COMMON.WYSIWYG.CODE_BLOCK_SAMPLE_TEXT\"),\n closeWith: \"\\n```\"\n }, {\n separator: \"---------------\"\n }, {\n name: $translate.instant(\"COMMON.WYSIWYG.PREVIEW_BUTTON\"),\n call: preview,\n className: \"preview-icon\"\n }\n ],\n afterInsert: function(event) {\n var target;\n target = angular.element(event.textarea);\n return $model.$setViewValue(target.val());\n }\n };\n return element.markItUpRemove().markItUp(markdownSettings).textcomplete([\n {\n cache: true,\n match: /(^|\\s)#([a-z0-9]+)$/i,\n search: function(term, callback) {\n var filter, searchProps, searchTypes;\n term = taiga.slugify(term);\n searchTypes = ['issues', 'tasks', 'userstories'];\n searchProps = ['ref', 'subject'];\n filter = (function(_this) {\n return function(item) {\n var j, len, prop;\n for (j = 0, len = searchProps.length; j < len; j++) {\n prop = searchProps[j];\n if (taiga.slugify(item[prop]).indexOf(term) >= 0) {\n return true;\n }\n }\n return false;\n };\n })(this);\n if (cancelablePromise) {\n cancelablePromise.abort();\n }\n cancelablePromise = $rs.search[\"do\"]($scope.projectId, term);\n cancelablePromise.then((function(_this) {\n return function(res) {\n var j, len, results, type;\n if (res.count < 1 || res.count === res.wikipages.length) {\n return callback([]);\n } else {\n results = [];\n for (j = 0, len = searchTypes.length; j < len; j++) {\n type = searchTypes[j];\n if (res[type] && res[type].length > 0) {\n results.push(callback(res[type].filter(filter), true));\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n };\n })(this));\n return callback([]);\n },\n replace: function(res) {\n return \"$1\\#\" + res.ref + \" \";\n },\n template: function(res, term) {\n return \"\\#\" + res.ref + \" - \" + res.subject;\n }\n }, {\n cache: true,\n match: /(^|\\s)@([a-z0-9\\-\\._]{2,})$/i,\n search: function(term, callback) {\n var searchProps, username;\n username = taiga.slugify(term);\n searchProps = ['username', 'full_name', 'full_name_display'];\n if ($scope.project.members.length < 1) {\n return callback([]);\n } else {\n return callback($scope.project.members.filter((function(_this) {\n return function(user) {\n var j, len, prop;\n for (j = 0, len = searchProps.length; j < len; j++) {\n prop = searchProps[j];\n if (taiga.slugify(user[prop]).indexOf(username) >= 0) {\n return true;\n }\n }\n return false;\n };\n })(this)));\n }\n },\n replace: function(user) {\n return \"$1@\" + user.username + \" \";\n },\n template: function(user) {\n return user.username + \" - \" + user.full_name_display;\n }\n }, {\n cache: true,\n match: /(^|\\s)\\[\\[([a-z0-9\\-]+)$/i,\n search: function(term, callback) {\n term = taiga.slugify(term);\n return $rs.search[\"do\"]($scope.projectId, term).then((function(_this) {\n return function(res) {\n if (res.count < 1) {\n callback([]);\n }\n if (res.count < 1 || !res.wikipages || res.wikipages.length <= 0) {\n callback([]);\n } else {\n callback(res.wikipages.filter(function(page) {\n return taiga.slugify(page['slug']).indexOf(term) >= 0;\n }), true);\n }\n return callback([]);\n };\n })(this));\n },\n replace: function(res) {\n return \"$1[[\" + res.slug + \"]]\";\n },\n template: function(res, term) {\n return res.slug;\n }\n }\n ], {\n debounce: 200\n });\n };\n renderMarkItUp();\n unbind = $rootscope.$on(\"$translateChangeEnd\", renderMarkItUp);\n element.on(\"keypress\", function(event) {\n return $scope.$apply();\n });\n return $scope.$on(\"$destroy\", function() {\n $el.off();\n return unbind();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgMarkitup\", [\"$rootScope\", \"$tgResources\", \"$selectedText\", \"$tgTemplate\", \"$compile\", \"$translate\", MarkitupDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/main.coffee\n */\n\n(function() {\n var BacklogFiltersDirective, bindOnce, debounceLeading, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n debounceLeading = this.taiga.debounceLeading;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogFiltersDirective = function($q, $log, $location, $templates) {\n var link, template, templateSelected;\n template = $templates.get(\"backlog/filters.html\", true);\n templateSelected = $templates.get(\"backlog/filter-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, currentFiltersType, getFiltersType, initializeSelectedFilters, reloadUserstories, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection;\n currentFiltersType = '';\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\"h2.breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 a.subfilter span.title\").html(title);\n $el.find(\"h2 a.subfilter span.title\").prop(\"data-type\", type);\n return currentFiltersType = getFiltersType();\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\"h2.breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function() {\n var i, len, name, ref, val, values;\n showCategories();\n selectedFilters = [];\n ref = $scope.filters;\n for (name in ref) {\n values = ref[name];\n for (i = 0, len = values.length; i < len; i++) {\n val = values[i];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters();\n };\n renderSelectedFilters = function() {\n var html;\n _.map(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n return $el.find(\".filters-applied\").html(html);\n };\n renderFilters = function(filters) {\n var html;\n _.map(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n return $el.find(\".filter-list\").html(html);\n };\n getFiltersType = function() {\n return $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n };\n reloadUserstories = function() {\n currentFiltersType = getFiltersType();\n return $q.all([$ctrl.loadUserstories(), $ctrl.generateFilters()]).then(function() {\n var currentFilters;\n currentFilters = $scope.filters[currentFiltersType];\n return renderFilters(_.reject(currentFilters, \"selected\"));\n });\n };\n toggleFilterSelection = function(type, id) {\n var filter, filters;\n currentFiltersType = getFiltersType();\n filters = $scope.filters[type];\n filter = _.find(filters, {\n id: id\n });\n filter.selected = !filter.selected;\n if (filter.selected) {\n selectedFilters.push(filter);\n $scope.$apply(function() {\n return $ctrl.selectFilter(type, id);\n });\n } else {\n selectedFilters = _.reject(selectedFilters, function(selected) {\n return filter.type === selected.type && filter.id === selected.id;\n });\n $ctrl.unselectFilter(type, id);\n }\n renderSelectedFilters(selectedFilters);\n if (type === currentFiltersType) {\n renderFilters(_.reject(filters, \"selected\"));\n }\n return reloadUserstories();\n };\n selectQFilter = debounceLeading(100, function(value) {\n if (value === void 0) {\n return;\n }\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n } else {\n $ctrl.replaceFilter(\"q\", value);\n }\n return reloadUserstories();\n });\n $scope.$watch(\"filtersQ\", selectQFilter);\n $scope.$on(\"backlog:loaded\", function(ctx) {\n return initializeSelectedFilters();\n });\n $scope.$on(\"filters:update\", function(ctx) {\n return $ctrl.generateFilters().then(function() {\n var filters;\n filters = $scope.filters[currentFiltersType];\n if (currentFiltersType) {\n return renderFilters(_.reject(filters, \"selected\"));\n }\n });\n });\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data('type'));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories();\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n return $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.hasClass(\"active\")) {\n target.removeClass(\"active\");\n } else {\n target.addClass(\"active\");\n }\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogFilters\", [\"$q\", \"$log\", \"$tgLocation\", \"$tgTemplate\", BacklogFiltersDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/lightboxes.coffee\n */\n\n(function() {\n var CreateEditSprint, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaBacklog\");\n\n CreateEditSprint = function($repo, $confirm, $rs, $rootscope, lightboxService, $loading, $translate) {\n var link;\n link = function($scope, $el, attrs) {\n var createSprint, form, getLastSprint, hasErrors, remove, resetSprint, submit;\n hasErrors = false;\n createSprint = true;\n form = null;\n resetSprint = function() {\n if (form) {\n form.reset();\n }\n return $scope.sprint = {\n project: null,\n name: null,\n estimated_start: null,\n estimated_finish: null\n };\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, currentLoading, newSprint, prettyDate, promise, submitButton, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n submitButton = $el.find(\".submit-button\");\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n hasErrors = true;\n $el.find(\".last-sprint-name\").addClass(\"disappear\");\n return;\n }\n hasErrors = false;\n newSprint = angular.copy($scope.sprint);\n broadcastEvent = null;\n if (createSprint) {\n newSprint.estimated_start = moment(newSprint.estimated_start, prettyDate).format(\"YYYY-MM-DD\");\n newSprint.estimated_finish = moment(newSprint.estimated_finish, prettyDate).format(\"YYYY-MM-DD\");\n promise = $repo.create(\"milestones\", newSprint);\n broadcastEvent = \"sprintform:create:success\";\n } else {\n newSprint.setAttr(\"estimated_start\", moment(newSprint.estimated_start, prettyDate).format(\"YYYY-MM-DD\"));\n newSprint.setAttr(\"estimated_finish\", moment(newSprint.estimated_finish, prettyDate).format(\"YYYY-MM-DD\"));\n promise = $repo.save(newSprint);\n broadcastEvent = \"sprintform:edit:success\";\n }\n currentLoading = $loading().target(submitButton).start();\n promise.then(function(data) {\n currentLoading.finish();\n if (createSprint) {\n $scope.sprintsCounter += 1;\n }\n $rootscope.$broadcast(broadcastEvent, data);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"light-error\", data._error_message);\n } else if (data.__all__) {\n return $confirm.notify(\"light-error\", data.__all__[0]);\n }\n });\n };\n })(this));\n remove = function() {\n var message, title;\n title = $translate.instant(\"LIGHTBOX.DELETE_SPRINT.TITLE\");\n message = $scope.sprint.name;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSuccess;\n onSuccess = function() {\n askResponse.finish();\n $scope.milestonesCounter -= 1;\n lightboxService.close($el);\n return $rootscope.$broadcast(\"sprintform:remove:success\", $scope.sprint);\n };\n onError = function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove($scope.sprint).then(onSuccess, onError);\n };\n })(this));\n };\n getLastSprint = function() {\n var openSprints, sortedSprints;\n openSprints = _.filter($scope.sprints, function(sprint) {\n return !sprint.closed;\n });\n sortedSprints = _.sortBy(openSprints, function(sprint) {\n return moment(sprint.estimated_finish, 'YYYY-MM-DD').format('X');\n });\n return sortedSprints[sortedSprints.length - 1];\n };\n $scope.$on(\"sprintform:create\", function(event, projectId) {\n var estimatedFinish, estimatedStart, lastSprint, lastSprintNameDom, prettyDate, text;\n resetSprint();\n form = $el.find(\"form\").checksley();\n form.reset();\n createSprint = true;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n $scope.sprint.project = projectId;\n $scope.sprint.name = null;\n $scope.sprint.slug = null;\n lastSprint = getLastSprint();\n estimatedStart = moment();\n if (lastSprint) {\n estimatedStart = moment(lastSprint.estimated_finish);\n } else if ($scope.sprint.estimated_start) {\n estimatedStart = moment($scope.sprint.estimated_start);\n }\n $scope.sprint.estimated_start = estimatedStart.format(prettyDate);\n estimatedFinish = moment().add(2, \"weeks\");\n if (lastSprint) {\n estimatedFinish = moment(lastSprint.estimated_finish).add(2, \"weeks\");\n } else if ($scope.sprint.estimated_finish) {\n estimatedFinish = moment($scope.sprint.estimated_finish);\n }\n $scope.sprint.estimated_finish = estimatedFinish.format(prettyDate);\n lastSprintNameDom = $el.find(\".last-sprint-name\");\n if ((lastSprint != null ? lastSprint.name : void 0) != null) {\n text = $translate.instant(\"LIGHTBOX.ADD_EDIT_SPRINT.LAST_SPRINT_NAME\", {\n lastSprint: lastSprint.name\n });\n lastSprintNameDom.html(text);\n }\n $el.find(\".delete-sprint\").addClass(\"hidden\");\n text = $translate.instant(\"LIGHTBOX.ADD_EDIT_SPRINT.TITLE\");\n $el.find(\".title\").text(text);\n text = $translate.instant(\"COMMON.CREATE\");\n $el.find(\".button-green\").text(text);\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus();\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n });\n $scope.$on(\"sprintform:edit\", function(ctx, sprint) {\n var editSprint, prettyDate, save;\n resetSprint();\n createSprint = false;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n $scope.$apply(function() {\n $scope.sprint = sprint;\n $scope.sprint.estimated_start = moment($scope.sprint.estimated_start).format(prettyDate);\n return $scope.sprint.estimated_finish = moment($scope.sprint.estimated_finish).format(prettyDate);\n });\n $el.find(\".delete-sprint\").removeClass(\"hidden\");\n editSprint = $translate.instant(\"BACKLOG.EDIT_SPRINT\");\n $el.find(\".title\").text(editSprint);\n save = $translate.instant(\"COMMON.SAVE\");\n $el.find(\".button-green\").text(save);\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus().select();\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n });\n $el.on(\"keyup\", \".sprint-name\", function(event) {\n if ($el.find(\".sprint-name\").val().length > 0 || hasErrors) {\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n } else {\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n }\n });\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".delete-sprint\", function(event) {\n event.preventDefault();\n return remove();\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return resetSprint();\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateEditSprint\", [\"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$translate\", CreateEditSprint]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/main.coffee\n */\n\n(function() {\n var BacklogController, BacklogDirective, BurndownBacklogGraphDirective, TgBacklogProgressBarDirective, ToggleBurndownVisibility, UsPointsDirective, UsRolePointsSelectorDirective, bindMethods, bindOnce, generateHash, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n generateHash = this.taiga.generateHash;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogController = (function(superClass) {\n extend(BacklogController, superClass);\n\n BacklogController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\", \"$tgLoading\", \"tgResources\"];\n\n function BacklogController(scope1, rootscope, repo, confirm, rs, params1, q, location, appMetaService, navUrls, events, analytics, translate, loading, rs2) {\n var promise;\n this.scope = scope1;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params1;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n this.loading = loading;\n this.rs2 = rs2;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"BACKLOG.SECTION_NAME\");\n this.showTags = false;\n this.activeFilters = false;\n this.scope.showGraphPlaceholder = null;\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"BACKLOG.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"BACKLOG.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n _this.appMetaService.setAll(title, description);\n if (_this.rs.userstories.getShowTags(_this.scope.projectId)) {\n _this.showTags = true;\n return _this.scope.$broadcast(\"showTags\", _this.showTags);\n }\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n BacklogController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:create:success\", (function(_this) {\n return function() {\n _this.loadSprints();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"sprint\", \"create\", \"create sprint on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n _this.rootscope.$broadcast(\"filters:update\");\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:edit:success\", (function(_this) {\n return function() {\n return _this.loadProjectStats();\n };\n })(this));\n this.scope.$on(\"sprintform:remove:success\", (function(_this) {\n return function(event, sprint) {\n _this.loadSprints();\n _this.loadProjectStats();\n _this.loadUserstories();\n if (sprint.closed) {\n _this.loadClosedSprints();\n }\n return _this.rootscope.$broadcast(\"filters:update\");\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.rootscope.$broadcast(\"filters:update\");\n };\n })(this));\n this.scope.$on(\"sprint:us:move\", this.moveUs);\n this.scope.$on(\"sprint:us:moved\", this.loadSprints);\n this.scope.$on(\"sprint:us:moved\", this.loadProjectStats);\n this.scope.$on(\"backlog:load-closed-sprints\", this.loadClosedSprints);\n return this.scope.$on(\"backlog:unload-closed-sprints\", this.unloadClosedSprints);\n };\n\n BacklogController.prototype.initializeSubscription = function() {\n var routingKey1, routingKey2;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.loadUserstories();\n return _this.loadSprints();\n };\n })(this));\n routingKey2 = \"changes.project.\" + this.scope.projectId + \".milestones\";\n return this.events.subscribe(this.scope, routingKey2, (function(_this) {\n return function(message) {\n return _this.loadSprints();\n };\n })(this));\n };\n\n BacklogController.prototype.toggleShowTags = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n _this.showTags = !_this.showTags;\n return _this.rs.userstories.storeShowTags(_this.scope.projectId, _this.showTags);\n };\n })(this));\n };\n\n BacklogController.prototype.toggleActiveFilters = function() {\n return this.activeFilters = !this.activeFilters;\n };\n\n BacklogController.prototype.loadProjectStats = function() {\n return this.rs.projects.stats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n var totalPoints;\n _this.scope.stats = stats;\n totalPoints = stats.total_points ? stats.total_points : stats.defined_points;\n if (totalPoints) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.closed_points / totalPoints);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n _this.scope.showGraphPlaceholder = !((stats.total_points != null) && (stats.total_milestones != null));\n return stats;\n };\n })(this));\n };\n\n BacklogController.prototype.unloadClosedSprints = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n _this.scope.closedSprints = [];\n return _this.rootscope.$broadcast(\"closed-sprints:reloaded\", []);\n };\n })(this));\n };\n\n BacklogController.prototype.loadClosedSprints = function() {\n var params;\n params = {\n closed: true\n };\n return this.rs.sprints.list(this.scope.projectId, params).then((function(_this) {\n return function(result) {\n var j, len, sprint, sprints;\n sprints = result.milestones;\n _this.scope.totalClosedMilestones = result.closed;\n for (j = 0, len = sprints.length; j < len; j++) {\n sprint = sprints[j];\n sprint.user_stories = _.sortBy(sprint.user_stories, \"sprint_order\");\n }\n _this.scope.closedSprints = sprints;\n _this.scope.closedSprintsById = groupBy(sprints, function(x) {\n return x.id;\n });\n _this.rootscope.$broadcast(\"closed-sprints:reloaded\", sprints);\n return sprints;\n };\n })(this));\n };\n\n BacklogController.prototype.loadSprints = function() {\n var params;\n params = {\n closed: false\n };\n return this.rs.sprints.list(this.scope.projectId, params).then((function(_this) {\n return function(result) {\n var j, len, sprint, sprints;\n sprints = result.milestones;\n _this.scope.totalMilestones = sprints;\n _this.scope.totalClosedMilestones = result.closed;\n _this.scope.totalOpenMilestones = result.open;\n _this.scope.totalMilestones = _this.scope.totalOpenMilestones + _this.scope.totalClosedMilestones;\n for (j = 0, len = sprints.length; j < len; j++) {\n sprint = sprints[j];\n sprint.user_stories = _.sortBy(sprint.user_stories, \"sprint_order\");\n }\n _this.scope.sprints = sprints;\n _this.scope.openSprints = _.filter(sprints, function(sprint) {\n return !sprint.closed;\n }).reverse();\n if (!_this.scope.closedSprints) {\n _this.scope.closedSprints = [];\n }\n _this.scope.sprintsCounter = sprints.length;\n _this.scope.sprintsById = groupBy(sprints, function(x) {\n return x.id;\n });\n _this.rootscope.$broadcast(\"sprints:loaded\", sprints);\n _this.scope.currentSprint = _this.findCurrentSprint();\n return sprints;\n };\n })(this));\n };\n\n BacklogController.prototype.restoreFilters = function() {\n var selectedStatuses, selectedTags;\n selectedTags = this.scope.oldSelectedTags;\n selectedStatuses = this.scope.oldSelectedStatuses;\n if (!selectedStatuses && !selectedStatuses) {\n return;\n }\n this.scope.filtersQ = this.scope.filtersQOld;\n this.replaceFilter(\"q\", this.scope.filtersQ);\n _.each([selectedTags, selectedStatuses], (function(_this) {\n return function(filterGrp) {\n return _.each(filterGrp, function(item) {\n var filter, filters;\n filters = _this.scope.filters[item.type];\n filter = _.find(filters, {\n id: item.id\n });\n filter.selected = true;\n return _this.selectFilter(item.type, item.id);\n });\n };\n })(this));\n return this.loadUserstories();\n };\n\n BacklogController.prototype.resetFilters = function() {\n var selectedStatuses, selectedTags;\n selectedTags = _.filter(this.scope.filters.tags, \"selected\");\n selectedStatuses = _.filter(this.scope.filters.status, \"selected\");\n this.scope.oldSelectedTags = selectedTags;\n this.scope.oldSelectedStatuses = selectedStatuses;\n this.scope.filtersQOld = this.scope.filtersQ;\n this.scope.filtersQ = void 0;\n this.replaceFilter(\"q\", this.scope.filtersQ);\n _.each([selectedTags, selectedStatuses], (function(_this) {\n return function(filterGrp) {\n return _.each(filterGrp, function(item) {\n var filter, filters;\n filters = _this.scope.filters[item.type];\n filter = _.find(filters, {\n id: item.id\n });\n filter.selected = false;\n return _this.unselectFilter(item.type, item.id);\n });\n };\n })(this));\n return this.loadUserstories();\n };\n\n BacklogController.prototype.loadUserstories = function() {\n var promise;\n this.scope.httpParams = this.getUrlFilters();\n this.rs.userstories.storeQueryParams(this.scope.projectId, this.scope.httpParams);\n promise = this.rs.userstories.listUnassigned(this.scope.projectId, this.scope.httpParams);\n return promise.then((function(_this) {\n return function(userstories) {\n _this.scope.userstories = _.sortBy(userstories, \"backlog_order\");\n _this.setSearchDataFilters();\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\");\n });\n return userstories;\n };\n })(this));\n };\n\n BacklogController.prototype.loadBacklog = function() {\n return this.q.all([this.loadProjectStats(), this.loadSprints(), this.loadUserstories()]);\n };\n\n BacklogController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_backlog_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.closedMilestones = !!project.total_closed_milestones;\n _this.scope.$emit('project:loaded', project);\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"id\");\n return project;\n };\n })(this));\n };\n\n BacklogController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.initializeSubscription();\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadBacklog();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.generateFilters();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.scope.$emit(\"backlog:loaded\");\n };\n })(this));\n };\n\n BacklogController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"backlog_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n BacklogController.prototype.resortUserStories = function(uses, field) {\n var index, item, items, j, len;\n if (field == null) {\n field = \"backlog_order\";\n }\n items = [];\n for (index = j = 0, len = uses.length; j < len; index = ++j) {\n item = uses[index];\n item[field] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n BacklogController.prototype.moveUs = function(ctx, usList, newUsIndex, newSprintId) {\n var data, items, j, l, len, len1, len2, m, movedFromClosedSprint, movedToClosedSprint, newSprint, oldSprintId, project, promise, promises, sprint, us, userstories;\n oldSprintId = usList[0].milestone;\n project = usList[0].project;\n movedFromClosedSprint = false;\n movedToClosedSprint = false;\n sprint = this.scope.sprintsById[oldSprintId];\n if (!sprint && this.scope.closedSprintsById) {\n sprint = this.scope.closedSprintsById[oldSprintId];\n if (sprint) {\n movedFromClosedSprint = true;\n }\n }\n newSprint = this.scope.sprintsById[newSprintId];\n if (!newSprint && newSprintId) {\n newSprint = this.scope.closedSprintsById[newSprintId];\n if (newSprint) {\n movedToClosedSprint = true;\n }\n }\n if (newSprintId === oldSprintId) {\n items = null;\n userstories = null;\n if (newSprintId === null) {\n userstories = this.scope.userstories;\n } else {\n userstories = newSprint.user_stories;\n }\n this.scope.$apply(function() {\n var args, j, key, len, r, us;\n for (key = j = 0, len = usList.length; j < len; key = ++j) {\n us = usList[key];\n r = userstories.indexOf(us);\n userstories.splice(r, 1);\n }\n args = [newUsIndex, 0].concat(usList);\n return Array.prototype.splice.apply(userstories, args);\n });\n if (newSprintId === null) {\n items = this.resortUserStories(userstories, \"backlog_order\");\n data = this.prepareBulkUpdateData(items, \"backlog_order\");\n this.rs.userstories.bulkUpdateBacklogOrder(project, data).then((function(_this) {\n return function() {\n var j, len, results, us;\n results = [];\n for (j = 0, len = usList.length; j < len; j++) {\n us = usList[j];\n results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return results;\n };\n })(this));\n } else {\n items = this.resortUserStories(userstories, \"sprint_order\");\n data = this.prepareBulkUpdateData(items, \"sprint_order\");\n this.rs.userstories.bulkUpdateSprintOrder(project, data).then((function(_this) {\n return function() {\n var j, len, results, us;\n results = [];\n for (j = 0, len = usList.length; j < len; j++) {\n us = usList[j];\n results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return results;\n };\n })(this));\n }\n return promise;\n }\n if (newSprintId === null) {\n for (j = 0, len = usList.length; j < len; j++) {\n us = usList[j];\n us.milestone = null;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, l, len1, r, results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(_this.scope.userstories, args);\n results = [];\n for (key = l = 0, len1 = usList.length; l < len1; key = ++l) {\n us = usList[key];\n r = sprint.user_stories.indexOf(us);\n results.push(sprint.user_stories.splice(r, 1));\n }\n return results;\n };\n })(this));\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n items = _this.resortUserStories(_this.scope.userstories, \"backlog_order\");\n data = _this.prepareBulkUpdateData(items, \"backlog_order\");\n return _this.rs.userstories.bulkUpdateBacklogOrder(us.project, data).then(function() {\n _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n if (movedFromClosedSprint) {\n return _this.rootscope.$broadcast(\"backlog:load-closed-sprints\");\n }\n });\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n }\n if (oldSprintId === null) {\n for (l = 0, len1 = usList.length; l < len1; l++) {\n us = usList[l];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, len2, m, r, results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n results = [];\n for (key = m = 0, len2 = usList.length; m < len2; key = ++m) {\n us = usList[key];\n r = _this.scope.userstories.indexOf(us);\n results.push(_this.scope.userstories.splice(r, 1));\n }\n return results;\n };\n })(this));\n } else {\n for (m = 0, len2 = usList.length; m < len2; m++) {\n us = usList[m];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, len3, n, r, results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n results = [];\n for (n = 0, len3 = usList.length; n < len3; n++) {\n us = usList[n];\n r = sprint.user_stories.indexOf(us);\n results.push(sprint.user_stories.splice(r, 1));\n }\n return results;\n };\n })(this));\n }\n promises = _.map(usList, (function(_this) {\n return function(us) {\n return _this.repo.save(us);\n };\n })(this));\n promise = this.q.all(promises).then((function(_this) {\n return function() {\n items = _this.resortUserStories(newSprint.user_stories, \"sprint_order\");\n data = _this.prepareBulkUpdateData(items, \"sprint_order\");\n _this.rs.userstories.bulkUpdateSprintOrder(project, data).then(function(result) {\n return _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n });\n _this.rs.userstories.bulkUpdateBacklogOrder(project, data).then(function() {\n var len3, n, results;\n results = [];\n for (n = 0, len3 = usList.length; n < len3; n++) {\n us = usList[n];\n results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return results;\n });\n if (movedToClosedSprint || movedFromClosedSprint) {\n return _this.scope.$broadcast(\"backlog:load-closed-sprints\");\n }\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n };\n\n BacklogController.prototype.isFilterSelected = function(type, id) {\n if ((this.searchdata[type] != null) && this.searchdata[type][id]) {\n return true;\n }\n return false;\n };\n\n BacklogController.prototype.setSearchDataFilters = function() {\n var name, results, urlfilters, val, value;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = this.scope.filtersQ || urlfilters.q;\n }\n this.searchdata = {};\n results = [];\n for (name in urlfilters) {\n value = urlfilters[name];\n if (this.searchdata[name] == null) {\n this.searchdata[name] = {};\n }\n results.push((function() {\n var j, len, ref1, results1;\n ref1 = taiga.toString(value).split(\",\");\n results1 = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n val = ref1[j];\n results1.push(this.searchdata[name][val] = true);\n }\n return results1;\n }).call(this));\n }\n return results;\n };\n\n BacklogController.prototype.getUrlFilters = function() {\n return _.pick(this.location.search(), \"status\", \"tags\", \"q\");\n };\n\n BacklogController.prototype.generateFilters = function() {\n var loadFilters, urlfilters;\n urlfilters = this.getUrlFilters();\n this.scope.filters = {};\n loadFilters = {};\n loadFilters.project = this.scope.projectId;\n loadFilters.tags = urlfilters.tags;\n loadFilters.status = urlfilters.status;\n loadFilters.q = urlfilters.q;\n loadFilters.milestone = 'null';\n return this.rs.userstories.filtersData(loadFilters).then((function(_this) {\n return function(data) {\n var choicesFiltersFormat, selectedStatuses, selectedTags, tagsFilterFormat;\n choicesFiltersFormat = function(choices, type, byIdObject) {\n return _.map(choices, function(t) {\n t.type = type;\n return t;\n });\n };\n tagsFilterFormat = function(tags) {\n return _.map(tags, function(t) {\n t.id = t.name;\n t.type = 'tags';\n return t;\n });\n };\n _this.scope.filters.status = choicesFiltersFormat(data.statuses, \"status\", _this.scope.usStatusById);\n _this.scope.filters.tags = tagsFilterFormat(data.tags);\n selectedTags = _.filter(_this.scope.filters.tags, \"selected\");\n selectedTags = _.map(selectedTags, \"id\");\n selectedStatuses = _.filter(_this.scope.filters.status, \"selected\");\n selectedStatuses = _.map(selectedStatuses, \"id\");\n _this.markSelectedFilters(_this.scope.filters, urlfilters);\n return _this.rs.userstories.storeQueryParams(_this.scope.projectId, {\n \"status\": selectedStatuses,\n \"tags\": selectedTags,\n \"project\": _this.scope.projectId,\n \"milestone\": null\n });\n };\n })(this));\n };\n\n BacklogController.prototype.markSelectedFilters = function(filters, urlfilters) {\n var isSelected, j, key, len, name, obj, ref1, ref2, results, searchdata, val, value;\n searchdata = {};\n ref1 = _.omit(urlfilters, \"page\", \"orderBy\");\n for (name in ref1) {\n value = ref1[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n ref2 = (\"\" + value).split(\",\");\n for (j = 0, len = ref2.length; j < len; j++) {\n val = ref2[j];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n results = [];\n for (key in filters) {\n value = filters[key];\n results.push((function() {\n var l, len1, results1;\n results1 = [];\n for (l = 0, len1 = value.length; l < len1; l++) {\n obj = value[l];\n results1.push(obj.selected = isSelected(obj.type, obj.id) ? true : void 0);\n }\n return results1;\n })());\n }\n return results;\n };\n\n BacklogController.prototype.updateUserStoryStatus = function() {\n this.setSearchDataFilters();\n return this.generateFilters().then((function(_this) {\n return function() {\n _this.rootscope.$broadcast(\"filters:update\");\n return _this.loadProjectStats();\n };\n })(this));\n };\n\n BacklogController.prototype.editUserStory = function(projectId, ref, $event) {\n var currentLoading, target;\n target = $($event.target);\n currentLoading = this.loading().target(target).removeClasses(\"edit-story\").timeout(200).start();\n return this.rs.userstories.getByRef(projectId, ref).then((function(_this) {\n return function(us) {\n return _this.rs2.attachments.list(\"us\", us.id, projectId).then(function(attachments) {\n _this.rootscope.$broadcast(\"usform:edit\", us, attachments.toJS());\n return currentLoading.finish();\n });\n };\n })(this));\n };\n\n BacklogController.prototype.deleteUserStory = function(us) {\n var message, title;\n title = this.translate.instant(\"US.TITLE_DELETE_ACTION\");\n message = us.subject;\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var promise;\n _this.scope.userstories = _.without(_this.scope.userstories, us);\n promise = _this.repo.remove(us);\n promise.then(function() {\n askResponse.finish();\n return _this.loadBacklog();\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return _this.confirm.notify(\"error\");\n });\n };\n })(this));\n };\n\n BacklogController.prototype.addNewUs = function(type) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, this.scope.project.default_us_status, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, this.scope.project.default_us_status);\n }\n };\n\n BacklogController.prototype.addNewSprint = function() {\n return this.rootscope.$broadcast(\"sprintform:create\", this.scope.projectId);\n };\n\n BacklogController.prototype.findCurrentSprint = function() {\n var currentDate;\n currentDate = new Date().getTime();\n return _.find(this.scope.sprints, function(sprint) {\n var end, start;\n start = moment(sprint.estimated_start, 'YYYY-MM-DD').format('x');\n end = moment(sprint.estimated_finish, 'YYYY-MM-DD').format('x');\n return currentDate >= start && currentDate <= end;\n });\n };\n\n return BacklogController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BacklogController\", BacklogController);\n\n BacklogDirective = function($repo, $rootscope, $translate) {\n var doomLineTemplate, link, linkDoomLine, linkFilters, linkToolbar, showHideFilter, showHideTags;\n doomLineTemplate = _.template(\"
<%- text %>
\");\n linkDoomLine = function($scope, $el, $attrs, $ctrl) {\n var addDoomLineDom, getUsItems, reloadDoomLine, removeDoomlineDom;\n reloadDoomLine = function() {\n var current_sum, domElement, i, j, len, ref1, results, stats, total_points, us;\n if (($scope.stats != null) && ($scope.stats.total_points != null) && $scope.stats.total_points !== 0) {\n removeDoomlineDom();\n stats = $scope.stats;\n total_points = stats.total_points;\n current_sum = stats.assigned_points;\n if (!$scope.userstories) {\n return;\n }\n ref1 = $scope.userstories;\n results = [];\n for (i = j = 0, len = ref1.length; j < len; i = ++j) {\n us = ref1[i];\n current_sum += us.total_points;\n if (current_sum > total_points) {\n domElement = $el.find('.backlog-table-body .us-item-row')[i];\n addDoomLineDom(domElement);\n break;\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n };\n removeDoomlineDom = function() {\n return $el.find(\".doom-line\").remove();\n };\n addDoomLineDom = function(element) {\n var text;\n text = $translate.instant(\"BACKLOG.DOOMLINE\");\n return $(element).before(doomLineTemplate({\n \"text\": text\n }));\n };\n getUsItems = function() {\n var rowElements;\n rowElements = $el.find('.backlog-table-body .us-item-row');\n return _.map(rowElements, function(x) {\n return angular.element(x);\n });\n };\n $scope.$on(\"userstories:loaded\", reloadDoomLine);\n return $scope.$watch(\"stats\", reloadDoomLine);\n };\n linkToolbar = function($scope, $el, $attrs, $ctrl) {\n var checkSelected, getUsToMove, lastChecked, moveToCurrentSprint, moveToLatestSprint, moveUssToSprint, shiftPressed;\n getUsToMove = function() {\n var ussDom;\n ussDom = $el.find(\".backlog-table-body input:checkbox:checked\");\n return _.map(ussDom, function(item) {\n var itemScope;\n item = $(item).closest('.tg-scope');\n itemScope = item.scope();\n itemScope.us.milestone = $scope.sprints[0].id;\n return itemScope.us;\n });\n };\n moveUssToSprint = function(selectedUss, sprint) {\n var extraPoints, totalExtraPoints, ussCurrent;\n ussCurrent = _($scope.userstories);\n $scope.userstories = ussCurrent.without.apply(ussCurrent, selectedUss).value();\n extraPoints = _.map(selectedUss, function(v, k) {\n return v.total_points;\n });\n totalExtraPoints = _.reduce(extraPoints, function(acc, num) {\n return acc + num;\n });\n sprint.user_stories = _.union(sprint.user_stories, selectedUss);\n sprint.total_points += totalExtraPoints;\n $repo.saveAll(selectedUss).then(function() {\n $ctrl.loadSprints();\n return $ctrl.loadProjectStats();\n });\n return $el.find(\".move-to-sprint\").hide();\n };\n moveToCurrentSprint = function(selectedUss) {\n return moveUssToSprint(selectedUss, $scope.currentSprint);\n };\n moveToLatestSprint = function(selectedUss) {\n return moveUssToSprint(selectedUss, $scope.sprints[0]);\n };\n shiftPressed = false;\n lastChecked = null;\n checkSelected = function(target) {\n var moveToSprintDom, selectedUsDom;\n lastChecked = target.closest(\".us-item-row\");\n target.closest('.us-item-row').toggleClass('ui-multisortable-multiple');\n moveToSprintDom = $el.find(\".move-to-sprint\");\n selectedUsDom = $el.find(\".backlog-table-body input:checkbox:checked\");\n if (selectedUsDom.length > 0 && $scope.sprints.length > 0) {\n return moveToSprintDom.show();\n } else {\n return moveToSprintDom.hide();\n }\n };\n $(window).on(\"keydown.shift-pressed keyup.shift-pressed\", function(event) {\n shiftPressed = !!event.shiftKey;\n return true;\n });\n $el.on(\"change\", \".backlog-table-body input:checkbox\", function(event) {\n var current, elements, nextAll, prevAll, target;\n if (lastChecked && shiftPressed) {\n elements = [];\n current = $(event.currentTarget).closest(\".us-item-row\");\n nextAll = lastChecked.nextAll();\n prevAll = lastChecked.prevAll();\n if (_.some(nextAll, function(next) {\n return next === current[0];\n })) {\n elements = lastChecked.nextUntil(current);\n } else if (_.some(prevAll, function(prev) {\n return prev === current[0];\n })) {\n elements = lastChecked.prevUntil(current);\n }\n _.map(elements, function(elm) {\n var input;\n input = $(elm).find(\"input:checkbox\");\n input.prop('checked', true);\n return checkSelected(input);\n });\n }\n target = angular.element(event.currentTarget);\n target.closest(\".us-item-row\").toggleClass('is-checked');\n return checkSelected(target);\n });\n $el.on(\"click\", \"#move-to-latest-sprint\", (function(_this) {\n return function(event) {\n var ussToMove;\n ussToMove = getUsToMove();\n return $scope.$apply(_.partial(moveToLatestSprint, ussToMove));\n };\n })(this));\n $el.on(\"click\", \"#move-to-current-sprint\", (function(_this) {\n return function(event) {\n var ussToMove;\n ussToMove = getUsToMove();\n return $scope.$apply(_.partial(moveToCurrentSprint, ussToMove));\n };\n })(this));\n return $el.on(\"click\", \"#show-tags\", function(event) {\n event.preventDefault();\n $ctrl.toggleShowTags();\n return showHideTags($ctrl);\n });\n };\n showHideTags = function($ctrl) {\n var elm, text;\n elm = angular.element(\"#show-tags\");\n if ($ctrl.showTags) {\n elm.addClass(\"active\");\n text = $translate.instant(\"BACKLOG.TAGS.HIDE\");\n return elm.text(text);\n } else {\n elm.removeClass(\"active\");\n text = $translate.instant(\"BACKLOG.TAGS.SHOW\");\n return elm.text(text);\n }\n };\n showHideFilter = function($scope, $el, $ctrl) {\n var hideText, showText, sidebar, target;\n sidebar = $el.find(\"sidebar.filters-bar\");\n sidebar.one(\"transitionend\", function() {\n return timeout(150, function() {\n $rootscope.$broadcast(\"resize\");\n return $('.burndown').css(\"visibility\", \"visible\");\n });\n });\n target = angular.element(\"#show-filters-button\");\n $('.burndown').css(\"visibility\", \"hidden\");\n sidebar.toggleClass(\"active\");\n target.toggleClass(\"active\");\n hideText = $translate.instant(\"BACKLOG.FILTERS.HIDE\");\n showText = $translate.instant(\"BACKLOG.FILTERS.SHOW\");\n toggleText(target, [hideText, showText]);\n if (!sidebar.hasClass(\"active\")) {\n $ctrl.resetFilters();\n } else {\n $ctrl.restoreFilters();\n }\n return $ctrl.toggleActiveFilters();\n };\n linkFilters = function($scope, $el, $attrs, $ctrl) {\n $scope.filtersSearch = {};\n return $el.on(\"click\", \"#show-filters-button\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n return showHideFilter($scope, $el, $ctrl);\n });\n });\n };\n link = function($scope, $el, $attrs, $rootscope) {\n var $ctrl, filters;\n $ctrl = $el.controller();\n linkToolbar($scope, $el, $attrs, $ctrl);\n linkFilters($scope, $el, $attrs, $ctrl);\n linkDoomLine($scope, $el, $attrs, $ctrl);\n $el.find(\".backlog-table-body\").disableSelection();\n filters = $ctrl.getUrlFilters();\n if (filters.status || filters.tags || filters.q) {\n showHideFilter($scope, $el, $ctrl);\n }\n $scope.$on(\"showTags\", function() {\n return showHideTags($ctrl);\n });\n return $scope.$on(\"$destroy\", function() {\n $el.off();\n return $(window).off(\".shift-pressed\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklog\", [\"$tgRepo\", \"$rootScope\", \"$translate\", BacklogDirective]);\n\n UsRolePointsSelectorDirective = function($rootscope, $template, $compile, $translate) {\n var link, selectionTemplate;\n selectionTemplate = $template.get(\"backlog/us-role-points-popover.html\", true);\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var numberOfRoles, roles;\n roles = _.filter(project.roles, \"computable\");\n numberOfRoles = _.size(roles);\n if (numberOfRoles > 1) {\n return $el.append($compile(selectionTemplate({\n \"roles\": roles\n }))($scope));\n } else {\n $el.find(\".icon-arrow-bottom\").remove();\n return $el.find(\".header-points\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n $el.find(\".popover\").popover().close();\n return $el.find(\".header-points\").html(roleName + \"/Total\");\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx, roleId) {\n var text;\n $el.find(\".popover\").popover().close();\n text = $translate.instant(\"COMMON.FIELDS.POINTS\");\n return $el.find(\".header-points\").text(text);\n });\n $el.on(\"click\", function(event) {\n var target;\n target = angular.element(event.target);\n if (target.is(\"span\") || target.is(\"div\")) {\n event.stopPropagation();\n }\n return $el.find(\".popover\").popover().open();\n });\n $el.on(\"click\", \".clear-selection\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $rootscope.$broadcast(\"uspoints:clear-selection\");\n });\n $el.on(\"click\", \".role\", function(event) {\n var rolScope, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n rolScope = target.scope();\n return $rootscope.$broadcast(\"uspoints:select\", target.data(\"role-id\"), target.text());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsRolePointsSelector\", [\"$rootScope\", \"$tgTemplate\", \"$compile\", \"$translate\", UsRolePointsSelectorDirective]);\n\n UsPointsDirective = function($tgEstimationsService, $repo, $tgTemplate) {\n var link, rolesTemplate;\n rolesTemplate = $tgTemplate.get(\"common/estimation/us-points-roles-popover.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, bindClickElements, estimationProcess, filteringRoleId, renderRolesSelector, selectedRoleId, updatingSelectedRoleId;\n $ctrl = $el.controller();\n updatingSelectedRoleId = null;\n selectedRoleId = null;\n filteringRoleId = null;\n estimationProcess = null;\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n var us;\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n selectedRoleId = roleId;\n return estimationProcess.render();\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx) {\n var us;\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n selectedRoleId = null;\n return estimationProcess.render();\n });\n $scope.$watch($attrs.tgBacklogUsPoints, function(us) {\n var roles;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n roles = estimationProcess.calculateRoles();\n if (roles.length === 0) {\n $el.find(\".icon-arrow-bottom\").remove();\n $el.find(\"a.us-points\").addClass(\"not-clickable\");\n } else if (roles.length === 1) {\n selectedRoleId = _.keys(us.points)[0];\n }\n if (estimationProcess.isEditable) {\n bindClickElements();\n }\n estimationProcess.onSelectedPointForRole = function(roleId, pointId) {\n return this.save(roleId, pointId).then(function() {\n return $ctrl.loadProjectStats();\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, pointId, pointObj, template, text, title, totalPoints;\n totalPoints = this.calculateTotalPoints();\n if ((selectedRoleId == null) || roles.length === 1) {\n text = totalPoints;\n title = totalPoints;\n } else {\n pointId = this.us.points[selectedRoleId];\n pointObj = this.pointsById[pointId];\n text = pointObj.name + \" / \" + totalPoints + \"\";\n title = pointObj.name + \" / \" + totalPoints;\n }\n ctx = {\n totalPoints: totalPoints,\n roles: this.calculateRoles(),\n editable: this.isEditable,\n text: text,\n title: title\n };\n mainTemplate = \"common/estimation/us-estimation-total.html\";\n template = $tgTemplate.get(mainTemplate, true);\n html = template(ctx);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n renderRolesSelector = function() {\n var html, roles;\n roles = estimationProcess.calculateRoles();\n html = rolesTemplate({\n \"roles\": roles\n });\n $el.append(html);\n return $el.find(\".pop-role\").popover().open(function() {\n return $(this).remove();\n });\n };\n bindClickElements = function() {\n $el.on(\"click\", \"a.us-points\", function(event) {\n var us;\n event.preventDefault();\n event.stopPropagation();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = selectedRoleId;\n if (selectedRoleId != null) {\n return estimationProcess.renderPointsSelector(selectedRoleId);\n } else {\n return renderRolesSelector();\n }\n });\n return $el.on(\"click\", \".role\", function(event) {\n var popRolesDom, target, us;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = target.data(\"role-id\");\n popRolesDom = $el.find(\".pop-role\");\n popRolesDom.find(\"a\").removeClass(\"active\");\n popRolesDom.find(\"a[data-role-id='\" + updatingSelectedRoleId + \"']\").addClass(\"active\");\n return estimationProcess.renderPointsSelector(updatingSelectedRoleId);\n });\n };\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogUsPoints\", [\"$tgEstimationsService\", \"$tgRepo\", \"$tgTemplate\", UsPointsDirective]);\n\n ToggleBurndownVisibility = function($storage) {\n var hide, link, show;\n hide = function() {\n $(\".js-burndown-graph\").removeClass(\"shown\");\n $(\".js-toggle-burndown-visibility-button\").removeClass(\"active\");\n return $(\".js-burndown-graph\").removeClass(\"open\");\n };\n show = function(firstLoad) {\n $(\".js-toggle-burndown-visibility-button\").addClass(\"active\");\n if (firstLoad) {\n return $(\".js-burndown-graph\").addClass(\"shown\");\n } else {\n return $(\".js-burndown-graph\").addClass(\"open\");\n }\n };\n link = function($scope, $el, $attrs) {\n var firstLoad, hash, toggleGraph;\n firstLoad = true;\n hash = generateHash([\"is-burndown-grpahs-collapsed\"]);\n $scope.isBurndownGraphCollapsed = $storage.get(hash) || false;\n toggleGraph = function() {\n if ($scope.isBurndownGraphCollapsed) {\n hide(firstLoad);\n } else {\n show(firstLoad);\n }\n return firstLoad = false;\n };\n $scope.$watch(\"showGraphPlaceholder\", function() {\n if ($scope.showGraphPlaceholder != null) {\n $scope.isBurndownGraphCollapsed = $scope.isBurndownGraphCollapsed || $scope.showGraphPlaceholder;\n return toggleGraph();\n }\n });\n $el.on(\"click\", \".js-toggle-burndown-visibility-button\", function() {\n $scope.isBurndownGraphCollapsed = !$scope.isBurndownGraphCollapsed;\n $storage.set(hash, $scope.isBurndownGraphCollapsed);\n return toggleGraph();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgToggleBurndownVisibility\", [\"$tgStorage\", ToggleBurndownVisibility]);\n\n BurndownBacklogGraphDirective = function($translate) {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var client_increment_line, colors, data, evolution_line, j, milestonesRange, optimal_line, options, ref1, results, team_increment_line, width, zero_line;\n width = element.width();\n element.height(width / 6);\n milestonesRange = (function() {\n results = [];\n for (var j = 0, ref1 = dataToDraw.milestones.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; 0 <= ref1 ? j++ : j--){ results.push(j); }\n return results;\n }).apply(this);\n data = [];\n zero_line = _.map(dataToDraw.milestones, function(ml) {\n return 0;\n });\n data.push({\n data: _.zip(milestonesRange, zero_line),\n lines: {\n fillColor: \"rgba(0,0,0,0)\"\n },\n points: {\n show: false\n }\n });\n optimal_line = _.map(dataToDraw.milestones, function(ml) {\n return ml.optimal;\n });\n data.push({\n data: _.zip(milestonesRange, optimal_line),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n evolution_line = _.filter(_.map(dataToDraw.milestones, function(ml) {\n return ml.evolution;\n }), function(evolution) {\n return evolution != null;\n });\n data.push({\n data: _.zip(milestonesRange, evolution_line),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n client_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"] - ml[\"client-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, client_increment_line),\n lines: {\n fillColor: \"rgba(255,51,51,0.3)\"\n }\n });\n team_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, team_increment_line),\n lines: {\n fillColor: \"rgba(153,51,51,0.3)\"\n }\n });\n colors = [\"rgba(0,0,0,1)\", \"rgba(120,120,120,0.2)\", \"rgba(102,153,51,1)\", \"rgba(153,51,51,1)\", \"rgba(255,51,51,1)\"];\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: \"#ccc\",\n hoverable: true\n },\n xaxis: {\n ticks: dataToDraw.milestones.length,\n axisLabel: $translate.instant(\"BACKLOG.CHART.XAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: \"Verdana, Arial, Helvetica, Tahoma, sans-serif\",\n axisLabelPadding: 5,\n tickFormatter: function(val, axis) {\n return \"\";\n }\n },\n yaxis: {\n axisLabel: $translate.instant(\"BACKLOG.CHART.YAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: \"Verdana, Arial, Helvetica, Tahoma, sans-serif\",\n axisLabelPadding: 5\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: colors,\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n var ctx;\n if (flotItem.seriesIndex === 1) {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.OPTIMAL\", ctx);\n } else if (flotItem.seriesIndex === 2) {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.REAL\", ctx);\n } else if (flotItem.seriesIndex === 3) {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.INCREMENT_CLIENT\", ctx);\n } else {\n ctx = {\n sprintName: dataToDraw.milestones[xval].name,\n value: Math.abs(yval)\n };\n return $translate.instant(\"BACKLOG.CHART.INCREMENT_TEAM\", ctx);\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch(\"stats\", function(value) {\n if ($scope.stats != null) {\n redrawChart(element, $scope.stats);\n return $scope.$on(\"resize\", function() {\n return redrawChart(element, $scope.stats);\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBurndownBacklogGraph\", [\"$translate\", BurndownBacklogGraphDirective]);\n\n TgBacklogProgressBarDirective = function($template, $compile) {\n var adjustPercentaje, link, render, template;\n template = $template.get(\"backlog/progress-bar.html\", true);\n render = function(scope, el, projectPointsPercentaje, closedPointsPercentaje) {\n var html;\n html = template({\n projectPointsPercentaje: projectPointsPercentaje,\n closedPointsPercentaje: closedPointsPercentaje\n });\n html = $compile(html)(scope);\n return el.html(html);\n };\n adjustPercentaje = function(percentage) {\n var adjusted;\n adjusted = _.max([0, percentage]);\n adjusted = _.min([100, adjusted]);\n return Math.round(adjusted);\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch($attrs.tgBacklogProgressBar, function(stats) {\n var closedPoints, closedPointsPercentaje, definedPoints, projectPointsPercentaje, totalPoints;\n if (stats != null) {\n totalPoints = stats.total_points ? stats.total_points : stats.defined_points;\n definedPoints = stats.defined_points;\n closedPoints = stats.closed_points;\n if (definedPoints > totalPoints) {\n projectPointsPercentaje = totalPoints * 100 / definedPoints;\n closedPointsPercentaje = closedPoints * 100 / definedPoints;\n } else {\n projectPointsPercentaje = 100;\n closedPointsPercentaje = closedPoints * 100 / totalPoints;\n }\n projectPointsPercentaje = adjustPercentaje(projectPointsPercentaje - 3);\n closedPointsPercentaje = adjustPercentaje(closedPointsPercentaje - 3);\n return render($scope, $el, projectPointsPercentaje, closedPointsPercentaje);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogProgressBar\", [\"$tgTemplate\", \"$compile\", TgBacklogProgressBarDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/sortable.coffee\n */\n\n(function() {\n var BacklogEmptySortableDirective, BacklogSortableDirective, SprintSortableDirective, bindOnce, deleteElement, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n deleteElement = function(el) {\n el.scope().$destroy();\n el.off();\n return el.remove();\n };\n\n BacklogSortableDirective = function($repo, $rs, $rootscope, $tgConfirm, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var getUsIndex;\n getUsIndex = (function(_this) {\n return function(us) {\n return $(us).index(\".backlog-table-body .row\");\n };\n })(this);\n bindOnce($scope, \"project\", function(project) {\n var filterError;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n filterError = function() {\n var text;\n text = $translate.instant(\"BACKLOG.SORTABLE_FILTER_ERROR\");\n return $tgConfirm.notify(\"error\", text);\n };\n $el.sortable({\n items: \".us-item-row\",\n cancel: \".popover\",\n connectWith: \".sprint\",\n dropOnEmpty: true,\n placeholder: \"row us-item-row us-item-drag sortable-placeholder\",\n scroll: true,\n disableHorizontalScroll: true,\n tolerance: \"pointer\",\n revert: false,\n start: function() {\n return $(document.body).addClass(\"drag-active\");\n },\n stop: function() {\n $(document.body).removeClass(\"drag-active\");\n if ($el.hasClass(\"active-filters\")) {\n $el.sortable(\"cancel\");\n return filterError();\n }\n }\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n if ($el.hasClass(\"active-filters\")) {\n ui.source.sortable(\"cancel\");\n filterError();\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = getUsIndex(ui.item);\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var index, items, us;\n if ($(ui.items[0]).parent().length === 0) {\n return;\n }\n if ($el.hasClass(\"active-filters\")) {\n return;\n }\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return getUsIndex(item);\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n setTimeout(((function(_this) {\n return function() {\n return item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, null);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n BacklogEmptySortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n items: \".us-item-row\",\n dropOnEmpty: true\n });\n return $el.on(\"sortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n SprintSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n scroll: true,\n dropOnEmpty: true,\n items: \".sprint-table .milestone-us-item-row\",\n disableHorizontalScroll: true,\n connectWith: \".sprint,.backlog-table-body,.empty-backlog\",\n placeholder: \"row us-item-row sortable-placeholder\",\n forcePlaceholderSize: true\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var index, items, us;\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return $(item).index();\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n deleteElement(item);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, $scope.sprint.id);\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var itemIndex, itemUs;\n if (ui.item.parent().length === 0) {\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n setTimeout(((function(_this) {\n return function() {\n return ui.item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, $scope.sprint.id);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgConfirm\", \"$translate\", BacklogSortableDirective]);\n\n module.directive(\"tgBacklogEmptySortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", BacklogEmptySortableDirective]);\n\n module.directive(\"tgSprintSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", SprintSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog/sprints.coffee\n */\n\n(function() {\n var BacklogSprintDirective, BacklogSprintHeaderDirective, ToggleExcludeClosedSprintsVisualization, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogSprintDirective = function($repo, $rootscope) {\n var link, slideOptions, sprintTableMinHeight, toggleSprint;\n sprintTableMinHeight = 50;\n slideOptions = {\n duration: 500,\n easing: 'linear'\n };\n toggleSprint = (function(_this) {\n return function($el) {\n var sprintArrow, sprintTable;\n sprintTable = $el.find(\".sprint-table\");\n sprintArrow = $el.find(\".compact-sprint\");\n sprintArrow.toggleClass('active');\n return sprintTable.toggleClass('open');\n };\n })(this);\n link = function($scope, $el, $attrs) {\n $scope.$watch($attrs.tgBacklogSprint, function(sprint) {\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n if (sprint.closed) {\n return $el.addClass(\"sprint-closed\");\n } else {\n return toggleSprint($el);\n }\n });\n $el.on(\"click\", \".sprint-name > .compact-sprint\", function(event) {\n event.preventDefault();\n toggleSprint($el);\n return $el.find(\".sprint-table\").slideToggle(slideOptions);\n });\n $el.on(\"click\", \".sprint-name > .icon-edit\", function(event) {\n var sprint;\n event.preventDefault();\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n return $rootscope.$broadcast(\"sprintform:edit\", sprint);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSprint\", [\"$tgRepo\", \"$rootScope\", BacklogSprintDirective]);\n\n BacklogSprintHeaderDirective = function($navUrls, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"backlog/sprint-header.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, isVisible, prettyDate, render;\n prettyDate = $translate.instant(\"BACKLOG.SPRINTS.DATE\");\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_milestone\") !== -1;\n };\n isVisible = function() {\n return $scope.project.my_permissions.indexOf(\"view_milestones\") !== -1;\n };\n render = function(sprint) {\n var compiledTemplate, ctx, estimatedDateRange, finish, start, taskboardUrl, templateScope;\n taskboardUrl = $navUrls.resolve(\"project-taskboard\", {\n project: $scope.project.slug,\n sprint: sprint.slug\n });\n start = moment(sprint.estimated_start).format(prettyDate);\n finish = moment(sprint.estimated_finish).format(prettyDate);\n estimatedDateRange = start + \"-\" + finish;\n ctx = {\n name: sprint.name,\n taskboardUrl: taskboardUrl,\n estimatedDateRange: estimatedDateRange,\n closedPoints: sprint.closed_points || 0,\n totalPoints: sprint.total_points || 0,\n isVisible: isVisible(),\n isEditable: isEditable()\n };\n templateScope = $scope.$new();\n _.assign(templateScope, ctx);\n compiledTemplate = $compile(template)(templateScope);\n return $el.html(compiledTemplate);\n };\n $scope.$watch($attrs.ngModel, function(sprint) {\n return render(sprint);\n });\n $scope.$on(\"sprintform:edit:success\", function() {\n return render($model.$modelValue);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgBacklogSprintHeader\", [\"$tgNavUrls\", \"$tgTemplate\", \"$compile\", \"$translate\", BacklogSprintHeaderDirective]);\n\n ToggleExcludeClosedSprintsVisualization = function($rootscope, $loading, $translate) {\n var excludeClosedSprints, link;\n excludeClosedSprints = true;\n link = function($scope, $el, $attrs) {\n var currentLoading, loadingElm;\n loadingElm = $(\"
\");\n $el.after(loadingElm);\n currentLoading = null;\n $el.on(\"click\", function(event) {\n event.preventDefault();\n excludeClosedSprints = !excludeClosedSprints;\n currentLoading = $loading().target(loadingElm).start();\n if (excludeClosedSprints) {\n return $rootscope.$broadcast(\"backlog:unload-closed-sprints\");\n } else {\n return $rootscope.$broadcast(\"backlog:load-closed-sprints\");\n }\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $scope.$on(\"closed-sprints:reloaded\", (function(_this) {\n return function(ctx, sprints) {\n var key, text;\n currentLoading.finish();\n if (sprints.length > 0) {\n key = \"BACKLOG.SPRINTS.ACTION_HIDE_CLOSED_SPRINTS\";\n } else {\n key = \"BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS\";\n }\n text = $translate.instant(key);\n return $el.find(\".text\").text(text);\n };\n })(this));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogToggleClosedSprintsVisualization\", [\"$rootScope\", \"$tgLoading\", \"$translate\", ToggleExcludeClosedSprintsVisualization]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard/charts.coffee\n */\n\n(function() {\n var SprintGraphDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaTaskboard\");\n\n SprintGraphDirective = function($translate) {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var data, days, options, width;\n width = element.width();\n element.height(240);\n days = _.map(dataToDraw, function(x) {\n return moment(x.day);\n });\n data = [];\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.optimal_points;\n })),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.open_points;\n })),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: '#ccc',\n hoverable: true\n },\n xaxis: {\n tickSize: [1, \"day\"],\n min: days[0],\n max: _.last(days),\n mode: \"time\",\n daysNames: days,\n axisLabel: $translate.instant(\"TASKBOARD.CHARTS.XAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',\n axisLabelPadding: 5\n },\n yaxis: {\n min: 0,\n axisLabel: $translate.instant(\"TASKBOARD.CHARTS.YAXIS_LABEL\"),\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',\n axisLabelPadding: 5\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: [\"rgba(102,153,51,1)\", \"rgba(120,120,120,0.2)\"],\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n var formattedDate, roundedValue;\n formattedDate = moment(xval).format($translate.instant(\"TASKBOARD.CHARTS.DATE\"));\n roundedValue = Math.round(yval);\n if (flotItem.seriesIndex === 1) {\n return $translate.instant(\"TASKBOARD.CHARTS.OPTIMAL\", {\n formattedDate: formattedDate,\n roundedValue: roundedValue\n });\n } else {\n return $translate.instant(\"TASKBOARD.CHARTS.REAL\", {\n formattedDate: formattedDate,\n roundedValue: roundedValue\n });\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$on(\"resize\", function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n $scope.$on(\"taskboard:graph:toggle-visibility\", function() {\n $el.parent().toggleClass('open');\n return timeout(100, function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n });\n $scope.$watch('stats', function(value) {\n if ($scope.stats == null) {\n return;\n }\n return redrawChart(element, $scope.stats.days);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintGraph\", [\"$translate\", SprintGraphDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkTasksDirective, CreateEditTaskDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n CreateEditTaskDirective = function($repo, $model, $rs, $rootscope, $loading, lightboxService, $translate, $q, attachmentsService) {\n var link;\n link = function($scope, $el, attrs) {\n var attachmentsToAdd, attachmentsToDelete, createAttachments, deleteAttachments, resetAttachments, submit, submitButton;\n $scope.isNew = true;\n attachmentsToAdd = Immutable.List();\n attachmentsToDelete = Immutable.List();\n resetAttachments = function() {\n attachmentsToAdd = Immutable.List();\n return attachmentsToDelete = Immutable.List();\n };\n $scope.addAttachment = function(attachment) {\n return attachmentsToAdd = attachmentsToAdd.push(attachment);\n };\n $scope.deleteAttachment = function(attachment) {\n return attachmentsToDelete = attachmentsToDelete.push(attachment);\n };\n createAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToAdd.toJS(), function(attachment) {\n return attachmentsService.upload(attachment.file, obj.id, $scope.task.project, 'task');\n });\n return $q.all(promises);\n };\n deleteAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToDelete.toJS(), function(attachment) {\n return attachmentsService[\"delete\"](\"task\", attachment.id);\n });\n return $q.all(promises);\n };\n $scope.$on(\"taskform:new\", function(ctx, sprintId, usId) {\n var create, newTask;\n $scope.task = {\n project: $scope.projectId,\n milestone: sprintId,\n user_story: usId,\n is_archived: false,\n status: $scope.project.default_task_status,\n assigned_to: null,\n tags: []\n };\n $scope.isNew = true;\n $scope.attachments = Immutable.List();\n resetAttachments();\n create = $translate.instant(\"COMMON.CREATE\");\n $el.find(\".button-green\").html(create);\n newTask = $translate.instant(\"LIGHTBOX.CREATE_EDIT_TASK.TITLE\");\n $el.find(\".title\").html(newTask + \" \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n $scope.$on(\"taskform:edit\", function(ctx, task, attachments) {\n var edit, save;\n $scope.task = task;\n $scope.isNew = false;\n $scope.attachments = Immutable.fromJS(attachments);\n resetAttachments();\n save = $translate.instant(\"COMMON.SAVE\");\n edit = $translate.instant(\"LIGHTBOX.CREATE_EDIT_TASK.ACTION_EDIT\");\n $el.find(\".button-green\").html(save);\n $el.find(\".title\").html(edit + \" \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n submitButton = $el.find(\".submit-button\");\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, currentLoading, form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n if ($scope.isNew) {\n promise = $repo.create(\"tasks\", $scope.task);\n broadcastEvent = \"taskform:new:success\";\n } else {\n promise = $repo.save($scope.task);\n broadcastEvent = \"taskform:edit:success\";\n }\n promise.then(function(data) {\n createAttachments(data);\n deleteAttachments(data);\n return data;\n });\n currentLoading = $loading().target(submitButton).start();\n return promise.then(function(data) {\n currentLoading.finish();\n lightboxService.close($el);\n return $rootscope.$broadcast(broadcastEvent, data);\n });\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n CreateBulkTasksDirective = function($repo, $rs, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.form = {\n data: \"\",\n usId: null\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, data, form, projectId, promise, sprintId, usId;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n data = $scope.form.data;\n projectId = $scope.projectId;\n sprintId = $scope.form.sprintId;\n usId = $scope.form.usId;\n promise = $rs.tasks.bulkCreate(projectId, sprintId, usId, data);\n promise.then(function(result) {\n currentLoading.finish();\n $rootscope.$broadcast(\"taskform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return console.log(\"FAIL\");\n });\n };\n })(this));\n $scope.$on(\"taskform:bulk\", function(ctx, sprintId, usId) {\n lightboxService.open($el);\n return $scope.form = {\n data: \"\",\n sprintId: sprintId,\n usId: usId\n };\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaTaskboard\");\n\n module.directive(\"tgLbCreateEditTask\", [\"$tgRepo\", \"$tgModel\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", \"$translate\", \"$q\", \"tgAttachmentsService\", CreateEditTaskDirective]);\n\n module.directive(\"tgLbCreateBulkTasks\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkTasksDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard.coffee\n */\n\n(function() {\n var TaskboardController, TaskboardDirective, TaskboardSquishColumnDirective, TaskboardTaskDirective, TaskboardUserDirective, bindMethods, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n toggleText = this.taiga.toggleText;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n scopeDefer = this.taiga.scopeDefer;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaTaskboard\");\n\n TaskboardController = (function(superClass) {\n extend(TaskboardController, superClass);\n\n TaskboardController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"tgAppMetaService\", \"$tgLocation\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\"];\n\n function TaskboardController(scope, rootscope, repo, confirm, rs1, params1, q, appMetaService, location, navUrls, events, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs1;\n this.params = params1;\n this.q = q;\n this.appMetaService = appMetaService;\n this.location = location;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"TASKBOARD.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this._setMeta();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n TaskboardController.prototype._setMeta = function() {\n var description, prettyDate, title;\n prettyDate = this.translate.instant(\"BACKLOG.SPRINTS.DATE\");\n title = this.translate.instant(\"TASKBOARD.PAGE_TITLE\", {\n projectName: this.scope.project.name,\n sprintName: this.scope.sprint.name\n });\n description = this.translate.instant(\"TASKBOARD.PAGE_DESCRIPTION\", {\n projectName: this.scope.project.name,\n sprintName: this.scope.sprint.name,\n startDate: moment(this.scope.sprint.estimated_start).format(prettyDate),\n endDate: moment(this.scope.sprint.estimated_finish).format(prettyDate),\n completedPercentage: this.scope.stats.completedPercentage || \"0\",\n completedPoints: this.scope.stats.completedPointsSum || \"--\",\n totalPoints: this.scope.stats.totalPointsSum || \"--\",\n openTasks: this.scope.stats.openTasks || \"--\",\n totalTasks: this.scope.stats.total_tasks || \"--\"\n });\n return this.appMetaService.setAll(title, description);\n };\n\n TaskboardController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"taskform:bulk:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"bulk create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:new:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:edit:success\", (function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n this.scope.$on(\"taskboard:task:move\", this.taskMove);\n return this.scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, task) {\n var promise;\n task.assigned_to = userId;\n promise = _this.repo.save(task);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n })(this));\n };\n\n TaskboardController.prototype.initializeSubscription = function() {\n var routingKey, routingKey1;\n routingKey = \"changes.project.\" + this.scope.projectId + \".tasks\";\n this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadTaskboard();\n };\n })(this));\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.refreshTagsColors();\n _this.loadSprintStats();\n return _this.loadSprint();\n };\n })(this));\n };\n\n TaskboardController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n if (!project.is_backlog_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(e) {\n return e.id;\n });\n _this.scope.roleById = groupBy(project.roles, function(e) {\n return e.id;\n });\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.usStatusById = groupBy(project.us_statuses, function(e) {\n return e.id;\n });\n _this.scope.$emit('project:loaded', project);\n _this.fillUsersAndRoles(project.members, project.roles);\n return project;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprintStats = function() {\n return this.rs.sprints.stats(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(stats) {\n var completedPointsSum, remainingPointsSum, remainingTasks, totalPointsSum;\n totalPointsSum = _.reduce(_.values(stats.total_points), (function(res, n) {\n return res + n;\n }), 0);\n completedPointsSum = _.reduce(_.values(stats.completed_points), (function(res, n) {\n return res + n;\n }), 0);\n remainingPointsSum = totalPointsSum - completedPointsSum;\n remainingTasks = stats.total_tasks - stats.completed_tasks;\n _this.scope.stats = stats;\n _this.scope.stats.totalPointsSum = totalPointsSum;\n _this.scope.stats.completedPointsSum = completedPointsSum;\n _this.scope.stats.remainingPointsSum = remainingPointsSum;\n _this.scope.stats.remainingTasks = remainingTasks;\n if (stats.totalPointsSum) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.completedPointsSum / stats.totalPointsSum);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n _this.scope.stats.openTasks = stats.total_tasks - stats.completed_tasks;\n return stats;\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprint = function() {\n return this.rs.sprints.get(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n _this.scope.userstories = _.sortBy(sprint.user_stories, \"sprint_order\");\n return sprint;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(tasks) {\n var i, j, k, len, len1, len2, ref, ref1, ref2, status, task, us, usId;\n _this.scope.tasks = _.sortBy(tasks, 'taskboard_order');\n _this.scope.usTasks = {};\n ref = _.union(_this.scope.userstories, [\n {\n id: null\n }\n ]);\n for (i = 0, len = ref.length; i < len; i++) {\n us = ref[i];\n _this.scope.usTasks[us.id] = {};\n ref1 = _this.scope.taskStatusList;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n status = ref1[j];\n _this.scope.usTasks[us.id][status.id] = [];\n }\n }\n ref2 = _this.scope.tasks;\n for (k = 0, len2 = ref2.length; k < len2; k++) {\n task = ref2[k];\n if ((_this.scope.usTasks[task.user_story] != null) && (_this.scope.usTasks[task.user_story][task.status] != null)) {\n _this.scope.usTasks[task.user_story][task.status].push(task);\n }\n }\n if (tasks.length === 0) {\n if (_this.scope.userstories.length > 0) {\n usId = _this.scope.userstories[0].id;\n } else {\n usId = null;\n }\n _this.scope.usTasks[usId][_this.scope.taskStatusList[0].id].push({\n isPlaceholder: true\n });\n }\n return tasks;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTaskboard = function() {\n return this.q.all([\n this.refreshTagsColors(), this.loadSprintStats(), this.loadSprint().then((function(_this) {\n return function() {\n return _this.loadTasks();\n };\n })(this))\n ]);\n };\n\n TaskboardController.prototype.loadInitialData = function() {\n var params, promise;\n params = {\n pslug: this.params.pslug,\n sslug: this.params.sslug\n };\n promise = this.repo.resolve(params).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n _this.scope.sprintId = data.milestone;\n _this.initializeSubscription();\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTasksOrder = function(tasks) {\n var data, items;\n items = this.resortTasks(tasks);\n data = this.prepareBulkUpdateData(items);\n return this.rs.tasks.bulkUpdateTaskTaskboardOrder(this.scope.project.id, data);\n };\n\n TaskboardController.prototype.resortTasks = function(tasks) {\n var i, index, item, items, len;\n items = [];\n for (index = i = 0, len = tasks.length; i < len; index = ++i) {\n item = tasks[index];\n item[\"taskboard_order\"] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n TaskboardController.prototype.prepareBulkUpdateData = function(uses) {\n return _.map(uses, function(x) {\n return {\n \"task_id\": x.id,\n \"order\": x[\"taskboard_order\"]\n };\n });\n };\n\n TaskboardController.prototype.taskMove = function(ctx, task, usId, statusId, order) {\n var promise, r, tasks;\n r = this.scope.usTasks[task.user_story][task.status].indexOf(task);\n this.scope.usTasks[task.user_story][task.status].splice(r, 1);\n tasks = this.scope.usTasks[usId][statusId];\n tasks.splice(order, 0, task);\n task.user_story = usId;\n task.status = statusId;\n task.taskboard_order = order;\n promise = this.repo.save(task);\n this.rootscope.$broadcast(\"sprint:task:moved\", task);\n promise.then((function(_this) {\n return function() {\n _this.refreshTasksOrder(tasks);\n return _this.loadSprintStats();\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function() {\n return console.log(\"FAIL TASK SAVE\");\n };\n })(this));\n };\n\n TaskboardController.prototype.addNewTask = function(type, us) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"taskform:new\", this.scope.sprintId, us != null ? us.id : void 0);\n case \"bulk\":\n return this.rootscope.$broadcast(\"taskform:bulk\", this.scope.sprintId, us != null ? us.id : void 0);\n }\n };\n\n TaskboardController.prototype.editTaskAssignedTo = function(task) {\n return this.rootscope.$broadcast(\"assigned-to:add\", task);\n };\n\n return TaskboardController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskboardController\", TaskboardController);\n\n TaskboardDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, tableBodyDom;\n $ctrl = $el.controller();\n $el.on(\"click\", \".toggle-analytics-visibility\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass('active');\n return $rootscope.$broadcast(\"taskboard:graph:toggle-visibility\");\n });\n tableBodyDom = $el.find(\".taskboard-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".taskboard-table-header .taskboard-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboard\", [\"$rootScope\", TaskboardDirective]);\n\n TaskboardTaskDirective = function($rootscope, $loading, $rs, $rs2) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"task\", function(task) {\n if (task.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!task.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n return $el.find(\".icon-edit\").on(\"click\", function(event) {\n if ($el.find('.icon-edit').hasClass('noclick')) {\n return;\n }\n return $scope.$apply(function() {\n var currentLoading, target, task;\n target = $(event.target);\n currentLoading = $loading().target(target).timeout(200).removeClasses(\"icon-edit\").start();\n task = $scope.task;\n return $rs.tasks.getByRef(task.project, task.ref).then((function(_this) {\n return function(editingTask) {\n return $rs2.attachments.list(\"task\", editingTask.id, editingTask.project).then(function(attachments) {\n $rootscope.$broadcast(\"taskform:edit\", editingTask, attachments.toJS());\n return currentLoading.finish();\n });\n };\n })(this));\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardTask\", [\"$rootScope\", \"$tgLoading\", \"$tgResources\", \"tgResources\", TaskboardTaskDirective]);\n\n TaskboardSquishColumnDirective = function(rs) {\n var avatarWidth, link, maxColumnWidth;\n avatarWidth = 40;\n maxColumnWidth = 300;\n link = function($scope, $el, $attrs) {\n var getCeilWidth, recalculateStatusColumnWidth, recalculateTaskboardWidth, refreshTaskboardTableWidth, setStatusColumnWidth;\n $scope.$on(\"sprint:task:moved\", (function(_this) {\n return function() {\n return recalculateTaskboardWidth();\n };\n })(this));\n bindOnce($scope, \"usTasks\", function(project) {\n $scope.statusesFolded = rs.tasks.getStatusColumnModes($scope.project.id);\n $scope.usFolded = rs.tasks.getUsRowModes($scope.project.id, $scope.sprintId);\n return recalculateTaskboardWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.statusesFolded[status.id] = !!!$scope.statusesFolded[status.id];\n rs.tasks.storeStatusColumnModes($scope.projectId, $scope.statusesFolded);\n return recalculateTaskboardWidth();\n };\n $scope.foldUs = function(us) {\n if (!us) {\n $scope.usFolded[null] = !!!$scope.usFolded[null];\n } else {\n $scope.usFolded[us.id] = !!!$scope.usFolded[us.id];\n }\n rs.tasks.storeUsRowModes($scope.projectId, $scope.sprintId, $scope.usFolded);\n return recalculateTaskboardWidth();\n };\n getCeilWidth = (function(_this) {\n return function(usId, statusId) {\n var tasks, tasksMatrixSize, width;\n tasks = $scope.usTasks[usId][statusId].length;\n if ($scope.statusesFolded[statusId]) {\n if (tasks && $scope.usFolded[usId]) {\n tasksMatrixSize = Math.round(Math.sqrt(tasks));\n width = avatarWidth * tasksMatrixSize;\n } else {\n width = avatarWidth;\n }\n return width;\n }\n return 0;\n };\n })(this);\n setStatusColumnWidth = (function(_this) {\n return function(statusId, width) {\n var column;\n column = $el.find(\".squish-status-\" + statusId);\n if (width) {\n return column.css('max-width', width);\n } else {\n return column.css(\"max-width\", maxColumnWidth);\n }\n };\n })(this);\n refreshTaskboardTableWidth = (function(_this) {\n return function() {\n var columnWidths, columns, totalWidth;\n columnWidths = [];\n columns = $el.find(\".task-colum-name\");\n columnWidths = _.map(columns, function(column) {\n return $(column).outerWidth(true);\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.taskboard-table-inner').css(\"width\", totalWidth);\n };\n })(this);\n recalculateStatusColumnWidth = (function(_this) {\n return function(statusId) {\n var statusFoldedWidth;\n statusFoldedWidth = getCeilWidth(null, statusId);\n _.forEach($scope.userstories, function(us) {\n var width;\n width = getCeilWidth(us.id, statusId);\n if (width > statusFoldedWidth) {\n return statusFoldedWidth = width;\n }\n });\n return setStatusColumnWidth(statusId, statusFoldedWidth);\n };\n })(this);\n return recalculateTaskboardWidth = (function(_this) {\n return function() {\n _.forEach($scope.taskStatusList, function(status) {\n return recalculateStatusColumnWidth(status.id);\n });\n refreshTaskboardTableWidth();\n };\n })(this);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSquishColumn\", [\"$tgResources\", TaskboardSquishColumnDirective]);\n\n TaskboardUserDirective = function($log, $translate) {\n var clickable, link;\n clickable = false;\n link = function($scope, $el, $attrs) {\n var username_label;\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.addClass(\"not-clickable\");\n $scope.$watch('task.assigned_to', function(assigned_to) {\n var user;\n user = $scope.usersById[assigned_to];\n if (user === void 0) {\n _.assign($scope, {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\",\n clickable: clickable\n });\n } else {\n _.assign($scope, {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n });\n }\n return username_label.text($scope.name);\n });\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_task\") > -1) {\n clickable = true;\n $el.find(\".avatar-assigned-to\").on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n };\n })(this));\n username_label.removeClass(\"not-clickable\");\n return username_label.on(\"click\", function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n });\n }\n });\n };\n return {\n link: link,\n templateUrl: \"taskboard/taskboard-user.html\",\n scope: {\n \"usersById\": \"=users\",\n \"project\": \"=\",\n \"task\": \"=\"\n }\n };\n };\n\n module.directive(\"tgTaskboardUserAvatar\", [\"$log\", \"$translate\", TaskboardUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard/sortable.coffee\n */\n\n(function() {\n var TaskboardSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n TaskboardSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".taskboard-task-inner\",\n dropOnEmpty: true,\n connectWith: \".taskboard-tasks-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemTask, newStatusId, newUsId, oldStatusId, oldUsId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemTask = itemEl.scope().task;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n oldUsId = oldParentScope.us ? oldParentScope.us.id : null;\n oldStatusId = oldParentScope.st.id;\n newUsId = newParentScope.us ? newParentScope.us.id : null;\n newStatusId = newParentScope.st.id;\n if (newStatusId !== oldStatusId || newUsId !== oldUsId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"taskboard:task:move\", itemTask, newUsId, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n return tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", TaskboardSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/kanban/main.coffee\n */\n\n(function() {\n var KanbanArchivedStatusHeaderDirective, KanbanArchivedStatusIntroDirective, KanbanController, KanbanDirective, KanbanSquishColumnDirective, KanbanUserDirective, KanbanUserstoryDirective, KanbanWipLimitDirective, bindMethods, bindOnce, defaultViewMode, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText, viewModes,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaKanban\");\n\n defaultViewMode = \"maximized\";\n\n viewModes = [\"maximized\", \"minimized\"];\n\n KanbanController = (function(superClass) {\n extend(KanbanController, superClass);\n\n KanbanController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\"];\n\n function KanbanController(scope, rootscope, repo, confirm, rs1, params1, q, location, appMetaService, navUrls, events, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs1;\n this.params = params1;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"KANBAN.SECTION_NAME\");\n this.scope.statusViewModes = {};\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"KANBAN.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"KANBAN.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n KanbanController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.refreshTagsColors();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.refreshTagsColors();\n };\n })(this));\n this.scope.$on(\"assigned-to:added\", this.onAssignedToChanged);\n this.scope.$on(\"kanban:us:move\", this.moveUs);\n this.scope.$on(\"kanban:show-userstories-for-status\", this.loadUserStoriesForStatus);\n return this.scope.$on(\"kanban:hide-userstories-for-status\", this.hideUserStoriesForStatus);\n };\n\n KanbanController.prototype.addNewUs = function(type, statusId) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, statusId, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, statusId);\n }\n };\n\n KanbanController.prototype.changeUsAssignedTo = function(us) {\n return this.rootscope.$broadcast(\"assigned-to:add\", us);\n };\n\n KanbanController.prototype.onAssignedToChanged = function(ctx, userid, us) {\n var promise;\n us.assigned_to = userid;\n promise = this.repo.save(us);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n\n KanbanController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n KanbanController.prototype.loadUserstories = function() {\n var params, promise;\n params = {\n status__is_archived: false\n };\n promise = this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n var i, j, k, len, len1, len2, ref, ref1, ref2, status, us, usByStatus, us_archived;\n _this.scope.userstories = userstories;\n usByStatus = _.groupBy(userstories, \"status\");\n us_archived = [];\n ref = _this.scope.usStatusList;\n for (i = 0, len = ref.length; i < len; i++) {\n status = ref[i];\n if (usByStatus[status.id] == null) {\n usByStatus[status.id] = [];\n }\n if (_this.scope.usByStatus != null) {\n ref1 = _this.scope.usByStatus[status.id];\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n us = ref1[j];\n if (us.status !== status.id) {\n us_archived.push(us);\n }\n }\n }\n if (status.is_archived && (_this.scope.usByStatus != null) && _this.scope.usByStatus[status.id].length !== 0) {\n ref2 = _this.scope.usByStatus[status.id].concat(us_archived);\n for (k = 0, len2 = ref2.length; k < len2; k++) {\n us = ref2[k];\n if (us.status === status.id) {\n usByStatus[status.id].push(us);\n }\n }\n }\n usByStatus[status.id] = _.sortBy(usByStatus[status.id], \"kanban_order\");\n }\n if (userstories.length === 0) {\n status = _this.scope.usStatusList[0];\n usByStatus[status.id].push({\n isPlaceholder: true\n });\n }\n _this.scope.usByStatus = usByStatus;\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\", userstories);\n });\n return userstories;\n };\n })(this));\n promise.then((function(_this) {\n return function() {\n return _this.scope.$broadcast(\"redraw:wip\");\n };\n })(this));\n return promise;\n };\n\n KanbanController.prototype.loadUserStoriesForStatus = function(ctx, statusId) {\n var params;\n params = {\n status: statusId\n };\n return this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n _this.scope.usByStatus[statusId] = _.sortBy(userstories, \"kanban_order\");\n _this.scope.$broadcast(\"kanban:shown-userstories-for-status\", statusId, userstories);\n return userstories;\n };\n })(this));\n };\n\n KanbanController.prototype.hideUserStoriesForStatus = function(ctx, statusId) {\n this.scope.usByStatus[statusId] = [];\n return this.scope.$broadcast(\"kanban:hidden-userstories-for-status\", statusId);\n };\n\n KanbanController.prototype.loadKanban = function() {\n return this.q.all([this.refreshTagsColors(), this.loadUserstories()]);\n };\n\n KanbanController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_kanban_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.projectId = project.id;\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.generateStatusViewModes();\n _this.scope.$emit(\"project:loaded\", project);\n return project;\n };\n })(this));\n };\n\n KanbanController.prototype.initializeSubscription = function() {\n var routingKey1;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n return _this.loadUserstories();\n };\n })(this));\n };\n\n KanbanController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n _this.initializeSubscription();\n return _this.loadKanban();\n };\n })(this));\n };\n\n KanbanController.prototype.generateStatusViewModes = function() {\n var i, len, mode, ref, status, storedStatusViewModes;\n storedStatusViewModes = this.rs.kanban.getStatusViewModes(this.scope.projectId);\n this.scope.statusViewModes = {};\n ref = this.scope.usStatusList;\n for (i = 0, len = ref.length; i < len; i++) {\n status = ref[i];\n mode = storedStatusViewModes[status.id] || defaultViewMode;\n this.scope.statusViewModes[status.id] = mode;\n }\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.storeStatusViewModes = function() {\n return this.rs.kanban.storeStatusViewModes(this.scope.projectId, this.scope.statusViewModes);\n };\n\n KanbanController.prototype.updateStatusViewMode = function(statusId, newViewMode) {\n this.scope.statusViewModes[statusId] = newViewMode;\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.isMaximized = function(statusId) {\n var mode;\n mode = this.scope.statusViewModes[statusId] || defaultViewMode;\n return mode === 'maximized';\n };\n\n KanbanController.prototype.isMinimized = function(statusId) {\n var mode;\n mode = this.scope.statusViewModes[statusId] || defaultViewMode;\n return mode === 'minimized';\n };\n\n KanbanController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"kanban_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n KanbanController.prototype.resortUserStories = function(uses) {\n var i, index, item, items, len;\n items = [];\n for (index = i = 0, len = uses.length; i < len; index = ++i) {\n item = uses[index];\n item.kanban_order = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n KanbanController.prototype.moveUs = function(ctx, us, oldStatusId, newStatusId, index) {\n var itemsToSave, promise, r;\n if (oldStatusId !== newStatusId) {\n r = this.scope.usByStatus[oldStatusId].indexOf(us);\n this.scope.usByStatus[oldStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n us.status = newStatusId;\n } else {\n r = this.scope.usByStatus[newStatusId].indexOf(us);\n this.scope.usByStatus[newStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n }\n itemsToSave = this.resortUserStories(this.scope.usByStatus[newStatusId]);\n this.scope.usByStatus[newStatusId] = _.sortBy(this.scope.usByStatus[newStatusId], \"kanban_order\");\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n var data;\n itemsToSave = _.reject(itemsToSave, {\n \"id\": us.id\n });\n data = _this.prepareBulkUpdateData(itemsToSave);\n return _this.rs.userstories.bulkUpdateKanbanOrder(us.project, data).then(function() {\n return itemsToSave;\n });\n };\n })(this));\n return promise;\n };\n\n return KanbanController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"KanbanController\", KanbanController);\n\n KanbanDirective = function($repo, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var tableBodyDom;\n tableBodyDom = $el.find(\".kanban-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".kanban-table-header .kanban-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanban\", [\"$tgRepo\", \"$rootScope\", KanbanDirective]);\n\n KanbanArchivedStatusHeaderDirective = function($rootscope, $translate) {\n var hideArchivedText, link, showArchivedText;\n showArchivedText = $translate.instant(\"KANBAN.ACTION_SHOW_ARCHIVED\");\n hideArchivedText = $translate.instant(\"KANBAN.ACTION_HIDE_ARCHIVED\");\n link = function($scope, $el, $attrs) {\n var hidden, status;\n status = $scope.$eval($attrs.tgKanbanArchivedStatusHeader);\n hidden = true;\n $scope[\"class\"] = \"icon-open-eye\";\n $scope.title = showArchivedText;\n $el.on(\"click\", function(event) {\n hidden = !hidden;\n return $scope.$apply(function() {\n if (hidden) {\n $scope[\"class\"] = \"icon-open-eye\";\n $scope.title = showArchivedText;\n return $rootscope.$broadcast(\"kanban:hide-userstories-for-status\", status.id);\n } else {\n $scope[\"class\"] = \"icon-closed-eye\";\n $scope.title = hideArchivedText;\n return $rootscope.$broadcast(\"kanban:show-userstories-for-status\", status.id);\n }\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanArchivedStatusHeader\", [\"$rootScope\", \"$translate\", KanbanArchivedStatusHeaderDirective]);\n\n KanbanArchivedStatusIntroDirective = function($translate) {\n var link, userStories;\n userStories = [];\n link = function($scope, $el, $attrs) {\n var hiddenUserStoriexText, status, updateIntroText;\n hiddenUserStoriexText = $translate.instant(\"KANBAN.HIDDEN_USER_STORIES\");\n status = $scope.$eval($attrs.tgKanbanArchivedStatusIntro);\n $el.text(hiddenUserStoriexText);\n updateIntroText = function() {\n if (userStories.length > 0) {\n return $el.text(\"\");\n } else {\n return $el.text(hiddenUserStoriexText);\n }\n };\n $scope.$on(\"kanban:us:move\", function(ctx, itemUs, oldStatusId, newStatusId, itemIndex) {\n var r;\n if (status.id === newStatusId) {\n if (status.id === oldStatusId) {\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n userStories.splice(itemIndex, 0, itemUs);\n } else {\n itemUs.isArchived = true;\n userStories.splice(itemIndex, 0, itemUs);\n }\n } else if (status.id === oldStatusId) {\n itemUs.isArchived = false;\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n }\n return updateIntroText();\n });\n $scope.$on(\"kanban:shown-userstories-for-status\", function(ctx, statusId, userStoriesLoaded) {\n if (statusId === status.id) {\n userStories = _.filter(userStoriesLoaded, function(us) {\n return us.status === status.id;\n });\n return updateIntroText();\n }\n });\n $scope.$on(\"kanban:hidden-userstories-for-status\", function(ctx, statusId) {\n if (statusId === status.id) {\n userStories = [];\n return updateIntroText();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanArchivedStatusIntro\", [\"$translate\", KanbanArchivedStatusIntroDirective]);\n\n KanbanUserstoryDirective = function($rootscope, $loading, $rs, $rs2) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"us\", function(us) {\n if (us.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!us.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n $el.on('click', '.icon-edit', function(event) {\n var currentLoading, target, us;\n if ($el.find(\".icon-edit\").hasClass(\"noclick\")) {\n return;\n }\n target = $(event.target);\n currentLoading = $loading().target(target).timeout(200).removeClasses(\"icon-edit\").start();\n us = $model.$modelValue;\n return $rs.userstories.getByRef(us.project, us.ref).then((function(_this) {\n return function(editingUserStory) {\n return $rs2.attachments.list(\"us\", us.id, us.project).then(function(attachments) {\n $rootscope.$broadcast(\"usform:edit\", editingUserStory, attachments.toJS());\n return currentLoading.finish();\n });\n };\n })(this));\n });\n $scope.getTemplateUrl = function() {\n if ($scope.us.isPlaceholder) {\n return \"common/components/kanban-placeholder.html\";\n } else {\n return \"kanban/kanban-task.html\";\n }\n };\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n template: '',\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgKanbanUserstory\", [\"$rootScope\", \"$tgLoading\", \"$tgResources\", \"tgResources\", KanbanUserstoryDirective]);\n\n KanbanSquishColumnDirective = function(rs) {\n var link;\n link = function($scope, $el, $attrs) {\n var updateTableWidth;\n $scope.$on(\"project:loaded\", function(event, project) {\n $scope.folds = rs.kanban.getStatusColumnModes(project.id);\n return updateTableWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.folds[status.id] = !!!$scope.folds[status.id];\n rs.kanban.storeStatusColumnModes($scope.projectId, $scope.folds);\n updateTableWidth();\n };\n return updateTableWidth = function() {\n var columnWidths, totalWidth;\n columnWidths = _.map($scope.usStatusList, function(status) {\n if ($scope.folds[status.id]) {\n return 40;\n } else {\n return 310;\n }\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.kanban-table-inner').css(\"width\", totalWidth);\n };\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanSquishColumn\", [\"$tgResources\", KanbanSquishColumnDirective]);\n\n KanbanWipLimitDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var redrawWipLimit, status;\n $el.disableSelection();\n status = $scope.$eval($attrs.tgKanbanWipLimit);\n redrawWipLimit = (function(_this) {\n return function() {\n $el.find(\".kanban-wip-limit\").remove();\n return timeout(200, function() {\n var element;\n element = $el.find(\".kanban-task\")[status.wip_limit];\n if (element) {\n return angular.element(element).before(\"
\");\n }\n });\n };\n })(this);\n if (status && !status.is_archived) {\n $scope.$on(\"redraw:wip\", redrawWipLimit);\n $scope.$on(\"kanban:us:move\", redrawWipLimit);\n $scope.$on(\"usform:new:success\", redrawWipLimit);\n $scope.$on(\"usform:bulk:success\", redrawWipLimit);\n }\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanWipLimit\", KanbanWipLimitDirective);\n\n KanbanUserDirective = function($log, $compile, $translate) {\n var clickable, link, template;\n template = _.template(\"
\\n class=\\\"not-clickable\\\"<% } %>>\\n \\\" alt=\\\"<%- name %>\\\" class=\\\"avatar\\\">\\n \\n
\");\n clickable = false;\n link = function($scope, $el, $attrs, $model) {\n var render, username_label, wtid;\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.addClass(\"not-clickable\");\n if (!$attrs.tgKanbanUserAvatar) {\n return $log.error(\"KanbanUserDirective: no attr is defined\");\n }\n wtid = $scope.$watch($attrs.tgKanbanUserAvatar, function(v) {\n var user;\n if ($scope.usersById == null) {\n $log.error(\"KanbanUserDirective requires userById set in scope.\");\n return wtid();\n } else {\n user = $scope.usersById[v];\n return render(user);\n }\n });\n render = function(user) {\n var ctx, html;\n if (user === void 0) {\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\",\n clickable: clickable\n };\n } else {\n ctx = {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n };\n }\n html = $compile(template(ctx))($scope);\n $el.html(html);\n return username_label.text(ctx.name);\n };\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n clickable = true;\n $el.on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n };\n })(this));\n username_label.removeClass(\"not-clickable\");\n return username_label.on(\"click\", function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgKanbanUserAvatar\", [\"$log\", \"$compile\", \"$translate\", KanbanUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/kanban/sortable.coffee\n */\n\n(function() {\n var KanbanSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaKanban\");\n\n KanbanSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".kanban-task-inner\",\n dropOnEmpty: true,\n connectWith: \".kanban-uses-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemUs, newStatusId, oldStatusId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemUs = itemEl.scope().us;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n newStatusId = newParentScope.s.id;\n oldStatusId = oldParentScope.s.id;\n if (newStatusId !== oldStatusId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"kanban:us:move\", itemUs, itemUs.status, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n return tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", KanbanSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/detail.coffee\n */\n\n(function() {\n var IssueDetailController, IssuePriorityButtonDirective, IssueSeverityButtonDirective, IssueStatusButtonDirective, IssueStatusDisplayDirective, IssueTypeButtonDirective, PromoteIssueToUsButtonDirective, bindMethods, bindOnce, groupBy, joinStr, mixOf, module, taiga, toString,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaIssues\");\n\n IssueDetailController = (function(superClass) {\n extend(IssueDetailController, superClass);\n\n IssueDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"tgAppMetaService\", \"$tgAnalytics\", \"$tgNavUrls\", \"$translate\"];\n\n function IssueDetailController(scope, rootscope, repo, confirm, rs, params, q, location, log, appMetaService, analytics, navUrls, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.log = log;\n this.appMetaService = appMetaService;\n this.analytics = analytics;\n this.navUrls = navUrls;\n this.translate = translate;\n bindMethods(this);\n this.scope.issueRef = this.params.issueref;\n this.scope.sectionName = this.translate.instant(\"ISSUES.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this._setMeta();\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n IssueDetailController.prototype._setMeta = function() {\n var description, ref, ref1, ref2, ref3, title;\n title = this.translate.instant(\"ISSUE.PAGE_TITLE\", {\n issueRef: \"#\" + this.scope.issue.ref,\n issueSubject: this.scope.issue.subject,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"ISSUE.PAGE_DESCRIPTION\", {\n issueStatus: ((ref = this.scope.statusById[this.scope.issue.status]) != null ? ref.name : void 0) || \"--\",\n issueType: ((ref1 = this.scope.typeById[this.scope.issue.type]) != null ? ref1.name : void 0) || \"--\",\n issueSeverity: ((ref2 = this.scope.severityById[this.scope.issue.severity]) != null ? ref2.name : void 0) || \"--\",\n issuePriority: ((ref3 = this.scope.priorityById[this.scope.issue.priority]) != null ? ref3.name : void 0) || \"--\",\n issueDescription: angular.element(this.scope.issue.description_html || \"\").text()\n });\n return this.appMetaService.setAll(title, description);\n };\n\n IssueDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on issue\", 1);\n };\n })(this));\n this.scope.$on(\"promote-issue-to-us:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"promoteToUserstory\", \"promote issue to userstory\", 1);\n _this.rootscope.$broadcast(\"object:updated\");\n return _this.loadIssue();\n };\n })(this));\n this.scope.$on(\"comment:new\", (function(_this) {\n return function() {\n return _this.loadIssue();\n };\n })(this));\n return this.scope.$on(\"custom-attributes-values:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this));\n };\n\n IssueDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n if (this.scope.project.is_issues_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-issues\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n }\n };\n\n IssueDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.issue_statuses;\n _this.scope.statusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.typeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n _this.scope.typeList = _.sortBy(project.issue_types, \"order\");\n _this.scope.severityList = project.severities;\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = project.priorities;\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadIssue = function() {\n return this.rs.issues.getByRef(this.scope.projectId, this.params.issueref).then((function(_this) {\n return function(issue) {\n var ctx, ref, ref1;\n _this.scope.issue = issue;\n _this.scope.issueId = issue.id;\n _this.scope.commentModel = issue;\n if (((ref = _this.scope.issue.neighbors.previous) != null ? ref.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n if (((ref1 = _this.scope.issue.neighbors.next) != null ? ref1.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.next.ref\n };\n return _this.scope.nextUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.loadIssue();\n };\n })(this));\n };\n\n\n /*\n * Note: This methods (onUpvote() and onDownvote()) are related to tg-vote-button.\n * See app/modules/components/vote-button for more info\n */\n\n IssueDetailController.prototype.onUpvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.upvote(this.scope.issueId).then(onSuccess, onError);\n };\n\n IssueDetailController.prototype.onDownvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.downvote(this.scope.issueId).then(onSuccess, onError);\n };\n\n\n /*\n * Note: This methods (onWatch() and onUnwatch()) are related to tg-watch-button.\n * See app/modules/components/watch-button for more info\n */\n\n IssueDetailController.prototype.onWatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.watch(this.scope.issueId).then(onSuccess, onError);\n };\n\n IssueDetailController.prototype.onUnwatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadIssue();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.issues.unwatch(this.scope.issueId).then(onSuccess, onError);\n };\n\n return IssueDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"IssueDetailController\", IssueDetailController);\n\n IssueStatusDisplayDirective = function($template, $compile) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(issue) {\n var html, status;\n status = $scope.statusById[issue.status];\n html = template({\n is_closed: status.is_closed,\n status: status\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue != null) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueStatusDisplay\", [\"$tgTemplate\", \"$compile\", IssueStatusDisplayDirective]);\n\n IssueStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issues-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, status;\n status = $scope.statusById[issue.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(statusId) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.status = statusId;\n currentLoading = $loading().target($el).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".js-edit-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssueStatusButtonDirective]);\n\n IssueTypeButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issue-type-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, type;\n type = $scope.typeById[issue.type];\n html = template({\n type: type,\n typees: $scope.typeList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(type) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.type = type;\n currentLoading = $loading().target($el.find(\".level-name\")).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".type-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-type\").popover().open();\n });\n $el.on(\"click\", \".type\", function(event) {\n var target, type;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n type = target.data(\"type-id\");\n return save(type);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueTypeButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssueTypeButtonDirective]);\n\n IssueSeverityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issue-severity-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, severity;\n severity = $scope.severityById[issue.severity];\n html = template({\n severity: severity,\n severityes: $scope.severityList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(severity) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.severity = severity;\n currentLoading = $loading().target($el.find(\".level-name\")).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".severity-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-severity\").popover().open();\n });\n $el.on(\"click\", \".severity\", function(event) {\n var severity, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n severity = target.data(\"severity-id\");\n return save(severity);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssueSeverityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssueSeverityButtonDirective]);\n\n IssuePriorityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"issue/issue-priority-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, priority;\n priority = $scope.priorityById[issue.priority];\n html = template({\n priority: priority,\n priorityes: $scope.priorityList,\n editable: isEditable()\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(priority) {\n var currentLoading, issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.priority = priority;\n currentLoading = $loading().target($el.find(\".level-name\")).start();\n onSuccess = function() {\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return currentLoading.finish();\n };\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".priority-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-priority\").popover().open();\n });\n $el.on(\"click\", \".priority\", function(event) {\n var priority, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n priority = target.data(\"priority-id\");\n return save(priority);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgIssuePriorityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", IssuePriorityButtonDirective]);\n\n PromoteIssueToUsButtonDirective = function($rootScope, $repo, $confirm, $qqueue, $translate) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var save;\n save = $qqueue.bindAdd((function(_this) {\n return function(issue, askResponse) {\n var data, onError, onSuccess;\n data = {\n generated_from_issue: issue.id,\n project: issue.project,\n subject: issue.subject,\n description: issue.description,\n tags: issue.tags,\n is_blocked: issue.is_blocked,\n blocked_note: issue.blocked_note\n };\n onSuccess = function() {\n askResponse.finish();\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"promote-issue-to-us:success\");\n };\n onError = function() {\n askResponse.finish();\n return $confirm.notify(\"error\");\n };\n return $repo.create(\"userstories\", data).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \"a\", function(event) {\n var issue, message, subtitle, title;\n event.preventDefault();\n issue = $model.$modelValue;\n title = $translate.instant(\"ISSUES.CONFIRM_PROMOTE.TITLE\");\n message = $translate.instant(\"ISSUES.CONFIRM_PROMOTE.MESSAGE\");\n subtitle = issue.subject;\n return $confirm.ask(title, subtitle, message).then((function(_this) {\n return function(response) {\n return save(issue, response);\n };\n })(this));\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n restrict: \"AE\",\n require: \"ngModel\",\n templateUrl: \"issue/promote-issue-to-us-button.html\",\n link: link\n };\n };\n\n module.directive(\"tgPromoteIssueToUsButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgQqueue\", \"$translate\", PromoteIssueToUsButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkIssuesDirective, CreateIssueDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaIssues\");\n\n CreateIssueDirective = function($repo, $confirm, $rootscope, lightboxService, $loading, $q, attachmentsService) {\n var link;\n link = function($scope, $el, $attrs) {\n var attachmentsToAdd, createAttachments, form, resetAttachments, submit, submitButton;\n form = $el.find(\"form\").checksley();\n $scope.issue = {};\n $scope.attachments = Immutable.List();\n $scope.$on(\"issueform:new\", function(ctx, project) {\n form.reset();\n resetAttachments();\n $el.find(\".tag-input\").val(\"\");\n lightboxService.open($el);\n return $scope.issue = {\n project: project.id,\n subject: \"\",\n status: project.default_issue_status,\n type: project.default_issue_type,\n priority: project.default_priority,\n severity: project.default_severity,\n tags: []\n };\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n createAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToAdd.toJS(), function(attachment) {\n return attachmentsService.upload(attachment.file, obj.id, $scope.issue.project, 'issue');\n });\n return $q.all(promises);\n };\n attachmentsToAdd = Immutable.List();\n resetAttachments = function() {\n attachmentsToAdd = Immutable.List();\n return $scope.attachments = Immutable.List();\n };\n $scope.addAttachment = function(attachment) {\n return attachmentsToAdd = attachmentsToAdd.push(attachment);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.create(\"issues\", $scope.issue);\n promise.then(function(data) {\n return createAttachments(data);\n });\n promise.then(function(data) {\n currentLoading.finish();\n $rootscope.$broadcast(\"issueform:new:success\", data);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateIssue\", [\"$tgRepo\", \"$tgConfirm\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$q\", \"tgAttachmentsService\", CreateIssueDirective]);\n\n CreateBulkIssuesDirective = function($repo, $rs, $confirm, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var form, submit, submitButton;\n form = null;\n $scope.$on(\"issueform:bulk\", function(ctx, projectId, status) {\n if (form) {\n form.reset();\n }\n lightboxService.open($el);\n return $scope[\"new\"] = {\n projectId: projectId,\n bulk: \"\"\n };\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, data, projectId, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n data = $scope[\"new\"].bulk;\n projectId = $scope[\"new\"].projectId;\n promise = $rs.issues.bulkCreate(projectId, data);\n promise.then(function(result) {\n currentLoading.finish();\n $rootscope.$broadcast(\"issueform:new:success\", result);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateBulkIssues\", [\"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkIssuesDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/list.coffee\n */\n\n(function() {\n var IssueAssignedToInlineEditionDirective, IssueStatusInlineEditionDirective, IssuesController, IssuesDirective, IssuesFiltersDirective, bindOnce, debounceLeading, groupBy, joinStr, mixOf, module, startswith, taiga, toString, trim,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounceLeading = this.taiga.debounceLeading;\n\n startswith = this.taiga.startswith;\n\n module = angular.module(\"taigaIssues\");\n\n IssuesController = (function(superClass) {\n extend(IssuesController, superClass);\n\n IssuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$tgUrls\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\"];\n\n function IssuesController(scope, rootscope, repo, confirm, rs, urls, params, q, location, appMetaService, navUrls, events, analytics, translate) {\n var filters, promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.urls = urls;\n this.params = params;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.events = events;\n this.analytics = analytics;\n this.translate = translate;\n this.loadIssues = bind(this.loadIssues, this);\n this.scope.sectionName = \"Issues\";\n this.scope.filters = {};\n if (_.isEmpty(this.location.search())) {\n filters = this.rs.issues.getFilters(this.params.pslug);\n filters.page = 1;\n this.location.search(filters);\n this.location.replace();\n return;\n }\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ISSUES.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"ISSUES.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"issueform:new:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"create\", \"create issue on issues list\", 1);\n return _this.loadIssues();\n };\n })(this));\n }\n\n IssuesController.prototype.initializeSubscription = function() {\n var routingKey;\n routingKey = \"changes.project.\" + this.scope.projectId + \".issues\";\n return this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadIssues();\n };\n })(this));\n };\n\n IssuesController.prototype.storeFilters = function() {\n return this.rs.issues.storeFilters(this.params.pslug, this.location.search());\n };\n\n IssuesController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_issues_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issueStatusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.severityList = _.sortBy(project.severities, \"order\");\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = _.sortBy(project.priorities, \"order\");\n _this.scope.issueTypes = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueTypeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n IssuesController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\", \"tags\", \"status\", \"types\", \"q\", \"severities\", \"priorities\", \"assignedTo\", \"createdBy\", \"orderBy\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n IssuesController.prototype.getUrlFilter = function(name) {\n var filters;\n filters = _.pick(this.location.search(), name);\n return filters[name];\n };\n\n IssuesController.prototype.loadMyFilters = function() {\n return this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n return _.map(filters, function(value, key) {\n return {\n id: key,\n name: key,\n type: \"myFilters\",\n selected: false\n };\n });\n };\n })(this));\n };\n\n IssuesController.prototype.removeNotExistingFiltersFromUrl = function() {\n var currentSearch, existingValues, filterName, filterValue, splittedValues, urlfilters;\n currentSearch = this.location.search();\n urlfilters = this.getUrlFilters();\n for (filterName in urlfilters) {\n filterValue = urlfilters[filterName];\n if (filterName === \"page\" || filterName === \"orderBy\" || filterName === \"q\") {\n continue;\n }\n if (filterName === \"tags\") {\n splittedValues = _.map((\"\" + filterValue).split(\",\"));\n } else {\n splittedValues = _.map((\"\" + filterValue).split(\",\"), function(x) {\n if (x === \"null\") {\n return null;\n } else {\n return parseInt(x);\n }\n });\n }\n existingValues = _.intersection(splittedValues, _.map(this.scope.filters[filterName], \"id\"));\n if (splittedValues.length !== existingValues.length) {\n this.location.search(filterName, existingValues.join());\n }\n }\n if (currentSearch !== this.location.search()) {\n return this.location.replace();\n }\n };\n\n IssuesController.prototype.markSelectedFilters = function(filters, urlfilters) {\n var isSelected, j, key, len, name, obj, ref, ref1, results, searchdata, val, value;\n searchdata = {};\n ref = _.omit(urlfilters, \"page\", \"orderBy\");\n for (name in ref) {\n value = ref[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n ref1 = (\"\" + value).split(\",\");\n for (j = 0, len = ref1.length; j < len; j++) {\n val = ref1[j];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n results = [];\n for (key in filters) {\n value = filters[key];\n results.push((function() {\n var k, len1, results1;\n results1 = [];\n for (k = 0, len1 = value.length; k < len1; k++) {\n obj = value[k];\n results1.push(obj.selected = isSelected(obj.type, obj.id) ? true : void 0);\n }\n return results1;\n })());\n }\n return results;\n };\n\n IssuesController.prototype.loadFilters = function() {\n var loadFilters, promise, urlfilters;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = urlfilters.q;\n }\n promise = this.loadMyFilters().then((function(_this) {\n return function(myFilters) {\n _this.scope.filters.myFilters = myFilters;\n return myFilters;\n };\n })(this));\n loadFilters = {};\n loadFilters.project = this.scope.projectId;\n loadFilters.tags = urlfilters.tags;\n loadFilters.status = urlfilters.status;\n loadFilters.q = urlfilters.q;\n loadFilters.types = urlfilters.types;\n loadFilters.severities = urlfilters.severities;\n loadFilters.priorities = urlfilters.priorities;\n loadFilters.assigned_to = urlfilters.assignedTo;\n loadFilters.owner = urlfilters.createdBy;\n promise = promise.then((function(_this) {\n return function() {\n return _this.rs.issues.filtersData(loadFilters);\n };\n })(this));\n return promise.then((function(_this) {\n return function(data) {\n var choicesFiltersFormat, tagsFilterFormat, usersFiltersFormat;\n usersFiltersFormat = function(users, type, unknownOption) {\n var reformatedUsers, unknownItem;\n reformatedUsers = _.map(users, function(t) {\n t.type = type;\n t.name = t.full_name ? t.full_name : unknownOption;\n return t;\n });\n unknownItem = _.remove(reformatedUsers, function(u) {\n return !u.id;\n });\n reformatedUsers = _.sortBy(reformatedUsers, function(u) {\n return u.name.toUpperCase();\n });\n if (unknownItem.length > 0) {\n reformatedUsers.unshift(unknownItem[0]);\n }\n return reformatedUsers;\n };\n choicesFiltersFormat = function(choices, type, byIdObject) {\n return _.map(choices, function(t) {\n t.type = type;\n return t;\n });\n };\n tagsFilterFormat = function(tags) {\n return _.map(tags, function(t) {\n t.id = t.name;\n t.type = 'tags';\n return t;\n });\n };\n _this.scope.filters.status = choicesFiltersFormat(data.statuses, \"status\", _this.scope.issueStatusById);\n _this.scope.filters.severities = choicesFiltersFormat(data.severities, \"severities\", _this.scope.severityById);\n _this.scope.filters.priorities = choicesFiltersFormat(data.priorities, \"priorities\", _this.scope.priorityById);\n _this.scope.filters.assignedTo = usersFiltersFormat(data.assigned_to, \"assignedTo\", \"Unassigned\");\n _this.scope.filters.createdBy = usersFiltersFormat(data.owners, \"createdBy\", \"Unknown\");\n _this.scope.filters.types = choicesFiltersFormat(data.types, \"types\", _this.scope.issueTypeById);\n _this.scope.filters.tags = tagsFilterFormat(data.tags);\n _this.removeNotExistingFiltersFromUrl();\n _this.markSelectedFilters(_this.scope.filters, urlfilters);\n return _this.rootscope.$broadcast(\"filters:loaded\", _this.scope.filters);\n };\n })(this));\n };\n\n IssuesController.prototype.loadIssuesRequests = 0;\n\n IssuesController.prototype.loadIssues = function() {\n var name, promise, ref, values;\n this.scope.urlFilters = this.getUrlFilters();\n this.scope.httpParams = {};\n ref = this.scope.urlFilters;\n for (name in ref) {\n values = ref[name];\n if (name === \"severities\") {\n name = \"severity\";\n } else if (name === \"orderBy\") {\n name = \"order_by\";\n } else if (name === \"priorities\") {\n name = \"priority\";\n } else if (name === \"assignedTo\") {\n name = \"assigned_to\";\n } else if (name === \"createdBy\") {\n name = \"owner\";\n } else if (name === \"status\") {\n name = \"status\";\n } else if (name === \"types\") {\n name = \"type\";\n }\n this.scope.httpParams[name] = values;\n }\n promise = this.rs.issues.list(this.scope.projectId, this.scope.httpParams);\n this.loadIssuesRequests += 1;\n promise.index = this.loadIssuesRequests;\n promise.then((function(_this) {\n return function(data) {\n if (promise.index === _this.loadIssuesRequests) {\n _this.scope.issues = data.models;\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n }\n return data;\n };\n })(this));\n return promise;\n };\n\n IssuesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n _this.initializeSubscription();\n _this.loadFilters();\n return _this.loadIssues();\n };\n })(this));\n };\n\n IssuesController.prototype.saveCurrentFiltersTo = function(newFilter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n filters[newFilter] = _this.location.search();\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.deleteMyFilter = function(filter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n delete filters[filter];\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.addNewIssue = function() {\n return this.rootscope.$broadcast(\"issueform:new\", this.scope.project);\n };\n\n IssuesController.prototype.addIssuesInBulk = function() {\n return this.rootscope.$broadcast(\"issueform:bulk\", this.scope.projectId);\n };\n\n return IssuesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"IssuesController\", IssuesController);\n\n IssuesDirective = function($log, $location, $template, $compile) {\n var link, linkOrdering, linkPagination, template;\n template = $template.get(\"issue/issue-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".issues-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, html, i, j, numPages, options, pages, ref;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n $pagEl.show();\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = j = 1, ref = numPages; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n html = template(options);\n html = $compile(html)($scope);\n return $pagEl.html(html);\n };\n $scope.$watch(\"issues\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".issues-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadIssues();\n });\n });\n $el.on(\"click\", \".issues-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadIssues();\n });\n });\n return $el.on(\"click\", \".issues-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadIssues();\n });\n });\n };\n linkOrdering = function($scope, $el, $attrs, $ctrl) {\n var colHeadElement, currentOrder, icon;\n currentOrder = $ctrl.getUrlFilter(\"orderBy\") || \"created_date\";\n if (currentOrder) {\n icon = startswith(currentOrder, \"-\") ? \"icon-arrow-up\" : \"icon-arrow-bottom\";\n colHeadElement = $el.find(\".row.title > div[data-fieldname='\" + (trim(currentOrder, \"-\")) + \"']\");\n colHeadElement.html((colHeadElement.html()) + \"\");\n }\n return $el.on(\"click\", \".row.title > div\", function(event) {\n var finalOrder, newOrder, target;\n target = angular.element(event.currentTarget);\n currentOrder = $ctrl.getUrlFilter(\"orderBy\");\n newOrder = target.data(\"fieldname\");\n finalOrder = currentOrder === newOrder ? \"-\" + newOrder : newOrder;\n return $scope.$apply(function() {\n $ctrl.replaceFilter(\"orderBy\", finalOrder);\n $ctrl.storeFilters();\n return $ctrl.loadIssues().then(function() {\n $el.find(\".row.title > div > span.icon\").remove();\n icon = startswith(finalOrder, \"-\") ? \"icon-arrow-up\" : \"icon-arrow-bottom\";\n return target.html((target.html()) + \"\");\n });\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkOrdering($scope, $el, $attrs, $ctrl);\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssues\", [\"$log\", \"$tgLocation\", \"$tgTemplate\", \"$compile\", IssuesDirective]);\n\n IssuesFiltersDirective = function($q, $log, $location, $rs, $confirm, $loading, $template, $translate, $compile, $auth) {\n var link, template, templateSelected;\n template = $template.get(\"issue/issues-filters.html\", true);\n templateSelected = $template.get(\"issue/issues-filters-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, getFiltersType, initializeSelectedFilters, reloadIssues, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection, unwatchIssues;\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\".breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 .subfilter .title\").html(title);\n return $el.find(\"h2 .subfilter .title\").prop(\"data-type\", type);\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\".breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function(filters) {\n var j, len, name, val, values;\n selectedFilters = [];\n for (name in filters) {\n values = filters[name];\n for (j = 0, len = values.length; j < len; j++) {\n val = values[j];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters(selectedFilters);\n };\n renderSelectedFilters = function(selectedFilters) {\n var html;\n _.filter(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n html = $compile(html)($scope);\n $el.find(\".filters-applied\").html(html);\n if ($auth.isAuthenticated() && selectedFilters.length > 0) {\n return $el.find(\".save-filters\").show();\n } else {\n return $el.find(\".save-filters\").hide();\n }\n };\n renderFilters = function(filters) {\n var html;\n _.filter(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n html = $compile(html)($scope);\n return $el.find(\".filter-list\").html(html);\n };\n getFiltersType = function() {\n return $el.find(\".subfilter .title\").prop('data-type');\n };\n reloadIssues = function() {\n var currentFiltersType;\n currentFiltersType = getFiltersType();\n return $q.all([$ctrl.loadIssues(), $ctrl.loadFilters()]).then(function() {\n var filters;\n filters = $scope.filters[currentFiltersType];\n return renderFilters(_.reject(filters, \"selected\"));\n });\n };\n toggleFilterSelection = function(type, id) {\n var currentFiltersType, filter, filterId, filters;\n if (type === \"myFilters\") {\n $rs.issues.getMyFilters($scope.projectId).then(function(data) {\n var filters, myFilters;\n myFilters = data;\n filters = myFilters[id];\n filters.page = 1;\n $ctrl.replaceAllFilters(filters);\n $ctrl.storeFilters();\n $ctrl.loadIssues();\n $ctrl.markSelectedFilters($scope.filters, filters);\n return initializeSelectedFilters($scope.filters);\n });\n return null;\n }\n filters = $scope.filters[type];\n filterId = type === 'tags' ? taiga.toString(id) : id;\n filter = _.find(filters, {\n id: filterId\n });\n filter.selected = !filter.selected;\n if (id === null) {\n id = \"null\";\n }\n if (filter.selected) {\n selectedFilters.push(filter);\n $ctrl.selectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n } else {\n selectedFilters = _.reject(selectedFilters, function(f) {\n return f.id === filter.id && f.type === filter.type;\n });\n $ctrl.unselectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n }\n reloadIssues();\n renderSelectedFilters(selectedFilters);\n currentFiltersType = getFiltersType();\n if (type === currentFiltersType) {\n return renderFilters(_.reject(filters, \"selected\"));\n }\n };\n $scope.$on(\"filters:loaded\", function(ctx, filters) {\n return initializeSelectedFilters(filters);\n });\n $scope.$on(\"filters:issueupdate\", function(ctx, filters) {\n var html;\n html = template({\n filters: filters.status\n });\n html = $compile(html)($scope);\n return $el.find(\".filter-list\").html(html);\n });\n selectQFilter = debounceLeading(100, function(value, oldValue) {\n if (value === void 0 || value === oldValue) {\n return;\n }\n $ctrl.replaceFilter(\"page\", null, true);\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n $ctrl.storeFilters();\n } else {\n $ctrl.replaceFilter(\"q\", value);\n $ctrl.storeFilters();\n }\n return reloadIssues();\n });\n unwatchIssues = $scope.$watch(\"issues\", function(newValue) {\n if (!_.isUndefined(newValue)) {\n $scope.$watch(\"filtersQ\", selectQFilter);\n return unwatchIssues();\n }\n });\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data(\"type\"));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories($el);\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass(\"active\");\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n if (type === \"myFilters\") {\n target.removeClass(\"active\");\n }\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter .remove-filter\", function(event) {\n var customFilterName, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n customFilterName = target.parent().data('id');\n title = $translate.instant(\"ISSUES.FILTERS.CONFIRM_DELETE.TITLE\");\n message = $translate.instant(\"ISSUES.FILTERS.CONFIRM_DELETE.MESSAGE\", {\n customFilterName: customFilterName\n });\n return $confirm.askOnDelete(title, message).then(function(askResponse) {\n var promise;\n promise = $ctrl.deleteMyFilter(customFilterName);\n promise.then(function() {\n promise = $ctrl.loadMyFilters();\n promise.then(function(filters) {\n askResponse.finish();\n $scope.filters.myFilters = filters;\n return renderFilters($scope.filters.myFilters);\n });\n return promise.then(null, function() {\n return askResponse.finish();\n });\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n });\n });\n $el.on(\"click\", \".save-filters\", function(event) {\n event.preventDefault();\n renderFilters($scope.filters[\"myFilters\"]);\n showFilters(\"My filters\", \"myFilters\");\n $el.find('.save-filters').hide();\n $el.find('.my-filter-name').removeClass(\"hidden\");\n $el.find('.my-filter-name').focus();\n return $scope.$apply();\n });\n return $el.on(\"keyup\", \".my-filter-name\", function(event) {\n var currentLoading, newFilter, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newFilter = target.val();\n currentLoading = $loading().target($el.find(\".new\")).start();\n promise = $ctrl.saveCurrentFiltersTo(newFilter);\n promise.then(function() {\n var loadPromise;\n loadPromise = $ctrl.loadMyFilters();\n loadPromise.then(function(filters) {\n var currentfilterstype;\n currentLoading.finish();\n $scope.filters.myFilters = filters;\n currentfilterstype = $el.find(\"h2 .subfilter .title\").prop('data-type');\n if (currentfilterstype === \"myFilters\") {\n renderFilters($scope.filters.myFilters);\n }\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n });\n return loadPromise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\", \"Error loading custom filters\");\n });\n });\n return promise.then(null, function() {\n currentLoading.finish();\n $el.find(\".my-filter-name\").val(newFilter).focus().select();\n return $confirm.notify(\"error\", \"Filter not saved\");\n });\n } else if (event.keyCode === 27) {\n $el.find('.my-filter-name').val('');\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssuesFilters\", [\"$q\", \"$log\", \"$tgLocation\", \"$tgResources\", \"$tgConfirm\", \"$tgLoading\", \"$tgTemplate\", \"$translate\", \"$compile\", \"$tgAuth\", IssuesFiltersDirective]);\n\n IssueStatusInlineEditionDirective = function($repo, $template, $rootscope) {\n\n /*\n Print the status of an Issue and a popover to change it.\n - tg-issue-status-inline-edition: The issue\n \n Example:\n \n div.status(tg-issue-status-inline-edition=\"issue\")\n a.issue-status(href=\"\")\n \n NOTE: This directive need 'issueStatusById' and 'project'.\n */\n var link, selectionTemplate, updateIssueStatus;\n selectionTemplate = $template.get(\"issue/issue-status-inline-edition-selection.html\", true);\n updateIssueStatus = function($el, issue, issueStatusById) {\n var issueStatusDom, issueStatusDomParent, status;\n issueStatusDomParent = $el.find(\".issue-status\");\n issueStatusDom = $el.find(\".issue-status .issue-status-bind\");\n status = issueStatusById[issue.status];\n if (status) {\n issueStatusDom.text(status.name);\n issueStatusDom.prop(\"title\", status.name);\n return issueStatusDomParent.css('color', status.color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, issue;\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueStatusInlineEdition);\n $el.on(\"click\", \".issue-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var filter, j, len, ref, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n ref = $scope.filters.status;\n for (j = 0, len = ref.length; j < len; j++) {\n filter = ref[j];\n if (filter.id === issue.status) {\n filter.count--;\n }\n }\n issue.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateIssueStatus($el, issue, $scope.issueStatusById);\n return $scope.$apply(function() {\n var k, len1, ref1;\n $repo.save(issue).then(function() {\n return $ctrl.loadIssues();\n });\n ref1 = $scope.filters.status;\n for (k = 0, len1 = ref1.length; k < len1; k++) {\n filter = ref1[k];\n if (filter.id === issue.status) {\n filter.count++;\n }\n }\n return $rootscope.$broadcast(\"filters:issueupdate\", $scope.filters);\n });\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.issue_statuses\n }));\n updateIssueStatus($el, issue, $scope.issueStatusById);\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$watch($attrs.tgIssueStatusInlineEdition, (function(_this) {\n return function(val) {\n return updateIssueStatus($el, val, $scope.issueStatusById);\n };\n })(this));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssueStatusInlineEdition\", [\"$tgRepo\", \"$tgTemplate\", \"$rootScope\", IssueStatusInlineEditionDirective]);\n\n IssueAssignedToInlineEditionDirective = function($repo, $rootscope, $translate) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, issue, updateIssue;\n updateIssue = function(issue) {\n var ctx, member;\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\"),\n imgurl: \"/\" + window._version + \"/images/unnamed.png\"\n };\n member = $scope.usersById[issue.assigned_to];\n if (member) {\n ctx.name = member.full_name_display;\n ctx.imgurl = member.photo;\n }\n $el.find(\".avatar\").html(template(ctx));\n return $el.find(\".issue-assignedto\").attr('title', ctx.name);\n };\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueAssignedToInlineEdition);\n updateIssue(issue);\n $el.on(\"click\", \".issue-assignedto\", function(event) {\n return $rootscope.$broadcast(\"assigned-to:add\", issue);\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, updatedIssue) {\n if (updatedIssue.id === issue.id) {\n updatedIssue.assigned_to = userId;\n $repo.save(updatedIssue);\n return updateIssue(updatedIssue);\n }\n };\n })(this));\n $scope.$watch($attrs.tgIssueAssignedToInlineEdition, (function(_this) {\n return function(val) {\n return updateIssue(val);\n };\n })(this));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssueAssignedToInlineEdition\", [\"$tgRepo\", \"$rootScope\", \"$translate\", IssueAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/userstories/detail.coffee\n */\n\n(function() {\n var UsClientRequirementButtonDirective, UsStatusButtonDirective, UsStatusDisplayDirective, UsTeamRequirementButtonDirective, UserStoryDetailController, bindMethods, bindOnce, groupBy, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaUserStories\");\n\n UserStoryDetailController = (function(superClass) {\n extend(UserStoryDetailController, superClass);\n\n UserStoryDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\"];\n\n function UserStoryDetailController(scope, rootscope, repo, confirm, rs, params, q, location, log, appMetaService, navUrls, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.log = log;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.usRef = this.params.usref;\n this.scope.sectionName = this.translate.instant(\"US.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this._setMeta();\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserStoryDetailController.prototype._setMeta = function() {\n var closedTasks, description, progressPercentage, ref, title, totalTasks;\n totalTasks = this.scope.tasks.length;\n closedTasks = _.filter(this.scope.tasks, (function(_this) {\n return function(t) {\n return _this.scope.taskStatusById[t.status].is_closed;\n };\n })(this)).length;\n progressPercentage = totalTasks > 0 ? Math.round(100 * closedTasks / totalTasks) : 0;\n title = this.translate.instant(\"US.PAGE_TITLE\", {\n userStoryRef: \"#\" + this.scope.us.ref,\n userStorySubject: this.scope.us.subject,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"US.PAGE_DESCRIPTION\", {\n userStoryStatus: ((ref = this.scope.statusById[this.scope.us.status]) != null ? ref.name : void 0) || \"--\",\n userStoryPoints: this.scope.us.total_points,\n userStoryDescription: angular.element(this.scope.us.description_html || \"\").text(),\n userStoryClosedTasks: closedTasks,\n userStoryTotalTasks: totalTasks,\n userStoryProgressPercentage: progressPercentage\n });\n return this.appMetaService.setAll(title, description);\n };\n\n UserStoryDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"related-tasks:update\", (function(_this) {\n return function() {\n var allClosed;\n _this.scope.tasks = _.clone(_this.scope.tasks, false);\n allClosed = _.every(_this.scope.tasks, function(task) {\n return task.is_closed;\n });\n if (_this.scope.us.is_closed !== allClosed) {\n return _this.loadUs();\n }\n };\n })(this));\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on userstory\", 1);\n };\n })(this));\n return this.scope.$on(\"comment:new\", (function(_this) {\n return function() {\n return _this.loadUs();\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.us.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-backlog\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-kanban\", ctx);\n }\n };\n\n UserStoryDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.us_statuses;\n _this.scope.statusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.taskStatusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(_this.scope.pointsList, function(e) {\n return e.id;\n });\n return project;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadUs = function() {\n var httpParams, kanbanStaus, milestone, noMilestone;\n httpParams = _.pick(this.location.search(), \"milestone\", \"no-milestone\", \"kanban-status\");\n milestone = httpParams.milestone;\n if (milestone) {\n this.rs.userstories.storeQueryParams(this.scope.projectId, {\n milestone: milestone,\n order_by: \"sprint_order\"\n });\n }\n noMilestone = httpParams[\"no-milestone\"];\n if (noMilestone) {\n this.rs.userstories.storeQueryParams(this.scope.projectId, {\n milestone: \"null\",\n order_by: \"backlog_order\"\n });\n }\n kanbanStaus = httpParams[\"kanban-status\"];\n if (kanbanStaus) {\n this.rs.userstories.storeQueryParams(this.scope.projectId, {\n status: kanbanStaus,\n order_by: \"kanban_order\"\n });\n }\n return this.rs.userstories.getByRef(this.scope.projectId, this.params.usref).then((function(_this) {\n return function(us) {\n var ctx, ref, ref1;\n _this.scope.us = us;\n _this.scope.usId = us.id;\n _this.scope.commentModel = us;\n if (((ref = _this.scope.us.neighbors.previous) != null ? ref.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n if (((ref1 = _this.scope.us.neighbors.next) != null ? ref1.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n return us;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadSprint = function() {\n if (this.scope.us.milestone) {\n return this.rs.sprints.get(this.scope.us.project, this.scope.us.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n UserStoryDetailController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, null, this.scope.usId).then((function(_this) {\n return function(tasks) {\n _this.scope.tasks = tasks;\n return tasks;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.loadUs().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadTasks()]);\n });\n };\n })(this));\n };\n\n\n /*\n * Note: This methods (onUpvote() and onDownvote()) are related to tg-vote-button.\n * See app/modules/components/vote-button for more info\n */\n\n UserStoryDetailController.prototype.onUpvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.upvote(this.scope.usId).then(onSuccess, onError);\n };\n\n UserStoryDetailController.prototype.onDownvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.downvote(this.scope.usId).then(onSuccess, onError);\n };\n\n\n /*\n * Note: This methods (onWatch() and onUnwatch()) are related to tg-watch-button.\n * See app/modules/components/watch-button for more info\n */\n\n UserStoryDetailController.prototype.onWatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.watch(this.scope.usId).then(onSuccess, onError);\n };\n\n UserStoryDetailController.prototype.onUnwatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadUs();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.userstories.unwatch(this.scope.usId).then(onSuccess, onError);\n };\n\n return UserStoryDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserStoryDetailController\", UserStoryDetailController);\n\n UsStatusDisplayDirective = function($template, $compile) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(us) {\n var html, status;\n status = $scope.statusById[us.status];\n html = template({\n is_closed: us.is_closed,\n status: status\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(us) {\n if (us != null) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsStatusDisplay\", [\"$tgTemplate\", \"$compile\", UsStatusDisplayDirective]);\n\n UsStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = (function(_this) {\n return function(us) {\n var html, status;\n status = $scope.statusById[us.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var currentLoading, onError, onSuccess, us;\n us = $model.$modelValue.clone();\n us.status = status;\n $.fn.popover().closeAll();\n currentLoading = $loading().target($el).start();\n onSuccess = function() {\n $model.$setViewValue(us);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n return currentLoading.finish();\n };\n return $repo.save(us).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".js-edit-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var status, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n status = target.data(\"status-id\");\n return save(status);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsStatusButtonDirective]);\n\n UsTeamRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"us/us-team-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n ctx = {\n canEdit: canEdit(),\n isRequired: us.team_requirement\n };\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(team_requirement) {\n var currentLoading, promise, us;\n us = $model.$modelValue.clone();\n us.team_requirement = team_requirement;\n currentLoading = $loading().target($el.find(\"label\")).start();\n promise = $tgrepo.save(us);\n promise.then(function() {\n $model.$setViewValue(us);\n currentLoading.finish();\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n $el.on(\"click\", \".team-requirement\", function(event) {\n var team_requirement;\n if (!canEdit()) {\n return;\n }\n team_requirement = !$model.$modelValue.team_requirement;\n return save(team_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsTeamRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", UsTeamRequirementButtonDirective]);\n\n UsClientRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template, $compile) {\n var link, template;\n template = $template.get(\"us/us-client-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n ctx = {\n canEdit: canEdit(),\n isRequired: us.client_requirement\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(client_requirement) {\n var currentLoading, promise, us;\n us = $model.$modelValue.clone();\n us.client_requirement = client_requirement;\n currentLoading = $loading().target($el.find(\"label\")).start();\n promise = $tgrepo.save(us);\n promise.then(function() {\n $model.$setViewValue(us);\n currentLoading.finish();\n return $rootscope.$broadcast(\"object:updated\");\n });\n return promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n $el.on(\"click\", \".client-requirement\", function(event) {\n var client_requirement;\n if (!canEdit()) {\n return;\n }\n client_requirement = !$model.$modelValue.client_requirement;\n return save(client_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsClientRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$compile\", UsClientRequirementButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/tasks/detail.coffee\n */\n\n(function() {\n var TaskDetailController, TaskIsIocaineButtonDirective, TaskStatusButtonDirective, TaskStatusDisplayDirective, bindMethods, groupBy, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaTasks\");\n\n TaskDetailController = (function(superClass) {\n extend(TaskDetailController, superClass);\n\n TaskDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\"];\n\n function TaskDetailController(scope, rootscope, repo, confirm, rs, params, q, location, log, appMetaService, navUrls, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.log = log;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.translate = translate;\n bindMethods(this);\n this.scope.taskRef = this.params.taskref;\n this.scope.sectionName = this.translate.instant(\"TASK.SECTION_NAME\");\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this._setMeta();\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n TaskDetailController.prototype._setMeta = function() {\n var description, ref, title;\n title = this.translate.instant(\"TASK.PAGE_TITLE\", {\n taskRef: \"#\" + this.scope.task.ref,\n taskSubject: this.scope.task.subject,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"TASK.PAGE_DESCRIPTION\", {\n taskStatus: ((ref = this.scope.statusById[this.scope.task.status]) != null ? ref.name : void 0) || \"--\",\n taskDescription: angular.element(this.scope.task.description_html || \"\").text()\n });\n return this.appMetaService.setAll(title, description);\n };\n\n TaskDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on task\", 1);\n };\n })(this));\n this.scope.$on(\"custom-attributes-values:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this));\n return this.scope.$on(\"comment:new\", (function(_this) {\n return function() {\n return _this.loadTask();\n };\n })(this));\n };\n\n TaskDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.task.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else if (this.scope.task.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n if (this.scope.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n }\n };\n\n TaskDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.task_statuses;\n _this.scope.statusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadTask = function() {\n return this.rs.tasks.getByRef(this.scope.projectId, this.params.taskref).then((function(_this) {\n return function(task) {\n var ctx, ref, ref1;\n _this.scope.task = task;\n _this.scope.taskId = task.id;\n _this.scope.commentModel = task;\n if (((ref = _this.scope.task.neighbors.previous) != null ? ref.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n if (((ref1 = _this.scope.task.neighbors.next) != null ? ref1.ref : void 0) != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n return task;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadSprint = function() {\n if (this.scope.task.milestone) {\n return this.rs.sprints.get(this.scope.task.project, this.scope.task.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadUserStory = function() {\n if (this.scope.task.user_story) {\n return this.rs.userstories.get(this.scope.task.project, this.scope.task.user_story).then((function(_this) {\n return function(us) {\n _this.scope.us = us;\n return us;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.loadTask().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadUserStory()]);\n });\n };\n })(this));\n };\n\n\n /*\n * Note: This methods (onUpvote() and onDownvote()) are related to tg-vote-button.\n * See app/modules/components/vote-button for more info\n */\n\n TaskDetailController.prototype.onUpvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.upvote(this.scope.taskId).then(onSuccess, onError);\n };\n\n TaskDetailController.prototype.onDownvote = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.downvote(this.scope.taskId).then(onSuccess, onError);\n };\n\n\n /*\n * Note: This methods (onWatch() and onUnwatch()) are related to tg-watch-button.\n * See app/modules/components/watch-button for more info\n */\n\n TaskDetailController.prototype.onWatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.watch(this.scope.taskId).then(onSuccess, onError);\n };\n\n TaskDetailController.prototype.onUnwatch = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.loadTask();\n return _this.rootscope.$broadcast(\"object:updated\");\n };\n })(this);\n onError = (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this);\n return this.rs.tasks.unwatch(this.scope.taskId).then(onSuccess, onError);\n };\n\n return TaskDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskDetailController\", TaskDetailController);\n\n TaskStatusDisplayDirective = function($template, $compile) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(task) {\n var html, status;\n status = $scope.statusById[task.status];\n html = template({\n is_closed: status.is_closed,\n status: status\n });\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(task) {\n if (task != null) {\n return render(task);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgTaskStatusDisplay\", [\"$tgTemplate\", \"$compile\", TaskStatusDisplayDirective]);\n\n TaskStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $compile, $translate, $template) {\n var link, template;\n template = $template.get(\"us/us-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = (function(_this) {\n return function(task) {\n var html, status;\n status = $scope.statusById[task.status];\n html = $compile(template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n }))($scope);\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var currentLoading, onError, onSuccess, task;\n task = $model.$modelValue.clone();\n task.status = status;\n currentLoading = $loading().target($el).start();\n onSuccess = function() {\n $model.$setViewValue(task);\n $rootScope.$broadcast(\"object:updated\");\n return currentLoading.finish();\n };\n onError = function() {\n $confirm.notify(\"error\");\n return currentLoading.finish();\n };\n return $repo.save(task).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".js-edit-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n $.fn.popover().closeAll();\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgTaskStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$compile\", \"$translate\", \"$tgTemplate\", TaskStatusButtonDirective]);\n\n TaskIsIocaineButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $compile, $template) {\n var link, template;\n template = $template.get(\"issue/iocaine-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = function(task) {\n var ctx, html;\n if (!isEditable() && !task.is_iocaine) {\n $el.html(\"\");\n return;\n }\n ctx = {\n isIocaine: task.is_iocaine,\n isEditable: isEditable()\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(is_iocaine) {\n var currentLoading, promise, task;\n task = $model.$modelValue.clone();\n task.is_iocaine = is_iocaine;\n currentLoading = $loading().target($el.find('label')).start();\n promise = $tgrepo.save(task);\n promise.then(function() {\n $model.$setViewValue(task);\n return $rootscope.$broadcast(\"object:updated\");\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n };\n })(this));\n $el.on(\"click\", \".is-iocaine\", function(event) {\n var is_iocaine;\n if (!isEditable()) {\n return;\n }\n is_iocaine = !$model.$modelValue.is_iocaine;\n return save(is_iocaine);\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgTaskIsIocaineButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$compile\", \"$tgTemplate\", TaskIsIocaineButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/team/main.coffee\n */\n\n(function() {\n var LeaveProjectDirective, TeamController, TeamFiltersDirective, TeamMemberCurrentUserDirective, TeamMemberStatsDirective, TeamMembersDirective, membersFilter, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n module = angular.module(\"taigaTeam\");\n\n TeamController = (function(superClass) {\n extend(TeamController, superClass);\n\n TeamController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$location\", \"$tgNavUrls\", \"tgAppMetaService\", \"$tgAuth\", \"$translate\", \"tgProjectService\"];\n\n function TeamController(scope, rootscope, repo, rs, params, q, location, navUrls, appMetaService, auth, translate, projectService) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.auth = auth;\n this.translate = translate;\n this.projectService = projectService;\n this.scope.sectionName = \"TEAM.SECTION_NAME\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"TEAM.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"TEAM.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n TeamController.prototype.setRole = function(role) {\n if (role) {\n return this.scope.filtersRole = role;\n } else {\n return this.scope.filtersRole = null;\n }\n };\n\n TeamController.prototype.loadMembers = function() {\n var i, len, member, ref, user;\n user = this.auth.getUser();\n this.scope.totals = {};\n ref = this.scope.activeUsers;\n for (i = 0, len = ref.length; i < len; i++) {\n member = ref[i];\n this.scope.totals[member.id] = 0;\n }\n this.scope.currentUser = _.find(this.scope.activeUsers, {\n id: user != null ? user.id : void 0\n });\n return this.scope.memberships = _.reject(this.scope.activeUsers, {\n id: user != null ? user.id : void 0\n });\n };\n\n TeamController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issuesEnabled = project.is_issues_activated;\n _this.scope.tasksEnabled = project.is_kanban_activated || project.is_backlog_activated;\n _this.scope.wikiEnabled = project.is_wiki_activated;\n _this.scope.owner = project.owner.id;\n return project;\n };\n })(this));\n };\n\n TeamController.prototype.loadMemberStats = function() {\n return this.rs.projects.memberStats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n var totals;\n totals = {};\n _.forEach(_this.scope.totals, function(total, userId) {\n var vals;\n vals = _.map(stats, function(memberStats, statsKey) {\n return memberStats[userId];\n });\n total = _.reduce(vals, function(sum, el) {\n return sum + el;\n });\n return _this.scope.totals[userId] = total;\n });\n _this.scope.stats = _this._processStats(stats);\n return _this.scope.stats.totals = _this.scope.totals;\n };\n })(this));\n };\n\n TeamController.prototype._processStat = function(stat) {\n var key, max, min, singleStat, value;\n max = _.max(_.toArray(stat));\n min = _.min(_.toArray(stat));\n singleStat = Object();\n for (key in stat) {\n if (!hasProp.call(stat, key)) continue;\n value = stat[key];\n if (value === min) {\n singleStat[key] = 0.1;\n } else if (value === max) {\n singleStat[key] = 1;\n } else {\n singleStat[key] = (value * 0.5) / max;\n }\n }\n return singleStat;\n };\n\n TeamController.prototype._processStats = function(stats) {\n var key, value;\n for (key in stats) {\n value = stats[key];\n stats[key] = this._processStat(value);\n }\n return stats;\n };\n\n TeamController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n var userRoles;\n _this.fillUsersAndRoles(project.members, project.roles);\n _this.loadMembers();\n userRoles = _.map(_this.scope.users, function(user) {\n return user.role;\n });\n _this.scope.roles = _.filter(_this.scope.roles, function(role) {\n return userRoles.indexOf(role.id) !== -1;\n });\n return _this.loadMemberStats();\n };\n })(this));\n };\n\n return TeamController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TeamController\", TeamController);\n\n TeamFiltersDirective = function() {\n return {\n templateUrl: \"team/team-filter.html\"\n };\n };\n\n module.directive(\"tgTeamFilters\", [TeamFiltersDirective]);\n\n TeamMemberStatsDirective = function() {\n return {\n templateUrl: \"team/team-member-stats.html\",\n scope: {\n stats: \"=\",\n userId: \"=user\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamMemberStats\", TeamMemberStatsDirective);\n\n TeamMemberCurrentUserDirective = function() {\n return {\n templateUrl: \"team/team-member-current-user.html\",\n scope: {\n project: \"=project\",\n currentUser: \"=currentuser\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\",\n owner: \"=owner\"\n }\n };\n };\n\n module.directive(\"tgTeamCurrentUser\", TeamMemberCurrentUserDirective);\n\n TeamMembersDirective = function() {\n var template;\n template = \"team/team-members.html\";\n return {\n templateUrl: template,\n scope: {\n memberships: \"=\",\n filtersQ: \"=filtersq\",\n filtersRole: \"=filtersrole\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\",\n owner: \"=owner\"\n }\n };\n };\n\n module.directive(\"tgTeamMembers\", TeamMembersDirective);\n\n LeaveProjectDirective = function($repo, $confirm, $location, $rs, $navurls, $translate, lightboxFactory, currentUserService) {\n var link;\n link = function($scope, $el, $attrs) {\n var leaveConfirm;\n leaveConfirm = function() {\n var confirm_leave_project_text, leave_project_text;\n leave_project_text = $translate.instant(\"TEAM.ACTION_LEAVE_PROJECT\");\n confirm_leave_project_text = $translate.instant(\"TEAM.CONFIRM_LEAVE_PROJECT\");\n return $confirm.ask(leave_project_text, confirm_leave_project_text).then((function(_this) {\n return function(response) {\n var promise;\n promise = $rs.projects.leave($scope.project.id);\n promise.then(function() {\n return currentUserService.loadProjects().then(function() {\n response.finish();\n $confirm.notify(\"success\");\n return $location.path($navurls.resolve(\"home\"));\n });\n });\n return promise.then(null, function(response) {\n response.finish();\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n };\n return $scope.leave = function() {\n if ($scope.project.owner.id === $scope.user.id) {\n return lightboxFactory.create(\"tg-lightbox-leave-project-warning\", {\n \"class\": \"lightbox lightbox-leave-project-warning\"\n }, {\n isCurrentUser: true,\n project: $scope.project\n });\n } else {\n return leaveConfirm();\n }\n };\n };\n return {\n scope: {\n user: \"=\",\n project: \"=\"\n },\n templateUrl: \"team/leave-project.html\",\n link: link\n };\n };\n\n module.directive(\"tgLeaveProject\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"$tgResources\", \"$tgNavUrls\", \"$translate\", \"tgLightboxFactory\", \"tgCurrentUserService\", LeaveProjectDirective]);\n\n membersFilter = function() {\n return function(members, filtersQ, filtersRole) {\n return _.filter(members, function(m) {\n return (!filtersRole || m.role === filtersRole.id) && (!filtersQ || m.full_name.search(new RegExp(filtersQ, \"i\")) >= 0);\n });\n };\n };\n\n module.filter('membersFilter', membersFilter);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/wiki/detail.coffee\n */\n\n(function() {\n var EditableWikiContentDirective, WikiDetailController, WikiSummaryDirective, bindOnce, debounce, groupBy, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaWiki\");\n\n WikiDetailController = (function(superClass) {\n extend(WikiDetailController, superClass);\n\n WikiDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgModel\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$filter\", \"$log\", \"tgAppMetaService\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\"];\n\n function WikiDetailController(scope, rootscope, repo, model, confirm, rs, params, q, location, filter, log, appMetaService, navUrls, analytics, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.model = model;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.filter = filter;\n this.log = log;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.translate = translate;\n this.scope.projectSlug = this.params.pslug;\n this.scope.wikiSlug = this.params.slug;\n this.scope.wikiTitle = this.scope.wikiSlug;\n this.scope.sectionName = \"Wiki\";\n this.scope.linksVisible = false;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this._setMeta();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n WikiDetailController.prototype._setMeta = function() {\n var description, ref, ref1, ref2, title;\n title = this.translate.instant(\"WIKI.PAGE_TITLE\", {\n wikiPageName: this.scope.wikiTitle,\n projectName: this.scope.project.name\n });\n description = this.translate.instant(\"WIKI.PAGE_DESCRIPTION\", {\n wikiPageContent: angular.element(((ref = this.scope.wiki) != null ? ref.html : void 0) || \"\").text(),\n totalEditions: ((ref1 = this.scope.wiki) != null ? ref1.editions : void 0) || 0,\n lastModifiedDate: moment((ref2 = this.scope.wiki) != null ? ref2.modified_date : void 0).format(this.translate.instant(\"WIKI.DATETIME\"))\n });\n return this.appMetaService.setAll(title, description);\n };\n\n WikiDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.is_wiki_activated) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWiki = function() {\n var promise;\n promise = this.rs.wiki.getBySlug(this.scope.projectId, this.params.slug);\n promise.then((function(_this) {\n return function(wiki) {\n _this.scope.wiki = wiki;\n _this.scope.wikiId = wiki.id;\n return _this.scope.wiki;\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function(xhr) {\n var data;\n _this.scope.wikiId = null;\n if (_this.scope.project.my_permissions.indexOf(\"add_wiki_page\") === -1) {\n return null;\n }\n data = {\n project: _this.scope.projectId,\n slug: _this.scope.wikiSlug,\n content: \"\"\n };\n _this.scope.wiki = _this.model.make_model(\"wiki\", data);\n return _this.scope.wiki;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWikiLinks = function() {\n return this.rs.wiki.listLinks(this.scope.projectId).then((function(_this) {\n return function(wikiLinks) {\n var selectedWikiLink;\n _this.scope.wikiLinks = wikiLinks;\n selectedWikiLink = _.find(wikiLinks, {\n href: _this.scope.wikiSlug\n });\n if (selectedWikiLink != null) {\n return _this.scope.wikiTitle = selectedWikiLink.title;\n }\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.members, project.roles);\n return _this.q.all([_this.loadWikiLinks(), _this.loadWiki()]).then(_this.checkLinksPerms.bind(_this));\n };\n })(this));\n };\n\n WikiDetailController.prototype.checkLinksPerms = function() {\n if (this.scope.project.my_permissions.indexOf(\"modify_wiki_link\") !== -1 || (this.scope.project.my_permissions.indexOf(\"view_wiki_links\") !== -1 && this.scope.wikiLinks.length)) {\n return this.scope.linksVisible = true;\n }\n };\n\n WikiDetailController.prototype[\"delete\"] = function() {\n var message, title;\n title = this.translate.instant(\"WIKI.DELETE_LIGHTBOX_TITLE\");\n message = this.scope.wikiTitle;\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSuccess;\n onSuccess = function() {\n var ctx;\n askResponse.finish();\n ctx = {\n project: _this.scope.projectSlug\n };\n _this.location.path(_this.navUrls.resolve(\"project-wiki\", ctx));\n return _this.confirm.notify(\"success\");\n };\n onError = function() {\n askResponse.finish(false);\n return _this.confirm.notify(\"error\");\n };\n return _this.repo.remove(_this.scope.wiki).then(onSuccess, onError);\n };\n })(this));\n };\n\n return WikiDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"WikiDetailController\", WikiDetailController);\n\n WikiSummaryDirective = function($log, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"wiki/wiki-summary.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var render;\n render = function(wiki) {\n var ctx, html, user;\n if ($scope.usersById == null) {\n $log.error(\"WikiSummaryDirective requires userById set in scope.\");\n } else {\n user = $scope.usersById[wiki.last_modifier];\n }\n if (user === void 0) {\n user = {\n name: \"unknown\",\n imgUrl: \"/\" + window._version + \"/images/user-noimage.png\"\n };\n } else {\n user = {\n name: user.full_name_display,\n imgUrl: user.photo\n };\n }\n ctx = {\n totalEditions: wiki.editions,\n lastModifiedDate: moment(wiki.modified_date).format($translate.instant(\"WIKI.DATETIME\")),\n user: user\n };\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n return render(wikiPage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgWikiSummary\", [\"$log\", \"$tgTemplate\", \"$compile\", \"$translate\", WikiSummaryDirective]);\n\n EditableWikiContentDirective = function($window, $document, $repo, $confirm, $loading, $analytics, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var cancelEdition, disableEdition, getSelectedText, isEditable, save, switchToEditMode, switchToReadMode;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_wiki_page\") !== -1;\n };\n switchToEditMode = function() {\n $el.find('.edit-wiki-content').show();\n $el.find('.view-wiki-content').hide();\n return $el.find('textarea').focus();\n };\n switchToReadMode = function() {\n $el.find('.edit-wiki-content').hide();\n return $el.find('.view-wiki-content').show();\n };\n disableEdition = function() {\n $el.find(\".view-wiki-content .edit\").remove();\n return $el.find(\".edit-wiki-content\").remove();\n };\n cancelEdition = function() {\n if (!$model.$modelValue.id) {\n return;\n }\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n return switchToReadMode();\n };\n getSelectedText = function() {\n if ($window.getSelection) {\n return $window.getSelection().toString();\n } else if ($document.selection) {\n return $document.selection.createRange().text;\n }\n return null;\n };\n save = $qqueue.bindAdd(function(wiki) {\n var currentLoading, onError, onSuccess, promise;\n onSuccess = function(wikiPage) {\n if (wiki.id == null) {\n $analytics.trackEvent(\"wikipage\", \"create\", \"create wiki page\", 1);\n }\n $model.$setViewValue(wikiPage.clone());\n $confirm.notify(\"success\");\n return switchToReadMode();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n currentLoading = $loading().removeClasses(\"icon-floppy\").target($el.find('.icon-floppy')).start();\n if (wiki.id != null) {\n promise = $repo.save(wiki).then(onSuccess, onError);\n } else {\n promise = $repo.create(\"wiki\", wiki).then(onSuccess, onError);\n }\n return promise[\"finally\"](function() {\n return currentLoading.finish();\n });\n });\n $el.on(\"click\", \"a\", function(event) {\n var href, target;\n target = angular.element(event.target);\n href = target.attr('href');\n if (href.indexOf(\"#\") === 0) {\n event.preventDefault();\n return $('body').scrollTop($(href).offset().top);\n }\n });\n $el.on(\"mousedown\", \".view-wiki-content\", function(event) {\n var target;\n target = angular.element(event.target);\n if (!isEditable()) {\n return;\n }\n if (event.button === 2) {\n\n }\n });\n $el.on(\"mouseup\", \".view-wiki-content\", function(event) {\n var target;\n target = angular.element(event.target);\n if (getSelectedText()) {\n return;\n }\n if (!isEditable()) {\n return;\n }\n if (target.is('a')) {\n return;\n }\n if (target.is('pre')) {\n return;\n }\n return switchToEditMode();\n });\n $el.on(\"click\", \".save\", debounce(2000, function() {\n return save($scope.wiki);\n }));\n $el.on(\"click\", \".cancel\", function() {\n return cancelEdition();\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n return cancelEdition();\n }\n });\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n if (isEditable()) {\n $el.addClass('editable');\n if ((wikiPage.id == null) || $.trim(wikiPage.content).length === 0) {\n return switchToEditMode();\n }\n } else {\n return disableEdition();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n templateUrl: \"wiki/editable-wiki-content.html\"\n };\n };\n\n module.directive(\"tgEditableWikiContent\", [\"$window\", \"$document\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgAnalytics\", \"$tgQqueue\", EditableWikiContentDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/wiki/detail.coffee\n */\n\n(function() {\n var WikiNavDirective, bindOnce, groupBy, mixOf, module, taiga;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaWiki\");\n\n WikiNavDirective = function($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $loading, $template, $compile, $translate) {\n var link, template;\n template = $template.get(\"wiki/wiki-nav.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render;\n $ctrl = $el.controller();\n if ($attrs.ngModel == null) {\n return $log.error(\"WikiNavDirective: no ng-model attr is defined\");\n }\n render = function(wikiLinks) {\n var addWikiLinkPermission, deleteWikiLinkPermission, html;\n addWikiLinkPermission = $scope.project.my_permissions.indexOf(\"add_wiki_link\") > -1;\n deleteWikiLinkPermission = $scope.project.my_permissions.indexOf(\"delete_wiki_link\") > -1;\n html = template({\n wikiLinks: wikiLinks,\n projectSlug: $scope.projectSlug,\n addWikiLinkPermission: addWikiLinkPermission,\n deleteWikiLinkPermission: deleteWikiLinkPermission\n });\n html = $compile(html)($scope);\n $el.off();\n $el.html(html);\n $el.on(\"click\", \".wiki-link .link-title\", function(event) {\n var linkId, linkSlug, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n linkSlug = $scope.wikiLinks[linkId].href;\n return $scope.$apply(function() {\n var ctx;\n ctx = {\n project: $scope.projectSlug,\n slug: linkSlug\n };\n return $location.path($navUrls.resolve(\"project-wiki-page\", ctx));\n });\n });\n $el.on(\"click\", \".add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new input\").focus();\n return $el.find(\".add-button\").hide();\n });\n $el.on(\"click\", \".js-delete-link\", function(event) {\n var linkId, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n title = $translate.instant(\"WIKI.DELETE_LIGHTBOX_TITLE\");\n message = $scope.wikiLinks[linkId].title;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var promise;\n promise = $tgrepo.remove($scope.wikiLinks[linkId]);\n promise.then(function() {\n promise = $ctrl.loadWikiLinks();\n promise.then(function() {\n askResponse.finish();\n return render($scope.wikiLinks);\n });\n return promise.then(null, function() {\n return askResponse.finish();\n });\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n });\n return $el.on(\"keyup\", \".new input\", function(event) {\n var currentLoading, newLink, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newLink = target.val();\n currentLoading = $loading().target($el.find(\".new\")).start();\n promise = $tgrepo.create(\"wiki-links\", {\n project: $scope.projectId,\n title: newLink\n });\n promise.then(function() {\n var loadPromise;\n $analytics.trackEvent(\"wikilink\", \"create\", \"create wiki link\", 1);\n loadPromise = $ctrl.loadWikiLinks();\n loadPromise.then(function() {\n currentLoading.finish();\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return render($scope.wikiLinks);\n });\n return loadPromise.then(null, function() {\n currentLoading.finish();\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return $confirm.notify(\"error\", \"Error loading wiki links\");\n });\n });\n return promise.then(null, function(error) {\n var ref;\n currentLoading.finish();\n $el.find(\".new input\").val(newLink);\n $el.find(\".new input\").focus().select();\n if ((error != null ? (ref = error.__all__) != null ? ref[0] : void 0 : void 0) != null) {\n return $confirm.notify(\"error\", \"The link already exists\");\n } else {\n return $confirm.notify(\"error\");\n }\n });\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWikiNav\", [\"$tgRepo\", \"$log\", \"$tgLocation\", \"$tgConfirm\", \"$tgNavUrls\", \"$tgAnalytics\", \"$tgLoading\", \"$tgTemplate\", \"$compile\", \"$translate\", WikiNavDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/lightboxes.coffee\n */\n\n(function() {\n var ChangeOwnerLightboxController, ChangeOwnerLightboxDirective, LbRequestOwnershipDirective, LightboxAddMembersController, LightboxAddMembersDirective, LightboxAddMembersWarningMessageDirective, TransferProjectStartSuccessDirective, debounce, module, taiga;\n\n taiga = this.taiga;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaKanban\");\n\n LightboxAddMembersController = (function() {\n LightboxAddMembersController.$inject = [\"$scope\", \"lightboxService\", \"tgLoader\", \"$tgConfirm\", \"$tgResources\", \"$rootScope\"];\n\n function LightboxAddMembersController(scope1, lightboxService1, tgLoader, confirm, rs1, rootScope) {\n var pendingMembersCount;\n this.scope = scope1;\n this.lightboxService = lightboxService1;\n this.tgLoader = tgLoader;\n this.confirm = confirm;\n this.rs = rs1;\n this.rootScope = rootScope;\n this._defaultMaxInvites = 4;\n this._defaultRole = this.project.roles[0].id;\n this.form = null;\n this.submitInvites = false;\n this.canAddUsers = true;\n this.memberInvites = [];\n if (this.project.max_memberships === null) {\n this.membersLimit = this._defaultMaxInvites;\n } else {\n pendingMembersCount = Math.max(this.project.max_memberships - this.project.total_memberships, 0);\n this.membersLimit = Math.min(pendingMembersCount, this._defaultMaxInvites);\n }\n this.addSingleMember();\n }\n\n LightboxAddMembersController.prototype.addSingleMember = function() {\n this.memberInvites.push({\n email: '',\n role_id: this._defaultRole\n });\n if (this.memberInvites.length >= this.membersLimit) {\n this.canAddUsers = false;\n }\n return this.showWarningMessage = !this.canAddUsers && this.project.total_memberships + this.memberInvites.length === this.project.max_memberships;\n };\n\n LightboxAddMembersController.prototype.removeSingleMember = function(index) {\n this.memberInvites.splice(index, 1);\n this.canAddUsers = true;\n return this.showWarningMessage = this.membersLimit === 1;\n };\n\n LightboxAddMembersController.prototype.submit = function() {\n var promise;\n this.form.initializeFields();\n this.form.reset();\n if (!this.form.validate()) {\n return;\n }\n this.memberInvites = _.filter(this.memberInvites, function(invites) {\n return invites.email !== \"\";\n });\n this.submitInvites = true;\n promise = this.rs.memberships.bulkCreateMemberships(this.project.id, this.memberInvites, this.invitationText);\n return promise.then(this._onSuccessInvite.bind(this), this._onErrorInvite.bind(this));\n };\n\n LightboxAddMembersController.prototype._onSuccessInvite = function() {\n this.submitInvites = false;\n this.rootScope.$broadcast(\"membersform:new:success\");\n this.lightboxService.closeAll();\n return this.confirm.notify(\"success\");\n };\n\n LightboxAddMembersController.prototype._onErrorInvite = function(response) {\n this.submitInvites = false;\n this.form.setErrors(response.data);\n if (response.data._error_message) {\n return this.confirm.notify(\"error\", response.data._error_message);\n }\n };\n\n return LightboxAddMembersController;\n\n })();\n\n module.controller(\"LbAddMembersController\", LightboxAddMembersController);\n\n LightboxAddMembersDirective = function(lightboxService) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n lightboxService.open(el);\n return ctrl.form = el.find(\"form\").checksley();\n };\n return {\n scope: {},\n bindToController: {\n project: '='\n },\n controller: 'LbAddMembersController',\n controllerAs: 'vm',\n templateUrl: 'admin/lightbox-add-members.html',\n link: link\n };\n };\n\n module.directive(\"tgLbAddMembers\", [\"lightboxService\", LightboxAddMembersDirective]);\n\n LightboxAddMembersWarningMessageDirective = function() {\n return {\n templateUrl: \"admin/lightbox-add-members-no-more=memberships-warning-message.html\",\n scope: {\n project: \"=\"\n }\n };\n };\n\n module.directive(\"tgLightboxAddMembersWarningMessage\", [LightboxAddMembersWarningMessageDirective]);\n\n LbRequestOwnershipDirective = function(lightboxService, rs, confirmService, $translate) {\n return {\n link: function(scope, el) {\n lightboxService.open(el);\n return scope.request = function() {\n scope.loading = true;\n return rs.projects.transferRequest(scope.projectId).then(function() {\n scope.loading = false;\n lightboxService.close(el);\n return confirmService.notify(\"success\", $translate.instant(\"ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP_SUCCESS\"));\n });\n };\n },\n templateUrl: \"common/lightbox/lightbox-request-ownership.html\"\n };\n };\n\n module.directive('tgLbRequestOwnership', [\"lightboxService\", \"tgResources\", \"$tgConfirm\", \"$translate\", LbRequestOwnershipDirective]);\n\n ChangeOwnerLightboxController = (function() {\n function ChangeOwnerLightboxController(rs1, lightboxService1, confirm, translate) {\n this.rs = rs1;\n this.lightboxService = lightboxService1;\n this.confirm = confirm;\n this.translate = translate;\n this.users = [];\n this.q = \"\";\n this.commentOpen = false;\n }\n\n ChangeOwnerLightboxController.prototype.limit = 3;\n\n ChangeOwnerLightboxController.prototype.normalizeString = function(normalizedString) {\n normalizedString = normalizedString.replace(\"Á\", \"A\").replace(\"Ä\", \"A\").replace(\"À\", \"A\");\n normalizedString = normalizedString.replace(\"É\", \"E\").replace(\"Ë\", \"E\").replace(\"È\", \"E\");\n normalizedString = normalizedString.replace(\"Í\", \"I\").replace(\"Ï\", \"I\").replace(\"Ì\", \"I\");\n normalizedString = normalizedString.replace(\"Ó\", \"O\").replace(\"Ö\", \"O\").replace(\"Ò\", \"O\");\n normalizedString = normalizedString.replace(\"Ú\", \"U\").replace(\"Ü\", \"U\").replace(\"Ù\", \"U\");\n return normalizedString;\n };\n\n ChangeOwnerLightboxController.prototype.filterUsers = function(user) {\n var text, username;\n username = user.full_name_display.toUpperCase();\n username = this.normalizeString(username);\n text = this.q.toUpperCase();\n text = this.normalizeString(text);\n return _.includes(username, text);\n };\n\n ChangeOwnerLightboxController.prototype.getUsers = function() {\n var users;\n if (!this.users.length && !this.q.length) {\n users = this.activeUsers;\n } else {\n users = this.users;\n }\n users = users.slice(0, this.limit);\n users = _.reject(users, {\n \"selected\": true\n });\n return _.reject(users, {\n \"id\": this.currentOwnerId\n });\n };\n\n ChangeOwnerLightboxController.prototype.userSearch = function() {\n this.users = this.activeUsers;\n this.selected = _.find(this.users, {\n \"selected\": true\n });\n if (this.q) {\n return this.users = _.filter(this.users, this.filterUsers.bind(this));\n }\n };\n\n ChangeOwnerLightboxController.prototype.selectUser = function(user) {\n this.activeUsers = _.map(this.activeUsers, function(user) {\n user.selected = false;\n return user;\n });\n user.selected = true;\n return this.userSearch();\n };\n\n ChangeOwnerLightboxController.prototype.submit = function() {\n this.loading = true;\n return this.rs.projects.transferStart(this.projectId, this.selected.id, this.comment).then((function(_this) {\n return function() {\n var desc, title;\n _this.loading = false;\n _this.lightboxService.closeAll();\n title = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_TITLE\");\n desc = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_DESC\");\n return _this.confirm.success(title, desc, {\n type: \"svg\",\n name: \"icon-speak-up\"\n });\n };\n })(this));\n };\n\n return ChangeOwnerLightboxController;\n\n })();\n\n ChangeOwnerLightboxController.$inject = [\"tgResources\", \"lightboxService\", \"$tgConfirm\", \"$translate\"];\n\n module.controller('ChangeOwnerLightbox', ChangeOwnerLightboxController);\n\n ChangeOwnerLightboxDirective = function(lightboxService, lightboxKeyboardNavigationService, $template, $compile) {\n var link;\n link = function(scope, el) {\n return lightboxService.open(el);\n };\n return {\n scope: true,\n controller: \"ChangeOwnerLightbox\",\n controllerAs: \"vm\",\n bindToController: {\n currentOwnerId: \"=\",\n projectId: \"=\",\n activeUsers: \"=\"\n },\n templateUrl: \"common/lightbox/lightbox-change-owner.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbChangeOwner\", [\"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", ChangeOwnerLightboxDirective]);\n\n TransferProjectStartSuccessDirective = function(lightboxService) {\n var link;\n link = function(scope, el) {\n scope.close = function() {\n return lightboxService.close(el);\n };\n return lightboxService.open(el);\n };\n return {\n templateUrl: \"common/lightbox/lightbox-transfer-project-start-success.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbTransferProjectStartSuccess\", [\"lightboxService\", TransferProjectStartSuccessDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/memberships.coffee\n */\n\n(function() {\n var MembershipsController, MembershipsDirective, MembershipsRowActionsDirective, MembershipsRowAdminCheckboxDirective, MembershipsRowAvatarDirective, MembershipsRowRoleSelectorDirective, NoMoreMembershipsExplanationDirective, bindMethods, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n MembershipsController = (function(superClass) {\n extend(MembershipsController, superClass);\n\n MembershipsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgAppMetaService\", \"$translate\", \"$tgAuth\", \"tgLightboxFactory\"];\n\n function MembershipsController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, analytics, appMetaService, translate, auth, lightboxFactory1) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.analytics = analytics;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.auth = auth;\n this.lightboxFactory = lightboxFactory1;\n bindMethods(this);\n this.scope.project = {};\n this.scope.filters = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.MEMBERSHIPS.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"membersform:new:success\", (function(_this) {\n return function() {\n _this.loadInitialData();\n return _this.analytics.trackEvent(\"membership\", \"create\", \"create memberships on admin\", 1);\n };\n })(this));\n }\n\n MembershipsController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.canAddUsers = project.max_memberships === null || project.max_memberships > project.total_memberships;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadMembers = function() {\n var httpFilters;\n httpFilters = this.getUrlFilters();\n return this.rs.memberships.list(this.scope.projectId, httpFilters).then((function(_this) {\n return function(data) {\n _this.scope.memberships = _.filter(data.models, function(membership) {\n return membership.user === null || membership.is_user_active;\n });\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n return data;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadInitialData = function() {\n return this.loadProject().then((function(_this) {\n return function() {\n return _this.q.all([_this.loadMembers(), _this.auth.refresh()]);\n };\n })(this));\n };\n\n MembershipsController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n MembershipsController.prototype.addNewMembers = function() {\n return this.lightboxFactory.create('tg-lb-add-members', {\n \"class\": \"lightbox lightbox-add-member\",\n \"project\": \"project\"\n }, {\n \"project\": this.scope.project\n });\n };\n\n MembershipsController.prototype.showLimitUsersWarningMessage = function() {\n var icon, message, title;\n title = this.translate.instant(\"ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING\");\n message = this.translate.instant(\"ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING_MESSAGE\", {\n members: this.scope.project.max_memberships\n });\n icon = \"/\" + window._version + \"/svg/icons/team-question.svg\";\n return this.confirm.success(title, message, {\n name: icon,\n type: \"img\"\n });\n };\n\n return MembershipsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"MembershipsController\", MembershipsController);\n\n MembershipsDirective = function($template, $compile) {\n var link, linkPagination, template;\n template = $template.get(\"admin/admin-membership-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".memberships-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, html, i, j, numPages, options, pages, ref;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = j = 1, ref = numPages; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n html = template(options);\n html = $compile(html)($scope);\n $pagEl.html(html);\n return $pagEl.show();\n };\n $scope.$watch(\"memberships\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".memberships-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadMembers();\n });\n });\n $el.on(\"click\", \".memberships-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadMembers();\n });\n });\n return $el.on(\"click\", \".memberships-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadMembers();\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMemberships\", [\"$tgTemplate\", \"$compile\", MembershipsDirective]);\n\n MembershipsRowAvatarDirective = function($log, $template, $translate) {\n var link, template;\n template = $template.get(\"admin/memberships-row-avatar.html\", true);\n link = function($scope, $el, $attrs) {\n var member, pending, render;\n pending = $translate.instant(\"ADMIN.MEMBERSHIP.STATUS_PENDING\");\n render = function(member) {\n var ctx, html;\n ctx = {\n full_name: member.full_name ? member.full_name : \"\",\n email: member.user_email ? member.user_email : member.email,\n imgurl: member.photo ? member.photo : \"/\" + window._version + \"/images/unnamed.png\",\n pending: !member.is_user_active ? pending : \"\",\n isOwner: member.is_owner\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowAvatar == null) {\n return $log.error(\"MembershipsRowAvatarDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAvatar);\n render(member);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowAvatar\", [\"$log\", \"$tgTemplate\", '$translate', MembershipsRowAvatarDirective]);\n\n MembershipsRowAdminCheckboxDirective = function($log, $repo, $confirm, $template, $compile) {\n var link, template;\n template = $template.get(\"admin/admin-memberships-row-checkbox.html\", true);\n link = function($scope, $el, $attrs) {\n var html, member, render;\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n if ($attrs.tgMembershipsRowAdminCheckbox == null) {\n return $log.error(\"MembershipsRowAdminCheckboxDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAdminCheckbox);\n if (member.is_owner) {\n $el.find(\".js-check\").remove();\n return;\n }\n render = function(member) {\n var ctx, html;\n ctx = {\n inputId: \"is-admin-\" + member.id\n };\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n };\n $el.on(\"click\", \":checkbox\", (function(_this) {\n return function(event) {\n var onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function(data) {\n member.revert();\n $el.find(\":checkbox\").prop(\"checked\", member.is_admin);\n return $confirm.notify(\"error\", data.is_admin[0]);\n };\n target = angular.element(event.currentTarget);\n member.is_admin = target.prop(\"checked\");\n return $repo.save(member).then(onSuccess, onError);\n };\n })(this));\n html = render(member);\n if (member.is_admin) {\n return $el.find(\":checkbox\").prop(\"checked\", true);\n }\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowAdminCheckbox\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgTemplate\", \"$compile\", MembershipsRowAdminCheckboxDirective]);\n\n MembershipsRowRoleSelectorDirective = function($log, $repo, $confirm) {\n var link, template;\n template = _.template(\"\");\n link = function($scope, $el, $attrs) {\n var $ctrl, html, member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n roleList: $scope.project.roles,\n selectedRole: member.role\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowRoleSelector == null) {\n return $log.error(\"MembershipsRowRoleSelectorDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowRoleSelector);\n html = render(member);\n $el.on(\"change\", \"select\", (function(_this) {\n return function(event) {\n var newRole, onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n target = angular.element(event.currentTarget);\n newRole = parseInt(target.val(), 10);\n if (member.role !== newRole) {\n member.role = newRole;\n return $repo.save(member).then(onSuccess, onError);\n }\n };\n })(this));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowRoleSelector\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", MembershipsRowRoleSelectorDirective]);\n\n MembershipsRowActionsDirective = function($log, $repo, $rs, $confirm, $compile, $translate, $location, $navUrls, lightboxFactory) {\n var activedTemplate, link, pendingTemplate;\n activedTemplate = \"
\\n
\\n\\n \\n \\n \\n\";\n pendingTemplate = \"\\n\\n\\n \\n \\n \\n\";\n link = function($scope, $el, $attrs) {\n var $ctrl, leaveConfirm, member, render;\n render = function(member) {\n var html;\n if (member.user) {\n html = $compile(activedTemplate)($scope);\n } else {\n html = $compile(pendingTemplate)($scope);\n }\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowActions == null) {\n return $log.error(\"MembershipsRowActionsDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowActions);\n render(member);\n $el.on(\"click\", \".js-resend\", function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function() {\n var text;\n text = $translate.instant(\"ADMIN.MEMBERSHIP.SUCCESS_SEND_INVITATION\", {\n email: $scope.member.email\n });\n return $confirm.notify(\"success\", text);\n };\n onError = function() {\n var text;\n text = $translate.instant(\"ADMIM.MEMBERSHIP.ERROR_SEND_INVITATION\");\n return $confirm.notify(\"error\", text);\n };\n return $rs.memberships.resendInvitation($scope.member.id).then(onSuccess, onError);\n });\n leaveConfirm = function() {\n var defaultMsg, message, title;\n title = $translate.instant(\"ADMIN.MEMBERSHIP.DELETE_MEMBER\");\n defaultMsg = $translate.instant(\"ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE\", {\n email: member.email\n });\n message = member.user ? member.full_name : defaultMsg;\n return $confirm.askOnDelete(title, message).then(function(askResponse) {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n var text;\n askResponse.finish();\n if (member.user !== $scope.user.id) {\n if ($scope.page > 1 && ($scope.count - 1) <= $scope.paginatedBy) {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n }\n $ctrl.loadInitialData();\n } else {\n $location.path($navUrls.resolve(\"home\"));\n }\n text = $translate.instant(\"ADMIN.MEMBERSHIP.SUCCESS_DELETE\", {\n message: message\n });\n return $confirm.notify(\"success\", text, null, 5000);\n };\n })(this);\n onError = (function(_this) {\n return function() {\n var text;\n askResponse.finish(false);\n text = $translate.instant(\"ADMIN.MEMBERSHIP.ERROR_DELETE\", {\n message: message\n });\n return $confirm.notify(\"error\", text);\n };\n })(this);\n return $repo.remove(member).then(onSuccess, onError);\n });\n };\n $el.on(\"click\", \".delete\", function(event) {\n var isCurrentUser;\n event.preventDefault();\n if ($scope.project.owner.id === member.user) {\n isCurrentUser = $scope.user.id === member.user;\n return lightboxFactory.create(\"tg-lightbox-leave-project-warning\", {\n \"class\": \"lightbox lightbox-leave-project-warning\"\n }, {\n isCurrentUser: isCurrentUser,\n project: $scope.project\n });\n } else {\n return leaveConfirm();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowActions\", [\"$log\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$compile\", \"$translate\", \"$tgLocation\", \"$tgNavUrls\", \"tgLightboxFactory\", MembershipsRowActionsDirective]);\n\n NoMoreMembershipsExplanationDirective = function() {\n return {\n templateUrl: \"admin/no-more-memberships-explanation.html\",\n scope: {\n project: \"=\"\n }\n };\n };\n\n module.directive(\"tgNoMoreMembershipsExplanation\", [NoMoreMembershipsExplanationDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/nav.coffee\n */\n\n(function() {\n var AdminNavigationDirective, module;\n\n AdminNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgAdminNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#adminmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaAdmin\");\n\n module.directive(\"tgAdminNavigation\", AdminNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/project-profile.coffee\n */\n\n(function() {\n var AdminProjectChangeOwnerDirective, AdminProjectRequestOwnershipDirective, AdminProjectRestrictionsDirective, CsvExporterController, CsvExporterIssuesController, CsvExporterTasksController, CsvExporterUserstoriesController, CsvIssueDirective, CsvTaskDirective, CsvUsDirective, ProjectDefaultValuesDirective, ProjectExportDirective, ProjectLogoDirective, ProjectLogoModelDirective, ProjectModulesDirective, ProjectProfileController, ProjectProfileDirective, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectProfileController = (function(superClass) {\n extend(ProjectProfileController, superClass);\n\n ProjectProfileController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\", \"$tgAuth\", \"tgCurrentUserService\"];\n\n function ProjectProfileController(scope1, rootscope, repo, confirm, rs, params, q, location, navUrls, appMetaService, translate, tgAuth, currentUserService1) {\n var promise;\n this.scope = scope1;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.tgAuth = tgAuth;\n this.currentUserService = currentUserService1;\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, sectionName, title;\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.PAGE_TITLE\", {\n sectionName: sectionName,\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n _this.appMetaService.setAll(title, description);\n return _this.fillUsersAndRoles(_this.scope.project.members, _this.scope.project.roles);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:loaded\", (function(_this) {\n return function() {\n var description, sectionName, title;\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.PROJECT_PROFILE.PAGE_TITLE\", {\n sectionName: sectionName,\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n }\n\n ProjectProfileController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.prioritiesList = _.sortBy(project.priorities, \"order\");\n _this.scope.severitiesList = _.sortBy(project.severities, \"order\");\n _this.scope.issueTypesList = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectProfileController.prototype.loadInitialData = function() {\n return this.q.all([this.loadProject(), this.tgAuth.refresh()]);\n };\n\n ProjectProfileController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.project);\n };\n\n return ProjectProfileController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectProfileController\", ProjectProfileController);\n\n ProjectProfileDirective = function($repo, $confirm, $loading, $navurls, $location, projectService, currentUserService) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, form, submit, submitButton;\n $ctrl = $el.controller();\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.save($scope.project);\n promise.then(function() {\n var newUrl;\n currentLoading.finish();\n $confirm.notify(\"success\");\n newUrl = $navurls.resolve(\"project-admin-project-profile-details\", {\n project: $scope.project.slug\n });\n $location.path(newUrl);\n $ctrl.loadInitialData();\n projectService.fetchProject();\n return currentUserService.loadProjects();\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectProfile\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgNavUrls\", \"$tgLocation\", \"tgProjectService\", \"tgCurrentUserService\", ProjectProfileDirective]);\n\n ProjectDefaultValuesDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.save($scope.project);\n promise.then(function() {\n currentLoading.finish();\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectDefaultValues\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", ProjectDefaultValuesDirective]);\n\n ProjectModulesDirective = function($repo, $confirm, $loading, projectService) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n submit = (function(_this) {\n return function() {\n var form, promise;\n form = $el.find(\"form\").checksley();\n form.initializeFields();\n form.reset();\n if (!form.validate()) {\n return;\n }\n promise = $repo.save($scope.project);\n promise.then(function() {\n $scope.$emit(\"project:loaded\", $scope.project);\n $confirm.notify(\"success\");\n return projectService.fetchProject();\n });\n return promise.then(null, function(data) {\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this);\n $el.on(\"change\", \".module-activation.module-direct-active input\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"submit\", \"form\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \".icon-save\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"keydown\", \".videoconference-attributes input\", function(e) {\n return e.which !== 32;\n });\n $scope.$watch(\"project.videoconferences\", function(newVal, oldVal) {\n if ((newVal != null) && (oldVal != null) && newVal !== oldVal) {\n return $scope.project.videoconferences_extra_data = \"\";\n }\n });\n $scope.$watch(\"isVideoconferenceActivated\", function(newValue, oldValue) {\n if (newValue === false) {\n $scope.project.videoconferences = null;\n $scope.project.videoconferences_extra_data = \"\";\n if (oldValue === true) {\n return submit();\n }\n }\n });\n return $scope.$watch(\"project\", function(project) {\n if (project.videoconferences != null) {\n return $scope.isVideoconferenceActivated = true;\n } else {\n return $scope.isVideoconferenceActivated = false;\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectModules\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"tgProjectService\", ProjectModulesDirective]);\n\n ProjectExportDirective = function($window, $rs, $confirm, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var asyn_message, buttonsEl, dump_ready_text, hideButtons, hideResult, hideSpinner, loading_msg, loading_title, resultEl, resultMessageEl, resultTitleEl, setAsyncMessage, setAsyncTitle, setLoadingMessage, setLoadingTitle, setSyncMessage, setSyncTitle, showButtons, showErrorMode, showExportResultAsyncMode, showExportResultSyncMode, showLoadingMode, showResult, showSpinner, spinnerEl, syn_message;\n buttonsEl = $el.find(\".admin-project-export-buttons\");\n showButtons = function() {\n return buttonsEl.removeClass(\"hidden\");\n };\n hideButtons = function() {\n return buttonsEl.addClass(\"hidden\");\n };\n resultEl = $el.find(\".admin-project-export-result\");\n showResult = function() {\n return resultEl.removeClass(\"hidden\");\n };\n hideResult = function() {\n return resultEl.addClass(\"hidden\");\n };\n spinnerEl = $el.find(\".spin\");\n showSpinner = function() {\n return spinnerEl.removeClass(\"hidden\");\n };\n hideSpinner = function() {\n return spinnerEl.addClass(\"hidden\");\n };\n resultTitleEl = $el.find(\".result-title\");\n loading_title = $translate.instant(\"ADMIN.PROJECT_EXPORT.LOADING_TITLE\");\n loading_msg = $translate.instant(\"ADMIN.PROJECT_EXPORT.LOADING_MESSAGE\");\n dump_ready_text = function() {\n return resultTitleEl.html($translate.instant(\"ADMIN.PROJECT_EXPORT.DUMP_READY\"));\n };\n asyn_message = function() {\n return resultTitleEl.html($translate.instant(\"ADMIN.PROJECT_EXPORT.ASYNC_MESSAGE\"));\n };\n syn_message = function(url) {\n return resultTitleEl.html($translate.instant(\"ADMIN.PROJECT_EXPORT.SYNC_MESSAGE\", {\n url: url\n }));\n };\n setLoadingTitle = function() {\n return resultTitleEl.html(loading_title);\n };\n setAsyncTitle = function() {\n return resultTitleEl.html(loading_msg);\n };\n setSyncTitle = function() {\n return resultTitleEl.html(dump_ready_text);\n };\n resultMessageEl = $el.find(\".result-message \");\n setLoadingMessage = function() {\n return resultMessageEl.html(loading_msg);\n };\n setAsyncMessage = function() {\n return resultMessageEl.html(asyn_message);\n };\n setSyncMessage = function(url) {\n return resultMessageEl.html(syn_message(url));\n };\n showLoadingMode = function() {\n showSpinner();\n setLoadingTitle();\n setLoadingMessage();\n hideButtons();\n return showResult();\n };\n showExportResultAsyncMode = function() {\n hideSpinner();\n setAsyncTitle();\n return setAsyncMessage();\n };\n showExportResultSyncMode = function(url) {\n hideSpinner();\n setSyncTitle();\n return setSyncMessage(url);\n };\n showErrorMode = function() {\n hideSpinner();\n hideResult();\n return showButtons();\n };\n return $el.on(\"click\", \"a.button-export\", debounce(2000, (function(_this) {\n return function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function(result) {\n var dumpUrl;\n if (result.status === 202) {\n return showExportResultAsyncMode();\n } else {\n dumpUrl = result.data.url;\n showExportResultSyncMode(dumpUrl);\n return $window.open(dumpUrl, \"_blank\");\n }\n };\n onError = function(result) {\n var errorMsg, ref;\n showErrorMode();\n errorMsg = $translate.instant(\"ADMIN.PROJECT_EXPORT.ERROR\");\n if (result.status === 429) {\n errorMsg = $translate.instant(\"ADMIN.PROJECT_EXPORT.ERROR_BUSY\");\n } else if ((ref = result.data) != null ? ref._error_message : void 0) {\n errorMsg = $translate.instant(\"ADMIN.PROJECT_EXPORT.ERROR_BUSY\", {\n message: result.data._error_message\n });\n }\n return $confirm.notify(\"error\", errorMsg);\n };\n showLoadingMode();\n return $rs.projects[\"export\"]($scope.projectId).then(onSuccess, onError);\n };\n })(this)));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectExport\", [\"$window\", \"$tgResources\", \"$tgConfirm\", \"$translate\", ProjectExportDirective]);\n\n CsvExporterController = (function(superClass) {\n extend(CsvExporterController, superClass);\n\n CsvExporterController.$inject = [\"$scope\", \"$rootScope\", \"$tgUrls\", \"$tgConfirm\", \"$tgResources\", \"$translate\"];\n\n function CsvExporterController(scope1, rootscope, urls, confirm, rs, translate) {\n this.scope = scope1;\n this.rootscope = rootscope;\n this.urls = urls;\n this.confirm = confirm;\n this.rs = rs;\n this.translate = translate;\n this._generateUuid = bind(this._generateUuid, this);\n this.setCsvUuid = bind(this.setCsvUuid, this);\n this.rootscope.$on(\"project:loaded\", this.setCsvUuid);\n this.scope.$watch(\"csvUuid\", (function(_this) {\n return function(value) {\n if (value) {\n return _this.scope.csvUrl = _this.urls.resolveAbsolute(_this.type + \"-csv\", value);\n } else {\n return _this.scope.csvUrl = \"\";\n }\n };\n })(this));\n }\n\n CsvExporterController.prototype.setCsvUuid = function() {\n return this.scope.csvUuid = this.scope.project[this.type + \"_csv_uuid\"];\n };\n\n CsvExporterController.prototype._generateUuid = function(response) {\n var promise;\n if (response == null) {\n response = null;\n }\n promise = this.rs.projects[\"regenerate_\" + this.type + \"_csv_uuid\"](this.scope.projectId);\n promise.then((function(_this) {\n return function(data) {\n var ref;\n return _this.scope.csvUuid = (ref = data.data) != null ? ref.uuid : void 0;\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n promise[\"finally\"](function() {\n if (response) {\n return response.finish();\n }\n });\n return promise;\n };\n\n CsvExporterController.prototype.regenerateUuid = function() {\n var subtitle, title;\n if (this.scope.csvUuid) {\n title = this.translate.instant(\"ADMIN.REPORTS.REGENERATE_TITLE\");\n subtitle = this.translate.instant(\"ADMIN.REPORTS.REGENERATE_SUBTITLE\");\n return this.confirm.ask(title, subtitle).then(this._generateUuid);\n } else {\n return this._generateUuid();\n }\n };\n\n return CsvExporterController;\n\n })(taiga.Controller);\n\n CsvExporterUserstoriesController = (function(superClass) {\n extend(CsvExporterUserstoriesController, superClass);\n\n function CsvExporterUserstoriesController() {\n return CsvExporterUserstoriesController.__super__.constructor.apply(this, arguments);\n }\n\n CsvExporterUserstoriesController.prototype.type = \"userstories\";\n\n return CsvExporterUserstoriesController;\n\n })(CsvExporterController);\n\n CsvExporterTasksController = (function(superClass) {\n extend(CsvExporterTasksController, superClass);\n\n function CsvExporterTasksController() {\n return CsvExporterTasksController.__super__.constructor.apply(this, arguments);\n }\n\n CsvExporterTasksController.prototype.type = \"tasks\";\n\n return CsvExporterTasksController;\n\n })(CsvExporterController);\n\n CsvExporterIssuesController = (function(superClass) {\n extend(CsvExporterIssuesController, superClass);\n\n function CsvExporterIssuesController() {\n return CsvExporterIssuesController.__super__.constructor.apply(this, arguments);\n }\n\n CsvExporterIssuesController.prototype.type = \"issues\";\n\n return CsvExporterIssuesController;\n\n })(CsvExporterController);\n\n module.controller(\"CsvExporterUserstoriesController\", CsvExporterUserstoriesController);\n\n module.controller(\"CsvExporterTasksController\", CsvExporterTasksController);\n\n module.controller(\"CsvExporterIssuesController\", CsvExporterIssuesController);\n\n CsvUsDirective = function($translate) {\n var link;\n link = function($scope) {\n return $scope.sectionTitle = \"ADMIN.CSV.SECTION_TITLE_US\";\n };\n return {\n controller: \"CsvExporterUserstoriesController\",\n controllerAs: \"ctrl\",\n templateUrl: \"admin/project-csv.html\",\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgCsvUs\", [\"$translate\", CsvUsDirective]);\n\n CsvTaskDirective = function($translate) {\n var link;\n link = function($scope) {\n return $scope.sectionTitle = \"ADMIN.CSV.SECTION_TITLE_TASK\";\n };\n return {\n controller: \"CsvExporterTasksController\",\n controllerAs: \"ctrl\",\n templateUrl: \"admin/project-csv.html\",\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgCsvTask\", [\"$translate\", CsvTaskDirective]);\n\n CsvIssueDirective = function($translate) {\n var link;\n link = function($scope) {\n return $scope.sectionTitle = \"ADMIN.CSV.SECTION_TITLE_ISSUE\";\n };\n return {\n controller: \"CsvExporterIssuesController\",\n controllerAs: \"ctrl\",\n templateUrl: \"admin/project-csv.html\",\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgCsvIssue\", [\"$translate\", CsvIssueDirective]);\n\n ProjectLogoDirective = function($auth, $model, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, showSizeInfo;\n showSizeInfo = function() {\n return $el.find(\".size-info\").addClass(\"active\");\n };\n onSuccess = function(response) {\n var project;\n project = $model.make_model(\"projects\", response.data);\n $scope.project = project;\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('success');\n };\n onError = function(response) {\n if (response.status === 413) {\n showSizeInfo();\n }\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('error', response.data._error_message);\n };\n $el.on(\"click\", \".js-change-logo\", function() {\n return $el.find(\"#logo-field\").click();\n });\n $el.on(\"change\", \"#logo-field\", function(event) {\n if ($scope.logoAttachment) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.projects.changeLogo($scope.project.id, $scope.logoAttachment).then(onSuccess, onError);\n }\n });\n $el.on(\"click\", \"a.js-use-default-logo\", function(event) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.projects.removeLogo($scope.project.id).then(onSuccess, onError);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectLogo\", [\"$tgAuth\", \"$tgModel\", \"$tgResources\", \"$tgConfirm\", ProjectLogoDirective]);\n\n ProjectLogoModelDirective = function($parse) {\n var link;\n link = function($scope, $el, $attrs) {\n var model, modelSetter;\n model = $parse($attrs.tgProjectLogoModel);\n modelSetter = model.assign;\n return $el.bind('change', function() {\n return $scope.$apply(function() {\n return modelSetter($scope, $el[0].files[0]);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive('tgProjectLogoModel', ['$parse', ProjectLogoModelDirective]);\n\n AdminProjectRestrictionsDirective = function() {\n return {\n scope: {\n \"project\": \"=\"\n },\n templateUrl: \"admin/admin-project-restrictions.html\"\n };\n };\n\n module.directive('tgAdminProjectRestrictions', [AdminProjectRestrictionsDirective]);\n\n AdminProjectRequestOwnershipDirective = function(lightboxFactory) {\n return {\n link: function(scope) {\n return scope.requestOwnership = function() {\n return lightboxFactory.create(\"tg-lb-request-ownership\", {\n \"class\": \"lightbox lightbox-request-ownership\"\n }, {\n projectId: scope.projectId\n });\n };\n },\n scope: {\n \"projectId\": \"=\",\n \"owner\": \"=\"\n },\n templateUrl: \"admin/admin-project-request-ownership.html\"\n };\n };\n\n module.directive('tgAdminProjectRequestOwnership', [\"tgLightboxFactory\", AdminProjectRequestOwnershipDirective]);\n\n AdminProjectChangeOwnerDirective = function(lightboxFactory) {\n return {\n link: function(scope) {\n return scope.changeOwner = function() {\n return lightboxFactory.create(\"tg-lb-change-owner\", {\n \"class\": \"lightbox lightbox-select-user\",\n \"project-id\": \"projectId\",\n \"active-users\": \"activeUsers\",\n \"current-owner-id\": \"currentOwnerId\"\n }, {\n projectId: scope.projectId,\n activeUsers: scope.activeUsers,\n currentOwnerId: scope.owner.id,\n members: scope.members\n });\n };\n },\n scope: {\n \"activeUsers\": \"=\",\n \"projectId\": \"=\",\n \"owner\": \"=\",\n \"members\": \"=\"\n },\n templateUrl: \"admin/admin-project-change-owner.html\"\n };\n };\n\n module.directive('tgAdminProjectChangeOwner', [\"tgLightboxFactory\", AdminProjectChangeOwnerDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/project-profile.coffee\n */\n\n(function() {\n var ColorSelectionDirective, DATE_TYPE, MULTILINE_TYPE, ProjectCustomAttributesController, ProjectCustomAttributesDirective, ProjectValuesController, ProjectValuesDirective, ProjectValuesSectionController, TEXT_TYPE, TYPE_CHOICES, URL_TYPE, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectValuesSectionController = (function(superClass) {\n extend(ProjectValuesSectionController, superClass);\n\n ProjectValuesSectionController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function ProjectValuesSectionController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, sectionName, title;\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.PROJECT_VALUES.PAGE_TITLE\", {\n \"sectionName\": sectionName,\n \"projectName\": _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n ProjectValuesSectionController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectValuesSectionController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise;\n };\n\n return ProjectValuesSectionController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectValuesSectionController\", ProjectValuesSectionController);\n\n ProjectValuesController = (function(superClass) {\n extend(ProjectValuesController, superClass);\n\n ProjectValuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\"];\n\n function ProjectValuesController(scope, rootscope, repo, confirm, rs) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.moveValue = bind(this.moveValue, this);\n this.loadValues = bind(this.loadValues, this);\n this.scope.$on(\"admin:project-values:move\", this.moveValue);\n this.rootscope.$on(\"project:loaded\", this.loadValues);\n }\n\n ProjectValuesController.prototype.loadValues = function() {\n return this.rs[this.scope.resource].listValues(this.scope.projectId, this.scope.type).then((function(_this) {\n return function(values) {\n _this.scope.values = values;\n _this.scope.maxValueOrder = _.maxBy(values, \"order\").order;\n return values;\n };\n })(this));\n };\n\n ProjectValuesController.prototype.moveValue = function(ctx, itemValue, itemIndex) {\n var r, values;\n values = this.scope.values;\n r = values.indexOf(itemValue);\n values.splice(r, 1);\n values.splice(itemIndex, 0, itemValue);\n _.each(values, function(value, index) {\n return value.order = index;\n });\n return this.repo.saveAll(values);\n };\n\n return ProjectValuesController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectValuesController\", ProjectValuesController);\n\n ProjectValuesDirective = function($log, $repo, $confirm, $location, animationFrame, $translate, $rootscope) {\n var link, linkDragAndDrop, linkValue;\n linkDragAndDrop = function($scope, $el, $attrs) {\n var itemEl, newParentScope, oldParentScope, tdom;\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el.find(\".sortable\");\n tdom.sortable({\n handle: \".row.table-main.visualization\",\n dropOnEmpty: true,\n connectWith: \".project-values-body\",\n revert: 400,\n axis: \"y\"\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemValue;\n itemEl = ui.item;\n itemValue = itemEl.scope().value;\n itemIndex = itemEl.index();\n return $scope.$broadcast(\"admin:project-values:move\", itemValue, itemIndex);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n linkValue = function($scope, $el, $attrs) {\n var $ctrl, cancel, goToBottomList, initializeNewValue, initializeTextTranslations, objName, saveNewValue, saveValue, valueType;\n $ctrl = $el.controller();\n valueType = $attrs.type;\n objName = $attrs.objname;\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"is_closed\": false,\n \"is_archived\": false\n };\n };\n initializeTextTranslations = function() {\n return $scope.addNewElementText = $translate.instant(\"ADMIN.PROJECT_VALUES_\" + (objName.toUpperCase()) + \".ACTION_ADD\");\n };\n initializeNewValue();\n initializeTextTranslations();\n $rootscope.$on(\"$translateChangeEnd\", function() {\n return $scope.$evalAsync(initializeTextTranslations);\n });\n goToBottomList = (function(_this) {\n return function(focus) {\n var table;\n if (focus == null) {\n focus = false;\n }\n table = $el.find(\".table-main\");\n $(document.body).scrollTop(table.offset().top + table.height());\n if (focus) {\n return $el.find(\".new-value input:visible\").first().focus();\n }\n };\n })(this);\n saveValue = function(target) {\n var form, formEl, promise, value;\n formEl = target.parents(\"form\");\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n value = formEl.scope().value;\n promise = $repo.save(value);\n promise.then((function(_this) {\n return function() {\n var row;\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n return row.siblings(\".visualization\").removeClass('hidden');\n };\n })(this));\n return promise.then(null, function(data) {\n return form.setErrors(data);\n });\n };\n saveNewValue = function(target) {\n var form, formEl, promise;\n formEl = target.parents(\"form\");\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n $scope.newValue.order = $scope.maxValueOrder ? $scope.maxValueOrder + 1 : 1;\n promise = $repo.create(valueType, $scope.newValue);\n promise.then((function(_this) {\n return function(data) {\n target.addClass(\"hidden\");\n $scope.values.push(data);\n $scope.maxValueOrder = data.order;\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n return form.setErrors(data);\n });\n };\n cancel = function(target) {\n var formEl, row, value;\n row = target.parents(\".row.table-main\");\n formEl = target.parents(\"form\");\n value = formEl.scope().value;\n return $scope.$apply(function() {\n row.addClass(\"hidden\");\n value.revert();\n return row.siblings(\".visualization\").removeClass('hidden');\n });\n };\n $el.on(\"click\", \".show-add-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").removeClass('hidden');\n return goToBottomList(true);\n });\n $el.on(\"click\", \".add-new\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n target = $el.find(\".new-value\");\n return saveNewValue(target);\n }));\n $el.on(\"click\", \".delete-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").addClass(\"hidden\");\n return initializeNewValue();\n });\n $el.on(\"click\", \".edit-value\", function(event) {\n var editionRow, row, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n editionRow = row.siblings(\".edition\");\n editionRow.removeClass('hidden');\n return editionRow.find('input:visible').first().focus().select();\n });\n $el.on(\"keyup\", \".edition input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return saveValue(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"keyup\", \".new-value input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = $el.find(\".new-value\");\n return saveNewValue(target);\n } else if (event.keyCode === 27) {\n $el.find(\".new-value\").addClass(\"hidden\");\n return initializeNewValue();\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return saveValue(target);\n });\n $el.on(\"click\", \".cancel\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return cancel(target);\n });\n return $el.on(\"click\", \".delete-value\", function(event) {\n var choices, formEl, subtitle, target, text, title, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.parents(\"form\");\n value = formEl.scope().value;\n choices = {};\n _.each($scope.values, function(option) {\n if (value.id !== option.id) {\n return choices[option.id] = option.name;\n }\n });\n subtitle = value.name;\n if (_.keys(choices).length === 0) {\n return $confirm.error($translate.instant(\"ADMIN.PROJECT_VALUES.ERROR_DELETE_ALL\"));\n }\n title = $translate.instant(\"ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE\");\n text = $translate.instant(\"ADMIN.PROJECT_VALUES.REPLACEMENT\");\n return $confirm.askChoice(title, subtitle, choices, text).then(function(response) {\n var onError, onSucces;\n onSucces = function() {\n return $ctrl.loadValues()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $repo.remove(value, {\n \"moveTo\": response.selected\n }).then(onSucces, onError);\n });\n });\n };\n link = function($scope, $el, $attrs) {\n linkDragAndDrop($scope, $el, $attrs);\n linkValue($scope, $el, $attrs);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectValues\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"animationFrame\", \"$translate\", \"$rootScope\", ProjectValuesDirective]);\n\n ColorSelectionDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$watch($attrs.ngModel, function(element) {\n return $scope.color = element.color;\n });\n $el.on(\"click\", \".current-color\", function(event) {\n var body, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n $el.find(\".select-color\").hide();\n target.siblings(\".select-color\").show();\n body = angular.element(\"body\");\n return body.on(\"click\", (function(_this) {\n return function(event) {\n if (angular.element(event.target).parent(\".select-color\").length === 0) {\n $el.find(\".select-color\").hide();\n return body.unbind(\"click\");\n }\n };\n })(this));\n });\n $el.on(\"click\", \".select-color .color\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n $scope.$apply(function() {\n return $model.$modelValue.color = target.data(\"color\");\n });\n return $el.find(\".select-color\").hide();\n });\n $el.on(\"click\", \".select-color .selected-color\", function(event) {\n event.preventDefault();\n $scope.$apply(function() {\n return $model.$modelValue.color = $scope.color;\n });\n return $el.find(\".select-color\").hide();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgColorSelection\", ColorSelectionDirective);\n\n TEXT_TYPE = \"text\";\n\n MULTILINE_TYPE = \"multiline\";\n\n DATE_TYPE = \"date\";\n\n URL_TYPE = \"url\";\n\n TYPE_CHOICES = [\n {\n key: TEXT_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT\"\n }, {\n key: MULTILINE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI\"\n }, {\n key: DATE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE\"\n }, {\n key: URL_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL\"\n }\n ];\n\n ProjectCustomAttributesController = (function(superClass) {\n extend(ProjectCustomAttributesController, superClass);\n\n ProjectCustomAttributesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function ProjectCustomAttributesController(scope, rootscope, repo, rs, params, q, location, navUrls, appMetaService, translate) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.moveCustomAttributes = bind(this.moveCustomAttributes, this);\n this.deleteCustomAttribute = bind(this.deleteCustomAttribute, this);\n this.saveCustomAttribute = bind(this.saveCustomAttribute, this);\n this.createCustomAttribute = bind(this.createCustomAttribute, this);\n this.loadCustomAttributes = bind(this.loadCustomAttributes, this);\n this.scope.TYPE_CHOICES = TYPE_CHOICES;\n this.scope.project = {};\n this.rootscope.$on(\"project:loaded\", (function(_this) {\n return function() {\n var description, sectionName, title;\n _this.loadCustomAttributes();\n sectionName = _this.translate.instant(_this.scope.sectionName);\n title = _this.translate.instant(\"ADMIN.CUSTOM_ATTRIBUTES.PAGE_TITLE\", {\n \"sectionName\": sectionName,\n \"projectName\": _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n }\n\n ProjectCustomAttributesController.prototype.loadCustomAttributes = function() {\n return this.rs.customAttributes[this.scope.type].list(this.scope.projectId).then((function(_this) {\n return function(customAttributes) {\n _this.scope.customAttributes = customAttributes;\n _this.scope.maxOrder = _.maxBy(customAttributes, \"order\").order;\n return customAttributes;\n };\n })(this));\n };\n\n ProjectCustomAttributesController.prototype.createCustomAttribute = function(attrValues) {\n return this.repo.create(\"custom-attributes/\" + this.scope.type, attrValues);\n };\n\n ProjectCustomAttributesController.prototype.saveCustomAttribute = function(attrModel) {\n return this.repo.save(attrModel);\n };\n\n ProjectCustomAttributesController.prototype.deleteCustomAttribute = function(attrModel) {\n return this.repo.remove(attrModel);\n };\n\n ProjectCustomAttributesController.prototype.moveCustomAttributes = function(attrModel, newIndex) {\n var customAttributes, r;\n customAttributes = this.scope.customAttributes;\n r = customAttributes.indexOf(attrModel);\n customAttributes.splice(r, 1);\n customAttributes.splice(newIndex, 0, attrModel);\n _.each(customAttributes, function(val, idx) {\n return val.order = idx;\n });\n return this.repo.saveAll(customAttributes);\n };\n\n return ProjectCustomAttributesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectCustomAttributesController\", ProjectCustomAttributesController);\n\n ProjectCustomAttributesDirective = function($log, $confirm, animationFrame, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, cancelCreate, cancelUpdate, create, deleteCustomAttribute, hideAddButton, hideCancelButton, hideCreateForm, hideEditForm, resetNewAttr, revertChangesInCustomAttribute, showAddButton, showCancelButton, showCreateForm, showEditForm, sortableEl, update;\n $ctrl = $el.controller();\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n sortableEl = $el.find(\".js-sortable\");\n sortableEl.sortable({\n handle: \".js-view-custom-field\",\n dropOnEmpty: true,\n revert: 400,\n axis: \"y\"\n });\n sortableEl.on(\"sortstop\", function(event, ui) {\n var itemAttr, itemEl, itemIndex;\n itemEl = ui.item;\n itemAttr = itemEl.scope().attr;\n itemIndex = itemEl.index();\n return $ctrl.moveCustomAttributes(itemAttr, itemIndex);\n });\n showCreateForm = function() {\n $el.find(\".js-new-custom-field\").removeClass(\"hidden\");\n return $el.find(\".js-new-custom-field input:visible\").first().focus();\n };\n hideCreateForm = function() {\n return $el.find(\".js-new-custom-field\").addClass(\"hidden\");\n };\n showAddButton = function() {\n return $el.find(\".js-add-custom-field-button\").removeClass(\"hidden\");\n };\n hideAddButton = function() {\n return $el.find(\".js-add-custom-field-button\").addClass(\"hidden\");\n };\n showCancelButton = function() {\n return $el.find(\".js-cancel-new-custom-field-button\").removeClass(\"hidden\");\n };\n hideCancelButton = function() {\n return $el.find(\".js-cancel-new-custom-field-button\").addClass(\"hidden\");\n };\n resetNewAttr = function() {\n return $scope.newAttr = {};\n };\n create = function(formEl) {\n var attr, form, onError, onSucces;\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n onSucces = (function(_this) {\n return function() {\n $ctrl.loadCustomAttributes();\n hideCreateForm();\n resetNewAttr();\n return $confirm.notify(\"success\");\n };\n })(this);\n onError = (function(_this) {\n return function(data) {\n return form.setErrors(data);\n };\n })(this);\n attr = $scope.newAttr;\n attr.project = $scope.projectId;\n attr.order = $scope.maxOrder ? $scope.maxOrder + 1 : 1;\n return $ctrl.createCustomAttribute(attr).then(onSucces, onError);\n };\n cancelCreate = function() {\n hideCreateForm();\n return resetNewAttr();\n };\n $scope.$watch(\"customAttributes\", function(customAttributes) {\n if (!customAttributes) {\n return;\n }\n if (customAttributes.length === 0) {\n hideCancelButton();\n hideAddButton();\n return showCreateForm();\n } else {\n hideCreateForm();\n showAddButton();\n return showCancelButton();\n }\n });\n $el.on(\"click\", \".js-add-custom-field-button\", function(event) {\n event.preventDefault();\n return showCreateForm();\n });\n $el.on(\"click\", \".js-create-custom-field-button\", debounce(2000, function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return create(formEl);\n }));\n $el.on(\"click\", \".js-cancel-new-custom-field-button\", function(event) {\n event.preventDefault();\n return cancelCreate();\n });\n $el.on(\"keyup\", \".js-new-custom-field input\", function(event) {\n var formEl, target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return create(formEl);\n } else if (event.keyCode === 27) {\n return cancelCreate();\n }\n });\n showEditForm = function(formEl) {\n formEl.find(\".js-view-custom-field\").addClass(\"hidden\");\n formEl.find(\".js-edit-custom-field\").removeClass(\"hidden\");\n return formEl.find(\".js-edit-custom-field input:visible\").first().focus().select();\n };\n hideEditForm = function(formEl) {\n formEl.find(\".js-edit-custom-field\").addClass(\"hidden\");\n return formEl.find(\".js-view-custom-field\").removeClass(\"hidden\");\n };\n revertChangesInCustomAttribute = function(formEl) {\n return $scope.$apply(function() {\n return formEl.scope().attr.revert();\n });\n };\n update = function(formEl) {\n var attr, form, onError, onSucces;\n form = formEl.checksley();\n if (!form.validate()) {\n return;\n }\n onSucces = (function(_this) {\n return function() {\n $ctrl.loadCustomAttributes();\n hideEditForm(formEl);\n return $confirm.notify(\"success\");\n };\n })(this);\n onError = (function(_this) {\n return function(data) {\n return form.setErrors(data);\n };\n })(this);\n attr = formEl.scope().attr;\n return $ctrl.saveCustomAttribute(attr).then(onSucces, onError);\n };\n cancelUpdate = function(formEl) {\n hideEditForm(formEl);\n return revertChangesInCustomAttribute(formEl);\n };\n $el.on(\"click\", \".js-edit-custom-field-button\", function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return showEditForm(formEl);\n });\n $el.on(\"click\", \".js-update-custom-field-button\", debounce(2000, function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return update(formEl);\n }));\n $el.on(\"click\", \".js-cancel-edit-custom-field-button\", function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return cancelUpdate(formEl);\n });\n $el.on(\"keyup\", \".js-edit-custom-field input\", function(event) {\n var formEl, target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return update(formEl);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return cancelUpdate(formEl);\n }\n });\n deleteCustomAttribute = function(formEl) {\n var attr, message, text, title;\n attr = formEl.scope().attr;\n message = attr.name;\n title = $translate.instant(\"COMMON.CUSTOM_ATTRIBUTES.DELETE\");\n text = $translate.instant(\"COMMON.CUSTOM_ATTRIBUTES.CONFIRM_DELETE\");\n return $confirm.ask(title, text, message).then(function(response) {\n var onError, onSucces;\n onSucces = function() {\n return $ctrl.loadCustomAttributes()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return $confirm.notify(\"error\", null, \"We have not been able to delete '\" + message + \"'.\");\n };\n return $ctrl.deleteCustomAttribute(attr).then(onSucces, onError);\n });\n };\n return $el.on(\"click\", \".js-delete-custom-field-button\", debounce(2000, function(event) {\n var formEl, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n formEl = target.closest(\"form\");\n return deleteCustomAttribute(formEl);\n }));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectCustomAttributes\", [\"$log\", \"$tgConfirm\", \"animationFrame\", \"$translate\", ProjectCustomAttributesDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/memberships.coffee\n */\n\n(function() {\n var EditRoleDirective, NewRoleDirective, RolePermissionsDirective, RolesController, RolesDirective, bindMethods, bindOnce, debounce, mixOf, module, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n RolesController = (function(superClass) {\n extend(RolesController, superClass);\n\n RolesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function RolesController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this._disableComputable = bind(this._disableComputable, this);\n this._enableComputable = bind(this._enableComputable, this);\n bindMethods(this);\n this.scope.sectionName = \"ADMIN.MENU.PERMISSIONS\";\n this.scope.project = {};\n this.scope.anyComputableRole = true;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.ROLES.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n RolesController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.anyComputableRole = _.some(_.map(project.roles, function(point) {\n return point.computable;\n }));\n return project;\n };\n })(this));\n };\n\n RolesController.prototype.loadRoles = function() {\n return this.rs.roles.list(this.scope.projectId).then((function(_this) {\n return function(roles) {\n var public_permission;\n roles = roles.map(function(role) {\n role.external_user = false;\n return role;\n });\n public_permission = {\n \"name\": _this.translate.instant(\"ADMIN.ROLES.EXTERNAL_USER\"),\n \"permissions\": _this.scope.project.public_permissions,\n \"external_user\": true\n };\n roles.push(public_permission);\n _this.scope.roles = roles;\n _this.scope.role = _this.scope.roles[0];\n return roles;\n };\n })(this));\n };\n\n RolesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadRoles();\n };\n })(this));\n return promise;\n };\n\n RolesController.prototype.setRole = function(role) {\n this.scope.role = role;\n return this.scope.$broadcast(\"role:changed\", this.scope.role);\n };\n\n RolesController.prototype[\"delete\"] = function() {\n var choices, i, len, ref, replacement, role, subtitle, title, warning;\n choices = {};\n ref = this.scope.roles;\n for (i = 0, len = ref.length; i < len; i++) {\n role = ref[i];\n if (role.id !== this.scope.role.id) {\n choices[role.id] = role.name;\n }\n }\n if (_.keys(choices).length === 0) {\n return this.confirm.error(this.translate.instant(\"ADMIN.ROLES.ERROR_DELETE_ALL\"));\n }\n title = this.translate.instant(\"ADMIN.ROLES.TITLE_DELETE_ROLE\");\n subtitle = this.scope.role.name;\n replacement = this.translate.instant(\"ADMIN.ROLES.REPLACEMENT_ROLE\");\n warning = this.translate.instant(\"ADMIN.ROLES.WARNING_DELETE_ROLE\");\n return this.confirm.askChoice(title, subtitle, choices, replacement, warning).then((function(_this) {\n return function(response) {\n var onError, onSuccess;\n onSuccess = function() {\n _this.loadProject();\n return _this.loadRoles()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return _this.confirm.notify('error');\n };\n return _this.repo.remove(_this.scope.role, {\n moveTo: response.selected\n }).then(onSuccess, onError);\n };\n })(this));\n };\n\n RolesController.prototype._enableComputable = function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.confirm.notify(\"success\");\n return _this.loadProject();\n };\n })(this);\n onError = (function(_this) {\n return function() {\n _this.confirm.notify(\"error\");\n return _this.scope.role.revert();\n };\n })(this);\n return this.repo.save(this.scope.role).then(onSuccess, onError);\n };\n\n RolesController.prototype._disableComputable = function() {\n var askOnError, askOnSuccess, message, subtitle, title;\n askOnSuccess = (function(_this) {\n return function(response) {\n var onError, onSuccess;\n onSuccess = function() {\n response.finish();\n _this.confirm.notify(\"success\");\n return _this.loadProject();\n };\n onError = function() {\n response.finish();\n _this.confirm.notify(\"error\");\n return _this.scope.role.revert();\n };\n return _this.repo.save(_this.scope.role).then(onSuccess, onError);\n };\n })(this);\n askOnError = (function(_this) {\n return function(response) {\n return _this.scope.role.revert();\n };\n })(this);\n title = this.translate.instant(\"ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_TITLE\");\n subtitle = this.translate.instant(\"ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_SUBTITLE\", {\n roleName: this.scope.role.name\n });\n message = this.translate.instant(\"ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_MESSAGE\");\n return this.confirm.ask(title, subtitle, message).then(askOnSuccess, askOnError);\n };\n\n RolesController.prototype.toggleComputable = debounce(2000, function() {\n if (!this.scope.role.computable) {\n return this._disableComputable();\n } else {\n return this._enableComputable();\n }\n });\n\n return RolesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"RolesController\", RolesController);\n\n EditRoleDirective = function($repo, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit, toggleView;\n toggleView = function() {\n $el.find('.total').toggle();\n return $el.find('.edit-role').toggle();\n };\n submit = function() {\n var promise;\n $scope.role.name = $el.find(\"input\").val();\n promise = $repo.save($scope.role);\n promise.then(function() {\n return $confirm.notify(\"success\");\n });\n promise.then(null, function(data) {\n return $confirm.notify(\"error\");\n });\n return toggleView();\n };\n $el.on(\"click\", \".edit-value\", function() {\n toggleView();\n $el.find(\"input\").focus();\n return $el.find(\"input\").val($scope.role.name);\n });\n $el.on(\"click\", \"a.save\", submit);\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return submit();\n } else if (event.keyCode === 27) {\n return toggleView();\n }\n });\n $scope.$on(\"role:changed\", function() {\n if ($el.find('.edit-role').is(\":visible\")) {\n return toggleView();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgEditRole\", [\"$tgRepo\", \"$tgConfirm\", EditRoleDirective]);\n\n RolesDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRoles\", RolesDirective);\n\n NewRoleDirective = function($tgrepo, $confirm) {\n var DEFAULT_PERMISSIONS, link;\n DEFAULT_PERMISSIONS = [\"view_project\", \"view_milestones\", \"view_us\", \"view_tasks\", \"view_issues\"];\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $el.on(\"click\", \"a.add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new\").focus();\n return $el.find(\".add-button\").hide();\n });\n return $el.on(\"keyup\", \".new\", function(event) {\n var newRole, onError, onSuccess, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newRole = {\n project: $scope.projectId,\n name: target.val(),\n permissions: DEFAULT_PERMISSIONS,\n order: _.maxBy($scope.roles, function(r) {\n return r.order;\n }).order + 1,\n computable: false\n };\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n onSuccess = function(role) {\n var insertPosition;\n insertPosition = $scope.roles.length - 1;\n $scope.roles.splice(insertPosition, 0, role);\n $ctrl.setRole(role);\n $el.find(\".add-button\").show();\n return $ctrl.loadProject();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $tgrepo.create(\"roles\", newRole).then(onSuccess, onError);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewRole\", [\"$tgRepo\", \"$tgConfirm\", NewRoleDirective]);\n\n RolePermissionsDirective = function($rootscope, $repo, $confirm, $compile) {\n var baseTemplate, categoryTemplate, link, resumeTemplate;\n resumeTemplate = _.template(\"
\\\">
\\n
\\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\\n <% _.each(category.permissions, function(permission) { %>\\n
active<% } %>\\\"\\n title=\\\"{{ '<%- permission.name %>' | translate }}\\\">
\\n <% }) %>\\n
\\n\\n \\n\");\n categoryTemplate = _.template(\"
\\\">\\n
\\n
\\n
\\n
\\n <% _.each(category.permissions, function(permission) { %>\\n
\\\">\\n \\\">\\n
\\n disabled=\\\"disabled\\\" <% } %>\\n <% if(permission.active) { %> checked=\\\"checked\\\" <% } %>/>\\n
\\n \\n \\n
\\n
\\n <% }) %>\\n
\\n
\\n
\");\n baseTemplate = _.template(\"
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, generateCategoriesFromRole, renderCategory, renderPermissions, renderResume;\n $ctrl = $el.controller();\n generateCategoriesFromRole = function(role) {\n var categories, isPermissionEditable, issuePermissions, milestonePermissions, setActivePermissions, setActivePermissionsPerCategory, taskPermissions, userStoryPermissions, wikiPermissions;\n setActivePermissions = function(permissions) {\n return _.map(permissions, function(x) {\n var ref;\n return _.extend({}, x, {\n active: (ref = x[\"key\"], indexOf.call(role.permissions, ref) >= 0)\n });\n });\n };\n isPermissionEditable = function(permission, role, project) {\n if (role.external_user && !project.is_private && permission.key.indexOf(\"view_\") === 0) {\n return false;\n } else {\n return true;\n }\n };\n setActivePermissionsPerCategory = function(category) {\n return _.map(category, function(cat) {\n cat.permissions = cat.permissions.map(function(permission) {\n permission.editable = isPermissionEditable(permission, role, $scope.project);\n return permission;\n });\n return _.extend({}, cat, {\n activePermissions: _.filter(cat[\"permissions\"], \"active\").length\n });\n });\n };\n categories = [];\n milestonePermissions = [\n {\n key: \"view_milestones\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.VIEW_SPRINTS\"\n }, {\n key: \"add_milestone\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.ADD_SPRINTS\"\n }, {\n key: \"modify_milestone\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.MODIFY_SPRINTS\"\n }, {\n key: \"delete_milestone\",\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.DELETE_SPRINTS\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.SPRINTS.NAME\",\n permissions: setActivePermissions(milestonePermissions)\n });\n userStoryPermissions = [\n {\n key: \"view_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.VIEW_USER_STORIES\"\n }, {\n key: \"add_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.ADD_USER_STORIES\"\n }, {\n key: \"modify_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.MODIFY_USER_STORIES\"\n }, {\n key: \"delete_us\",\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.DELETE_USER_STORIES\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.NAME\",\n permissions: setActivePermissions(userStoryPermissions)\n });\n taskPermissions = [\n {\n key: \"view_tasks\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.VIEW_TASKS\"\n }, {\n key: \"add_task\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.ADD_TASKS\"\n }, {\n key: \"modify_task\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.MODIFY_TASKS\"\n }, {\n key: \"delete_task\",\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.DELETE_TASKS\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.TASKS.NAME\",\n permissions: setActivePermissions(taskPermissions)\n });\n issuePermissions = [\n {\n key: \"view_issues\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.VIEW_ISSUES\"\n }, {\n key: \"add_issue\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.ADD_ISSUES\"\n }, {\n key: \"modify_issue\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.MODIFY_ISSUES\"\n }, {\n key: \"delete_issue\",\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.DELETE_ISSUES\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.ISSUES.NAME\",\n permissions: setActivePermissions(issuePermissions)\n });\n wikiPermissions = [\n {\n key: \"view_wiki_pages\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_PAGES\"\n }, {\n key: \"add_wiki_page\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_PAGES\"\n }, {\n key: \"modify_wiki_page\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.MODIFY_WIKI_PAGES\"\n }, {\n key: \"delete_wiki_page\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_PAGES\"\n }, {\n key: \"view_wiki_links\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_LINKS\"\n }, {\n key: \"add_wiki_link\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_LINKS\"\n }, {\n key: \"delete_wiki_link\",\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_LINKS\"\n }\n ];\n categories.push({\n name: \"COMMON.PERMISIONS_CATEGORIES.WIKI.NAME\",\n permissions: setActivePermissions(wikiPermissions)\n });\n return setActivePermissionsPerCategory(categories);\n };\n renderResume = function(element, category) {\n return element.find(\".resume\").html($compile(resumeTemplate({\n category: category\n }))($scope));\n };\n renderCategory = function(category, index) {\n var html;\n html = categoryTemplate({\n category: category,\n index: index\n });\n html = angular.element(html);\n renderResume(html, category);\n return $compile(html)($scope);\n };\n renderPermissions = function() {\n var html;\n $el.off();\n html = baseTemplate();\n _.each(generateCategoriesFromRole($scope.role), function(category, index) {\n return html = angular.element(html).append(renderCategory(category, index));\n });\n $el.html(html);\n $el.on(\"click\", \".resume\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass(\"open-drawer\");\n return target.next().toggleClass(\"open\");\n });\n return $el.on(\"change\", \".category-item input\", function(event) {\n var getActivePermissions, onError, onSuccess, target;\n getActivePermissions = function() {\n var activePermissions;\n activePermissions = _.filter($el.find(\".category-item input\"), function(t) {\n return angular.element(t).is(\":checked\");\n });\n activePermissions = _.sortBy(_.map(activePermissions, function(t) {\n var permission;\n return permission = angular.element(t).parents(\".category-item\").data(\"id\");\n }));\n if (activePermissions.length) {\n activePermissions.push(\"view_project\");\n }\n return activePermissions;\n };\n target = angular.element(event.currentTarget);\n $scope.role.permissions = getActivePermissions();\n onSuccess = function() {\n var categories, categoryId;\n categories = generateCategoriesFromRole($scope.role);\n categoryId = target.parents(\".category-config\").data(\"id\");\n renderResume(target.parents(\".category-config\"), categories[categoryId]);\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\");\n return $ctrl.loadProject();\n };\n onError = function() {\n $confirm.notify(\"error\");\n target.prop(\"checked\", !target.prop(\"checked\"));\n return $scope.role.permissions = getActivePermissions();\n };\n if ($scope.role.external_user) {\n $scope.project.public_permissions = $scope.role.permissions;\n $scope.project.anon_permissions = $scope.role.permissions.filter(function(permission) {\n return permission.indexOf(\"view_\") === 0;\n });\n return $repo.save($scope.project).then(onSuccess, onError);\n } else {\n return $repo.save($scope.role).then(onSuccess, onError);\n }\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $scope.$on(\"role:changed\", function() {\n return renderPermissions();\n });\n return bindOnce($scope, $attrs.ngModel, renderPermissions);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRolePermissions\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$compile\", RolePermissionsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin/third-parties.coffee\n */\n\n(function() {\n var BitbucketController, BitbucketWebhooksDirective, GithubController, GithubWebhooksDirective, GitlabController, GitlabWebhooksDirective, NewWebhookDirective, SelectInputText, ValidOriginIpsDirective, WebhookDirective, WebhooksController, bindMethods, debounce, mixOf, module, taiga, timeout,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n debounce = this.taiga.debounce;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaAdmin\");\n\n WebhooksController = (function(superClass) {\n extend(WebhooksController, superClass);\n\n WebhooksController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"$translate\"];\n\n function WebhooksController(scope, repo, rs, params, location, navUrls, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = \"ADMIN.WEBHOOKS.SECTION_NAME\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.WEBHOOKS.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"webhooks:reload\", this.loadWebhooks);\n }\n\n WebhooksController.prototype.loadWebhooks = function() {\n return this.rs.webhooks.list(this.scope.projectId).then((function(_this) {\n return function(webhooks) {\n return _this.scope.webhooks = webhooks;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n if (!project.i_am_admin) {\n _this.location.path(_this.navUrls.resolve(\"permission-denied\"));\n }\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadWebhooks();\n };\n })(this));\n return promise;\n };\n\n return WebhooksController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"WebhooksController\", WebhooksController);\n\n WebhookDirective = function($rs, $repo, $confirm, $loading, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var cancel, openHistory, save, showEditMode, showVisualizationMode, updateLogs, updateShowHideHistoryText, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n updateLogs = function() {\n var prettyDate;\n prettyDate = $translate.instant(\"ADMIN.WEBHOOKS.DATE\");\n return $rs.webhooklogs.list(webhook.id).then((function(_this) {\n return function(webhooklogs) {\n var i, len, log, ref;\n for (i = 0, len = webhooklogs.length; i < len; i++) {\n log = webhooklogs[i];\n log.validStatus = (200 <= (ref = log.status) && ref < 300);\n log.prettySentHeaders = _.map(_.toPairs(log.request_headers), function(arg) {\n var header, value;\n header = arg[0], value = arg[1];\n return header + \": \" + value;\n }).join(\"\\n\");\n log.prettySentData = JSON.stringify(log.request_data);\n log.prettyDate = moment(log.created).format(prettyDate);\n }\n webhook.logs_counter = webhooklogs.length;\n webhook.logs = webhooklogs;\n return updateShowHideHistoryText();\n };\n })(this));\n };\n updateShowHideHistoryText = function() {\n var historyElement, text, textElement, title;\n textElement = $el.find(\".toggle-history\");\n historyElement = textElement.parents(\".single-webhook-wrapper\").find(\".webhooks-history\");\n if (historyElement.hasClass(\"open\")) {\n text = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY\");\n title = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY_TITLE\");\n } else {\n text = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY\");\n title = $translate.instant(\"ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY_TITLE\");\n }\n textElement.text(text);\n return textElement.prop(\"title\", title);\n };\n showVisualizationMode = function() {\n $el.find(\".edition-mode\").addClass(\"hidden\");\n return $el.find(\".visualization-mode\").removeClass(\"hidden\");\n };\n showEditMode = function() {\n $el.find(\".visualization-mode\").addClass(\"hidden\");\n return $el.find(\".edition-mode\").removeClass(\"hidden\");\n };\n openHistory = function() {\n return $el.find(\".webhooks-history\").addClass(\"open\");\n };\n cancel = function() {\n showVisualizationMode();\n return $scope.$apply(function() {\n return webhook.revert();\n });\n };\n save = debounce(2000, function(target) {\n var form, promise;\n form = target.parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n promise = $repo.save(webhook);\n promise.then((function(_this) {\n return function() {\n return showVisualizationMode();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n $el.on(\"click\", \".test-webhook\", function() {\n openHistory();\n return $rs.webhooks.test(webhook.id).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n $el.on(\"click\", \".edit-webhook\", function() {\n return showEditMode();\n });\n $el.on(\"click\", \".cancel-existing\", function() {\n return cancel();\n });\n $el.on(\"click\", \".edit-existing\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n });\n $el.on(\"keyup\", \".edition-mode input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return save(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"click\", \".delete-webhook\", function() {\n var message, title;\n title = $translate.instant(\"ADMIN.WEBHOOKS.DELETE\");\n message = $translate.instant(\"ADMIN.WEBHOOKS.WEBHOOK_NAME\", {\n name: webhook.name\n });\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSucces;\n onSucces = function() {\n askResponse.finish();\n return $scope.$emit(\"webhooks:reload\");\n };\n onError = function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove(webhook).then(onSucces, onError);\n };\n })(this));\n });\n $el.on(\"click\", \".toggle-history\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if ((webhook.logs == null) || webhook.logs.length === 0) {\n return updateLogs().then(function() {\n return timeout(0, function() {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return updateShowHideHistoryText();\n });\n });\n } else {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return $scope.$apply(function() {\n return updateShowHideHistoryText();\n });\n }\n });\n $el.on(\"click\", \".history-single\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n target.toggleClass(\"history-single-open\");\n return target.siblings(\".history-single-response\").toggleClass(\"open\");\n });\n return $el.on(\"click\", \".resend-request\", function(event) {\n var log, target;\n target = angular.element(event.currentTarget);\n log = target.data(\"log\");\n return $rs.webhooklogs.resend(log).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$translate\", WebhookDirective]);\n\n NewWebhookDirective = function($rs, $repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var addWebhookDOMNode, formDOMNode, initializeNewValue, save, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n formDOMNode = $el.find(\".new-webhook-form\");\n addWebhookDOMNode = $el.find(\".add-webhook\");\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"url\": \"\",\n \"key\": \"\"\n };\n };\n initializeNewValue();\n $scope.$watch(\"webhooks\", function(webhooks) {\n if (webhooks != null) {\n if (webhooks.length === 0) {\n formDOMNode.removeClass(\"hidden\");\n addWebhookDOMNode.addClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n } else {\n formDOMNode.addClass(\"hidden\");\n return addWebhookDOMNode.removeClass(\"hidden\");\n }\n }\n });\n save = debounce(2000, function() {\n var form, promise;\n form = formDOMNode.checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n promise = $repo.create(\"webhooks\", $scope.newValue);\n promise.then((function(_this) {\n return function() {\n $scope.$emit(\"webhooks:reload\");\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n formDOMNode.on(\"click\", \".add-new\", function(event) {\n event.preventDefault();\n return save();\n });\n formDOMNode.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return save();\n }\n });\n formDOMNode.on(\"click\", \".cancel-new\", function(event) {\n return $scope.$apply(function() {\n initializeNewValue();\n if ($scope.webhooks.length >= 1) {\n return formDOMNode.addClass(\"hidden\");\n }\n });\n });\n return addWebhookDOMNode.on(\"click\", function(event) {\n formDOMNode.removeClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", NewWebhookDirective]);\n\n GithubController = (function(superClass) {\n extend(GithubController, superClass);\n\n GithubController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"tgAppMetaService\", \"$translate\"];\n\n function GithubController(scope, repo, rs, params, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"ADMIN.GITHUB.SECTION_NAME\");\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.GITHUB.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n GithubController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"github\").then((function(_this) {\n return function(github) {\n return _this.scope.github = github;\n };\n })(this));\n };\n\n GithubController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GithubController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n return promise;\n };\n\n return GithubController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GithubController\", GithubController);\n\n GitlabController = (function(superClass) {\n extend(GitlabController, superClass);\n\n GitlabController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"tgAppMetaService\", \"$translate\"];\n\n function GitlabController(scope, repo, rs, params, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"ADMIN.GITLAB.SECTION_NAME\");\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.GITLAB.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n GitlabController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"gitlab\").then((function(_this) {\n return function(gitlab) {\n return _this.scope.gitlab = gitlab;\n };\n })(this));\n };\n\n GitlabController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GitlabController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n return promise;\n };\n\n return GitlabController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GitlabController\", GitlabController);\n\n BitbucketController = (function(superClass) {\n extend(BitbucketController, superClass);\n\n BitbucketController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"tgAppMetaService\", \"$translate\"];\n\n function BitbucketController(scope, repo, rs, params, appMetaService, translate) {\n var promise;\n this.scope = scope;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.appMetaService = appMetaService;\n this.translate = translate;\n bindMethods(this);\n this.scope.sectionName = this.translate.instant(\"ADMIN.BITBUCKET.SECTION_NAME\");\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"ADMIN.BITBUCKET.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.scope.project.description;\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n BitbucketController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"bitbucket\").then((function(_this) {\n return function(bitbucket) {\n return _this.scope.bitbucket = bitbucket;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n return promise;\n };\n\n return BitbucketController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BitbucketController\", BitbucketController);\n\n SelectInputText = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.on(\"click\", \".select-input-content\", function() {\n $el.find(\"input\").select();\n return $el.find(\".help-copy\").addClass(\"visible\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSelectInputText\", SelectInputText);\n\n GithubWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.saveAttribute($scope.github, \"github\");\n promise.then(function() {\n currentLoading.finish();\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGithubWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GithubWebhooksDirective]);\n\n GitlabWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.saveAttribute($scope.gitlab, \"gitlab\");\n promise.then(function() {\n currentLoading.finish();\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGitlabWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GitlabWebhooksDirective]);\n\n BitbucketWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.saveAttribute($scope.bitbucket, \"bitbucket\");\n promise.then(function() {\n currentLoading.finish();\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n return $el.on(\"submit\", \"form\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBitbucketWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", BitbucketWebhooksDirective]);\n\n ValidOriginIpsDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $ngModel) {\n return $ngModel.$parsers.push(function(value) {\n value = $.trim(value);\n if (value === \"\") {\n return [];\n }\n return value.split(\",\");\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgValidOriginIps\", ValidOriginIpsDirective);\n\n}).call(this);\n\n(function() {\n var createProjectRestrictionDirective, module;\n\n module = angular.module(\"taigaProject\");\n\n createProjectRestrictionDirective = function() {\n return {\n templateUrl: \"project/wizard-restrictions.html\"\n };\n };\n\n module.directive('tgCreateProjectRestriction', [createProjectRestrictionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/attachments.coffee\n */\n\n(function() {\n var CreateProject, DeleteProjectDirective, bindOnce, debounce, module, taiga, timeout;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaProject\");\n\n CreateProject = function($rootscope, $repo, $confirm, $location, $navurls, $rs, $projectUrl, $loading, lightboxService, $cacheFactory, $translate, currentUserService, $auth) {\n var directive, link;\n link = function($scope, $el, attrs) {\n var currentLoading, form, onErrorSubmit, onSuccessSubmit, openLightbox, submit, submitButton;\n $scope.data = {};\n $scope.templates = [];\n currentLoading = null;\n $auth.refresh();\n $scope.canCreatePrivateProjects = currentUserService.canCreatePrivateProjects();\n $scope.canCreatePublicProjects = currentUserService.canCreatePublicProjects();\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n onSuccessSubmit = function(response) {\n $cacheFactory.get('$http').removeAll();\n currentLoading.finish();\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\", $translate.instant(\"COMMON.SAVE\"));\n $location.url($projectUrl.get(response));\n lightboxService.close($el);\n return currentUserService.loadProjects();\n };\n onErrorSubmit = function(response) {\n var error_field, i, len, ref, results, selectors;\n currentLoading.finish();\n form.setErrors(response);\n selectors = [];\n ref = _.keys(response);\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n error_field = ref[i];\n results.push(selectors.push(\"[name=\" + error_field + \"]\"));\n }\n return results;\n };\n submit = (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.create(\"projects\", $scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this);\n openLightbox = function() {\n $scope.data = {\n is_private: false\n };\n if (!$scope.templates.length) {\n $rs.projects.templates().then((function(_this) {\n return function(result) {\n $scope.templates = result;\n return $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n };\n })(this));\n } else {\n $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n }\n return lightboxService.open($el);\n };\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return openLightbox();\n };\n directive = {\n link: link,\n templateUrl: \"project/wizard-create-project.html\",\n scope: {}\n };\n return directive;\n };\n\n module.directive(\"tgLbCreateProject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$location\", \"$tgNavUrls\", \"$tgResources\", \"$projectUrl\", \"$tgLoading\", \"lightboxService\", \"$cacheFactory\", \"$translate\", \"tgCurrentUserService\", \"$tgAuth\", CreateProject]);\n\n DeleteProjectDirective = function($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader, currentUserService) {\n var link;\n link = function($scope, $el, $attrs) {\n var projectToDelete, submit;\n projectToDelete = null;\n $scope.$on(\"deletelightbox:new\", function(ctx, project) {\n lightboxService.open($el);\n return projectToDelete = project;\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var promise;\n tgLoader.start();\n lightboxService.close($el);\n promise = $repo.remove(projectToDelete);\n promise.then(function(data) {\n tgLoader.pageLoaded();\n $rootscope.$broadcast(\"projects:reload\");\n $location.path($navUrls.resolve(\"home\"));\n $confirm.notify(\"success\");\n return currentUserService.loadProjects();\n });\n return promise.then(null, function() {\n $confirm.notify(\"error\");\n return lightboxService.close($el);\n });\n };\n $el.on(\"click\", \".button-red\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbDeleteProject\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfirm\", \"lightboxService\", \"tgLoader\", \"tgCurrentUserService\", DeleteProjectDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/bind.coffee\n */\n\n(function() {\n var BindHtmlDirective, BindOnceAltDirective, BindOnceBindDirective, BindOnceHrefDirective, BindOnceHtmlDirective, BindOnceRefDirective, BindOnceSrcDirective, BindOnceTitleDirective, BindTitleDirective, bindOnce, module;\n\n bindOnce = this.taiga.bindOnce;\n\n BindOnceBindDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoBind, function(val) {\n return $el.text(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHtml, function(val) {\n return $el.html(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceRefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoRef, function(val) {\n return $el.html(\"#\" + val + \" \");\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceSrcDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoSrc, function(val) {\n return $el.attr(\"src\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHrefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHref, function(val) {\n return $el.attr(\"href\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceAltDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoAlt, function(val) {\n return $el.attr(\"alt\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoTitle, function(val) {\n return $el.attr(\"title\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgTitleHtml, function(val) {\n if (val != null) {\n return $el.attr(\"title\", val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n BindHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgBindHtml, function(val) {\n if (val != null) {\n return $el.html(val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaBase\");\n\n module.directive(\"tgBoBind\", BindOnceBindDirective);\n\n module.directive(\"tgBoHtml\", BindOnceHtmlDirective);\n\n module.directive(\"tgBoRef\", BindOnceRefDirective);\n\n module.directive(\"tgBoSrc\", BindOnceSrcDirective);\n\n module.directive(\"tgBoHref\", BindOnceHrefDirective);\n\n module.directive(\"tgBoAlt\", BindOnceAltDirective);\n\n module.directive(\"tgBoTitle\", BindOnceTitleDirective);\n\n module.directive(\"tgBindTitle\", BindTitleDirective);\n\n module.directive(\"tgBindHtml\", BindHtmlDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/conf.coffee\n */\n\n(function() {\n var ConfigurationService, module;\n\n ConfigurationService = (function() {\n function ConfigurationService() {\n this.config = window.taigaConfig;\n }\n\n ConfigurationService.prototype.get = function(key, defaultValue) {\n if (defaultValue == null) {\n defaultValue = null;\n }\n if (_.has(this.config, key)) {\n return this.config[key];\n }\n return defaultValue;\n };\n\n return ConfigurationService;\n\n })();\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgConfig\", ConfigurationService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/contrib.coffee\n */\n\n(function() {\n var ContribController, ContribUserSettingsController, module,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n module = angular.module(\"taigaBase\");\n\n ContribController = (function(superClass) {\n extend(ContribController, superClass);\n\n ContribController.$inject = [\"$rootScope\", \"$scope\", \"$routeParams\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\"];\n\n function ContribController(rootScope, scope, params, repo, rs, confirm) {\n var promise;\n this.rootScope = rootScope;\n this.scope = scope;\n this.params = params;\n this.repo = repo;\n this.rs = rs;\n this.confirm = confirm;\n this.scope.currentPlugin = _.head(_.filter(this.rootScope.adminPlugins, {\n \"slug\": this.params.plugin\n }));\n this.scope.projectSlug = this.params.pslug;\n promise = this.loadInitialData();\n promise.then(null, (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n }\n\n ContribController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.$broadcast('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ContribController.prototype.loadInitialData = function() {\n return this.loadProject();\n };\n\n return ContribController;\n\n })(taiga.Controller);\n\n module.controller(\"ContribController\", ContribController);\n\n ContribUserSettingsController = (function(superClass) {\n extend(ContribUserSettingsController, superClass);\n\n ContribUserSettingsController.$inject = [\"$rootScope\", \"$scope\", \"$routeParams\"];\n\n function ContribUserSettingsController(rootScope, scope, params) {\n this.rootScope = rootScope;\n this.scope = scope;\n this.params = params;\n this.scope.currentPlugin = _.head(_.filter(this.rootScope.userSettingsPlugins, {\n \"slug\": this.params.plugin\n }));\n }\n\n return ContribUserSettingsController;\n\n })(taiga.Controller);\n\n module.controller(\"ContribUserSettingsController\", ContribUserSettingsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/filters.coffee\n */\n\n(function() {\n var FiltersStorageService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n FiltersStorageService = (function(superClass) {\n extend(FiltersStorageService, superClass);\n\n FiltersStorageService.$inject = [\"$tgStorage\", \"$routeParams\"];\n\n function FiltersStorageService(storage, params) {\n this.storage = storage;\n this.params = params;\n }\n\n FiltersStorageService.prototype.generateHash = function(components) {\n if (components == null) {\n components = [];\n }\n components = _.map(components, function(x) {\n return JSON.stringify(x);\n });\n return hex_sha1(components.join(\":\"));\n };\n\n return FiltersStorageService;\n\n })(taiga.Service);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/http.coffee\n */\n\n(function() {\n var HttpService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n HttpService = (function(superClass) {\n extend(HttpService, superClass);\n\n HttpService.$inject = [\"$http\", \"$q\", \"$tgStorage\", \"$rootScope\", \"$cacheFactory\", \"$translate\"];\n\n function HttpService(http, q, storage, rootScope, cacheFactory, translate) {\n this.http = http;\n this.q = q;\n this.storage = storage;\n this.rootScope = rootScope;\n this.cacheFactory = cacheFactory;\n this.translate = translate;\n HttpService.__super__.constructor.call(this);\n this.cache = this.cacheFactory(\"httpget\");\n }\n\n HttpService.prototype.headers = function() {\n var headers, lang, token;\n headers = {};\n token = this.storage.get('token');\n if (token) {\n headers[\"Authorization\"] = \"Bearer \" + token;\n }\n lang = this.translate.preferredLanguage();\n if (lang) {\n headers[\"Accept-Language\"] = lang;\n }\n return headers;\n };\n\n HttpService.prototype.request = function(options) {\n options.headers = _.assign({}, options.headers || {}, this.headers());\n return this.http(options);\n };\n\n HttpService.prototype.get = function(url, params, options) {\n options = _.assign({\n method: \"GET\",\n url: url\n }, options);\n if (params) {\n options.params = params;\n }\n options.cache = this.cache;\n return this.request(options)[\"finally\"]((function(_this) {\n return function(data) {\n return _this.cache.removeAll();\n };\n })(this));\n };\n\n HttpService.prototype.post = function(url, data, params, options) {\n options = _.assign({\n method: \"POST\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.put = function(url, data, params, options) {\n options = _.assign({\n method: \"PUT\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.patch = function(url, data, params, options) {\n options = _.assign({\n method: \"PATCH\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype[\"delete\"] = function(url, data, params, options) {\n options = _.assign({\n method: \"DELETE\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n return HttpService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgHttp\", HttpService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/location.coffee\n */\n\n(function() {\n var locationFactory, module;\n\n locationFactory = function($location, $route, $rootscope) {\n $location.noreload = function(scope) {\n var lastRoute, un;\n lastRoute = $route.current;\n un = scope.$on(\"$locationChangeSuccess\", function() {\n $route.current = lastRoute;\n return un();\n });\n return $location;\n };\n $location.isInCurrentRouteParams = function(name, value) {\n var params;\n params = $location.search() || {};\n return params[name] === value;\n };\n return $location;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgLocation\", [\"$location\", \"$route\", \"$rootScope\", locationFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/model.coffee\n */\n\n(function() {\n var Model, ModelService, module, provider, taiga,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n Model = (function() {\n function Model(name, data, dataTypes) {\n this._attrs = data;\n this._name = name;\n this._dataTypes = dataTypes;\n this.setAttrs(data);\n this.initialize();\n }\n\n Model.prototype.clone = function() {\n var instance;\n instance = new Model(this._name, this._attrs, this._dataTypes);\n instance._modifiedAttrs = this._modifiedAttrs;\n instance._isModified = this._isModified;\n return instance;\n };\n\n Model.prototype.applyCasts = function() {\n var attrName, castMethod, castName, ref, results;\n ref = this._dataTypes;\n results = [];\n for (attrName in ref) {\n castName = ref[attrName];\n castMethod = service.casts[castName];\n if (!castMethod) {\n continue;\n }\n results.push(this._attrs[attrName] = castMethod(this._attrs[attrName]));\n }\n return results;\n };\n\n Model.prototype.getIdAttrName = function() {\n return \"id\";\n };\n\n Model.prototype.getName = function() {\n return this._name;\n };\n\n Model.prototype.getAttrs = function(patch) {\n if (patch == null) {\n patch = false;\n }\n if (this._attrs.version != null) {\n this._modifiedAttrs.version = this._attrs.version;\n }\n if (patch) {\n return _.extend({}, this._modifiedAttrs);\n }\n return _.extend({}, this._attrs, this._modifiedAttrs);\n };\n\n Model.prototype.setAttrs = function(attrs) {\n this._attrs = attrs;\n this._modifiedAttrs = {};\n this.applyCasts();\n return this._isModified = false;\n };\n\n Model.prototype.setAttr = function(name, value) {\n this._modifiedAttrs[name] = value;\n return this._isModified = true;\n };\n\n Model.prototype.initialize = function() {\n var getter, self, setter;\n self = this;\n getter = function(name) {\n return function() {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n return self[name];\n }\n if (indexOf.call(_.keys(self._modifiedAttrs), name) < 0) {\n return self._attrs[name];\n }\n return self._modifiedAttrs[name];\n };\n };\n setter = function(name) {\n return function(value) {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n self[name] = value;\n return;\n }\n if (self._attrs[name] !== value) {\n self._modifiedAttrs[name] = value;\n self._isModified = true;\n } else {\n delete self._modifiedAttrs[name];\n }\n };\n };\n return _.each(this._attrs, function(value, name) {\n var options;\n options = {\n get: getter(name),\n set: setter(name),\n enumerable: true,\n configurable: true\n };\n return Object.defineProperty(self, name, options);\n });\n };\n\n Model.prototype.serialize = function() {\n var data;\n data = {\n \"data\": _.clone(this._attrs),\n \"name\": this._name\n };\n return JSON.stringify(data);\n };\n\n Model.prototype.isModified = function() {\n return this._isModified;\n };\n\n Model.prototype.isAttributeModified = function(attribute) {\n return this._modifiedAttrs[attribute] != null;\n };\n\n Model.prototype.markSaved = function() {\n this._isModified = false;\n this._attrs = this.getAttrs();\n return this._modifiedAttrs = {};\n };\n\n Model.prototype.revert = function() {\n this._modifiedAttrs = {};\n return this._isModified = false;\n };\n\n Model.desSerialize = function(sdata) {\n var ddata, model;\n ddata = JSON.parse(sdata);\n model = new Model(ddata.url, ddata.data);\n return model;\n };\n\n return Model;\n\n })();\n\n taiga = this.taiga;\n\n ModelService = (function(superClass) {\n extend(ModelService, superClass);\n\n ModelService.$inject = [\"$q\", \"$tgUrls\", \"$tgStorage\", \"$tgHttp\"];\n\n function ModelService(q, urls, storage, http) {\n this.q = q;\n this.urls = urls;\n this.storage = storage;\n this.http = http;\n ModelService.__super__.constructor.call(this);\n }\n\n return ModelService;\n\n })(taiga.Service);\n\n provider = function($q, $http, $gmUrls, $gmStorage) {\n var service;\n service = {};\n service.make_model = function(name, data, cls, dataTypes) {\n if (cls == null) {\n cls = Model;\n }\n if (dataTypes == null) {\n dataTypes = {};\n }\n return new cls(name, data, dataTypes);\n };\n service.cls = Model;\n service.casts = {\n int: function(value) {\n return parseInt(value, 10);\n },\n float: function(value) {\n return parseFloat(value, 10);\n }\n };\n return service;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgModel\", [\"$q\", \"$http\", \"$tgUrls\", \"$tgStorage\", provider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/navurl.coffee\n */\n\n(function() {\n var NavigationUrlsDirective, NavigationUrlsService, bindOnce, module, taiga, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaBase\");\n\n NavigationUrlsService = (function(superClass) {\n extend(NavigationUrlsService, superClass);\n\n function NavigationUrlsService() {\n this.urls = {};\n }\n\n NavigationUrlsService.prototype.update = function(urls) {\n return this.urls = _.merge({}, this.urls, urls || {});\n };\n\n NavigationUrlsService.prototype.formatUrl = function(url, ctx) {\n var replacer;\n if (ctx == null) {\n ctx = {};\n }\n replacer = function(match) {\n match = trim(match, \":\");\n return ctx[match] || \"undefined\";\n };\n return url.replace(/(:\\w+)/g, replacer);\n };\n\n NavigationUrlsService.prototype.resolve = function(name, ctx) {\n var url;\n url = this.urls[name];\n if (!url) {\n return \"\";\n }\n if (ctx) {\n return this.formatUrl(url, ctx);\n }\n return url;\n };\n\n return NavigationUrlsService;\n\n })(taiga.Service);\n\n module.service(\"$tgNavUrls\", NavigationUrlsService);\n\n NavigationUrlsDirective = function($navurls, $auth, $q, $location, lightboxService) {\n var bindOnceP, link, parseNav;\n bindOnceP = function($scope, attr) {\n var defered;\n defered = $q.defer();\n bindOnce($scope, attr, function(v) {\n return defered.resolve(v);\n });\n return defered.promise;\n };\n parseNav = function(data, $scope) {\n var index, name, obj, params, promises, ref, result, values;\n ref = _.map(data.split(\":\"), trim), name = ref[0], params = ref[1];\n if (params) {\n result = params.split(/(\\w+)=/);\n result = _.filter(result, function(str) {\n return str.length;\n });\n result = _.map(result, function(str) {\n return trim(str.replace(/,$/g, ''));\n });\n params = [];\n index = 0;\n while (index < result.length) {\n obj = {};\n obj[result[index]] = result[index + 1];\n params.push(obj);\n index = index + 2;\n }\n } else {\n params = [];\n }\n values = _.map(params, function(param) {\n return _.values(param)[0];\n });\n promises = _.map(values, function(x) {\n return bindOnceP($scope, x);\n });\n return $q.all(promises).then(function() {\n var i, key, len, options, param, value;\n options = {};\n for (i = 0, len = params.length; i < len; i++) {\n param = params[i];\n key = Object.keys(param)[0];\n value = param[key];\n options[key] = $scope.$eval(value);\n }\n return [name, options];\n });\n };\n link = function($scope, $el, $attrs) {\n if ($el.is(\"a\")) {\n $el.attr(\"href\", \"#\");\n }\n $el.on(\"mouseenter\", function(event) {\n var target;\n target = $(event.currentTarget);\n if (!target.data(\"fullUrl\") || $attrs.tgNavGetParams !== target.data(\"params\")) {\n return parseNav($attrs.tgNav, $scope).then(function(result) {\n var fullUrl, getURLParams, getURLParamsStr, name, options, url, user;\n name = result[0], options = result[1];\n user = $auth.getUser();\n if (user) {\n options.user = user.username;\n }\n url = $navurls.resolve(name);\n fullUrl = $navurls.formatUrl(url, options);\n if ($attrs.tgNavGetParams) {\n getURLParams = JSON.parse($attrs.tgNavGetParams);\n getURLParamsStr = $.param(getURLParams);\n fullUrl = fullUrl + \"?\" + getURLParamsStr;\n target.data(\"params\", $attrs.tgNavGetParams);\n }\n target.data(\"fullUrl\", fullUrl);\n if (target.is(\"a\")) {\n target.attr(\"href\", fullUrl);\n }\n return $el.on(\"click\", function(event) {\n if (event.metaKey || event.ctrlKey) {\n return;\n }\n event.preventDefault();\n target = $(event.currentTarget);\n if (target.hasClass('noclick')) {\n return;\n }\n fullUrl = target.data(\"fullUrl\");\n switch (event.which) {\n case 1:\n $location.url(fullUrl);\n $scope.$apply();\n break;\n case 2:\n window.open(fullUrl);\n }\n return lightboxService.closeAll();\n });\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNav\", [\"$tgNavUrls\", \"$tgAuth\", \"$q\", \"$tgLocation\", \"lightboxService\", NavigationUrlsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/repository.coffee\n */\n\n(function() {\n var RepositoryService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n RepositoryService = (function(superClass) {\n extend(RepositoryService, superClass);\n\n RepositoryService.$inject = [\"$q\", \"$tgModel\", \"$tgStorage\", \"$tgHttp\", \"$tgUrls\"];\n\n function RepositoryService(q, model1, storage, http, urls) {\n this.q = q;\n this.model = model1;\n this.storage = storage;\n this.http = http;\n this.urls = urls;\n RepositoryService.__super__.constructor.call(this);\n }\n\n RepositoryService.prototype.resolveUrlForModel = function(model) {\n var idAttrName;\n idAttrName = model.getIdAttrName();\n return (this.urls.resolve(model.getName())) + \"/\" + model[idAttrName];\n };\n\n RepositoryService.prototype.resolveUrlForAttributeModel = function(model) {\n return this.urls.resolve(model.getName(), model.parent);\n };\n\n RepositoryService.prototype.create = function(name, data, dataTypes, extraParams) {\n var defered, promise, url;\n if (dataTypes == null) {\n dataTypes = {};\n }\n if (extraParams == null) {\n extraParams = {};\n }\n defered = this.q.defer();\n url = this.urls.resolve(name);\n promise = this.http.post(url, JSON.stringify(data));\n promise.success((function(_this) {\n return function(_data, _status) {\n return defered.resolve(_this.model.make_model(name, _data, null, dataTypes));\n };\n })(this));\n promise.error((function(_this) {\n return function(data, status) {\n return defered.reject(data);\n };\n })(this));\n return defered.promise;\n };\n\n RepositoryService.prototype.remove = function(model, params) {\n var defered, promise, url;\n if (params == null) {\n params = {};\n }\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http[\"delete\"](url, {}, params);\n promise.success(function(data, status) {\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(model);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAll = function(models, patch) {\n var promises;\n if (patch == null) {\n patch = true;\n }\n promises = _.map(models, (function(_this) {\n return function(x) {\n return _this.save(x, true);\n };\n })(this));\n return this.q.all(promises);\n };\n\n RepositoryService.prototype.save = function(model, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForModel(model);\n data = JSON.stringify(model.getAttrs(patch));\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAttribute = function(model, attribute, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForAttributeModel(model);\n data = {};\n data[attribute] = model.getAttrs();\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.refresh = function(model) {\n var defered, promise, url;\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http.get(url);\n promise.success(function(data, status) {\n model._modifiedAttrs = {};\n model._attrs = data;\n model._isModified = false;\n model.applyCasts();\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.queryMany = function(name, params, options, headers) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n if (headers == null) {\n headers = false;\n }\n url = this.urls.resolve(name);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var result;\n result = _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n if (headers) {\n return [result, data.headers];\n }\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneAttribute = function(name, id, attribute, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name, id);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var model;\n model = _this.model.make_model(name, data.data[attribute]);\n model.parent = id;\n return model;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOne = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return _this.model.make_model(name, data.data);\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneRaw = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = _.merge({\n headers: {}\n }, options);\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryPaginated = function(name, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n httpOptions = _.merge({\n headers: {}\n }, options);\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var headers, result;\n headers = data.headers();\n result = {};\n result.models = _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n result.count = parseInt(headers[\"x-pagination-count\"], 10);\n result.current = parseInt(headers[\"x-pagination-current\"] || 1, 10);\n result.paginatedBy = parseInt(headers[\"x-paginated-by\"], 10);\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOnePaginatedRaw = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = _.merge({\n headers: {}\n }, options);\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var headers, result;\n headers = data.headers();\n result = {};\n result.data = data.data;\n result.count = parseInt(headers[\"x-pagination-count\"], 10);\n result.current = parseInt(headers[\"x-pagination-current\"] || 1, 10);\n result.paginatedBy = parseInt(headers[\"x-paginated-by\"], 10);\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.resolve = function(options) {\n var cache, params;\n params = {};\n if (options.pslug != null) {\n params.project = options.pslug;\n }\n if (options.usref != null) {\n params.us = options.usref;\n }\n if (options.taskref != null) {\n params.task = options.taskref;\n }\n if (options.issueref != null) {\n params.issue = options.issueref;\n }\n if (options.sslug != null) {\n params.milestone = options.sslug;\n }\n if (options.wikipage != null) {\n params.wikipage = options.wikipage;\n }\n cache = !(options.wikipage || options.sslug);\n return this.queryOneRaw(\"resolver\", null, params, {\n cache: cache\n });\n };\n\n return RepositoryService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgRepo\", RepositoryService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/storage.coffee\n */\n\n(function() {\n var StorageService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n StorageService = (function(superClass) {\n extend(StorageService, superClass);\n\n StorageService.$inject = [\"$rootScope\"];\n\n function StorageService($rootScope) {\n StorageService.__super__.constructor.call(this);\n }\n\n StorageService.prototype.get = function(key, _default) {\n var serializedValue;\n serializedValue = localStorage.getItem(key);\n if (serializedValue === null) {\n return _default || null;\n }\n return JSON.parse(serializedValue);\n };\n\n StorageService.prototype.set = function(key, val) {\n if (_.isObject(key)) {\n return _.each(key, (function(_this) {\n return function(val, key) {\n return _this.set(key, val);\n };\n })(this));\n } else {\n return localStorage.setItem(key, JSON.stringify(val));\n }\n };\n\n StorageService.prototype.contains = function(key) {\n var value;\n value = this.get(key);\n return value !== null;\n };\n\n StorageService.prototype.remove = function(key) {\n return localStorage.removeItem(key);\n };\n\n StorageService.prototype.clear = function() {\n return localStorage.clear();\n };\n\n return StorageService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgStorage\", StorageService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/http.coffee\n */\n\n(function() {\n var UrlsService, format, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n format = function(fmt, obj) {\n obj = _.clone(obj);\n return fmt.replace(/%s/g, function(match) {\n return String(obj.shift());\n });\n };\n\n taiga = this.taiga;\n\n UrlsService = (function(superClass) {\n extend(UrlsService, superClass);\n\n UrlsService.$inject = [\"$tgConfig\"];\n\n function UrlsService(config) {\n this.config = config;\n this.urls = {};\n this.mainUrl = this.config.get(\"api\");\n }\n\n UrlsService.prototype.update = function(urls) {\n return this.urls = _.merge(this.urls, urls);\n };\n\n UrlsService.prototype.resolve = function() {\n var args, name, url;\n args = _.toArray(arguments);\n if (args.length === 0) {\n throw Error(\"wrong arguments to setUrls\");\n }\n name = args.slice(0, 1)[0];\n url = format(this.urls[name], args.slice(1));\n return format(\"%s/%s\", [_.trimEnd(this.mainUrl, \"/\"), _.trimStart(url, \"/\")]);\n };\n\n UrlsService.prototype.resolveAbsolute = function() {\n var url;\n url = this.resolve.apply(this, arguments);\n if (/^https?:\\/\\//i.test(url)) {\n return url;\n }\n if (/^\\//.test(url)) {\n return window.location.protocol + \"//\" + window.location.host + url;\n }\n return window.location.protocol + \"//\" + window.location.host + \"/\" + url;\n };\n\n return UrlsService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service('$tgUrls', UrlsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/custom-field-values.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo) {\n var _get, service;\n _get = function(objectId, resource) {\n return $repo.queryOne(resource, objectId);\n };\n service = {\n userstory: {\n get: function(objectId) {\n return _get(objectId, \"custom-attributes-values/userstory\");\n }\n },\n task: {\n get: function(objectId) {\n return _get(objectId, \"custom-attributes-values/task\");\n }\n },\n issue: {\n get: function(objectId) {\n return _get(objectId, \"custom-attributes-values/issue\");\n }\n }\n };\n return function(instance) {\n return instance.customAttributesValues = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgCustomAttributesValuesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($repo) {\n var _list, service;\n _list = function(projectId, resource) {\n return $repo.queryMany(resource, {\n project: projectId\n });\n };\n service = {\n userstory: {\n list: function(projectId) {\n return _list(projectId, \"custom-attributes/userstory\");\n }\n },\n task: {\n list: function(projectId) {\n return _list(projectId, \"custom-attributes/task\");\n }\n },\n issue: {\n list: function(projectId) {\n return _list(projectId, \"custom-attributes/issue\");\n }\n }\n };\n return function(instance) {\n return instance.customAttributes = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgCustomAttributesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/history.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(type, objectId) {\n return $repo.queryOneRaw(\"history/\" + type, objectId);\n };\n service.deleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/delete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n service.undeleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/undelete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.history = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgHistoryResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.get = function(token) {\n return $repo.queryOne(\"invitations\", token);\n };\n return function(instance) {\n return instance.invitations = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgInvitationsResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/issues.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage, $q) {\n var filtersHashSuffix, hashSuffix, myFiltersHashSuffix, service;\n service = {};\n hashSuffix = \"issues-queryparams\";\n filtersHashSuffix = \"issues-filters\";\n myFiltersHashSuffix = \"issues-my-filters\";\n service.get = function(projectId, issueId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"issues\", issueId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"issues\", \"by_ref\", params);\n };\n service.listInAllProjects = function(filters) {\n return $repo.queryMany(\"issues\", filters);\n };\n service.list = function(projectId, filters, options) {\n var params;\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryPaginated(\"issues\", params, options);\n };\n service.bulkCreate = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-issues\");\n params = {\n project_id: projectId,\n bulk_issues: data\n };\n return $http.post(url, params);\n };\n service.upvote = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-upvote\", issueId);\n return $http.post(url);\n };\n service.downvote = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-downvote\", issueId);\n return $http.post(url);\n };\n service.watch = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-watch\", issueId);\n return $http.post(url);\n };\n service.unwatch = function(issueId) {\n var url;\n url = $urls.resolve(\"issue-unwatch\", issueId);\n return $http.post(url);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/issues_stats\");\n };\n service.filtersData = function(params) {\n return $repo.queryOneRaw(\"issues-filters\", null, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeFilters = function(projectSlug, params) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.set(hash, params);\n };\n service.getFilters = function(projectSlug) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.get(hash) || {};\n };\n service.storeMyFilters = function(projectId, myFilters) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n if (_.isEmpty(myFilters)) {\n promise = $http[\"delete\"](url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function() {\n return deferred.resolve();\n });\n promise.then(null, function() {\n return deferred.reject();\n });\n } else {\n promise = $http.put(url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function(data) {\n return deferred.resolve();\n });\n promise.then(null, function(data) {\n var innerPromise;\n innerPromise = $http.post(\"\" + url, {\n key: hash,\n value: myFilters\n });\n innerPromise.then(function() {\n return deferred.resolve();\n });\n return innerPromise.then(null, function() {\n return deferred.reject();\n });\n });\n }\n return deferred.promise;\n };\n service.getMyFilters = function(projectId) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n promise = $http.get(url + \"/\" + hash);\n promise.then(function(data) {\n return deferred.resolve(data.data.value);\n });\n promise.then(null, function(data) {\n return deferred.resolve({});\n });\n return deferred.promise;\n };\n return function(instance) {\n return instance.issues = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgIssuesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/kanban.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($storage) {\n var hashSuffixStatusColumnModes, hashSuffixStatusViewModes, service;\n service = {};\n hashSuffixStatusViewModes = \"kanban-statusviewmodels\";\n hashSuffixStatusColumnModes = \"kanban-statuscolumnmodels\";\n service.storeStatusViewModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusViewModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.kanban = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgKanbanResourcesProvider\", [\"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/locales.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($repo) {\n var service;\n service = {\n list: function() {\n return $repo.queryMany(\"locales\");\n }\n };\n return function(instance) {\n return instance.locales = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgLocalesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/mdrender.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.render = function(projectId, content) {\n var params, url;\n if ((content == null) || content === \"\") {\n content = ' ';\n }\n params = {\n project_id: projectId,\n content: content\n };\n url = $urls.resolve(\"wiki\");\n return $http.post(url + \"/render\", params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.mdrender = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMdRenderResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"memberships\", id);\n };\n service.list = function(projectId, filters, enablePagination) {\n var options, params;\n if (enablePagination == null) {\n enablePagination = true;\n }\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n if (enablePagination) {\n return $repo.queryPaginated(\"memberships\", params);\n }\n return $repo.queryMany(\"memberships\", params, options = {\n enablePagination: enablePagination\n });\n };\n service.listByUser = function(userId, filters) {\n var params;\n params = {\n user: userId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryPaginated(\"memberships\", params);\n };\n service.resendInvitation = function(id) {\n var url;\n url = $urls.resolve(\"memberships\");\n return $http.post(url + \"/\" + id + \"/resend_invitation\", {});\n };\n service.bulkCreateMemberships = function(projectId, data, invitation_extra_text) {\n var params, url;\n url = $urls.resolve(\"bulk-create-memberships\");\n params = {\n project_id: projectId,\n bulk_memberships: data,\n invitation_extra_text: invitation_extra_text\n };\n return $http.post(url, params);\n };\n return function(instance) {\n return instance.memberships = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMembershipsResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules.coffee\n */\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.list = function(projectId, module) {\n return $repo.queryOneAttribute(\"project-modules\", projectId, module);\n };\n return function(instance) {\n return instance.modules = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgModulesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"notify-policies\", id);\n };\n service.list = function(filters) {\n var params;\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"notify-policies\", params);\n };\n return function(instance) {\n return instance.notifyPolicies = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgNotifyPoliciesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $auth, $q, $translate) {\n var service;\n service = {};\n service.get = function(projectId) {\n return $repo.queryOne(\"projects\", projectId);\n };\n service.getBySlug = function(projectSlug) {\n return $repo.queryOne(\"projects\", \"by_slug?slug=\" + projectSlug);\n };\n service.list = function() {\n return $repo.queryMany(\"projects\");\n };\n service.listByMember = function(memberId) {\n var params;\n params = {\n \"member\": memberId,\n \"order_by\": \"memberships__user_order\"\n };\n return $repo.queryMany(\"projects\", params);\n };\n service.templates = function() {\n return $repo.queryMany(\"project-templates\");\n };\n service.usersList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"users\", params);\n };\n service.rolesList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"roles\", params);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/stats\");\n };\n service.bulkUpdateOrder = function(bulkData) {\n var url;\n url = $urls.resolve(\"bulk-update-projects-order\");\n return $http.post(url, bulkData);\n };\n service.regenerate_userstories_csv_uuid = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/regenerate_userstories_csv_uuid\";\n return $http.post(url);\n };\n service.regenerate_issues_csv_uuid = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/regenerate_issues_csv_uuid\";\n return $http.post(url);\n };\n service.regenerate_tasks_csv_uuid = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/regenerate_tasks_csv_uuid\";\n return $http.post(url);\n };\n service.leave = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/leave\";\n return $http.post(url);\n };\n service.memberStats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/member_stats\");\n };\n service.tagsColors = function(projectId) {\n return $repo.queryOne(\"projects\", projectId + \"/tags_colors\");\n };\n service[\"export\"] = function(projectId) {\n var url;\n url = ($urls.resolve(\"exporter\")) + \"/\" + projectId;\n return $http.get(url);\n };\n service[\"import\"] = function(file, statusUpdater) {\n var complete, data, defered, errorMsg, failed, maxFileSize, response, uploadComplete, uploadFailed, uploadProgress, xhr;\n defered = $q.defer();\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_MAX_SIZE_EXCEEDED\", {\n fileName: file.name,\n fileSize: sizeFormat(file.size),\n maxFileSize: sizeFormat(maxFileSize)\n });\n response = {\n status: 413,\n data: {\n _error_message: errorMsg\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n var message, percent;\n percent = Math.round((evt.loaded / evt.total) * 100);\n message = $translate.instant(\"PROJECT.IMPORT.UPLOAD_IN_PROGRESS_MESSAGE\", {\n uploadedSize: sizeFormat(evt.loaded),\n totalSize: sizeFormat(evt.total)\n });\n return statusUpdater(\"in-progress\", null, message, percent);\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return statusUpdater(\"done\", $translate.instant(\"PROJECT.IMPORT.TITLE\"), $translate.instant(\"PROJECT.IMPORT.DESCRIPTION\"));\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return statusUpdater(\"error\");\n };\n })(this);\n complete = (function(_this) {\n return function(evt) {\n var error, ref;\n response = {};\n try {\n response.data = JSON.parse(evt.target.responseText);\n } catch (error) {\n response.data = {};\n }\n response.status = evt.target.status;\n if (evt.target.getResponseHeader('Taiga-Info-Project-Is-Private')) {\n response.headers = {\n isPrivate: evt.target.getResponseHeader('Taiga-Info-Project-Is-Private') === 'True',\n memberships: parseInt(evt.target.getResponseHeader('Taiga-Info-Project-Memberships'))\n };\n }\n if ((ref = response.status) === 201 || ref === 202) {\n defered.resolve(response);\n }\n return defered.reject(response);\n };\n })(this);\n failed = (function(_this) {\n return function(evt) {\n return defered.reject(\"fail\");\n };\n })(this);\n data = new FormData();\n data.append('dump', file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.upload.addEventListener(\"load\", uploadComplete, false);\n xhr.upload.addEventListener(\"error\", uploadFailed, false);\n xhr.upload.addEventListener(\"abort\", uploadFailed, false);\n xhr.addEventListener(\"load\", complete, false);\n xhr.addEventListener(\"error\", failed, false);\n xhr.open(\"POST\", $urls.resolve(\"importer\"));\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + ($auth.getToken()));\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n service.changeLogo = function(projectId, file) {\n var data, defered, maxFileSize, options, response, url;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered = $q.defer();\n defered.reject(response);\n return defered.promise;\n }\n data = new FormData();\n data.append('logo', file);\n options = {\n transformRequest: angular.identity,\n headers: {\n 'Content-Type': void 0\n }\n };\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/change_logo\";\n return $http.post(url, data, {}, options);\n };\n service.removeLogo = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/remove_logo\";\n return $http.post(url);\n };\n return function(instance) {\n return instance.projects = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgProjectsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgAuth\", \"$q\", \"$translate\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"roles\", id);\n };\n service.list = function(projectId) {\n return $repo.queryMany(\"roles\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.roles = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgRolesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/search.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http, $q) {\n var service;\n service = {};\n service[\"do\"] = function(projectId, term) {\n var deferredAbort, params, request, url;\n deferredAbort = $q.defer();\n url = $urls.resolve(\"search\");\n params = {\n url: url,\n method: \"GET\",\n timeout: deferredAbort.promise,\n cancelable: true,\n params: {\n project: projectId,\n text: term,\n get_all: false\n }\n };\n request = $http.request(params).then(function(data) {\n return data.data;\n });\n request.abort = function() {\n return deferredAbort.resolve();\n };\n request[\"finally\"] = function() {\n request.abort = angular.noop;\n return deferredAbort = request = null;\n };\n return request;\n };\n return function(instance) {\n return instance.search = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSearchResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/sprints.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $model, $storage) {\n var service;\n service = {};\n service.get = function(projectId, sprintId) {\n return $repo.queryOne(\"milestones\", sprintId).then(function(sprint) {\n var uses;\n uses = sprint.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n sprint._attrs.user_stories = uses;\n return sprint;\n });\n };\n service.stats = function(projectId, sprintId) {\n return $repo.queryOneRaw(\"milestones\", sprintId + \"/stats\");\n };\n service.list = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"milestones\", params, {}, true).then((function(_this) {\n return function(result) {\n var headers, i, len, m, milestones, uses;\n milestones = result[0];\n headers = result[1];\n for (i = 0, len = milestones.length; i < len; i++) {\n m = milestones[i];\n uses = m.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n m._attrs.user_stories = uses;\n }\n return {\n milestones: milestones,\n closed: parseInt(headers(\"Taiga-Info-Total-Closed-Milestones\"), 10),\n open: parseInt(headers(\"Taiga-Info-Total-Opened-Milestones\"), 10)\n };\n };\n })(this));\n };\n return function(instance) {\n return instance.sprints = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSprintsResourcesProvider\", [\"$tgRepo\", \"$tgModel\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/tasks.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, hashSuffixStatusColumnModes, hashSuffixUsRowModes, service;\n service = {};\n hashSuffix = \"tasks-queryparams\";\n hashSuffixStatusColumnModes = \"tasks-statuscolumnmodels\";\n hashSuffixUsRowModes = \"tasks-usrowmodels\";\n service.get = function(projectId, taskId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"tasks\", taskId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"tasks\", \"by_ref\", params);\n };\n service.listInAllProjects = function(filters) {\n return $repo.queryMany(\"tasks\", filters);\n };\n service.list = function(projectId, sprintId, userStoryId) {\n var params;\n if (sprintId == null) {\n sprintId = null;\n }\n if (userStoryId == null) {\n userStoryId = null;\n }\n params = {\n project: projectId\n };\n if (sprintId) {\n params.milestone = sprintId;\n }\n if (userStoryId) {\n params.user_story = userStoryId;\n }\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"tasks\", params);\n };\n service.bulkCreate = function(projectId, sprintId, usId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-tasks\");\n params = {\n project_id: projectId,\n sprint_id: sprintId,\n us_id: usId,\n bulk_tasks: data\n };\n return $http.post(url, params).then(function(result) {\n return result.data;\n });\n };\n service.upvote = function(taskId) {\n var url;\n url = $urls.resolve(\"task-upvote\", taskId);\n return $http.post(url);\n };\n service.downvote = function(taskId) {\n var url;\n url = $urls.resolve(\"task-downvote\", taskId);\n return $http.post(url);\n };\n service.watch = function(taskId) {\n var url;\n url = $urls.resolve(\"task-watch\", taskId);\n return $http.post(url);\n };\n service.unwatch = function(taskId) {\n var url;\n url = $urls.resolve(\"task-unwatch\", taskId);\n return $http.post(url);\n };\n service.bulkUpdateTaskTaskboardOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-task-taskboard-order\");\n params = {\n project_id: projectId,\n bulk_tasks: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeUsRowModes = function(projectId, sprintId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.set(hash, params);\n };\n service.getUsRowModes = function(projectId, sprintId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.tasks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgTasksResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $q) {\n var service;\n service = {};\n service.changeAvatar = function(file) {\n var data, defered, maxFileSize, options, response, url;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered = $q.defer();\n defered.reject(response);\n return defered.promise;\n }\n data = new FormData();\n data.append('avatar', file);\n options = {\n transformRequest: angular.identity,\n headers: {\n 'Content-Type': void 0\n }\n };\n url = ($urls.resolve(\"users\")) + \"/change_avatar\";\n return $http.post(url, data, {}, options);\n };\n service.removeAvatar = function() {\n var url;\n url = ($urls.resolve(\"users\")) + \"/remove_avatar\";\n return $http.post(url);\n };\n service.changePassword = function(currentPassword, newPassword) {\n var data, url;\n url = ($urls.resolve(\"users\")) + \"/change_password\";\n data = {\n current_password: currentPassword,\n password: newPassword\n };\n return $http.post(url, data);\n };\n return function(instance) {\n return instance.userSettings = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserSettingsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/user.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($http, $urls) {\n var service;\n service = {};\n service.contacts = function(userId, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = $urls.resolve(\"user-contacts\", userId);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return $http.get(url, {}, httpOptions).then(function(result) {\n return result.data;\n });\n };\n return function(instance) {\n return instance.users = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUsersResourcesProvider\", [\"$tgHttp\", \"$tgUrls\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/userstories.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, service;\n service = {};\n hashSuffix = \"userstories-queryparams\";\n service.get = function(projectId, usId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"userstories\", usId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"userstories\", \"by_ref\", params);\n };\n service.listInAllProjects = function(filters) {\n return $repo.queryMany(\"userstories\", filters);\n };\n service.filtersData = function(params) {\n return $repo.queryOneRaw(\"userstories-filters\", null, params);\n };\n service.listUnassigned = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId,\n \"milestone\": \"null\"\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.listAll = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.bulkCreate = function(projectId, status, bulk) {\n var data, url;\n data = {\n project_id: projectId,\n status_id: status,\n bulk_stories: bulk\n };\n url = $urls.resolve(\"bulk-create-us\");\n return $http.post(url, data);\n };\n service.upvote = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-upvote\", userStoryId);\n return $http.post(url);\n };\n service.downvote = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-downvote\", userStoryId);\n return $http.post(url);\n };\n service.watch = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-watch\", userStoryId);\n return $http.post(url);\n };\n service.unwatch = function(userStoryId) {\n var url;\n url = $urls.resolve(\"userstory-unwatch\", userStoryId);\n return $http.post(url);\n };\n service.bulkUpdateBacklogOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-backlog-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateSprintOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-sprint-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateKanbanOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-kanban-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeShowTags = function(projectId, showTags) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.set(hash, showTags);\n };\n service.getShowTags = function(projectId) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.get(hash) || null;\n };\n return function(instance) {\n return instance.userstories = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserstoriesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: webhooklogs.coffee\n */\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(webhookId) {\n var params;\n params = {\n webhook: webhookId\n };\n return $repo.queryMany(\"webhooklogs\", params);\n };\n service.resend = function(webhooklogId) {\n var url;\n url = $urls.resolve(\"webhooklogs-resend\", webhooklogId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooklogs = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhookLogsResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: webhooks.coffee\n */\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(projectId) {\n var params;\n params = {\n project: projectId\n };\n return $repo.queryMany(\"webhooks\", params);\n };\n service.test = function(webhookId) {\n var url;\n url = $urls.resolve(\"webhooks-test\", webhookId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhooksResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources/wikis.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(wikiId) {\n return $repo.queryOne(\"wiki\", wikiId);\n };\n service.getBySlug = function(projectId, slug) {\n return $repo.queryOne(\"wiki\", \"by_slug?project=\" + projectId + \"&slug=\" + slug);\n };\n service.listLinks = function(projectId) {\n return $repo.queryMany(\"wiki-links\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.wiki = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWikiResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/main.coffee\n */\n\n(function() {\n var UserChangePasswordController, UserChangePasswordDirective, debounce, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserChangePasswordController = (function(superClass) {\n extend(UserChangePasswordController, superClass);\n\n UserChangePasswordController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\", \"$translate\"];\n\n function UserChangePasswordController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, auth, translate) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.auth = auth;\n this.translate = translate;\n this.scope.sectionName = this.translate.instant(\"CHANGE_PASSWORD.SECTION_NAME\");\n this.scope.user = this.auth.getUser();\n }\n\n return UserChangePasswordController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserChangePasswordController\", UserChangePasswordController);\n\n UserChangePasswordDirective = function($rs, $confirm, $loading, $translate) {\n var link;\n link = function($scope, $el, $attrs, ctrl) {\n var form, submit, submitButton;\n form = new checksley.Form($el.find(\"form\"));\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n if ($scope.newPassword1 !== $scope.newPassword2) {\n $confirm.notify('error', $translate.instant(\"CHANGE_PASSWORD.ERROR_PASSWORD_MATCH\"));\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $rs.userSettings.changePassword($scope.currentPassword, $scope.newPassword1);\n promise.then(function() {\n currentLoading.finish();\n return $confirm.notify('success');\n });\n return promise.then(null, function(response) {\n currentLoading.finish();\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserChangePassword\", [\"$tgResources\", \"$tgConfirm\", \"$tgLoading\", \"$translate\", UserChangePasswordDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues/lightboxes.coffee\n */\n\n(function() {\n var DeleteUserDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n DeleteUserDirective = function($repo, $rootscope, $auth, $location, $navUrls, lightboxService, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit, submitButton;\n $scope.$on(\"deletelightbox:new\", function(ctx, user) {\n return lightboxService.open($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var currentLoading, promise;\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.remove($scope.user);\n promise.then(function(data) {\n currentLoading.finish();\n lightboxService.close($el);\n $auth.logout();\n return $location.path($navUrls.resolve(\"login\"));\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return console.log(\"FAIL\");\n });\n };\n $el.on(\"click\", \".button-green\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n $el.on(\"click\", \".button-red\", debounce(2000, function(event) {\n event.preventDefault();\n return submit();\n }));\n return submitButton = $el.find(\".button-red\");\n };\n return {\n link: link,\n templateUrl: \"user/lightbox/lightbox-delete-account.html\"\n };\n };\n\n module.directive(\"tgLbDeleteUser\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"lightboxService\", \"$tgLoading\", DeleteUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/main.coffee\n */\n\n(function() {\n var TaigaAvatarModelDirective, UserAvatarDirective, UserProfileDirective, UserSettingsController, debounce, mixOf, module, sizeFormat, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n sizeFormat = this.taiga.sizeFormat;\n\n module = angular.module(\"taigaUserSettings\");\n\n debounce = this.taiga.debounce;\n\n UserSettingsController = (function(superClass) {\n extend(UserSettingsController, superClass);\n\n UserSettingsController.$inject = [\"$scope\", \"$rootScope\", \"$tgConfig\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\", \"$translate\"];\n\n function UserSettingsController(scope, rootscope, config, repo, confirm, rs, params, q, location, navUrls, auth, translate) {\n var maxFileSize, promise, text;\n this.scope = scope;\n this.rootscope = rootscope;\n this.config = config;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.auth = auth;\n this.translate = translate;\n this.scope.sectionName = \"USER_SETTINGS.MENU.SECTION_TITLE\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n if (!this.scope.user) {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n this.location.replace();\n }\n this.scope.lang = this.getLan();\n this.scope.theme = this.getTheme();\n maxFileSize = this.config.get(\"maxUploadFileSize\", null);\n if (maxFileSize) {\n text = this.translate.instant(\"USER_SETTINGS.AVATAR_MAX_SIZE\", {\n \"maxFileSize\": sizeFormat(maxFileSize)\n });\n this.scope.maxFileSizeMsg = text;\n }\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserSettingsController.prototype.loadInitialData = function() {\n this.scope.availableThemes = this.config.get(\"themes\", []);\n return this.rs.locales.list().then((function(_this) {\n return function(locales) {\n _this.scope.locales = locales;\n return locales;\n };\n })(this));\n };\n\n UserSettingsController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.user);\n };\n\n UserSettingsController.prototype.getLan = function() {\n return this.scope.user.lang || this.translate.preferredLanguage();\n };\n\n UserSettingsController.prototype.getTheme = function() {\n return this.scope.user.theme || this.config.get(\"defaultTheme\") || \"taiga\";\n };\n\n return UserSettingsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserSettingsController\", UserSettingsController);\n\n UserProfileDirective = function($confirm, $auth, $repo, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var changeEmail, form, onError, onSuccess;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n changeEmail = $scope.user.isAttributeModified(\"email\");\n $scope.user.lang = $scope.lang;\n $scope.user.theme = $scope.theme;\n onSuccess = function(data) {\n var text;\n $auth.setUser(data);\n if (changeEmail) {\n text = $translate.instant(\"USER_PROFILE.CHANGE_EMAIL_SUCCESS\");\n return $confirm.success(text);\n } else {\n return $confirm.notify('success');\n }\n };\n onError = function(data) {\n form.setErrors(data);\n return $confirm.notify('error', data._error_message);\n };\n return $repo.save($scope.user).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserProfile\", [\"$tgConfirm\", \"$tgAuth\", \"$tgRepo\", \"$translate\", UserProfileDirective]);\n\n UserAvatarDirective = function($auth, $model, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, showSizeInfo;\n showSizeInfo = function() {\n return $el.find(\".size-info\").removeClass(\"hidden\");\n };\n onSuccess = function(response) {\n var user;\n user = $model.make_model(\"users\", response.data);\n $auth.setUser(user);\n $scope.user = user;\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('success');\n };\n onError = function(response) {\n if (response.status === 413) {\n showSizeInfo();\n }\n $el.find('.loading-overlay').removeClass('active');\n return $confirm.notify('error', response.data._error_message);\n };\n $el.on(\"click\", \".js-change-avatar\", function() {\n return $el.find(\"#avatar-field\").click();\n });\n $el.on(\"change\", \"#avatar-field\", function(event) {\n if ($scope.avatarAttachment) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.userSettings.changeAvatar($scope.avatarAttachment).then(onSuccess, onError);\n }\n });\n $el.on(\"click\", \"a.js-use-gravatar\", function(event) {\n $el.find('.loading-overlay').addClass(\"active\");\n return $rs.userSettings.removeAvatar().then(onSuccess, onError);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserAvatar\", [\"$tgAuth\", \"$tgModel\", \"$tgResources\", \"$tgConfirm\", UserAvatarDirective]);\n\n TaigaAvatarModelDirective = function($parse) {\n var link;\n link = function($scope, $el, $attrs) {\n var model, modelSetter;\n model = $parse($attrs.tgAvatarModel);\n modelSetter = model.assign;\n return $el.bind('change', function() {\n return $scope.$apply(function() {\n return modelSetter($scope, $el[0].files[0]);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive('tgAvatarModel', ['$parse', TaigaAvatarModelDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/nav.coffee\n */\n\n(function() {\n var UserSettingsNavigationDirective, module;\n\n UserSettingsNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgUserSettingsNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#usersettingsmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaUserSettings\");\n\n module.directive(\"tgUserSettingsNavigation\", UserSettingsNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings/notifications.coffee\n */\n\n(function() {\n var UserNotificationsController, UserNotificationsDirective, UserNotificationsListDirective, bindOnce, mixOf, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserNotificationsController = (function(superClass) {\n extend(UserNotificationsController, superClass);\n\n UserNotificationsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserNotificationsController(scope, rootscope, repo, confirm, rs, params, q, location, navUrls, auth) {\n var promise;\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.confirm = confirm;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n this.auth = auth;\n this.scope.sectionName = \"USER_SETTINGS.NOTIFICATIONS.SECTION_NAME\";\n this.scope.user = this.auth.getUser();\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserNotificationsController.prototype.loadInitialData = function() {\n return this.rs.notifyPolicies.list().then((function(_this) {\n return function(notifyPolicies) {\n _this.scope.notifyPolicies = notifyPolicies;\n return notifyPolicies;\n };\n })(this));\n };\n\n return UserNotificationsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserNotificationsController\", UserNotificationsController);\n\n UserNotificationsDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotifications\", UserNotificationsDirective);\n\n UserNotificationsListDirective = function($repo, $confirm, $compile) {\n var link, template;\n template = _.template(\"<% _.each(notifyPolicies, function (notifyPolicy, index) { %>\\n
\\\">\\n
<%- notifyPolicy.project_name %>
\\n
\\n
\\n \\\" id=\\\"policy-all-<%- notifyPolicy.id %>\\\"\\n value=\\\"2\\\" <% if (notifyPolicy.notify_level == 2) { %>checked=\\\"checked\\\"<% } %>/>\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-involved-<%- notifyPolicy.id %>\\\"\\n value=\\\"1\\\" <% if (notifyPolicy.notify_level == 1) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-none-<%- notifyPolicy.id %>\\\"\\n value=\\\"3\\\" <% if (notifyPolicy.notify_level == 3) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n<% }) %>\");\n link = function($scope, $el, $attrs) {\n var render;\n render = function() {\n var ctx, html;\n $el.off();\n ctx = {\n notifyPolicies: $scope.notifyPolicies\n };\n html = template(ctx);\n $el.html($compile(html)($scope));\n return $el.on(\"change\", \"input[type=radio]\", function(event) {\n var onError, onSuccess, policy, policyIndex, prev_level, target;\n target = angular.element(event.currentTarget);\n policyIndex = target.parents(\".policy-table-row\").data('index');\n policy = $scope.notifyPolicies[policyIndex];\n prev_level = policy.notify_level;\n policy.notify_level = parseInt(target.val(), 10);\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n return target.parents(\".policy-table-row\").find(\"input[value=\" + prev_level + \"]\").prop(\"checked\", true);\n };\n return $repo.save(policy).then(onSuccess, onError);\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotificationsList\", [\"$tgRepo\", \"$tgConfirm\", \"$compile\", UserNotificationsListDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: components.module.coffee\n */\n\n(function() {\n angular.module(\"taigaComponents\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaDiscover\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-apps.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaExternalApps\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaHome\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: navigation-bar.module.coffee\n */\n\n(function() {\n angular.module(\"taigaNavigationBar\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile.module.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaProfile\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects.module.coffee\n */\n\n(function() {\n angular.module(\"taigaProjects\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: resources.module.coffee\n */\n\n(function() {\n angular.module(\"taigaResources2\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline.module.coffee\n */\n\n(function() {\n angular.module(\"taigaUserTimeline\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachment-link.directive.coffee\n */\n\n(function() {\n var AttachmentLinkDirective;\n\n AttachmentLinkDirective = function($parse, lightboxFactory) {\n var link;\n link = function(scope, el, attrs) {\n var attachment;\n attachment = $parse(attrs.tgAttachmentLink)(scope);\n el.on(\"click\", function(event) {\n if (taiga.isImage(attachment.getIn(['file', 'name']))) {\n event.preventDefault();\n return scope.$apply(function() {\n return lightboxFactory.create('tg-lb-attachment-preview', {\n \"class\": 'lightbox lightbox-block'\n }, {\n file: attachment.get('file')\n });\n });\n }\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n link: link\n };\n };\n\n AttachmentLinkDirective.$inject = [\"$parse\", \"tgLightboxFactory\"];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentLink\", AttachmentLinkDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachment-gallery.directive.coffee\n */\n\n(function() {\n var AttachmentGalleryDirective;\n\n AttachmentGalleryDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n scope: {},\n bindToController: {\n attachment: \"=\",\n onDelete: \"&\",\n onUpdate: \"&\",\n type: \"=\"\n },\n controller: \"Attachment\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachment/attachment-gallery.html\",\n link: link\n };\n };\n\n AttachmentGalleryDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentGallery\", AttachmentGalleryDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchment.controller.coffee\n */\n\n(function() {\n var AttachmentController;\n\n AttachmentController = (function() {\n AttachmentController.$inject = ['tgAttachmentsService', '$translate'];\n\n function AttachmentController(attachmentsService, translate) {\n this.attachmentsService = attachmentsService;\n this.translate = translate;\n this.form = {};\n this.form.description = this.attachment.getIn(['file', 'description']);\n this.form.is_deprecated = this.attachment.get(['file', 'is_deprecated']);\n this.title = this.translate.instant(\"ATTACHMENT.TITLE\", {\n fileName: this.attachment.get('name'),\n date: moment(this.attachment.get('created_date')).format(this.translate.instant(\"ATTACHMENT.DATE\"))\n });\n }\n\n AttachmentController.prototype.editMode = function(mode) {\n var attachment;\n attachment = this.attachment.set('editable', mode);\n return this.onUpdate({\n attachment: attachment\n });\n };\n\n AttachmentController.prototype[\"delete\"] = function() {\n return this.onDelete({\n attachment: this.attachment\n });\n };\n\n AttachmentController.prototype.save = function() {\n var attachment;\n attachment = this.attachment.set('loading', true);\n this.onUpdate({\n attachment: attachment\n });\n attachment = this.attachment.merge({\n editable: false,\n loading: false\n });\n attachment = attachment.mergeIn(['file'], {\n description: this.form.description,\n is_deprecated: !!this.form.is_deprecated\n });\n return this.onUpdate({\n attachment: attachment\n });\n };\n\n return AttachmentController;\n\n })();\n\n angular.module('taigaComponents').controller('Attachment', AttachmentController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachment.directive.coffee\n */\n\n(function() {\n var AttachmentDirective;\n\n AttachmentDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n scope: {},\n bindToController: {\n attachment: \"=\",\n onDelete: \"&\",\n onUpdate: \"&\",\n type: \"=\"\n },\n controller: \"Attachment\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachment/attachment.html\",\n link: link\n };\n };\n\n AttachmentDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachment\", AttachmentDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-drop.directive.coffee\n */\n\n(function() {\n var AttachmentsDropDirective;\n\n AttachmentsDropDirective = function($parse) {\n var link;\n link = function(scope, el, attrs) {\n var eventAttr;\n eventAttr = $parse(attrs.tgAttachmentsDrop);\n el.on('dragover', function(e) {\n e.preventDefault();\n return false;\n });\n el.on('drop', function(e) {\n var dataTransfer;\n e.stopPropagation();\n e.preventDefault();\n dataTransfer = e.dataTransfer || (e.originalEvent && e.originalEvent.dataTransfer);\n return scope.$apply(function() {\n return eventAttr(scope, {\n files: dataTransfer.files\n });\n });\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n link: link\n };\n };\n\n AttachmentsDropDirective.$inject = [\"$parse\"];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsDrop\", AttachmentsDropDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-full.controller.coffee\n */\n\n(function() {\n var AttachmentsFullController, sizeFormat;\n\n sizeFormat = this.taiga.sizeFormat;\n\n AttachmentsFullController = (function() {\n AttachmentsFullController.$inject = [\"$translate\", \"$tgConfirm\", \"$tgConfig\", \"$tgStorage\", \"tgAttachmentsFullService\", \"tgProjectService\"];\n\n function AttachmentsFullController(translate, confirm, config, storage, attachmentsFullService, projectService) {\n this.translate = translate;\n this.confirm = confirm;\n this.config = config;\n this.storage = storage;\n this.attachmentsFullService = attachmentsFullService;\n this.projectService = projectService;\n this.mode = this.storage.get('attachment-mode', 'list');\n this.maxFileSize = this.config.get(\"maxUploadFileSize\", null);\n if (this.maxFileSize) {\n this.maxFileSize = sizeFormat(this.maxFileSize);\n }\n this.maxFileSizeMsg = this.maxFileSize ? this.translate.instant(\"ATTACHMENT.MAX_UPLOAD_SIZE\", {\n maxFileSize: this.maxFileSize\n }) : \"\";\n taiga.defineImmutableProperty(this, 'attachments', (function(_this) {\n return function() {\n return _this.attachmentsFullService.attachments;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsCount', (function(_this) {\n return function() {\n return _this.attachmentsFullService.deprecatedsCount;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'attachmentsVisible', (function(_this) {\n return function() {\n return _this.attachmentsFullService.attachmentsVisible;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsVisible', (function(_this) {\n return function() {\n return _this.attachmentsFullService.deprecatedsVisible;\n };\n })(this));\n }\n\n AttachmentsFullController.prototype.uploadingAttachments = function() {\n return this.attachmentsFullService.uploadingAttachments;\n };\n\n AttachmentsFullController.prototype.addAttachment = function(file) {\n var editable;\n editable = this.mode === 'list';\n return this.attachmentsFullService.addAttachment(this.projectId, this.objId, this.type, file, editable);\n };\n\n AttachmentsFullController.prototype.setMode = function(mode) {\n this.mode = mode;\n return this.storage.set('attachment-mode', mode);\n };\n\n AttachmentsFullController.prototype.toggleDeprecatedsVisible = function() {\n return this.attachmentsFullService.toggleDeprecatedsVisible();\n };\n\n AttachmentsFullController.prototype.addAttachments = function(files) {\n return _.forEach(files, (function(_this) {\n return function(file) {\n return _this.addAttachment(file);\n };\n })(this));\n };\n\n AttachmentsFullController.prototype.loadAttachments = function() {\n return this.attachmentsFullService.loadAttachments(this.type, this.objId, this.projectId);\n };\n\n AttachmentsFullController.prototype.deleteAttachment = function(toDeleteAttachment) {\n var message, title;\n title = this.translate.instant(\"ATTACHMENT.TITLE_LIGHTBOX_DELETE_ATTACHMENT\");\n message = this.translate.instant(\"ATTACHMENT.MSG_LIGHTBOX_DELETE_ATTACHMENT\", {\n fileName: toDeleteAttachment.getIn(['file', 'name'])\n });\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var onError, onSuccess;\n onError = function() {\n message = _this.translate.instant(\"ATTACHMENT.ERROR_DELETE_ATTACHMENT\", {\n errorMessage: message\n });\n _this.confirm.notify(\"error\", null, message);\n return askResponse.finish(false);\n };\n onSuccess = function() {\n return askResponse.finish();\n };\n return _this.attachmentsFullService.deleteAttachment(toDeleteAttachment, _this.type).then(onSuccess, onError);\n };\n })(this));\n };\n\n AttachmentsFullController.prototype.reorderAttachment = function(attachment, newIndex) {\n return this.attachmentsFullService.reorderAttachment(this.type, attachment, newIndex);\n };\n\n AttachmentsFullController.prototype.updateAttachment = function(toUpdateAttachment) {\n return this.attachmentsFullService.updateAttachment(toUpdateAttachment, this.type);\n };\n\n AttachmentsFullController.prototype._isEditable = function() {\n if (this.projectService.project) {\n return this.projectService.hasPermission(this.editPermission);\n }\n return false;\n };\n\n AttachmentsFullController.prototype.showAttachments = function() {\n return this._isEditable() || this.attachmentsFullService.attachments.size;\n };\n\n return AttachmentsFullController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"AttachmentsFull\", AttachmentsFullController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-full.directive.coffee\n */\n\n(function() {\n var AttachmentsFullDirective, bindOnce;\n\n bindOnce = this.taiga.bindOnce;\n\n AttachmentsFullDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return bindOnce(scope, 'vm.objId', function(value) {\n return ctrl.loadAttachments();\n });\n };\n return {\n scope: {},\n bindToController: {\n type: \"@\",\n objId: \"=\",\n projectId: \"=\",\n editPermission: \"@\"\n },\n controller: \"AttachmentsFull\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachments-full/attachments-full.html\",\n link: link\n };\n };\n\n AttachmentsFullDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsFull\", AttachmentsFullDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-full.service.coffee\n */\n\n(function() {\n var AttachmentsFullService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n AttachmentsFullService = (function(superClass) {\n extend(AttachmentsFullService, superClass);\n\n AttachmentsFullService.$inject = [\"tgAttachmentsService\", \"$rootScope\"];\n\n function AttachmentsFullService(attachmentsService, rootScope) {\n this.attachmentsService = attachmentsService;\n this.rootScope = rootScope;\n this._attachments = Immutable.List();\n this._deprecatedsCount = 0;\n this._attachmentsVisible = Immutable.List();\n this._deprecatedsVisible = false;\n this.uploadingAttachments = [];\n taiga.defineImmutableProperty(this, 'attachments', (function(_this) {\n return function() {\n return _this._attachments;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsCount', (function(_this) {\n return function() {\n return _this._deprecatedsCount;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'attachmentsVisible', (function(_this) {\n return function() {\n return _this._attachmentsVisible;\n };\n })(this));\n taiga.defineImmutableProperty(this, 'deprecatedsVisible', (function(_this) {\n return function() {\n return _this._deprecatedsVisible;\n };\n })(this));\n }\n\n AttachmentsFullService.prototype.toggleDeprecatedsVisible = function() {\n this._deprecatedsVisible = !this._deprecatedsVisible;\n return this.regenerate();\n };\n\n AttachmentsFullService.prototype.regenerate = function() {\n this._deprecatedsCount = this._attachments.count(function(it) {\n return it.getIn(['file', 'is_deprecated']);\n });\n if (this._deprecatedsVisible) {\n return this._attachmentsVisible = this._attachments;\n } else {\n return this._attachmentsVisible = this._attachments.filter(function(it) {\n return !it.getIn(['file', 'is_deprecated']);\n });\n }\n };\n\n AttachmentsFullService.prototype.addAttachment = function(projectId, objId, type, file, editable) {\n if (editable == null) {\n editable = true;\n }\n return new Promise((function(_this) {\n return function(resolve, reject) {\n var promise;\n if (_this.attachmentsService.validate(file)) {\n _this.uploadingAttachments.push(file);\n promise = _this.attachmentsService.upload(file, objId, projectId, type);\n return promise.then(function(file) {\n var attachment;\n _this.uploadingAttachments = _this.uploadingAttachments.filter(function(uploading) {\n return uploading.name !== file.get('name');\n });\n attachment = Immutable.Map();\n attachment = attachment.merge({\n file: file,\n editable: editable,\n loading: false\n });\n _this._attachments = _this._attachments.push(attachment);\n _this.regenerate();\n _this.rootScope.$broadcast(\"attachment:create\");\n return resolve(attachment);\n });\n } else {\n return reject(file);\n }\n };\n })(this));\n };\n\n AttachmentsFullService.prototype.loadAttachments = function(type, objId, projectId) {\n return this.attachmentsService.list(type, objId, projectId).then((function(_this) {\n return function(files) {\n _this._attachments = files.map(function(file) {\n var attachment;\n attachment = Immutable.Map();\n return attachment.merge({\n loading: false,\n editable: false,\n file: file\n });\n });\n return _this.regenerate();\n };\n })(this));\n };\n\n AttachmentsFullService.prototype.deleteAttachment = function(toDeleteAttachment, type) {\n var onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this._attachments = _this._attachments.filter(function(attachment) {\n return attachment !== toDeleteAttachment;\n });\n return _this.regenerate();\n };\n })(this);\n return this.attachmentsService[\"delete\"](type, toDeleteAttachment.getIn(['file', 'id'])).then(onSuccess);\n };\n\n AttachmentsFullService.prototype.reorderAttachment = function(type, attachment, newIndex) {\n var attachments, oldIndex, promises;\n oldIndex = this.attachments.findIndex(function(it) {\n return it === attachment;\n });\n if (oldIndex === newIndex) {\n return;\n }\n attachments = this.attachments.remove(oldIndex);\n attachments = attachments.splice(newIndex, 0, attachment);\n attachments = attachments.map(function(x, i) {\n return x.setIn(['file', 'order'], i + 1);\n });\n promises = [];\n attachments.forEach((function(_this) {\n return function(attachment) {\n var patch;\n patch = {\n order: attachment.getIn(['file', 'order'])\n };\n return promises.push(_this.attachmentsService.patch(attachment.getIn(['file', 'id']), type, patch));\n };\n })(this));\n return Promise.all(promises).then((function(_this) {\n return function() {\n _this._attachments = attachments;\n return _this.regenerate();\n };\n })(this));\n };\n\n AttachmentsFullService.prototype.updateAttachment = function(toUpdateAttachment, type) {\n var index, oldAttachment, patch;\n index = this._attachments.findIndex(function(attachment) {\n return attachment.getIn(['file', 'id']) === toUpdateAttachment.getIn(['file', 'id']);\n });\n oldAttachment = this._attachments.get(index);\n patch = taiga.patch(oldAttachment.get('file'), toUpdateAttachment.get('file'));\n if (toUpdateAttachment.get('loading')) {\n this._attachments = this._attachments.set(index, toUpdateAttachment);\n return this.regenerate();\n } else {\n return this.attachmentsService.patch(toUpdateAttachment.getIn(['file', 'id']), type, patch).then((function(_this) {\n return function() {\n _this._attachments = _this._attachments.set(index, toUpdateAttachment);\n return _this.regenerate();\n };\n })(this));\n }\n };\n\n return AttachmentsFullService;\n\n })(taiga.Service);\n\n angular.module(\"taigaComponents\").service(\"tgAttachmentsFullService\", AttachmentsFullService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-simple.controller.coffee\n */\n\n(function() {\n var AttachmentsSimpleController;\n\n AttachmentsSimpleController = (function() {\n AttachmentsSimpleController.$inject = [\"tgAttachmentsService\"];\n\n function AttachmentsSimpleController(attachmentsService) {\n this.attachmentsService = attachmentsService;\n }\n\n AttachmentsSimpleController.prototype.addAttachment = function(file) {\n var attachment;\n attachment = Immutable.fromJS({\n file: file,\n name: file.name,\n size: file.size\n });\n if (this.attachmentsService.validate(file)) {\n this.attachments = this.attachments.push(attachment);\n if (this.onAdd) {\n return this.onAdd({\n attachment: attachment\n });\n }\n }\n };\n\n AttachmentsSimpleController.prototype.addAttachments = function(files) {\n return _.forEach(files, this.addAttachment.bind(this));\n };\n\n AttachmentsSimpleController.prototype.deleteAttachment = function(toDeleteAttachment) {\n this.attachments = this.attachments.filter(function(attachment) {\n return attachment !== toDeleteAttachment;\n });\n if (this.onDelete) {\n return this.onDelete({\n attachment: toDeleteAttachment\n });\n }\n };\n\n return AttachmentsSimpleController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"AttachmentsSimple\", AttachmentsSimpleController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attchments-simple.directive.coffee\n */\n\n(function() {\n var AttachmentsSimpleDirective;\n\n AttachmentsSimpleDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n scope: {},\n bindToController: {\n attachments: \"=\",\n onAdd: \"&\",\n onDelete: \"&\"\n },\n controller: \"AttachmentsSimple\",\n controllerAs: \"vm\",\n templateUrl: \"components/attachments-simple/attachments-simple.html\",\n link: link\n };\n };\n\n AttachmentsSimpleDirective.$inject = [];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsSimple\", AttachmentsSimpleDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-sortable.directive.coffee\n */\n\n(function() {\n var AttachmentSortableDirective;\n\n AttachmentSortableDirective = function($parse) {\n var link;\n link = function(scope, el, attrs) {\n var callback;\n callback = $parse(attrs.tgAttachmentsSortable);\n el.sortable({\n items: \"div[tg-bind-scope]\",\n handle: \".settings .icon\",\n containment: \".attachments\",\n dropOnEmpty: true,\n helper: 'clone',\n scroll: false,\n tolerance: \"pointer\",\n placeholder: \"sortable-placeholder single-attachment\"\n });\n el.on(\"sortstop\", function(event, ui) {\n var attachment, newIndex;\n attachment = ui.item.scope().attachment;\n newIndex = ui.item.index();\n return scope.$apply(function() {\n return callback(scope, {\n attachment: attachment,\n index: newIndex\n });\n });\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n link: link\n };\n };\n\n AttachmentSortableDirective.$inject = [\"$parse\"];\n\n angular.module(\"taigaComponents\").directive(\"tgAttachmentsSortable\", AttachmentSortableDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: auto-select.directive.coffee\n */\n\n(function() {\n var AutoSelectDirective;\n\n AutoSelectDirective = function($timeout) {\n return {\n link: function(scope, elm) {\n return $timeout(function() {\n return elm[0].select();\n });\n }\n };\n };\n\n AutoSelectDirective.$inject = ['$timeout'];\n\n angular.module(\"taigaComponents\").directive(\"tgAutoSelect\", AutoSelectDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: file-change.directive.coffee\n */\n\n(function() {\n var FileChangeDirective;\n\n FileChangeDirective = function($parse) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var eventAttr;\n eventAttr = $parse(attrs.tgFileChange);\n el.on('change', function(event) {\n return scope.$apply(function() {\n return eventAttr(scope, {\n files: event.currentTarget.files\n });\n });\n });\n return scope.$on(\"$destroy\", function() {\n return el.off();\n });\n };\n return {\n require: \"ngModel\",\n restrict: \"A\",\n link: link\n };\n };\n\n FileChangeDirective.$inject = [\"$parse\"];\n\n angular.module(\"taigaComponents\").directive(\"tgFileChange\", FileChangeDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: joy-ride.directive.coffee\n */\n\n(function() {\n var JoyRideDirective, taiga;\n\n taiga = this.taiga;\n\n JoyRideDirective = function($rootScope, currentUserService, joyRideService, $location, $translate) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var initJoyrRide, intro, unsuscribe;\n unsuscribe = null;\n intro = introJs();\n intro.oncomplete(function() {\n return $('html,body').scrollTop(0);\n });\n intro.onexit(function() {\n return currentUserService.disableJoyRide();\n });\n initJoyrRide = function(next, config) {\n if (!config[next.joyride]) {\n return;\n }\n intro.setOptions({\n exitOnEsc: false,\n exitOnOverlayClick: false,\n showStepNumbers: false,\n nextLabel: $translate.instant('JOYRIDE.NAV.NEXT') + ' →',\n prevLabel: '← ' + $translate.instant('JOYRIDE.NAV.BACK'),\n skipLabel: $translate.instant('JOYRIDE.NAV.SKIP'),\n doneLabel: $translate.instant('JOYRIDE.NAV.DONE'),\n disableInteraction: true\n });\n intro.setOption('steps', joyRideService.get(next.joyride));\n return intro.start();\n };\n return $rootScope.$on('$routeChangeSuccess', function(event, next) {\n if (!next.joyride || !currentUserService.isAuthenticated()) {\n intro.exit();\n if (unsuscribe) {\n unsuscribe();\n }\n return;\n }\n intro.oncomplete(function() {\n return currentUserService.disableJoyRide(next.joyride);\n });\n if (next.loader) {\n return unsuscribe = $rootScope.$on('loader:end', function() {\n currentUserService.loadJoyRideConfig().then(function(config) {\n return initJoyrRide(next, config);\n });\n return unsuscribe();\n });\n } else {\n return currentUserService.loadJoyRideConfig().then(function(config) {\n return initJoyrRide(next, config);\n });\n }\n });\n };\n return {\n scope: {},\n link: link\n };\n };\n\n JoyRideDirective.$inject = [\"$rootScope\", \"tgCurrentUserService\", \"tgJoyRideService\", \"$location\", \"$translate\"];\n\n angular.module(\"taigaComponents\").directive(\"tgJoyRide\", JoyRideDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: joy-ride.service.coffee\n */\n\n(function() {\n var JoyRideService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n JoyRideService = (function(superClass) {\n extend(JoyRideService, superClass);\n\n JoyRideService.$inject = ['$translate', 'tgCheckPermissionsService'];\n\n function JoyRideService(translate, checkPermissionsService) {\n this.translate = translate;\n this.checkPermissionsService = checkPermissionsService;\n }\n\n JoyRideService.prototype.getConfig = function() {\n return {\n dashboard: (function(_this) {\n return function() {\n var steps;\n steps = [\n {\n element: '.project-list > section:not(.ng-hide)',\n position: 'left',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP1.TITLE'),\n text: _this.translate.instant('JOYRIDE.DASHBOARD.STEP1.TEXT')\n }\n }, {\n element: '.working-on-container',\n position: 'right',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP2.TITLE'),\n text: _this.translate.instant('JOYRIDE.DASHBOARD.STEP2.TEXT')\n }\n }, {\n element: '.watching-container',\n position: 'right',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP3.TITLE'),\n text: [_this.translate.instant('JOYRIDE.DASHBOARD.STEP3.TEXT1'), _this.translate.instant('JOYRIDE.DASHBOARD.STEP3.TEXT2')]\n }\n }\n ];\n if (!$('.project-list .create-project-button').is(':hidden')) {\n steps.push({\n element: '.project-list .create-project-button',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.DASHBOARD.STEP4.TITLE'),\n text: [_this.translate.instant('JOYRIDE.DASHBOARD.STEP4.TEXT1'), _this.translate.instant('JOYRIDE.DASHBOARD.STEP4.TEXT2')]\n }\n });\n }\n return steps;\n };\n })(this),\n backlog: (function(_this) {\n return function() {\n var steps;\n steps = [\n {\n element: '.summary',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP1.TITLE'),\n text: [_this.translate.instant('JOYRIDE.BACKLOG.STEP1.TEXT1'), _this.translate.instant('JOYRIDE.BACKLOG.STEP1.TEXT2')]\n }\n }, {\n element: '.backlog-table-empty',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP2.TITLE'),\n text: _this.translate.instant('JOYRIDE.BACKLOG.STEP2.TEXT')\n }\n }, {\n element: '.sprints',\n position: 'left',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP3.TITLE'),\n text: _this.translate.instant('JOYRIDE.BACKLOG.STEP3.TEXT')\n }\n }\n ];\n if (_this.checkPermissionsService.check('add_us')) {\n steps.push({\n element: '.new-us',\n position: 'rigth',\n joyride: {\n title: _this.translate.instant('JOYRIDE.BACKLOG.STEP4.TITLE'),\n text: _this.translate.instant('JOYRIDE.BACKLOG.STEP4.TEXT')\n }\n });\n }\n return steps;\n };\n })(this),\n kanban: (function(_this) {\n return function() {\n var steps;\n steps = [\n {\n element: '.kanban-table-inner',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.KANBAN.STEP1.TITLE'),\n text: _this.translate.instant('JOYRIDE.KANBAN.STEP1.TEXT')\n }\n }, {\n element: '.card-placeholder',\n position: 'right',\n joyride: {\n title: _this.translate.instant('JOYRIDE.KANBAN.STEP2.TITLE'),\n text: _this.translate.instant('JOYRIDE.KANBAN.STEP2.TEXT')\n }\n }\n ];\n if (_this.checkPermissionsService.check('add_us')) {\n steps.push({\n element: '.icon-plus',\n position: 'bottom',\n joyride: {\n title: _this.translate.instant('JOYRIDE.KANBAN.STEP3.TITLE'),\n text: [_this.translate.instant('JOYRIDE.KANBAN.STEP3.TEXT1'), _this.translate.instant('JOYRIDE.KANBAN.STEP3.TEXT2')]\n }\n });\n }\n return steps;\n };\n })(this)\n };\n };\n\n JoyRideService.prototype.get = function(name) {\n var joyRide, joyRides;\n joyRides = this.getConfig();\n joyRide = joyRides[name].call(this);\n return _.map(joyRide, function(item) {\n var html;\n html = \"\";\n if (item.joyride.title) {\n html += \"

\" + item.joyride.title + \"

\";\n }\n if (_.isArray(item.joyride.text)) {\n _.forEach(item.joyride.text, function(text) {\n return html += \"

\" + text + \"

\";\n });\n } else {\n html += \"

\" + item.joyride.text + \"

\";\n }\n item.intro = html;\n return item;\n });\n };\n\n return JoyRideService;\n\n })(taiga.Service);\n\n angular.module(\"taigaComponents\").service(\"tgJoyRideService\", JoyRideService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Andrey Antukh \n * Copyright (C) 2014-2015 Jesús Espino Garcia \n * Copyright (C) 2014-2015 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: live-announcement.directive.coffee\n */\n\n(function() {\n var LiveAnnouncementDirective;\n\n LiveAnnouncementDirective = function(liveAnnouncementService) {\n var link;\n link = function(scope, el, attrs) {};\n return {\n restrict: \"AE\",\n scope: {},\n controllerAs: 'vm',\n controller: function() {\n this.close = function() {\n return liveAnnouncementService.open = false;\n };\n return Object.defineProperties(this, {\n open: {\n get: function() {\n return liveAnnouncementService.open;\n }\n },\n title: {\n get: function() {\n return liveAnnouncementService.title;\n }\n },\n desc: {\n get: function() {\n return liveAnnouncementService.desc;\n }\n }\n });\n },\n link: link,\n templateUrl: \"components/live-announcement/live-announcement.html\"\n };\n };\n\n LiveAnnouncementDirective.$inject = [\"tgLiveAnnouncementService\"];\n\n angular.module(\"taigaComponents\").directive(\"tgLiveAnnouncement\", LiveAnnouncementDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: notification.service.coffee\n */\n\n(function() {\n var LiveAnnouncementService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n LiveAnnouncementService = (function(superClass) {\n extend(LiveAnnouncementService, superClass);\n\n function LiveAnnouncementService() {\n this.open = false;\n this.title = \"\";\n this.desc = \"\";\n }\n\n LiveAnnouncementService.prototype.show = function(title, desc) {\n this.open = true;\n this.title = title;\n return this.desc = desc;\n };\n\n return LiveAnnouncementService;\n\n })(taiga.Service);\n\n angular.module(\"taigaComponents\").service(\"tgLiveAnnouncementService\", LiveAnnouncementService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-logo-big-src.directive.coffee\n */\n\n(function() {\n var ProjectLogoBigSrcDirective;\n\n ProjectLogoBigSrcDirective = function(projectLogoService) {\n var link;\n link = function(scope, el, attrs) {\n return scope.$watch('project', function(project) {\n var logo, projectLogo;\n project = Immutable.fromJS(project);\n if (!project) {\n return;\n }\n projectLogo = project.get('logo_big_url');\n if (projectLogo) {\n el.attr('src', projectLogo);\n return el.css('background', \"\");\n } else {\n logo = projectLogoService.getDefaultProjectLogo(project.get('slug'), project.get('id'));\n el.attr('src', logo.src);\n return el.css('background', logo.color);\n }\n });\n };\n return {\n link: link,\n scope: {\n project: \"=tgProjectLogoBigSrc\"\n }\n };\n };\n\n ProjectLogoBigSrcDirective.$inject = [\"tgProjectLogoService\"];\n\n angular.module(\"taigaComponents\").directive(\"tgProjectLogoBigSrc\", ProjectLogoBigSrcDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-logo-small-src.directive.coffee\n */\n\n(function() {\n var ProjectLogoSmallSrcDirective;\n\n ProjectLogoSmallSrcDirective = function(projectLogoService) {\n var link;\n link = function(scope, el, attrs) {\n return scope.$watch('project', function(project) {\n var logo, projectLogo;\n project = Immutable.fromJS(project);\n if (!project) {\n return;\n }\n projectLogo = project.get('logo_small_url');\n if (projectLogo) {\n el.attr('src', projectLogo);\n return el.css('background', \"\");\n } else {\n logo = projectLogoService.getDefaultProjectLogo(project.get('slug'), project.get('id'));\n el.attr('src', logo.src);\n return el.css('background', logo.color);\n }\n });\n };\n return {\n link: link,\n scope: {\n project: \"=tgProjectLogoSmallSrc\"\n }\n };\n };\n\n ProjectLogoSmallSrcDirective.$inject = [\"tgProjectLogoService\"];\n\n angular.module(\"taigaComponents\").directive(\"tgProjectLogoSmallSrc\", ProjectLogoSmallSrcDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-menu.controller.coffee\n */\n\n(function() {\n var ProjectMenuController;\n\n ProjectMenuController = (function() {\n ProjectMenuController.$inject = [\"tgProjectService\", \"tgLightboxFactory\"];\n\n function ProjectMenuController(projectService, lightboxFactory) {\n this.projectService = projectService;\n this.lightboxFactory = lightboxFactory;\n this.project = null;\n this.menu = Immutable.Map();\n }\n\n ProjectMenuController.prototype.show = function() {\n this.project = this.projectService.project;\n this.active = this._getActiveSection();\n this._setVideoConference();\n return this._setMenuPermissions();\n };\n\n ProjectMenuController.prototype.hide = function() {\n this.project = null;\n return this.menu = {};\n };\n\n ProjectMenuController.prototype.search = function() {\n return this.lightboxFactory.create(\"tg-search-box\", {\n \"class\": \"lightbox lightbox-search\"\n });\n };\n\n ProjectMenuController.prototype._setVideoConference = function() {\n var videoconferenceUrl;\n videoconferenceUrl = this._videoConferenceUrl();\n if (videoconferenceUrl) {\n return this.project = this.project.set(\"videoconferenceUrl\", videoconferenceUrl);\n }\n };\n\n ProjectMenuController.prototype._setMenuPermissions = function() {\n this.menu = Immutable.Map({\n backlog: false,\n kanban: false,\n issues: false,\n wiki: false\n });\n if (this.project.get(\"is_backlog_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_us\") !== -1) {\n this.menu = this.menu.set(\"backlog\", true);\n }\n if (this.project.get(\"is_kanban_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_us\") !== -1) {\n this.menu = this.menu.set(\"kanban\", true);\n }\n if (this.project.get(\"is_issues_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_issues\") !== -1) {\n this.menu = this.menu.set(\"issues\", true);\n }\n if (this.project.get(\"is_wiki_activated\") && this.project.get(\"my_permissions\").indexOf(\"view_wiki_pages\") !== -1) {\n return this.menu = this.menu.set(\"wiki\", true);\n }\n };\n\n ProjectMenuController.prototype._getActiveSection = function() {\n var indexBacklog, indexKanban, oldSectionName, sectionName, sectionsBreadcrumb;\n sectionName = this.projectService.section;\n sectionsBreadcrumb = this.projectService.sectionsBreadcrumb;\n indexBacklog = sectionsBreadcrumb.lastIndexOf(\"backlog\");\n indexKanban = sectionsBreadcrumb.lastIndexOf(\"kanban\");\n if (indexBacklog !== -1 || indexKanban !== -1) {\n if (indexKanban === -1 || indexBacklog > indexKanban) {\n oldSectionName = \"backlog\";\n } else {\n oldSectionName = \"kanban\";\n }\n }\n if (sectionName === \"backlog-kanban\") {\n if (oldSectionName === \"backlog\" || oldSectionName === \"kanban\") {\n sectionName = oldSectionName;\n } else if (this.project.get(\"is_backlog_activated\") && !this.project.get(\"is_kanban_activated\")) {\n sectionName = \"backlog\";\n } else if (!this.project.get(\"is_backlog_activated\") && this.project.get(\"is_kanban_activated\")) {\n sectionName = \"kanban\";\n }\n }\n return sectionName;\n };\n\n ProjectMenuController.prototype._videoConferenceUrl = function() {\n var baseUrl, url;\n if (this.project.get(\"videoconferences\") === \"appear-in\") {\n baseUrl = \"https://appear.in/\";\n } else if (this.project.get(\"videoconferences\") === \"talky\") {\n baseUrl = \"https://talky.io/\";\n } else if (this.project.get(\"videoconferences\") === \"jitsi\") {\n baseUrl = \"https://meet.jit.si/\";\n } else if (this.project.get(\"videoconferences\") === \"custom\") {\n return this.project.get(\"videoconferences_extra_data\");\n } else {\n return \"\";\n }\n if (this.project.get(\"videoconferences_extra_data\")) {\n url = this.project.get(\"slug\") + \"-\" + taiga.slugify(this.project.get(\"videoconferences_extra_data\"));\n } else {\n url = this.project.get(\"slug\");\n }\n if (this.project.get(\"videoconferences\") === \"jitsi\") {\n url = url.replace(/-/g, \"\");\n }\n return baseUrl + url;\n };\n\n return ProjectMenuController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"ProjectMenu\", ProjectMenuController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-menu.directive.coffee\n */\n\n(function() {\n var ProjectMenuDirective, taiga;\n\n taiga = this.taiga;\n\n ProjectMenuDirective = function(projectService, lightboxFactory) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var projectChange;\n projectChange = function() {\n if (projectService.project) {\n return ctrl.show();\n } else {\n return ctrl.hide();\n }\n };\n scope.$watch((function() {\n return projectService.project;\n }), projectChange);\n scope.vm.fixed = false;\n return $(window).on(\"scroll\", function() {\n var position;\n position = $(window).scrollTop();\n if (position > 100 && scope.vm.fixed === false) {\n scope.vm.fixed = true;\n return scope.$digest();\n } else if (position < 100 && scope.vm.fixed === true) {\n scope.vm.fixed = false;\n return scope.$digest();\n }\n });\n };\n return {\n scope: {},\n controller: \"ProjectMenu\",\n controllerAs: \"vm\",\n templateUrl: \"components/project-menu/project-menu.html\",\n link: link\n };\n };\n\n ProjectMenuDirective.$inject = [\"tgProjectService\", \"tgLightboxFactory\"];\n\n angular.module(\"taigaComponents\").directive(\"tgProjectMenu\", ProjectMenuDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/components/terms-of-service-and-privacy-policy-notice/terms-of-service-and-privacy-policy-notice.directive.coffee\n */\n\n(function() {\n var TermsOfServiceAndPrivacyPolicyNoticeDirective;\n\n TermsOfServiceAndPrivacyPolicyNoticeDirective = function($config) {\n var link;\n link = function(scope, el, attrs) {\n scope.privacyPolicyUrl = $config.get(\"privacyPolicyUrl\");\n return scope.termsOfServiceUrl = $config.get(\"termsOfServiceUrl\");\n };\n return {\n restrict: \"AE\",\n scope: {},\n link: link,\n templateUrl: \"components/terms-of-service-and-privacy-policy-notice/terms-of-service-and-privacy-policy-notice.html\"\n };\n };\n\n angular.module(\"taigaComponents\").directive(\"tgTermsOfServiceAndPrivacyPolicyNotice\", [\"$tgConfig\", TermsOfServiceAndPrivacyPolicyNoticeDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: vote-button.controller.coffee\n */\n\n(function() {\n var VoteButtonController;\n\n VoteButtonController = (function() {\n VoteButtonController.$inject = [\"tgCurrentUserService\"];\n\n function VoteButtonController(currentUserService) {\n this.currentUserService = currentUserService;\n this.user = this.currentUserService.getUser();\n this.isMouseOver = false;\n this.loading = false;\n }\n\n VoteButtonController.prototype.showTextWhenMouseIsOver = function() {\n return this.isMouseOver = true;\n };\n\n VoteButtonController.prototype.showTextWhenMouseIsLeave = function() {\n return this.isMouseOver = false;\n };\n\n VoteButtonController.prototype.toggleVote = function() {\n var promise;\n this.loading = true;\n if (!this.item.is_voter) {\n promise = this._upvote();\n } else {\n promise = this._downvote();\n }\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n return promise;\n };\n\n VoteButtonController.prototype._upvote = function() {\n return this.onUpvote().then((function(_this) {\n return function() {\n return _this.showTextWhenMouseIsLeave();\n };\n })(this));\n };\n\n VoteButtonController.prototype._downvote = function() {\n return this.onDownvote();\n };\n\n return VoteButtonController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"VoteButton\", VoteButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: vote-button.directive.coffee\n */\n\n(function() {\n var VoteButtonDirective;\n\n VoteButtonDirective = function() {\n return {\n scope: {},\n controller: \"VoteButton\",\n bindToController: {\n item: \"=\",\n onUpvote: \"=\",\n onDownvote: \"=\"\n },\n controllerAs: \"vm\",\n templateUrl: \"components/vote-button/vote-button.html\"\n };\n };\n\n angular.module(\"taigaComponents\").directive(\"tgVoteButton\", VoteButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-button.controller.coffee\n */\n\n(function() {\n var WatchButtonController;\n\n WatchButtonController = (function() {\n WatchButtonController.$inject = [\"tgCurrentUserService\", \"$rootScope\"];\n\n function WatchButtonController(currentUserService, rootScope) {\n this.currentUserService = currentUserService;\n this.rootScope = rootScope;\n this.user = this.currentUserService.getUser();\n this.isMouseOver = false;\n this.loading = false;\n }\n\n WatchButtonController.prototype.showTextWhenMouseIsOver = function() {\n return this.isMouseOver = true;\n };\n\n WatchButtonController.prototype.showTextWhenMouseIsLeave = function() {\n return this.isMouseOver = false;\n };\n\n WatchButtonController.prototype.openWatchers = function() {\n return this.rootScope.$broadcast(\"watcher:add\", this.item);\n };\n\n WatchButtonController.prototype.getPerms = function() {\n var name, perms;\n if (!this.item) {\n return \"\";\n }\n name = this.item._name;\n perms = {\n userstories: 'modify_us',\n issues: 'modify_issue',\n tasks: 'modify_task'\n };\n return perms[name];\n };\n\n WatchButtonController.prototype.toggleWatch = function() {\n var promise;\n this.loading = true;\n if (!this.item.is_watcher) {\n promise = this._watch();\n } else {\n promise = this._unwatch();\n }\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n return promise;\n };\n\n WatchButtonController.prototype._watch = function() {\n return this.onWatch().then((function(_this) {\n return function() {\n return _this.showTextWhenMouseIsLeave();\n };\n })(this));\n };\n\n WatchButtonController.prototype._unwatch = function() {\n return this.onUnwatch();\n };\n\n return WatchButtonController;\n\n })();\n\n angular.module(\"taigaComponents\").controller(\"WatchButton\", WatchButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-button.directive.coffee\n */\n\n(function() {\n var WatchButtonDirective;\n\n WatchButtonDirective = function() {\n return {\n scope: {},\n controller: \"WatchButton\",\n bindToController: {\n item: \"=\",\n onWatch: \"=\",\n onUnwatch: \"=\"\n },\n controllerAs: \"vm\",\n templateUrl: function(item, attributes) {\n return \"components/watch-button/watch-button-\" + attributes.environment + \".html\";\n }\n };\n };\n\n angular.module(\"taigaComponents\").directive(\"tgWatchButton\", WatchButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-home-order-by.controller.coffee\n */\n\n(function() {\n var DiscoverHomeOrderByController;\n\n DiscoverHomeOrderByController = (function() {\n DiscoverHomeOrderByController.$inject = ['$translate'];\n\n function DiscoverHomeOrderByController(translate) {\n this.translate = translate;\n this.is_open = false;\n this.texts = {\n week: this.translate.instant('DISCOVER.FILTERS.WEEK'),\n month: this.translate.instant('DISCOVER.FILTERS.MONTH'),\n year: this.translate.instant('DISCOVER.FILTERS.YEAR'),\n all: this.translate.instant('DISCOVER.FILTERS.ALL_TIME')\n };\n }\n\n DiscoverHomeOrderByController.prototype.currentText = function() {\n return this.texts[this.currentOrderBy];\n };\n\n DiscoverHomeOrderByController.prototype.open = function() {\n return this.is_open = true;\n };\n\n DiscoverHomeOrderByController.prototype.close = function() {\n return this.is_open = false;\n };\n\n DiscoverHomeOrderByController.prototype.orderBy = function(type) {\n this.currentOrderBy = type;\n this.is_open = false;\n return this.onChange({\n orderBy: this.currentOrderBy\n });\n };\n\n return DiscoverHomeOrderByController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverHomeOrderBy\", DiscoverHomeOrderByController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-home-order-by.directive.coffee\n */\n\n(function() {\n var DiscoverHomeOrderByDirective;\n\n DiscoverHomeOrderByDirective = function() {\n var link;\n link = function(scope, el, attrs) {};\n return {\n controller: \"DiscoverHomeOrderBy\",\n controllerAs: \"vm\",\n bindToController: true,\n templateUrl: \"discover/components/discover-home-order-by/discover-home-order-by.html\",\n scope: {\n currentOrderBy: \"=orderBy\",\n onChange: \"&\"\n },\n link: link\n };\n };\n\n DiscoverHomeOrderByDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgDiscoverHomeOrderBy\", DiscoverHomeOrderByDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search-bar.controller.coffee\n */\n\n(function() {\n var DiscoverSearchBarController;\n\n DiscoverSearchBarController = (function() {\n DiscoverSearchBarController.$inject = ['tgDiscoverProjectsService'];\n\n function DiscoverSearchBarController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, 'projects', (function(_this) {\n return function() {\n return _this.discoverProjectsService.projectsCount;\n };\n })(this));\n this.discoverProjectsService.fetchStats();\n }\n\n DiscoverSearchBarController.prototype.selectFilter = function(filter) {\n return this.onChange({\n filter: filter,\n q: this.q\n });\n };\n\n DiscoverSearchBarController.prototype.submitFilter = function() {\n return this.onChange({\n filter: this.filter,\n q: this.q\n });\n };\n\n return DiscoverSearchBarController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverSearchBar\", DiscoverSearchBarController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search.directive.coffee\n */\n\n(function() {\n var DiscoverSearchBarDirective;\n\n DiscoverSearchBarDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {};\n return {\n controller: \"DiscoverSearchBar\",\n controllerAs: \"vm\",\n templateUrl: 'discover/components/discover-search-bar/discover-search-bar.html',\n bindToController: true,\n scope: {\n q: \"=\",\n filter: \"=\",\n onChange: \"&\"\n },\n link: link\n };\n };\n\n DiscoverSearchBarDirective.$inject = [];\n\n angular.module('taigaDiscover').directive('tgDiscoverSearchBar', DiscoverSearchBarDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search-list-header.controller.coffee\n */\n\n(function() {\n var DiscoverSearchListHeaderController;\n\n DiscoverSearchListHeaderController = (function() {\n DiscoverSearchListHeaderController.$inject = [];\n\n function DiscoverSearchListHeaderController() {\n this.like_is_open = this.orderBy.indexOf('-total_fans') === 0;\n this.activity_is_open = this.orderBy.indexOf('-total_activity') === 0;\n }\n\n DiscoverSearchListHeaderController.prototype.openLike = function() {\n this.like_is_open = true;\n this.activity_is_open = false;\n return this.setOrderBy('-total_fans_last_week');\n };\n\n DiscoverSearchListHeaderController.prototype.openActivity = function() {\n this.activity_is_open = true;\n this.like_is_open = false;\n return this.setOrderBy('-total_activity_last_week');\n };\n\n DiscoverSearchListHeaderController.prototype.setOrderBy = function(type) {\n if (type == null) {\n type = '';\n }\n if (!type) {\n this.like_is_open = false;\n this.activity_is_open = false;\n }\n return this.onChange({\n orderBy: type\n });\n };\n\n return DiscoverSearchListHeaderController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverSearchListHeader\", DiscoverSearchListHeaderController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search-list-header.directive.coffee\n */\n\n(function() {\n var DiscoverSearchListHeaderDirective;\n\n DiscoverSearchListHeaderDirective = function() {\n var link;\n link = function(scope, el, attrs) {};\n return {\n controller: \"DiscoverSearchListHeader\",\n controllerAs: \"vm\",\n bindToController: true,\n templateUrl: \"discover/components/discover-search-list-header/discover-search-list-header.html\",\n scope: {\n onChange: \"&\",\n orderBy: \"=\"\n },\n link: link\n };\n };\n\n DiscoverSearchListHeaderDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgDiscoverSearchListHeader\", DiscoverSearchListHeaderDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: featured-projects.controller.coffee\n */\n\n(function() {\n var FeaturedProjectsController;\n\n FeaturedProjectsController = (function() {\n FeaturedProjectsController.$inject = [\"tgDiscoverProjectsService\"];\n\n function FeaturedProjectsController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, \"featured\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.featured;\n };\n })(this));\n this.discoverProjectsService.fetchFeatured();\n }\n\n return FeaturedProjectsController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"FeaturedProjects\", FeaturedProjectsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: featured-projects.directive.coffee\n */\n\n(function() {\n var FeaturedProjectsDirective;\n\n FeaturedProjectsDirective = function() {\n var link;\n link = function(scope, el, attrs) {};\n return {\n controller: \"FeaturedProjects\",\n controllerAs: \"vm\",\n templateUrl: \"discover/components/featured-projects/featured-projects.html\",\n scope: {},\n link: link\n };\n };\n\n FeaturedProjectsDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgFeaturedProjects\", FeaturedProjectsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: highlighted.directive.coffee\n */\n\n(function() {\n var HighlightedDirective;\n\n HighlightedDirective = function() {\n return {\n templateUrl: \"discover/components/highlighted/highlighted.html\",\n scope: {\n loading: \"=\",\n highlighted: \"=\",\n orderBy: \"=\"\n }\n };\n };\n\n HighlightedDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgHighlighted\", HighlightedDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: most-active.controller.coffee\n */\n\n(function() {\n var MostActiveController;\n\n MostActiveController = (function() {\n MostActiveController.$inject = [\"tgDiscoverProjectsService\"];\n\n function MostActiveController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, \"highlighted\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.mostActive;\n };\n })(this));\n this.currentOrderBy = 'week';\n this.order_by = this.getOrderBy();\n }\n\n MostActiveController.prototype.fetch = function() {\n this.loading = true;\n this.order_by = this.getOrderBy();\n return this.discoverProjectsService.fetchMostActive({\n order_by: this.order_by\n }).then((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n MostActiveController.prototype.orderBy = function(type) {\n this.currentOrderBy = type;\n return this.fetch();\n };\n\n MostActiveController.prototype.getOrderBy = function(type) {\n if (this.currentOrderBy === 'all') {\n return '-total_activity';\n } else {\n return '-total_activity_last_' + this.currentOrderBy;\n }\n };\n\n return MostActiveController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"MostActive\", MostActiveController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: most-active.directive.coffee\n */\n\n(function() {\n var MostActiveDirective;\n\n MostActiveDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return ctrl.fetch();\n };\n return {\n controller: \"MostActive\",\n controllerAs: \"vm\",\n templateUrl: \"discover/components/most-active/most-active.html\",\n scope: {},\n link: link\n };\n };\n\n MostActiveDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgMostActive\", MostActiveDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: msot-liked.controller.coffee\n */\n\n(function() {\n var MostLikedController;\n\n MostLikedController = (function() {\n MostLikedController.$inject = [\"tgDiscoverProjectsService\"];\n\n function MostLikedController(discoverProjectsService) {\n this.discoverProjectsService = discoverProjectsService;\n taiga.defineImmutableProperty(this, \"highlighted\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.mostLiked;\n };\n })(this));\n this.currentOrderBy = 'week';\n this.order_by = this.getOrderBy();\n }\n\n MostLikedController.prototype.fetch = function() {\n this.loading = true;\n this.order_by = this.getOrderBy();\n return this.discoverProjectsService.fetchMostLiked({\n order_by: this.order_by\n }).then((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n MostLikedController.prototype.orderBy = function(type) {\n this.currentOrderBy = type;\n return this.fetch();\n };\n\n MostLikedController.prototype.getOrderBy = function() {\n if (this.currentOrderBy === 'all') {\n return '-total_fans';\n } else {\n return '-total_fans_last_' + this.currentOrderBy;\n }\n };\n\n return MostLikedController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"MostLiked\", MostLikedController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: most-liked.directive.coffee\n */\n\n(function() {\n var MostLikedDirective;\n\n MostLikedDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return ctrl.fetch();\n };\n return {\n controller: \"MostLiked\",\n controllerAs: \"vm\",\n templateUrl: \"discover/components/most-liked/most-liked.html\",\n scope: {},\n link: link\n };\n };\n\n MostLikedDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgMostLiked\", MostLikedDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-home.controller.coffee\n */\n\n(function() {\n var DiscoverHomeController;\n\n DiscoverHomeController = (function() {\n DiscoverHomeController.$inject = ['$tgLocation', '$tgNavUrls', 'tgAppMetaService', '$translate'];\n\n function DiscoverHomeController(location, navUrls, appMetaService, translate) {\n var description, title;\n this.location = location;\n this.navUrls = navUrls;\n this.appMetaService = appMetaService;\n this.translate = translate;\n title = this.translate.instant(\"DISCOVER.PAGE_TITLE\");\n description = this.translate.instant(\"DISCOVER.PAGE_DESCRIPTION\");\n this.appMetaService.setAll(title, description);\n }\n\n DiscoverHomeController.prototype.onSubmit = function(q) {\n var url;\n url = this.navUrls.resolve('discover-search');\n return this.location.search('text', q).path(url);\n };\n\n return DiscoverHomeController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverHome\", DiscoverHomeController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search.controller.coffee\n */\n\n(function() {\n var DiscoverSearchController;\n\n DiscoverSearchController = (function() {\n DiscoverSearchController.$inject = ['$routeParams', 'tgDiscoverProjectsService', '$route', 'tgAppMetaService', '$translate'];\n\n function DiscoverSearchController(routeParams, discoverProjectsService, route, appMetaService, translate) {\n var description, title;\n this.routeParams = routeParams;\n this.discoverProjectsService = discoverProjectsService;\n this.route = route;\n this.appMetaService = appMetaService;\n this.translate = translate;\n this.page = 1;\n taiga.defineImmutableProperty(this, \"searchResult\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.searchResult;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"nextSearchPage\", (function(_this) {\n return function() {\n return _this.discoverProjectsService.nextSearchPage;\n };\n })(this));\n this.q = this.routeParams.text;\n this.filter = this.routeParams.filter || 'all';\n this.orderBy = this.routeParams['order_by'] || '';\n this.loadingGlobal = false;\n this.loadingList = false;\n this.loadingPagination = false;\n title = this.translate.instant(\"DISCOVER.SEARCH.PAGE_TITLE\");\n description = this.translate.instant(\"DISCOVER.SEARCH.PAGE_DESCRIPTION\");\n this.appMetaService.setAll(title, description);\n }\n\n DiscoverSearchController.prototype.fetch = function() {\n this.page = 1;\n this.discoverProjectsService.resetSearchList();\n return this.search();\n };\n\n DiscoverSearchController.prototype.fetchByGlobalSearch = function() {\n if (this.loadingGlobal) {\n return;\n }\n this.loadingGlobal = true;\n return this.fetch().then((function(_this) {\n return function() {\n return _this.loadingGlobal = false;\n };\n })(this));\n };\n\n DiscoverSearchController.prototype.fetchByOrderBy = function() {\n if (this.loadingList) {\n return;\n }\n this.loadingList = true;\n return this.fetch().then((function(_this) {\n return function() {\n return _this.loadingList = false;\n };\n })(this));\n };\n\n DiscoverSearchController.prototype.showMore = function() {\n if (this.loadingPagination) {\n return;\n }\n this.loadingPagination = true;\n this.page++;\n return this.search().then((function(_this) {\n return function() {\n return _this.loadingPagination = false;\n };\n })(this));\n };\n\n DiscoverSearchController.prototype.search = function() {\n var filter, params;\n filter = this.getFilter();\n params = {\n page: this.page,\n q: this.q,\n order_by: this.orderBy\n };\n _.assign(params, filter);\n return this.discoverProjectsService.fetchSearch(params);\n };\n\n DiscoverSearchController.prototype.getFilter = function() {\n if (this.filter === 'people') {\n return {\n is_looking_for_people: true\n };\n } else if (this.filter === 'scrum') {\n return {\n is_backlog_activated: true\n };\n } else if (this.filter === 'kanban') {\n return {\n is_kanban_activated: true\n };\n }\n return {};\n };\n\n DiscoverSearchController.prototype.onChangeFilter = function(filter, q) {\n this.filter = filter;\n this.q = q;\n this.route.updateParams({\n filter: this.filter,\n text: this.q\n });\n return this.fetchByGlobalSearch();\n };\n\n DiscoverSearchController.prototype.onChangeOrder = function(orderBy) {\n this.orderBy = orderBy;\n this.route.updateParams({\n order_by: orderBy\n });\n return this.fetchByOrderBy();\n };\n\n return DiscoverSearchController;\n\n })();\n\n angular.module(\"taigaDiscover\").controller(\"DiscoverSearch\", DiscoverSearchController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-search.directive.coffee\n */\n\n(function() {\n var DiscoverSearchDirective;\n\n DiscoverSearchDirective = function() {\n var link;\n link = function(scope, element, attrs, ctrl) {\n return ctrl.fetch();\n };\n return {\n controller: \"DiscoverSearch\",\n controllerAs: \"vm\",\n link: link\n };\n };\n\n DiscoverSearchDirective.$inject = [];\n\n angular.module(\"taigaDiscover\").directive(\"tgDiscoverSearch\", DiscoverSearchDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: discover-projects.service.coffee\n */\n\n(function() {\n var DiscoverProjectsService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n DiscoverProjectsService = (function(superClass) {\n var _discoverParams;\n\n extend(DiscoverProjectsService, superClass);\n\n DiscoverProjectsService.$inject = [\"tgResources\", \"tgProjectsService\"];\n\n _discoverParams = {\n discover_mode: true\n };\n\n function DiscoverProjectsService(rs, projectsService) {\n this.rs = rs;\n this.projectsService = projectsService;\n this._mostLiked = Immutable.List();\n this._mostActive = Immutable.List();\n this._featured = Immutable.List();\n this._searchResult = Immutable.List();\n this._projectsCount = 0;\n this.decorate = this.projectsService._decorate.bind(this.projectsService);\n taiga.defineImmutableProperty(this, \"mostLiked\", (function(_this) {\n return function() {\n return _this._mostLiked;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"mostActive\", (function(_this) {\n return function() {\n return _this._mostActive;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"featured\", (function(_this) {\n return function() {\n return _this._featured;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"searchResult\", (function(_this) {\n return function() {\n return _this._searchResult;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"nextSearchPage\", (function(_this) {\n return function() {\n return _this._nextSearchPage;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"projectsCount\", (function(_this) {\n return function() {\n return _this._projectsCount;\n };\n })(this));\n }\n\n DiscoverProjectsService.prototype.fetchMostLiked = function(params) {\n var _params;\n _params = _.extend({}, _discoverParams, params);\n return this.rs.projects.getProjects(_params, false).then((function(_this) {\n return function(result) {\n var data, projects;\n data = result.data.slice(0, 5);\n projects = Immutable.fromJS(data);\n projects = projects.map(_this.decorate);\n return _this._mostLiked = projects;\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.fetchMostActive = function(params) {\n var _params;\n _params = _.extend({}, _discoverParams, params);\n return this.rs.projects.getProjects(_params, false).then((function(_this) {\n return function(result) {\n var data, projects;\n data = result.data.slice(0, 5);\n projects = Immutable.fromJS(data);\n projects = projects.map(_this.decorate);\n return _this._mostActive = projects;\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.fetchFeatured = function() {\n var _params;\n _params = _.extend({}, _discoverParams);\n _params.is_featured = true;\n return this.rs.projects.getProjects(_params, false).then((function(_this) {\n return function(result) {\n var data, projects;\n data = result.data.slice(0, 4);\n projects = Immutable.fromJS(data);\n projects = projects.map(_this.decorate);\n return _this._featured = projects;\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.resetSearchList = function() {\n return this._searchResult = Immutable.List();\n };\n\n DiscoverProjectsService.prototype.fetchStats = function() {\n return this.rs.stats.discover().then((function(_this) {\n return function(discover) {\n return _this._projectsCount = discover.getIn(['projects', 'total']);\n };\n })(this));\n };\n\n DiscoverProjectsService.prototype.fetchSearch = function(params) {\n var _params;\n _params = _.extend({}, _discoverParams, params);\n return this.rs.projects.getProjects(_params).then((function(_this) {\n return function(result) {\n var projects;\n _this._nextSearchPage = !!result.headers('X-Pagination-Next');\n projects = Immutable.fromJS(result.data);\n projects = projects.map(_this.decorate);\n return _this._searchResult = _this._searchResult.concat(projects);\n };\n })(this));\n };\n\n return DiscoverProjectsService;\n\n })(taiga.Service);\n\n angular.module(\"taigaDiscover\").service(\"tgDiscoverProjectsService\", DiscoverProjectsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-app.controller.coffee\n */\n\n(function() {\n var ExternalAppController, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n ExternalAppController = (function(superClass) {\n extend(ExternalAppController, superClass);\n\n ExternalAppController.$inject = [\"$routeParams\", \"tgExternalAppsService\", \"$window\", \"tgCurrentUserService\", \"$location\", \"$tgNavUrls\", \"tgXhrErrorService\", \"tgLoader\"];\n\n function ExternalAppController(routeParams, externalAppsService, window, currentUserService, location, navUrls, xhrError, loader) {\n var loginUrl, nextUrl;\n this.routeParams = routeParams;\n this.externalAppsService = externalAppsService;\n this.window = window;\n this.currentUserService = currentUserService;\n this.location = location;\n this.navUrls = navUrls;\n this.xhrError = xhrError;\n this.loader = loader;\n this.createApplicationToken = bind(this.createApplicationToken, this);\n this._getApplicationToken = bind(this._getApplicationToken, this);\n this._redirect = bind(this._redirect, this);\n this.loader.start(false);\n this._applicationId = this.routeParams.application;\n this._state = this.routeParams.state;\n this._getApplicationToken();\n this._user = this.currentUserService.getUser();\n this._application = null;\n nextUrl = encodeURIComponent(this.location.url());\n loginUrl = this.navUrls.resolve(\"login\");\n this.loginWithAnotherUserUrl = loginUrl + \"?next=\" + nextUrl;\n taiga.defineImmutableProperty(this, \"user\", (function(_this) {\n return function() {\n return _this._user;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"application\", (function(_this) {\n return function() {\n return _this._application;\n };\n })(this));\n }\n\n ExternalAppController.prototype._redirect = function(applicationToken) {\n var nextUrl;\n nextUrl = applicationToken.get(\"next_url\");\n return this.window.open(nextUrl, \"_self\");\n };\n\n ExternalAppController.prototype._getApplicationToken = function() {\n return this.externalAppsService.getApplicationToken(this._applicationId, this._state).then((function(_this) {\n return function(data) {\n _this._application = data.get(\"application\");\n if (data.get(\"auth_code\")) {\n return _this._redirect(data);\n } else {\n return _this.loader.pageLoaded();\n }\n };\n })(this))[\"catch\"]((function(_this) {\n return function(xhr) {\n _this.loader.pageLoaded();\n return _this.xhrError.response(xhr);\n };\n })(this));\n };\n\n ExternalAppController.prototype.cancel = function() {\n return this.window.history.back();\n };\n\n ExternalAppController.prototype.createApplicationToken = function() {\n return this.externalAppsService.authorizeApplicationToken(this._applicationId, this._state).then((function(_this) {\n return function(data) {\n return _this._redirect(data);\n };\n })(this))[\"catch\"]((function(_this) {\n return function(xhr) {\n return _this.xhrError.response(xhr);\n };\n })(this));\n };\n\n return ExternalAppController;\n\n })(taiga.Controller);\n\n angular.module(\"taigaExternalApps\").controller(\"ExternalApp\", ExternalAppController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-app.service.coffee\n */\n\n(function() {\n var ExternalAppsService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n ExternalAppsService = (function(superClass) {\n extend(ExternalAppsService, superClass);\n\n ExternalAppsService.$inject = [\"tgResources\"];\n\n function ExternalAppsService(rs) {\n this.rs = rs;\n }\n\n ExternalAppsService.prototype.getApplicationToken = function(applicationId, state) {\n return this.rs.externalapps.getApplicationToken(applicationId, state);\n };\n\n ExternalAppsService.prototype.authorizeApplicationToken = function(applicationId, state) {\n return this.rs.externalapps.authorizeApplicationToken(applicationId, state);\n };\n\n return ExternalAppsService;\n\n })(taiga.Service);\n\n angular.module(\"taigaExternalApps\").service(\"tgExternalAppsService\", ExternalAppsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: feedback.service.coffee\n */\n\n(function() {\n var FeedbackService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n FeedbackService = (function(superClass) {\n extend(FeedbackService, superClass);\n\n FeedbackService.$inject = [\"tgLightboxFactory\"];\n\n function FeedbackService(lightboxFactory) {\n this.lightboxFactory = lightboxFactory;\n }\n\n FeedbackService.prototype.sendFeedback = function() {\n return this.lightboxFactory.create(\"tg-lb-feedback\", {\n \"class\": \"lightbox lightbox-feedback lightbox-generic-form\"\n });\n };\n\n return FeedbackService;\n\n })(taiga.Service);\n\n angular.module(\"taigaFeedback\").service(\"tgFeedbackService\", FeedbackService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: duty.directive.coffee\n */\n\n(function() {\n var DutyDirective;\n\n DutyDirective = function(navurls, $translate) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n scope.vm.duty = scope.duty;\n return scope.vm.getDutyType = function() {\n if (scope.vm.duty) {\n if (scope.vm.duty.get('_name') === \"userstories\") {\n return $translate.instant(\"COMMON.USER_STORY\");\n }\n if (scope.vm.duty.get('_name') === \"tasks\") {\n return $translate.instant(\"COMMON.TASK\");\n }\n if (scope.vm.duty.get('_name') === \"issues\") {\n return $translate.instant(\"COMMON.ISSUE\");\n }\n }\n };\n };\n return {\n templateUrl: \"home/duties/duty.html\",\n scope: {\n \"duty\": \"=tgDuty\"\n },\n link: link\n };\n };\n\n DutyDirective.$inject = [\"$tgNavUrls\", \"$translate\"];\n\n angular.module(\"taigaHome\").directive(\"tgDuty\", DutyDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home.controller.coffee\n */\n\n(function() {\n var HomeController;\n\n HomeController = (function() {\n HomeController.$inject = [\"tgCurrentUserService\", \"$location\", \"$tgNavUrls\"];\n\n function HomeController(currentUserService, location, navUrls) {\n this.currentUserService = currentUserService;\n this.location = location;\n this.navUrls = navUrls;\n if (!this.currentUserService.getUser()) {\n this.location.path(this.navUrls.resolve(\"discover\"));\n }\n }\n\n return HomeController;\n\n })();\n\n angular.module(\"taigaHome\").controller(\"Home\", HomeController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home.service.coffee\n */\n\n(function() {\n var HomeService, groupBy,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n groupBy = this.taiga.groupBy;\n\n HomeService = (function(superClass) {\n extend(HomeService, superClass);\n\n HomeService.$inject = [\"$tgNavUrls\", \"tgResources\", \"tgProjectsService\"];\n\n function HomeService(navurls, rs, projectsService) {\n this.navurls = navurls;\n this.rs = rs;\n this.projectsService = projectsService;\n }\n\n HomeService.prototype._attachProjectInfoToWorkInProgress = function(workInProgress, projectsById) {\n var _attachProjectInfoToDuty, _duties, assignedTo, watching;\n _attachProjectInfoToDuty = (function(_this) {\n return function(duty, objType) {\n var ctx, project, url;\n project = projectsById.get(String(duty.get('project')));\n ctx = {\n project: project.get('slug'),\n ref: duty.get('ref')\n };\n url = _this.navurls.resolve(\"project-\" + objType + \"-detail\", ctx);\n duty = duty.set('url', url);\n duty = duty.set('projectName', project.get('name'));\n duty = duty.set('blockedProject', project.get('blocked_code'));\n duty = duty.set(\"_name\", objType);\n return duty;\n };\n })(this);\n assignedTo = workInProgress.get(\"assignedTo\");\n if (assignedTo.get(\"userStories\")) {\n _duties = assignedTo.get(\"userStories\").map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"userstories\");\n });\n assignedTo = assignedTo.set(\"userStories\", _duties);\n }\n if (assignedTo.get(\"tasks\")) {\n _duties = assignedTo.get(\"tasks\").map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"tasks\");\n });\n assignedTo = assignedTo.set(\"tasks\", _duties);\n }\n if (assignedTo.get(\"issues\")) {\n _duties = assignedTo.get(\"issues\").map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"issues\");\n });\n assignedTo = assignedTo.set(\"issues\", _duties);\n }\n watching = workInProgress.get(\"watching\");\n if (watching.get(\"userStories\")) {\n _duties = watching.get(\"userStories\").filter(function(duty) {\n return !!projectsById.get(String(duty.get('project')));\n });\n _duties = _duties.map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"userstories\");\n });\n watching = watching.set(\"userStories\", _duties);\n }\n if (watching.get(\"tasks\")) {\n _duties = watching.get(\"tasks\").filter(function(duty) {\n return !!projectsById.get(String(duty.get('project')));\n });\n _duties = _duties.map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"tasks\");\n });\n watching = watching.set(\"tasks\", _duties);\n }\n if (watching.get(\"issues\")) {\n _duties = watching.get(\"issues\").filter(function(duty) {\n return !!projectsById.get(String(duty.get('project')));\n });\n _duties = _duties.map(function(duty) {\n return _attachProjectInfoToDuty(duty, \"issues\");\n });\n watching = watching.set(\"issues\", _duties);\n }\n workInProgress = workInProgress.set(\"assignedTo\", assignedTo);\n return workInProgress = workInProgress.set(\"watching\", watching);\n };\n\n HomeService.prototype.getWorkInProgress = function(userId) {\n var assignedIssuesPromise, assignedTasksPromise, assignedTo, assignedUserStoriesPromise, params, params_us, projectsById, projectsPromise, watching, watchingIssuesPromise, watchingTasksPromise, watchingUserStoriesPromise, workInProgress;\n projectsById = Immutable.Map();\n projectsPromise = this.projectsService.getProjectsByUserId(userId).then(function(projects) {\n return projectsById = Immutable.fromJS(groupBy(projects.toJS(), function(p) {\n return p.id;\n }));\n });\n assignedTo = Immutable.Map();\n params = {\n status__is_closed: false,\n assigned_to: userId\n };\n params_us = {\n is_closed: false,\n assigned_to: userId\n };\n assignedUserStoriesPromise = this.rs.userstories.listInAllProjects(params_us).then(function(userstories) {\n return assignedTo = assignedTo.set(\"userStories\", userstories);\n });\n assignedTasksPromise = this.rs.tasks.listInAllProjects(params).then(function(tasks) {\n return assignedTo = assignedTo.set(\"tasks\", tasks);\n });\n assignedIssuesPromise = this.rs.issues.listInAllProjects(params).then(function(issues) {\n return assignedTo = assignedTo.set(\"issues\", issues);\n });\n params = {\n status__is_closed: false,\n watchers: userId\n };\n params_us = {\n is_closed: false,\n watchers: userId\n };\n watching = Immutable.Map();\n watchingUserStoriesPromise = this.rs.userstories.listInAllProjects(params_us).then(function(userstories) {\n return watching = watching.set(\"userStories\", userstories);\n });\n watchingTasksPromise = this.rs.tasks.listInAllProjects(params).then(function(tasks) {\n return watching = watching.set(\"tasks\", tasks);\n });\n watchingIssuesPromise = this.rs.issues.listInAllProjects(params).then(function(issues) {\n return watching = watching.set(\"issues\", issues);\n });\n workInProgress = Immutable.Map();\n return Promise.all([projectsPromise, assignedUserStoriesPromise, assignedTasksPromise, assignedIssuesPromise, watchingUserStoriesPromise, watchingTasksPromise, watchingIssuesPromise]).then((function(_this) {\n return function() {\n workInProgress = workInProgress.set(\"assignedTo\", assignedTo);\n workInProgress = workInProgress.set(\"watching\", watching);\n workInProgress = _this._attachProjectInfoToWorkInProgress(workInProgress, projectsById);\n return workInProgress;\n };\n })(this));\n };\n\n return HomeService;\n\n })(taiga.Service);\n\n angular.module(\"taigaHome\").service(\"tgHomeService\", HomeService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: home-project-list.directive.coffee\n */\n\n(function() {\n var HomeProjectListDirective;\n\n HomeProjectListDirective = function(currentUserService, projectsService) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n taiga.defineImmutableProperty(scope.vm, \"projects\", function() {\n return currentUserService.projects.get(\"recents\");\n });\n return scope.vm.newProject = function() {\n return projectsService.newProject();\n };\n };\n directive = {\n templateUrl: \"home/projects/home-project-list.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n HomeProjectListDirective.$inject = [\"tgCurrentUserService\", \"tgProjectsService\"];\n\n angular.module(\"taigaHome\").directive(\"tgHomeProjectList\", HomeProjectListDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: working-on.controller.coffee\n */\n\n(function() {\n var WorkingOnController;\n\n WorkingOnController = (function() {\n WorkingOnController.$inject = [\"tgHomeService\"];\n\n function WorkingOnController(homeService) {\n this.homeService = homeService;\n this.assignedTo = Immutable.Map();\n this.watching = Immutable.Map();\n }\n\n WorkingOnController.prototype._setAssignedTo = function(workInProgress) {\n var issues, tasks, userStories;\n userStories = workInProgress.get(\"assignedTo\").get(\"userStories\");\n tasks = workInProgress.get(\"assignedTo\").get(\"tasks\");\n issues = workInProgress.get(\"assignedTo\").get(\"issues\");\n this.assignedTo = userStories.concat(tasks).concat(issues);\n if (this.assignedTo.size > 0) {\n return this.assignedTo = this.assignedTo.sortBy(function(elem) {\n return elem.get(\"modified_date\");\n }).reverse();\n }\n };\n\n WorkingOnController.prototype._setWatching = function(workInProgress) {\n var issues, tasks, userStories;\n userStories = workInProgress.get(\"watching\").get(\"userStories\");\n tasks = workInProgress.get(\"watching\").get(\"tasks\");\n issues = workInProgress.get(\"watching\").get(\"issues\");\n this.watching = userStories.concat(tasks).concat(issues);\n if (this.watching.size > 0) {\n return this.watching = this.watching.sortBy(function(elem) {\n return elem.get(\"modified_date\");\n }).reverse();\n }\n };\n\n WorkingOnController.prototype.getWorkInProgress = function(userId) {\n return this.homeService.getWorkInProgress(userId).then((function(_this) {\n return function(workInProgress) {\n _this._setAssignedTo(workInProgress);\n return _this._setWatching(workInProgress);\n };\n })(this));\n };\n\n return WorkingOnController;\n\n })();\n\n angular.module(\"taigaHome\").controller(\"WorkingOn\", WorkingOnController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: working-on.directive.coffee\n */\n\n(function() {\n var WorkingOnDirective;\n\n WorkingOnDirective = function(homeService, currentUserService) {\n var link;\n link = function(scope, el, attrs, ctrl) {\n var user, userId;\n user = currentUserService.getUser();\n if (user) {\n userId = user.get(\"id\");\n return ctrl.getWorkInProgress(userId);\n }\n };\n return {\n controller: \"WorkingOn\",\n controllerAs: \"vm\",\n templateUrl: \"home/working-on/working-on.html\",\n scope: {},\n link: link\n };\n };\n\n WorkingOnDirective.$inject = [\"tgHomeService\", \"tgCurrentUserService\"];\n\n angular.module(\"taigaHome\").directive(\"tgWorkingOn\", WorkingOnDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: dropdown-project-list.directive.coffee\n */\n\n(function() {\n var DropdownProjectListDirective;\n\n DropdownProjectListDirective = function(currentUserService, projectsService) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n taiga.defineImmutableProperty(scope.vm, \"projects\", function() {\n return currentUserService.projects.get(\"recents\");\n });\n return scope.vm.newProject = function() {\n return projectsService.newProject();\n };\n };\n directive = {\n templateUrl: \"navigation-bar/dropdown-project-list/dropdown-project-list.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n DropdownProjectListDirective.$inject = [\"tgCurrentUserService\", \"tgProjectsService\"];\n\n angular.module(\"taigaNavigationBar\").directive(\"tgDropdownProjectList\", DropdownProjectListDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: dropdown-user.directive.coffee\n */\n\n(function() {\n var DropdownUserDirective;\n\n DropdownUserDirective = function(authService, configService, locationService, navUrlsService, feedbackService, $rootScope) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n scope.vm.isFeedbackEnabled = configService.get(\"feedbackEnabled\");\n taiga.defineImmutableProperty(scope.vm, \"user\", function() {\n return authService.userData;\n });\n scope.vm.logout = function() {\n authService.logout();\n locationService.url(navUrlsService.resolve(\"discover\"));\n return locationService.search({});\n };\n scope.vm.sendFeedback = function() {\n return feedbackService.sendFeedback();\n };\n return scope.vm.userSettingsPlugins = _.filter($rootScope.userSettingsPlugins, {\n userMenu: true\n });\n };\n directive = {\n templateUrl: \"navigation-bar/dropdown-user/dropdown-user.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n DropdownUserDirective.$inject = [\"$tgAuth\", \"$tgConfig\", \"$tgLocation\", \"$tgNavUrls\", \"tgFeedbackService\", \"$rootScope\"];\n\n angular.module(\"taigaNavigationBar\").directive(\"tgDropdownUser\", DropdownUserDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: navigation-bar.directive.coffee\n */\n\n(function() {\n var NavigationBarDirective;\n\n NavigationBarDirective = function(currentUserService, navigationBarService, locationService, navUrlsService, config) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n scope.vm = {};\n taiga.defineImmutableProperty(scope.vm, \"projects\", function() {\n return currentUserService.projects.get(\"recents\");\n });\n taiga.defineImmutableProperty(scope.vm, \"isAuthenticated\", function() {\n return currentUserService.isAuthenticated();\n });\n taiga.defineImmutableProperty(scope.vm, \"isEnabledHeader\", function() {\n return navigationBarService.isEnabledHeader();\n });\n scope.vm.publicRegisterEnabled = config.get(\"publicRegisterEnabled\");\n scope.vm.login = function() {\n var nextUrl;\n nextUrl = encodeURIComponent(locationService.url());\n locationService.url(navUrlsService.resolve(\"login\"));\n return locationService.search({\n next: nextUrl\n });\n };\n scope.vm.register = function() {\n var nextUrl;\n nextUrl = encodeURIComponent(locationService.url());\n locationService.url(navUrlsService.resolve(\"register\"));\n return locationService.search({\n next: nextUrl\n });\n };\n return scope.$on(\"$routeChangeSuccess\", function() {\n if (locationService.path() === \"/\") {\n return scope.vm.active = true;\n } else {\n return scope.vm.active = false;\n }\n });\n };\n directive = {\n templateUrl: \"navigation-bar/navigation-bar.html\",\n scope: {},\n link: link\n };\n return directive;\n };\n\n NavigationBarDirective.$inject = [\"tgCurrentUserService\", \"tgNavigationBarService\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\"];\n\n angular.module(\"taigaNavigationBar\").directive(\"tgNavigationBar\", NavigationBarDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: navigation-bar.service.coffee\n */\n\n(function() {\n var NavigationBarService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n NavigationBarService = (function(superClass) {\n extend(NavigationBarService, superClass);\n\n function NavigationBarService() {\n this.disableHeader();\n }\n\n NavigationBarService.prototype.enableHeader = function() {\n return this.enabledHeader = true;\n };\n\n NavigationBarService.prototype.disableHeader = function() {\n return this.enabledHeader = false;\n };\n\n NavigationBarService.prototype.isEnabledHeader = function() {\n return this.enabledHeader;\n };\n\n return NavigationBarService;\n\n })(taiga.Service);\n\n angular.module(\"taigaNavigationBar\").service(\"tgNavigationBarService\", NavigationBarService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-bar.controller.coffee\n */\n\n(function() {\n var ProfileBarController;\n\n ProfileBarController = (function() {\n ProfileBarController.$inject = [\"tgUserService\"];\n\n function ProfileBarController(userService) {\n this.userService = userService;\n this.loadStats();\n }\n\n ProfileBarController.prototype.loadStats = function() {\n return this.userService.getStats(this.user.get(\"id\")).then((function(_this) {\n return function(stats) {\n return _this.stats = stats;\n };\n })(this));\n };\n\n return ProfileBarController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileBar\", ProfileBarController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-bar.directive.coffee\n */\n\n(function() {\n var ProfileBarDirective;\n\n ProfileBarDirective = function() {\n return {\n templateUrl: \"profile/profile-bar/profile-bar.html\",\n controller: \"ProfileBar\",\n controllerAs: \"vm\",\n scope: {\n user: \"=user\",\n isCurrentUser: \"=iscurrentuser\"\n },\n bindToController: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileBar\", ProfileBarDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-contacts.controller.coffee\n */\n\n(function() {\n var ProfileContactsController;\n\n ProfileContactsController = (function() {\n ProfileContactsController.$inject = [\"tgUserService\", \"tgCurrentUserService\"];\n\n function ProfileContactsController(userService, currentUserService) {\n this.userService = userService;\n this.currentUserService = currentUserService;\n this.currentUser = this.currentUserService.getUser();\n this.isCurrentUser = false;\n if (this.currentUser && this.currentUser.get(\"id\") === this.user.get(\"id\")) {\n this.isCurrentUser = true;\n }\n }\n\n ProfileContactsController.prototype.loadContacts = function() {\n return this.userService.getContacts(this.user.get(\"id\")).then((function(_this) {\n return function(contacts) {\n return _this.contacts = contacts;\n };\n })(this));\n };\n\n return ProfileContactsController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileContacts\", ProfileContactsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-contacts.directive.coffee\n */\n\n(function() {\n var ProfileContactsDirective;\n\n ProfileContactsDirective = function() {\n var link;\n link = function(scope, elm, attrs, ctrl) {\n return ctrl.loadContacts();\n };\n return {\n templateUrl: \"profile/profile-contacts/profile-contacts.html\",\n scope: {\n user: \"=\"\n },\n controllerAs: \"vm\",\n controller: \"ProfileContacts\",\n link: link,\n bindToController: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileContacts\", ProfileContactsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: items.directive.coffee\n */\n\n(function() {\n var FavItemDirective;\n\n FavItemDirective = function() {\n var link, templateUrl;\n link = function(scope, el, attrs, ctrl) {\n return scope.vm = {\n item: scope.item\n };\n };\n templateUrl = function(el, attrs) {\n if (attrs.itemType === \"project\") {\n return \"profile/profile-favs/items/project.html\";\n } else {\n return \"profile/profile-favs/items/ticket.html\";\n }\n };\n return {\n scope: {\n \"item\": \"=tgFavItem\"\n },\n link: link,\n templateUrl: templateUrl\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgFavItem\", FavItemDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-favs.controller.coffee\n */\n\n(function() {\n var FavsBaseController, ProfileLikedController, ProfileVotedController, ProfileWatchedController, debounceLeading,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n debounceLeading = this.taiga.debounceLeading;\n\n FavsBaseController = (function() {\n function FavsBaseController() {\n this._init();\n }\n\n FavsBaseController.prototype._init = function() {\n this.enableFilterByAll = true;\n this.enableFilterByProjects = true;\n this.enableFilterByUserStories = true;\n this.enableFilterByTasks = true;\n this.enableFilterByIssues = true;\n this.enableFilterByTextQuery = true;\n this._resetList();\n this.q = null;\n return this.type = null;\n };\n\n FavsBaseController.prototype._resetList = function() {\n this.items = Immutable.List();\n this.scrollDisabled = false;\n return this._page = 1;\n };\n\n FavsBaseController.prototype._enableLoadingSpinner = function() {\n return this.isLoading = true;\n };\n\n FavsBaseController.prototype._disableLoadingSpinner = function() {\n return this.isLoading = false;\n };\n\n FavsBaseController.prototype._enableScroll = function() {\n return this.scrollDisabled = false;\n };\n\n FavsBaseController.prototype._disableScroll = function() {\n return this.scrollDisabled = true;\n };\n\n FavsBaseController.prototype._checkIfHasMorePages = function(hasNext) {\n if (hasNext) {\n this._page += 1;\n return this._enableScroll();\n } else {\n return this._disableScroll();\n }\n };\n\n FavsBaseController.prototype._checkIfHasNoResults = function() {\n return this.hasNoResults = this.items.size === 0;\n };\n\n FavsBaseController.prototype.loadItems = function() {\n this._enableLoadingSpinner();\n this._disableScroll();\n return this._getItems(this.user.get(\"id\"), this._page, this.type, this.q).then((function(_this) {\n return function(response) {\n _this.items = _this.items.concat(response.get(\"data\"));\n _this._checkIfHasMorePages(response.get(\"next\"));\n _this._checkIfHasNoResults();\n _this._disableLoadingSpinner();\n return _this.items;\n };\n })(this))[\"catch\"]((function(_this) {\n return function() {\n _this._disableLoadingSpinner();\n return _this.items;\n };\n })(this));\n };\n\n FavsBaseController.prototype.filterByTextQuery = debounceLeading(500, function() {\n this._resetList();\n return this.loadItems();\n });\n\n FavsBaseController.prototype.showAll = function() {\n if (this.type !== null) {\n this.type = null;\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showProjectsOnly = function() {\n if (this.type !== \"project\") {\n this.type = \"project\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showUserStoriesOnly = function() {\n if (this.type !== \"userstory\") {\n this.type = \"userstory\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showTasksOnly = function() {\n if (this.type !== \"task\") {\n this.type = \"task\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n FavsBaseController.prototype.showIssuesOnly = function() {\n if (this.type !== \"issue\") {\n this.type = \"issue\";\n this._resetList();\n return this.loadItems();\n }\n };\n\n return FavsBaseController;\n\n })();\n\n ProfileLikedController = (function(superClass) {\n extend(ProfileLikedController, superClass);\n\n ProfileLikedController.$inject = [\"tgUserService\"];\n\n function ProfileLikedController(userService) {\n this.userService = userService;\n ProfileLikedController.__super__.constructor.call(this);\n this.enableFilterByAll = false;\n this.enableFilterByProjects = false;\n this.enableFilterByUserStories = false;\n this.enableFilterByTasks = false;\n this.enableFilterByIssues = false;\n this.enableFilterByTextQuery = true;\n this._getItems = this.userService.getLiked;\n }\n\n return ProfileLikedController;\n\n })(FavsBaseController);\n\n angular.module(\"taigaProfile\").controller(\"ProfileLiked\", ProfileLikedController);\n\n ProfileVotedController = (function(superClass) {\n extend(ProfileVotedController, superClass);\n\n ProfileVotedController.$inject = [\"tgUserService\"];\n\n function ProfileVotedController(userService) {\n this.userService = userService;\n ProfileVotedController.__super__.constructor.call(this);\n this.enableFilterByAll = true;\n this.enableFilterByProjects = false;\n this.enableFilterByUserStories = true;\n this.enableFilterByTasks = true;\n this.enableFilterByIssues = true;\n this.enableFilterByTextQuery = true;\n this._getItems = this.userService.getVoted;\n }\n\n return ProfileVotedController;\n\n })(FavsBaseController);\n\n angular.module(\"taigaProfile\").controller(\"ProfileVoted\", ProfileVotedController);\n\n ProfileWatchedController = (function(superClass) {\n extend(ProfileWatchedController, superClass);\n\n ProfileWatchedController.$inject = [\"tgUserService\"];\n\n function ProfileWatchedController(userService) {\n this.userService = userService;\n ProfileWatchedController.__super__.constructor.call(this);\n this._getItems = this.userService.getWatched;\n }\n\n return ProfileWatchedController;\n\n })(FavsBaseController);\n\n angular.module(\"taigaProfile\").controller(\"ProfileWatched\", ProfileWatchedController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-favs.directive.coffee\n */\n\n(function() {\n var ProfileLikedDirective, ProfileVotedDirective, ProfileWatchedDirective, base;\n\n base = {\n scope: {},\n bindToController: {\n user: \"=\",\n type: \"@\",\n q: \"@\",\n scrollDisabled: \"@\",\n isLoading: \"@\",\n hasNoResults: \"@\"\n },\n controller: null,\n controllerAs: \"vm\",\n templateUrl: \"profile/profile-favs/profile-favs.html\"\n };\n\n ProfileLikedDirective = function() {\n return _.extend({}, base, {\n controller: \"ProfileLiked\"\n });\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileLiked\", ProfileLikedDirective);\n\n ProfileVotedDirective = function() {\n return _.extend({}, base, {\n controller: \"ProfileVoted\"\n });\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileVoted\", ProfileVotedDirective);\n\n ProfileWatchedDirective = function() {\n return _.extend({}, base, {\n controller: \"ProfileWatched\"\n });\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileWatched\", ProfileWatchedDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-hints.controller.coffee\n */\n\n(function() {\n var ProfileHints;\n\n ProfileHints = (function() {\n ProfileHints.prototype.HINTS = [\n {\n url: \"https://taiga.io/support/import-export-projects/\"\n }, {\n url: \"https://taiga.io/support/custom-fields/\"\n }, {}, {}\n ];\n\n function ProfileHints(translate) {\n var hintKey;\n this.translate = translate;\n hintKey = Math.floor(Math.random() * this.HINTS.length) + 1;\n this.hint = this.HINTS[hintKey - 1];\n this.hint.linkText = this.hint.linkText || 'HINTS.LINK';\n this.hint.title = this.translate.instant(\"HINTS.HINT\" + hintKey + \"_TITLE\");\n this.hint.text = this.translate.instant(\"HINTS.HINT\" + hintKey + \"_TEXT\");\n }\n\n return ProfileHints;\n\n })();\n\n ProfileHints.$inject = [\"$translate\"];\n\n angular.module(\"taigaProfile\").controller(\"ProfileHints\", ProfileHints);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-hints.directive.coffee\n */\n\n(function() {\n var ProfileHints;\n\n ProfileHints = function($translate) {\n return {\n scope: {},\n controller: \"ProfileHints\",\n controllerAs: \"vm\",\n templateUrl: \"profile/profile-hints/profile-hints.html\"\n };\n };\n\n ProfileHints.$inject = [\"$translate\"];\n\n angular.module(\"taigaProfile\").directive(\"tgProfileHints\", ProfileHints);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-projects.controller.coffee\n */\n\n(function() {\n var ProfileProjectsController;\n\n ProfileProjectsController = (function() {\n ProfileProjectsController.$inject = [\"tgProjectsService\", \"tgUserService\"];\n\n function ProfileProjectsController(projectsService, userService) {\n this.projectsService = projectsService;\n this.userService = userService;\n }\n\n ProfileProjectsController.prototype.loadProjects = function() {\n return this.projectsService.getProjectsByUserId(this.user.get(\"id\")).then((function(_this) {\n return function(projects) {\n return _this.userService.attachUserContactsToProjects(_this.user.get(\"id\"), projects);\n };\n })(this)).then((function(_this) {\n return function(projects) {\n return _this.projects = projects;\n };\n })(this));\n };\n\n return ProfileProjectsController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileProjects\", ProfileProjectsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-projects.directive.coffee\n */\n\n(function() {\n var ProfileProjectsDirective;\n\n ProfileProjectsDirective = function() {\n var link;\n link = function(scope, elm, attr, ctrl) {\n return ctrl.loadProjects();\n };\n return {\n templateUrl: \"profile/profile-projects/profile-projects.html\",\n scope: {\n user: \"=\"\n },\n link: link,\n bindToController: true,\n controllerAs: \"vm\",\n controller: \"ProfileProjects\"\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileProjects\", ProfileProjectsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-tab.directive.coffee\n */\n\n(function() {\n var ProfileTabDirective;\n\n ProfileTabDirective = function() {\n var link;\n link = function(scope, element, attrs, ctrl, transclude) {\n scope.tab = {};\n attrs.$observe(\"tgProfileTab\", function(name) {\n return scope.tab.name = name;\n });\n attrs.$observe(\"tabTitle\", function(title) {\n return scope.tab.title = title;\n });\n scope.tab.icon = attrs.tabIcon;\n scope.tab.iconName = '#' + attrs.tabIcon;\n scope.tab.active = !!attrs.tabActive;\n if (scope.$eval(attrs.tabDisabled) !== true) {\n return ctrl.addTab(scope.tab);\n }\n };\n return {\n templateUrl: \"profile/profile-tab/profile-tab.html\",\n scope: {},\n require: \"^tgProfileTabs\",\n link: link,\n transclude: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileTab\", ProfileTabDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-tabs.controller.coffee\n */\n\n(function() {\n var ProfileTabsController;\n\n ProfileTabsController = (function() {\n function ProfileTabsController() {\n this.tabs = [];\n }\n\n ProfileTabsController.prototype.addTab = function(tab) {\n return this.tabs.push(tab);\n };\n\n ProfileTabsController.prototype.toggleTab = function(tab) {\n _.map(this.tabs, function(tab) {\n return tab.active = false;\n });\n return tab.active = true;\n };\n\n return ProfileTabsController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"ProfileTabs\", ProfileTabsController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile-tabs.directive.coffee\n */\n\n(function() {\n var ProfileTabsDirective;\n\n ProfileTabsDirective = function() {\n return {\n scope: {},\n controller: \"ProfileTabs\",\n controllerAs: \"vm\",\n templateUrl: \"profile/profile-tabs/profile-tabs.html\",\n transclude: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgProfileTabs\", ProfileTabsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: profile.controller.coffee\n */\n\n(function() {\n var ProfileController;\n\n ProfileController = (function() {\n ProfileController.$inject = [\"tgAppMetaService\", \"tgCurrentUserService\", \"$routeParams\", \"tgUserService\", \"tgXhrErrorService\", \"$translate\"];\n\n function ProfileController(appMetaService, currentUserService, routeParams, userService, xhrError, translate) {\n this.appMetaService = appMetaService;\n this.currentUserService = currentUserService;\n this.routeParams = routeParams;\n this.userService = userService;\n this.xhrError = xhrError;\n this.translate = translate;\n this.isCurrentUser = false;\n if (this.routeParams.slug) {\n this.userService.getUserByUserName(this.routeParams.slug).then((function(_this) {\n return function(user) {\n if (!user.get('is_active')) {\n return _this.xhrError.notFound();\n } else {\n _this.user = user;\n _this.isCurrentUser = false;\n _this._setMeta(_this.user);\n return user;\n }\n };\n })(this))[\"catch\"]((function(_this) {\n return function(xhr) {\n return _this.xhrError.response(xhr);\n };\n })(this));\n } else {\n this.user = this.currentUserService.getUser();\n this.isCurrentUser = true;\n this._setMeta(this.user);\n }\n }\n\n ProfileController.prototype._setMeta = function(user) {\n var ctx, description, title;\n ctx = {\n userFullName: user.get(\"full_name_display\"),\n userUsername: user.get(\"username\")\n };\n title = this.translate.instant(\"USER.PROFILE.PAGE_TITLE\", ctx);\n description = user.get(\"bio\");\n return this.appMetaService.setAll(title, description);\n };\n\n return ProfileController;\n\n })();\n\n angular.module(\"taigaProfile\").controller(\"Profile\", ProfileController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: blocked-project-explanation.directive.coffee\n */\n\n(function() {\n var BlockedProjectExplanationDirective;\n\n BlockedProjectExplanationDirective = function() {\n return {\n templateUrl: \"projects/project/blocked-project-explanation.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgBlockedProjectExplanation\", BlockedProjectExplanationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: like-project-button.controller.coffee\n */\n\n(function() {\n var LikeProjectButtonController;\n\n LikeProjectButtonController = (function() {\n LikeProjectButtonController.$inject = [\"$tgConfirm\", \"tgLikeProjectButtonService\"];\n\n function LikeProjectButtonController(confirm, likeButtonService) {\n this.confirm = confirm;\n this.likeButtonService = likeButtonService;\n this.isMouseOver = false;\n this.loading = false;\n }\n\n LikeProjectButtonController.prototype.showTextWhenMouseIsOver = function() {\n return this.isMouseOver = true;\n };\n\n LikeProjectButtonController.prototype.showTextWhenMouseIsLeave = function() {\n return this.isMouseOver = false;\n };\n\n LikeProjectButtonController.prototype.toggleLike = function() {\n var promise;\n this.loading = true;\n if (!this.project.get(\"is_fan\")) {\n promise = this._like();\n } else {\n promise = this._unlike();\n }\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n return promise;\n };\n\n LikeProjectButtonController.prototype._like = function() {\n return this.likeButtonService.like(this.project.get('id')).then((function(_this) {\n return function() {\n return _this.showTextWhenMouseIsLeave();\n };\n })(this))[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n };\n\n LikeProjectButtonController.prototype._unlike = function() {\n return this.likeButtonService.unlike(this.project.get('id'))[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n };\n\n return LikeProjectButtonController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"LikeProjectButton\", LikeProjectButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: like-project-button.directive.coffee\n */\n\n(function() {\n var LikeProjectButtonDirective;\n\n LikeProjectButtonDirective = function() {\n return {\n scope: {},\n controller: \"LikeProjectButton\",\n bindToController: {\n project: '='\n },\n controllerAs: \"vm\",\n templateUrl: \"projects/components/like-project-button/like-project-button.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgLikeProjectButton\", LikeProjectButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: like-project-button.service.coffee\n */\n\n(function() {\n var LikeProjectButtonService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n LikeProjectButtonService = (function(superClass) {\n extend(LikeProjectButtonService, superClass);\n\n LikeProjectButtonService.$inject = [\"tgResources\", \"tgCurrentUserService\", \"tgProjectService\"];\n\n function LikeProjectButtonService(rs, currentUserService, projectService) {\n this.rs = rs;\n this.currentUserService = currentUserService;\n this.projectService = projectService;\n }\n\n LikeProjectButtonService.prototype._getProjectIndex = function(projectId) {\n return this.currentUserService.projects.get('all').findIndex(function(project) {\n return project.get('id') === projectId;\n });\n };\n\n LikeProjectButtonService.prototype._updateProjects = function(projectId, isFan) {\n var projectIndex, projects;\n projectIndex = this._getProjectIndex(projectId);\n if (projectIndex === -1) {\n return;\n }\n projects = this.currentUserService.projects.get('all').update(projectIndex, function(project) {\n var totalFans;\n totalFans = project.get(\"total_fans\");\n if (isFan) {\n totalFans++;\n } else {\n totalFans--;\n }\n return project.merge({\n is_fan: isFan,\n total_fans: totalFans\n });\n });\n return this.currentUserService.setProjects(projects);\n };\n\n LikeProjectButtonService.prototype._updateCurrentProject = function(isFan) {\n var project, totalFans;\n totalFans = this.projectService.project.get(\"total_fans\");\n if (isFan) {\n totalFans++;\n } else {\n totalFans--;\n }\n project = this.projectService.project.merge({\n is_fan: isFan,\n total_fans: totalFans\n });\n return this.projectService.setProject(project);\n };\n\n LikeProjectButtonService.prototype.like = function(projectId) {\n return this.rs.projects.likeProject(projectId).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, true);\n return _this._updateCurrentProject(true);\n };\n })(this));\n };\n\n LikeProjectButtonService.prototype.unlike = function(projectId) {\n return this.rs.projects.unlikeProject(projectId).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, false);\n return _this._updateCurrentProject(false);\n };\n })(this));\n };\n\n return LikeProjectButtonService;\n\n })(taiga.Service);\n\n angular.module(\"taigaProjects\").service(\"tgLikeProjectButtonService\", LikeProjectButtonService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: sort-projects.directive.coffee\n */\n\n(function() {\n var SortProjectsDirective;\n\n SortProjectsDirective = function(currentUserService) {\n var directive, link;\n link = function(scope, el, attrs, ctrl) {\n var itemEl;\n itemEl = null;\n el.sortable({\n dropOnEmpty: true,\n revert: 200,\n axis: \"y\",\n opacity: .95,\n placeholder: 'placeholder',\n cancel: '.project-name'\n });\n return el.on(\"sortstop\", function(event, ui) {\n var i, index, len, project, sortData, sorted_project_ids, value;\n itemEl = ui.item;\n project = itemEl.scope().project;\n index = itemEl.index();\n sorted_project_ids = _.map(scope.projects.toJS(), function(p) {\n return p.id;\n });\n sorted_project_ids = _.without(sorted_project_ids, project.get(\"id\"));\n sorted_project_ids.splice(index, 0, project.get('id'));\n sortData = [];\n for (index = i = 0, len = sorted_project_ids.length; i < len; index = ++i) {\n value = sorted_project_ids[index];\n sortData.push({\n \"project_id\": value,\n \"order\": index\n });\n }\n return currentUserService.bulkUpdateProjectsOrder(sortData);\n });\n };\n directive = {\n scope: {\n projects: \"=tgSortProjects\"\n },\n link: link\n };\n return directive;\n };\n\n angular.module(\"taigaProjects\").directive(\"tgSortProjects\", [\"tgCurrentUserService\", SortProjectsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-project-button.controller.coffee\n */\n\n(function() {\n var WatchProjectButtonController;\n\n WatchProjectButtonController = (function() {\n WatchProjectButtonController.$inject = [\"$tgConfirm\", \"tgWatchProjectButtonService\"];\n\n function WatchProjectButtonController(confirm, watchButtonService) {\n this.confirm = confirm;\n this.watchButtonService = watchButtonService;\n this.showWatchOptions = false;\n this.loading = false;\n }\n\n WatchProjectButtonController.prototype.toggleWatcherOptions = function() {\n return this.showWatchOptions = !this.showWatchOptions;\n };\n\n WatchProjectButtonController.prototype.closeWatcherOptions = function() {\n return this.showWatchOptions = false;\n };\n\n WatchProjectButtonController.prototype.watch = function(notifyLevel) {\n if (notifyLevel === this.project.get('notify_level')) {\n return;\n }\n this.loading = true;\n this.closeWatcherOptions();\n return this.watchButtonService.watch(this.project.get('id'), notifyLevel)[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this))[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n WatchProjectButtonController.prototype.unwatch = function() {\n this.loading = true;\n this.closeWatcherOptions();\n return this.watchButtonService.unwatch(this.project.get('id'))[\"catch\"]((function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this))[\"finally\"]((function(_this) {\n return function() {\n return _this.loading = false;\n };\n })(this));\n };\n\n return WatchProjectButtonController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"WatchProjectButton\", WatchProjectButtonController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-project-button.directive.coffee\n */\n\n(function() {\n var WatchProjectButtonDirective;\n\n WatchProjectButtonDirective = function() {\n return {\n scope: {},\n controller: \"WatchProjectButton\",\n bindToController: {\n project: \"=\"\n },\n controllerAs: \"vm\",\n templateUrl: \"projects/components/watch-project-button/watch-project-button.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgWatchProjectButton\", WatchProjectButtonDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: watch-project-button.service.coffee\n */\n\n(function() {\n var WatchProjectButtonService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n WatchProjectButtonService = (function(superClass) {\n extend(WatchProjectButtonService, superClass);\n\n WatchProjectButtonService.$inject = [\"tgResources\", \"tgCurrentUserService\", \"tgProjectService\"];\n\n function WatchProjectButtonService(rs, currentUserService, projectService) {\n this.rs = rs;\n this.currentUserService = currentUserService;\n this.projectService = projectService;\n }\n\n WatchProjectButtonService.prototype._getProjectIndex = function(projectId) {\n return this.currentUserService.projects.get('all').findIndex(function(project) {\n return project.get('id') === projectId;\n });\n };\n\n WatchProjectButtonService.prototype._updateProjects = function(projectId, notifyLevel, isWatcher) {\n var projectIndex, projects;\n projectIndex = this._getProjectIndex(projectId);\n if (projectIndex === -1) {\n return;\n }\n projects = this.currentUserService.projects.get('all').update(projectIndex, (function(_this) {\n return function(project) {\n var totalWatchers;\n totalWatchers = project.get('total_watchers');\n if (!_this.projectService.project.get('is_watcher') && isWatcher) {\n totalWatchers++;\n } else if (_this.projectService.project.get('is_watcher') && !isWatcher) {\n totalWatchers--;\n }\n return project.merge({\n is_watcher: isWatcher,\n total_watchers: totalWatchers,\n notify_level: notifyLevel\n });\n };\n })(this));\n return this.currentUserService.setProjects(projects);\n };\n\n WatchProjectButtonService.prototype._updateCurrentProject = function(notifyLevel, isWatcher) {\n var project, totalWatchers;\n totalWatchers = this.projectService.project.get(\"total_watchers\");\n if (!this.projectService.project.get('is_watcher') && isWatcher) {\n totalWatchers++;\n } else if (this.projectService.project.get('is_watcher') && !isWatcher) {\n totalWatchers--;\n }\n project = this.projectService.project.merge({\n is_watcher: isWatcher,\n notify_level: notifyLevel,\n total_watchers: totalWatchers\n });\n return this.projectService.setProject(project);\n };\n\n WatchProjectButtonService.prototype.watch = function(projectId, notifyLevel) {\n return this.rs.projects.watchProject(projectId, notifyLevel).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, notifyLevel, true);\n return _this._updateCurrentProject(notifyLevel, true);\n };\n })(this));\n };\n\n WatchProjectButtonService.prototype.unwatch = function(projectId) {\n return this.rs.projects.unwatchProject(projectId).then((function(_this) {\n return function() {\n _this._updateProjects(projectId, null, false);\n return _this._updateCurrentProject(null, false);\n };\n })(this));\n };\n\n return WatchProjectButtonService;\n\n })(taiga.Service);\n\n angular.module(\"taigaProjects\").service(\"tgWatchProjectButtonService\", WatchProjectButtonService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects-listing.controller.coffee\n */\n\n(function() {\n var ProjectsListingController;\n\n ProjectsListingController = (function() {\n ProjectsListingController.$inject = [\"tgCurrentUserService\", \"tgProjectsService\"];\n\n function ProjectsListingController(currentUserService, projectsService) {\n this.currentUserService = currentUserService;\n this.projectsService = projectsService;\n taiga.defineImmutableProperty(this, \"projects\", (function(_this) {\n return function() {\n return _this.currentUserService.projects.get(\"all\");\n };\n })(this));\n }\n\n ProjectsListingController.prototype.newProject = function() {\n return this.projectsService.newProject();\n };\n\n return ProjectsListingController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"ProjectsListing\", ProjectsListingController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project.controller.coffee\n */\n\n(function() {\n var ProjectController;\n\n ProjectController = (function() {\n ProjectController.$inject = [\"$routeParams\", \"tgAppMetaService\", \"$tgAuth\", \"$translate\", \"tgProjectService\"];\n\n function ProjectController(routeParams, appMetaService, auth, translate, projectService) {\n var projectSlug;\n this.routeParams = routeParams;\n this.appMetaService = appMetaService;\n this.auth = auth;\n this.translate = translate;\n this.projectService = projectService;\n projectSlug = this.routeParams.pslug;\n this.user = this.auth.userData;\n taiga.defineImmutableProperty(this, \"project\", (function(_this) {\n return function() {\n return _this.projectService.project;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"members\", (function(_this) {\n return function() {\n return _this.projectService.activeMembers;\n };\n })(this));\n this.appMetaService.setfn(this._setMeta.bind(this));\n }\n\n ProjectController.prototype._setMeta = function(project) {\n var ctx, metas;\n if (!this.project) {\n return null;\n }\n metas = {};\n ctx = {\n projectName: this.project.get(\"name\")\n };\n metas.title = this.translate.instant(\"PROJECT.PAGE_TITLE\", ctx);\n metas.description = this.project.get(\"description\");\n return metas;\n };\n\n return ProjectController;\n\n })();\n\n angular.module(\"taigaProjects\").controller(\"Project\", ProjectController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects.service.coffee\n */\n\n(function() {\n var ProjectsService, groupBy, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n ProjectsService = (function(superClass) {\n extend(ProjectsService, superClass);\n\n ProjectsService.$inject = [\"tgResources\", \"$projectUrl\", \"tgLightboxFactory\"];\n\n function ProjectsService(rs, projectUrl, lightboxFactory) {\n this.rs = rs;\n this.projectUrl = projectUrl;\n this.lightboxFactory = lightboxFactory;\n }\n\n ProjectsService.prototype.getProjectBySlug = function(projectSlug) {\n return this.rs.projects.getProjectBySlug(projectSlug).then((function(_this) {\n return function(project) {\n return _this._decorate(project);\n };\n })(this));\n };\n\n ProjectsService.prototype.getProjectStats = function(projectId) {\n return this.rs.projects.getProjectStats(projectId);\n };\n\n ProjectsService.prototype.getProjectsByUserId = function(userId, paginate) {\n return this.rs.projects.getProjectsByUserId(userId, paginate).then((function(_this) {\n return function(projects) {\n return projects.map(_this._decorate.bind(_this));\n };\n })(this));\n };\n\n ProjectsService.prototype._decorate = function(project) {\n var colorized_tags, tags, url;\n url = this.projectUrl.get(project.toJS());\n project = project.set(\"url\", url);\n colorized_tags = [];\n if (project.get(\"tags\")) {\n tags = project.get(\"tags\").sort();\n colorized_tags = tags.map(function(tag) {\n var color;\n color = project.get(\"tags_colors\").get(tag);\n return Immutable.fromJS({\n name: tag,\n color: color\n });\n });\n project = project.set(\"colorized_tags\", colorized_tags);\n }\n return project;\n };\n\n ProjectsService.prototype.newProject = function() {\n return this.lightboxFactory.create(\"tg-lb-create-project\", {\n \"class\": \"wizard-create-project lightbox\"\n });\n };\n\n ProjectsService.prototype.bulkUpdateProjectsOrder = function(sortData) {\n return this.rs.projects.bulkUpdateOrder(sortData);\n };\n\n ProjectsService.prototype.transferValidateToken = function(projectId, token) {\n return this.rs.projects.transferValidateToken(projectId, token);\n };\n\n ProjectsService.prototype.transferAccept = function(projectId, token, reason) {\n return this.rs.projects.transferAccept(projectId, token, reason);\n };\n\n ProjectsService.prototype.transferReject = function(projectId, token, reason) {\n return this.rs.projects.transferReject(projectId, token, reason);\n };\n\n return ProjectsService;\n\n })(taiga.Service);\n\n angular.module(\"taigaProjects\").service(\"tgProjectsService\", ProjectsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: cant-own-project-explanation.directive.coffee\n */\n\n(function() {\n var CantOwnProjectExplanationDirective;\n\n CantOwnProjectExplanationDirective = function() {\n return {\n templateUrl: \"projects/transfer/cant-own-project-explanation.html\"\n };\n };\n\n angular.module(\"taigaProjects\").directive(\"tgCantOwnProjectExplanation\", CantOwnProjectExplanationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: transfer-project.directive.coffee\n */\n\n(function() {\n var TransferProject, module;\n\n module = angular.module('taigaProjects');\n\n TransferProject = (function() {\n TransferProject.$inject = [\"$routeParams\", \"tgProjectsService\", \"$location\", \"$tgAuth\", \"tgCurrentUserService\", \"$tgNavUrls\", \"$translate\", \"$tgConfirm\"];\n\n function TransferProject(routeParams, projectService, location, authService, currentUserService, navUrls, translate, confirmService) {\n this.routeParams = routeParams;\n this.projectService = projectService;\n this.location = location;\n this.authService = authService;\n this.currentUserService = currentUserService;\n this.navUrls = navUrls;\n this.translate = translate;\n this.confirmService = confirmService;\n }\n\n TransferProject.prototype.initialize = function() {\n this.projectId = this.project.get(\"id\");\n this.token = this.routeParams.token;\n this.showAddComment = false;\n return this._refreshUserData();\n };\n\n TransferProject.prototype._validateToken = function() {\n return this.projectService.transferValidateToken(this.projectId, this.token).then(null, (function(_this) {\n return function(data, status) {\n return _this.location.path(_this.navUrls.resolve(\"not-found\"));\n };\n })(this));\n };\n\n TransferProject.prototype._refreshUserData = function() {\n return this.authService.refresh().then((function(_this) {\n return function() {\n _this._validateToken();\n _this._setProjectData();\n return _this._checkOwnerData();\n };\n })(this));\n };\n\n TransferProject.prototype._setProjectData = function() {\n return this.canBeOwnedByUser = this.currentUserService.canOwnProject(this.project);\n };\n\n TransferProject.prototype._checkOwnerData = function() {\n var currentUser, maxMemberships;\n currentUser = this.currentUserService.getUser();\n if (this.project.get('is_private')) {\n this.ownerMessage = 'ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PRIVATE';\n this.maxProjects = currentUser.get('max_private_projects');\n if (this.maxProjects === null) {\n this.maxProjects = this.translate.instant('ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS');\n }\n this.currentProjects = currentUser.get('total_private_projects');\n maxMemberships = currentUser.get('max_memberships_private_projects');\n } else {\n this.ownerMessage = 'ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PUBLIC';\n this.maxProjects = currentUser.get('max_public_projects');\n if (this.maxProjects === null) {\n this.maxProjects = this.translate.instant('ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS');\n }\n this.currentProjects = currentUser.get('total_public_projects');\n maxMemberships = currentUser.get('max_memberships_public_projects');\n }\n return this.validNumberOfMemberships = maxMemberships === null || this.project.get('total_memberships') <= maxMemberships;\n };\n\n TransferProject.prototype.transferAccept = function(token, reason) {\n return this.projectService.transferAccept(this.project.get(\"id\"), token, reason).then((function(_this) {\n return function() {\n var newUrl;\n newUrl = _this.navUrls.resolve(\"project-admin-project-profile-details\", {\n project: _this.project.get(\"slug\")\n });\n _this.location.path(newUrl);\n _this.confirmService.notify(\"success\", _this.translate.instant(\"ADMIN.PROJECT_TRANSFER.ACCEPTED_PROJECT_OWNERNSHIP\"), '', 5000);\n };\n })(this));\n };\n\n TransferProject.prototype.transferReject = function(token, reason) {\n return this.projectService.transferReject(this.project.get(\"id\"), token, reason).then((function(_this) {\n return function() {\n var newUrl;\n newUrl = _this.navUrls.resolve(\"project-admin-project-profile-details\", {\n project: _this.project.get(\"slug\")\n });\n _this.location.path(newUrl);\n _this.confirmService.notify(\"success\", _this.translate.instant(\"ADMIN.PROJECT_TRANSFER.REJECTED_PROJECT_OWNERNSHIP\"), '', 5000);\n };\n })(this));\n };\n\n TransferProject.prototype.addComment = function() {\n return this.showAddComment = true;\n };\n\n TransferProject.prototype.hideComment = function() {\n this.showAddComment = false;\n return this.reason = '';\n };\n\n return TransferProject;\n\n })();\n\n module.controller(\"TransferProjectController\", TransferProject);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: transfer-project.directive.coffee\n */\n\n(function() {\n var TransferProjectDirective, module;\n\n module = angular.module('taigaProjects');\n\n TransferProjectDirective = function() {\n var link;\n link = function(scope, el, attrs, ctrl) {\n return ctrl.initialize();\n };\n return {\n link: link,\n scope: {},\n bindToController: {\n project: \"=\"\n },\n templateUrl: \"projects/transfer/transfer-project.html\",\n controller: 'TransferProjectController',\n controllerAs: 'vm'\n };\n };\n\n module.directive('tgTransferProject', TransferProjectDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments-resource.service.coffee\n */\n\n(function() {\n var Resource, module, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n Resource = function(urlsService, http, config, $rootScope, $q, storage) {\n var service;\n service = {};\n service.list = function(type, objectId, projectId) {\n var httpOptions, params, url, urlname;\n urlname = \"attachments/\" + type;\n params = {\n object_id: objectId,\n project: projectId\n };\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n url = urlsService.resolve(urlname);\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service[\"delete\"] = function(type, id) {\n var url, urlname;\n urlname = \"attachments/\" + type;\n url = urlsService.resolve(urlname) + (\"/\" + id);\n return http[\"delete\"](url);\n };\n service.patch = function(type, id, patch) {\n var url, urlname;\n urlname = \"attachments/\" + type;\n url = urlsService.resolve(urlname) + (\"/\" + id);\n return http.patch(url, patch);\n };\n service.create = function(type, projectId, objectId, file) {\n var data, defered, maxFileSize, response, token, uploadComplete, uploadFailed, uploadProgress, url, urlname, xhr;\n urlname = \"attachments/\" + type;\n url = urlsService.resolve(urlname);\n defered = $q.defer();\n if (file === void 0) {\n defered.reject(null);\n return defered.promise;\n }\n maxFileSize = config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"in-progress\";\n file.size = sizeFormat(evt.total);\n file.progressMessage = \"upload \" + (sizeFormat(evt.loaded)) + \" of \" + (sizeFormat(evt.total));\n return file.progressPercent = (Math.round((evt.loaded / evt.total) * 100)) + \"%\";\n });\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n var attachment, error, ref, status;\n file.status = \"done\";\n status = evt.target.status;\n try {\n attachment = JSON.parse(evt.target.responseText);\n } catch (error) {\n attachment = {};\n }\n if (status >= 200 && status < 400) {\n attachment = Immutable.fromJS(attachment);\n return defered.resolve(attachment);\n } else {\n response = {\n status: status,\n data: {\n _error_message: (ref = data['attached_file']) != null ? ref[0] : void 0\n }\n };\n return defered.reject(response);\n }\n });\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"error\";\n return defered.reject(\"fail\");\n });\n };\n })(this);\n data = new FormData();\n data.append(\"project\", projectId);\n data.append(\"object_id\", objectId);\n data.append(\"attached_file\", file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.addEventListener(\"load\", uploadComplete, false);\n xhr.addEventListener(\"error\", uploadFailed, false);\n token = storage.get('token');\n xhr.open(\"POST\", url);\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + token);\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n return function() {\n return {\n \"attachments\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\", \"$tgConfig\", \"$rootScope\", \"$q\", \"$tgStorage\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgAttachmentsResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: external-apps-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.getApplicationToken = function(applicationId, state) {\n var url;\n url = urlsService.resolve(\"applications\");\n url = url + \"/\" + applicationId + \"/token?state=\" + state;\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.authorizeApplicationToken = function(applicationId, state) {\n var data, url;\n url = urlsService.resolve(\"application-tokens\");\n url = url + \"/authorize\";\n data = {\n \"state\": state,\n \"application\": applicationId\n };\n return http.post(url, data).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"externalapps\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgExternalAppsResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: issues-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.listInAllProjects = function(params) {\n var httpOptions, url;\n url = urlsService.resolve(\"issues\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"issues\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgIssuesResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: projects-resource.service.coffee\n */\n\n(function() {\n var Resource, module, pagination;\n\n pagination = function() {};\n\n Resource = function(urlsService, http, paginateResponseService) {\n var service;\n service = {};\n service.getProjects = function(params, pagination) {\n var httpOptions, url;\n if (params == null) {\n params = {};\n }\n if (pagination == null) {\n pagination = true;\n }\n url = urlsService.resolve(\"projects\");\n httpOptions = {};\n if (!pagination) {\n httpOptions = {\n headers: {\n \"x-lazy-pagination\": true\n }\n };\n }\n return http.get(url, params, httpOptions);\n };\n service.getProjectBySlug = function(projectSlug) {\n var url;\n url = urlsService.resolve(\"projects\");\n url = url + \"/by_slug?slug=\" + projectSlug;\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getProjectsByUserId = function(userId, paginate) {\n var httpOptions, params, url;\n if (paginate == null) {\n paginate = false;\n }\n url = urlsService.resolve(\"projects\");\n httpOptions = {};\n if (!paginate) {\n httpOptions.headers = {\n \"x-disable-pagination\": \"1\"\n };\n }\n params = {\n \"member\": userId,\n \"order_by\": \"memberships__user_order\"\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getProjectStats = function(projectId) {\n var url;\n url = urlsService.resolve(\"projects\");\n url = url + \"/\" + projectId;\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.bulkUpdateOrder = function(bulkData) {\n var url;\n url = urlsService.resolve(\"bulk-update-projects-order\");\n return http.post(url, bulkData);\n };\n service.getTimeline = function(projectId, page) {\n var params, url;\n params = {\n page: page,\n only_relevant: true\n };\n url = urlsService.resolve(\"timeline-project\");\n url = url + \"/\" + projectId;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.likeProject = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-like\", projectId);\n return http.post(url);\n };\n service.unlikeProject = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-unlike\", projectId);\n return http.post(url);\n };\n service.watchProject = function(projectId, notifyLevel) {\n var data, url;\n data = {\n notify_level: notifyLevel\n };\n url = urlsService.resolve(\"project-watch\", projectId);\n return http.post(url, data);\n };\n service.unwatchProject = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-unwatch\", projectId);\n return http.post(url);\n };\n service.transferValidateToken = function(projectId, token) {\n var data, url;\n data = {\n token: token\n };\n url = urlsService.resolve(\"project-transfer-validate-token\", projectId);\n return http.post(url, data);\n };\n service.transferAccept = function(projectId, token, reason) {\n var data, url;\n data = {\n token: token,\n reason: reason\n };\n url = urlsService.resolve(\"project-transfer-accept\", projectId);\n return http.post(url, data);\n };\n service.transferReject = function(projectId, token, reason) {\n var data, url;\n data = {\n token: token,\n reason: reason\n };\n url = urlsService.resolve(\"project-transfer-reject\", projectId);\n return http.post(url, data);\n };\n service.transferRequest = function(projectId) {\n var url;\n url = urlsService.resolve(\"project-transfer-request\", projectId);\n return http.post(url);\n };\n service.transferStart = function(projectId, userId, reason) {\n var data, url;\n data = {\n user: userId,\n reason: reason\n };\n url = urlsService.resolve(\"project-transfer-start\", projectId);\n return http.post(url, data);\n };\n return function() {\n return {\n \"projects\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\", \"tgPaginateResponseService\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgProjectsResources\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: resources.coffee\n */\n\n(function() {\n var Resources, services;\n\n services = [\"tgProjectsResources\", \"tgUserResources\", \"tgUsersResources\", \"tgUserstoriesResource\", \"tgTasksResource\", \"tgIssuesResource\", \"tgExternalAppsResource\", \"tgAttachmentsResource\", \"tgStatsResource\"];\n\n Resources = function($injector) {\n var i, j, len, len1, ref, service, serviceFn, serviceName, serviceProperty;\n for (i = 0, len = services.length; i < len; i++) {\n serviceName = services[i];\n serviceFn = $injector.get(serviceName);\n service = $injector.invoke(serviceFn);\n ref = Object.keys(service);\n for (j = 0, len1 = ref.length; j < len1; j++) {\n serviceProperty = ref[j];\n if (this[serviceProperty]) {\n console.warm(\"repeated resource \" + serviceProperty);\n }\n this[serviceProperty] = service[serviceProperty];\n }\n }\n return this;\n };\n\n Resources.$inject = [\"$injector\"];\n\n angular.module(\"taigaResources2\").service(\"tgResources\", Resources);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: stats-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.discover = function(applicationId, state) {\n var url;\n url = urlsService.resolve(\"stats-discover\");\n return http.get(url).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"stats\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgStatsResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: tasks-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.listInAllProjects = function(params) {\n var httpOptions, url;\n url = urlsService.resolve(\"tasks\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"tasks\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgTasksResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http, paginateResponseService) {\n var service;\n service = {};\n service.getUserStorage = function(key) {\n var httpOptions, url;\n url = urlsService.resolve(\"user-storage\");\n if (key) {\n url += '/' + key;\n }\n httpOptions = {};\n return http.get(url, {}).then(function(response) {\n return response.data.value;\n });\n };\n service.setUserStorage = function(key, value) {\n var params, url;\n url = urlsService.resolve(\"user-storage\") + '/' + key;\n params = {\n key: key,\n value: value\n };\n return http.put(url, params);\n };\n service.createUserStorage = function(key, value) {\n var params, url;\n url = urlsService.resolve(\"user-storage\");\n params = {\n key: key,\n value: value\n };\n return http.post(url, params);\n };\n return function() {\n return {\n \"user\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgUserResources\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: users-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http, paginateResponseService) {\n var service;\n service = {};\n service.getUserByUsername = function(username) {\n var httpOptions, params, url;\n url = urlsService.resolve(\"by_username\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n params = {\n username: username\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getStats = function(userId) {\n var httpOptions, url;\n url = urlsService.resolve(\"user-stats\", userId);\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, {}, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getContacts = function(userId) {\n var httpOptions, url;\n url = urlsService.resolve(\"user-contacts\", userId);\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, {}, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n service.getLiked = function(userId, page, type, q) {\n var params, url;\n url = urlsService.resolve(\"user-liked\", userId);\n params = {};\n if (page != null) {\n params.page = page;\n }\n if (type != null) {\n params.type = type;\n }\n if (q != null) {\n params.q = q;\n }\n params.only_relevant = true;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getVoted = function(userId, page, type, q) {\n var params, url;\n url = urlsService.resolve(\"user-voted\", userId);\n params = {};\n if (page != null) {\n params.page = page;\n }\n if (type != null) {\n params.type = type;\n }\n if (q != null) {\n params.q = q;\n }\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getWatched = function(userId, page, type, q) {\n var params, url;\n url = urlsService.resolve(\"user-watched\", userId);\n params = {};\n if (page != null) {\n params.page = page;\n }\n if (type != null) {\n params.type = type;\n }\n if (q != null) {\n params.q = q;\n }\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getProfileTimeline = function(userId, page) {\n var params, url;\n params = {\n page: page\n };\n url = urlsService.resolve(\"timeline-profile\");\n url = url + \"/\" + userId;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n service.getUserTimeline = function(userId, page) {\n var params, url;\n params = {\n page: page,\n only_relevant: true\n };\n url = urlsService.resolve(\"timeline-user\");\n url = url + \"/\" + userId;\n return http.get(url, params, {\n headers: {\n 'x-lazy-pagination': true\n }\n }).then(function(result) {\n result = Immutable.fromJS(result);\n return paginateResponseService(result);\n });\n };\n return function() {\n return {\n \"users\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\", \"tgPaginateResponseService\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgUsersResources\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: userstories-resource.service.coffee\n */\n\n(function() {\n var Resource, module;\n\n Resource = function(urlsService, http) {\n var service;\n service = {};\n service.listInAllProjects = function(params) {\n var httpOptions, url;\n url = urlsService.resolve(\"userstories\");\n httpOptions = {\n headers: {\n \"x-disable-pagination\": \"1\"\n }\n };\n return http.get(url, params, httpOptions).then(function(result) {\n return Immutable.fromJS(result.data);\n });\n };\n return function() {\n return {\n \"userstories\": service\n };\n };\n };\n\n Resource.$inject = [\"$tgUrls\", \"$tgHttp\"];\n\n module = angular.module(\"taigaResources2\");\n\n module.factory(\"tgUserstoriesResource\", Resource);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: app-meta.service.coffee\n */\n\n(function() {\n var AppMetaService, taiga, truncate;\n\n taiga = this.taiga;\n\n truncate = taiga.truncate;\n\n AppMetaService = (function() {\n AppMetaService.$inject = [\"$rootScope\"];\n\n function AppMetaService(rootScope) {\n this.rootScope = rootScope;\n }\n\n AppMetaService.prototype._set = function(key, value) {\n var meta;\n if (!key) {\n return;\n }\n if (key === \"title\") {\n meta = $(\"head title\");\n if (meta.length === 0) {\n meta = $(\"\");\n $(\"head\").append(meta);\n }\n return meta.text(value || \"\");\n } else if (key.indexOf(\"og:\") === 0) {\n meta = $(\"head meta[property='\" + key + \"']\");\n if (meta.length === 0) {\n meta = $(\"\");\n $(\"head\").append(meta);\n }\n return meta.attr(\"content\", value || \"\");\n } else {\n meta = $(\"head meta[name='\" + key + \"']\");\n if (meta.length === 0) {\n meta = $(\"\");\n $(\"head\").append(meta);\n }\n return meta.attr(\"content\", value || \"\");\n }\n };\n\n AppMetaService.prototype.setTitle = function(title) {\n return this._set('title', title);\n };\n\n AppMetaService.prototype.setDescription = function(description) {\n return this._set(\"description\", truncate(description, 250));\n };\n\n AppMetaService.prototype.setTwitterMetas = function(title, description) {\n this._set(\"twitter:card\", \"summary\");\n this._set(\"twitter:site\", \"@taigaio\");\n this._set(\"twitter:title\", title);\n this._set(\"twitter:description\", truncate(description, 300));\n return this._set(\"twitter:image\", window.location.origin + \"/\" + window._version + \"/images/logo-color.png\");\n };\n\n AppMetaService.prototype.setOpenGraphMetas = function(title, description) {\n this._set(\"og:type\", \"object\");\n this._set(\"og:site_name\", \"Taiga - Love your projects\");\n this._set(\"og:title\", title);\n this._set(\"og:description\", truncate(description, 300));\n this._set(\"og:image\", window.location.origin + \"/\" + window._version + \"/images/logo-color.png\");\n return this._set(\"og:url\", window.location.href);\n };\n\n AppMetaService.prototype.setAll = function(title, description) {\n this.setTitle(title);\n this.setDescription(description);\n this.setTwitterMetas(title, description);\n return this.setOpenGraphMetas(title, description);\n };\n\n AppMetaService.prototype.addMobileViewport = function() {\n return $(\"head\").append(\"\");\n };\n\n AppMetaService.prototype.removeMobileViewport = function() {\n return $(\"head meta[name=\\\"viewport\\\"]\").remove();\n };\n\n AppMetaService.prototype.setfn = function(fn) {\n if (this.listener) {\n this._listener();\n }\n return this._listener = this.rootScope.$watchCollection(fn, (function(_this) {\n return function(metas) {\n if (metas) {\n _this.setAll(metas.title, metas.description);\n return _this._listener();\n }\n };\n })(this));\n };\n\n return AppMetaService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgAppMetaService\", AppMetaService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: attachments.service.coffee\n */\n\n(function() {\n var AttachmentsService, sizeFormat;\n\n sizeFormat = this.taiga.sizeFormat;\n\n AttachmentsService = (function() {\n AttachmentsService.$inject = [\"$tgConfirm\", \"$tgConfig\", \"$translate\", \"tgResources\"];\n\n function AttachmentsService(confirm, config, translate, rs) {\n this.confirm = confirm;\n this.config = config;\n this.translate = translate;\n this.rs = rs;\n this.maxFileSize = this.getMaxFileSize();\n if (this.maxFileSize) {\n this.maxFileSizeFormated = sizeFormat(this.maxFileSize);\n }\n }\n\n AttachmentsService.prototype.sizeError = function(file) {\n var message;\n message = this.translate.instant(\"ATTACHMENT.ERROR_MAX_SIZE_EXCEEDED\", {\n fileName: file.name,\n fileSize: sizeFormat(file.size),\n maxFileSize: this.maxFileSizeFormated\n });\n return this.confirm.notify(\"error\", message);\n };\n\n AttachmentsService.prototype.validate = function(file) {\n if (this.maxFileSize && file.size > this.maxFileSize) {\n this.sizeError(file);\n return false;\n }\n return true;\n };\n\n AttachmentsService.prototype.getMaxFileSize = function() {\n return this.config.get(\"maxUploadFileSize\", null);\n };\n\n AttachmentsService.prototype.list = function(type, objId, projectId) {\n return this.rs.attachments.list(type, objId, projectId).then((function(_this) {\n return function(attachments) {\n return attachments.sortBy(function(attachment) {\n return attachment.get('order');\n });\n };\n })(this));\n };\n\n AttachmentsService.prototype[\"delete\"] = function(type, id) {\n return this.rs.attachments[\"delete\"](type, id);\n };\n\n AttachmentsService.prototype.saveError = function(file, data) {\n var message;\n message = \"\";\n if (file) {\n message = this.translate.instant(\"ATTACHMENT.ERROR_UPLOAD_ATTACHMENT\", {\n fileName: file.name,\n errorMessage: data.data._error_message\n });\n }\n return this.confirm.notify(\"error\", message);\n };\n\n AttachmentsService.prototype.upload = function(file, objId, projectId, type) {\n var promise;\n promise = this.rs.attachments.create(type, projectId, objId, file);\n promise.then(null, this.saveError.bind(this, file));\n return promise;\n };\n\n AttachmentsService.prototype.patch = function(id, type, patch) {\n var promise;\n promise = this.rs.attachments.patch(type, id, patch);\n promise.then(null, this.saveError.bind(this, null));\n return promise;\n };\n\n return AttachmentsService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgAttachmentsService\", AttachmentsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: check-permissions.service.coffee\n */\n\n(function() {\n var ChekcPermissionsService, taiga;\n\n taiga = this.taiga;\n\n ChekcPermissionsService = (function() {\n ChekcPermissionsService.$inject = [\"tgProjectService\"];\n\n function ChekcPermissionsService(projectService) {\n this.projectService = projectService;\n }\n\n ChekcPermissionsService.prototype.check = function(permission) {\n if (!this.projectService.project) {\n return false;\n }\n return this.projectService.project.get('my_permissions').indexOf(permission) !== -1;\n };\n\n return ChekcPermissionsService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgCheckPermissionsService\", ChekcPermissionsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: current-user.service.coffee\n */\n\n(function() {\n var CurrentUserService, groupBy, taiga;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n CurrentUserService = (function() {\n CurrentUserService.$inject = [\"tgProjectsService\", \"$tgStorage\", \"tgResources\"];\n\n function CurrentUserService(projectsService, storageService, rs) {\n this.projectsService = projectsService;\n this.storageService = storageService;\n this.rs = rs;\n this._user = null;\n this._projects = Immutable.Map();\n this._projectsById = Immutable.Map();\n this._joyride = null;\n taiga.defineImmutableProperty(this, \"projects\", (function(_this) {\n return function() {\n return _this._projects;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"projectsById\", (function(_this) {\n return function() {\n return _this._projectsById;\n };\n })(this));\n }\n\n CurrentUserService.prototype.isAuthenticated = function() {\n if (this.getUser() !== null) {\n return true;\n }\n return false;\n };\n\n CurrentUserService.prototype.getUser = function() {\n var userData;\n if (!this._user) {\n userData = this.storageService.get(\"userInfo\");\n if (userData) {\n userData = Immutable.fromJS(userData);\n this.setUser(userData);\n }\n }\n return this._user;\n };\n\n CurrentUserService.prototype.removeUser = function() {\n this._user = null;\n this._projects = Immutable.Map();\n this._projectsById = Immutable.Map();\n return this._joyride = null;\n };\n\n CurrentUserService.prototype.setUser = function(user) {\n this._user = user;\n return this._loadUserInfo();\n };\n\n CurrentUserService.prototype.bulkUpdateProjectsOrder = function(sortData) {\n return this.projectsService.bulkUpdateProjectsOrder(sortData).then((function(_this) {\n return function() {\n return _this.loadProjects();\n };\n })(this));\n };\n\n CurrentUserService.prototype.loadProjects = function() {\n return this.projectsService.getProjectsByUserId(this._user.get(\"id\")).then((function(_this) {\n return function(projects) {\n return _this.setProjects(projects);\n };\n })(this));\n };\n\n CurrentUserService.prototype.disableJoyRide = function(section) {\n if (section) {\n this._joyride[section] = false;\n } else {\n this._joyride = {\n backlog: false,\n kanban: false,\n dashboard: false\n };\n }\n return this.rs.user.setUserStorage('joyride', this._joyride);\n };\n\n CurrentUserService.prototype.loadJoyRideConfig = function() {\n return new Promise((function(_this) {\n return function(resolve) {\n if (_this._joyride !== null) {\n resolve(_this._joyride);\n return;\n }\n return _this.rs.user.getUserStorage('joyride').then(function(config) {\n _this._joyride = config;\n return resolve(_this._joyride);\n })[\"catch\"](function() {\n _this._joyride = {\n backlog: true,\n kanban: true,\n dashboard: true\n };\n _this.rs.user.createUserStorage('joyride', _this._joyride);\n return resolve(_this._joyride);\n });\n };\n })(this));\n };\n\n CurrentUserService.prototype._loadUserInfo = function() {\n return Promise.all([this.loadProjects()]);\n };\n\n CurrentUserService.prototype.setProjects = function(projects) {\n this._projects = this._projects.set(\"all\", projects);\n this._projects = this._projects.set(\"recents\", projects.slice(0, 10));\n this._projectsById = Immutable.fromJS(groupBy(projects.toJS(), function(p) {\n return p.id;\n }));\n return this.projects;\n };\n\n CurrentUserService.prototype.canCreatePrivateProjects = function() {\n var user;\n user = this.getUser();\n if (user.get('max_private_projects') !== null && user.get('total_private_projects') >= user.get('max_private_projects')) {\n return {\n valid: false,\n reason: 'max_private_projects',\n type: 'private_project'\n };\n }\n return {\n valid: true\n };\n };\n\n CurrentUserService.prototype.canCreatePublicProjects = function() {\n var user;\n user = this.getUser();\n if (user.get('max_public_projects') !== null && user.get('total_public_projects') >= user.get('max_public_projects')) {\n return {\n valid: false,\n reason: 'max_public_projects',\n type: 'public_project'\n };\n }\n return {\n valid: true\n };\n };\n\n CurrentUserService.prototype.canOwnProject = function(project) {\n var result, user;\n user = this.getUser();\n if (project.get('is_private')) {\n result = this.canCreatePrivateProjects();\n if (!result.valid) {\n return result;\n }\n if (user.get('max_memberships_private_projects') !== null && project.get('total_memberships') > user.get('max_memberships_private_projects')) {\n return {\n valid: false,\n reason: 'max_members_private_projects',\n type: 'private_project'\n };\n }\n } else {\n result = this.canCreatePublicProjects();\n if (!result.valid) {\n return result;\n }\n if (user.get('max_memberships_public_projects') !== null && project.get('total_memberships') > user.get('max_memberships_public_projects')) {\n return {\n valid: false,\n reason: 'max_members_public_projects',\n type: 'public_project'\n };\n }\n }\n return {\n valid: true\n };\n };\n\n return CurrentUserService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgCurrentUserService\", CurrentUserService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: lightbox-factory.service.coffee\n */\n\n(function() {\n var LightboxFactory;\n\n LightboxFactory = (function() {\n LightboxFactory.$inject = [\"$rootScope\", \"$compile\"];\n\n function LightboxFactory(rootScope, compile) {\n this.rootScope = rootScope;\n this.compile = compile;\n }\n\n LightboxFactory.prototype.create = function(name, attrs, scopeAttrs) {\n var elm, html, scope;\n scope = this.rootScope.$new();\n scope = _.merge(scope, scopeAttrs);\n elm = $(\"
\").attr(name, true).attr(\"tg-bind-scope\", true);\n if (attrs) {\n elm.attr(attrs);\n }\n elm.addClass(\"remove-on-close\");\n html = this.compile(elm)(scope);\n $(document.body).append(html);\n };\n\n return LightboxFactory;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgLightboxFactory\", LightboxFactory);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: paginate-response.service.coffee\n */\n\n(function() {\n var PaginateResponse;\n\n PaginateResponse = function() {\n return function(result) {\n var paginateResponse;\n paginateResponse = Immutable.Map({\n \"data\": result.get(\"data\"),\n \"next\": !!result.get(\"headers\")(\"x-pagination-next\"),\n \"prev\": !!result.get(\"headers\")(\"x-pagination-prev\"),\n \"current\": result.get(\"headers\")(\"x-pagination-current\"),\n \"count\": result.get(\"headers\")(\"x-pagination-count\")\n });\n return paginateResponse;\n };\n };\n\n angular.module(\"taigaCommon\").factory(\"tgPaginateResponseService\", PaginateResponse);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2015 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project-logo.service.coffee\n */\n\n(function() {\n var ProjectLogoService,\n modulo = function(a, b) { return (+a % (b = +b) + b) % b; };\n\n ProjectLogoService = (function() {\n function ProjectLogoService() {\n var COLORS, IMAGES;\n IMAGES = [\"/\" + window._version + \"/images/project-logos/project-logo-01.png\", \"/\" + window._version + \"/images/project-logos/project-logo-02.png\", \"/\" + window._version + \"/images/project-logos/project-logo-03.png\", \"/\" + window._version + \"/images/project-logos/project-logo-04.png\", \"/\" + window._version + \"/images/project-logos/project-logo-05.png\"];\n COLORS = [\"rgba( 153, 214, 220, 1 )\", \"rgba( 213, 156, 156, 1 )\", \"rgba( 214, 161, 212, 1 )\", \"rgba( 164, 162, 219, 1 )\", \"rgba( 152, 224, 168, 1 )\"];\n this.logos = _.cartesianProduct(IMAGES, COLORS);\n }\n\n ProjectLogoService.prototype.getDefaultProjectLogo = function(slug, id) {\n var idx, key, logo;\n key = slug + \"-\" + id;\n idx = modulo(murmurhash3_32_gc(key, 42), this.logos.length);\n logo = this.logos[idx];\n return {\n src: logo[0],\n color: logo[1]\n };\n };\n\n return ProjectLogoService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgProjectLogoService\", ProjectLogoService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: project.service.coffee\n */\n\n(function() {\n var ProjectService, taiga;\n\n taiga = this.taiga;\n\n ProjectService = (function() {\n ProjectService.$inject = [\"tgProjectsService\", \"tgXhrErrorService\"];\n\n function ProjectService(projectsService, xhrError) {\n this.projectsService = projectsService;\n this.xhrError = xhrError;\n this._project = null;\n this._section = null;\n this._sectionsBreadcrumb = Immutable.List();\n this._activeMembers = Immutable.List();\n taiga.defineImmutableProperty(this, \"project\", (function(_this) {\n return function() {\n return _this._project;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"section\", (function(_this) {\n return function() {\n return _this._section;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"sectionsBreadcrumb\", (function(_this) {\n return function() {\n return _this._sectionsBreadcrumb;\n };\n })(this));\n taiga.defineImmutableProperty(this, \"activeMembers\", (function(_this) {\n return function() {\n return _this._activeMembers;\n };\n })(this));\n }\n\n ProjectService.prototype.setSection = function(section) {\n this._section = section;\n if (section) {\n return this._sectionsBreadcrumb = this._sectionsBreadcrumb.push(this._section);\n } else {\n return this._sectionsBreadcrumb = Immutable.List();\n }\n };\n\n ProjectService.prototype.setProjectBySlug = function(pslug) {\n return new Promise((function(_this) {\n return function(resolve, reject) {\n if (!_this.project || _this.project.get('slug') !== pslug) {\n return _this.projectsService.getProjectBySlug(pslug).then(function(project) {\n _this.setProject(project);\n return resolve();\n })[\"catch\"](function(xhr) {\n return _this.xhrError.response(xhr);\n });\n } else {\n return resolve();\n }\n };\n })(this));\n };\n\n ProjectService.prototype.setProject = function(project) {\n this._project = project;\n return this._activeMembers = this._project.get('members').filter(function(member) {\n return member.get('is_active');\n });\n };\n\n ProjectService.prototype.cleanProject = function() {\n this._project = null;\n this._activeMembers = Immutable.List();\n this._section = null;\n return this._sectionsBreadcrumb = Immutable.List();\n };\n\n ProjectService.prototype.hasPermission = function(permission) {\n return this._project.get('my_permissions').indexOf(permission) !== -1;\n };\n\n ProjectService.prototype.fetchProject = function() {\n var pslug;\n pslug = this.project.get('slug');\n return this.projectsService.getProjectBySlug(pslug).then((function(_this) {\n return function(project) {\n return _this.setProject(project);\n };\n })(this));\n };\n\n return ProjectService;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgProjectService\", ProjectService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: scope-event.service.coffee\n */\n\n(function() {\n var ScopeEvent;\n\n ScopeEvent = (function() {\n function ScopeEvent() {}\n\n ScopeEvent.prototype.scopes = {};\n\n ScopeEvent.prototype._searchDuplicatedScopes = function(id) {\n return _.find(Object.keys(this.scopes), (function(_this) {\n return function(key) {\n return _this.scopes[key].$id === id;\n };\n })(this));\n };\n\n ScopeEvent.prototype._create = function(name, scope) {\n var duplicatedScopeName;\n duplicatedScopeName = this._searchDuplicatedScopes(scope.$id);\n if (duplicatedScopeName) {\n throw new Error(\"scopeEvent: this scope is already register with the name \\\"\" + duplicatedScopeName + \"\\\"\");\n }\n if (this.scopes[name]) {\n throw new Error(\"scopeEvent: \\\"\" + name + \"\\\" already in use\");\n } else {\n scope._tgEmitter = new EventEmitter2();\n scope.$on(\"$destroy\", (function(_this) {\n return function() {\n scope._tgEmitter.removeAllListeners();\n return delete _this.scopes[name];\n };\n })(this));\n return this.scopes[name] = scope;\n }\n };\n\n ScopeEvent.prototype.emitter = function(name, scope) {\n if (scope) {\n scope = this._create(name, scope);\n } else if (this.scopes[name]) {\n scope = this.scopes[name];\n } else {\n throw new Error(\"scopeEvent: \\\"\" + name + \"\\\" scope doesn't exist'\");\n }\n return scope._tgEmitter;\n };\n\n return ScopeEvent;\n\n })();\n\n angular.module(\"taigaCommon\").service(\"tgScopeEvent\", ScopeEvent);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: theme.service.coffee\n */\n\n(function() {\n var ThemeService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n ThemeService = (function(superClass) {\n extend(ThemeService, superClass);\n\n function ThemeService() {\n return ThemeService.__super__.constructor.apply(this, arguments);\n }\n\n return ThemeService;\n\n })(taiga.Service = function() {\n return {\n use: function(themeName) {\n var stylesheetEl;\n stylesheetEl = $(\"link[rel='stylesheet']:first\");\n if (stylesheetEl.length === 0) {\n stylesheetEl = $(\"\");\n $(\"head\").append(stylesheetEl);\n }\n return stylesheetEl.attr(\"href\", \"/\" + window._version + \"/styles/theme-\" + themeName + \".css\");\n }\n };\n });\n\n angular.module(\"taigaCommon\").service(\"tgThemeService\", ThemeService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user.service.coffee\n */\n\n(function() {\n var UserService, bindMethods, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n bindMethods = taiga.bindMethods;\n\n UserService = (function(superClass) {\n extend(UserService, superClass);\n\n UserService.$inject = [\"tgResources\"];\n\n function UserService(rs) {\n this.rs = rs;\n bindMethods(this);\n }\n\n UserService.prototype.getUserByUserName = function(username) {\n return this.rs.users.getUserByUsername(username);\n };\n\n UserService.prototype.getContacts = function(userId) {\n return this.rs.users.getContacts(userId);\n };\n\n UserService.prototype.getLiked = function(userId, pageNumber, objectType, textQuery) {\n return this.rs.users.getLiked(userId, pageNumber, objectType, textQuery);\n };\n\n UserService.prototype.getVoted = function(userId, pageNumber, objectType, textQuery) {\n return this.rs.users.getVoted(userId, pageNumber, objectType, textQuery);\n };\n\n UserService.prototype.getWatched = function(userId, pageNumber, objectType, textQuery) {\n return this.rs.users.getWatched(userId, pageNumber, objectType, textQuery);\n };\n\n UserService.prototype.getStats = function(userId) {\n return this.rs.users.getStats(userId);\n };\n\n UserService.prototype.attachUserContactsToProjects = function(userId, projects) {\n return this.getContacts(userId).then(function(contacts) {\n projects = projects.map(function(project) {\n var contactsFiltered;\n contactsFiltered = contacts.filter(function(contact) {\n var contactId;\n contactId = contact.get(\"id\");\n return project.get('members').indexOf(contactId) !== -1;\n });\n project = project.set(\"contacts\", contactsFiltered);\n return project;\n });\n return projects;\n });\n };\n\n return UserService;\n\n })(taiga.Service);\n\n angular.module(\"taigaCommon\").service(\"tgUserService\", UserService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: xhrError.service.coffee\n */\n\n(function() {\n var xhrError,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n xhrError = (function(superClass) {\n extend(xhrError, superClass);\n\n xhrError.$inject = [\"$q\", \"$location\", \"$tgNavUrls\"];\n\n function xhrError(q, location, navUrls) {\n this.q = q;\n this.location = location;\n this.navUrls = navUrls;\n }\n\n xhrError.prototype.notFound = function() {\n this.location.path(this.navUrls.resolve(\"not-found\"));\n return this.location.replace();\n };\n\n xhrError.prototype.permissionDenied = function() {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n return this.location.replace();\n };\n\n xhrError.prototype.response = function(xhr) {\n if (xhr) {\n if (xhr.status === 404) {\n this.notFound();\n } else if (xhr.status === 403) {\n this.permissionDenied();\n }\n }\n return this.q.reject(xhr);\n };\n\n return xhrError;\n\n })(taiga.Service);\n\n angular.module(\"taigaCommon\").service(\"tgXhrErrorService\", xhrError);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-attachment.directive.coffee\n */\n\n(function() {\n var UserTimelineAttachmentDirective;\n\n UserTimelineAttachmentDirective = function(template, $compile) {\n var isImage, link, validFileExtensions;\n validFileExtensions = [\".jpg\", \".jpeg\", \".bmp\", \".gif\", \".png\"];\n isImage = function(url) {\n url = url.toLowerCase();\n return _.some(validFileExtensions, function(extension) {\n return url.indexOf(extension, url - extension.length) !== -1;\n });\n };\n link = function(scope, el) {\n var is_image, templateHtml;\n is_image = isImage(scope.attachment.get('url'));\n if (is_image) {\n templateHtml = template.get(\"user-timeline/user-timeline-attachment/user-timeline-attachment-image.html\");\n } else {\n templateHtml = template.get(\"user-timeline/user-timeline-attachment/user-timeline-attachment.html\");\n }\n el.html(templateHtml);\n $compile(el.contents())(scope);\n return el.find(\"img\").error(function() {\n return this.remove();\n });\n };\n return {\n link: link,\n scope: {\n attachment: \"=tgUserTimelineAttachment\"\n }\n };\n };\n\n UserTimelineAttachmentDirective.$inject = [\"$tgTemplate\", \"$compile\"];\n\n angular.module(\"taigaUserTimeline\").directive(\"tgUserTimelineAttachment\", UserTimelineAttachmentDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-item-title.service.coffee\n */\n\n(function() {\n var UserTimelineItemTitle, unslugify;\n\n unslugify = this.taiga.unslugify;\n\n UserTimelineItemTitle = (function() {\n UserTimelineItemTitle.$inject = [\"$translate\", \"$sce\"];\n\n UserTimelineItemTitle.prototype._fieldTranslationKey = {\n 'status': 'COMMON.FIELDS.STATUS',\n 'subject': 'COMMON.FIELDS.SUBJECT',\n 'description_diff': 'COMMON.FIELDS.DESCRIPTION',\n 'points': 'COMMON.FIELDS.POINTS',\n 'assigned_to': 'COMMON.FIELDS.ASSIGNED_TO',\n 'severity': 'ISSUES.FIELDS.SEVERITY',\n 'priority': 'ISSUES.FIELDS.PRIORITY',\n 'type': 'ISSUES.FIELDS.TYPE',\n 'is_iocaine': 'TASK.FIELDS.IS_IOCAINE',\n 'is_blocked': 'COMMON.FIELDS.IS_BLOCKED'\n };\n\n UserTimelineItemTitle.prototype._params = {\n username: function(timeline, event) {\n var title_attr, url, user;\n user = timeline.getIn(['data', 'user']);\n if (user.get('is_profile_visible')) {\n title_attr = this.translate.instant('COMMON.SEE_USER_PROFILE', {\n username: user.get('username')\n });\n url = \"user-profile:username=timeline.getIn(['data', 'user', 'username'])\";\n return this._getLink(url, user.get('name'), title_attr);\n } else {\n return this._getUsernameSpan(user.get('name'));\n }\n },\n field_name: function(timeline, event) {\n var field_name;\n field_name = timeline.getIn(['data', 'value_diff', 'key']);\n return this.translate.instant(this._fieldTranslationKey[field_name]);\n },\n project_name: function(timeline, event) {\n var url;\n url = \"project:project=timeline.getIn(['data', 'project', 'slug'])\";\n return this._getLink(url, timeline.getIn([\"data\", \"project\", \"name\"]));\n },\n new_value: function(timeline, event) {\n var new_value, value;\n if (_.isArray(timeline.getIn([\"data\", \"value_diff\", \"value\"]).toJS())) {\n value = timeline.getIn([\"data\", \"value_diff\", \"value\"]).get(1);\n if (value === null && timeline.getIn([\"data\", \"value_diff\", \"key\"]) === 'assigned_to') {\n value = this.translate.instant('ACTIVITY.VALUES.UNASSIGNED');\n }\n new_value = value;\n } else {\n new_value = timeline.getIn([\"data\", \"value_diff\", \"value\"]).first().get(1);\n }\n return _.escape(new_value);\n },\n sprint_name: function(timeline, event) {\n var url;\n url = \"project-taskboard:project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['data', 'milestone', 'slug'])\";\n return this._getLink(url, timeline.getIn(['data', 'milestone', 'name']));\n },\n us_name: function(timeline, event) {\n var event_us, obj, text, url;\n obj = this._getTimelineObj(timeline, event).get('userstory');\n event_us = {\n obj: 'parent_userstory'\n };\n url = this._getDetailObjUrl(event_us);\n text = '#' + obj.get('ref') + ' ' + obj.get('subject');\n return this._getLink(url, text);\n },\n obj_name: function(timeline, event) {\n var obj, text, url;\n obj = this._getTimelineObj(timeline, event);\n url = this._getDetailObjUrl(event);\n if (event.obj === 'wikipage') {\n text = unslugify(obj.get('slug'));\n } else if (event.obj === 'milestone') {\n text = obj.get('name');\n } else {\n text = '#' + obj.get('ref') + ' ' + obj.get('subject');\n }\n return this._getLink(url, text);\n },\n role_name: function(timeline, event) {\n return _.escape(timeline.getIn(['data', 'value_diff', 'value']).keySeq().first());\n }\n };\n\n function UserTimelineItemTitle(translate, sce) {\n this.translate = translate;\n this.sce = sce;\n }\n\n UserTimelineItemTitle.prototype._translateTitleParams = function(param, timeline, event) {\n return this._params[param].call(this, timeline, event);\n };\n\n UserTimelineItemTitle.prototype._getTimelineObj = function(timeline, event) {\n return timeline.getIn(['data', event.obj]);\n };\n\n UserTimelineItemTitle.prototype._getDetailObjUrl = function(event) {\n var url;\n url = {\n \"issue\": [\"project-issues-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])\"],\n \"wikipage\": [\"project-wiki-page\", \":project=timeline.getIn(['data', 'project', 'slug']),slug=timeline.getIn(['obj', 'slug'])\"],\n \"task\": [\"project-tasks-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])\"],\n \"userstory\": [\"project-userstories-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])\"],\n \"parent_userstory\": [\"project-userstories-detail\", \":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'userstory', 'ref'])\"],\n \"milestone\": [\"project-taskboard\", \":project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['obj', 'slug'])\"]\n };\n return url[event.obj][0] + url[event.obj][1];\n };\n\n UserTimelineItemTitle.prototype._getLink = function(url, text, title) {\n title = title || text;\n return $('').attr('tg-nav', url).text(text).attr('title', title).prop('outerHTML');\n };\n\n UserTimelineItemTitle.prototype._getUsernameSpan = function(text) {\n var title;\n title = title || text;\n return $('').addClass('username').text(text).prop('outerHTML');\n };\n\n UserTimelineItemTitle.prototype._getParams = function(timeline, event, timeline_type) {\n var params;\n params = {};\n timeline_type.translate_params.forEach((function(_this) {\n return function(param) {\n return params[param] = _this._translateTitleParams(param, timeline, event);\n };\n })(this));\n return params;\n };\n\n UserTimelineItemTitle.prototype.getTitle = function(timeline, event, type) {\n var params, paramsKeys, translation;\n params = this._getParams(timeline, event, type);\n paramsKeys = {};\n Object.keys(params).forEach(function(key) {\n return paramsKeys[key] = '{{' + key + '}}';\n });\n translation = this.translate.instant(type.key, paramsKeys);\n Object.keys(params).forEach(function(key) {\n var find;\n find = '{{' + key + '}}';\n return translation = translation.replace(new RegExp(find, 'g'), params[key]);\n });\n return translation;\n };\n\n return UserTimelineItemTitle;\n\n })();\n\n angular.module(\"taigaUserTimeline\").service(\"tgUserTimelineItemTitle\", UserTimelineItemTitle);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-item-type.service.coffee\n */\n\n(function() {\n var UserTimelineType, timelineType;\n\n timelineType = function(timeline, event) {\n var types;\n types = [\n {\n check: function(timeline, event) {\n return event.obj === 'membership';\n },\n key: 'TIMELINE.NEW_MEMBER',\n translate_params: ['project_name'],\n member: function(timeline) {\n return Immutable.Map({\n user: timeline.getIn(['data', 'user']),\n role: timeline.getIn(['data', 'role'])\n });\n }\n }, {\n check: function(timeline, event) {\n return event.obj === 'project' && event.type === 'create';\n },\n key: 'TIMELINE.NEW_PROJECT',\n translate_params: ['username', 'project_name'],\n description: function(timeline) {\n return timeline.getIn(['data', 'project', 'description']);\n }\n }, {\n check: function(timeline, event) {\n return event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'attachments';\n },\n key: 'TIMELINE.UPLOAD_ATTACHMENT',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'create';\n },\n key: 'TIMELINE.US_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'issue' && event.type === 'create';\n },\n key: 'TIMELINE.ISSUE_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'wikipage' && event.type === 'create';\n },\n key: 'TIMELINE.WIKI_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'create' && !timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'create' && timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_CREATED_WITH_US',\n translate_params: ['username', 'project_name', 'obj_name', 'us_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'milestone' && event.type === 'create';\n },\n key: 'TIMELINE.MILESTONE_CREATED',\n translate_params: ['username', 'project_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return timeline.getIn(['data', 'comment']) && event.obj === 'userstory';\n },\n key: 'TIMELINE.NEW_COMMENT_US',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n text = timeline.getIn(['data', 'comment_html']);\n return $($.parseHTML(text)).text();\n }\n }, {\n check: function(timeline, event) {\n return timeline.getIn(['data', 'comment']) && event.obj === 'issue';\n },\n key: 'TIMELINE.NEW_COMMENT_ISSUE',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n text = timeline.getIn(['data', 'comment_html']);\n return $($.parseHTML(text)).text();\n }\n }, {\n check: function(timeline, event) {\n return timeline.getIn(['data', 'comment']) && event.obj === 'task';\n },\n key: 'TIMELINE.NEW_COMMENT_TASK',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n text = timeline.getIn(['data', 'comment_html']);\n return $($.parseHTML(text)).text();\n }\n }, {\n check: function(timeline, event) {\n return timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'moveInBacklog' && timeline.hasIn(['data', 'value_diff', 'value', 'backlog_order']) && event.type === 'change';\n },\n key: 'TIMELINE.US_MOVED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n if (timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'moveInBacklog' && event.type === 'change' && event.obj === 'userstory') {\n return timeline.getIn(['data', 'value_diff', 'value', 'milestone']).get(1) === null;\n }\n return false;\n },\n key: 'TIMELINE.US_REMOVED_FROM_MILESTONE',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'moveInBacklog' && event.type === 'change' && event.obj === 'userstory';\n },\n key: 'TIMELINE.US_ADDED_MILESTONE',\n translate_params: ['username', 'obj_name', 'sprint_name']\n }, {\n check: function(timeline, event) {\n if (timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'blocked' && event.type === 'change') {\n return timeline.getIn(['data', 'value_diff', 'value', 'is_blocked']).get(1) === true;\n }\n return false;\n },\n key: 'TIMELINE.BLOCKED',\n translate_params: ['username', 'obj_name'],\n description: function(timeline) {\n var text;\n if (timeline.hasIn(['data', 'value_diff', 'value', 'blocked_note_html'])) {\n text = timeline.getIn(['data', 'value_diff', 'value', 'blocked_note_html']).get(1);\n return $($.parseHTML(text)).text();\n } else {\n return false;\n }\n }\n }, {\n check: function(timeline, event) {\n if (timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'blocked' && event.type === 'change') {\n return timeline.getIn(['data', 'value_diff', 'value', 'is_blocked']).get(1) === false;\n }\n return false;\n },\n key: 'TIMELINE.UNBLOCKED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'milestone' && event.type === 'change';\n },\n key: 'TIMELINE.MILESTONE_UPDATED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'wikipage' && event.type === 'change';\n },\n key: 'TIMELINE.WIKI_UPDATED',\n translate_params: ['username', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'points';\n },\n key: 'TIMELINE.US_UPDATED_POINTS',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value', 'role_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.US_UPDATED',\n translate_params: ['username', 'field_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'userstory' && event.type === 'change';\n },\n key: 'TIMELINE.US_UPDATED_WITH_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'issue' && event.type === 'change' && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.ISSUE_UPDATED',\n translate_params: ['username', 'field_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'issue' && event.type === 'change';\n },\n key: 'TIMELINE.ISSUE_UPDATED_WITH_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && !timeline.getIn(['data', 'task', 'userstory']) && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.TASK_UPDATED',\n translate_params: ['username', 'field_name', 'obj_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && timeline.getIn(['data', 'task', 'userstory']) && timeline.hasIn(['data', 'value_diff']) && timeline.getIn(['data', 'value_diff', 'key']) === 'description_diff';\n },\n key: 'TIMELINE.TASK_UPDATED_WITH_US',\n translate_params: ['username', 'field_name', 'obj_name', 'us_name']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && !timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_UPDATED_WITH_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'task' && event.type === 'change' && timeline.getIn(['data', 'task', 'userstory']);\n },\n key: 'TIMELINE.TASK_UPDATED_WITH_US_NEW_VALUE',\n translate_params: ['username', 'field_name', 'obj_name', 'us_name', 'new_value']\n }, {\n check: function(timeline, event) {\n return event.obj === 'user' && event.type === 'create';\n },\n key: 'TIMELINE.NEW_USER',\n translate_params: ['username']\n }\n ];\n return _.find(types, function(obj) {\n return obj.check(timeline, event);\n });\n };\n\n UserTimelineType = (function() {\n function UserTimelineType() {}\n\n UserTimelineType.prototype.getType = function(timeline, event) {\n return timelineType(timeline, event);\n };\n\n return UserTimelineType;\n\n })();\n\n angular.module(\"taigaUserTimeline\").service(\"tgUserTimelineItemType\", UserTimelineType);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-item.directive.coffee\n */\n\n(function() {\n var UserTimelineItemDirective;\n\n UserTimelineItemDirective = function() {\n return {\n templateUrl: \"user-timeline/user-timeline-item/user-timeline-item.html\",\n scope: {\n timeline: \"=tgUserTimelineItem\"\n }\n };\n };\n\n angular.module(\"taigaUserTimeline\").directive(\"tgUserTimelineItem\", UserTimelineItemDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline-pagination-sequence.service.coffee\n */\n\n(function() {\n var UserTimelinePaginationSequence;\n\n UserTimelinePaginationSequence = function() {\n var obj;\n obj = {};\n obj.generate = function(config) {\n var getContent, items, next, page;\n page = 1;\n items = Immutable.List();\n config.minItems = config.minItems || 20;\n next = function() {\n items = Immutable.List();\n return getContent();\n };\n getContent = function() {\n return config.fetch(page).then(function(response) {\n var data;\n page++;\n data = response.get(\"data\");\n if (config.filter) {\n data = config.filter(data);\n }\n if (config.map) {\n data = data.map(config.map);\n }\n items = items.concat(data);\n if (items.size < config.minItems && response.get(\"next\")) {\n return getContent();\n }\n return Immutable.Map({\n items: items,\n next: response.get(\"next\")\n });\n });\n };\n return {\n next: function() {\n return next();\n }\n };\n };\n return obj;\n };\n\n angular.module(\"taigaUserTimeline\").factory(\"tgUserTimelinePaginationSequenceService\", UserTimelinePaginationSequence);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/profile/profile-timeline/profile-timeline.controller.coffee\n */\n\n(function() {\n var UserTimelineController, mixOf, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n UserTimelineController = (function(superClass) {\n extend(UserTimelineController, superClass);\n\n UserTimelineController.$inject = [\"tgUserTimelineService\"];\n\n function UserTimelineController(userTimelineService) {\n this.userTimelineService = userTimelineService;\n this.timelineList = Immutable.List();\n this.scrollDisabled = false;\n this.timeline = null;\n if (this.projectId) {\n this.timeline = this.userTimelineService.getProjectTimeline(this.projectId);\n } else if (this.currentUser) {\n this.timeline = this.userTimelineService.getProfileTimeline(this.user.get(\"id\"));\n } else {\n this.timeline = this.userTimelineService.getUserTimeline(this.user.get(\"id\"));\n }\n }\n\n UserTimelineController.prototype.loadTimeline = function() {\n this.scrollDisabled = true;\n return this.timeline.next().then((function(_this) {\n return function(response) {\n _this.timelineList = _this.timelineList.concat(response.get(\"items\"));\n if (response.get(\"next\")) {\n _this.scrollDisabled = false;\n }\n return _this.timelineList;\n };\n })(this));\n };\n\n return UserTimelineController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n angular.module(\"taigaUserTimeline\").controller(\"UserTimeline\", UserTimelineController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline.directive.coffee\n */\n\n(function() {\n var UserTimelineDirective;\n\n UserTimelineDirective = function() {\n return {\n templateUrl: \"user-timeline/user-timeline/user-timeline.html\",\n controller: \"UserTimeline\",\n controllerAs: \"vm\",\n scope: {\n projectId: \"=projectid\",\n user: \"=\",\n currentUser: \"=\"\n },\n bindToController: true\n };\n };\n\n angular.module(\"taigaProfile\").directive(\"tgUserTimeline\", UserTimelineDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: user-timeline.service.coffee\n */\n\n(function() {\n var UserTimelineService, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n UserTimelineService = (function(superClass) {\n extend(UserTimelineService, superClass);\n\n UserTimelineService.$inject = [\"tgResources\", \"tgUserTimelinePaginationSequenceService\", \"tgUserTimelineItemType\", \"tgUserTimelineItemTitle\"];\n\n function UserTimelineService(rs, userTimelinePaginationSequenceService, userTimelineItemType, userTimelineItemTitle) {\n this.rs = rs;\n this.userTimelinePaginationSequenceService = userTimelinePaginationSequenceService;\n this.userTimelineItemType = userTimelineItemType;\n this.userTimelineItemTitle = userTimelineItemTitle;\n }\n\n UserTimelineService.prototype._valid_fields = ['status', 'subject', 'description_diff', 'assigned_to', 'points', 'severity', 'priority', 'type', 'attachments', 'is_iocaine', 'content_diff', 'name', 'estimated_finish', 'estimated_start', 'blocked', 'moveInBacklog', 'milestone'];\n\n UserTimelineService.prototype._invalid = [\n {\n check: function(timeline) {\n var fieldKey, value_diff;\n value_diff = timeline.get(\"data\").get(\"value_diff\");\n if (value_diff) {\n fieldKey = value_diff.get('key');\n if (this._valid_fields.indexOf(fieldKey) === -1) {\n return true;\n } else if (fieldKey === 'attachments' && value_diff.get('value').get('new').size === 0) {\n return true;\n }\n }\n return false;\n }\n }, {\n check: function(timeline) {\n var event, value_diff;\n event = timeline.get('event_type').split(\".\");\n value_diff = timeline.get(\"data\").get(\"value_diff\");\n return event[2] === 'change' && value_diff === void 0;\n }\n }, {\n check: function(timeline) {\n var event;\n event = timeline.get('event_type').split(\".\");\n return event[2] === 'delete';\n }\n }, {\n check: function(timeline) {\n var event;\n event = timeline.get('event_type').split(\".\");\n return event[1] === 'project' && event[2] === 'change';\n }\n }, {\n check: function(timeline) {\n return !!timeline.get(\"data\").get(\"comment_deleted\");\n }\n }, {\n check: function(timeline) {\n var event, value_diff;\n event = timeline.get('event_type').split(\".\");\n value_diff = timeline.get(\"data\").get(\"value_diff\");\n if (value_diff && event[1] === \"task\" && event[2] === \"change\" && value_diff.get(\"key\") === \"milestone\") {\n return timeline.get(\"data\").get(\"value_diff\").get(\"value\");\n }\n return false;\n }\n }\n ];\n\n UserTimelineService.prototype._isInValidTimeline = function(timeline) {\n return _.some(this._invalid, (function(_this) {\n return function(invalid) {\n return invalid.check.call(_this, timeline);\n };\n })(this));\n };\n\n UserTimelineService.prototype._parseEventType = function(event_type) {\n event_type = event_type.split(\".\");\n return {\n section: event_type[0],\n obj: event_type[1],\n type: event_type[2]\n };\n };\n\n UserTimelineService.prototype._getTimelineObject = function(timeline, event) {\n if (timeline.get('data').get(event.obj)) {\n return timeline.get('data').get(event.obj);\n }\n };\n\n UserTimelineService.prototype._attachExtraInfoToTimelineEntry = function(timeline, event, type) {\n var title;\n title = this.userTimelineItemTitle.getTitle(timeline, event, type);\n timeline = timeline.set('title_html', title);\n timeline = timeline.set('obj', this._getTimelineObject(timeline, event));\n if (type.description) {\n timeline = timeline.set('description', type.description(timeline));\n }\n if (type.member) {\n timeline = timeline.set('member', type.member(timeline));\n }\n if (timeline.getIn(['data', 'value_diff', 'key']) === 'attachments' && timeline.hasIn(['data', 'value_diff', 'value', 'new'])) {\n timeline = timeline.set('attachments', timeline.getIn(['data', 'value_diff', 'value', 'new']));\n }\n return timeline;\n };\n\n UserTimelineService.prototype._parseTimeline = function(response) {\n var newdata;\n newdata = Immutable.List();\n response.get('data').forEach((function(_this) {\n return function(item) {\n var data, event, newItem, values_diff;\n event = _this._parseEventType(item.get('event_type'));\n data = item.get('data');\n values_diff = data.get('values_diff');\n if (values_diff && values_diff.count()) {\n if (values_diff.has('is_blocked')) {\n values_diff = Immutable.Map({\n 'blocked': values_diff\n });\n }\n if (values_diff.has('milestone')) {\n if (event.obj === 'userstory') {\n values_diff = Immutable.Map({\n 'moveInBacklog': values_diff\n });\n } else {\n values_diff = values_diff.deleteIn(['values_diff', 'milestone']);\n }\n } else if (event.obj === 'milestone') {\n values_diff = Immutable.Map({\n 'milestone': values_diff\n });\n }\n return values_diff.forEach(function(value, key) {\n var newItem, obj;\n obj = Immutable.Map({\n key: key,\n value: value\n });\n newItem = item.setIn(['data', 'value_diff'], obj);\n newItem = newItem.deleteIn(['data', 'values_diff']);\n return newdata = newdata.push(newItem);\n });\n } else {\n newItem = item.deleteIn(['data', 'values_diff']);\n return newdata = newdata.push(newItem);\n }\n };\n })(this));\n return response.set('data', newdata);\n };\n\n UserTimelineService.prototype._addEntyAttributes = function(item) {\n var event, type;\n event = this._parseEventType(item.get('event_type'));\n type = this.userTimelineItemType.getType(item, event);\n return this._attachExtraInfoToTimelineEntry(item, event, type);\n };\n\n UserTimelineService.prototype.getProfileTimeline = function(userId) {\n var config;\n config = {};\n config.fetch = (function(_this) {\n return function(page) {\n return _this.rs.users.getProfileTimeline(userId, page).then(function(response) {\n return _this._parseTimeline(response);\n });\n };\n })(this);\n config.map = (function(_this) {\n return function(obj) {\n return _this._addEntyAttributes(obj);\n };\n })(this);\n config.filter = (function(_this) {\n return function(items) {\n return items.filterNot(function(item) {\n return _this._isInValidTimeline(item);\n });\n };\n })(this);\n return this.userTimelinePaginationSequenceService.generate(config);\n };\n\n UserTimelineService.prototype.getUserTimeline = function(userId) {\n var config;\n config = {};\n config.fetch = (function(_this) {\n return function(page) {\n return _this.rs.users.getUserTimeline(userId, page).then(function(response) {\n return _this._parseTimeline(response);\n });\n };\n })(this);\n config.map = (function(_this) {\n return function(obj) {\n return _this._addEntyAttributes(obj);\n };\n })(this);\n config.filter = (function(_this) {\n return function(items) {\n return items.filterNot(function(item) {\n return _this._isInValidTimeline(item);\n });\n };\n })(this);\n return this.userTimelinePaginationSequenceService.generate(config);\n };\n\n UserTimelineService.prototype.getProjectTimeline = function(projectId) {\n var config;\n config = {};\n config.fetch = (function(_this) {\n return function(page) {\n return _this.rs.projects.getTimeline(projectId, page).then(function(response) {\n return _this._parseTimeline(response);\n });\n };\n })(this);\n config.map = (function(_this) {\n return function(obj) {\n return _this._addEntyAttributes(obj);\n };\n })(this);\n config.filter = (function(_this) {\n return function(items) {\n return items.filterNot(function(item) {\n return _this._isInValidTimeline(item);\n });\n };\n })(this);\n return this.userTimelinePaginationSequenceService.generate(config);\n };\n\n return UserTimelineService;\n\n })(taiga.Service);\n\n angular.module(\"taigaUserTimeline\").service(\"tgUserTimelineService\", UserTimelineService);\n\n}).call(this);\n\n//# sourceMappingURL=maps/app.js.map\n"]} \ No newline at end of file diff --git a/dist/v-1459503555751/js/maps/libs.js.map b/dist/v-1460103845046/js/maps/libs.js.map similarity index 100% rename from dist/v-1459503555751/js/maps/libs.js.map rename to dist/v-1460103845046/js/maps/libs.js.map diff --git a/dist/v-1459503555751/js/templates.js b/dist/v-1460103845046/js/templates.js similarity index 97% rename from dist/v-1459503555751/js/templates.js rename to dist/v-1460103845046/js/templates.js index c754022..9ada5ac 100644 --- a/dist/v-1459503555751/js/templates.js +++ b/dist/v-1460103845046/js/templates.js @@ -1,19 +1,13 @@ -angular.module("templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("auth/change-password-from-recovery.html","\n
\n
\n
\n
\n\n \n \n \n \n \n \n \n \n \n\n\n
\n

Taiga

\n
\n


\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
"); -$templateCache.put("auth/forgot-password.html","\n
"); -$templateCache.put("auth/invitation.html","\n
\n
\n
\n

\n

\n
\n
\n

\n
\n \n
\n
\n \n \n
\n
\n
\n
\n
\n

\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
"); -$templateCache.put("auth/login-text.html","\n

 \" title=\"{{"AUTH.REGISTER" | translate}}\" translate=\"AUTH.CREATE_ACCOUNT\">

"); -$templateCache.put("auth/login.html","\n
\n
\n
\n
\n\n \n \n \n \n \n \n \n \n \n\n\n
\n

Taiga

\n

\n
\n
\n
\n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
"); -$templateCache.put("auth/register.html","\n
\n
\n
\n
\n\n \n \n \n \n \n \n \n \n \n\n\n
\n

Taiga

\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
"); -$templateCache.put("admin/admin-membership-paginator.html","\n
    <% if (showPrevious) { %>\n
  • <% } %>\n <% _.each(pages, function(item) { %>\n
  • \"><% if (item.type === \"page\") { %>\"><%- item.num %><% } else if (item.type === \"page-active\") { %><%- item.num %><% } else { %>...<% } %>
  • <% }); %>\n <% if (showNext) { %>\n
  • <% } %>\n
"); +angular.module("templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("admin/admin-membership-paginator.html","\n
    <% if (showPrevious) { %>\n
  • <% } %>\n <% _.each(pages, function(item) { %>\n
  • \"><% if (item.type === \"page\") { %>\"><%- item.num %><% } else if (item.type === \"page-active\") { %><%- item.num %><% } else { %>...<% } %>
  • <% }); %>\n <% if (showNext) { %>\n
  • <% } %>\n
"); $templateCache.put("admin/admin-memberships-row-checkbox.html","\n
\n \"/>\n
\n
"); $templateCache.put("admin/admin-memberships.html","\n
\n \n \n
\n \n
\n
\n
\n
\n
\n
\n

\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
"); -$templateCache.put("admin/admin-project-change-owner.html","\n
\"{{::owner.full_name_display}}\"/
\n
\n
{{ \'ADMIN.PROJECT_PROFILE.PROJECT_OWNER\' | translate }}
\n
{{::owner.full_name_display}}
\n
{{ \'ADMIN.PROJECT_PROFILE.CHANGE_OWNER\' | translate }}"); +$templateCache.put("admin/admin-project-change-owner.html","\n
\"{{::owner.full_name_display}}\"/
\n
\n
{{ \'ADMIN.PROJECT_PROFILE.PROJECT_OWNER\' | translate }}
\n
{{::owner.full_name_display}}
\n
{{ \'ADMIN.PROJECT_PROFILE.CHANGE_OWNER\' | translate }}"); $templateCache.put("admin/admin-project-default-values.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n
\n

\n
\n

\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n
"); -$templateCache.put("admin/admin-project-export.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n
\n

\n
\n

\n
\n
\n
\n
\"{{
\n

\n

\n
\n \n \n \n
\n
"); +$templateCache.put("admin/admin-project-export.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n
\n

\n
\n

\n
\n
\n
\n
\"{{
\n

\n

\n
\n \n \n \n
\n
"); $templateCache.put("admin/admin-project-modules.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n

\n
\n
\n \n \n
\n
\n \n \n
\n \n \n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n

\n
\n \n
\n \n
\n
\n \n
\n \n \n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
"); -$templateCache.put("admin/admin-project-profile.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n
\n

\n
\n
\n
\n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n
\n
\n \n
\n
\n
{{ \'ADMIN.PROJECT_PROFILE.RECRUITING\' | translate }}\n \n \n {{ \'ADMIN.PROJECT_PROFILE.RECRUITING_MESSAGE\' | translate }}\"\n \n \n
\n \n
\n
\n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n {{ \'ADMIN.PROJECT_PROFILE.PRIVATE_OR_PUBLIC\' | translate }}\n \n {{\'ADMIN.PROJECT_PROFILE.PRIVATE_OR_PUBLIC\' | translate }}\n
\n {{ \'ADMIN.PROJECT_PROFILE.DELETE\' | translate }}\n
\n
\n
\n
\n
\n \n \n \n
\n

\n

\n
\n
\n
"); +$templateCache.put("admin/admin-project-profile.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n
\n

\n
\n
\n
\n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n
\n
\n \n
\n
\n
{{ \'ADMIN.PROJECT_PROFILE.RECRUITING\' | translate }}\n \n \n {{ \'ADMIN.PROJECT_PROFILE.RECRUITING_MESSAGE\' | translate }}\"\n \n \n
\n \n
\n
\n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n {{ \'ADMIN.PROJECT_PROFILE.PRIVATE_OR_PUBLIC\' | translate }}\n \n {{\'ADMIN.PROJECT_PROFILE.PRIVATE_OR_PUBLIC\' | translate }}\n
\n {{ \'ADMIN.PROJECT_PROFILE.DELETE\' | translate }}\n
\n
\n
\n
\n
\n \n \n \n
\n

\n

\n
\n
\n
"); $templateCache.put("admin/admin-project-reports.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n
\n

\n
\n

\n
\n

\n
\n
\n
\n \n
\n
"); -$templateCache.put("admin/admin-project-request-ownership.html","\n
\"{{::owner.full_name_display}}\"/
\n
\n
{{ \'ADMIN.PROJECT_PROFILE.PROJECT_OWNER\' | translate }}
\n
{{::owner.full_name_display}}
\n
{{ \'ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP\' | translate }}"); +$templateCache.put("admin/admin-project-request-ownership.html","\n
\"{{::owner.full_name_display}}\"/
\n
\n
{{ \'ADMIN.PROJECT_PROFILE.PROJECT_OWNER\' | translate }}
\n
{{::owner.full_name_display}}
\n
{{ \'ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP\' | translate }}"); $templateCache.put("admin/admin-project-restrictions.html","\n
{{ \'ADMIN.PROJECT_PROFILE.MAX_PRIVATE_PROJECTS\' | translate }}{{ \'ADMIN.PROJECT_PROFILE.MAX_PRIVATE_PROJECTS_MEMBERS\' | translate }}{{ \'ADMIN.PROJECT_PROFILE.MAX_PUBLIC_PROJECTS\' | translate }}{{ \'ADMIN.PROJECT_PROFILE.MAX_PUBLIC_PROJECTS_MEMBERS\' | translate }}
"); $templateCache.put("admin/admin-project-values-custom-fields.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n

\n
\n

\n
\n
\n
\n

{{ customFieldSectionTitle | translate }}

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
{{ attr.name }}
\n
{{ attr.description }}
\n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n

{{ customFieldSectionTitle | translate }}

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
{{ attr.name }}
\n
{{ attr.description }}
\n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n

{{ customFieldSectionTitle | translate }}

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
{{ attr.name }}
\n
{{ attr.description }}
\n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
"); $templateCache.put("admin/admin-project-values-points.html","\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n

\n
\n

\n
\n
\n
\n

{{sectionName | translate}}

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
{{ value.name }}
\n
{{ value.value }}
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
"); @@ -31,7 +25,13 @@ $templateCache.put("admin/lightbox-add-members.html","\" alt=\"<%- full_name %>\"/>\n
\n <%- full_name %>\n <% if (isOwner) { %>\n \n \n \n \n <% } %>\n
<%- pending %><%- email %>
\n
\n"); $templateCache.put("admin/no-more-memberships-explanation.html","\n

\n

"); $templateCache.put("admin/project-csv.html","\n
\n
\n

\n
\n
\n
\n \n
\n \n \n \n
\n
\n \n \n \n \n \n \n
\n
"); -$templateCache.put("backlog/backlog.html","\n
\n \n \n
\n
\n

\n
\n
\n \n \n \n \n
\n
\n
\n
\n

\n \n \n \n

\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n
\n
--
\n
--
\n
--
\n
--
\n
\n \n \n \n
\n
\n
\n \n \n \n
\n

\n

{{\'BACKLOG.CUSTOMIZE_GRAPH_TEXT\' | translate}} {{\'BACKLOG.CUSTOMIZE_GRAPH_ADMIN\' | translate}}

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n
\n \n
\n
\n \n \n {{ ::us.total_voters }}\n
\n
\n
\n
\n \n
\n
\n \n
\n \n \n \n
\n
\n
\n
\"{{\'BACKLOG.EMPTY\'\n

\n
\n
\n \n
\n
\n

\n \n \n \n
\n
\"{{\'BACKLOG.SPRINTS.EMPTY\'\n

\n
\n
\n
\n
\n
\n
{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT_ANONYMOUS\' | translate }}{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT\' | translate }}
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT_ANONYMOUS\' | translate }}{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT\' | translate }}
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n \n
\n
\n \n
"); +$templateCache.put("auth/change-password-from-recovery.html","\n
\n
\n
\n
\n\n \n \n \n \n \n \n \n \n \n\n\n
\n

Taiga

\n
\n


\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
"); +$templateCache.put("auth/forgot-password.html","\n
\n
\n
\n
\n\n \n \n \n \n \n \n \n \n \n\n\n
\n

Taiga

\n
\n


\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
"); +$templateCache.put("auth/invitation.html","\n
\n
\n
\n

\n

\n
\n
\n

\n
\n \n
\n
\n \n \n
\n
\n
\n
\n
\n

\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
"); +$templateCache.put("auth/login-text.html","\n

 \" title=\"{{"AUTH.REGISTER" | translate}}\" translate=\"AUTH.CREATE_ACCOUNT\">

"); +$templateCache.put("auth/login.html","\n
\n
\n
\n
\n\n \n \n \n \n \n \n \n \n \n\n\n
\n

Taiga

\n

\n
\n
\n
\n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
"); +$templateCache.put("auth/register.html","\n
\n
\n
\n
\n\n \n \n \n \n \n \n \n \n \n\n\n
\n

Taiga

\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
"); +$templateCache.put("backlog/backlog.html","\n
\n \n \n
\n
\n

\n
\n
\n \n \n \n \n
\n
\n
\n
\n

\n \n \n \n

\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n
\n
--
\n
--
\n
--
\n
--
\n
\n \n \n \n
\n
\n
\n \n \n \n
\n

\n

{{\'BACKLOG.CUSTOMIZE_GRAPH_TEXT\' | translate}} {{\'BACKLOG.CUSTOMIZE_GRAPH_ADMIN\' | translate}}

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n
\n \n
\n
\n \n \n {{ ::us.total_voters }}\n
\n
\n
\n
\n \n
\n
\n \n
\n \n \n \n
\n
\n
\n
\"{{\'BACKLOG.EMPTY\'\n

\n
\n
\n \n
\n
\n

\n \n \n \n
\n
\"{{\'BACKLOG.SPRINTS.EMPTY\'\n

\n
\n
\n
\n
\n
\n
{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT_ANONYMOUS\' | translate }}{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT\' | translate }}
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT_ANONYMOUS\' | translate }}{{ \'BACKLOG.SPRINTS.WARNING_EMPTY_SPRINT\' | translate }}
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n \n
\n
\n \n
"); $templateCache.put("backlog/filter-selected.html","<% _.each(filters, function(f) { %>\" data-id=\"<%- f.id %>\" class=\"single-filter selected\">\" class=\"name\"><%- f.name %>\n \n \n <% }) %>"); $templateCache.put("backlog/filters.html","\n<% _.each(filters, function(f) { %>\n<% if (f.selected) { %>\" data-id=\"<%- f.id %>\" class=\"single-filter active\">\" class=\"name\"><%- f.name %><% if (f.count){ %><%- f.count %><% } %><% } else { %>\" data-id=\"<%- f.id %>\" class=\"single-filter\">\" class=\"name\"><%- f.name %><% if (f.count){ %><%- f.count %><% } %><% } %>\n<% }) %>"); $templateCache.put("backlog/progress-bar.html","\n
\n
%\" class=\"project-points-progress\">
\n
%\" class=\"closed-points-progress\">
"); @@ -43,27 +43,27 @@ $templateCache.put("contrib/user-settings.html","\n
\n
\n <% if (description){ %><%- description %><% } %>\n
\n
<% if (type==\"text\") { %>\n \"/><% } else if (type==\"multiline\") { %>\n <% } else if (type==\"date\") { %>\n \"/><% } else if (type==\"url\") { %>\n \"/><% } else { %>\n \"/><% } %>\n
\n
\n \n \n \n
\n"); $templateCache.put("custom-attributes/custom-attribute-value.html","\n
\n
<%- name %><% if (description){ %><%- description %><% } %>
\n
<% if (type==\"url\") { %>\"><%- value %><% } else { %>\n <%- value %>\n <% } %>
<% if (isEditable) { %>\n
\n \n \n \n
<% } %>\n
"); $templateCache.put("custom-attributes/custom-attributes-values.html","\n
\n
\n \n open<% } %>\">\n \n \n
\n
open<% } %>\">\n
\">
\n
\n
"); -$templateCache.put("error/error.html","\n
\n
\n \"TAIGA\"\n

Taiga

\n

\n
\n
"); -$templateCache.put("error/not-found.html","\n
\n
\n \"TAIGA\"\n

\n

\n
\n
"); -$templateCache.put("error/permission-denied.html","\n
\n
\"TAIGA\"\n

\n

\n
\n
"); -$templateCache.put("kanban/kanban-task.html","\n
\n
\n
\n
\n

\n
\n
\n

\n

\n

\n
\n \n \n \n
"); -$templateCache.put("kanban/kanban.html","\n
\n \n
\n
\n

\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n \n
\n
\n
\n
"); +$templateCache.put("error/error.html","\n
\n
\n \"TAIGA\"\n

Taiga

\n

\n
\n
"); +$templateCache.put("error/not-found.html","\n
\n
\n \"TAIGA\"\n

\n

\n
\n
"); +$templateCache.put("error/permission-denied.html","\n
\n
\"TAIGA\"\n

\n

\n
\n
"); $templateCache.put("issue/iocaine-button.html","\n
\n \n \n
"); $templateCache.put("issue/issue-paginator.html","\n
    <% if (showPrevious) { %>\n
  • <% } %>\n <% _.each(pages, function(item) { %>\n
  • \"><% if (item.type === \"page\") { %>\"><%- item.num %><% } else if (item.type === \"page-active\") { %><%- item.num %><% } else { %>...<% } %>
  • <% }); %>\n <% if (showNext) { %>\n
  • <% } %>\n
"); $templateCache.put("issue/issue-priority-button.html","\n
clickable<% }%>\">\" class=\"level\"><%- priority.name %><% if(editable){ %>\n \n \n <% }%>\n \n
"); $templateCache.put("issue/issue-severity-button.html","\n
clickable<% }%>\">\" class=\"level\"><%- severity.name %><% if(editable){ %>\n \n \n <% }%>\n \n
"); $templateCache.put("issue/issue-status-inline-edition-selection.html","\n"); $templateCache.put("issue/issue-type-button.html","\n
clickable<% }%>\">\" class=\"level\"><%- type.name %><% if(editable){ %>\n \n \n <% }%>\n \n
"); -$templateCache.put("issue/issues-detail.html","\n
\n \n
\n
\n
\n

\n
\n
\n
\n
\n \n
\n

\n \n

{{ \'ISSUES.EXTERNAL_REFERENCE\'|translate }}{{ issue.external_reference[1] }}

\n

\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n \n
\n \n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n
"); +$templateCache.put("issue/issues-detail.html","\n
\n \n
\n
\n
\n

\n
\n
\n
\n
\n \n
\n

\n \n

{{ \'ISSUES.EXTERNAL_REFERENCE\'|translate }}{{ issue.external_reference[1] }}

\n

\n \n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n \n
\n \n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n
"); $templateCache.put("issue/issues-filters-selected.html","<% _.each(filters, function(f) { %>\" data-id=\"<%- f.id %>\" class=\"single-filter selected\">\" class=\"name\"><%- f.name %>\n \n \n <% }) %>"); $templateCache.put("issue/issues-filters.html","\n<% _.each(filters, function(f) { %>\n<% if (!f.selected) { %>\" data-id=\"<%- f.id %>\" class=\"single-filter\">\" class=\"name\"><%- f.name %><% if (f.count){ %><%- f.count %><% } %>\n <% if (f.type == \"myFilters\"){ %>\n \n \n <% } %><% } %>\n<% }) %>\n"); $templateCache.put("issue/issues-status-button.html","\" ng-click=\"editStatus()\" class=\"detail-status-inner js-edit-status <% if(editable){ %>clickable<% }%>\"><%- status.name %><% if(editable){ %>\n \n \n <% }%>\n "); -$templateCache.put("issue/issues.html","\n
\n \n \n
\n
\n

\n
\n
\n \n \n \n \n
\n
\n
\n
\n

\n \n \n \n

\n \n
\n
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n {{ ::issue.total_voters }}\n
\n \n \n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\"{{ISSUES.TABLE.EMPTY.TITLE\n

\n
\n \n
\n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n \n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n \n
\n
\n
"); +$templateCache.put("issue/issues.html","\n
\n \n \n
\n
\n

\n
\n
\n \n \n \n \n
\n
\n
\n
\n

\n \n \n \n

\n \n
\n
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n {{ ::issue.total_voters }}\n
\n \n \n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\"{{ISSUES.TABLE.EMPTY.TITLE\n

\n
\n \n
\n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n \n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n \n
\n
\n
"); $templateCache.put("issue/promote-issue-to-us-button.html","\n \n \n "); +$templateCache.put("kanban/kanban-task.html","\n
\n
\n
\n
\n

\n
\n
\n

\n

\n

\n
\n \n \n \n
"); +$templateCache.put("kanban/kanban.html","\n
\n \n
\n
\n

\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n \n
\n
\n
\n
"); $templateCache.put("project/wizard-create-project.html","\n\n \n\n
\n
\n

\n
\n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n
\n \n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
"); $templateCache.put("project/wizard-restrictions.html","\n
\n \n \n {{ \'WIZARD.MAX_PRIVATE_PROJECTS\' | translate }}\n
\n
\n \n \n {{ \'WIZARD.MAX_PUBLIC_PROJECTS\' | translate }}\n
"); $templateCache.put("search/lightbox-search.html","\n \n \n \n
\n

\n
\n \n
\n
\n \n
\n
"); -$templateCache.put("search/search.html","\n
\n \n \n
\n
\n
\n \n
\n \n \n \n
\n
\n
\n
\n
\n
\n
\n

\n
\n \n
\n \n \n \n \n
\n
"); +$templateCache.put("search/search.html","\n
\n \n \n
\n
\n
\n \n
\n \n \n \n
\n
\n
\n
\n
\n
\n
\n

\n
\n \n
\n \n \n \n \n
\n
"); $templateCache.put("task/related-task-create-form.html","\n
\n
\n \n
\n \n \n \n \n \n \n
\n
\n
\n\n
\n
\n
\n \n \n \n
\n
"); $templateCache.put("task/related-task-row-edit.html","\n
\n
\n \" placeholder=\"{{\'TASK.PLACEHOLDER_SUBJECT\' | translate}}\"/>\n
\n \n \n \n \n \n \n
\n
\n
\n\n
\n
\n
\n \n \n \n
\n
"); $templateCache.put("task/related-task-row.html","\n
\n
<%- task.subject %>\" class=\"clickable\">\n \n \n #<%- task.ref %><%- task.subject %>\n
<% if(perms.modify_task) { %>\n \n \n <% } %>\n <% if(perms.delete_task) { %>\n \n \n <% } %>\n
\n
\n
\n\n
\n
\n
<% if(perms.modify_task) { %>\n \n \n <% } %>\n
\n
"); @@ -72,7 +72,7 @@ $templateCache.put("taskboard/taskboard-user.html","\n
\n
\n \n
\n
\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n \n \n \n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

\n

\n \n \n \n \n \n \n

\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n

\n

\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n \n \n \n

\n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

{{\'TASKBOARD.PLACEHOLDER_CARD_TITLE\' | translate}}

\n

{{\'TASKBOARD.PLACEHOLDER_CARD_TEXT\' | translate}}

\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n

\n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n \n \n \n

\n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

{{\'TASKBOARD.PLACEHOLDER_CARD_TITLE\' | translate}}

\n

{{\'TASKBOARD.PLACEHOLDER_CARD_TEXT\' | translate}}

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n \n
\n
\n
\n \n \n \n
\n

\n
\n \n
\n
\n
\n
\n
"); $templateCache.put("team/leave-project.html","\n \n \n {{ \'TEAM.ACTION_LEAVE_PROJECT\' | translate }}"); $templateCache.put("team/team-filter.html","\n"); -$templateCache.put("team/team-member-current-user.html","\n
\n
\n
\n
\n
\n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
"); +$templateCache.put("team/team-member-current-user.html","\n
\n
\n
\n
\n
\n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
"); $templateCache.put("team/team-member-stats.html","\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
"); $templateCache.put("team/team-members.html","\n
\n
\n \n
\n
\n
"); $templateCache.put("team/team.html","\n
\n \n \n
\n
\n
\n

\n
\n
\n
\n \n
\n \n \n \n
\n
\n
\n \n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

{{filtersRole.name || (\"TEAM.SECTION_FILTER_ALL\" | translate)}}

\n
\n
\n
"); @@ -80,15 +80,15 @@ $templateCache.put("us/us-client-requirement-button.html","\n