{"id":28754321,"url":"https://github.com/zeroasterisk/cakephp-eip","last_synced_at":"2025-08-25T17:03:57.970Z","repository":{"id":137932800,"uuid":"9324874","full_name":"zeroasterisk/CakePHP-Eip","owner":"zeroasterisk","description":"Edit in Place Plugin (Helper/Component) for CakePHP (requires jquery)","archived":false,"fork":false,"pushed_at":"2014-02-06T17:47:34.000Z","size":468,"stargazers_count":14,"open_issues_count":5,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T01:09:03.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeroasterisk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-09T15:42:00.000Z","updated_at":"2022-05-27T01:08:34.000Z","dependencies_parsed_at":"2023-03-14T01:30:44.110Z","dependency_job_id":null,"html_url":"https://github.com/zeroasterisk/CakePHP-Eip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zeroasterisk/CakePHP-Eip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Eip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Eip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Eip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Eip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroasterisk","download_url":"https://codeload.github.com/zeroasterisk/CakePHP-Eip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Eip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272100683,"owners_count":24873442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-17T01:08:23.511Z","updated_at":"2025-08-25T17:03:57.955Z","avatar_url":"https://github.com/zeroasterisk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Eip: Edit in Place for CakePHP\n===================\n\nThis is a helper to simplify Edit in Place functionality in CakePHP views\n\nValidation is done in the Model, optionally also in the View (currently little\n)\n\n[Demo Screencast](http://screencast.com/t/gwCPpjqIPg) (2:21)\n\n* https://github.com/zeroasterisk/CakePHP-Eip\n* Author:      Alan Blount\n* Author URL:  http://zeroasterisk.com/\n* Copyright (c) 2013 Alan Blount\n* Licensed under The MIT License\n\nInspiration from:\n\n* https://github.com/kareypowell/CakePHP-InPlace-Editing\n* Author:      Karey H. Powell\n* Author URL:  http://kareypowell.com/\n* Copyright (c) 2012 Karey H. Powell\n* Licensed under The MIT License\n\nHuge credit to the fantastic X-editable library:\n\n* http://vitalets.github.io/x-editable/index.html\n* http://github.com/vitalets/x-editable\n* Author:      Vitaliy Potapov\n* Author URL:  https://github.com/vitalets\n\nRequirements\n-----------------\n\n* @requires bootstrapjs or jquery or zepto (not included in this repo)\n* @requires http://vitalets.github.io/x-editable/ (included in this repo)\n\nInstall\n-----------------\n\n```\ngit clone https://github.com/zeroasterisk/CakePHP-Eip.git app/Plugin/Eip\n```\n\nDecide on a supported Library.\n\n* Bootstrap\n* jQueryUI\n* jQuery\n\nFor more information on these options check out\n(X-editable)[http://vitalets.github.io/x-editable/index.html]\n\nAll following examples assume bootstrap is chosen\n(others are included in this package, you just have to move them into place appropriatly)\n\nSetup Library JS/CSS: Method A: symlink\n-----------------\n\n```\ncd app/webroot\nln -s ../Plugin/Eip/webroot/bootstrap-editable/bootstrap-editable eip\n```\n\nSetup Library JS/CSS: Method B: copy the directory\n-----------------\n\n```\ncd app/webroot\ncp -r ../Plugin/Eip/webroot/bootstrap-editable/bootstrap-editable eip\n```\n\nSetup the Config file (for option defaulting)\n-----------------\n\nA basic config file has been included in the package, just copy it into place\nand edit...\n\n```\ncd app/Config\ncp ../Plugin/Eip/Config/eip.php ./\n```\n\nIf you already have a config file that is being loaded, you can also use that one\n\n```\n$config['Eip'] = array(\n\t...\n);\n```\n\nConfigure\n-----------------\n\nAdd the following to `app/Config/bootstrap.php`\n\n```\nCakePlugin::load('Eip');\n```\n\nConfigure: Edit app/Config/eip.php\n-----------------\n\nThe `app/Config/eip.php` file is the easiest way to configure Eip.\n\nIt allows you to setup sitewide configurations for Eip, but you can still\noverride these configuration on a per-controller basis by passing in settings\nwhen initializing the helper.\n\nAlso, the config file is only loaded when the helper is iniitalized, so there's\nno extra applicaiton latency on controllers which don't load the helper.\n\nConfigure: Pass in settings when loading the helpers\n-----------------\n\n```\nClass SomethingController extends AppController {\n\tpublic $helpers = array(\n\t\t'Eip.Eip' =\u003e array(\n\t\t\t'pathToJs' =\u003e '...',\n\t\t\t'pathToJs' =\u003e '...',\n\t\t\t'options' =\u003e array(...)\n\t\t),\n\t)\n}\n```\n\n\nUsage\n-----------------\n\n*Controller*\n\n```\npublic $helpers = array('Eip.Eip');\n\npublic $components = array('Eip.Eip');\n\n/**\n * simple option \u0026 lazy option\n * no view needed\n */\npublic function eip() {\n\t$this-\u003eEip-\u003eauto('Page');\n}\n\n/**\n * manual option offers more control and doesn't break MVC\n * view needed\n */\npublic function eipManual() {\n\tif (!$this-\u003emyOwnSecurity($this-\u003eAuth-\u003euser())) {\n\t\treturn $this-\u003eredirect('/');\n\t}\n\t$data = $this-\u003eEip-\u003esetupData('Page', array('Page' =\u003e array('is_active' =\u003e 1)));\n\t$saved = $this-\u003ePage-\u003esave($data);\n\t$this-\u003eset(compact('data', 'saved'));\n}\n```\n\n*View*\n\nIn the view where you want the Edit in Place text to show (index, view, etc)\n\n```\n\u003c?php echo $this-\u003eEip-\u003einput('Page.title', $page); ?\u003e \u003c!-- no hover title --\u003e\n\u003c?php echo $this-\u003eEip-\u003einput('Page.title_alt', $page, 'Alternate Title of Page'); ?\u003e\n\u003c?php echo $this-\u003eEip-\u003einput('Page.title_head', $page, array('title' =\u003e 'Title of Page in the header')); ?\u003e\n\u003c?php echo $this-\u003eEip-\u003einput('Page.title_other', $page, $options); ?\u003e \u003c!-- see list of options below --\u003e\n```\n\n*Layout*\n\n```\n\u003c?php\n// At the bottom of the page\n// might already be there (non-inlined JS from HtmlHelper)\n// http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::scriptBlock\necho $this-\u003efetch('script');\n```\n\nOptions\n-----------------\n\nFor more details on options see\n(X-editable)[http://vitalets.github.io/x-editable/docs.html#editable]\n\nYou may set these options anywhere you like. Here's the load order (later overwrites)\n\n* in the config file,\n* or in the `$helper` variable options, in the controller\n* or in the `$this-\u003eEip-\u003einput($path, $data, $options);` parameter, in the view\n\n```\n$options = array(\n\t// -----------------------\n\t// options for container on page \u0026 data setup\n\t// url to be submit to via ajax (array or string)\n\t//   (or it can be a custom JS function instead of an ajax url)\n\t//   the default will end up being on the current prefix/controller\n\t//     with the 'action' of 'eip'\n\t'url' =\u003e array('action' =\u003e 'eip'),\n\t// if empty, will attempt to get from the data\n\t//   translates to 'pk' option in x-editable\n\t'id' =\u003e null,\n\t// if set, overrides the display of the Eip\n\t'display' =\u003e null,\n\t// wrapper container\n\t'element' =\u003e 'span',\n\t// wrapper class for container\n\t'elementClass' =\u003e 'eip-wrap',\n\t// title/tooltip\n\t'title' =\u003e null,\n\t// rel\n\t'rel' =\u003e null,\n\t// -----------------------\n\t// options for input\n\t// Type of input. Can be text|textarea|select|date|checklist and more\n\t'type' =\u003e 'text',\n\t'mode' =\u003e 'popup', // inline or popup\n\t// -----------------------\n\t// x-editable options which are passed through \"as is\" if not null\n\t//   for more info: http://vitalets.github.io/x-editable/docs.html\n\t'ajaxOptions' =\u003e null,\n\t'anim' =\u003e null,\n\t'autotext' =\u003e null,\n\t'disabled' =\u003e null,\n\t'emptyclass' =\u003e null,\n\t'emptytext' =\u003e null, // placeholder\n\t'name' =\u003e null, // taken from id attribute\n\t'onblur' =\u003e null,\n\t'params' =\u003e null,\n\t'placement' =\u003e null,\n\t'savenochange' =\u003e null,\n\t'selector' =\u003e null,\n\t'send' =\u003e null,\n\t'showbuttons' =\u003e null,\n\t'success' =\u003e null,\n\t'toggle' =\u003e null,\n\t'validate' =\u003e null, // custom clientside validation\n\t'value' =\u003e null, // Initial value of input. If not set, taken from element's text.\n\t// x-editable options for other input types\n\t'inputclass' =\u003e null,\n\t'tpl' =\u003e null,\n\t// textarea\n\t'rows' =\u003e null,\n\t// select \u0026 checklist\n\t'source' =\u003e null,\n\t'prepend' =\u003e null, // empty option\n\t'sourceCache' =\u003e null,\n\t'sourceError' =\u003e null,\n\t'separator' =\u003e null, // checklist only\n\t// date\n\t'format' =\u003e null,\n\t'viewformat' =\u003e null,\n\t'datepicker' =\u003e null,\n\t'clear' =\u003e null,\n\t// combodate\n\t//   \u003cscript src=\"js/moment.min.js\"\u003e\u003c/script\u003e\n\t'template' =\u003e null,\n\t'combodate' =\u003e null,\n\t// wysihtml5\n\t//   Wysihtml5 default options.\n\t//   https://github.com/jhollingworth/bootstrap-wysihtml5#options\n\t'wysihtml5' =\u003e null,\n);\n```\n\nExceptions\n----------------\n\nWant to customize the feedback for error / exception handling?\n\nNo Problem... just create the EipDataException class somewhere before the\nEipComponent is initialized into the controller, and your Exception handler\ntakes over rendering.\n\nNote: it must return a non-200 Http Status code...\n\n\tclass EipDataException extends CakeException {\n\t\tprotected $_messageTemplate = '%s %s';\n\t\tpublic function __construct($message, $data=null, $debugOnly=null) {\n\t\t\theader(\"HTTP/1.0 417 Expectation Failed\");\n\t\t\tif (!empty($data)) {\n\t\t\t\t$data = preg_replace('#[^a-zA-Z0-9 \\-\\_:]+#', ' ', json_encode($data));\n\t\t\t\t$data = \"($data)\";\n\t\t\t}\n\t\t\techo sprintf($this-\u003e_messageTemplate, $message, $data);\n\t\t\tif (Configure::read('debug') \u003e 2) {\n\t\t\t\techo json_encode($debugOnly);\n\t\t\t}\n\t\t\texit;\n\t\t}\n\t}\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroasterisk%2Fcakephp-eip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroasterisk%2Fcakephp-eip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroasterisk%2Fcakephp-eip/lists"}