Giter Site home page Giter Site logo

bc-appspill's Introduction

Introducing bc-AppSpill.js

A jQuery plugin for outputting more than 500 web app items to a page at once within Adobe Business Catalyst.

The way this works is the plugin looks for BC's pagination which starts after 500 web app items and grabs content from all those pages with Ajax. The plugin will then output all those items to the page and show the target container.

If you have defined a callback as a plugin option it will run that and then show the target container to the user. See below.

Visit the demo page Here we are outputting over 500 Web App items and then running a callback function that simply adds a class to each web app item.

Basic Usage - How Do I Use It?

Create a target container element and output your Web App items. You will also want to add a class to this target so that Ajax has a target to work with.

 <div class="bc-output-all ajax-target">
	{module_webapps,21691,a}
 </div>

Hide the parent container and pagination.

 .bc-output-all {display:none;}
 .bc-output-all .pagination.webapp { display:none; }

Include jQuery 1.10+ & bc-appspill.min.js

 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
 <script src="javascript/bc-appspill.min.js"></script>
 <script>
    $('.bc-output-all').bcAppSpill();
 </script>

With a callback function

This is handy for when you want a bunch of items on a page and then you want to use another plugin to manipulate that data eg. jQuery driven calendar feature.

// example callback function
// adds a class of 'meow' to all the items
// after they have all loaded
 function _manipulateItems(target){
  $(target).find('div').each(function(){
	 $(this).addClass('meow');
  }); 
 }

 $('.bc-output-all').bcAppSpill({
  callBack: function(){
	 _manipulateItems('.bc-output-all'); // run this function after
  }
 });

Options

Below you will find some simple options to define:

$('.bc-output-all').bcAppSpill({
  ajaxTarget: 'ajax-target', // a handle for ajax
  bcPagClass: 'pagination.webapp', // BC's default pagination <ul>
  bcPaginationNext: 'li.pag-next', // BC's default pagination next link 
  callBack: function(){
   _manipulateItems('.bc-output-all'); // run this function afterwards
 }
});

Bonus Material

Throw the function below into your console window to create a bunch of web app items for a spreadsheet import file. Copy the contents of the console window, paste it into a text editor then find/replace any unwanted text.

function drawItems(){
  for(x = 0; x < 2000; x++){
	  var s = x+',Item Name,"",14-Mar-2014,01-Jan-9999,,-1,Y,-1,,,,,,,'
	  console.log(s);
  }
}

drawItems();

Changelog

  • 03.17.14 - v1.0.0 - 866bytes minified
    • Initial release

Credits

@_josephwatkins

bc-appspill's People

Watchers

Aaron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.