Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: devel

story profile Add Category button lists all cats?

 

 

Bricolage devel RSS feed   Index | Next | Previous | View Threaded


lannings at who

Apr 15, 2009, 6:57 AM

Post #1 of 2 (1183 views)
Permalink
story profile Add Category button lists all cats?

[.note: I'm probably overlooking something
because I'm frantically fixing things before
I leave WHO.]

In comp/widgets/story_prof/list_categories.html ,
where the 'Add Category' button is added, there is this:

% my $all_cats = [.
% grep { ! $curr_cats->{$_->get_id} && chk_authz($_, READ, 1) }
% $cat_pkg->list({ site_id => $story->get_site_id })
% ];
% if (scalar @$all_cats) {
<div class="actions">
<& '/widgets/profile/button.mc',
disp => $lang->maketext("Add Category"),
name => 'add_category_button',
button => 'add_category_lgreen',
useTable => 0,
js => qq{onclick="catListMan.add('new_category_uri'); return false"}
&>
....

If I'm reading that correctly, it does a list
of ALL CATEGORIES for the current site in order
to check if it should display the button, right?

(Users were reporting that the UI was slow,
maybe this was it, hmm...)


david at kineticode

Apr 15, 2009, 8:40 AM

Post #2 of 2 (1095 views)
Permalink
Re: story profile Add Category button lists all cats? [In reply to]

On Apr 15, 2009, at 6:57 AM, Scott Lanning wrote:

> [.note: I'm probably overlooking something
> because I'm frantically fixing things before
> I leave WHO.]
>
> In comp/widgets/story_prof/list_categories.html ,
> where the 'Add Category' button is added, there is this:
>
> % my $all_cats = [.
> % grep { ! $curr_cats->{$_->get_id} && chk_authz($_, READ, 1) }
> % $cat_pkg->list({ site_id => $story->get_site_id })
> % ];
> % if (scalar @$all_cats) {
> <div class="actions">
> <& '/widgets/profile/button.mc',
> disp => $lang->maketext("Add Category"),
> name => 'add_category_button',
> button => 'add_category_lgreen',
> useTable => 0,
> js => qq{onclick="catListMan.add('new_category_uri');
> return false"}
> &>
> ....
>
> If I'm reading that correctly, it does a list
> of ALL CATEGORIES for the current site in order
> to check if it should display the button, right?
>
> (Users were reporting that the UI was slow,
> maybe this was it, hmm...)

Yeah, pretty stupid. It should probably be

if (Bric::Biz::Category->list_ids({ not_id => ANY( map { $_->get_id }
$story->get_categories)) {
....
}

You'd have to add not_id, I think, but it should be a cinch.

Best,

David

Bricolage devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.