Fork me on GitHub

Tagged: jquery RSS

  • britg 12:22 pm on December 6, 2009 Permalink | Log in to leave a Comment
    Tags: , javascripts, jquery, tooltips   

    qTip – jQuery Tooltip Plugin with Excellent Docs 

    qTip - jQuery Tooltips

    qTip - jQuery Tooltips

    The bar has been set on jQuery plugins by this simple yet very robust project: qTip.

    What is it? An easy way to create fancy tooltips that has (optional) customization options for just about anything you want to do. I had been using a pretty old and bland library before, so I was excited to stumble on this one.

    Example: a tooltip positioned at the bottom left of a selector, with a green color scheme and a little tip pointing to the selector.

        $('#myselector').qtip({
            content: 'Eat my tooltip, sucker!',
            position: {
                corner: {
                    target: "bottomLeft",
                    tooltip: "topLeft"
                },
                adjust: {
                    x: 10,
                    y: 10
                }
            },
            style: {
                name: "green",
                tip: "topLeft"
            }
        });
    

    Perhaps the best part of this plugin is the documentation. Just check them out and tell me that’s not the most well-documented library you’ve ever seen.

     
  • britg 8:14 am on January 15, 2009 Permalink | Log in to leave a Comment
    Tags: , , jquery, timeago   

    Results are in – No One Likes Working With Time 

    20fswp3I recently performed a very Scientific survery asking ‘do you like working with time?’  I don’t mean ‘working with time constraints’, or ‘working with a person whos name is Time but they probably spell it like PThyhm (the P is silent).’  No, I mean working with time (timestamps, date formating, human-friendly time representation, etc) in your code — do you like it?

    The results may or may not surprise you.  With a sample size of 1, most if not all of those surveyed responded that they very strongly dislike working with timestamps!

    I strongly agree with the person surveyed, so that’s why I’m so elated that I stumbled upon this repo on github the other day — jQuery timeago.  Yes!  Finally I can just dump my timestamps straight from the database onto the page, call $.timeago(‘selector’), and bam — a perfectly human readable, self updating time representation.

    If you’re one of the many that agree with the extremely scientific survey above, then I highly recommend you give this jQuery plugin a try – here’s the plugins homepage.

     
    • Ryan McGeary 8:17 am on January 15, 2009 Permalink

      Thanks for the write-up. Glad you like the plugin.

    • britg 8:18 am on January 15, 2009 Permalink

      No problem, Ryan. Thanks for writing the plugin!

    • Ryan McGeary 4:17 pm on January 15, 2009 Permalink

      Thanks for the write-up. Glad you like the plugin.

    • britg 4:18 pm on January 15, 2009 Permalink

      No problem, Ryan. Thanks for writing the plugin!

  • britg 9:49 am on August 8, 2008 Permalink | Log in to leave a Comment
    Tags: , cms, edit anywhere, jquery, thickbox   

    Code Drive-By: Edit Anywhere Component for CakePHP 

    I call this a code drive-by because I’m just going to dump the code without much explanation.  When I have time I’ll come back and walk through it and turn it into a useful article on the CakePHP bakery.

    This component allows you to manage content (primarily text blocks) on a site if you’re logged in.  The editor pops up in a thickbox.

    Some requirements off the top of my head:

    • CakePHP, duh.
    • jquery
    • thickbox
    • Auth Component

    Again, sorry for the drive-by but hopefully someone will get use out of this.

    controller =& $controller;
    			App::import('Model', 'Setting');
    			$this->Setting = new Setting();
    		}
    
    		function read($field = null) {
    			return $this->render($field);
    		}
    
    		function render($field = null)
    		{
    			$content = $this->Setting->findByField($field);
    
    			if(!empty($content)) {
    				return $this->output($field, $content['Setting']['value']);
    			} else {
    				return $this->output($field, '');
    			}
    		}
    
    		function output($field, $str)
    		{
    			$output = $str;
    			if($this->controller->u['User']['role'] == 'admin') {
    				$output .= $this->editButton($field);
    			}
    			return nl2br($output);
    		}
    
    		function editButton($field) {
    			return '';
    		}
    	}
    ?>
    

    And my Settings Controller looks like:

    Setting->findByField($field);
    
    			if(!empty($content)) {
    				$this->Setting->id = $content['Setting']['id'];
    			}
    
    			if(!empty($this->data))
    			{
    				$content['Setting'] = array(
    					'field' => $field,
    					'value' => $this->data['Setting']['value'],
    				);
    
    				$this->Setting->save($content);
    				die($this->redirect($_REQUEST['r']));
    			}
    
    			$this->set(compact('field', 'content'));
    		}
    	}
    ?>
    
     
    • Romiz 2:47 am on January 12, 2009 Permalink

      It`s cool decision! Inline editors rules!
      Whether you thought about automatic rendering of text blocks?
      I mean that view itself should to know what blocks needed and will call render method of some helper…

    • Romiz 10:47 am on January 12, 2009 Permalink

      It`s cool decision! Inline editors rules!
      Whether you thought about automatic rendering of text blocks?
      I mean that view itself should to know what blocks needed and will call render method of some helper…

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel