Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification of branch gh-pages of the tutorial : rename store property and delete use of deliteful/Store #15

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ define([

tagModeSwitch.checked = settings.tagMode === "all" ? true : false;

languageSelect.store = new Memory();
languages.forEach(function (l) {
languageSelect.store.add(l);
languageSelect.setSelected(l, l.value === settings.language);
languageSelect.source = new Memory({data: languages});
languageSelect.on("query-success", function () {
languages.forEach(function (l) {
languageSelect.setSelected(l, l.value === settings.language);
});
});

// callbacks called when a settings input field is modified
Expand Down Expand Up @@ -89,12 +90,12 @@ define([
photosReceived = function (json) {
// cleanup request
requestDone();
// show the photos in the list by simply setting the list's store
photolist.store = new Memory({data: json.items});
// show the photos in the list by simply setting the list's source
photolist.source = new Memory({data: json.items});
};

refreshPhotoList = function () {
photolist.store = new Memory();
photolist.source = new Memory();
getPhotos(settings.tags);
};

Expand Down
20 changes: 2 additions & 18 deletions runnable/part1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@
<d-linear-layout vertical="false" class="pageHeader">
<div class="fill titleStyle">Menu</div>
</d-linear-layout>
<d-store id="menu_data">
<!-- left menu content -->
<d-list id="list" on-selection-change="vs.show(event.newValue.id)" selectionMode="radio">
{"label": "First View", "id": "first" },
{"label": "Second View", "id": "second" },
{"label": "Third View", "id": "third" }
<!--{"label": "Fourth View", "id": "fourth" }-->
</d-store>
<!-- left menu content -->
<d-list id="list" store="menu_data" on-selection-change="vs.show(event.newValue.id)" selectionMode="radio">
</d-list>
</d-linear-layout>
</d-side-pane>
Expand Down Expand Up @@ -62,20 +59,7 @@
<!-- fill the third view with content -->
<span>3rd view</span>
</div>
<!-- other views
<div id="fourth">
</div>
-->
</d-view-stack>
<!-- page content footer -->
<!--
<d-linear-layout vertical="false" class="pageFooter">
<div class="fill"><button is="d-button"></button></div>
<div class="fill"><button is="d-button"></button></div>
<div class="fill"><button is="d-button"></button></div>
<div class="fill"><button is="d-button"></button></div>
</d-linear-layout>
-->
</d-linear-layout>
</body>
</html>
3 changes: 1 addition & 2 deletions runnable/part1/js/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
define([
"delite/register", "delite/theme!delite/themes/{{theme}}/global.css", "deliteful/ViewStack",
"deliteful/SidePane", "deliteful/LinearLayout", "deliteful/Button", "deliteful/StarRating",
"deliteful/ProgressBar", "deliteful/Store", "deliteful/list/List", "requirejs-domready/domReady!"
"deliteful/ProgressBar", "deliteful/list/List", "requirejs-domready/domReady!"
], function (register) {
register.parse();
document.body.style.display = "";
list.selectedItem = list.store.get("first");

/* app code will go here */

Expand Down
6 changes: 3 additions & 3 deletions runnable/part4/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ define([
photosReceived = function (json) {
// cleanup request
requestDone();
// show the photos in the list by simply setting the list's store
photolist.store = new Memory({data: json.items});
// show the photos in the list by simply setting the list's source
photolist.source = new Memory({data: json.items});
};

refreshPhotoList = function () {
photolist.store = new Memory();
photolist.source = new Memory();
getPhotos("bridges,famous");
};

Expand Down
6 changes: 3 additions & 3 deletions runnable/part5/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ define([
photosReceived = function (json) {
// cleanup request
requestDone();
// show the photos in the list by simply setting the list's store
photolist.store = new Memory({data: json.items});
// show the photos in the list by simply setting the list's source
photolist.source = new Memory({data: json.items});
};

refreshPhotoList = function () {
photolist.store = new Memory();
photolist.source = new Memory();
getPhotos("bridges,famous");
};

Expand Down
6 changes: 3 additions & 3 deletions runnable/part6/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ define([
photosReceived = function (json) {
// cleanup request
requestDone();
// show the photos in the list by simply setting the list's store
photolist.store = new Memory({data: json.items});
// show the photos in the list by simply setting the list's source
photolist.source = new Memory({data: json.items});
};

refreshPhotoList = function () {
photolist.store = new Memory();
photolist.source = new Memory();
getPhotos("bridges,famous");
};

Expand Down
51 changes: 26 additions & 25 deletions runnable/part7/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ define([

tagModeSwitch.checked = settings.tagMode === "all" ? true : false;

languageSelect.store = new Memory();
languages.forEach(function (l) {
languageSelect.store.add(l);
languageSelect.setSelected(l, l.value === settings.language);
languageSelect.source = new Memory({data: languages});
languageSelect.on("query-success", function () {
languages.forEach(function (l) {
languageSelect.setSelected(l, l.value === settings.language);
});
});

// callbacks called when a settings input field is modified
Expand Down Expand Up @@ -89,39 +90,39 @@ define([
photosReceived = function (json) {
// cleanup request
requestDone();
// show the photos in the list by simply setting the list's store
photolist.store = new Memory({data: json.items});
// show the photos in the list by simply setting the list's source
photolist.source = new Memory({data: json.items});
};

refreshPhotoList = function () {
photolist.store = new Memory();
photolist.source = new Memory();
getPhotos(settings.tags);
};

photolist.itemRenderer = register("d-photo-item", [HTMLElement, ItemRenderer], {
template: handlebars.compile("<template>" +
"<div attach-point='renderNode'>" +
"<div class='photoThumbnailBg'>" +
"<img class='photoThumbnail' src='{{item.media.m}}'>" +
"</div>" +
"<div class='photoSummary'>" +
"<div class='photoTitle'>{{item.title}}</div>" +
"<div class='publishedTime'>{{this.formatDate(this.item.published)}}</div>" +
"<div class='author'>{{item.author}}</div>" +
"</div>" +
"</div>" +
"</template>"),
"<div attach-point='renderNode'>" +
"<div class='photoThumbnailBg'>" +
"<img class='photoThumbnail' src='{{item.media.m}}'>" +
"</div>" +
"<div class='photoSummary'>" +
"<div class='photoTitle'>{{item.title}}</div>" +
"<div class='publishedTime'>{{this.formatDate(this.item.published)}}</div>" +
"<div class='author'>{{item.author}}</div>" +
"</div>" +
"</div>" +
"</template>"),

// Formats a date in ISO 8601 format into a more readable format.
formatDate: function (d) {
return d && new Intl.DateTimeFormat(settings.language, {
year: "numeric",
month: "long",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric"
}).format(new Date(d));
year: "numeric",
month: "long",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric"
}).format(new Date(d));
}
});

Expand Down
15 changes: 8 additions & 7 deletions runnable/part8-1/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ define([

tagModeSwitch.checked = settings.tagMode === "all" ? true : false;

languageSelect.store = new Memory();
languages.forEach(function (l) {
languageSelect.store.add(l);
languageSelect.setSelected(l, l.value === settings.language);
languageSelect.source = new Memory({data: languages});
languageSelect.on("query-success", function () {
languages.forEach(function (l) {
languageSelect.setSelected(l, l.value === settings.language);
});
});

// callbacks called when a settings input field is modified
Expand Down Expand Up @@ -89,12 +90,12 @@ define([
photosReceived = function (json) {
// cleanup request
requestDone();
// show the photos in the list by simply setting the list's store
photolist.store = new Memory({data: json.items});
// show the photos in the list by simply setting the list's source
photolist.source = new Memory({data: json.items});
};

refreshPhotoList = function () {
photolist.store = new Memory();
photolist.source = new Memory();
getPhotos(settings.tags);
};

Expand Down