We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New FF Matrix Celltype: Copee Pastee

Development and Programming

iain's avatar
iain
317 posts
16 years ago
iain's avatar iain

Hi,

I’ve put together a quite simple cell type for a FF Matrix, basically it outputs a plain text {whatever-x} within your matrix row, where ‘x’ is the row count, and ‘whatever’ is whatever you want…

See the screenshot attached of what it does, and if you’re wondering why you’d need such a thing… its for accompanying the most excellent LG Replace plugin where you can insert the contents from fields dynamically within other fields. (See this screen-cast too for more information on using LG Replace).

Instructions are included in the zip file but are here also:

Version 1.1.0 (Updated to include Brandon’s tips below)

INSTALLATION:

  1. Drop the ‘iain_copee_pastee’ folder into your /system/extensions/fieldtypes/ folder.

  2. Enable the Field Type in your ‘Utilities -> FieldTypes Manager’

USAGE:

Create a new cell in your Matrix and assign it to be a “Iain Copee Pastee” field type. Use the lower ‘label’ to select what text you’d like to be displayed to the publisher. Your text will be prefixed with “{" and appended with "x}” where x is the row count.

I am a noob with php, and jQuery and just starting out with EE dev so if any devs out there see room for improvement, please sing out.

Download is available from Jam Digital

EDITS: 17 August 2009: Just re-uploaded v1.1.0 - Forgot to update the version number in the file. 17 December 2009: Removed forum hosted version, placed on Jam Digital

       
Brandon Kelly's avatar
Brandon Kelly
257 posts
16 years ago
Brandon Kelly's avatar Brandon Kelly

Hi Iain,

Nice work! But, there’s no need for these FF Matrix modifications.

If you place your iain_copee_pastee.js file within your own fieldtype’s folder, you can include it yourself by adding this to your display_cell method:

$this->include_js('iain_copee_pastee.js');

Within that JS file, wrap your code with the following:

$.fn.ffMatrix.onDisplayCell.iain_copee_pastee = function(cell, FFM) {
    // cell initialization code here.
    // `cell` is the table cell containing your celltype
    // `FFM` is the FF Matrix object
};
       
iain's avatar
iain
317 posts
16 years ago
iain's avatar iain

Brilliant! Thanks Brandon, I’ll post the updated code in a sec.

       
eyevariety's avatar
eyevariety
158 posts
16 years ago
eyevariety's avatar eyevariety

New version up yet?

       
iain's avatar
iain
317 posts
16 years ago
iain's avatar iain

just this second…

       
lealea's avatar
lealea
202 posts
16 years ago
lealea's avatar lealea

Cool, implemented this. 😊 Thanks Iain.

The only thing that would make it even UBER awesome is if the client skips the need to click, highlight, press CTRL+C… don’t know how to add the functionality, but if the client can just click on this area and the text is automatically COPIED, then the only thing they have to do is paste it where they want.

       
eyevariety's avatar
eyevariety
158 posts
16 years ago
eyevariety's avatar eyevariety

Lots of Jquery versions of that functionality.. would be a cinch to add. Iain if you don’t, I’ll give it a stab.

       
turbineseaplane's avatar
turbineseaplane
16 posts
16 years ago
turbineseaplane's avatar turbineseaplane

Don’t forget to update the version in the fieldtype php file.

       
JArment's avatar
JArment
131 posts
16 years ago
JArment's avatar JArment

I’m really excited to try this out. I’ll be adding it by the middle of the week. I’ll an update on how it works.

Thanks.

       
Brian Litzinger's avatar
Brian Litzinger
711 posts
16 years ago
Brian Litzinger's avatar Brian Litzinger

Looks handy. My big question though… what extension are you using to get WYSIWYM editor for your field?

       
iain's avatar
iain
317 posts
16 years ago
iain's avatar iain
Cool, implemented this. 😊 Thanks Iain. The only thing that would make it even UBER awesome is if the client skips the need to click, highlight, press CTRL+C… don’t know how to add the functionality, but if the client can just click on this area and the text is automatically COPIED, then the only thing they have to do is paste it where they want.

I went down this route for some time, mainly with zeroclipboard. Getting it to click to copy was quite straight forward but as I started using it in production it was evident there were some issues.

The main problem is that zeroclipboard uses a flash file to overlay the element you want copied, and it does this via absolute positioning. So, when you hide/show a field above Copee Pastee, the target click area moves away from its original element, this combined with a couple of other niggles had me pull the plug.

Lots of Jquery versions of that functionality.. would be a cinch to add. Iain if you don’t, I’ll give it a stab.

Go for it, if you find something reliable and cross browser I’d love to see it integrated.

Looks handy. My big question though… what extension are you using to get WYSIWYM editor for your field?

You can grab the extension from my Google code repository

It can be used as a field, or a matrix cell type. If you’re using it as a cell, it does have an issue where the editors start ‘doubling’ when you add more than one row at a time between saves. I’ll look at a fix when I have time. The lessons learnt here will apply 😊

EDIT: Sorry, link to google code was broken, just updated it…

       
Sean C. Smith's avatar
Sean C. Smith
3,818 posts
16 years ago
Sean C. Smith's avatar Sean C. Smith

this looks very cool. Wish I had a project to use this on right now.

       
Wes Baker's avatar
Wes Baker
343 posts
16 years ago
Wes Baker's avatar Wes Baker

I managed to get it to copy the value when you click on it by using ZeroClipboard (http://code.google.com/p/zeroclipboard/downloads/list). I attached the updated iain_copee_pastee.js file.

One question for the FieldFrame elite out there: Is there a better way to point to the ZeroClipboard.swf file?

Two questions for @iain: Why is there a copee_functions.js file and a iain_copee_pastee.js file? Could you put this on GitHub so i can fork it?

       
iain's avatar
iain
317 posts
16 years ago
iain's avatar iain
I managed to get it to copy the value when you click on it by using ZeroClipboard (http://code.google.com/p/zeroclipboard/downloads/list). I attached the updated iain_copee_pastee.js file.

Hi Wes, yeah you got to where I got, if you add the following lines into copee_style.css, and see where the flash overlays are appearing, it all looks a bit hacky to me…

embed {border: 1px solid red;}

Check the two screenshots below, first (on_load.png) is ok, looks like the flash files are going where they should be,

then if you start changing the pages layout, by collapsing/opening any of the fields above, see the second screenshot below.

Not ideal, and exactly the reason I didn’t bundle in the release…

Two questions for @iain: Why is there a copee_functions.js file and a iain_copee_pastee.js file? Could you put this on GitHub so i can fork it?

There are two files because the first release had a seperate js file to place within ff_matrix folder. With some quick advice from Brandon he explained how it could be done better. I updated the files as quickly as I could so that’s why there are two… Next version won’t, and some updates from Brandon in 3.1 has meant some other minor improvements to this fieldtype also.

Regarding GitHub, I haven’t used it yet but I have been reading up and watching some screencasts, I’ll let you know when I create an account and start hosting my code over there.

       
Macrike's avatar
Macrike
137 posts
16 years ago
Macrike's avatar Macrike

Great idea. FF Matrix + LG Replace is a powerfull combination, and this fieldtype just makes it even better. ^_^

For some reason I’m not getting the closing tag to display. Any ideas?

       
1 2 3 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.