Author Topic: Help to fire JS event to hide tab on workspaces!  (Read 3990 times)

edoher

  • Newbie
  • *
  • Posts: 8
    • View Profile
Help to fire JS event to hide tab on workspaces!
« on: June 16, 2010, 05:20:43 PM »
Hi:

As for version 1.6.2, and even for 1.7 as I can see, you don't have the option to disable modules in a workspace basis, but for the entire site. I want to fix this adding a JS event when you call the ajax to load a workspace (http://XXXXXXXXXXX.com/index.php?active_project=7&ajax=true&c=dashboard&a=index&current=overview-panel&_dc=1276719279711).

Right now, this ajax is only returning an empty event element and some html. What I know I have to do is call a JS
Code: [Select]
if(project_id == 7) Ext.get('tabs-panel__mails-panel').setDisplayed(false);, for example, if I want to hide that tab when the project id is 7, or whatever number. For that, I need an event listener for that ajax, and the "project_id" variable. How can I get those? I have been trying to read your code but is really really chalenging.

Thanks in advance

edoher

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Help to fire JS event to hide tab on workspaces!
« Reply #1 on: June 16, 2010, 07:15:51 PM »
OK, I've been reading the Hooks tutorial, but I can't seem to make it work for what I want. I need to trigger a JS event whenever I open a workspace. What hook should I use? after_action ? render_object_properties? render_page_actions?

How can I just echo some code using one of this hooks? I tried override_action_view, but it just doesn't work. HELP PLEASE!

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Help to fire JS event to hide tab on workspaces!
« Reply #2 on: June 22, 2010, 10:56:14 AM »
I think you are looking to add a listener to an UI event, not a hook.


Code: [Select]

og.eventManager.addListener('workspace added',
function  (param){
//code
 } );


edoher

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Help to fire JS event to hide tab on workspaces!
« Reply #3 on: June 23, 2010, 04:17:25 PM »
Yeah, but I needed (past tense, because I had to modify layout.js to do it) a listener for the event, if it exists, "workspace change". Does it exist? Does it have the new workspace 'id' parameter?

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Help to fire JS event to hide tab on workspaces!
« Reply #4 on: June 24, 2010, 02:01:48 PM »
It's "workspace edited" defined in public/assets/javascript/og/WorkspacePanel.js that fires updateWS also defined there.

Recursive searching throughout the project is very helpful  :)

 

anything
anything