config.router.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. 'use strict';
  2. /**
  3. * Config for the router
  4. */
  5. angular.module('app')
  6. .run(
  7. [ '$rootScope', '$state', '$stateParams',
  8. function ($rootScope, $state, $stateParams) {
  9. $rootScope.$state = $state;
  10. $rootScope.$stateParams = $stateParams;
  11. }
  12. ]
  13. )
  14. .config(
  15. [ '$stateProvider', '$urlRouterProvider',
  16. function ($stateProvider, $urlRouterProvider) {
  17. $urlRouterProvider
  18. .otherwise('/app/dashboard-v1');
  19. $stateProvider
  20. .state('app', {
  21. abstract: true,
  22. url: '/app',
  23. templateUrl: 'tpl/app.html'
  24. })
  25. .state('app.dashboard-v1', {
  26. url: '/dashboard-v1',
  27. templateUrl: 'tpl/app_dashboard_v1.html',
  28. resolve: {
  29. deps: ['$ocLazyLoad',
  30. function( $ocLazyLoad ){
  31. return $ocLazyLoad.load(['js/controllers/chart.js']);
  32. }]
  33. }
  34. })
  35. .state('app.dashboard-v2', {
  36. url: '/dashboard-v2',
  37. templateUrl: 'tpl/app_dashboard_v2.html',
  38. resolve: {
  39. deps: ['$ocLazyLoad',
  40. function( $ocLazyLoad ){
  41. return $ocLazyLoad.load(['js/controllers/chart.js']);
  42. }]
  43. }
  44. })
  45. .state('app.ui', {
  46. url: '/ui',
  47. template: '<div ui-view class="fade-in-up"></div>'
  48. })
  49. .state('app.ui.buttons', {
  50. url: '/buttons',
  51. templateUrl: 'tpl/ui_buttons.html'
  52. })
  53. .state('app.ui.icons', {
  54. url: '/icons',
  55. templateUrl: 'tpl/ui_icons.html'
  56. })
  57. .state('app.ui.grid', {
  58. url: '/grid',
  59. templateUrl: 'tpl/ui_grid.html'
  60. })
  61. .state('app.ui.widgets', {
  62. url: '/widgets',
  63. templateUrl: 'tpl/ui_widgets.html'
  64. })
  65. .state('app.ui.bootstrap', {
  66. url: '/bootstrap',
  67. templateUrl: 'tpl/ui_bootstrap.html'
  68. })
  69. .state('app.ui.sortable', {
  70. url: '/sortable',
  71. templateUrl: 'tpl/ui_sortable.html'
  72. })
  73. .state('app.ui.portlet', {
  74. url: '/portlet',
  75. templateUrl: 'tpl/ui_portlet.html'
  76. })
  77. .state('app.ui.timeline', {
  78. url: '/timeline',
  79. templateUrl: 'tpl/ui_timeline.html'
  80. })
  81. .state('app.ui.tree', {
  82. url: '/tree',
  83. templateUrl: 'tpl/ui_tree.html',
  84. resolve: {
  85. deps: ['$ocLazyLoad',
  86. function( $ocLazyLoad ){
  87. return $ocLazyLoad.load('angularBootstrapNavTree').then(
  88. function(){
  89. return $ocLazyLoad.load('js/controllers/tree.js');
  90. }
  91. );
  92. }
  93. ]
  94. }
  95. })
  96. .state('app.ui.toaster', {
  97. url: '/toaster',
  98. templateUrl: 'tpl/ui_toaster.html',
  99. resolve: {
  100. deps: ['$ocLazyLoad',
  101. function( $ocLazyLoad){
  102. return $ocLazyLoad.load('toaster').then(
  103. function(){
  104. return $ocLazyLoad.load('js/controllers/toaster.js');
  105. }
  106. );
  107. }]
  108. }
  109. })
  110. .state('app.ui.jvectormap', {
  111. url: '/jvectormap',
  112. templateUrl: 'tpl/ui_jvectormap.html',
  113. resolve: {
  114. deps: ['$ocLazyLoad',
  115. function( $ocLazyLoad){
  116. return $ocLazyLoad.load('js/controllers/vectormap.js');
  117. }]
  118. }
  119. })
  120. .state('app.ui.googlemap', {
  121. url: '/googlemap',
  122. templateUrl: 'tpl/ui_googlemap.html',
  123. resolve: {
  124. deps: ['uiLoad',
  125. function( uiLoad ){
  126. return uiLoad.load( [
  127. 'js/app/map/load-google-maps.js',
  128. 'js/app/map/ui-map.js',
  129. 'js/app/map/map.js'] ).then(
  130. function(){
  131. return loadGoogleMaps();
  132. }
  133. );
  134. }]
  135. }
  136. })
  137. .state('app.chart', {
  138. url: '/chart',
  139. templateUrl: 'tpl/ui_chart.html',
  140. resolve: {
  141. deps: ['uiLoad',
  142. function( uiLoad){
  143. return uiLoad.load('js/controllers/chart.js');
  144. }]
  145. }
  146. })
  147. // table
  148. .state('app.table', {
  149. url: '/table',
  150. template: '<div ui-view></div>'
  151. })
  152. .state('app.table.static', {
  153. url: '/static',
  154. templateUrl: 'tpl/table_static.html'
  155. })
  156. .state('app.table.datatable', {
  157. url: '/datatable',
  158. templateUrl: 'tpl/table_datatable.html'
  159. })
  160. .state('app.table.footable', {
  161. url: '/footable',
  162. templateUrl: 'tpl/table_footable.html'
  163. })
  164. .state('app.table.grid', {
  165. url: '/grid',
  166. templateUrl: 'tpl/table_grid.html',
  167. resolve: {
  168. deps: ['$ocLazyLoad',
  169. function( $ocLazyLoad ){
  170. return $ocLazyLoad.load('ngGrid').then(
  171. function(){
  172. return $ocLazyLoad.load('js/controllers/grid.js');
  173. }
  174. );
  175. }]
  176. }
  177. })
  178. // form
  179. .state('app.form', {
  180. url: '/form',
  181. template: '<div ui-view class="fade-in"></div>',
  182. resolve: {
  183. deps: ['uiLoad',
  184. function( uiLoad){
  185. return uiLoad.load('js/controllers/form.js');
  186. }]
  187. }
  188. })
  189. .state('app.form.elements', {
  190. url: '/elements',
  191. templateUrl: 'tpl/form_elements.html'
  192. })
  193. .state('app.form.validation', {
  194. url: '/validation',
  195. templateUrl: 'tpl/form_validation.html'
  196. })
  197. .state('app.form.wizard', {
  198. url: '/wizard',
  199. templateUrl: 'tpl/form_wizard.html'
  200. })
  201. .state('app.form.fileupload', {
  202. url: '/fileupload',
  203. templateUrl: 'tpl/form_fileupload.html',
  204. resolve: {
  205. deps: ['$ocLazyLoad',
  206. function( $ocLazyLoad){
  207. return $ocLazyLoad.load('angularFileUpload').then(
  208. function(){
  209. return $ocLazyLoad.load('js/controllers/file-upload.js');
  210. }
  211. );
  212. }]
  213. }
  214. })
  215. .state('app.form.imagecrop', {
  216. url: '/imagecrop',
  217. templateUrl: 'tpl/form_imagecrop.html',
  218. resolve: {
  219. deps: ['$ocLazyLoad',
  220. function( $ocLazyLoad){
  221. return $ocLazyLoad.load('ngImgCrop').then(
  222. function(){
  223. return $ocLazyLoad.load('js/controllers/imgcrop.js');
  224. }
  225. );
  226. }]
  227. }
  228. })
  229. .state('app.form.select', {
  230. url: '/select',
  231. templateUrl: 'tpl/form_select.html',
  232. controller: 'SelectCtrl',
  233. resolve: {
  234. deps: ['$ocLazyLoad',
  235. function( $ocLazyLoad ){
  236. return $ocLazyLoad.load('ui.select').then(
  237. function(){
  238. return $ocLazyLoad.load('js/controllers/select.js');
  239. }
  240. );
  241. }]
  242. }
  243. })
  244. .state('app.form.slider', {
  245. url: '/slider',
  246. templateUrl: 'tpl/form_slider.html',
  247. controller: 'SliderCtrl',
  248. resolve: {
  249. deps: ['$ocLazyLoad',
  250. function( $ocLazyLoad ){
  251. return $ocLazyLoad.load('vr.directives.slider').then(
  252. function(){
  253. return $ocLazyLoad.load('js/controllers/slider.js');
  254. }
  255. );
  256. }]
  257. }
  258. })
  259. .state('app.form.editor', {
  260. url: '/editor',
  261. templateUrl: 'tpl/form_editor.html',
  262. controller: 'EditorCtrl',
  263. resolve: {
  264. deps: ['$ocLazyLoad',
  265. function( $ocLazyLoad ){
  266. return $ocLazyLoad.load('textAngular').then(
  267. function(){
  268. return $ocLazyLoad.load('js/controllers/editor.js');
  269. }
  270. );
  271. }]
  272. }
  273. })
  274. // pages
  275. .state('app.page', {
  276. url: '/page',
  277. template: '<div ui-view class="fade-in-down"></div>'
  278. })
  279. .state('app.page.profile', {
  280. url: '/profile',
  281. templateUrl: 'tpl/page_profile.html'
  282. })
  283. .state('app.page.post', {
  284. url: '/post',
  285. templateUrl: 'tpl/page_post.html'
  286. })
  287. .state('app.page.search', {
  288. url: '/search',
  289. templateUrl: 'tpl/page_search.html'
  290. })
  291. .state('app.page.invoice', {
  292. url: '/invoice',
  293. templateUrl: 'tpl/page_invoice.html'
  294. })
  295. .state('app.page.price', {
  296. url: '/price',
  297. templateUrl: 'tpl/page_price.html'
  298. })
  299. .state('app.docs', {
  300. url: '/docs',
  301. templateUrl: 'tpl/docs.html'
  302. })
  303. // others
  304. .state('lockme', {
  305. url: '/lockme',
  306. templateUrl: 'tpl/page_lockme.html'
  307. })
  308. .state('access', {
  309. url: '/access',
  310. template: '<div ui-view class="fade-in-right-big smooth"></div>'
  311. })
  312. .state('access.signin', {
  313. url: '/signin',
  314. templateUrl: 'tpl/page_signin.html',
  315. resolve: {
  316. deps: ['uiLoad',
  317. function( uiLoad ){
  318. return uiLoad.load( ['js/controllers/signin.js'] );
  319. }]
  320. }
  321. })
  322. .state('access.signup', {
  323. url: '/signup',
  324. templateUrl: 'tpl/page_signup.html',
  325. resolve: {
  326. deps: ['uiLoad',
  327. function( uiLoad ){
  328. return uiLoad.load( ['js/controllers/signup.js'] );
  329. }]
  330. }
  331. })
  332. .state('access.forgotpwd', {
  333. url: '/forgotpwd',
  334. templateUrl: 'tpl/page_forgotpwd.html'
  335. })
  336. .state('access.404', {
  337. url: '/404',
  338. templateUrl: 'tpl/page_404.html'
  339. })
  340. // fullCalendar
  341. .state('app.calendar', {
  342. url: '/calendar',
  343. templateUrl: 'tpl/app_calendar.html',
  344. // use resolve to load other dependences
  345. resolve: {
  346. deps: ['$ocLazyLoad', 'uiLoad',
  347. function( $ocLazyLoad, uiLoad ){
  348. return uiLoad.load(
  349. ['vendor/jquery/fullcalendar/fullcalendar.css',
  350. 'vendor/jquery/fullcalendar/theme.css',
  351. 'vendor/jquery/jquery-ui-1.10.3.custom.min.js',
  352. 'vendor/libs/moment.min.js',
  353. 'vendor/jquery/fullcalendar/fullcalendar.min.js',
  354. 'js/app/calendar/calendar.js']
  355. ).then(
  356. function(){
  357. return $ocLazyLoad.load('ui.calendar');
  358. }
  359. )
  360. }]
  361. }
  362. })
  363. // mail
  364. .state('app.mail', {
  365. abstract: true,
  366. url: '/mail',
  367. templateUrl: 'tpl/mail.html',
  368. // use resolve to load other dependences
  369. resolve: {
  370. deps: ['uiLoad',
  371. function( uiLoad ){
  372. return uiLoad.load( ['js/app/mail/mail.js',
  373. 'js/app/mail/mail-service.js',
  374. 'vendor/libs/moment.min.js'] );
  375. }]
  376. }
  377. })
  378. .state('app.mail.list', {
  379. url: '/inbox/{fold}',
  380. templateUrl: 'tpl/mail.list.html'
  381. })
  382. .state('app.mail.detail', {
  383. url: '/{mailId:[0-9]{1,4}}',
  384. templateUrl: 'tpl/mail.detail.html'
  385. })
  386. .state('app.mail.compose', {
  387. url: '/compose',
  388. templateUrl: 'tpl/mail.new.html'
  389. })
  390. .state('layout', {
  391. abstract: true,
  392. url: '/layout',
  393. templateUrl: 'tpl/layout.html'
  394. })
  395. .state('layout.fullwidth', {
  396. url: '/fullwidth',
  397. views: {
  398. '': {
  399. templateUrl: 'tpl/layout_fullwidth.html'
  400. },
  401. 'footer': {
  402. templateUrl: 'tpl/layout_footer_fullwidth.html'
  403. }
  404. },
  405. resolve: {
  406. deps: ['uiLoad',
  407. function( uiLoad ){
  408. return uiLoad.load( ['js/controllers/vectormap.js'] );
  409. }]
  410. }
  411. })
  412. .state('layout.mobile', {
  413. url: '/mobile',
  414. views: {
  415. '': {
  416. templateUrl: 'tpl/layout_mobile.html'
  417. },
  418. 'footer': {
  419. templateUrl: 'tpl/layout_footer_mobile.html'
  420. }
  421. }
  422. })
  423. .state('layout.app', {
  424. url: '/app',
  425. views: {
  426. '': {
  427. templateUrl: 'tpl/layout_app.html'
  428. },
  429. 'footer': {
  430. templateUrl: 'tpl/layout_footer_fullwidth.html'
  431. }
  432. },
  433. resolve: {
  434. deps: ['uiLoad',
  435. function( uiLoad ){
  436. return uiLoad.load( ['js/controllers/tab.js'] );
  437. }]
  438. }
  439. })
  440. .state('apps', {
  441. abstract: true,
  442. url: '/apps',
  443. templateUrl: 'tpl/layout.html'
  444. })
  445. .state('apps.note', {
  446. url: '/note',
  447. templateUrl: 'tpl/apps_note.html',
  448. resolve: {
  449. deps: ['uiLoad',
  450. function( uiLoad ){
  451. return uiLoad.load( ['js/app/note/note.js',
  452. 'vendor/libs/moment.min.js'] );
  453. }]
  454. }
  455. })
  456. .state('apps.contact', {
  457. url: '/contact',
  458. templateUrl: 'tpl/apps_contact.html',
  459. resolve: {
  460. deps: ['uiLoad',
  461. function( uiLoad ){
  462. return uiLoad.load( ['js/app/contact/contact.js'] );
  463. }]
  464. }
  465. })
  466. .state('app.weather', {
  467. url: '/weather',
  468. templateUrl: 'tpl/apps_weather.html',
  469. resolve: {
  470. deps: ['$ocLazyLoad',
  471. function( $ocLazyLoad ){
  472. return $ocLazyLoad.load(
  473. {
  474. name: 'angular-skycons',
  475. files: ['js/app/weather/skycons.js',
  476. 'vendor/libs/moment.min.js',
  477. 'js/app/weather/angular-skycons.js',
  478. 'js/app/weather/ctrl.js' ]
  479. }
  480. );
  481. }]
  482. }
  483. })
  484. .state('music', {
  485. url: '/music',
  486. templateUrl: 'tpl/music.html',
  487. controller: 'MusicCtrl',
  488. resolve: {
  489. deps: ['$ocLazyLoad',
  490. function( $ocLazyLoad ){
  491. return $ocLazyLoad.load([
  492. 'com.2fdevs.videogular',
  493. 'com.2fdevs.videogular.plugins.controls',
  494. 'com.2fdevs.videogular.plugins.overlayplay',
  495. 'com.2fdevs.videogular.plugins.poster',
  496. 'com.2fdevs.videogular.plugins.buffering',
  497. 'js/app/music/ctrl.js',
  498. 'js/app/music/theme.css'
  499. ]);
  500. }]
  501. }
  502. })
  503. .state('music.home', {
  504. url: '/home',
  505. templateUrl: 'tpl/music.home.html'
  506. })
  507. .state('music.genres', {
  508. url: '/genres',
  509. templateUrl: 'tpl/music.genres.html'
  510. })
  511. .state('music.detail', {
  512. url: '/detail',
  513. templateUrl: 'tpl/music.detail.html'
  514. })
  515. .state('music.mtv', {
  516. url: '/mtv',
  517. templateUrl: 'tpl/music.mtv.html'
  518. })
  519. .state('music.mtvdetail', {
  520. url: '/mtvdetail',
  521. templateUrl: 'tpl/music.mtv.detail.html'
  522. })
  523. .state('music.playlist', {
  524. url: '/playlist/{fold}',
  525. templateUrl: 'tpl/music.playlist.html'
  526. })
  527. }
  528. ]
  529. );