Skip to content

Commit

Permalink
Updates to release v1.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Aug 29, 2017
1 parent f623648 commit 2ca3b68
Show file tree
Hide file tree
Showing 21 changed files with 371 additions and 153 deletions.
127 changes: 127 additions & 0 deletions .github/CONTRIBUTING.md
@@ -0,0 +1,127 @@
Contributing to yii2-builder
============================
Looking to contribute something to yii2-builder? **Here's how you can help.**

Please take a moment to review this document in order to make the contribution
process easy and effective for everyone involved.

Following these guidelines helps to communicate that you respect the time of
the developers managing and developing this open source project. In return,
they should reciprocate that respect in addressing your issue or assessing
patches and features.

Using the issue tracker
-----------------------
When [reporting bugs][reporting-bugs] or
[requesting features][requesting-features], the
[issue tracker on GitHub][issue-tracker] is the recommended channel to use.

The issue tracker **is not** a place for support requests. Refer the
[extension documentation](http://demos.krajee.com/builder),
[extension demos](http://demos.krajee.com/builder-details/form) and/or refer to the
[webtips Q & A forum](http://webtips.krajee.com/questions) which are the better places to get help.

Reporting bugs with yii2-builder
--------------------------------
We really appreciate clear bug reports that _consistently_ show an issue
_within yii2-builder_.

The ideal bug report follows these guidelines:

1. **Use the [GitHub issue search][issue-search]** — Check if the issue
has already been reported.
2. **Check if the issue has been fixed** — Try to reproduce the problem
using the code in the `master` branch.
3. **Isolate the problem** — Try to share a demo or a test case that
consistently reproduces the problem.

Please try to be as detailed as possible in your bug report, especially if an
isolated test case cannot be made. Some useful questions to include the answer
to are:

- What steps can be used to reproduce the issue?
- What is the bug and what is the expected outcome?
- What browser(s) and Operating System have you tested with?
- Does the bug happen consistently across all tested browsers?
- What version of jQuery are you using? And what version of yii2-builder?
- Are you using yii2-builder with other plugins?

All of these questions will help others fix and identify any potential bugs.

Requesting features in yii2-builder
------------------------------------------
Before starting work on a major feature for yii2-builder, **read the
[documentation](http://demos.krajee.com/builder) first** or you may risk spending a considerable amount of
time on something which the project developers are not interested in bringing into the project.

### Submitting a pull request

We use GitHub's pull request system for submitting patches. Here are some
guidelines to follow when creating the pull request for your fix.

1. Make sure to create a ticket for your pull request. This will serve as the
bug ticket, and any discussion about the bug will take place there. Your pull
request will be focused on the specific changes that fix the bug.
2. Make sure to reference the ticket you are fixing within your pull request.
This will allow us to close off the ticket once we merge the pull request, or
follow up on the ticket if there are any related blocking issues.
3. Explain why the specific change was made. Not everyone who is reviewing your
pull request will be familiar with the problem it is fixing.
4. Run your tests first. If your tests aren't passing, the pull request won't
be able to be merged. If you're breaking existing tests, make sure that you
aren't causing any breaking changes.
5. Only include source changes. While it's not required, only including changes
from the `src` directory will prevent merge conflicts from occuring. Making
this happen can be as a simple as not committing changes from the `dist`
directory.

By following these steps, you will make it easier for your pull request to be
reviewed and eventually merged.

Triaging issues and pull requests
---------------------------------
Anyone can help the project maintainers triage issues and review pull requests.

### Handling new issues

yii2-builder regularly receives new issues which need to be tested and organized.

When a new issue that comes in that is similar to another existing issue, it
should be checked to make sure it is not a duplicate. Duplicates issues should
be marked by replying to the issue with "Duplicate of #[issue number]" where
`[issue number]` is the url or issue number for the existing issue. This will
allow the project maintainers to quickly close off additional issues and keep
the discussion focused within a single issue.

If you can test issues that are reported to yii2-builder that contain test cases and
confirm under what conditions bugs happen, that will allow others to identify
what causes a bug quicker.

### Reviewing pull requests

It is very common for pull requests to be opened for issues that contain a clear
solution to the problem. These pull requests should be rigorously reviewed by
the community before being accepted. If you are not sure about a piece of
submitted code, or know of a better way to do something, do not hesitate to make
a comment on the pull request.

### Reviving old tickets

If you come across tickets which have not been updated for a while, you are
encouraged to revive them. While this can be as simple as saying `:+1:`, it is
best if you can include more information on the issue. Common bugs and feature
requests are more likely to be fixed, whether it is by the community or the
developers, so keeping tickets up to date is encouraged.

Licensing
---------

It should also be made clear that **all code contributed to yii2-builder** must be
licensable under the [BSD-3 license][licensing]. Code that cannot be released
under this license **cannot be accepted** into the project.

[issue-search]: https://github.com/kartik-v/yii2-builder/search?q=&type=Issues
[issue-tracker]: https://github.com/kartik-v/yii2-builder/issues
[licensing]: https://github.com/kartik-v/yii2-builder/blob/master/LICENSE.md
[reporting-bugs]: #reporting-bugs-with-yii2-builder
[requesting-features]: #requesting-features-in-yii2-builder
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,47 @@
## Prerequisites

- [ ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- [ ] The issue still exists against the latest `master` branch of yii2-builder.
- [ ] This is not an usage question. I confirm having gone through and read the [documentation](http://demos.krajee.com/builder) and [demo](http://demos.krajee.com/builder-details/form-grid).
- [ ] This is not a general programming / coding question. (Those should be directed to the [webtips Q & A forum](http://webtips.krajee.com/questions)).
- [ ] I have attempted to find the simplest possible steps to reproduce the issue.
- [ ] I have included a failing test as a pull request (Optional).

## Steps to reproduce the issue

1.
2.
3.

## Expected behavior and actual behavior

When I follow those steps, I see...

I was expecting...

## Environment

#### Browsers

- [ ] Google Chrome
- [ ] Mozilla Firefox
- [ ] Internet Explorer
- [ ] Safari

#### Operating System

- [ ] Windows
- [ ] Mac OS X
- [ ] Linux
- [ ] Mobile

#### Libraries

- jQuery version:
- yii2-builder version:

## Isolating the problem

- [ ] This bug happens [on the demos page](https://demos.krajee.com/builder-details/form-grid)
- [ ] The bug happens consistently across all tested browsers
- [ ] This bug happens when using yii2-builder without other plugins.
16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,16 @@
## Scope
This pull request includes a

- [ ] Bug fix
- [ ] New feature
- [ ] Translation

## Changes
The following changes were made (this change is also documented in the [change log](https://github.com/kartik-v/yii2-builder/blob/master/CHANGE.md)):

-
-
-

## Related Issues
If this is related to an existing ticket, include a link to it as well.
4 changes: 2 additions & 2 deletions ActiveFormEvent.php
Expand Up @@ -2,8 +2,8 @@
/**
* @package yii2-builder
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @version 1.6.2
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2017
* @version 1.6.3
*/

namespace kartik\builder;
Expand Down
60 changes: 36 additions & 24 deletions BaseForm.php
Expand Up @@ -3,8 +3,8 @@
/**
* @package yii2-builder
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @version 1.6.2
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2017
* @version 1.6.3
*/

namespace kartik\builder;
Expand Down Expand Up @@ -127,7 +127,7 @@ class BaseForm extends Widget
self::INPUT_FILE,
self::INPUT_HTML5,
self::INPUT_WIDGET,
self::INPUT_RAW
self::INPUT_RAW,
];

/**
Expand All @@ -139,7 +139,7 @@ class BaseForm extends Widget
self::INPUT_TEXTAREA => true,
self::INPUT_FILE => true,
self::INPUT_HIDDEN => true,
self::INPUT_STATIC => true
self::INPUT_STATIC => true,
];

/**
Expand All @@ -152,7 +152,7 @@ class BaseForm extends Widget
self::INPUT_RADIO_LIST => true,
self::INPUT_CHECKBOX_BUTTON_GROUP => true,
self::INPUT_RADIO_BUTTON_GROUP => true,
self::INPUT_MULTISELECT => true
self::INPUT_MULTISELECT => true,
];

/**
Expand Down Expand Up @@ -239,17 +239,6 @@ class BaseForm extends Widget
*/
public $staticOnly = false;

/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
static::prepareAttributes($this->attributes);
$this->checkBaseConfig();
}

/**
* Prepares attributes based on visibility setting
*
Expand All @@ -275,7 +264,7 @@ protected static function prepareAttributes(&$attributes = [])
* @param string $attribute the name of the attribute.
* @param array $settings the attribute settings.
*
* @return ActiveField
* @return string
* @throws InvalidConfigException
*
*/
Expand Down Expand Up @@ -336,7 +325,9 @@ protected static function renderRawActiveInput($form, $model, $attribute, $setti
$i = strpos($attribute, ']');
$attribName = $i > 0 ? substr($attribute, $i + 1) : $attribute;
if (!in_array($type, static::$_validInputs)) {
throw new InvalidConfigException("Invalid input type '{$type}' configured for the attribute '{$attribName}'.'");
throw new InvalidConfigException(
"Invalid input type '{$type}' configured for the attribute '{$attribName}'.'"
);
}
$fieldConfig = ArrayHelper::getValue($settings, 'fieldConfig', []);
$options = ArrayHelper::getValue($settings, 'options', []);
Expand All @@ -352,11 +343,13 @@ protected static function renderRawActiveInput($form, $model, $attribute, $setti
if ($type === self::INPUT_HIDDEN_STATIC) {
$staticOptions = ArrayHelper::getValue($settings, 'hiddenStaticOptions', []);
return static::getInput($field->staticInput($staticOptions), $label, $hint) .
static::getInput($field->hiddenInput($options));
static::getInput($field->hiddenInput($options));
}
if (isset(static::$_dropdownInputs[$type])) {
if (!isset($settings['items'])) {
throw new InvalidConfigException("You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'.");
throw new InvalidConfigException(
"You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'."
);
}
return static::getInput($field->$type($settings['items'], $options), $label, $hint);
}
Expand All @@ -374,7 +367,9 @@ protected static function renderRawActiveInput($form, $model, $attribute, $setti
if ($type === self::INPUT_WIDGET) {
$widgetClass = ArrayHelper::getValue($settings, 'widgetClass', []);
if (empty($widgetClass) && !$widgetClass instanceof InputWidget) {
throw new InvalidConfigException("A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'.");
throw new InvalidConfigException(
"A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'."
);
}
return static::getInput($field->$type($widgetClass, $options), $label, $hint);
}
Expand All @@ -400,7 +395,9 @@ protected static function renderRawInput($attribute, &$id, $settings = [])
$i = strpos($attribute, ']');
$attribName = $i > 0 ? substr($attribute, $i + 1) : $attribute;
if (!in_array($type, static::$_validInputs)) {
throw new InvalidConfigException("Invalid input type '{$type}' configured for the attribute '{$attribName}'.'");
throw new InvalidConfigException(
"Invalid input type '{$type}' configured for the attribute '{$attribName}'.'"
);
}
$value = ArrayHelper::getValue($settings, 'value', null);
$options = ArrayHelper::getValue($settings, 'options', []);
Expand Down Expand Up @@ -433,7 +430,9 @@ protected static function renderRawInput($attribute, &$id, $settings = [])
}
if (isset(static::$_dropdownInputs[$type])) {
if (!isset($settings['items'])) {
throw new InvalidConfigException("You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'.");
throw new InvalidConfigException(
"You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'."
);
}
$items = ArrayHelper::getValue($settings, 'items', []);
return Html::$type($attribute, $value, $items, $options);
Expand All @@ -451,7 +450,9 @@ protected static function renderRawInput($attribute, &$id, $settings = [])
if ($type === self::INPUT_WIDGET) {
$widgetClass = ArrayHelper::getValue($settings, 'widgetClass', []);
if (empty($widgetClass) && !$widgetClass instanceof InputWidget) {
throw new InvalidConfigException("A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'.");
throw new InvalidConfigException(
"A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'."
);
}
$options['name'] = $attribute;
$options['value'] = $value;
Expand Down Expand Up @@ -482,4 +483,15 @@ protected static function getInput($field, $label = null, $hint = null)
}
return $field;
}

/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
static::prepareAttributes($this->attributes);
$this->checkBaseConfig();
}
}

0 comments on commit 2ca3b68

Please sign in to comment.