(function ($) {
    "use strict";

    var rbvost = {

        siteurl:    "http://127.0.0.1:8080/wordpress/",
        themeurl:   "http://127.0.0.1:8080/wordpress//wp-content/themes/rbvost/",
        cache: undefined,

        init: function () {
            this.setLoginForm();
            this.checkLoginError();

            $.ajax({
                url: rbvost.siteurl + "?json=1"
            })
            .done(function (data) {
                if (data) {
                    rbvost.cache = data;
                    rbvost.renderView();
                } else {
                    alert("please log in");
                }
                console.log(data);
            })
            .fail(function () {
                alert("error");
            });
        },

        renderView: function () {
            var data = rbvost.cache;
            $.get(rbvost.themeurl + "_template.html", function (template) {
                $("#app").html(
                    Mustache.render(template, data)
                );
                rbvost.bindUIActions();
            });
        },

        bindUIActions: function () {
            $(".btn").on("click", function (e) { rbvost.sayHello(e); });
        },

        windowLoaded: function () {
            console.log("Loaded");
        },

        windowResized: function () {
            console.log("Resized");
        },

        windowScrolled: function () {
            // Improve performance while scrolling by not triggering hover events
            // http://www.thecssninja.com/javascript/pointer-events-60fps
            var body = document.documentElement;
            var timer;

            if (!body.style.pointerEvents) {
                body.style.pointerEvents = "none";
            }

            timer = setTimeout(function () {
                body.style.pointerEvents = "";
            }, 200);
        },

        setLoginForm: function () {
            $("#user_login").attr("placeholder", "Username");
            $("#user_pass").attr("placeholder", "Password");
        },

        checkLoginError: function () {
            var querystring = window.location.href.slice(window.location.href.indexOf("?") + 1);
            if (querystring === "login-failed") {
                $(".alert").show();
            }
        }

    };

    // DOM Ready
    $(function () { rbvost.init(); });
    // Images Loaded
    $(window).load(function () { rbvost.windowLoaded(); });
    // Window Resized (smart debounced event)
    $(window).bind("debouncedresize", function () { rbvost.windowResized(); });
    // Window Scrolled
    $(window).on("scroll", function () { rbvost.windowScrolled(); });

} (jQuery));

@@ -113,19 +113,22 @@
        t
-h
 em
+plat
 eurl:   
@@ -186,16 +186,26 @@
 /rbvost/
+templates/
 %22,%0A     
@@ -545,18 +545,24 @@
 st.r
-enderView(
+outer(%22campaign%22
 );%0A 
@@ -651,43 +651,8 @@
   %7D%0A
-                console.log(data);%0A
     
@@ -767,17 +767,13 @@
    r
-enderView
+outer
 : fu
@@ -772,32 +772,36 @@
 uter: function (
+view
 ) %7B%0A            
@@ -804,32 +804,205 @@
     
-var data = rbvost.cache;
+if (view === %22campaign%22) %7B%0A                rbvost.renderCampaignFilters();%0A                rbvost.renderCampaignList();%0A            %7D%0A        %7D,%0A%0A        renderView: function (data, template, el) %7B
 %0A   
@@ -1028,28 +1028,29 @@
 st.t
-h
 em
+plat
 eurl + 
-%22_
 template
 .htm
@@ -1049,14 +1049,8 @@
 late
-.html%22
 , fu
@@ -1091,14 +1091,10 @@
   $(
-%22#app%22
+el
 ).ht
@@ -1228,32 +1228,418 @@
 %7D);%0A        %7D,%0A%0A
+        renderCampaignFilters: function () %7B%0A            var data = rbvost.cache;%0A            console.log(data);%0A            rbvost.renderView(data, %22campaign-filters.html%22, %22.campaign-filters-view%22);%0A        %7D,%0A%0A        renderCampaignList: function () %7B%0A            var data = rbvost.cache;%0A            rbvost.renderView(data, %22campaign-list.html%22, %22.campaign-list-view%22);%0A        %7D,%0A%0A
         bindUIAc

split templates into multival views and build router