Skip to content

Commit 2d3f805

Browse files
committed
Merge pull request #443 from crazyserver/MOBILE-1461
Mobile 1461
2 parents 23ef7f4 + 4dd6546 commit 2d3f805

File tree

13 files changed

+1351
-2
lines changed

13 files changed

+1351
-2
lines changed

www/addons/mod_wiki/controllers/index.js

Lines changed: 479 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// (C) Copyright 2015 Martin Dougiamas
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
angular.module('mm.addons.mod_wiki')
16+
17+
/**
18+
* Wiki map controller.
19+
*
20+
* @module mm.addons.mod_wiki
21+
* @ngdoc controller
22+
* @name mmaModWikiMapCtrl
23+
*/
24+
.controller('mmaModWikiMapCtrl', function($scope, mmaModWikiSubwikiPagesLoaded) {
25+
$scope.map = [];
26+
27+
$scope.constructMap = function(subwikiPages) {
28+
var initialLetter = false,
29+
letter = {};
30+
31+
$scope.map = [];
32+
33+
angular.forEach(subwikiPages, function(page) {
34+
// Should we create a new grouping?
35+
if (page.title.charAt(0).toLocaleUpperCase() !== initialLetter) {
36+
initialLetter = page.title.charAt(0).toLocaleUpperCase();
37+
letter = {label: initialLetter, pages: []};
38+
39+
$scope.map.push(letter);
40+
}
41+
42+
// Add the subwiki to the currently active grouping.
43+
letter.pages.push(page);
44+
});
45+
};
46+
47+
var obsLoaded = $scope.$on(mmaModWikiSubwikiPagesLoaded, function(event, subwikiPages) {
48+
$scope.constructMap(subwikiPages);
49+
});
50+
51+
$scope.constructMap($scope.subwikiPages);
52+
53+
$scope.$on('$destroy', obsLoaded);
54+
});

www/addons/mod_wiki/lang/en.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"errorloadingpage": "An error occured while loading page.",
3+
"errornowikiavailable": "There's no wiki available to be shown.",
4+
"gowikihome": "Go Wiki home",
5+
"map": "Map",
6+
"notingroup": "Not in group",
7+
"subwiki": "Subwiki",
8+
"viewpage": "View page"
9+
}

www/addons/mod_wiki/main.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// (C) Copyright 2015 Martin Dougiamas
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
angular.module('mm.addons.mod_wiki', [])
16+
17+
.constant('mmaModWikiSubwikiPagesLoaded', 'mma_mod_wiki_subwiki_pages_loaded')
18+
19+
.config(function($stateProvider) {
20+
21+
$stateProvider
22+
23+
.state('site.mod_wiki', {
24+
url: '/mod_wiki',
25+
params: {
26+
module: null,
27+
moduleid: null, // Redundant parameter to fix a problem passing object as parameters. To be fixed in MOBILE-1370.
28+
courseid: null,
29+
pageid: null,
30+
pagetitle: null,
31+
wikiid: null,
32+
subwikiid: null,
33+
action: null
34+
},
35+
views: {
36+
'site': {
37+
controller: 'mmaModWikiIndexCtrl',
38+
templateUrl: 'addons/mod_wiki/templates/index.html'
39+
}
40+
}
41+
});
42+
43+
})
44+
45+
.config(function($mmCourseDelegateProvider, $mmContentLinksDelegateProvider) {
46+
$mmCourseDelegateProvider.registerContentHandler('mmaModWiki', 'wiki', '$mmaModWikiHandlers.courseContent');
47+
$mmContentLinksDelegateProvider.registerLinkHandler('mmaModWiki', '$mmaModWikiHandlers.linksHandler');
48+
})
49+
50+
.run(function($mmEvents, mmCoreEventLogout, $mmaModWiki) {
51+
// Clear cache for SubwikiLists
52+
$mmEvents.on(mmCoreEventLogout, $mmaModWiki.clearSubwikiList);
53+
});
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
$mma-mod-wiki-toc-level-padding: 12px !default;
2+
$mma-mod-wiki-newentry-link-color: red !default;
3+
$mma-mod-wiki-toc-title-color: #666 !default;
4+
$mma-mod-wiki-toc-border-color: #bbb !default;
5+
$mma-mod-wiki-toc-background-color: #eee !default;
6+
$mma-mod-wiki-subwiki-selected-background-color: #f7f7f7 !default;
7+
8+
.wiki-toc {
9+
border: 1px solid $mma-mod-wiki-toc-border-color;
10+
background: $mma-mod-wiki-toc-background-color;
11+
margin: 16px;
12+
padding: 8px;
13+
}
14+
15+
.wiki-toc-title {
16+
color: $mma-mod-wiki-toc-title-color;
17+
font-size: 1.1em;
18+
font-variant: small-caps;
19+
text-align: center;
20+
}
21+
22+
.wiki-toc-section {
23+
padding: 0;
24+
margin: 2px 8px;
25+
}
26+
27+
.wiki-toc-section-2 {
28+
padding-left: $mma-mod-wiki-toc-level-padding;
29+
}
30+
31+
.wiki-toc-section-3 {
32+
padding-left: $mma-mod-wiki-toc-level-padding * 2;
33+
}
34+
35+
.mm-site_mod_wiki .wiki_newentry {
36+
color: $mma-mod-wiki-newentry-link-color;
37+
font-style: italic;
38+
}
39+
40+
/* Hide edit section links */
41+
a.wiki_edit_section {
42+
display: none;
43+
}
44+
45+
.mma-mod_wiki-subwiki-picker .item-divider {
46+
font-weight: bold;
47+
}
48+
49+
.mma-mod_wiki-subwiki-picker .item.item-selected {
50+
background-color: $mma-mod-wiki-subwiki-selected-background-color;
51+
}
52+
53+
.mma-mod_wiki-subwiki-picker .item.item-selected .icon {
54+
font-size: 24px;
55+
}

0 commit comments

Comments
 (0)