Help with migrating this repo to use new CanJS
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start with static/js/upcoming-events/event.js and static/js/upcoming-events/upcoming-events.js, then compare their current APIs with the CanJS 3 migration guide. Trace the existing model, list, control, and promise imports before deciding what migration guidance is needed. Done means both examples are updated or clearly documented so similar files can be migrated consistently.
Written by the indexing model from the issue text.
Description
Hello!
It would be greatly helpful to me migrating this repo if someone could show me an example or two.
For example, let's take the two .js files in static/js/upcoming-events:
https://github.com/donejs/bit-docs-donejs-theme/tree/master/static/js/upcoming-events
Would someone be willing to show what these files should look like if they were made with the newest version of CanJS? I should be able to apply the similar changes to most other files in this project on my own once I see how to do it for these two files.
event.js:
/* global moment */
import can from 'can/';
// import moment from 'moment'; // added global
import 'can/model/';
import 'can/map/define/';
import 'can/list/promise/';
export const Event = can.Model.extend({
findAll: 'GET https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events?key={apiKey}',
parseModels: function(data, xhr) {
return data && data.items;
}
}, {
define: {
startTimestamp: {
get: function() {
var start = this.attr('start');
var startDateTime = start.attr('dateTime') || start.attr('date');
return moment(startDateTime).format('X');
},
serialize: true
}
}
});
export default Event;
upcoming-events.js:
import $ from 'jquery';
import can from 'can/';
import Event from './event';
import 'can/construct/super/';
import 'can/control/plugin/';
import 'can/view/stache/';
import 'can/list/promise/';
import 'can/map/define/';
import '../components/upcoming-events/upcoming-events';
import '../components/upcoming-event/upcoming-event';
var template = can.stache('<upcoming-events events="{events}"></upcoming-events>');
var UpcomingEvents = can.Control.extend({
pluginName: 'upcomingEvents',
defaults: {
apiKey: null,
calendarId: null
}
}, {
init: function(el, options) {
this.update(options);
},
update: function(options) {
this._super(options);
var vm = new ViewModel(options);
this.element.html(template(vm));
}
});
export var ViewModel = can.Map.extend({
define: {
events: {
Value: Event.List,
get: function(currentValue) {
currentValue.replace(Event.findAll( this.attr() ));
return currentValue;
}
}
}
});
export default UpcomingEvents;
The migration guide has been helpful, but I have many questions after reading through. I have made the few changes that were obvious, but am shooting in the dark since I don't fully understand how the old CanJS works, and how things have changed. For example, how to migrate from using the old import 'can/list/promise/';?
Please show me... Thanks!
- Dominant language
- CSS
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from donejs/bit-docs-donejs-theme
-
greenkeeper
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
bug developer relations easy help wanted
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
bug developer relations help wanted p2
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
bug developer relations help wanted p2
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
bug developer relations help wanted p2
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
All issues in donejs/bit-docs-donejs-theme
Similar issues
-
Admin: Title Separator field can't be cleared (input falls back to "|")Possibly taken @emdashbot claimed this today. Openbot:bug bot:in-review
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
emdash-cms/emdash#4236 · 3 comments ·
Maintainers usually reply within 1 day
-
area:holodeck review-finding
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
hyperdrive-technology/holodeck#142 ·
Maintainers usually reply within 1 day
-
good first issue help wanted translation
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ChristianHandy/FleetPilot#122 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 3 days
-
area/ui bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100