dvlpp / sharp

A Laravel 5 CMS for developers who hate CMS
15 stars 1 forks source link

Install failure.... #1

Open oimken opened 9 years ago

oimken commented 9 years ago
installation is old. not works in laravel 5

there is some small changes in installation:

I am newbie in laravel , but sharp interes me. would you please tell me more about sharp ?

Is it not depend on database? where did it save the images/files to?

dvlpp commented 9 years ago

Well, you are right, and I'm sorry: I use Sharp a lot for my own projects, but I wasn't able found the time yet to update the doc (which is Laravel 4 specific, as you figured).

The idea of Sharp is to be DB and file system agnostic: Sharp require from the project code to implement some interfaces in repositories, based on what's defined in the config files, and those repositories are responsible of dealing with the posted data.

This said, the tool provide a good help with an Eloquent Model configuration, with the SharpEloquentAutoUpdaterService (which goal is to do all the DB work).

I plan to work on the code (keeping the current API) and the documentation in the coming months, but I'm a the moment way to busy. You are the first asking me help on this project, so here's what we can do: if you have the motivation to dive in with the current donc and the latest code, do it, and send me an email or reply here if you have some issue or question. The project is production-ready (some projects are live at this time).

One final note: prefer, for development, this version in composer.json, because some bug fixes are coming periodically without tag-release:

(I will not break the current codebase)

oimken commented 9 years ago

Thanks a lot for your reply!!! I am reading the doc and I got you idea of sharp. It is a amazing tools for small site, such as single page portfolio. I will try my best to read your code to understand how it works! Thank you for you sharing!!

oimken commented 9 years ago

I try to follow your doc to set up a demo, but the doc if for laravel 4, there are lots of differences, I stuck on very first step: create the cms config file.....

I already tried to put the config file "sharp.cms.giraffe.php" into "/config", and edit the "config/sharp.php"

"name" => "Sharp Demo", // "auth_service" => '\Quincy\Services\SharpAuth', "cms" => ['giraffe']

and change the file name to test: but I keep receiving the error message:

EntityConfigurationNotFoundException in SharpCmsConfig.php line 59: Category configuration for [] can't be found

would you please help me out? update the doc will be very helpful, or share a little sample that I could figure out how sharp works.

thank you for your kind help.

dvlpp commented 9 years ago

Oh, it changed a lot. There's only one config file (sharp.php). Here's an example:

return [
    "name" => "SharpZoo",
    "auth_service" => false,
//    "auth_service" => '\App\Sharp\SharpAuthentication',
    "languages" => [
        "fr" => "French",
        "en" => "English"
    ],
    "cms" => [
        "africa" => [
            "label" => "African area",

            "entities" => [
                "giraffe" => [
                    "label"   => "Giraffe",
                    "icon"    => "star",
                    "plural"  => "Giraffes",

                    "id_attribute" => "id",

                    "active_state_field" => "alive",

                    "duplicable" => true,

                    "commands" => [
                        "list" => [
                            "export" => [
                                "text" => "Export (CSV)",
                                "type" => "download",
                                "handler" => '\App\Sharp\Giraffe\ExportCsvCommand',
                            ]
                        ],
                        "entity" => [
                            "birthday" => [
                                "text" => "Add one year",
                                "type" => "reload",
                                "handler" => '\App\Sharp\Giraffe\BirthdayCommand'
                            ],
                            "view" => [
                                "text" => "Preview",
                                "type" => "view",
                                "handler" => '\App\Sharp\Giraffe\PreviewCommand',
                                "view" => "sharp_previews/giraffe"
                            ]
                        ]
                    ],

                    // List columns
                    "list_template" => [
                        "columns" => [
                            "picture" => [
                                "width" => 1,
                                "renderer" => 'thumbnail:100x100'
                            ],
                            "name" => [
                                "header"   => "Name",
                                "sortable" => true,
                                "width" => 6
                            ],
                            "age" => [
                                "header"   => "Age",
                                "sortable" => true,
                                "width" => 2
                            ],
                            "height" => [
                                "header"   => "Height",
                                "width" => 1,
                                "renderer" => '\App\Sharp\Giraffe\HeightColumnsRenderer'
                            ]
                        ],

                        "paginate" => 10,
                        "reorderable" => false,
                        "sublist" => true,
                        "searchable" => true
                    ],

                    // Model
                    "repository" => '\App\Sharp\Giraffe\Repository',
                    "validator" => '\App\Sharp\Giraffe\Validator',

                    // Fields
                    "form_fields" => [
                        "name" => [
                            "label" => "Name",
                            "type" => "text"
                        ],

                        "picture" => [
                            "label" => "Picture (JPG)",
                            "type" => "file",
                            "file_filter" => "jpg,jpeg",
                            "file_filter_alert" => "JPG only",
                            "thumbnail" => "200x100"
                        ],

                        "zookeeper_id" => [
                            "label" => "Zoo keeper",
                            "type" => "ref",
                            "repository" => '\App\Sharp\Zookeeper\Repository'
                        ],

                        "desc" => [
                            "label" => "Description",
                            "type" => "markdown",
                            "toolbar" => "BI QUO LP F"
                        ],

                        "age" => [
                            "label" => "Age",
                            "type" => "text",
                            "attributes" => [
                                "placeholder" => "In years"
                            ],
                            "field_width" => 6
                        ],

                        "height" => [
                            "label" => "Height",
                            "type" => "text",
                            "attributes" => [
                                "placeholder" => "In cm"
                            ],
                            "field_width" => 6
                        ],

                        "particularities" => [
                            "label" => "Physical particularities",
                            "type" => "pivot",
                            "addable" => true,
                            "sortable" => true,
                            "order_attribute" => "order",
                            "create_attribute" => "name",
                            "repository" => '\App\Sharp\Particularity\Repository'
                        ],

                        "photos" => [
                            "label" => "Photos",
                            "type" => "list",
                            "sortable" => true,
                            "addable" => true,
                            "removable" => true,
                            "add_button_text" => "Add a photo",
                            "item_id_attribute" => "id",
                            "item" => [
                                "file" => [
                                    "type" => "file",
                                    "file_type" => "jpg,jpeg,png,gif",
                                    "thumbnail" => "0x100"
                                ],
                                "legend" => [
                                    "type" => "markdown",
                                    "height" => 80,
                                    "toolbar" => "BIUL"
                                ],
                                "tags" => [
                                    "label" => "Tags",
                                    "type" => "pivot",
                                    "addable" => true,
                                    "create_attribute" => "text",
                                    "repository" => '\App\Sharp\Photo\PhotoTagRepository'
                                ],
                            ]
                        ],

                        "card~number" => [
                            "label" => "Card number",
                            "type" => "text"
                        ],
                        "card~origin" => [
                            "label" => "Origin",
                            "type" => "choose",
                            "values" => [
                                "0" => "Unknown",
                                "1" => "Other Zoo",
                                "2" => "Wild life"
                            ],
                            "field_width"=>6
                        ],
                        "card~origin_zoo" => [
                            "label" => "Which one?",
                            "type" => "text",
                            "conditional_display" => 'card~origin:1',
                            "field_width"=>6
                        ],
                        "card~origin_country" => [
                            "label" => "From which country?",
                            "type" => "text",
                            "conditional_display" => 'card~origin:2',
                            "field_width"=>6
                        ],

                        "card-label" => [
                            "type"=>"label",
                            "format"=>"BelongsTo Relation"
                        ],

                        /*"show~title" => [
                            "label" => "Show title",
                            "type" => "text"
                        ],
                        "show~desc" => [
                            "label" => "Description",
                            "type" => "textarea"
                        ],
                        "show~date" => [
                            "label" => "Date of the show",
                            "type" => "date",
                            "has_time" => true
                        ],*/
                        "show-label" => [
                            "type"=>"label",
                            "format"=>"OneToOne Relation"
                        ],

                        "shows" => [
                            "label" => "Shows",
                            "type" => "embed_list",
                            "entity_category" => "africa",
                            "entity" => "show",
                            "renderer" => '\App\Sharp\Giraffe\Show\EmbedRenderer',
                            "sortable" => true,
                            "addable" => true,
                            "removable" => true,
                            "add_button_text" => "Add a show",
                            "item_id_attribute" => "id",
                            "order_attribute" => "order"
                        ],

                    ], // End of form fields

                    "form_layout" => [
                        "tab1" => [
                            "tab" => "Animal",
                            "col1" => [
                                "name",
                                "picture",
                                "zookeeper_id",
                                "age",
                                "height",
                                "particularities"
                            ],
                            "col2" => [
                                "desc",
                                "photos"
                            ]
                        ],
                        "tab2" => [
                            "tab" => "Card",
                            "col1" => [
                                "card-label",
                                "card~number",
                                "card~origin",
                                "card~origin_zoo",
                                "card~origin_country"
                            ],
                            "col2" => []
                        ],
                        "tab3" => [
                            "tab" => "Shows",
                            "col1" => [
                                "shows"
                            ],
                            "col2" => [

                            ]
                        ]
                    ]
                ],

                "zone" => "file:sharp_zone",

                "show" => [
                    "label"   => "Show",
                    "plural"  => "Shows",
                    "embedded" => true,

                    // Model
                    "repository" => '\App\Sharp\Giraffe\Show\Repository',
                    "validator" => '\App\Sharp\Giraffe\Show\Validator',

                    // Fields
                    "form_fields" => [
                        "title" => [
                            "label" => "Show title",
                            "type" => "text"
                        ],
                        "desc" => [
                            "label" => "Description",
                            "type" => "textarea"
                        ],
                        "date" => [
                            "label" => "Date of the show",
                            "type" => "date",
                            "has_time" => true
                        ],
                    ], // End of form fields

                    "form_layout" => [
                        "tab1" => [
                            "tab" => "",
                            "col1" => [
                                "title",
                                "date"
                            ],
                            "col2" => [
                                "desc"
                            ]
                        ]
                    ]
                ]
            ]
        ]
    ]
];

Note you can split this file into multiple files of entities. The syntax is:

(...)
"entities" => [
    "giraffe" => "file:sharp_giraffe",
(...)

Simply create a "sharp_giraffe.php" file, with the giraffe entity config.

Hope this will help.

Philippe

Le 13 mars 2015 à 11:41, oimken notifications@github.com a écrit :

I try to follow your doc to set up a demo, but the doc if for laravel 4, there are lots of differences, I stuck on very first step: create the cms config file.....

I already tried to put the config file "sharp.cms.giraffe.php" into "/config", and edit the "config/sharp.php"

"name" => "Sharp Demo", // "auth_service" => '\Quincy\Services\SharpAuth', "cms" => ['giraffe']

and change the file name to test: but I keep receiving the error message:

EntityConfigurationNotFoundException in SharpCmsConfig.php line 59: Category configuration for [] can't be found

would you please help me out? update the doc will be very helpful, or share a little sample that I could figure out how sharp works.

thank you for your kind help.

— Reply to this email directly or view it on GitHub.

oimken commented 9 years ago

WOO!!! Thanks for your quick reply, that is really fast!!! Thank you.

oimken commented 9 years ago

and I got another problem:

ReflectionException in Container.php line 776: Class \App\Sharp\Giraffe\Repository does not exist

where should I put the Repository Class into.

Is that:

create a Repositories directory in app folder. for example "app/Sharp/Giraffe"

and create a php file name "Repository.php"?

dvlpp commented 9 years ago

Yes, with an App\Sharp\Giraffe namespace.

Le 13 mars 2015 à 12:02, oimken notifications@github.com a écrit :

and I got another problem:

ReflectionException in Container.php line 776: Class \App\Sharp\Giraffe\Repository does not exist

where should I put the Repository Class into.

— Reply to this email directly or view it on GitHub.

oimken commented 9 years ago

I could not get it works...

I create the Repository, and got this:

MandatoryClassNotFoundException in SharpEntitiesList.php line 80: Repository [App\Sharp\Giraffe\Repository] has to implements \Dvlpp\Sharp\Repositories\SharpHasSublist in order to manage sublists

so I add "use Dvlpp\Sharp\Repositories\SharpHasSublist" to Repository.php, and change to "class Repository implements SharpHasSublist {" , and I got this:

FatalErrorException in Repository.php line 16: Interface 'Dvlpp\Sharp\Repositories\SharpHasSublist' not found

maybe I am too weak in php, I am a graphic designer actually, I just could not get the demo run.....

but I really like your "Sharp" idea, it will easy my work.
I am already looking for a simple and handy cms for a very long time. Sharp seems so attractive ... clean and nice and could be highly custom

could you send me a running sharp demo to my emal "oimken(#at#)gmail.com"? maybe this request is too much, but as you see, I am a very junior php fan, without a running demo, I almost could not do anything further...