refactor cta subscription button to component, remove deprecation
This commit is contained in:
parent
bae81542b9
commit
8c9f92062d
8
app/components/subscribe-button.coffee
Normal file
8
app/components/subscribe-button.coffee
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
`import Ember from 'ember'`
|
||||||
|
`import config from 'travis/config/environment'`
|
||||||
|
|
||||||
|
SubscribeButtonComponent = Ember.Component.extend
|
||||||
|
|
||||||
|
classNames: ['cta-btn']
|
||||||
|
|
||||||
|
`export default SubscribeButtonComponent`
|
|
@ -50,9 +50,17 @@ Controller = Ember.Controller.extend
|
||||||
@config.show_repos_hint == 'public'
|
@config.show_repos_hint == 'public'
|
||||||
).property()
|
).property()
|
||||||
|
|
||||||
billingUrl: (->
|
billingUrl: ( ->
|
||||||
id = if @get('model.type') == 'user' then 'user' else @get('model.login')
|
id = if @get('model.type') == 'user' then 'user' else @get('model.login')
|
||||||
"#{@config.billingEndpoint}/subscriptions/#{id}"
|
"#{@config.billingEndpoint}/subscriptions/#{id}"
|
||||||
|
).property('model.name', 'model.login')
|
||||||
|
|
||||||
|
subscribeButtonInfo: (->
|
||||||
|
{
|
||||||
|
billingUrl: @get('billingUrl')
|
||||||
|
subscribed: @get('model.subscribed')
|
||||||
|
education: @get('model.education')
|
||||||
|
}
|
||||||
).property('model.login', 'model.type')
|
).property('model.login', 'model.type')
|
||||||
|
|
||||||
`export default Controller`
|
`export default Controller`
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
color: $grey-light
|
color: $grey-light
|
||||||
text-decoration: underline
|
text-decoration: underline
|
||||||
@media #{$medium-up}
|
@media #{$medium-up}
|
||||||
.profile-header, .sync-button, .ember-view
|
.profile-header, .sync-button
|
||||||
display: inline-block
|
display: inline-block
|
||||||
vertical-align: middle
|
vertical-align: middle
|
||||||
.sync-button
|
.sync-button
|
||||||
|
@ -138,7 +138,6 @@ p.profile-user-last
|
||||||
li
|
li
|
||||||
clear: both
|
clear: both
|
||||||
margin-bottom: .8em
|
margin-bottom: .8em
|
||||||
// overflow: auto
|
|
||||||
.profile-hooks
|
.profile-hooks
|
||||||
width: grid-calc(10, 24)
|
width: grid-calc(10, 24)
|
||||||
display: inline-block
|
display: inline-block
|
||||||
|
|
|
@ -1,25 +1,10 @@
|
||||||
{{#if allHooks.isLoaded}}
|
{{#if allHooks.isLoaded}}
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
{{#if config.billingEndpoint}}
|
|
||||||
<div class="cta-btn">
|
{{#if config.billingEndpoint}}
|
||||||
{{#if view.subscribed}}
|
{{subscribe-button account=subscribeButtonInfo}}
|
||||||
<a class="btn btn-activated" href={{billingUrl}}>
|
|
||||||
Subscription active!
|
|
||||||
</a>
|
|
||||||
{{else}}
|
|
||||||
{{#if view.education}}
|
|
||||||
<a class="btn btn-activated" href={{billingUrl}}>
|
|
||||||
Educational account!
|
|
||||||
</a>
|
|
||||||
{{else}}
|
|
||||||
<a class="btn btn-activate" href={{billingUrl}}>
|
|
||||||
Sign up this account!
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="profile-header">
|
<div class="profile-header">
|
||||||
<h1>{{accountName}}</h1>
|
<h1>{{accountName}}</h1>
|
||||||
|
|
15
app/templates/components/subscribe-button.hbs
Normal file
15
app/templates/components/subscribe-button.hbs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{{#if account.subscribed}}
|
||||||
|
<a class="btn btn-activated" href={{account.billingUrl}}>
|
||||||
|
Subscription active!
|
||||||
|
</a>
|
||||||
|
{{else}}
|
||||||
|
{{#if account.education}}
|
||||||
|
<a class="btn btn-activated" href={{account.billingUrl}}>
|
||||||
|
Educational account!
|
||||||
|
</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="btn btn-activate" href={{account.billingUrl}}>
|
||||||
|
Sign up this account!
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
Loading…
Reference in New Issue
Block a user