profile hints

stable
Juanfran 2015-05-27 13:14:10 +02:00
parent 2687338db8
commit edf4ecbd28
6 changed files with 102 additions and 7 deletions

View File

@ -1150,6 +1150,15 @@
"LAST_MODIFICATION": "last modification"
}
},
"HINTS": {
"SECTION_NAME": "Hint",
"LINK": "If you want to know how to use it visit our support page",
"LINK_TITLE": "Visit our support page",
"HINT1_TITLE": "Did you know you import and export projects?",
"HINT1_TEXT": "This allow you to extract all your data from one taiga and move it to another one",
"HINT2_TITLE": "Did you know you can create custom fields?",
"HINT2_TEXT": "This will provide teams with a flexible input to fit in their workflow"
},
"TIMELINE": {
"UPLOAD_ATTACHMENT": "{{username}} has uploaded a new attachment in {{obj_name}}",
"US_CREATED": "{{username}} has created a new US in {{project_name}} {{obj_name}}",

View File

@ -5,10 +5,4 @@ aside.profile-sidebar
a.trans-button
span(translate="USER.PROFILE_SIDEBAR.ADD_INFO")
h4
span.icon.icon-help
span Hint
p Did you know you can archive user Stories?
p Archived User Stories help you organize better your columns and remove old cards.
a(href="", title="visit our archived user stories support page") If you want to know how to use it visit our archived user stories support page
div(tg-profile-hints)

View File

@ -0,0 +1,22 @@
class ProfileHints
maxHints: 2
supportUrls: [
"https://taiga.io/support/import-export-projects/",
"https://taiga.io/support/custom-fields/"
]
constructor: (@translate) ->
hintKey = Math.floor(Math.random() * @.maxHints) + 1
@.url = @.supportUrls[hintKey - 1]
@translate("HINTS.HINT#{hintKey}_TITLE").then (text) =>
@.title = text
@translate("HINTS.HINT#{hintKey}_TEXT").then (text) =>
@.text = text
ProfileHints.$inject = [
"$translate"
]
angular.module("taigaProfile").controller("ProfileHints", ProfileHints)

View File

@ -0,0 +1,49 @@
describe "ProfileHints", ->
$controller = null
$provide = null
mocks = {}
_mockTranslate = () ->
mocks.translateService = sinon.stub()
$provide.value "$translate", mocks.translateService
_mocks = () ->
module (_$provide_) ->
$provide = _$provide_
_mockTranslate()
return null
beforeEach ->
module "taigaProfile"
_mocks()
inject (_$controller_) ->
$controller = _$controller_
it "random hint generator", (done) ->
returned = {
then: () ->
}
mocks.translateService.withArgs("HINTS.HINT1_TITLE").promise().resolve("title_1")
mocks.translateService.withArgs("HINTS.HINT1_TEXT").promise().resolve("text_1")
mocks.translateService.withArgs("HINTS.HINT2_TITLE").promise().resolve("title_2")
mocks.translateService.withArgs("HINTS.HINT2_TEXT").promise().resolve("text_2")
ctrl = $controller("ProfileHints")
setTimeout ( ->
if ctrl.url == "https://taiga.io/support/custom-fields/"
expect(ctrl.title).to.be.equal("title_2")
expect(ctrl.text).to.be.equal("text_2")
done()
else if ctrl.url == "https://taiga.io/support/import-export-projects/"
expect(ctrl.title).to.be.equal("title_1")
expect(ctrl.text).to.be.equal("text_1")
done()
)

View File

@ -0,0 +1,13 @@
ProfileHints = ($translate) ->
return {
scope: {},
controller: "ProfileHints",
controllerAs: "vm",
templateUrl: "profile/profile-hints/profile-hints.html"
}
ProfileHints.$inject = [
"$translate"
]
angular.module("taigaProfile").directive("tgProfileHints", ProfileHints)

View File

@ -0,0 +1,8 @@
h4
span.icon.icon-help
span(translate="HINTS.SECTION_NAME")
p {{::vm.title}}
p {{::vm.text}}
|  
a(target="_blank", ng-href="{{::vm.url}}", title="{{'HINTS.LINK_TITLE' | translate}}", translate="HINTS.LINK")