Skip to content

Commit

Permalink
Update to release v1.7.4 fix #97 fix #98 fix #101 fix #102
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jan 11, 2016
1 parent 1fdc286 commit 888e31c
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 257 deletions.
8 changes: 7 additions & 1 deletion CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ Change Log: `yii2-detail-view`

## Version 1.7.4

**Date:** 18-Sep-2015
**Date:** 11-Jan-2016

- (bug #86): Fix Inflector class dependency.
- (enh #87): Add ability to show values as not set when empty.
- (enh #89): Fix documentation for type to correct constant.
- (enh #93): Add Polish translations.
- (enh #97): Enhance widget to parse visible attributes correctly.
- (enh #98): CSS Styling enhancements for `table-condensed`.
- (enh #101): Enhance plugin and widget with destroy method.
- (enh #102): Enhancements for PJAX reinitialization. Complements enhancements in kartik-v/yii2-krajee-base#52 and kartik-v/yii2-krajee-base#53.

## Version 1.7.3

Expand Down
388 changes: 197 additions & 191 deletions DetailView.php

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions DetailViewAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
/**
* @package yii2-detail-view
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @version 1.7.4
*/

namespace kartik\detail;

use kartik\base\AssetBundle;

/**
* Asset bundle for DetailView Widget
*
* @author Kartik Visweswaran <[email protected]>
* @since 1.0
*/
class DetailViewAsset extends \kartik\base\AssetBundle
class DetailViewAsset extends AssetBundle
{
/**
* @inherit doc
* @inheritdoc
*/
public function init()
{
Expand All @@ -27,5 +29,4 @@ public function init()
$this->setupAssets('css', ['css/kv-detail-view']);
parent::init();
}

}
}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 - 2015, Kartik Visweswaran
Copyright (c) 2014 - 2016, Kartik Visweswaran
Krajee.com
All rights reserved.

Expand Down
57 changes: 33 additions & 24 deletions assets/css/kv-detail-view.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*!
* @package yii2-detail-view
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @version 1.7.4
*
* Styles for yii2-detail-view extension
*
* Author: Kartik Visweswaran
* Copyright: 2014 - 2015, Kartik Visweswaran, Krajee.com
* Copyright: 2014 - 2016, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
Expand All @@ -30,13 +30,14 @@
background: #ffffff url('../img/loading.gif') top 15px right 15px no-repeat;
}

.kv-detail-loading * {
.kv-detail-loading * {
background: transparent !important;
}

.kv-detail-loading td {
border-color: #efefef !important;
}

.kv-edit-mode .kv-detail-view {
overflow-y: hidden;
}
Expand All @@ -46,7 +47,7 @@
}

.kv-edit-mode table {
overflow:hidden;
overflow: hidden;
}

.kv-child-table {
Expand All @@ -55,8 +56,8 @@

.kv-child-table-row, .kv-child-table-row > td {
vertical-align: middle;
padding: 0!important;
margin: 0!important;
padding: 0 !important;
margin: 0 !important;
}

.kv-child-table-cell {
Expand All @@ -66,22 +67,30 @@
overflow: hidden;
}

.kv-child-table-row th {
border-left: 1px #ddd solid;
border-right: 1px #ddd solid;
}

.kv-child-table td, .kv-child-table th {
margin: 0;
background: transparent;

}

.table .kv-child-table > tbody > tr > td, .table .kv-child-table > tbody > tr > th {
padding: 8px;
background: transparent;
}

.kv-child-table-row th {
border-left: 1px #ddd solid;
border-right: 1px #ddd solid;
.table-condensed .kv-child-table > tbody > tr > td, .table-condensed .kv-child-table > tbody > tr > th {
padding: 5px;
}

.kv-action-btn {
margin:0 2px;
padding:0 5px;
background:none;
border:none;
margin: 0 2px;
padding: 0 5px;
background: none;
border: none;
font-size: 16px;
}

Expand All @@ -90,41 +99,41 @@
}

.panel-primary .kv-action-btn {
color:#d9edf7;
color: #d9edf7;
}

.panel-primary .kv-action-btn:hover {
color:#c4e3f3;
color: #c4e3f3;
}

.panel-info .kv-action-btn {
color:#31708f;
color: #31708f;
}

.panel-info .kv-action-btn:hover {
color:#245269;
color: #245269;
}

.panel-warning .kv-action-btn {
color:#8a6d3b;
color: #8a6d3b;
}

.panel-warning .kv-action-btn:hover {
color:#66512c;
color: #66512c;
}

.panel-danger .kv-action-btn {
color:#a94442;
color: #a94442;
}

.panel-danger .kv-action-btn:hover {
color:#843534;
color: #843534;
}

.panel-success .kv-action-btn {
color:#3c763d;
color: #3c763d;
}

.panel-success .kv-action-btn:hover {
color:#2b542c;
color: #2b542c;
}
6 changes: 3 additions & 3 deletions assets/css/kv-detail-view.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 44 additions & 28 deletions assets/js/kv-detail-view.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
/*!
* @package yii2-detail-view
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @version 1.7.4
*
* Client extension for the yii2-detail-view extension
*
* Author: Kartik Visweswaran
* Copyright: 2014 - 2015, Kartik Visweswaran, Krajee.com
* Copyright: 2014 - 2016, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/

(function ($) {
"use strict";

var NAMESPACE, events;
NAMESPACE = '.kvDetailView';
events = {
click: 'click' + NAMESPACE,
afterValidate: 'afterValidate' + NAMESPACE
};

var KvDetailView = function (element, options) {
var self = this;
self.$element = $(element);
Expand All @@ -31,7 +37,7 @@
self.initElements();
self.listen();
},
alert: function(type, msg) {
alert: function (type, msg) {
var self = this, css;
css = self.alertMessageSettings[type];
if (msg) {
Expand All @@ -41,49 +47,58 @@
return '';
},
initAlert: function () {
var self = this, $alert = self.$element.find('.kv-alert-container');
$alert.find('.alert .close').each(function() {
var self = this, $alert = self.$element.find('.kv-alert-container'), eClick = events.click;
$alert.find('.alert .close').each(function () {
var $el = $(this);
$el.off('click').on('click', function() {
setTimeout(function() {
if (!$alert.find('.alert').length) {
$el.off(eClick).on(eClick, function () {
setTimeout(function () {
if (!$alert.find('.alert').length) {
$alert.hide();
}
}, 300);
});
});
});
},
destroy: function () {
var self = this, eClick = events.click, eValidate = events.afterValidate;
self.$btnSave.off(eClick);
self.$btnUpdate.off(eClick);
self.$btnView.off(eClick);
self.$btnDelete.off(eClick);
self.$element.find('.kv-detail-view').closest('form').off(eValidate);
self.$element.find('.kv-alert-container .alert .close').off(eClick);
},
listen: function () {
var self = this, $alert = self.$element.find('.kv-alert-container'),
$detail = self.$element.find('.kv-detail-view');
$detail.closest('form').on('afterValidate', function (event, messages) {
var self = this, $alert = self.$element.find('.kv-alert-container'), eClick = events.click,
eValidate = events.afterValidate, $detail = self.$element.find('.kv-detail-view');
$detail.closest('form').off(eValidate).on(eValidate, function (event, messages) {
if (messages !== undefined) {
$detail.removeClass('kv-detail-loading');
}
});
self.$btnSave.on('click', function () {
self.$btnSave.off(eClick).on(eClick, function () {
$alert.hide();
$detail.removeClass('kv-detail-loading').addClass('kv-detail-loading');
});
self.$btnUpdate.on('click', function () {
self.$btnUpdate.off(eClick).on(eClick, function () {
self.setMode('edit');
});
self.$btnView.on('click', function () {
self.$btnView.off(eClick).on(eClick, function () {
self.setMode('view');
});
self.$btnDelete.on('click', function (ev) {
var $el = $(this), params = self.deleteParams, confirmMsg = self.deleteConfirm,
settings = self.deleteAjaxSettings || {};
self.$btnDelete.off(eClick).on(eClick, function (ev) {
var $el = $(this), params = self.deleteParams, confirmMsg = self.deleteConfirm,
settings = self.deleteAjaxSettings || {};
ev.preventDefault();
if (confirmMsg && !confirm(confirmMsg)) {
if (confirmMsg && !confirm(confirmMsg)) {
return;
}
settings = $.extend({
type: 'post',
dataType: 'json',
data: params,
url: $el.attr('href'),
beforeSend: function() {
beforeSend: function () {
$alert.html('').hide();
$detail.removeClass('kv-detail-loading').addClass('kv-detail-loading');
},
Expand All @@ -94,20 +109,21 @@
self.$btnUpdate.attr('disabled', 'disabled');
self.$btnView.attr('disabled', 'disabled');
self.$btnSave.attr('disabled', 'disabled');
};
$.each(data.messages, function(key, msg) {
}
$.each(data.messages, function (key, msg) {
$alert.append(self.alert(key, msg));
});
$alert.hide().fadeIn('slow', function() {
$detail.removeClass('kv-detail-loading');
self.initAlert();
$alert.hide().fadeIn('slow', function () {
$detail.removeClass('kv-detail-loading');
self.initAlert();
});
},
error: function(xhr, txt, err) {
error: function (xhr, txt, err) {
var msg = '';
if (self.showErrorStack) {
msg = xhr.responseText ? $(xhr.responseText).text() : '';
msg = msg && msg.length ? '<pre>' + $.trim(msg).replace(/\n\s*\n/g, '\n').replace(/\</g, '&lt;') + '</pre>' : '';
msg = msg && msg.length ? '<pre>' + $.trim(msg).replace(/\n\s*\n/g, '\n')
.replace(/</g, '&lt;') + '</pre>' : '';
}
msg = self.alert('kv-detail-error', err + msg);
$detail.removeClass('kv-detail-loading');
Expand Down
Loading

0 comments on commit 888e31c

Please sign in to comment.