digicorp / propeller

Propeller - Develop more, Code less. Propeller is a front-end responsive framework based on Google's Material Design Standards & Bootstrap.
http://propeller.in
MIT License
1.13k stars 141 forks source link

Provide javascript api for propeller components #33

Closed StarpTech closed 6 years ago

StarpTech commented 7 years ago

Every website has dynamic sections. As soon as I want to render a list from a ajax request I can't use the library to make this work. The last option is to copy paste and reinitiliaze all components. My suggestion is to provide a javascript api e.g by jquery plugins.

Further I would remove all html in javascript and provide a interface like in bootstrap.

piyush-digicorp commented 7 years ago

Hello, We are working towards creating js API for Propeller components.

terrancesnyder commented 7 years ago

A simple solution, work around could be rename all your document ready calls to a psuedo event.

$(document).on('page.load', function() { .... });

This would allow people to call a event if they needed to reload.

$( document ).trigger( "page.load" );

However this is sub-optimal... Maybe checkout UI Kit or other material design sites for how they work around this.

For now, I've modified my local to do the above so that Aurelia can be used.

StarpTech commented 7 years ago

@terrancesnyder thanks for the response. I already did it but this is ugly because you can't isolate a component from their depedencies e.g a form component in aurelia or riotjs should be responsible for bootstraping their elements not a global routine and without much copy & paste or modifying the library its not possible.

terrancesnyder commented 7 years ago

@StarpTech thanks, i needed something so just being pragmatic and adding this to gulp until that better solution is done. i'll follow this ticket if other ways come out.

    const patchPropellerForDomLoad = gulp.src(`${source}/dist/js/propeller*.js`)
        .pipe(changedInPlace({ firstPass: true }))
        .pipe(replace('$(document).ready(function () {', "$(document).on('page.load', function() {"))
        .pipe(gulp.dest(`${source}/dist/js`));
monika-digicorp commented 6 years ago

@terrancesnyder In Propeller V1.2, we have enhanced the components by developing jQuery Plugins to fetch the data dynamically. For more details, please refer: https://github.com/digicorp/propeller/releases/tag/v1.2.0