Hello,
I'm searchin for solution, how can I hide Activity tab panel in issue view.
In details I don't want to show Activity tab panel for user that aren't members of
specified group (e.g. 'my-users')
I've tested solution with file activitystream.vm, but it only works from project view.
code from "jira\atlassian-jira\WEB-INF\classes\templates\plugins\jira\projectpanels\fragments\summary\activitystream.vm"
#disable_html_escaping()
#if($jiraUserUtils.getGroupNamesForUser($authcontext.getLoggedInUser().getName()).contains("my-users"))
#if($!gadgetHtml)
<div class="mod-header">
<h3>$i18n.getText('common.concepts.activity.stream')</h3>
</div>
<div class="mod-content">
<div class="activitystream-container">
$gadgetHtml
</div>
</div>
#end
#end
When I go to issue view, then Activity is still shown.
Regards
Robert M.
it should work now, try with this
<script type="text/javascript"> JIRA.ViewIssueTabs.onTabReady(function() { hideTab(); }) function hideTab(){ var user=getCurrentUserName(); var groupName='my-users'; if(!isUserInGroup(user,groupName)){ //to hide the Activity Tab AJS.$('#activity-stream-issue-tab').hide(); }else{ AJS.$('#activity-stream-issue-tab').show(); } } function getCurrentUserName() { var user; AJS.$.ajax({ url: "/rest/gadget/1.0/currentUser", type: 'get', dataType: 'json', async: false, success: function(data) { user = data.username; } }); return user; } function getGroups(user) { var groups; AJS.$.ajax({ url: "/rest/api/2/user?username="+user+"&expand=groups", type: 'get', dataType: 'json', async: false, success: function(data) { groups = data.groups.items; } }); return groups; } function isUserInGroup(user, group){ var groups = getGroups(user); for (i = 0; i < groups.length; i++){ if (groups[i].name == group){ return true; } } return false; } </script>
i have tested this and it is working fine on my machine!!
Hi,
I am having requirement of hiding the History Tab under Activity Panel for specific project and users/groups. I am using JIRA 7.3.9. Any one please suggest.
Regards,
Dileep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there specific page where i can apply Css or java scrip to hide the "Activity" tab as i already hide the 1. All 2. Work log 3. History
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
So as per above comments, Only problem is that this Activity tab is still shown when I click one of shown tabs (All\Comment\Work log) so any idea how to hide remaining tan on click event as well ?
Thanks,
Hardik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
glad to hear it worked!!
Cheers!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Rambanam Prasad could you please share / inform how guys solve the issue mentioned above? I'm having the same problem. It means, after click in a tab, my desired previous hided tab show up again :-/ I coded exactly what you mentioned in your last posted code (above), but with no success regarding to tab click. In my particular case, I'd like to hide tabs: *worklog and history*. Could you help me please? Thanks in advance. Michel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michel @Michel Barros , I am facing a similar problem, Can you please let me know if you were able to resolve it ? Thanks, Ranjith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ranjith Rajan, Unfortunately, not. We still facing the same problem. If you have any ideas, please share with me. Thanks! Michel Barros
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michel, @Michel Barros Yes i figured out. Place the below code in the any of the plugin.xml available. In my case i pasted under atlassian-plugins-websource-plugin-mock.xml. Assuming that you already have a javascript to hide the tabs. Place the javascript in the location mention in the web-resource below. Let me know if you need any help with the javascript. Regards, Ranjith web-resource key="test-js" name="javascript"> <dependency>jira.webresources:global-static</dependency> <description>JavaScript</description> <resource name="hidefields.js" location="includes/js/hidefields.js" type="download"/> <context>atl.general</context> <context>atl.admin</context> </web-resource>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ranjith.rajan, Thanks for sharing it. I will try it, as soon as I reconfigure my own environment around here. Best Regards! Michel Barros
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i've created script test.jsp and saved it under "includes\decorators\aui-layout" directory (thesame with footer.jsp)
In footer.jsp I have added this java script:
<%@ page import="com.atlassian.jira.plugin.navigation.HeaderFooterRendering" %>
<%@ page import="static com.atlassian.jira.component.ComponentAccessor.*" %>
<%
//
// IDEA gives you a warning below because it cant resolve JspWriter. I don't know why but its harmless
//
getComponent(HeaderFooterRendering.class).includeFooters(out, request);
%>
<jsp:include page="/includes/decorators/global-translations.jsp" />
<jsp:include page="/includes/decorators/aui-layout/test.jsp" />
functionality works for members and non-members of specified group.
Olny problem is that this Activity tab is still shown when I click one of shown tabs (All\Comment\Work log)
Robert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you share source of the view screen of your issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
as of now where you added this script and testing? and check the id's as per your instance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
finally try with this
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { callHideFunction(); }); callHideFunction(); function callHideFunction(){ hideTab(); ('#all-tabpanel, #comment-tabpanel, #worklog-tabpanel, #changehistory-tabpanel').click(function(){ hideTab(); }); } function hideTab(){ var user=getCurrentUserName(); var groupName='my-users'; if(!isUserInGroup(user,groupName)){ //to hide the Activity Tab AJS.$('#activity-stream-issue-tab').hide(); }else{ AJS.$('#activity-stream-issue-tab').show(); } } function getCurrentUserName() { var user; AJS.$.ajax({ url: "/rest/gadget/1.0/currentUser", type: 'get', dataType: 'json', async: false, success: function(data) { user = data.username; } }); return user; } function getGroups(user) { var groups; AJS.$.ajax({ url: "/rest/api/2/user?username="+user+"&expand=groups", type: 'get', dataType: 'json', async: false, success: function(data) { groups = data.groups.items; } }); return groups; } function isUserInGroup(user, group){ var groups = getGroups(user); for (i = 0; i < groups.length; i++){ if (groups[i].name == group){ return true; } } return false; } }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rambanam. I'm looking how to disable certain tabs and panels for JIRA issues. You're using #all-tabpanel, #comment-tabpanel, #worklog-tabpanel and #changehistory-tabpanel in you're script, but where can these be found? Is there a list published somewhere? I'm not using Javascript currently, but only CSS. However, the tags in your script match to the CSS containers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there specific page where i can apply Css or java scrip to hide the "Activity" tab as i already hide the 1. All 2. Work log 3. History
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try with this
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { callHideFunction(); }); callHideFunction(); function callHideFunction(){ var user=getCurrentUserName(); var groupName='my-users'; if(!isUserInGroup(user,groupName)){ //to hide the Activity Tab AJS.$('#activity-stream-issue-tab').hide(); }else{ AJS.$('#activity-stream-issue-tab').show(); } function getCurrentUserName() { var user; AJS.$.ajax({ url: "/rest/gadget/1.0/currentUser", type: 'get', dataType: 'json', async: false, success: function(data) { user = data.username; } }); return user; } function getGroups(user) { var groups; AJS.$.ajax({ url: "/rest/api/2/user?username="+user+"&expand=groups", type: 'get', dataType: 'json', async: false, success: function(data) { groups = data.groups.items; } }); return groups; } function isUserInGroup(user, group){ var groups = getGroups(user); for (i = 0; i < groups.length; i++){ if (groups[i].name == group){ return true; } } return false; } } }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm beggining with JIRA. Can You describe it in more details:
Where should I code this line?
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED,
function
(e, context, reason)
In this function jQuery(document).ready(
function
(), like in example above?
Or in other file?
Robert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bind your jQuery to JIRA Event, cause after partial-reload (p.e. AJAX) all bindings are gone.
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) { //Your Code here! });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you it works indeed !!!
AJS.$.ajax({
url:
"/rest/gadget/1.0/currentUser"
,
type:
'get'
,
dataType:
'json'
,
async:
false
,
success:
function
(data) {
user = data.username;
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can hide the tab panels using javascript, try with the following code <script type="text/javascript"> jQuery(document).ready(function() { var user=getCurrentUserName(); var groupName='my-users'; if(!isUserInGroup(user,groupName)){ //to hide the Activity Tab AJS.$('#activity-stream-issue-tab').hide(); }else{ AJS.$('#activity-stream-issue-tab').show(); } function getCurrentUserName() { var user; AJS.$.ajax({ url: "/rest/gadget/1.0/currentUser", type: 'get', dataType: 'json', async: false, success: function(data) { user = data.username; } }); return user; } function getGroups(user) { var groups; AJS.$.ajax({ url: "/rest/api/2/user?username="+user+"&expand=groups", type: 'get', dataType: 'json', async: false, success: function(data) { groups = data.groups.items; } }); return groups; } function isUserInGroup(user, group){ var groups = getGroups(user); for (i = 0; i < groups.length; i++){ if (groups[i].name == group){ return true; } } return false; } }); </script> add the above script in footer.jsp
i copied and modified script from http://www.j-tricks.com/1/post/2012/02/some-ajs-tricks.html
Note: pls check the REST API URL's as per the Jira 6
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i think you have to use the following code to get current user in jira 6
AJS.$.get("/jira/rest/auth/1/session", function (data) { var userName = data.name; });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.