Skip to content

Instantly share code, notes, and snippets.

@jonschreiber
Last active January 24, 2017 07:21
Show Gist options
  • Save jonschreiber/4803eb484305ffef075aba55374638f6 to your computer and use it in GitHub Desktop.
Save jonschreiber/4803eb484305ffef075aba55374638f6 to your computer and use it in GitHub Desktop.
customize the Chute Media Chooser v2 - example CSS injection
MC.prototype.initChooser = function() {
this.chooser = new Chute.Chooser({
client_id : this.settings.client_id,
width : 600,
height : 500,
album : this.settings.uploadAlbum,
steps : ['profile', 'selector', 'tos', 'thanks', 'ageError'],
saveAfterStep: 'tos',
stepOptions: {
profile: {
title: 'Profile',
public: true,
next: 'next',
fields: [
{
type: 'text',
name: 'FirstName',
placeholder: 'First Name',
required: false
},
{
type: 'text',
name: 'LastName',
placeholder: 'Last Name',
private: true,
required: true
},
{
type: 'text',
name: 'EmailAddress',
placeholder: 'Email Address',
private: true,
required: true
},
{
type: 'text',
name: 'PhoneNumber',
placeholder: 'Phone Number',
private: true,
required: true
}
]
},
selector: {
captionLimit: 100,
captions: 'optional',
limit: 1,
title: 'UPLOAD YOUR VIDEO',
next: 'Next',
services: ['upload'],
template: this.chooserData.stepTemplates.selector
},
tos : {
title: 'Terms',
next: 'Next',
text: 'I agree to the Terms & Conditions.',
template: this.chooserData.stepTemplates.tos
},
thanks: {
title: 'Thanks',
next: 'done',
text: 'Thank You for Submitting!'
},
ageError: {
title: 'Error',
next: 'close',
template: '<script>document.body.className += \' custom-step-error\'</script><div class="step-thanks"><div class="body">Sorry, you are ineligible for this contest. <a href="http://goodmorningamerica.com/" target="_blank">Click here to visit GoodMorningAmerica.com</a>.</div></div>'
}
}
});
};
MC.prototype.bindChooser = function() {
var that = this;
// ... other stuff
this.chooser.on('after:profile:render', function() {
// Add styles on the first step
that.chooser.$('header').prepend('<style>' + that.chooserData.styles + '</style>');
that.chooser.$('header').prepend('<link href="//fonts.googleapis.com/css?family=Open+Sans:100,400,500,700|Signika:700,400" rel="stylesheet" type="text/css">');
that.chooser.$('header').prepend('<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">');
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment