Commits

Scott Nixon  committed a196177

Added support for inline embedding of action elements. Both overlay floats and inline embeds share the workflow.

  • Participants
  • Parent commits 1822284

Comments (0)

Files changed (3)

File inbounding/dispatch/api/handlers.py

     '''
     allowed_methods = ('GET')
     model = Action
-    fields = ("id", "url", "code")
+    fields = ("id", "url", "code", "type")
     
     def read(self, request):
         mylist = []

File inbounding/dispatch/static/css/ck_main.css

 
 .ck_closed { 
     display: none;
+}
+
+.ck_embed {
+    margin: 0;
+    padding: 0;
+    border: 0;
 }

File inbounding/dispatch/static/in.js

   author: Scott Nixon
   Checks to see if the page loading has a referrer. If the page is being referred
   the Website administrator can configure elements to be displayed to the user.
+
+  Inline Embed: The embedded elements are added using a combination of an html tag added 
+  to the page with a html id of "#ckembed_<Action_id>" and the ContextKick script.
+  
+  Overlay Float: The floated element is added the ContextKick script and positioned 
+  absolutely.
+
+  Shared Attributes: Both html types share the same method and workflow. The only 
+  differences are the html format and the exposure of the closure button which is 
+  probably unnecessary.  
 */
 
 /* Begin Tool Library */
 		var tmplt1b = "<div id='ck_container' class='ck_closed'><div class='top-layer'><div class='hide-open inner-light'><a id='ck_close' onclick='INBOUND.close();'>close</a></div></div><div class='inner-light'><div class='action_box'>"
 
 		var tmplt2 = results.code + "</div></div></div>"
-		var orginal = '<div id="in_container">' + s + results.code + '</div>'
+		var orginal = '<div id="in_container">' + results.code + '</div>'
+		var ck_embed = '<div class="ck_embed">' + results.code + '</div>'
 
 		var s = status;
 		var csscls = '';
 		}
 		else if (s === '101') {
 		    // Added class='ck_closed'
-		    $('body').append(tmplt1b + tmplt2);
+		    if (results.type === '1') {
+			$('#ckembed_' + results.id).html();
+		    }
+		    else if (results.type === '2') {
+			$('body').append(tmplt1b + tmplt2);
+		    }
 		} 
 		else {
+		    console.log("No Status")
 		    /* This is the default event that will show the template in 
 		     * an unchanged state.
 		    */
-		    $('body').append(tmplt1a + tmplt2);
+
+		    if (results.type === '1') {
+			$('#ckembed_' + results.id).html(ck_embed);		
+		    }
+		    else if (results.type === '2') {
+			$('body').append(tmplt1a + tmplt2);
+		    }
 		}