Another JS fix for you @PJH



  • Presented without comment.

    <script type="text/javascript">
    Discourse.TopicMapComponent.reopen({
      creatorNotFirstPostOwner: function() {
        if (!this.get('topic.postStream.firstPostPresent')) {
          return;
        }
        var fristPost = this.get('topic.postStream.posts')[0];
        return (this.get('topic.details.created_by.username') !== fristPost.get('username'));
      }.property('topic.details.created_by.username', 'topic.postStream.firstPostPresent'),
    });
    </script>
    
    <script type='text/x-handlebars' data-template-name='components/topic-map'>
    <nav class='buttons'>
      <button class='btn' {{action "toggleMap"}} title="{{i18n 'topic.toggle_information'}}">
        <i {{bind-attr class=":fa toggleMapClass"}}></i>
      </button>
    </nav>
    
    <section {{bind-attr class=":map mapCollapsed"}}>
      <ul class="clearfix">
        <li>
          <a href='{{unbound topic.url}}'>
          <h4>{{#if creatorNotFirstPostOwner}}
            jeffed
          {{else}}
            {{i18n 'created_lowercase'}}
          {{/if}}
          </h4>
          {{avatar details.created_by imageSize="tiny"}}
          {{format-date topic.created_at}}
          </a>
        </li>
        <li>
          <a {{bind-attr href="topic.lastPostUrl"}}>
          <h4>{{i18n 'last_post_lowercase'}}</h4>
          {{avatar details.last_poster imageSize="tiny"}}
          {{format-date topic.last_posted_at}}
          </a>
        </li>
        <li>
          {{number topic.posts_count}}
          <h4>{{i18n 'posts_lowercase'}}</h4>
        </li>
        <li class='secondary'>
          {{number topic.views class=topic.viewsHeat}}
          <h4>{{i18n 'views_lowercase'}}</h4>
        </li>
        <li class='secondary'>
          {{number topic.participant_count}}
          <h4>{{i18n 'users_lowercase'}}</h4>
        </li>
        {{#if topic.like_count}}
          <li class='secondary'>
            {{number topic.like_count}}
            <h4>{{i18n 'likes_lowercase'}}</h4>
          </li>
        {{/if}}
        {{#if details.links.length}}
          <li class='secondary'>
            {{number details.links.length}}
            <h4>{{i18n 'links_lowercase'}}</h4>
          </li>
        {{/if}}
        {{#if showPosterAvatar}}
          <li {{bind-attr class=":avatars mapCollapsed::hidden"}}>
            {{#each p in details.fewParticipants}}
              {{topic-participant participant=p}}
            {{/each}}
          </li>
        {{/if}}
      </ul>
    </section>
    
    {{#unless mapCollapsed}}
      <section class='avatars clearfix'>
        {{#each p in details.participants}}
          {{topic-participant participant=p}}
        {{/each}}
      </section>
    
      {{#if infoLinks}}
        <section class='links'>
    
            <table class='topic-links'>
              {{#each link in infoLinks}}
                <tr>
                <td>
                  <span class='badge badge-notification clicks' title='{{i18n 'topic_map.clicks' count=clicks}}'>{{link.clicks}}</span>
                </td>
                <td>
                  <a href="{{unbound link.url}}" target="_blank" class='topic-link track-link' data-user-id="{{unbound link.user_id}}" data-ignore-post-id="true" title="{{unbound link.url}}">
                    {{#if link.title}}{{link.title}}{{else}}{{shorten-url link.url}}{{/if}}
                  </a>
                  {{link-domain link}}
                </td>
                </tr>
              {{/each}}
            </table>
    
            {{#if showAllLinksControls}}
              <div class='link-summary'>
                <a href {{action "showAllLinks"}}>{{i18n 'topic_map.links_shown' totalLinks=details.links.length}}</a>
              </div>
            {{/if}}
    
        </section>
      {{/if}}
    {{/unless}}
    </script>
    

    @PJH @boomzilla




  • Fake News

    I don't see anything special about your test forum. Is that because I'm not logged in, or is mobile viewing a barrier to Discourse fun?


  • Winner of the 2016 Presidential Election

    Most likely the first as I also don't see anything.

    Filed Under: Too lazy to create accounts everywhere

    Addendum: Or I was just blind... suits me right



  • Oh, right, I didn't test on mobile. Try again..

    It says "jeffed" instead of "created" when a topic was split.

      <h4>{{#if creatorNotFirstPostOwner}}
    
        jeffed
      {{else}}
        {{i18n 'created_lowercase'}}
      {{/if}}

  • Winner of the 2016 Presidential Election

    Clicking on it gives me a loading-circle and a text "Text at the bottom works" or something and then the topic comes back.

    Filed Under: What does all the JS do if all you do is change the text?

    Addendum: Okay, the text at the bottom is always there.... so that point is moot.. but still



  • @Kuro said:

    Filed Under: What does all the JS do if all you do is change the text?

    Most of it's just recreating the vanilla HTML layout, because the patching mechanism that @lightyear wrote is too big of a dependency to carry and doesn't really abstract much anyways.


  • Fake News

    Ah, that's subtle of you, hiding it in the "topic overview pandemonium bar".

    I was expecting your customization would alter the yellow "moved x posts to a new topic" message, right now poor @boomzilla has to do those by hand.



  • @JBert said:

    I was expecting your customization would alter the yellow "moved x posts to a new topic" message, right now poor @boomzilla has to do those by hand.

    :( that would require translation edits on the server


  • :belt_onion:

    yeah i didn't even realize that anything of any use lived there ever. and now... it is pretty much still the same.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.