Stories
Slash Boxes
Comments

Dev.SN ♥ developers

Meta
posted by martyb on Friday March 20 2020, @09:30AM   Printer-friendly
from the before-and-after-was-the-original-dept-line-but-it-can-be-much-much-longer-as-you-can-now-see-here!! dept.

[2020-03-20 18:21:26 UTC: Updated dept. line to show how many characters it could contain. --martyb]

[2020-03-20 20:03:14 UTC: Added topics: "/dev/random", "Code", "Software", and "Answers" topics to better illustrate their use of space in a story. --martyb]

IMPORTANT NOTE: Rehash has altered the indentation; tabs have been replaced with spaces.

Here is the original version of the template: dispStory;misc;default

[% dispmode = dispmode || "full" %]
[% IF dispmode == "full" %]
<div class="article">
<span class="sd-info-block" style="display: none">
    <span class="sd-key-sid">[% story.sid %]</span>
    <span class="type">story</span>
    [% IF user.is_admin %]<span class="stoid">[% story.stoid %]</span>[% END %]
</span>
[% stripped_title = story.title | strip_title %]
[% IF magic;
    thisskin = Slash.db.getSkin(story.primaryskid);
    IF thisskin.rootdir;
        title = "<a href=\"$thisskin.rootdir/\">";
    ELSE;
        IF user.is_anon;
            title = "<a href=\"$gSkin.rootdir/$thisskin.name/\">";
        ELSE;
            title = "<a href=\"$gSkin.rootdir/index.pl?section=$story.primaryskid\">";
        END;
    END;
    title = title _ thisskin.title _ "</a>: <a href=\"$thisskin.rootdir/article.pl?sid=$story.sid\">$stripped_title</a>";
ELSE;
    title = "<a href=\"$gSkin.rootdir/article.pl?sid=$story.sid\">$stripped_title</a>";
END %]
[% seen_topics = {} %]
[% PROCESS titlebar future=story.is_future %]
    <div class="details">
        [% IF story.journal_id;
            # at some point, we should maybe have a link
            # directly to the journal entry, perhaps
            # in the storylinks?  for now, just to the journal.
            journal     = Slash.getObject('Slash::Journal');
            thisjournal = journal.get(story.journal_id);
            IF thisjournal && thisjournal.uid;
                thisuser    = Slash.db.getUser(thisjournal.uid); %]
        Journal written by <a href="[% constants.real_rootdir %]/~[% thisuser.nickname | fixnickforlink | strip_paramattr %]/journal/"
            >[% thisuser.nickname | strip_literal %] ([% thisjournal.uid %])</a> and [%
            ELSIF story.by %]
        Written by [% story.by | strip_literal %] and [%
            END;
        END %]
        posted by
        [% IF author.homepage %]
            <a href="[% author.homepage %]">[% author.nickname | strip_literal %]</a>
        [% ELSE %]
            <a href="[% constants.real_rootdir %]/~[% author.nickname | fixnickforlink | strip_paramattr %]/">    [% author.nickname | strip_literal %]</a>
        [% END %]
        [% story.atstorytime %]
        [% IF constants.plugin.Print %]
              <a href="[% gSkin.rootdir -%]/print.pl?sid=[% story.sid %]"><img src="[% constants.imagedir %]/print.gif" height="11" width="15" alt="Printer-friendly"></a>
        [% END %]
        [% IF constants.plugin.Email %]
              <a href="[% gSkin.rootdir -%]/email.pl?sid=[% story.sid %]"><img src="[% constants.imagedir -%]/email.gif" height="14" width="20" alt="Email story" ></a>
        [% END %]<br>
        [% IF constants.use_dept && story.dept %]<strong>from the <b>[% story.dept %]</b> dept.</strong>[% END %]
    </div>
    <div class="body">
        [% mypagemenu = PROCESS pagemenu; IF mypagemenu %]<br>[% mypagemenu %][% END %]
        <div class="topic">
            [% seen_topics.${topic.tid} = 1 %]
            [% IF user.lowbandwidth || user.simpledesign || user.noicons ||  user.pda %]
                [ <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]">[% topic.textname %]</a> ]
            [% ELSIF topic.image %]
                <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]">
                    <img src="[% constants.imagedir %]/topics/[% topic.image %]" width="[% topic.width %]" height="[% topic.height %]" alt="[% topic.textname %]" title="[% topic.textname %]" >
                </a>
            [% END %]
            [% FOREACH tid = topiclist %]
                [% IF seen_topics.$tid ; NEXT ; END %]
                [% seen_topics.$tid = 1 %]
                [% topic2 = Slash.db.getTopic(tid) %]
                    [% IF user.lowbandwidth || user.simpledesign || user.noicons %]
                        [ <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic2.tid %]" class="topic2">[% topic2.textname %]</a> ]
                    [% ELSIF topic2.image %]
                        <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic2.tid %]" class="topic2">
                            <img src="[% constants.imagedir %]/topics/[% topic2.image %]" width="[% topic2.width %]" height="[% topic2.height %]" alt="[% topic2.textname %]" title="[% topic2.textname %]" >
                        </a>
                    [% END %]
            [% END %]
        </div>
        <div class="intro">
            [%
            # Look ye to parseDomainTags for the domaintags == [0-2] logic
            %]
            [% IF user.domaintags == "3" %]
                [% story.introtext | apply_rehash_tags %]
            [% ELSE %]
                [% pretext = story.introtext | apply_rehash_tags;
                   pretext = Slash.addDomainTags(pretext);
                   pretext = Slash.parseDomainTags(pretext, 1); %]
                [% pretext %]
            [% END %]
        </div>
        [% IF !full && story.bodytext.length %]
                <input type="checkbox" id="more_[% story.sid %]" class="story_more" autocomplete="off" />
                <label for="more_[% story.sid %]" class="story_more">[% constants.story_more %]</label>
                <div class="story_more full">
                        [% story.bodytext | apply_rehash_tags %]
                </div>
        [% END %]

[% IF full && user.is_admin %]
        <br><a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">[ Edit ]</a>
        [% IF user.acl.signoff_allowed %]
          [% signed = Slash.db.hasUserSignedStory(stoid, user.uid); %]
          [% UNLESS signed %]<a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">[ No Signoff ]</a> [% END %]
        [% END %]
        [% possndstory = Slash.db.getStory(stoid) %]
        [% UNLESS possndstory.neverdisplay %]<a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">[ Display Enabled ]</a>[% END %]
[% END %]

[% IF story.is_future && !user.is_admin %]<p>See any serious problems with this story?
[% IF constants.ircslash_remarks %]
    Paste a short message here (if it's a dupe, the URL would be great)
    <form action="[% gSkin.rootdir %]/index.pl" method="post">
    <input type="text" name="remark" size="20" maxlength="100">
    <input type="hidden" name="sid" value="[% story.sid | strip_attribute %]" >
    </form>
    or email
[% ELSE %]
    Email
[% END %]
<a href="mailto:[% constants.adminmail %]?subject=[DP]%20[% story.title | strip_paramattr_nonhttp %]">our on-duty editor</a>.
[% END %]

[% IF full && story.bodytext %]
        <div class="full">
            [% story.bodytext | apply_rehash_tags %]
        </div>
[% END %]
    </div>
</div>
[% ELSIF dispmode == "brief" %]
[% IF story.is_future %]<div class="future">[% END %]
<div class="briefarticle">
[% storylink = Slash.linkStory ({
    sid => story.sid,
    link => story.title,
    tid  => story.tid
    skin => story.primaryskid
}, 1 );
%]
[% title = ''; IF magic;
    thisskin = Slash.db.getSkin(story.primaryskid);
    IF thisskin.rootdir;
        title = "<a href=\"$thisskin.rootdir/\">";
    ELSE;
        IF user.is_anon;
            title = "<a href=\"$gSkin.rootdir/$thisskin.name/\">";
        ELSE;
            title = "<a href=\"$gSkin.rootdir/index.pl?section=$story.primaryskid\">";
        END;
    END;
    title = "<span class=\"section\">" _ title _ thisskin.title _ "</a></span>: ";
END;
    title = title _ "<span class=\"storytitle\"><a href=\"$thisskin.rootdir/article.pl?sid=$story.sid\">$story.title</a></span>";
%]
    [% title %]  [% IF story.commentcount %][% story.commentcount %] comment[% IF story.commentcount > 1 %]s[% END %][% END %]
    [% IF user.is_admin %]<a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">(edit)</a>[% END %]
    [% IF getintro %]
    <div class="introhide" id="intro-[% story.stoid %]">
        [% story.introtext | apply_rehash_tags %]
    </div>
    [% END %]
</div>
[% IF story.is_future %]</div>[% END %]
[% END %]

Here is the updated version of the template: dispStory;misc;default

[% dispmode = dispmode || "full" %]
[% IF dispmode == "full" %]
<div class="article">
<span class="sd-info-block" style="display: none">
    <span class="sd-key-sid">[% story.sid %]</span>
    <span class="type">story</span>
    [% IF user.is_admin %]<span class="stoid">[% story.stoid %]</span>[% END %]
</span>
[% stripped_title = story.title | strip_title %]
[% IF magic;
    thisskin = Slash.db.getSkin(story.primaryskid);
    IF thisskin.rootdir;
        title = "<a href=\"$thisskin.rootdir/\">";
    ELSE;
        IF user.is_anon;
            title = "<a href=\"$gSkin.rootdir/$thisskin.name/\">";
        ELSE;
            title = "<a href=\"$gSkin.rootdir/index.pl?section=$story.primaryskid\">";
        END;
    END;
    title = title _ thisskin.title _ "</a>: <a href=\"$thisskin.rootdir/article.pl?sid=$story.sid\">$stripped_title</a>";
ELSE;
    title = "<a href=\"$gSkin.rootdir/article.pl?sid=$story.sid\">$stripped_title</a>";
END %]
[% seen_topics = {} %]
[% PROCESS titlebar future=story.is_future %]
    <div class="details">
        [% IF story.journal_id;
            # at some point, we should maybe have a link
            # directly to the journal entry, perhaps
            # in the storylinks?  for now, just to the journal.
            journal     = Slash.getObject('Slash::Journal');
            thisjournal = journal.get(story.journal_id);
            IF thisjournal && thisjournal.uid;
                thisuser    = Slash.db.getUser(thisjournal.uid); %]
        Journal written by <a href="[% constants.real_rootdir %]/~[% thisuser.nickname | fixnickforlink | strip_paramattr %]/journal/"
            >[% thisuser.nickname | strip_literal %] ([% thisjournal.uid %])</a> and [%
            ELSIF story.by %]
        Written by [% story.by | strip_literal %] and [%
            END;
        END %]
        posted by
        [% IF author.homepage %]
            <a href="[% author.homepage %]">[% author.nickname | strip_literal %]</a>
        [% ELSE %]
            <a href="[% constants.real_rootdir %]/~[% author.nickname | fixnickforlink | strip_paramattr %]/">    [% author.nickname | strip_literal %]</a>
        [% END %]
        [% story.atstorytime %]
        [% IF constants.plugin.Print %]
              <a href="[% gSkin.rootdir -%]/print.pl?sid=[% story.sid %]"><img src="[% constants.imagedir %]/print.gif" height="11" width="15" alt="Printer-friendly"></a>
        [% END %]
        [% IF constants.plugin.Email %]
              <a href="[% gSkin.rootdir -%]/email.pl?sid=[% story.sid %]"><img src="[% constants.imagedir -%]/email.gif" height="14" width="20" alt="Email story" ></a>
        [% END %]<br>
        [% IF constants.use_dept && story.dept %]<strong>from the <b>[% story.dept %]</b> dept.</strong>[% END %]
    </div>

    <div class="body">

    <!-- BEGIN in-memory update 2020-03-20 --martyb -->
    <div class="linkCommentPage" style="margin: 0; padding: 0; background-color: inherit !important;">
        <span class="nbutton">
            <b>
                <style>html body div#frame div#contents div#index div#articles div.article div.body div.linkCommentPage span.nbutton b a {display: none;}</style>
                <a href="#acomments">Skip to comment(s)</a>
            </b>
        </span>
    </div>
    <!-- END in-memory update 2020-03-20 --martyb -->

        [% mypagemenu = PROCESS pagemenu; IF mypagemenu %]<br>[% mypagemenu %][% END %]
        <div class="topic">
            [% seen_topics.${topic.tid} = 1 %]
            [% IF user.lowbandwidth || user.simpledesign || user.noicons ||  user.pda %]
                [ <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]">[% topic.textname %]</a> ]
            [% ELSIF topic.image %]
                <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic.tid %]">
                    <img src="[% constants.imagedir %]/topics/[% topic.image %]" width="[% topic.width %]" height="[% topic.height %]" alt="[% topic.textname %]" title="[% topic.textname %]" >
                </a>
            [% END %]
            [% FOREACH tid = topiclist %]
                [% IF seen_topics.$tid ; NEXT ; END %]
                [% seen_topics.$tid = 1 %]
                [% topic2 = Slash.db.getTopic(tid) %]
                    [% IF user.lowbandwidth || user.simpledesign || user.noicons %]
                        [ <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic2.tid %]" class="topic2">[% topic2.textname %]</a> ]
                    [% ELSIF topic2.image %]
                        <a href="[% gSkin.rootdir %]/search.pl?tid=[% topic2.tid %]" class="topic2">
                            <img src="[% constants.imagedir %]/topics/[% topic2.image %]" width="[% topic2.width %]" height="[% topic2.height %]" alt="[% topic2.textname %]" title="[% topic2.textname %]" >
                        </a>
                    [% END %]
            [% END %]
        </div>
        <div class="intro">
            [%
            # Look ye to parseDomainTags for the domaintags == [0-2] logic
            %]
            [% IF user.domaintags == "3" %]
                [% story.introtext | apply_rehash_tags %]
            [% ELSE %]
                [% pretext = story.introtext | apply_rehash_tags;
                   pretext = Slash.addDomainTags(pretext);
                   pretext = Slash.parseDomainTags(pretext, 1); %]
                [% pretext %]
            [% END %]
        </div>
        [% IF !full && story.bodytext.length %]
                <input type="checkbox" id="more_[% story.sid %]" class="story_more" autocomplete="off" />
                <label for="more_[% story.sid %]" class="story_more">[% constants.story_more %]</label>
                <div class="story_more full">
                        [% story.bodytext | apply_rehash_tags %]
                </div>
        [% END %]

[% IF full && user.is_admin %]
        <br><a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">[ Edit ]</a>
        [% IF user.acl.signoff_allowed %]
          [% signed = Slash.db.hasUserSignedStory(stoid, user.uid); %]
          [% UNLESS signed %]<a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">[ No Signoff ]</a> [% END %]
        [% END %]
        [% possndstory = Slash.db.getStory(stoid) %]
        [% UNLESS possndstory.neverdisplay %]<a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">[ Display Enabled ]</a>[% END %]
[% END %]

[% IF story.is_future && !user.is_admin %]<p>See any serious problems with this story?
[% IF constants.ircslash_remarks %]
    Paste a short message here (if it's a dupe, the URL would be great)
    <form action="[% gSkin.rootdir %]/index.pl" method="post">
    <input type="text" name="remark" size="20" maxlength="100">
    <input type="hidden" name="sid" value="[% story.sid | strip_attribute %]" >
    </form>
    or email
[% ELSE %]
    Email
[% END %]
<a href="mailto:[% constants.adminmail %]?subject=[DP]%20[% story.title | strip_paramattr_nonhttp %]">our on-duty editor</a>.
[% END %]

[% IF full && story.bodytext %]
        <div class="full">
            [% story.bodytext | apply_rehash_tags %]
        </div>
[% END %]
    </div>
</div>
[% ELSIF dispmode == "brief" %]
[% IF story.is_future %]<div class="future">[% END %]
<div class="briefarticle">
[% storylink = Slash.linkStory ({
    sid => story.sid,
    link => story.title,
    tid  => story.tid
    skin => story.primaryskid
}, 1 );
%]
[% title = ''; IF magic;
    thisskin = Slash.db.getSkin(story.primaryskid);
    IF thisskin.rootdir;
        title = "<a href=\"$thisskin.rootdir/\">";
    ELSE;
        IF user.is_anon;
            title = "<a href=\"$gSkin.rootdir/$thisskin.name/\">";
        ELSE;
            title = "<a href=\"$gSkin.rootdir/index.pl?section=$story.primaryskid\">";
        END;
    END;
    title = "<span class=\"section\">" _ title _ thisskin.title _ "</a></span>: ";
END;
    title = title _ "<span class=\"storytitle\"><a href=\"$thisskin.rootdir/article.pl?sid=$story.sid\">$story.title</a></span>";
%]
    [% title %]  [% IF story.commentcount %][% story.commentcount %] comment[% IF story.commentcount > 1 %]s[% END %][% END %]
    [% IF user.is_admin %]<a href="[% gSkin.rootdir -%]/admin.pl?op=edit&sid=[% story.sid %]">(edit)</a>[% END %]
    [% IF getintro %]
    <div class="introhide" id="intro-[% story.stoid %]">
        [% story.introtext | apply_rehash_tags %]
    </div>
    [% END %]
</div>
[% IF story.is_future %]</div>[% END %]
[% END %]


Original Submission

This discussion has been archived. No new comments can be posted.
Display Options Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 2) by martyb on Friday March 20 2020, @09:49AM

    by martyb (76) on Friday March 20 2020, @09:49AM (#31590) Journal

    First Post!

    And this also becomes a comment you can skip to in order to test out the new "Skip to Comment(s)" button.

    I think this may be the very first time in the history of slashcode where a "First Post" comment SHOULD NOT be moderated "-1 Offtopic"!

  • (Score: 0) by Anonymous Coward on Friday March 20 2020, @12:51PM (1 child)

    by Anonymous Coward on Friday March 20 2020, @12:51PM (#31591)

    I love the javascriptless approach of the solution, most site would have rolled something with 200 lines of executed js (the button and all the function called for the functionality not the total is size of the js... that would have been quite bigger as js devs love using libraries, usually a bit too much for there own good)

    • (Score: 0) by Anonymous Coward on Saturday March 21 2020, @11:25AM

      by Anonymous Coward on Saturday March 21 2020, @11:25AM (#31594)

      Don't you feel cheated, though? How can this little dab of uncomplicated code ever crash and burn, like javascript can?

  • (Score: 2) by FatPhil on Saturday March 21 2020, @08:30AM

    by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Saturday March 21 2020, @08:30AM (#31592) Homepage Journal
    Can we float the div to the right, so that it's always in the same place?
    --
    Making a public pledge to no longer contribute to slashdot
  • (Score: 0) by Anonymous Coward on Sunday March 22 2020, @01:06AM (2 children)

    by Anonymous Coward on Sunday March 22 2020, @01:06AM (#31595)

    Was this test been stopped? Is the link being fixed? What does the button look like? What about the text? Why not use styles like already are used? Maybe use the + or - button like with comments to roll down/up the story?

    • (Score: 0) by Anonymous Coward on Sunday March 22 2020, @11:22AM (1 child)

      by Anonymous Coward on Sunday March 22 2020, @11:22AM (#31596)

      posted by martyb on Friday March 20, @09:30AM Printer-friendly [Skip to comment(s)]

      • (Score: 0) by Anonymous Coward on Sunday March 22 2020, @03:46PM

        by Anonymous Coward on Sunday March 22 2020, @03:46PM (#31597)

        still not there. maybe make it larger?

(1)