Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: samples/github/lib/src/commit_presenter.dart

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'github_services.dart';
6
7 import 'package:immi/dart/immi.dart';
8 import 'package:immi/dart/image.dart';
9
10 import 'package:immi_samples/sequenced_presenter.dart';
11
12 // Export generated code for nodes in commit_presenter.immi
13 import 'package:immi/dart/commit_presenter.dart';
14 export 'package:immi/dart/commit_presenter.dart';
15
16 class CommitPresenter extends SequencedPresenter<CommitNode> {
17 Repository _repository;
18 Set<int> selectedIndices = new Set<int>();
19
20 CommitPresenter(this._repository);
21
22 void toggleAt(int index) {
23 if (selectedIndices.contains(index)) {
24 selectedIndices.remove(index);
25 } else {
26 selectedIndices.add(index);
27 }
28 }
29
30 CommitNode presentAt(int index) {
31 Map<String, dynamic> json = _repository.getCommitAt(index);
32 if (json == null) return null;
33
34 String imageUrl = json['author'] == null
35 ? ""
36 : json['author']['avatar_url'];
37
38 return new CommitNode(
39 author: json['commit']['author']['name'],
40 message: json['commit']['message'],
41 selected: selectedIndices.contains(index),
42 image: new ImageNode(url: imageUrl));
43 }
44 }
OLDNEW
« no previous file with comments | « samples/github/lib/src/commit_list_presenter.dart ('k') | samples/github/lib/src/commit_presenter.immi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698