Skip to content

Commit

Permalink
SAK-43404 - SWITCH: Commons tool : Fix bad pattern in the first selec…
Browse files Browse the repository at this point in the history
…ted tab (sakaiproject#8009)
  • Loading branch information
Miguel Pellicer authored Mar 11, 2020
1 parent e4cc0f4 commit ecd32f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion commons/api/src/bundle/commons.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ modified = Modified:
no_content_warning = You have not entered any content to save
none = -
save = Save
permissions = Permissions
permissions_tooltip = Setup the permissions for each role in this site
permissions_role_label = Role
role = Role
Expand Down Expand Up @@ -62,3 +61,7 @@ Example URL: /direct/commons/posts/SITEID.json

commons.action.rss = (GET) Retrieves the RSS feed for an entire site. <br /> \
Example URL: /direct/commons/rss/SITEID.json

# Menu
menu_main = Posts
permissions = Permissions
1 change: 1 addition & 0 deletions commons/tool/src/webapp/WEB-INF/templates/toolbar.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<li id="commons-main-link" role="menuitem"><span class="current"><a href="javascript:;">{{tr 'menu_main'}}</a></span></li>
<li id="commons-permissions-link" role="menuitem"><span><a href="javascript:;">{{tr 'permissions'}}</a></span></li>
8 changes: 8 additions & 0 deletions commons/tool/src/webapp/js/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ commons.switchState = function (state, arg) {
$("#commons-post-editor").toggle(commons.currentUserPermissions.postCreate);

if (commons.states.POSTS === state) {
$('#commons-toolbar > li > span').removeClass('current');
$('#commons-main-link > span').addClass('current');

var templateData = {
currentUserId: commons.userId,
Expand Down Expand Up @@ -272,6 +274,8 @@ commons.switchState = function (state, arg) {
}
});
} else if (commons.states.POST === state) {
$('#commons-toolbar > li > span').removeClass('current');
$('#commons-main-link > span').addClass('current');
var url = "/direct/commons/post.json?postId=" + arg.postId;
$.ajax( { url : url, dataType: "json", cache: false, timeout: commons.AJAX_TIMEOUT })
.done(function (data) {
Expand Down Expand Up @@ -309,6 +313,10 @@ commons.switchState = function (state, arg) {
if (commons.embedder === 'SITE') {
commons.utils.renderTemplate('toolbar', {} ,'commons-toolbar');

$('#commons-main-link>span>a').click(function (e) {
commons.switchState(commons.states.POSTS);
});

$('#commons-permissions-link>span>a').click(function (e) {
commons.switchState(commons.states.PERMISSIONS);
});
Expand Down

0 comments on commit ecd32f1

Please sign in to comment.