1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-07 06:25:23 +02:00

removed per section trello auth

This commit is contained in:
Harvey Kandola 2016-05-19 16:50:26 -07:00
parent 1d29caef53
commit 2d7f6e7e10
3 changed files with 110 additions and 83 deletions

View file

@ -22,9 +22,16 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
authenticated: false,
config: {},
boards: null,
noBoards: false,
boardStyle: Ember.computed('config.board', function() {
var color = this.get('config.board').prefs.backgroundColor;
let board = this.get('config.board');
if (is.null(board) || is.undefined(board)) {
return "#4c4c4c";
}
let color = board.prefs.backgroundColor;
return Ember.String.htmlSafe("background-color: " + color);
}),
@ -38,7 +45,7 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
if (is.empty(config)) {
config = {
appKey: "",
appKey: "8e00492ee9a8934cfb8604d3a51f8f70",
token: "",
user: null,
board: null,
@ -51,6 +58,11 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
if (this.get('config.appKey') !== "" && this.get('config.token') !== "") {
this.send('auth');
}
else {
Ember.$.getScript("https://api.trello.com/1/client.js?key=" + this.get('config.appKey'), function() {
Trello.deauthorize();
});
}
},
willDestroyElement() {
@ -65,6 +77,13 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
let board = this.get('config.board');
let page = this.get('page');
if (is.null(boards) || is.undefined(boards) || boards.length === 0) {
this.set('noBoards', true);
return;
}
this.set('noBoards', false);
if (is.null(board) || is.undefined(board)) {
if (boards.length) {
board = boards[0];
@ -106,10 +125,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
return this.get('isDirty');
},
getAppKey() {
window.open("https://trello.com/app-key", "Trello App Key", "");
},
onListCheckbox(id) {
let lists = this.get('config.lists');
let list = lists.findBy('id', id);
@ -119,12 +134,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
}
},
logout() {
Trello.deauthorize();
this.set('authenticated', false);
this.set('token', '');
},
auth() {
if (this.get('config.appKey') === "") {
$("#trello-appkey").addClass('error').focus();
@ -215,6 +224,3 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
}
}
});
// app key per user
// global section config

View file

@ -1,19 +1,17 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
// by contacting <sales@documize.com>.
//
// https://documize.com
$color-off-white: #f5f5f5;
$color-off-black: #4c4c4c;
$color-black: #000000;
$color-white: #ffffff;
$color-primary: #2180cc;
$color-link: #5680de;
$color-red: #d9493c;
@ -27,11 +25,8 @@ $color-chip: #98A2AB;
$color-input: #98A2AB;
$color-stroke: #98A2AB;
$color-card-active: #f7fcff;
$color-border: #dbdbdb;
$color-border2: #e2e2e2;
$color-primary-light: lighten($color-primary, 30%);
$color-primary-dark: darken($color-primary, 10%);
$color-gray2: #f0eeee;
@ -41,16 +36,42 @@ $color-shadow: #dbdbdb;
$color-error: #c23c56;
$color-highlight: #fff8dc;
$color-warning: #990012;
.background-color-white { background-color: $color-white; }
.color-white { color: $color-white; }
.color-off-white { color: $color-off-white; }
.color-black { color: $color-black; }
.color-off-black { color: $color-off-black; }
.background-color-primary { background-color: $color-primary; }
.color-primary { color: $color-primary; }
.color-link { color: $color-link; }
.color-blue { color: $color-blue; }
.color-red { color: $color-red; }
.color-green { color: $color-green; }
.color-gray { color: $color-gray; }
.background-color-white {
background-color: $color-white;
}
.color-white {
color: $color-white;
}
.color-off-white {
color: $color-off-white;
}
.color-black {
color: $color-black;
}
.color-off-black {
color: $color-off-black;
}
.background-color-primary {
background-color: $color-primary;
}
.color-primary {
color: $color-primary;
}
.color-link {
color: $color-link;
}
.color-blue {
color: $color-blue;
}
.color-red {
color: $color-red;
}
.color-green {
color: $color-green;
}
.color-gray {
color: $color-gray;
}
.color-error {
color: $color-error;
}

View file

@ -32,64 +32,64 @@
}
</style>
{{#section/base-editor document=document folder=folder page=page busy=busy tip="Trello is the visual way to manage your projects and organize anything (https://trello.com)" isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action
'onAction')}}
<div class="pull-left width-45">
<div class="input-form">
<form>
<div class="heading">
<div class="title">Authentication</div>
<div class="tip">Provide Trello App Key and then authenticate</div>
</div>
<div class="input-control">
<label>Trello App Key</label>
<div class="tip">Use plain old button below to grab the magic key -- you might need to log into Trello</div>
{{focus-input id="trello-appkey" type="password" value=config.appKey readonly=isReadonly}}
</div>
{{#if authenticated}}
<div class="regular-button button-gray" {{ action 'logout' }}>Logout {{config.user.fullName}}</div>
{{else}}
<div class="regular-button button-gray" {{ action 'getAppKey' }}>Get App Key</div>
<div class="button-gap" />
<div class="regular-button button-blue" {{ action 'auth' }}>Authenticate</div>
{{/if}}
</form>
</div>
</div>
{{#section/base-editor document=document folder=folder page=page busy=busy
tip="Trello is the visual way to manage your projects and organize anything (https://trello.com)"
isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
{{#if authenticated}}
<div class="pull-right width-45">
<div class="pull-left width-50">
<div class="input-form">
<div class="heading">
<div class="title">Select Board & Lists</div>
<div class="tip">Choose lists to include from board</div>
</div>
<div class="input-control">
<label>Board</label>
<div class="tip">Select board</div>
{{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}}
</div>
<div class="input-control">
<label>Lists</label>
<div class="tip">Select lists to include</div>
<div class="trello-board" style= {{boardStyle}}>
<div class="trello-board-title">{{config.board.name}}</div>
{{#each config.lists as |list|}}
<div class="trello-list" {{action 'onListCheckbox' list.id}}>
{{#if list.included}}
<i class="material-icons widget-checkbox checkbox-gray trello-list-checkbox">check_box</i>
{{else}}
<i class="material-icons widget-checkbox checkbox-gray trello-list-checkbox">check_box_outline_blank</i>
{{/if}}
<span class="trello-list-title">{{list.name}}</span>
</div>
{{/each}}
<div class="clearfix" />
{{#if noBoards}}
<div class="input-control">
<div class="color-error">You have no team boards to share - personal boards are never shown.</div>
</div>
</div>
{{else}}
<div class="input-control">
<label>Board</label>
<div class="tip">Select board</div>
{{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}}
</div>
<div class="input-control">
<label>Lists</label>
<div class="tip">Select lists to include</div>
<div class="trello-board" style= {{boardStyle}}>
<div class="trello-board-title">{{config.board.name}}</div>
{{#each config.lists as |list|}}
<div class="trello-list" {{action 'onListCheckbox' list.id}}>
{{#if list.included}}
<i class="material-icons widget-checkbox checkbox-gray trello-list-checkbox">check_box</i>
{{else}}
<i class="material-icons widget-checkbox checkbox-gray trello-list-checkbox">check_box_outline_blank</i>
{{/if}}
<span class="trello-list-title">{{list.name}}</span>
</div>
{{/each}}
<div class="clearfix" />
</div>
</div>
{{/if}}
</div>
</div>
{{else}}
<div class="pull-left width-50">
<div class="input-form">
<form>
<div class="heading">
<div class="title">Authentication</div>
<div class="tip">Click to authenticate with Trello</div>
</div>
<div class="regular-button button-blue" {{ action 'auth' }}>Authenticate</div>
</form>
</div>
</div>
{{/if}}
{{/section/base-editor}}