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

Convert Shortcode model in admin.js #271

Open
2 tasks
eswarsaladi opened this issue Aug 13, 2023 · 1 comment
Open
2 tasks

Convert Shortcode model in admin.js #271

eswarsaladi opened this issue Aug 13, 2023 · 1 comment
Assignees

Comments

@eswarsaladi
Copy link
Collaborator

Code :

drstk.Shortcode = Backbone.Model.extend({
defaults: {
type: '',
items: new drstk.Items(),
settings: new drstk.Settings(),
colorsettings: new drstk.ColorSettings(),
},
initialize: function () {
this.set('items', new drstk.Items());
this.set('settings', new drstk.Settings());
this.set('colorsettings', new drstk.ColorSettings());
},
parse: function (response) {
response.items = new drstk.Items(response.items);
response.settings = new drstk.Settings(response.settings);
response.colorsettings = new drstk.ColorSettings(response.colorsettings);
return response;
},
set: function (attributes, options) {
if (attributes.items !== undefined && !(attributes.items instanceof drstk.Items)) {
attributes.items = new drstk.Items(attributes.items);
}
if (attributes.settings !== undefined && !(attributes.settings instanceof drstk.Settings)) {
attributes.settings = new drstk.Settings(attributes.settings);
}
if (attributes.colorsettings !== undefined && !(attributes.colorsettings instanceof drstk.ColorSettings)) {
attributes.colorsettings = new drstk.ColorSettings(attributes.colorsettings);
}
return Backbone.Model.prototype.set.call(this, attributes, options);
},
});

Tasks :

  • Refactor Shortcode model
  • Comment each function inside the model

Estimated Time: 20 - 30 min

@patrickmj
Copy link
Member

In particular, this will help make the code more clear about the 6 different kinds of shortcodes at work in old CERES. That'll be important to have in place for managing the upcoming changeover to new CERES, and will intersect with some of Aadesh's work very soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants