From 2d7f6e7e107cf44ae7472fed828cc8c9de79b000 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Thu, 19 May 2016 16:50:26 -0700 Subject: [PATCH] removed per section trello auth --- .../components/section/trello/type-editor.js | 36 ++++--- app/app/styles/color.scss | 61 ++++++++---- .../components/section/trello/type-editor.hbs | 96 +++++++++---------- 3 files changed, 110 insertions(+), 83 deletions(-) diff --git a/app/app/components/section/trello/type-editor.js b/app/app/components/section/trello/type-editor.js index b6953170..9f8b0f37 100644 --- a/app/app/components/section/trello/type-editor.js +++ b/app/app/components/section/trello/type-editor.js @@ -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 diff --git a/app/app/styles/color.scss b/app/app/styles/color.scss index b189241b..5e7204e1 100644 --- a/app/app/styles/color.scss +++ b/app/app/styles/color.scss @@ -1,19 +1,17 @@ // Copyright 2016 Documize Inc. . 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 . +// by contacting . // // 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; +} diff --git a/app/app/templates/components/section/trello/type-editor.hbs b/app/app/templates/components/section/trello/type-editor.hbs index 11ba75e1..001cdcc0 100644 --- a/app/app/templates/components/section/trello/type-editor.hbs +++ b/app/app/templates/components/section/trello/type-editor.hbs @@ -32,64 +32,64 @@ } -{{#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')}} - -
-
-
-
-
Authentication
-
Provide Trello App Key and then authenticate
-
-
- -
Use plain old button below to grab the magic key -- you might need to log into Trello
- {{focus-input id="trello-appkey" type="password" value=config.appKey readonly=isReadonly}} -
- {{#if authenticated}} -
Logout {{config.user.fullName}}
- {{else}} -
Get App Key
-
-
Authenticate
- {{/if}} - -
-
+{{#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}} -
+ +
Select Board & Lists
Choose lists to include from board
-
- -
Select board
- {{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}} -
-
- -
Select lists to include
-
-
{{config.board.name}}
- {{#each config.lists as |list|}} -
- {{#if list.included}} - check_box - {{else}} - check_box_outline_blank - {{/if}} - {{list.name}} -
- {{/each}} -
+ {{#if noBoards}} +
+
You have no team boards to share - personal boards are never shown.
-
+ {{else}} +
+ +
Select board
+ {{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}} +
+
+ +
Select lists to include
+
+
{{config.board.name}}
+ {{#each config.lists as |list|}} +
+ {{#if list.included}} + check_box + {{else}} + check_box_outline_blank + {{/if}} + {{list.name}} +
+ {{/each}} +
+
+
+ {{/if}}
+ + {{else}} + +
+
+
+
+
Authentication
+
Click to authenticate with Trello
+
+
Authenticate
+
+
+
+ {{/if}} {{/section/base-editor}}