Skip to content

Commit

Permalink
Fixes #390, Fixes #260: Create (bootstrap)-independent version
Browse files Browse the repository at this point in the history
  • Loading branch information
simialbi authored and samdark committed Dec 10, 2018
1 parent c02adc5 commit b7becd5
Show file tree
Hide file tree
Showing 73 changed files with 5,551 additions and 455 deletions.
12 changes: 0 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ php:
- 7.1
- 7.2

matrix:
include:
- php: hhvm
sudo: true
dist: trusty
group: edge
cache:
directories: "$HOME/.composer/cache"
before_install:
- wget https://phar.phpunit.de/phpunit-4.5.1.phar
script:
- php phpunit-4.5.1.phar --verbose $PHPUNIT_FLAGS
sudo: false

# cache vendor dirs
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Yii Framework 2 gii extension Change Log
2.1.0 under development
-----------------------

- no changes in this release.
- Enh #390, Bug #260: Create (bootstrap)-independent version (simialbi)


2.0.8 December 08, 2018
Expand Down
25 changes: 17 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "yiisoft/yii2-gii",
"description": "The Gii extension for the Yii framework",
"keywords": ["yii2", "gii", "code generator"],
"keywords": [
"yii2",
"gii",
"code generator"
],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
Expand All @@ -20,26 +24,31 @@
"minimum-stability": "dev",
"require": {
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap": "~2.0.0",
"phpspec/php-diff": ">=1.0.2",
"bower-asset/typeahead.js": "0.10.* | ~0.11.0"
"phpspec/php-diff": "^1.1.0"
},
"require-dev": {
"yiisoft/yii2-coding-standards": "~2.0",
"phpunit/phpunit": "<7"
},
"autoload": {
"psr-4": {
"yii\\gii\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"yiiunit\\gii\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"config": {
"process-timeout": 1800,
"fxp-asset": {
"installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
"enabled": false
}
},
"repositories": [
Expand Down
10 changes: 4 additions & 6 deletions src/GiiAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ class GiiAsset extends AssetBundle
{
public $sourcePath = '@yii/gii/assets';
public $css = [
'main.css',
'css/main.css',
];
public $js = [
'gii.js',
'js/bs4-native.min.js',
'js/gii.js',
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'yii\gii\TypeAheadAsset',
'yii\web\YiiAsset'
];
}
30 changes: 0 additions & 30 deletions src/TypeAheadAsset.php

This file was deleted.

2 changes: 2 additions & 0 deletions src/assets/css/main.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/assets/css/main.css.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/assets/js/bs4-native.min.js

Large diffs are not rendered by default.

42 changes: 13 additions & 29 deletions src/assets/gii.js → src/assets/js/gii.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,10 @@ yii.gii = (function ($) {
return true;
};

var initHintBlocks = function () {
$('.hint-block').each(function () {
var $hint = $(this);
$hint.parent().find('label').addClass('help').popover({
html: true,
trigger: 'hover',
placement: 'right',
content: $hint.html()
});
});
};

var initStickyInputs = function () {
$('.sticky:not(.error)').find('input[type="text"],select,textarea').each(function () {
var value;
var value,
element = document.createElement('div');
if (this.tagName === 'SELECT') {
value = this.options[this.selectedIndex].text;
} else if (this.tagName === 'TEXTAREA') {
Expand All @@ -56,7 +45,11 @@ yii.gii = (function ($) {
if (value === '') {
value = '[empty]';
}
$(this).before('<div class="sticky-value">' + value + '</div>').hide();
element.classList.add('sticky-value');
element.title = value;
element.innerHTML = value;
new Tooltip(element, {placement: 'right'});
$(this).before(element).hide();
});
$('.sticky-value').on('click', function () {
$(this).hide();
Expand Down Expand Up @@ -98,7 +91,10 @@ yii.gii = (function ($) {
}
$modal.find('.modal-title').text($link.data('title'));
$modal.find('.modal-body').html('Loading ...');
$modal.modal('show');

var modalInitJs = new Modal($modal[0]);
modalInitJs.show();

var checkbox = $('a.' + $modal.data('action') + '[href="' + $link.attr('href') + '"]').closest('tr').find('input').get(0);
var checked = false;
if (checkbox) {
Expand All @@ -107,7 +103,7 @@ yii.gii = (function ($) {
} else {
$modal.find('.modal-checkbox').addClass('disabled');
}
$modal.find('.modal-checkbox span').toggleClass('glyphicon-check', checked).toggleClass('glyphicon-unchecked', !checked);
$modal.find('.modal-checkbox').toggleClass('checked', checked).toggleClass('unchecked', !checked);

ajaxRequest = $.ajax({
type: 'POST',
Expand Down Expand Up @@ -144,7 +140,7 @@ yii.gii = (function ($) {
var $checkbox = $modal.data('current').closest('tr').find('input');
var checked = !$checkbox.prop('checked');
$checkbox.trigger('click');
$modal.find('.modal-checkbox span').toggleClass('glyphicon-check', checked).toggleClass('glyphicon-unchecked', !checked);
$modal.find('.modal-checkbox').toggleClass('checked', checked).toggleClass('unchecked', !checked);
return false;
};

Expand Down Expand Up @@ -199,19 +195,7 @@ yii.gii = (function ($) {
}).on("keyup", onKeyup);

return {
autocomplete: function (counter, data) {
var datum = new Bloodhound({
datumTokenizer: function (d) {
return Bloodhound.tokenizers.whitespace(d.word);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: data
});
datum.initialize();
jQuery('.typeahead-' + counter).typeahead(null, {displayKey: 'word', source: datum.ttAdapter()});
},
init: function () {
initHintBlocks();
initStickyInputs();
initPreviewDiffLinks();
initConfirmationCheckboxes();
Expand Down
Loading

0 comments on commit b7becd5

Please sign in to comment.