]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add RSS feed to subscribe button
authorChocobozzz <me@florianbigard.com>
Wed, 26 Sep 2018 07:39:41 +0000 (09:39 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 26 Sep 2018 07:39:41 +0000 (09:39 +0200)
client/src/app/shared/user-subscription/remote-subscribe.component.html
client/src/app/shared/user-subscription/remote-subscribe.component.scss
client/src/app/shared/user-subscription/subscribe-button.component.html
client/src/app/shared/user-subscription/subscribe-button.component.scss
client/src/app/shared/user-subscription/subscribe-button.component.ts
client/src/app/shared/video/video.service.ts

index 3762142f2015d0357679d6530d58ec30abe7316b..ec3636b3e03bb80f55dacd9953e7ed8c9534a108 100644 (file)
@@ -1,5 +1,4 @@
-<form novalidate [formGroup]="form" 
-      (ngSubmit)="formValidated()">
+<form novalidate [formGroup]="form" (ngSubmit)="formValidated()">
   <div class="form-group">
     <input type="email"
       formControlName="text"
@@ -7,17 +6,17 @@
       (keyup.control.enter)="onValidKey()" (keyup.meta.enter)="onValidKey()"
       placeholder="jane_doe@example.com">
   </div>
-  <button type="submit"
-    [disabled]="!form.valid"
-    class="btn btn-sm btn-remote-follow"
-    i18n>
+
+  <button type="submit" [disabled]="!form.valid" class="btn btn-sm btn-remote-follow" i18n>
     <span *ngIf="!interact">Remote subscribe</span>
     <span *ngIf="interact">Remote interact</span>
   </button>
+
   <my-help *ngIf="!interact && showHelp"
            helpType="custom"
            i18n-customHtml customHtml="You can subscribe to the channel via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type the channel URL in the search box and subscribe there.">
   </my-help>
+
   <my-help *ngIf="showHelp && interact"
            helpType="custom"
            i18n-customHtml customHtml="You can interact with this via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type the current URL in the search box and interact with it there.">
index e492710794d8cb23e6af94f5b5146cddcb59b8e3..698c5866abdb1ae2ccf18c9ae6a30b684a4f5e06 100644 (file)
@@ -1,5 +1,6 @@
 @import '_mixins';
 
 .btn-remote-follow {
+  @include peertube-button;
   @include orange-button;
 }
\ No newline at end of file
index b62fb7dfa86d8f8eddd50a6ade11508f5649bcf1..2c8481c96091589b39e758c3f403153dda5b05df 100644 (file)
       {{ videoChannel.followersCount | myNumberFormatter }}
     </span>
   </button>
-  <button *ngIf="subscribed === true" type="button"
-          class="btn btn-sm" role="button"
-          (click)="unsubscribe()" i18n>Unsubscribe</button>
 
-  <div class="btn-group" ngbDropdown autoClose="outside" 
+  <button
+    *ngIf="subscribed === true" type="button"
+    class="btn btn-sm" role="button"
+    (click)="unsubscribe()" i18n
+  >
+    Unsubscribe
+  </button>
+
+  <div class="btn-group" ngbDropdown autoClose="outside"
        placement="bottom-right" role="group"
        aria-label="Multiple ways to subscribe to the current channel">
     <button class="btn btn-sm dropdown-toggle-split" ngbDropdownToggle>
         {{ videoChannel.followersCount | myNumberFormatter }}
       </span>
     </button>
+
     <div class="dropdown-menu" ngbDropdownMenu>
 
       <h6 class="dropdown-header" i18n>Using an ActivityPub-compatible account</h6>
+
       <button class="dropdown-item" (click)="subscribe()"
               *ngIf="subscribed === false">
         <span *ngIf="!isUserLoggedIn()" i18n>Subscribe with an account on {{ videoChannel.host }}</span>
         <span *ngIf="isUserLoggedIn()" i18n>Subscribe with your local account</span>
       </button>
+
       <button class="dropdown-item" i18n>Subscribe with a remote account:</button>
       <my-remote-subscribe showHelp="true" account="{{ uriAccount }}"></my-remote-subscribe>
+
       <div class="dropdown-divider"></div>
 
       <h6 class="dropdown-header" i18n>Using a syndication feed</h6>
index 7a8a8ee08cdae945140a4d6790a4b43502fc6658..15fb83c051134722aca5a025f848abf20fa277f2 100644 (file)
@@ -4,15 +4,32 @@
 .btn-group-subscribe {
   @include peertube-button;
   @include disable-default-a-behaviour;
+
   float: right;
   padding: 0;
 
-  &.btn-group > .btn:not(.dropdown-toggle) {
-    padding-right: 5px;
+  & > .btn,
+  & > .dropdown > .dropdown-toggle {
     font-size: 15px;
   }
-  &.btn-group > .btn-group:not(:first-child) > .btn {
-    padding-left: 2px;
+
+  // Unlogged
+  & > .dropdown > .dropdown-toggle span {
+    padding-right: 3px;
+  }
+
+  // Logged
+  & > .btn {
+    padding-right: 4px;
+
+    & + .dropdown > button {
+      padding-left: 2px;
+
+      &::after {
+        position: relative;
+        top: 1px;
+      }
+    }
   }
 
   &.subscribe-button {
@@ -22,7 +39,7 @@
     }
 
     span.followers-count {
-      padding-left:5px;
+      padding-left: 5px;
     }
   }
   &.unsubscribe-button {
     }
   }
 
+  .dropdown-menu {
+    cursor: default;
+
+    button {
+      cursor: pointer;
+    }
+  }
+
   .dropdown-header {
     padding-left: 1rem;
   }
index e3c758942703c91bd5c316e570949d065edfc3de..95c2bb8f8a8289415fd1d8dd4add1a45c3a4e434 100644 (file)
@@ -5,6 +5,8 @@ import { UserSubscriptionService } from '@app/shared/user-subscription/user-subs
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
 import { NotificationsService } from 'angular2-notifications'
 import { I18n } from '@ngx-translate/i18n-polyfill'
+import { VideoService } from '@app/shared/video/video.service'
+import { FeedFormat } from '../../../../../shared/models/feeds'
 
 @Component({
   selector: 'my-subscribe-button',
@@ -23,7 +25,8 @@ export class SubscribeButtonComponent implements OnInit {
     private router: Router,
     private notificationsService: NotificationsService,
     private userSubscriptionService: UserSubscriptionService,
-    private i18n: I18n
+    private i18n: I18n,
+    private videoService: VideoService
   ) { }
 
   get uri () {
@@ -100,6 +103,10 @@ export class SubscribeButtonComponent implements OnInit {
   }
 
   rssOpen () {
-    window.open('')
+    const rssFeed = this.videoService
+                      .getVideoChannelFeedUrls(this.videoChannel.id)
+                      .find(i => i.format === FeedFormat.RSS)
+
+    window.open(rssFeed.url)
   }
 }
index 4a78d70ea740d5a734391e9bd8303f20339b3957..2255a18a22e0a860455d528be05eba51c2743949 100644 (file)
@@ -28,7 +28,7 @@ import { Account } from '@app/shared/account/account.model'
 import { AccountService } from '@app/shared/account/account.service'
 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
 import { ServerService } from '@app/core'
-import { UserSubscriptionService } from '@app/shared/user-subscription'
+import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service'
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 
@@ -210,14 +210,17 @@ export class VideoService implements VideosProvider {
   buildBaseFeedUrls (params: HttpParams) {
     const feeds = [
       {
+        format: FeedFormat.RSS,
         label: 'rss 2.0',
         url: VideoService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase()
       },
       {
+        format: FeedFormat.ATOM,
         label: 'atom 1.0',
         url: VideoService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase()
       },
       {
+        format: FeedFormat.JSON,
         label: 'json 1.0',
         url: VideoService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase()
       }