Mepps has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/394664 )
Change subject: WIP Urls direct to boards
......................................................................
WIP Urls direct to boards
Bug: T120000
Change-Id: Ifb4b580e54f501efc51ad4e98d17a4d3295d43b4
---
M src/components/app-content/app-content.js
1 file changed, 16 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/dash
refs/changes/64/394664/1
diff --git a/src/components/app-content/app-content.js
b/src/components/app-content/app-content.js
index c7471e6..e8f056e 100644
--- a/src/components/app-content/app-content.js
+++ b/src/components/app-content/app-content.js
@@ -5,7 +5,14 @@
], function ( $, ko, templateMarkup ) {
function AppContent() {
- var self = this;
+ var self = this, displayBoard, pages = [ 'Library', 'Profile',
'Home' ];
+
+ displayBoard = function( view ) {
+ $.get( 'board/' + view, function ( bdata ) {
+ self.displayPage( 'Home' );
+ self.displayedBoard( bdata );
+ } );
+ }
self.displayedBoard = ko.observable();
self.userBoards = ko.observableArray();
@@ -30,16 +37,18 @@
self.userdata( userInfo );
self.welcome( userInfo.name.charAt( 0
).toUpperCase() + userInfo.name.slice( 1 ) );
self.loggedIn( true );
-
- $.get( 'board/' + self.userdata().defaultBoard,
function ( moredata ) {
- self.displayedBoard( moredata );
- } );
+ if ( location.hash ) {
+ displayBoard(
location.hash.substring(1) );
+ } else {
+
displayBoard(self.userdata().defaultBoard);
+ }
$.get( 'board/', function ( boards ) {
self.userBoards( boards );
} );
}
} );
+
self.addWidgetToBoard = function ( event, data ) {
$.ajax( {
@@ -86,18 +95,14 @@
};
self.setDisplayPage = function ( e, data ) {
- var pages = [ 'Library', 'Profile', 'Home' ],
- view = data.target.id;
+ var view = data.target.id;
if ( pages.indexOf( data.target.id ) > -1 ) {
self.displayPage( view );
} else if ( isNaN( parseInt( view, 10 ) ) ) {
self.displayPage( $.trim( $( data.target
).text() ) );
} else {
- $.get( 'board/' + view, function ( bdata ) {
- self.displayPage( 'Home' );
- self.displayedBoard( bdata );
- } );
+ displayBoard( view );
}
};
--
To view, visit https://gerrit.wikimedia.org/r/394664
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb4b580e54f501efc51ad4e98d17a4d3295d43b4
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/dash
Gerrit-Branch: master
Gerrit-Owner: Mepps <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits