Skip to content

Commit

Permalink
Fix oppia#5798: Introduce Improvements Tab to Exploration Editor (opp…
Browse files Browse the repository at this point in the history
…ia#5991)

* Fix hola's multiple choice question.

* add config_property for showing the issues tab

* fix indentation

* shorter description

* fetch issue_tab_exposed from backend

* make isIssuesTabExposed a function

* redirect away from issues if it is not exposed

* remove unused import

* fix copyright date

* better naming for config variable

* explicit function definition

* stop showing feedback count

* stop showing unrelated data

* make helper function

* better handler name

* better name

* better name for service

* fix line-too-long error

* sort imports

* rename backend url

* commit the new service

* connect issues_tab to its controller

* add message for issues tab

* reorganize redirect routes

* fix fileoverview

* use bug_report material icon

* add dependency to routerservice

* fix line-too-long error

* save line-too-long error fix for different PR

* accept an exploration id for the features backend api call

* s/EXPLORATION_FEATURES_URL/EXPLORATION_EDITOR_FEATURES_URL/

* use better acl

* prettier issues tab template

* Simplify html structure

* Fix indentation

* add programmatic data

* use length of open issues

* remove i18n from TODO

* revert to dev mode

* remove unused scope variable

* s/exposed/enabled

* s/allData/combinedData

* delete extraneous space

* give players access to exploration features

* s/Exploration\w*Features/ExplorationFeatures

* sort imports

* rename actual file

* add conditional to existing expression

* use different constant to keep strings together

* explain constants

* sort imports

* remove useless parenthesis

* fix headers

* use propere name

* sort imports

* sort imports

* sort imports

* use new name

* fix quote-props error

* stop using excessive format for comment headers.

* s/TAGS/TABS

* add missing constant access

* s/EXPLORATION_EDITOR_FEATURES_URL/EXPLORATION_FEATURES_URL

* sort imports

* simplify function assignment

* simplify function assignment

* remove unneeded prefix

* condense object definition

* s/_tabs/tabStatus

* render nothing if issue type does not exist

* s/exploration_editor/explorehandler for URL

* store active tab directly

* use i18n strings

* fix line-too-long

* Update core/templates/dev/head/pages/exploration_editor/settings_tab/SettingsTab.js

Better wording.

Co-Authored-By: brianrodri <brian@brianrodri.com>

* add human readable issues name

* reorder words

* s/issues/improvements

* fix wrong function call

* s/issues/improvements

* fix i18n

* finishing touches

* fix line-too-long

* fix line-too-long

* fix line-too-long

* fix remaining line-too-long errors

* fix line-too-long

* fix spacing

* sort i18n definitions

* fix wrong import

* fix line-too-long

* move improvements next to stats

* only use 3 cards

* only use 2 cards

* remove extra newline

* remove todos

* Make ImprovementsTab a directive

* suffix with directive

* s/activeTab/activeTabName

* improve JSDoc

* require logged in to show improvements tab

* Update improvements_tab_directive.html

s/improvements/issues

* improve docstrings

* remove directive suffix

* prefer ng-if
  • Loading branch information
brianrodri authored Jan 1, 2019
1 parent 59260be commit faf68df
Show file tree
Hide file tree
Showing 38 changed files with 511 additions and 292 deletions.
8 changes: 8 additions & 0 deletions assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@
"I18N_GET_STARTED_PAGE_PARAGRAPH_9": "When learners go through your exploration, they can send you feedback to alert you to problems or to share ideas for making it better.",
"I18N_GET_STARTED_PAGE_PARAGRAPH_9_HEADING": "Improve Your Exploration",
"I18N_GET_STARTED_PAGE_TITLE": "Get Started",
"I18N_IMPROVEMENTS_TAB_FEEDBACK_DESCRIPTION": "A learner had something to say about your exploration.",
"I18N_IMPROVEMENTS_TAB_PLAYTHROUGH_ISSUES_CYCLIC_TRANSITIONS_DESCRIPTION": "A player has quit an exploration after repeatedly cycling through a sequence of cards.",
"I18N_IMPROVEMENTS_TAB_PLAYTHROUGH_ISSUES_EARLY_QUIT_DESCRIPTION": "A player has quit an exploration soon after starting.",
"I18N_IMPROVEMENTS_TAB_PLAYTHROUGH_ISSUES_MULTIPLE_INCORRECT_ANSWERS_DESCRIPTION": "A player has quit an exploration after entering many incorrect answers.",
"I18N_IMPROVEMENTS_TAB_SUMMARY_ARCHIVED_ISSUES": "Archived Issues",
"I18N_IMPROVEMENTS_TAB_SUMMARY_OPEN_ISSUES": "Open Issues",
"I18N_IMPROVEMENTS_TAB_SUMMARY_RESOLVED_ISSUES": "Resolved Issues",
"I18N_IMPROVEMENTS_TAB_UNRESOLVED_ANSWER_DESCRIPTION": "A commonly entered answer has no explicit feedback from you.",
"I18N_INTERACTIONS_FRACTIONS_INPUT_PLACEHOLDER": "Enter a fraction in the form x/x, or a mixed number in the form x x/x.",
"I18N_INTERACTIONS_FRACTIONS_INPUT_PLACEHOLDER_NO_INTEGER": "Enter a fraction in the form x/x.",
"I18N_INTERACTIONS_GRAPH_ADD_EDGE": "Add Edge",
Expand Down
8 changes: 8 additions & 0 deletions assets/i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@
"I18N_GET_STARTED_PAGE_PARAGRAPH_9": "Text on the Get Started page that explains the process for creating an Oppia activity at a high level.\n{{Identical|Get started}}",
"I18N_GET_STARTED_PAGE_PARAGRAPH_9_HEADING": "Paragraph heading on the Get Started page that explains the process for creating an Oppia activity at a high level.\n{{Identical|Get started}}",
"I18N_GET_STARTED_PAGE_TITLE": "Title of the Get Started page that explains the process for creating an Oppia activity at a high level.\n{{Identical|Get started}}",
"I18N_IMPROVEMENTS_TAB_FEEDBACK_DESCRIPTION": "Text displayed to describe an issue card describing a feedback thread about the exploration.",
"I18N_IMPROVEMENTS_TAB_PLAYTHROUGH_ISSUES_CYCLIC_TRANSITIONS_DESCRIPTION": "Text displayed to describe an issue card describing a playthrough demonstrating a learner that had quit after being stuck moving through the same set of cards repeatedly.",
"I18N_IMPROVEMENTS_TAB_PLAYTHROUGH_ISSUES_EARLY_QUIT_DESCRIPTION": "Text displayed to describe an issue card describing a playthrough demonstrating a learner that quit immediately after starting an exploration.",
"I18N_IMPROVEMENTS_TAB_PLAYTHROUGH_ISSUES_MULTIPLE_INCORRECT_ANSWERS_DESCRIPTION": "Text displayed to describe an issue card describing playthrough demonstrating a learner that quit after entering incorrect answers repeatedly.",
"I18N_IMPROVEMENTS_TAB_SUMMARY_ARCHIVED_ISSUES": "Text displayed in the summary card to show the number of issues that have been archived.",
"I18N_IMPROVEMENTS_TAB_SUMMARY_OPEN_ISSUES": "Text displayed in the summary card to show the number of issues that are open and require attention.",
"I18N_IMPROVEMENTS_TAB_SUMMARY_RESOLVED_ISSUES": "Text displayed in the summary card to show the number of issues that have been given attention and deemed fixed by Oppia.",
"I18N_IMPROVEMENTS_TAB_UNRESOLVED_ANSWER_DESCRIPTION": "A commonly entered answer has no explicit feedback from you.",
"I18N_INTERACTIONS_FRACTIONS_INPUT_PLACEHOLDER": "Text displayed in the fractions interaction input as a placeholder.",
"I18N_INTERACTIONS_FRACTIONS_INPUT_PLACEHOLDER_NO_INTEGER": "Text displayed in the fractions interaction input as a placeholder when no integer part is allowed.",
"I18N_INTERACTIONS_GRAPH_ADD_EDGE": "Text displayed in a button in a graph interaction inside the graph editor - When the user clicks the button, he can add a new line (edge) to the graph.",
Expand Down
14 changes: 14 additions & 0 deletions core/controllers/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,3 +878,17 @@ def get(self, exploration_id):
self.render_json({
'unresolved_answers': unresolved_answers_with_frequency
})


class ExplorationFeaturesHandler(EditorHandler):
"""Returns features the given exploration is configured to support."""

GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON

@acl_decorators.can_play_exploration
def get(self, unused_exploration_id):
"""Handles GET requests for an exploration's features."""
self.render_json({
'is_improvements_tab_enabled':
config_domain.IS_IMPROVEMENTS_TAB_ENABLED.value,
})
5 changes: 5 additions & 0 deletions core/domain/config_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,8 @@ def get_config_property_schemas(cls):
RECORD_PLAYTHROUGH_PROBABILITY = ConfigProperty(
'record_playthrough_probability', FLOAT_SCHEMA,
'The probability of recording playthroughs', 0.2)

IS_IMPROVEMENTS_TAB_ENABLED = ConfigProperty(
'is_improvements_tab_enabled', BOOL_SCHEMA,
'Exposes the Improvements Tab for creators in the exploration editor.',
False)
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ oppia.directive('collectionEditorNavbarBreadcrumb', [
preview: 'Preview',
settings: 'Settings',
stats: 'Statistics',
history: 'History'
improvements: 'Improvements',
history: 'History',
};

$scope.collection = CollectionEditorStateService.getCollection();

$scope.getCurrentTabName = function() {
return _TAB_NAMES_TO_HUMAN_READABLE_NAMES[
RouterService.getTabStatuses().active];
RouterService.getActiveTabName()];
};

$scope.editCollectionTitle = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ oppia.directive('collectionEditorNavbar', [
$scope.isSaveInProgress = (
CollectionEditorStateService.isSavingCollection);

$scope.getTabStatuses = RouterService.getTabStatuses;
$scope.getActiveTabName = RouterService.getActiveTabName;
$scope.selectMainTab = RouterService.navigateToMainTab;
$scope.selectPreviewTab = RouterService.navigateToPreviewTab;
$scope.selectSettingsTab = RouterService.navigateToSettingsTab;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@

{% block content %}
<div ng-controller="CollectionEditor">
<div ng-if="getTabStatuses().active === 'main'">
<div ng-if="getActiveTabName() === 'main'">
<collection-main-tab></collection-main-tab>
</div>

<div ng-show="getTabStatuses().active === 'settings'">
<div ng-show="getActiveTabName() === 'settings'">
<collection-settings-tab></collection-settings-tab>
</div>

<div ng-show="getTabStatuses().active === 'history'">
<div ng-show="getActiveTabName() === 'history'">
<collection-history-tab></collection-history-tab>
</div>

<div ng-show="getTabStatuses().active === 'stats'">
<div ng-show="getActiveTabName() === 'stats'">
<collection-statistics-tab></collection-statistics-tab>
</div>
</div>
Expand Down Expand Up @@ -134,6 +134,7 @@
<script src="/templates/dev/head/pages/exploration_editor/ExplorationDataService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/AngularNameService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/ExplorationEditor.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/ExplorationFeaturesService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/RouterService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/ChangesInHumanReadableFormService.js"></script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ul class="nav navbar-nav oppia-navbar-nav navbar-right ng-cloak" style="margin-left: 20px;">
<!-- Editor -->
<li ng-class="{'active': getTabStatuses().active === 'main', 'uib-dropdown': getWarningsCount()}" ng-attr-uib-dropdown="<[getWarningsCount()]>">
<li ng-class="{'active': getActiveTabName() === 'main', 'uib-dropdown': getWarningsCount()}" ng-attr-uib-dropdown="<[getWarningsCount()]>">
<a href="#" uib-tooltip="Editor" ng-click="selectMainTab()" class="protractor-test-main-tab">
<i class="material-icons">&#xE254;</i>
</a>
Expand All @@ -22,7 +22,7 @@
</li>

<!-- Settings -->
<li ng-class="{'active': getTabStatuses().active === 'settings'}">
<li ng-class="{'active': getActiveTabName() === 'settings'}">
<a href="#" uib-tooltip="Settings" tooltip-placement="bottom" ng-click="selectSettingsTab()" class="protractor-test-settings-tab">
<i class="material-icons">&#xE8B8;</i>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ <h2>Suggestions to review</h2>
<script src="/templates/dev/head/services/ComputeGraphService.js"></script>
<script src="/templates/dev/head/services/EditabilityService.js"></script>
<script src="/templates/dev/head/services/GenerateContentIdService.js"></script>
<script src="/templates/dev/head/services/IssuesService.js"></script>
<script src="/templates/dev/head/services/ImprovementsService.js"></script>
<script src="/templates/dev/head/services/LocalStorageService.js"></script>
<script src="/templates/dev/head/services/SiteAnalyticsService.js"></script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ oppia.directive('editorNavbarBreadcrumb', [
preview: 'Preview',
settings: 'Settings',
stats: 'Statistics',
improvements: 'Improvements',
history: 'History',
feedback: 'Feedback'
feedback: 'Feedback',
};

$scope.getCurrentTabName = function() {
if (!RouterService.getTabStatuses()) {
if (!RouterService.getActiveTabName()) {
return '';
} else {
return _TAB_NAMES_TO_HUMAN_READABLE_NAMES[
RouterService.getTabStatuses().active];
RouterService.getActiveTabName()];
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@ oppia.directive('editorNavigation', [
templateUrl: UrlInterpolationService.getDirectiveTemplateUrl(
'/pages/exploration_editor/editor_navigation_directive.html'),
controller: [
'$scope', '$rootScope', '$timeout', '$uibModal', 'ContextService',
'ExplorationRightsService', 'ExplorationWarningsService',
'RouterService', 'StateEditorTutorialFirstTimeService',
'SiteAnalyticsService', 'ThreadDataService', 'UserService',
'WindowDimensionsService',
'$rootScope', '$scope', '$timeout', '$uibModal', 'ContextService',
'ExplorationFeaturesService', 'ExplorationRightsService',
'ExplorationWarningsService', 'RouterService', 'SiteAnalyticsService',
'StateEditorTutorialFirstTimeService', 'ThreadDataService',
'UserService', 'WindowDimensionsService',
function(
$scope, $rootScope, $timeout, $uibModal, ContextService,
ExplorationRightsService, ExplorationWarningsService,
RouterService, StateEditorTutorialFirstTimeService,
SiteAnalyticsService, ThreadDataService, UserService,
WindowDimensionsService) {
$rootScope, $scope, $timeout, $uibModal, ContextService,
ExplorationFeaturesService, ExplorationRightsService,
ExplorationWarningsService, RouterService, SiteAnalyticsService,
StateEditorTutorialFirstTimeService, ThreadDataService,
UserService, WindowDimensionsService) {
$scope.popoverControlObject = {
postTutorialHelpPopoverIsShown: false
};
$scope.isLargeScreen = (WindowDimensionsService.getWidth() >= 1024);
$scope.isImprovementsTabEnabled =
ExplorationFeaturesService.isImprovementsTabEnabled;

$scope.$on('openPostTutorialHelpPopover', function() {
if ($scope.isLargeScreen) {
Expand Down Expand Up @@ -105,12 +107,14 @@ oppia.directive('editorNavigation', [
ExplorationWarningsService.hasCriticalWarnings);

$scope.ExplorationRightsService = ExplorationRightsService;
$scope.getTabStatuses = RouterService.getTabStatuses;
$scope.getActiveTabName = RouterService.getActiveTabName;
$scope.selectMainTab = RouterService.navigateToMainTab;
$scope.selectTranslationTab = RouterService.navigateToTranslationTab;
$scope.selectPreviewTab = RouterService.navigateToPreviewTab;
$scope.selectSettingsTab = RouterService.navigateToSettingsTab;
$scope.selectStatsTab = RouterService.navigateToStatsTab;
$scope.selectImprovementsTab =
RouterService.navigateToImprovementsTab;
$scope.selectHistoryTab = RouterService.navigateToHistoryTab;
$scope.selectFeedbackTab = RouterService.navigateToFeedbackTab;
$scope.getOpenThreadsCount = ThreadDataService.getOpenThreadsCount;
Expand Down
Loading

0 comments on commit faf68df

Please sign in to comment.