Skip to content

Commit

Permalink
On branch master
Browse files Browse the repository at this point in the history
 Initial commit
	new file:   LICENSE
	new file:   README.md
	new file:   YasheenaGiiAsset.php
	new file:   assets/yasheenaGii.css
	new file:   assets/yasheenaGii.js
	new file:   composer.json
	new file:   generators/crud/Generator.php
	new file:   generators/crud/default/_controller.php
	new file:   generators/crud/default/controller.php
	new file:   generators/crud/default/search.php
	new file:   generators/crud/default/views/_form.php
	new file:   generators/crud/default/views/_index.php
	new file:   generators/crud/default/views/create.php
	new file:   generators/crud/default/views/index.php
	new file:   generators/crud/default/views/update.php
	new file:   generators/crud/default/views/view.php
	new file:   generators/crud/form.php
	new file:   generators/crud/valuestore.php
  • Loading branch information
yasheena committed Nov 19, 2016
0 parents commit 3f76e39
Show file tree
Hide file tree
Showing 18 changed files with 2,265 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 Wolfgang Mattis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
CRUD Generator for repeated use
===============================

This packet contains a CRUD generator for the framework YII2.

This generator generates a controller and views that implement CRUD operations for the specified data model using the great modules of kartik-v.

Many parameters of the Grid can be defined and this data is stored for reusing the generator to update the Grid settings till final version. This settings inculdes the handling of foreign keys, search fields, column formats, withs, visibility, order, labels and alignment and also additional buttons (including glyphicons) in the footer area for actions and mass actions.

The template is splitted into two parts, so you can write already code in one part and update settings of the grid in the other part by using the generator.

Installation
------------

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist yasheena/yii2-gii "*"
```

or add

```
"yasheena/yii2-gii": "*"
```

to the require section of your `composer.json` file.


Usage
-----

Once the extension is installed, you can find a new CRUD generator in your generator list.
19 changes: 19 additions & 0 deletions YasheenaGiiAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace yasheena\gii;

use yii\web\AssetBundle;

class YasheenaGiiAsset extends AssetBundle
{
public $sourcePath = '@vendor/yasheena/yii2-gii/assets';
public $js = ['yasheenaGii.js'];
public $css = ['yasheenaGii.css'];
public $depends = [
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
];
public $publishOptions = [
'forceCopy' => true,
];
}
78 changes: 78 additions & 0 deletions assets/yasheenaGii.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

.coltab {
border: 1px solid gray;
width: -moz-max-content;
}

.coltab td,th {
border: 1px solid gray;
padding: 10px 10px 0px 10px;
}

.col_order {
width: 80px;
}

.col_name {
}

.col_visible {
width: 120px;
}

.col_align {
width: 110px;
}

.col_replace {
}

.col_width {
width: 95px;
}

.col_format {
width: 135px;
}

.col_search {
width: 105px;
}

.col_label {
}

.container {
margin-left: 0px !important;
}

.btn_label {
}

.btn_url {
width: 350px;
}

.btn_icon {
}

.btn_icon_pic {
width: 35px;
}

.btn_hint {
width: 500px;
}

.glyphicon {
display: block !important;
}

.field-generator-viewpath .generator-loadview {
float: left;
}

.field-generator-basecontrollerclass {
clear: left;
}
.
46 changes: 46 additions & 0 deletions assets/yasheenaGii.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
yii.yasheenaGii = (function ($) {
return {
init: function () {
// hide left button definition when checkbox column is disabled
$('form #generator-dat_use_checkboxcolumn').change(function () {
$('form .field-generator-dat_lft_button').toggle($(this).is(':checked'));
$('form #generator-dat_lft_button').trigger('change');
}).change();
// update form depending on the left button settings
$('form #generator-dat_lft_button').change(function () {
// if left button is set to none, hide left button entries table
$('form .field-generator-lft_table').toggle(
!$('input[name="Generator[dat_lft_button]"][value="None"]').is(':checked')
&& $('#generator-dat_use_checkboxcolumn').is(':checked')
);
// if it is not a dropdown, hide line for defining dropdown button
$('form #generator-lft-line-0').toggle(
$('input[name="Generator[dat_lft_button]"][value="Dropdown"]').is(':checked')
);
// if left button is not set to none, hide datafield selection of checkboxcolumn
$('form .field-generator-checkbox-field').toggle(
$('input[name="Generator[dat_lft_button]"][value="None"]').is(':checked')
&& $('#generator-dat_use_checkboxcolumn').is(':checked')
);
}).change();
// if right button is set to none, hide right button entries table
$('form #generator-dat_rgt_button').change(function () {
$('form .field-generator-rgt_table').toggle(
!$('input[name="Generator[dat_rgt_button]"][value="None"]').is(':checked')
);
// if it is not a dropdown, hide line for defining dropdown button
$('form #generator-rgt-line-0').toggle(
$('input[name="Generator[dat_rgt_button]"][value="Dropdown"]').is(':checked')
);
}).change();
// update the icon depending on dropdown list for the left und right button entries
$('form .generator-button-dropdown').change(function () {
var id = $(this).attr('id');
$('form #' + id + '-icon').removeClass();
if ($(this).val() != '---') {
$('form #' + id + '-icon').toggleClass('glyphicon glyphicon-' + $(this).val(), true);
}
}).change();
}
}
})(jQuery);
22 changes: 22 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "yasheena/yii2-gii",
"description": "This is a CRUD generator for the framework YII2, which is highly configurable and allows reusing the generator till final version.",
"type": "yii2-extension",
"keywords": ["yii2","extension","gii","generator"],
"license": "MIT",
"authors": [
{
"name": "Wolfgang Mattis",
"email": "[email protected]"
}
],
"require": {
"yiisoft/yii2": "*",
"yasheena/view": "*"
},
"autoload": {
"psr-4": {
"yasheena\\gii\\": ""
}
}
}
Loading

0 comments on commit 3f76e39

Please sign in to comment.