プロジェクト

全般

プロフィール

Feature #618

未完了

Ability to list all pages alphabetically

FLX FLX さんが13年以上前に追加. 約13年前に更新.

ステータス:
新規(New)
優先度:
通常(Normal)
担当者:
対象バージョン:
開始日:
2010/10/27
期日:
進捗率:

0%

予定工数:

説明

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.


ファイル

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

Haru Iida さんが13年以上前に更新

  • プロジェクトr-labs から Wiki Extensions に変更
  • 担当者Haru Iida にセット

Haru Iida さんが13年以上前に更新

  • 対象バージョン0.2.4 から 0.2.5 に変更

Haru Iida さんが約13年前に更新

  • 対象バージョン0.2.5 から 0.3.0 に変更

Haru Iida さんが約13年前に更新

  • 対象バージョン0.3.0 から いつかやる(Unplanned) に変更

FLX FLX さんが約13年前に更新

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

Haru Iida さんが約13年前に更新

Thaks for your help.

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

FLX FLX さんが約13年前に更新

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

FLX FLX さんが約13年前に更新

Hey Haru Iida,

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

Thanks!
Dennis

Haru Iida さんが約13年前に更新

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

FLX FLX さんが約13年前に更新

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

Haru Iida さんが約13年前に更新

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

FLX FLX さんが約13年前に更新

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 :)

他の形式にエクスポート: Atom PDF