(e)
| 140 | } |
| 141 | |
| 142 | onClickCreateClan (e) { |
| 143 | let name |
| 144 | if (me.isAnonymous()) { return this.openModalView(new CreateAccountModal()) } |
| 145 | const clanType = $('.private-clan-checkbox').prop('checked') ? 'private' : 'public' |
| 146 | if ((clanType === 'private') && !me.isPremium()) { |
| 147 | this.openModalView(new SubscribeModal()) |
| 148 | if (window.tracker != null) { |
| 149 | window.tracker.trackEvent('Show subscription modal', { category: 'Subscription', label: 'create clan' }) |
| 150 | } |
| 151 | return |
| 152 | } |
| 153 | if (name = $('.create-clan-name').val()) { |
| 154 | let description |
| 155 | const clan = new Clan() |
| 156 | clan.set('type', clanType) |
| 157 | clan.set('name', name) |
| 158 | if (description = $('.create-clan-description').val()) { clan.set('description', description) } |
| 159 | return clan.save({}, { |
| 160 | error: (model, response, options) => { |
| 161 | return console.error('Error saving clan', response.status) |
| 162 | }, |
| 163 | success: (model, response, options) => { |
| 164 | application.router.navigate(`/clans/${model.id}`) |
| 165 | return window.location.reload() |
| 166 | } |
| 167 | } |
| 168 | ) |
| 169 | } else { |
| 170 | return console.log('Invalid name') |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | onJoinClan (e) { |
| 175 | let clanID |
nothing calls this directly
no test coverage detected