mirror of
https://github.com/documize/community.git
synced 2025-07-21 22:29:41 +02:00
Add --None-- option to edit page
This commit is contained in:
parent
d655f1b42f
commit
8867b27152
3 changed files with 61 additions and 49 deletions
|
@ -117,30 +117,34 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
|||
this.set('config.board', boards.findBy('id', board.id));
|
||||
}
|
||||
|
||||
this.get('sectionService').fetch(page, "lists", self.get('config'))
|
||||
.then(function (lists) {
|
||||
let savedLists = self.get('config.lists');
|
||||
if (savedLists === null) {
|
||||
savedLists = [];
|
||||
}
|
||||
|
||||
lists.forEach(function (list) {
|
||||
let saved = savedLists.findBy("id", list.id);
|
||||
let included = true;
|
||||
if (is.not.undefined(saved)) {
|
||||
included = saved.included;
|
||||
if (is.null(board.id) || is.undefined(board.id)) {
|
||||
self.set('busy', false);
|
||||
} else {
|
||||
this.get('sectionService').fetch(page, "lists", self.get('config'))
|
||||
.then(function (lists) {
|
||||
let savedLists = self.get('config.lists');
|
||||
if (savedLists === null) {
|
||||
savedLists = [];
|
||||
}
|
||||
list.included = included;
|
||||
});
|
||||
|
||||
self.set('config.lists', lists);
|
||||
self.set('busy', false);
|
||||
}, function (error) { //jshint ignore: line
|
||||
self.set('busy', false);
|
||||
self.set('authenticated', false);
|
||||
self.showNotification("Unable to fetch board lists");
|
||||
console.log(error);
|
||||
});
|
||||
lists.forEach(function (list) {
|
||||
let saved = savedLists.findBy("id", list.id);
|
||||
let included = true;
|
||||
if (is.not.undefined(saved)) {
|
||||
included = saved.included;
|
||||
}
|
||||
list.included = included;
|
||||
});
|
||||
|
||||
self.set('config.lists', lists);
|
||||
self.set('busy', false);
|
||||
}, function (error) { //jshint ignore: line
|
||||
self.set('busy', false);
|
||||
self.set('authenticated', false);
|
||||
self.showNotification("Unable to fetch board lists");
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
@ -203,8 +207,9 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
|||
self.get('sectionService').fetch(page, "boards", self.get('config'))
|
||||
.then(function (boards) {
|
||||
self.set('busy', false);
|
||||
self.set('boards', boards);
|
||||
boards.unshift({ id: null, name: "--None--", backgroundColor: "white" }); // add the non-selection to the front
|
||||
self.set('config.boards', boards); // save the boards in the config too
|
||||
self.set('boards', boards);
|
||||
self.getBoardLists();
|
||||
}, function (error) { //jshint ignore: line
|
||||
self.set('busy', false);
|
||||
|
|
|
@ -25,14 +25,16 @@
|
|||
<div class="tip">All boards are selectd by default</div>
|
||||
<div class="github-board">
|
||||
{{#each config.boards as |board|}}
|
||||
<div class="github-list" {{action 'onBoardCheckbox' board.id}}>
|
||||
{{#if board.included}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box</i>
|
||||
{{else}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box_outline_blank</i>
|
||||
{{/if}}
|
||||
<span style="background-color: {{board.prefs.backgroundColor}}">{{board.name}}</span>
|
||||
</div>
|
||||
{{#if board.id}}
|
||||
<div class="github-list" {{action 'onBoardCheckbox' board.id}}>
|
||||
{{#if board.included}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box</i>
|
||||
{{else}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray github-list-checkbox">check_box_outline_blank</i>
|
||||
{{/if}}
|
||||
<span style="background-color: {{board.prefs.backgroundColor}}">{{board.name}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
<div class="clearfix" />
|
||||
</div>
|
||||
|
@ -46,24 +48,26 @@
|
|||
<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="section-trello-board" style= {{boardStyle}}>
|
||||
<div class="section-trello-board-title">{{config.board.name}}</div>
|
||||
{{#each config.lists as |list|}}
|
||||
<div class="section-trello-list" {{action 'onListCheckbox' list.id}}>
|
||||
{{#if list.included}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray section-trello-list-checkbox">check_box</i>
|
||||
{{else}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray section-trello-list-checkbox">check_box_outline_blank</i>
|
||||
{{/if}}
|
||||
<span class="trello-list-title">{{list.name}}</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
<div class="clearfix" />
|
||||
{{#if config.board.id}}
|
||||
<div class="input-control">
|
||||
<label>Lists</label>
|
||||
<div class="tip">Select lists to include</div>
|
||||
<div class="section-trello-board" style= {{boardStyle}}>
|
||||
<div class="section-trello-board-title">{{config.board.name}}</div>
|
||||
{{#each config.lists as |list|}}
|
||||
<div class="section-trello-list" {{action 'onListCheckbox' list.id}}>
|
||||
{{#if list.included}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray section-trello-list-checkbox">check_box</i>
|
||||
{{else}}
|
||||
<i class="material-icons widget-checkbox checkbox-gray section-trello-list-checkbox">check_box_outline_blank</i>
|
||||
{{/if}}
|
||||
<span class="trello-list-title">{{list.name}}</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
<div class="clearfix" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -224,7 +224,7 @@ func (*Provider) Refresh(ctx *provider.Context, config, data string) string {
|
|||
}
|
||||
|
||||
for _, board := range c.Boards {
|
||||
if board.Included {
|
||||
if board.Included && board.ID != "" {
|
||||
var payload = trelloRenderBoard{}
|
||||
|
||||
c.Board = board
|
||||
|
@ -315,6 +315,9 @@ func getBoards(config trelloConfig) (boards []trelloBoard, err error) {
|
|||
}
|
||||
|
||||
func getLists(config trelloConfig) (lists []trelloList, err error) {
|
||||
if config.Board.ID == "" {
|
||||
return
|
||||
}
|
||||
uri := fmt.Sprintf("https://api.trello.com/1/boards/%s/lists/open?key=%s&token=%s", config.Board.ID, config.AppKey, config.Token)
|
||||
req, err := http.NewRequest("GET", uri, nil)
|
||||
log.IfErr(err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue