diff --git a/CHANGELOG.md b/CHANGELOG.md
index a212ce7..f1df7e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## 1.0.1 - 2018-10-19
+### Added
+- Added support for advanced language level for Content Quality module
+
+### Changed
+- Page slideout directive has been updated
+
## 1.0.0 - 2018-10-11
### Added
- Initial release
diff --git a/composer.json b/composer.json
index dc80073..6a02392 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "inalgiev/craft-webtexttool",
"description": "Webtexttool is the easiest way to make your website content SEO proof, resulting in higher search engine rankings and more traffic to your website. With webtexttool everyone can create great content and make sure it's SEO proof at the same time.",
"type": "craft-plugin",
- "version": "1.0.0",
+ "version": "1.0.1",
"keywords": [
"craft",
"cms",
diff --git a/src/Webtexttool.php b/src/Webtexttool.php
index a7e27f5..8547e22 100644
--- a/src/Webtexttool.php
+++ b/src/Webtexttool.php
@@ -67,7 +67,7 @@ class Webtexttool extends Plugin
*
* @var string
*/
- public $schemaVersion = '1.0.0';
+ public $schemaVersion = '1.0.1';
public $hasCpSettings = false;
@@ -147,19 +147,6 @@ function (PluginEvent $event) {
}
);
- // Add new sections to the Control Panel
- /*Event::on(
- Cp::class,
- Cp::EVENT_REGISTER_CP_NAV_ITEMS,
- function(RegisterCpNavItemsEvent $event) {
- $event->navItems[] = [
- 'url' => 'webtexttool',
- 'label' => 'Webtexttool',
- 'icon' => '@inalgiev/webtexttool/icon.svg',
- ];
- }
- );*/
-
Craft::info(Craft::t('webtexttool', '{name} plugin loaded', ['name' => $this->name]),
__METHOD__
);
diff --git a/src/resources/css/wtt-core.css b/src/resources/css/wtt-core.css
index 0939676..13dd7ba 100644
--- a/src/resources/css/wtt-core.css
+++ b/src/resources/css/wtt-core.css
@@ -460,7 +460,7 @@ table {
position: absolute;
top: 0;
left: 0;
- z-index: 1060;
+ z-index: 10000;
display: none;
max-width: 276px;
padding: 1px !important;
@@ -2363,7 +2363,7 @@ ul.tag-list > li.tag-item {
-moz-transition-duration: .3s;
-o-transition-duration: .3s;
transition-duration: .3s;
- z-index: 999999999999;
+ z-index: 9999;
line-height: 22px;
height: 100%;
text-align: center;
@@ -2413,13 +2413,41 @@ ul.tag-list > li.tag-item {
padding: 2px;
margin: 2px 5px 5px 0;
line-height: 1;
- white-space: nowrap;
+ text-decoration: none;
text-align: center;
- border-width: 1px;
- border-style: solid;
+ border: 1px solid transparent;
border-radius: 4px;
transition: all .15s ease-in-out;
font: 14px "Helvetica Neue",Helvetica,Arial,sans-serif;
+ cursor: pointer;
+}
+
+#slideout .post-tag.gender-female {
+ background-color: #FFDFDD;
+}
+
+#slideout .post-tag.gender-neutral {
+ background-color: #d3d3d3
+}
+
+#slideout .post-tag.sentiment-negative {
+ background-color: #FFDFDD
+}
+
+#slideout .post-tag-orange {
+ background-color: #fee4c5
+}
+
+div.scrollable {
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ overflow: auto;
+}
+
+#slideout table {
+ width: 100%;
}
.badge, .wtt-btn, .wtt-btn-group, .btn-group-vertical, .caret, .checkbox-inline, .radio-inline {
diff --git a/src/resources/js/edit-page-controller.js b/src/resources/js/edit-page-controller.js
index df8b8c3..10daa2d 100644
--- a/src/resources/js/edit-page-controller.js
+++ b/src/resources/js/edit-page-controller.js
@@ -1026,61 +1026,167 @@ app.controller("editPageController", ['$scope', '$http', '$q', 'stateService', '
};
var initialCQTemplate = {
- "Suggestions": {
- "PageScore": 0.0,
- "Suggestions": [{
- "Tag": "Readability",
- "MetaTag": "Readability",
- "Rules": null,
- "Importance": 40.0,
- "Score": 0.0,
- "Penalty": 0.0,
- "Tooltip": null,
- "SortIndex": 1
- },
- {
- "Tag": "Adjectives",
- "MetaTag": "Adjectives",
- "Rules": null,
- "Importance": 20.0,
- "Score": 0.0,
- "Penalty": 0.0,
- "Tooltip": null,
- "SortIndex": 1
- },
- {
- "Tag": "Whitespaces",
- "MetaTag": "Whitespaces",
- "Rules": null,
- "Importance": 15.0,
- "Score": 0.0,
- "Penalty": 0.0,
- "Tooltip": null,
- "SortIndex": 1
- },
- {
- "Tag": "Sentiment",
- "MetaTag": "Sentiment",
- "Rules": null,
- "Importance": 10.0,
- "Score": 0.0,
- "Penalty": 0.0,
- "Tooltip": null,
- "SortIndex": 1
- },
- {
- "Tag": "Gender",
- "MetaTag": "Gender",
- "Rules": null,
- "Importance": 15.0,
- "Score": 0.0,
- "Penalty": 0.0,
- "Tooltip": null,
- "SortIndex": 1
+ "PageScore": 0.0,
+ "Suggestions": [{
+ "Tag": "Readability",
+ "MetaTag": "Readability",
+ "Rules": null,
+ "Importance": 70.0,
+ "Score": 0.0,
+ "Penalty": 0.0,
+ "Tooltip": null,
+ "SortIndex": 1,
+ "Metadata": {
+ "Category": 20,
+ "ShortName": "Readability",
+ "DisplayName": "Readability",
+ "DisplayType": null,
+ "Order": 1,
+ "Settings": [{"DisplayName": "Elementary", "Value": "1"}, {
+ "DisplayName": "Highschool",
+ "Value": "2"
+ }, {"DisplayName": "University", "Value": "3"}],
+ "Rules": [{
+ "Name": "ReadingLevel",
+ "Value": "1",
+ "IsPrimary": true,
+ "IsStringValue": false
+ }, {
+ "Name": "DifficultWordsLevel",
+ "Value": "1",
+ "IsPrimary": false,
+ "IsStringValue": false
+ }, {
+ "Name": "LongSentencesLevel",
+ "Value": "1",
+ "IsPrimary": false,
+ "IsStringValue": false
+ }, {
+ "Name": "SentenceLengthLevel",
+ "Value": "1",
+ "IsPrimary": false,
+ "IsStringValue": false
+ }, {
+ "Name": "PassiveVoice",
+ "Value": "1",
+ "IsPrimary": false,
+ "IsStringValue": false
+ }, {
+ "Name": "DifficultWordsLevel",
+ "Value": "1",
+ "IsPrimary": false,
+ "IsStringValue": false
+ }]
+ }
+ }, {
+ "Tag": "Adjectives",
+ "MetaTag": "Adjectives",
+ "Rules": null,
+ "Importance": 20.0,
+ "Score": 0.0,
+ "Penalty": 0.0,
+ "Tooltip": null,
+ "SortIndex": 1,
+ "Metadata": {
+ "Category": 21,
+ "ShortName": "Adjectives",
+ "DisplayName": "Adjectives",
+ "DisplayType": null,
+ "Order": 2,
+ "Settings": null,
+ "Rules": [{
+ "Name": "AdjectivesLevel",
+ "Value": "1",
+ "IsPrimary": true,
+ "IsStringValue": false
+ }]
+ }
+ }, {
+ "Tag": "Whitespaces",
+ "MetaTag": "Whitespaces",
+ "Rules": null,
+ "Importance": 20.0,
+ "Score": 0.0,
+ "Penalty": 0.0,
+ "Tooltip": null,
+ "SortIndex": 1,
+ "Metadata": {
+ "Category": 23,
+ "ShortName": "Whitespaces",
+ "DisplayName": "Whitespaces",
+ "DisplayType": null,
+ "Order": 5,
+ "Settings": null,
+ "Rules": [{
+ "Name": "WhitespacesLevel",
+ "Value": "1",
+ "IsPrimary": true,
+ "IsStringValue": false
+ }, {
+ "Name": "BulletPointsLevel",
+ "Value": "1",
+ "IsPrimary": false,
+ "IsStringValue": false
+ }]
+ }
+ }, {
+ "Tag": "Gender",
+ "MetaTag": "Gender",
+ "Rules": null,
+ "Importance": 15.0,
+ "Score": 0.0,
+ "Penalty": 0.0,
+ "Tooltip": null,
+ "SortIndex": 1,
+ "Metadata": {
+ "Category": 22,
+ "ShortName": "Gender",
+ "DisplayName": "Gender",
+ "DisplayType": null,
+ "Order": 3,
+ "Settings": [{"DisplayName": "Female", "Value": "f"}, {
+ "DisplayName": "Neutral",
+ "Value": "n"
+ }, {"DisplayName": "Male", "Value": "m"}],
+ "Rules": [{
+ "Name": "GenderLevel",
+ "Value": "n",
+ "IsPrimary": true,
+ "IsStringValue": true
+ }]
+ }
+ }, {
+ "Tag": "Sentiment",
+ "MetaTag": "Sentiment",
+ "Rules": null,
+ "Importance": 10.0,
+ "Score": 0.0,
+ "Penalty": 0.0,
+ "Tooltip": null,
+ "SortIndex": 1,
+ "Metadata": {
+ "Category": 30,
+ "ShortName": "Sentiment",
+ "DisplayName": "Sentiment",
+ "DisplayType": null,
+ "Order": 4,
+ "Settings": [{
+ "DisplayName": "Negative",
+ "Value": "negative"
+ }, {"DisplayName": "Neutral", "Value": "neutral"}, {
+ "DisplayName": "Positive",
+ "Value": "positive"
}],
- "PageScoreTag": "Let’s get started!",
- "RuleSet": "ContentQuality"
- }
+ "Rules": [{
+ "Name": "SentimentLevel",
+ "Value": "positive",
+ "IsPrimary": true,
+ "IsStringValue": true
+ }]
+ }
+ }],
+ "PageScoreTag": "Let’s get started!",
+ "RuleSet": "ContentQuality"
};
function init() {
@@ -1103,15 +1209,25 @@ app.controller("editPageController", ['$scope', '$http', '$q', 'stateService', '
if (wtt_globals.record !== "" && wtt_globals.record.wttContentQualitySuggestions !== "" && wtt_globals.record.wttContentQualitySuggestions !== null) {
// load last run suggestions
- var contentQualityDetails = JSON.parse(wtt_globals.record.wttContentQualitySuggestions);
+ var lastRunSuggestions = JSON.parse(wtt_globals.record.wttContentQualitySuggestions);
+
+ $scope.contentQualityDetails = lastRunSuggestions.Details;
- if(contentQualityDetails !== null) {
- $scope.contentQualityDetails = contentQualityDetails.Details;
- renderSuggestions(contentQualityDetails, false);
+ //map the new Metadata template to the old Suggestions
+ if(typeof lastRunSuggestions.Suggestions[0].Metadata === "undefined") {
+
+ var contentQualitySuggestions = _.map(initialCQTemplate.Suggestions, function(element) {
+ var treasure = _.findWhere(lastRunSuggestions.Suggestions, { Tag: element.Tag });
+ return _.extend(element, treasure);
+ });
+
+ lastRunSuggestions.Suggestions = contentQualitySuggestions;
}
+
+ renderSuggestions(lastRunSuggestions, false);
} else {
// load initial template
- $scope.contentQualitySuggestions = initialCQTemplate.Suggestions.Suggestions;
+ $scope.contentQualitySuggestions = initialCQTemplate.Suggestions;
$scope.QualityScoreTag = initialCQTemplate.Suggestions.PageScoreTag;
}
@@ -1245,7 +1361,8 @@ app.directive('enforceMaxTags', function () {
app.directive("wttContentQuality", function () {
return {
template: wtt_globals.contentQualityTemplate,
- link: function () {
+ link: function (scope) {
+ scope.data = stateService.data;
}
};
});
@@ -1373,121 +1490,51 @@ app.directive("wttSuggestionContentQuality", ["suggestionsService", "$sce", "sta
var data2 = stateService.data;
scope.data2 = data2;
- function buildOnOffAction(prop, display) {
- return {
- buttons: [],
- action: function (button) {
- scope.settings[prop] = this.active ? 1 : 0;
- updateOnAction(scope.settings[prop]);
- },
- selected: function (button) {
- return scope.settings[prop] === button.value;
- },
- active: scope.settings[prop] > 0,
- display: display
+ scope.setRuleProp = function (rules, value) {
+ for (var i = 0; i < rules.length; i++) {
+ var rule = rules[i];
+ var prop = rule.Name;
+ if (value === 0) {
+ if (scope.settings[prop]) {
+ scope.settings[prop] = rule.IsStringValue ? '' : 0;
+ } else {
+ scope.settings[prop] = rule.Value;
+ }
+ } else {
+ scope.settings[prop] = value;
+ }
}
- }
+ };
- var actions = {
- Readability: {
- buttons: [{
- label: "Elementary",
- tip: "Elementary",
- value: "1"
- },
- {
- label: "Highschool",
- tip: "Highschool",
- value: "2"
- },
- {
- label: "University",
- tip: "University",
- value: "3"
- }],
- action: function (button) {
- if (scope.settings.DifficultWordsLevel == 0 && button.value == 0) {
- button.value = 1;
- }
+ var buildAction = function (metadata) {
+ // console.log(metadata);
- scope.settings.ReadingLevel = button.value;
- scope.settings.DifficultWordsLevel = button.value;
- scope.settings.LongSentencesLevel = button.value;
- updateOnAction(button.value);
- },
- selected: function (button) {
- return scope.settings.ReadingLevel === button.value;
- },
- active: scope.settings.ReadingLevel > 0
- },
- Adjectives: {
- buttons: [],
- action: function (button) {
- scope.settings.AdjectivesLevel = this.active ? 1 : 0;
- scope.settings.AdjectiveList = scope.settings.AdjectivesLevel;
- updateOnAction(scope.settings.AdjectivesLevel);
- },
- selected: function (button) {
- return scope.settings.AdjectivesLevel === button.value;
- },
- active: scope.settings.AdjectivesLevel > 0
- },
- GenderList: buildOnOffAction('GenderList', 'gradient'),
- Gender: {
- buttons: [{label: 'Female', tip: 'Female', value: 'f'},
- {label: 'Neutral', tip: 'Neutral', value: 'n'},
- {label: 'Male', tip: 'Male', value: 'm'}],
- action: function (button) {
- if (button.value === 0) {
- //on off action
- if (scope.settings.GenderLevel) {
- scope.settings.GenderLevel = '';
- } else {
- scope.settings.GenderLevel = 'm'; //default after ON
- }
- } else {
- scope.settings.GenderLevel = button.value;
- }
+ var primaryRule = metadata.Rules[0];
+ var prop = primaryRule.Name;
+ var buttonList = _.map(metadata.Settings, function (item) {
+ return {
+ label: item.DisplayName,
+ tip: item.DisplayName,
+ value: item.Value
+ };
+ });
- updateOnAction(scope.settings.GenderLevel);
+ return {
+ buttons: buttonList,
+ action: function (button) {
+ scope.setRuleProp(metadata.Rules, button.value);
+ updateOnAction(scope.settings[prop]);
},
selected: function (button) {
- return scope.settings.GenderLevel === button.value;
+ return scope.settings[prop] == button.value;
},
- active: scope.settings.GenderLevel && true
- },
- Sentiment: {
- buttons: [{label: 'Negative', tip: 'Negative', value: 'negative'},
- {label: 'Neutral', tip: 'Neutral', value: 'neutral'},
- {label: 'Positive', tip: 'Positive', value: 'positive'}],
- action: function(button){
- if (button.value === 0){
- //on off action
- if(scope.settings.SentimentLevel){
- scope.settings.SentimentLevel = '';
- }else{
- scope.settings.SentimentLevel = 'neutral'; //default after ON
- }
- }else{
- scope.settings.SentimentLevel = button.value;
- }
-
- updateOnAction(scope.settings.SentimentLevel);
- },
- selected: function(button){
- return scope.settings.SentimentLevel === button.value;
- },
- active: scope.settings.SentimentLevel && true
- },
- Bulletpoints: buildOnOffAction('BulletPointsLevel'),
- Whitespaces: buildOnOffAction('WhitespacesLevel'),
- Jargon: buildOnOffAction('JargonList'),
- Repetition: buildOnOffAction('RepetitionLevel'),
- SingularPlural: buildOnOffAction('SingularPluralLevel', 'gradient'),
- TextLength: buildOnOffAction('TextLengthRuleLevel', 'gradient')
+ active: !!scope.settings[prop],
+ display: metadata.DisplayType
+ }
};
- scope.actionConfig = actions[scope.suggestion.MetaTag];
+ var action = buildAction(scope.suggestion.Metadata);
+ scope.actionConfig = action;
scope.suggestion.selected = scope.suggestion.Importance > 0;
scope.suggestion.isCollapsed = false;
@@ -1530,6 +1577,17 @@ app.directive("wttSuggestionContentQuality", ["suggestionsService", "$sce", "sta
Name: key,
Count: items.length}
}).value();
+ } else if (data2.sliderInfo.Type == "fullList") {
+ data2.sliderInfo.tags = _.chain(data2.sliderInfo.List).groupBy(function (item) {
+ return item.Word
+ }).map(function (items, key) {
+ return {
+ Name: key,
+ Count: items.length,
+ CssClass: items.length > 0 ? items[0].Type : '',
+ To: items[0].To ? items[0].To.join(", ") : ''
+ };
+ }).value();
}
jQuery('#slideout').addClass('on');
diff --git a/src/templates/directives/wtt-content-quality.html b/src/templates/directives/wtt-content-quality.html
index f6f83d6..4241432 100644
--- a/src/templates/directives/wtt-content-quality.html
+++ b/src/templates/directives/wtt-content-quality.html
@@ -1,3 +1,5 @@
+
{[info.Title]} | @@ -14,11 +14,36 @@- {[item.Name]} {[item.Count]} + {[item.Name]} {[item.Count]} |
---|