- Posts: 4
COMMUNITY FORUM
Frontend Editing - Hide Categories which are disabled
- Don De Longe
-
Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- scyllar
-
- Offline
- Senior Member
- Posts: 60
Please Log in or Create an account to join the conversation.
- Markus Thiel
-
- Offline
- Premium Member
- Posts: 149
Please Log in or Create an account to join the conversation.
- Markus Thiel
-
- Offline
- Premium Member
- Posts: 149
But like to hide the parent of the parentcategory hehe :D
Please Log in or Create an account to join the conversation.
- Marios Katsis
-
- Offline
- New Member
- Posts: 9
You must go at http://yoursite/components/com_k2/views/item/tmpl/form.php and add this
var disabledOptions=$$('#catid option[disabled]');
$each(disabledOptions, function(option){
option.setStyle('visibility', 'hidden');
option.setStyle('font-size', '0px');
});
before (or after, it does not matter) the code
if(window.ie){
var disabledOptions=$$('#catid option[disabled]');
$each(disabledOptions, function(option){
option.setStyle('height', '0px');
});
}
I am looking to give a solution for IE, Opera, Chrome
Please Log in or Create an account to join the conversation.
- Marios Katsis
-
- Offline
- New Member
- Posts: 9
var disabledOptions=$$('#catid option[disabled]');
option.remove(option.selectedIndex);
});
This works for all browsers
Please Log in or Create an account to join the conversation.
- Jakub Jedynak
-
- Offline
- Senior Member
- Posts: 56
Code for Firefox only works (in Firefox only).
How can I change forms.php to show only cuurent category (for both Add and Edit links).
I've changeed the code in forms.php (using changed k2 function getCategoryPath) which works in Edit mode, but in Add mode there is no category assigned so I get an error:
FROM
echo $this->lists;
TO
function getCategoryName($catid) {
static $array = array();
$db = &JFactory::getDBO();
$query = "SELECT * FROM #__k2_categories WHERE id={$catid}";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
array_push($array, $row->name);
}
return array_reverse($array);
}
$categories = getCategoryName($this->row->catid);
foreach($categories as $catName) {
echo $catName;
}
Marios Katsis said:The solution is to add the following code to the page http://yoursite/components/com_k2/views/item/tmpl/form.php
var disabledOptions=$$('#catid option[disabled]');
option.remove(option.selectedIndex);
});
This works for all browsers
Please Log in or Create an account to join the conversation.
- Jiliko.net
-
- Offline
- Platinum Member
- Posts: 567
You can also try that solution :
community.getk2.org/forum/topics/remove-not-assigned-categories-1?commentId=3536014:Comment:85244
Olivier
Please Log in or Create an account to join the conversation.
- Jakub Jedynak
-
- Offline
- Senior Member
- Posts: 56
But IMO Add/Edit in front end windows should work in a different way.
When you are in category and click New Article button, category should be already assigned (without dropdown at all).
In the same way it should work in Edit Mode.
Anyone have an idea how can I do that? No droppdown - just assigned current category?
Olivier Nolbert said:Hi,
You can also try that solution :
community.getk2.org/forum/topics/remove-not-assigned-categor...
Olivier
Please Log in or Create an account to join the conversation.
- Chris Dewook
-
- Offline
- New Member
- Posts: 5
Please Log in or Create an account to join the conversation.
- N
-
- Offline
- New Member
- Posts: 5
Jakub Jedynak wrote:
When you are in category and click New Article button, category should be already assigned (without dropdown at all).
In the same way it should work in Edit Mode.
Anyone have an idea how can I do that? No droppdown - just assigned current category?
I also would like this functionality. Can anyone explain how to automatically assign the category when adding an item in the frontend? Please, this is very basic.
Please Log in or Create an account to join the conversation.
- Pashted
-
- Offline
- New Member
- Posts: 3
getk2.org/community/New-to-K2-Ask-here-first/6473-Re-customize-my-front-end-editor#179052N wrote:
Jakub Jedynak wrote:
When you are in category and click New Article button, category should be already assigned (without dropdown at all).
In the same way it should work in Edit Mode.
Anyone have an idea how can I do that? No droppdown - just assigned current category?
I also would like this functionality. Can anyone explain how to automatically assign the category when adding an item in the frontend? Please, this is very basic.
Please Log in or Create an account to join the conversation.
- Manos Krokos
-
- Offline
- Junior Member
- Posts: 39
Oliver's link is dead, unfortunately.
I would also like to skip the ability to upload attachments.
Please Log in or Create an account to join the conversation.
- Franz Wohlkönig
-
- Offline
- Platinum Member
- Posts: 529
you mean this?:
Edit the file: [publichtml]/media/k2/assets/css/k2.css
And add to the bottom of that file (just before /* End */):
/* List option styling => hide disabled category options */
option[disabled='disabled'] { display: none; }
works in ff e.a., not ie8
Regards
Please Log in or Create an account to join the conversation.
- Manos Krokos
-
- Offline
- Junior Member
- Posts: 39
Please Log in or Create an account to join the conversation.
- Franz Wohlkönig
-
- Offline
- Platinum Member
- Posts: 529
sorry, no experience on php. i'm working with firefox on mac (solution works on windows and linux too) and all authors too - so i don't know tricks for safari, ie or other browsers. isnt it possible to change the browser for you and your authors?
Regards
Please Log in or Create an account to join the conversation.
- Manos Krokos
-
- Offline
- Junior Member
- Posts: 39
Please Log in or Create an account to join the conversation.
- behzad
-
- Offline
- Junior Member
- Posts: 21
how can I separate categories options from subcategories? I want two category selections , one for category and another for subcategories of that category , how?
Please Log in or Create an account to join the conversation.