Project

General

Profile

Feature #618

Ability to list all pages alphabetically

Added by FLX FLX about 9 years ago. Updated almost 9 years ago.

Status:
新規(New)
Priority:
通常(Normal)
Assignee:
Start date:
10/27/2010
Due date:
% Done:

0%

Estimated time:

Description

It would be awesome to have a way to list all articles within a project wiki, maybe as an extension of the tags macro, by not listing any particular tags. It would even be better if it could be grouped as shown in the example I've attached to this message.


Files

list-pages.png (11.7 KB) list-pages.png Listing all pages within a project, example FLX FLX, 10/27/2010 07:55 PM

History

#1

Updated by Haru Iida almost 9 years ago

  • Project changed from r-labs to Wiki Extensions
  • Assignee set to Haru Iida
#2

Updated by Haru Iida almost 9 years ago

  • Target version changed from 0.2.4 to 0.2.5
#3

Updated by Haru Iida almost 9 years ago

  • Target version changed from 0.2.5 to 0.3.0
#4

Updated by Haru Iida almost 9 years ago

  • Target version changed from 0.3.0 to いつかやる(Unplanned)
#5

Updated by FLX FLX almost 9 years ago

Hi,

I've cheated around a bit and made a function in ProtoType that accomplishes this: http://jsfiddle.net/flxfxp/3LwH8/19/
However, I've tried to implement it in Redmine but when using it it actually clears the list.

Maybe you can get it to work inside Redmine?

Thanks.

Dennis

#6

Updated by Haru Iida almost 9 years ago

Thaks for your help.

But I'm Japanese. We have thousands characters.
It's not so useful for us.

#7

Updated by FLX FLX almost 9 years ago

I completely understand. However, since the English alphabet only consists of 26 letters it would be handy for those who need it. I've been trying to get it working as an extension of the taggedpages macro by creating the following:

 Redmine::WikiFormatting::Macros.register do
    desc "Creates a nice list format for the taggedpages macro" 
    macro :taggedlist do |obj, args|

        s = '
        <script type="text/javascript">
        var output = $H({});

        $$(".wiki ul.wikiext-taggedpages li a").each(function(el) {
            var l = el.innerHTML.substr(0, 1).toUpperCase();
            if (typeof(output.get(l)) == "undefined") output.set(l, []);
            output.get(l).push(el.innerHTML);
        });

        $$(".wiki ul.wikiext-taggedpages").invoke("update", "");

        output.keys().each(function(key) {
            var values = output.get(key);
            $$("ul").first().insert("<li><p>" + key + "</p></li>");
            values.each(function(v) {
                $$("ul").first().insert("<li>" + v + "</li>");
            });
        });
        </script>
        '

It doesn't seem to work like my example at http://jsfiddle.net/flxfxp/3LwH8/19/, as it removes the entire list content. Even if it's not going to be in the wiki extensions plugin, can you help me get this working?

Many thanks,

Dennis

#8

Updated by FLX FLX almost 9 years ago

Hey Haru Iida,

If possible I would really appreciate some help on this :)

Thanks!
Dennis

#9

Updated by Haru Iida almost 9 years ago

You have to use $$(".wiki ul.wikiext-taggedpages") instead of $$("ul").

How about following code?

Redmine::WikiFormatting::Macros.register do
    desc "Creates a nice list format for the taggedpages macro" 
    macro :taggedlist do |obj, args|

        s = '
        <script type="text/javascript">
        var output = $H({});

        $$(".wiki ul.wikiext-taggedpages li a").each(function(el) {
            var l = el.innerHTML.substr(0, 1).toUpperCase();
            if (typeof(output.get(l)) == "undefined") output.set(l, []);
            output.get(l).push(el.innerHTML);
        });

        var ul = $$(".wiki ul.wikiext-taggedpages");
        ul.invoke("update", "");

        output.keys().each(function(key) {
            var values = output.get(key);
            ul.first().insert("<li><p>" + key + "</p></li>");
            values.each(function(v) {
                ul.first().insert("<li>" + v + "</li>");
            });
        });
        </script>
        '
    end
end
#10

Updated by FLX FLX almost 9 years ago

Awesome, that works :D

The only problem is that it takes links but it doesn't put them as links but straight text. Any idea on how to fix this?

Thanks,
Dennis

#11

Updated by Haru Iida almost 9 years ago

You can try this one.

Redmine::WikiFormatting::Macros.register do
    desc "Creates a nice list format for the taggedpages macro" 
    macro :taggedlist do |obj, args|

        s = '
        <script type="text/javascript">
        var output = $H({});

        $$(".wiki ul.wikiext-taggedpages li a").each(function(el) {
            var l = el.innerHTML.substr(0, 1).toUpperCase();
            if (typeof(output.get(l)) == "undefined") output.set(l, []);
            output.get(l).push(el.parentNode.innerHTML);
        });

        var ul = $$(".wiki ul.wikiext-taggedpages");
        ul.invoke("update", "");

        output.keys().each(function(key) {
            var values = output.get(key);
            ul.first().insert("<li><p>" + key + "</p></li>");
            values.each(function(v) {
                ul.first().insert("<li>" + v + "</li>");
            });
        });
        </script>
        '
    end
end
#12

Updated by FLX FLX almost 9 years ago

You're a god, that works exactly like it should! :D thanks!
Even though it's not relevant to Japanese users, feel free to include this code in your plugin :)

Also available in: Atom PDF