1 of 3
1
New FF Matrix Celltype: Copee Pastee
Posted: 16 August 2009 10:17 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  446
Joined  01-14-2006

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

 Signature 

Weblog | @iain | Taxonomy for EE2

Profile
 
 
Posted: 16 August 2009 05:10 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  304
Joined  01-03-2008

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(cellFFM{
    
// cell initialization code here.
    // `cell` is the table cell containing your celltype
    // `FFM` is the FF Matrix object
}
 Signature 

pixelandtonic.com    @brandonkelly

Profile
 
 
Posted: 16 August 2009 06:38 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  446
Joined  01-14-2006

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

 Signature 

Weblog | @iain | Taxonomy for EE2

Profile
 
 
Posted: 16 August 2009 06:46 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  180
Joined  06-28-2007

New version up yet?

 Signature 

twitter

Profile
 
 
Posted: 16 August 2009 06:49 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  446
Joined  01-14-2006

just this second…

 Signature 

Weblog | @iain | Taxonomy for EE2

Profile
 
 
Posted: 17 August 2009 01:18 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  300
Joined  09-14-2004

Cool, implemented this. smile 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.

 Signature 

{ say it once, say it twice, lealea says it’s nice } { host,  EE Podcast } { member, professionals network }

Profile
 
 
Posted: 17 August 2009 01:33 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  180
Joined  06-28-2007

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

 Signature 

twitter

Profile
 
 
Posted: 17 August 2009 02:35 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  26
Joined  03-12-2008

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

Profile
 
 
Posted: 17 August 2009 03:26 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  151
Joined  09-15-2008

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.

 Signature 

Jim Arment
http://jarment.com · http://canyoncreekonline.com

Profile
 
 
Posted: 17 August 2009 04:14 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  474
Joined  02-16-2007

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

 Signature 

@litzinger
Bold Minded add-ons

Profile
 
 
Posted: 17 August 2009 05:33 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  446
Joined  01-14-2006
lealea - 17 August 2009 05:18 PM

Cool, implemented this. smile 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.

eyevariety - 17 August 2009 05:33 PM

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.

litzinger - 17 August 2009 08:14 PM

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 smile

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

 Signature 

Weblog | @iain | Taxonomy for EE2

Profile
 
 
Posted: 19 August 2009 12:57 AM   [ Ignore ]   [ # 11 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4003
Joined  05-13-2004

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

 Signature 

web: Caffeine Creations twitter @CS_sean

Profile
 
 
Posted: 20 August 2009 10:57 AM   [ Ignore ]   [ # 12 ]  
Administrator
Avatar
RankRankRank
Total Posts:  380
Joined  09-02-2007

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?

File Attachments
iain_copee_pastee.js.zip  (File Size: 1KB - Downloads: 230)
 Signature 

 

Profile
 
 
Posted: 20 August 2009 07:23 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  446
Joined  01-14-2006
Wes Baker - 20 August 2009 02:57 PM

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 {border1px 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…

Wes Baker - 20 August 2009 02:57 PM

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.

 Signature 

Weblog | @iain | Taxonomy for EE2

Profile
 
 
Posted: 22 August 2009 11:33 AM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  167
Joined  04-25-2008

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?

Profile
 
 
Posted: 28 August 2009 01:35 AM   [ Ignore ]   [ # 15 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1642
Joined  01-05-2007

Can you knock up a quick screencast of this in action? Looks awesome!

 Signature 

Steven Hambleton | Hambo Development

WE SPECIALISE IN WORKING WITH AGENCIES AND BUILDING LONG TERM DEVELOPMENT PARTNERSHIPS 
Profile
 
 
Posted: 28 August 2009 03:43 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  446
Joined  01-14-2006

Just incase this saves anyone hours of debugging, I think I’ve found a bug when a “}” is inserted into FF fields and there are conditionals in the template that’s calling the FF field.

I’ve filed a support request, hopefully Brandon will confirm and respond soon…

 Signature 

Weblog | @iain | Taxonomy for EE2

Profile
 
 
Posted: 07 September 2009 03:25 AM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  06-10-2006

Hey Ian,

would it be possible to add some javascript to the Pastee field which copies the content on click?

Profile
 
 
Posted: 11 September 2009 05:28 PM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

My client is using an XHTML field, and my {audio} keys are supposed to insert a div that floats left and contains a Flash player that loads the audio. Works great, except the div is being wrapped with ‘p’ tags from the XHTML typography being applied. I’ve been trying to use the Strip ‘P’ plugin to get rid of them, but I think I’m having a parsing issue.

Anyone else having this issue when inserting content? (This may be more of an LG Replace problem…)

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
   
1 of 3
1