tractorcow / silverstripe-colorpicker

Silverstripe Color Picker
Other
18 stars 12 forks source link

Not Working in SS 3.0? #1

Closed odonnetp closed 11 years ago

odonnetp commented 11 years ago

Hi there,

I wanted to add this to a site, specifically to a Nivo Slider module. The code for Nivo Slider is as such:

public function getCMSFields() { $fields = parent::getCMSFields();

    // Remove unneccesary fields.
    $fields->removeByName("NivoSliderID");

    $fields->push(TextField::create("Title", "Title"));

            return $fields;

}

I tried to copy suit and add the following:

    $fields->push(ColorField::create("TextColor", "Text Color"));       

but after I save, run dev/build, and go to backend, when I click on the field for text color, nothing happens. Any thoughts to why this might not be working?

tractorcow commented 11 years ago

Hi @odonnetp , I've tested your code in both SS 3.1 and 3.0 and they both seem fine. Do you think you could please help me reproduce your issue?

What is your exact SS version? Can you provide a full working example I can use? (DataObject or Page) Have you noticed any JS errors? Are the colorfield.js and colorpicker.js files being included?

odonnetp commented 11 years ago

I don't think the JS files are being called, but not sure why...is there anything within a config file or anything that I have to call in the JS files? Again, I'm trying to add to Nivo Slider (https://github.com/micmania1/silverstripe-nivoslider). I'm using SS 3.0. I have Nivo Slider folder in root and also color picker in root. Nivo Slider is done within its own Admin area (not within a page), could that have any reason why it isn't working?

Here is the code I have for NivoSliderSlide.php. I was testing just with the Text color to make it a color picker (previously I had admin just add it as rgb code):

<?php

/**

tractorcow commented 11 years ago

Hiya, I'm working my way through this.

Why is SlideImage a searchable field? It crashes my test code.

odonnetp commented 11 years ago

Figured it out. Needed to change the folder to be "colorpicker" as that is the folder structure it is calling in code/forms/ColorField.php.

tractorcow commented 11 years ago

:P aha, solution!

How about I fix the install documentation... it's a little outdated.

Thanks for your help. By the way, use composer! It'll solve all these issues for you in the future. :P

tractorcow commented 11 years ago

I've updated the docs - See https://github.com/tractorcow/silverstripe-colorpicker#installation

odonnetp commented 11 years ago

Appreciate it! Looking good, thanks again. Haven't used composer but will look into it.