File tree 4 files changed +55
-0
lines changed
4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 88
88
</Topnav::List >
89
89
<Topnav::List class =" md:ml-auto md:border-t-0" >
90
90
<ReportReviewWarning @class =" max-md:hidden" />
91
+ <Topnav::ListItem >
92
+ <Topnav::LinkTo
93
+ @onClick ={{ fn (mut this.expand ) false }}
94
+ title =" Timed Documentation Of This Page"
95
+ href ={{ this.docs.getDocsEndpoint }}
96
+ target =" _blank"
97
+ >
98
+ <FaIcon @icon =" book" />
99
+ Docs
100
+ </Topnav::LinkTo >
101
+ </Topnav::ListItem >
91
102
<Topnav::ListItem >
92
103
<Topnav::LinkTo
93
104
@onClick ={{ fn (mut this.expand ) false }}
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ export default class Topnav extends Component {
7
7
8
8
@service media ;
9
9
10
+ @service docs ;
11
+
10
12
@tracked expand = false ;
11
13
12
14
get navMobile ( ) {
Original file line number Diff line number Diff line change
1
+ import Service , { service } from "@ember/service" ;
2
+
3
+ export default class DocsService extends Service {
4
+ timedDocsURL = "https://timed.dev/docs/" ;
5
+ @service router ;
6
+
7
+ get getDocsEndpoint ( ) {
8
+ return this . timedDocsURL + this . getDocsURL ;
9
+ }
10
+
11
+ get getDocsURL ( ) {
12
+ const docsUrlMatch = {
13
+ // timedUrl: DocsUrl
14
+ "/attendances" : "tracking/attendances" ,
15
+ "/reports" : "tracking/timesheet" ,
16
+ "/analysis" : "analysis" ,
17
+ "/statistics" : "statistics" ,
18
+ "/projects" : "projects" ,
19
+ "/users" : "users" ,
20
+ "/" : "tracking/activities" ,
21
+ } ;
22
+
23
+ for ( const timedUrl of Object . keys ( docsUrlMatch ) ) {
24
+ if ( this . router . currentURL . startsWith ( timedUrl ) ) {
25
+ return docsUrlMatch [ timedUrl ] ;
26
+ }
27
+ }
28
+ return "" ;
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ import { module , test } from "qunit" ;
2
+ import { setupTest } from "timed/tests/helpers" ;
3
+
4
+ module ( "Unit | Service | docs" , function ( hooks ) {
5
+ setupTest ( hooks ) ;
6
+
7
+ // TODO: Replace this with your real tests.
8
+ test ( "it exists" , function ( assert ) {
9
+ const service = this . owner . lookup ( "service:docs" ) ;
10
+ assert . ok ( service ) ;
11
+ } ) ;
12
+ } ) ;
You can’t perform that action at this time.
0 commit comments