diff --git a/application/controllers/admin/expressions.php b/application/controllers/admin/expressions.php index 8dea73e1fae..4667540c4a0 100644 --- a/application/controllers/admin/expressions.php +++ b/application/controllers/admin/expressions.php @@ -49,16 +49,18 @@ function index() $aData['title_bar']['title'] = $surveyinfo['surveyls_title']." (".gT("ID").":".$iSurveyID.")"; if(Yii::app()->request->getQuery('gid')!='') { - $aData['questiongroupbar']['closebutton']['url'] = 'admin/questiongroups/sa/view/surveyid/'.$aData['surveyid'].'/gid/'.sanitize_int(Yii::app()->request->getQuery('gid')); + $aData['questiongroupbar']['closebutton']['url'] = $this->getController()->createUrl('admin/questiongroups/sa/view/',['surveyid'=> $surveyid, 'gid'=> sanitize_int(Yii::app()->request->getQuery('gid'))]); } else { - $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/'.$aData['surveyid']; + $aData['surveybar']['closebutton']['url'] = $this->getController()->createUrl('/admin/survey/sa/view/',['surveyid'=> $surveyid]); } if(Yii::app()->request->getQuery('qid')!='') { - $aData['questiongroupbar']['closebutton']['url'] = 'admin/questions/sa/view/surveyid/'.$aData['surveyid'].'/gid/'.sanitize_int(Yii::app()->request->getQuery('gid')).'/qid/'.sanitize_int(Yii::app()->request->getQuery('qid')); + $aData['questiongroupbar']['closebutton']['url'] = $this->getController()->createUrl( + 'admin/questiongroups/sa/view/', + ['surveyid'=> $surveyid, 'gid'=> sanitize_int(Yii::app()->request->getQuery('gid')), 'qid'=> sanitize_int(Yii::app()->request->getQuery('qid'))]); $aData['gid'] = sanitize_int(Yii::app()->request->getQuery('gid')); } } diff --git a/application/controllers/admin/surveyadmin.php b/application/controllers/admin/surveyadmin.php index 231b3619ec6..b000104c5a5 100644 --- a/application/controllers/admin/surveyadmin.php +++ b/application/controllers/admin/surveyadmin.php @@ -492,27 +492,7 @@ public function getAjaxMenuArray($surveyid){ $survey = Survey::model()->findByPk($iSurveyID); $baselang = $survey->language; $menus = $survey->getSurveyMenus(); - $propArray = array( - 'menuEntries' => [ - [ - 'active' => false, - 'icon' => 'fa fa-list', - 'name' => gT('Overview'), - 'link' => $this->getController()->createUrl("admin/survey/sa/view", ['surveyid' => $surveyid]) - ], - [ - 'active' => false, - 'icon' => 'fa fa-cogs', - 'name' => gT('General Settings'), - 'link' => $this->getController()->createUrl("admin/survey/sa/surveygeneralsettings",['surveyid' => $surveyid]) - ], - [ - 'active' => false, - 'icon' => 'fa fa-language', - 'name' => gT('Language'), - 'link' => $this->getController()->createUrl("admin/survey/sa/editlanguagesettings",['surveyid' => $surveyid]) - ], - ]); + return Yii::app()->getController()->renderPartial( '/admin/super/_renderJson', array( @@ -521,16 +501,7 @@ public function getAjaxMenuArray($surveyid){ 'settings' => array( 'extrasettings' => false, 'parseHTML' => false, - ), - // 'debug' => [ - // $iSurveyID, - // $survey, - // $baselang, - // $setting_entry, - // $lastquestion, - // $setting_entry, - // $lastquestiongroup - // ] + ) ] ), false, @@ -1925,7 +1896,6 @@ private function _registerScriptFiles() App()->getClientScript()->registerPackage('jquery-json'); App()->clientScript->registerPackage('bootstrap-switch'); App()->getClientScript()->registerPackage('jquery-datatable'); - App()->clientScript->defaultScriptFilePosition=CClientScript::POS_END; App()->clientScript->registerPackage('adminpanel'); } diff --git a/application/models/Survey.php b/application/models/Survey.php index 14d4f5c68c1..6acd5aa0b8a 100644 --- a/application/models/Survey.php +++ b/application/models/Survey.php @@ -541,30 +541,23 @@ private function _getDefaultSurveyMenu(){ $oDefaultMenu = Surveymenu::model()->findByPk(1); //Posibility to add more languages to the database is given, so it is possible to add a call by language //Also for peripheral menues we may add submenus someday. + + $entries = []; $defaultMenuEntries = $oDefaultMenu->surveymenuEntries; + foreach($defaultMenuEntries as $menuEntry){ + $aEntry = $menuEntry->attributes; + $aEntry['link'] = $aEntry['menu_link'] + ? App()->getController()->createUrl($aEntry['menu_link'],['surveyid' => $this->sid]) + : App()->getController()->createUrl("admin/survey/sa/rendersidemenulink",['surveyid' => $this->sid, 'subaction' => $aEntry['name'] ]); + $entries[] = $aEntry; + } + $aResult = [ "title" => $oDefaultMenu->title, "description" => $oDefaultMenu->description, - "entries" => [ - [ - 'id'=> "0", - 'link'=> App()->getController()->createUrl("admin/survey/sa/view",['surveyid' => $this->sid]), - 'menu_class'=> "", - 'menu_description'=> "Survey overwiew", - 'menu_icon'=> "list", - 'menu_icon_type'=> "fontawesome", - 'menu_id'=> "1", - 'menu_title'=> "Overview", - 'name'=> "overview", - 'title'=> "General overview", - ] - ] + "entries" => $entries ]; - foreach($defaultMenuEntries as $menuEntry){ - $aEntry = $menuEntry->attributes; - $aEntry['link'] = App()->getController()->createUrl("admin/survey/sa/rendersidemenulink",['surveyid' => $this->sid, 'subaction' => $aEntry['name'] ]); - $aResult["entries"][] = $aEntry; - } + return $aResult; } diff --git a/application/models/SurveymenuEntries.php b/application/models/SurveymenuEntries.php index 99798abd38f..a157bfb2f54 100644 --- a/application/models/SurveymenuEntries.php +++ b/application/models/SurveymenuEntries.php @@ -13,6 +13,7 @@ * @property string $menu_description * @property string $menu_icon * @property string $menu_class + * @property string $menu_link * @property string $action * @property string $template * @property string $partial @@ -50,11 +51,11 @@ public function rules() return array( array('changed_at', 'required'), array('menu_id, priority, changed_by, created_by', 'numerical', 'integerOnly'=>true), - array('title, menu_title, menu_icon, menu_class, action, template, partial, permission, permissionGrade, classes, getdatamethod', 'length', 'max'=>255), + array('title, menu_title, menu_icon, menu_class, menu_link, action, template, partial, permission, permissionGrade, classes, getdatamethod', 'length', 'max'=>255), array('description, menu_description, language, data, created_at', 'safe'), // The following rule is used by search(). // @todo Please remove those attributes that should not be searched. - array('id, menu_id, priority, title, description, menu_title, menu_description, menu_icon, menu_class, action, template, partial, language, permission, permissionGrade, classes, data, getdatamethod, changed_at, changed_by, created_at, created_by', 'safe', 'on'=>'search'), + array('id, menu_id, priority, title, description, menu_title, menu_description, menu_icon, menu_class, menu_link, action, template, partial, language, permission, permissionGrade, classes, data, getdatamethod, changed_at, changed_by, created_at, created_by', 'safe', 'on'=>'search'), ); } @@ -85,6 +86,7 @@ public function attributeLabels() 'menu_description' => 'Menu Description', 'menu_icon' => 'Menu Icon', 'menu_class' => 'Menu Class', + 'menu_link' => 'Menu link', 'action' => 'Action', 'template' => 'Template', 'partial' => 'Partial', @@ -128,6 +130,7 @@ public function search() $criteria->compare('menu_description',$this->menu_description,true); $criteria->compare('menu_icon',$this->menu_icon,true); $criteria->compare('menu_class',$this->menu_class,true); + $criteria->compare('menu_link',$this->menu_link,true); $criteria->compare('action',$this->action,true); $criteria->compare('template',$this->template,true); $criteria->compare('partial',$this->partial,true); diff --git a/application/views/admin/super/sidebody.php b/application/views/admin/super/sidebody.php index 25297ec7585..2230556b1b3 100644 --- a/application/views/admin/super/sidebody.php +++ b/application/views/admin/super/sidebody.php @@ -1,3 +1,3 @@ -
+
diff --git a/application/views/admin/survey/settings/default.xml b/application/views/admin/survey/settings/default.xml deleted file mode 100644 index 97f3091f15b..00000000000 --- a/application/views/admin/survey/settings/default.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - surveysetting - Surveysettings - - generalsettings - surveytexts - presentation - publication - panelintegration - tokens - ressources - - 1.0.0 - \ No newline at end of file diff --git a/application/views/admin/survey/settings/generalsettings.xml b/application/views/admin/survey/settings/generalsettings.xml deleted file mode 100644 index 8b062c05d40..00000000000 --- a/application/views/admin/survey/settings/generalsettings.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - generalsettings - Edit survey settings - - General settings - General survey settings - - fa-gears - - 1.0.0 - updatesurveylocalesettings - - - - /admin/survey/subview/accordion/_generaloptions_panel - - surveysettings - read - col-sm-12 col-md-5 - - _generalTabEditSurvey - \ No newline at end of file diff --git a/application/views/admin/survey/settings/panelintegration.xml b/application/views/admin/survey/settings/panelintegration.xml deleted file mode 100644 index d6e97f7d2b0..00000000000 --- a/application/views/admin/survey/settings/panelintegration.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - panelintegration - Edit survey panel integration - - Panel integration - Define panel integrations for your survey - - fa-link - - 1.0.0 - surveygeneralsettings - - - - /admin/survey/subview/accordion/_integration_panel - - - surveylocale - read - col-sm-12 col-md-7 content-right - - _tabPanelIntegration - \ No newline at end of file diff --git a/application/views/admin/survey/settings/plugins.xml b/application/views/admin/survey/settings/plugins.xml deleted file mode 100644 index 28e5cbea95a..00000000000 --- a/application/views/admin/survey/settings/plugins.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - plugins - Plugin settings - - Plugins - Edit plugin settings - - fa-file-text-o - - 1.0.0 - surveygeneralsettings - - - - /admin/survey/subview/accordion/_plugins_panel - - surveylocale - read - col-sm-12 col-md-7 content-right - - _generalTabEditSurvey - \ No newline at end of file diff --git a/application/views/admin/survey/settings/presentation.xml b/application/views/admin/survey/settings/presentation.xml deleted file mode 100644 index a1f868d29de..00000000000 --- a/application/views/admin/survey/settings/presentation.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - generalsettings - Presentation & navigation settings - - Presentation - Edit presentation and navigation settings - - fa-eye-slash - - 1.0.0 - surveygeneralsettings - - - - /admin/survey/subview/tab_edit_view - - surveylocale - read - col-sm-12 col-md-7 content-right - - _tabPresentationNavigation - \ No newline at end of file diff --git a/application/views/admin/survey/settings/publication.xml b/application/views/admin/survey/settings/publication.xml deleted file mode 100644 index 96f9c7b9730..00000000000 --- a/application/views/admin/survey/settings/publication.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - publication - Publication and access control settings - - Publication&Access - Edit settings for publicationa and access control - - fa-key - - 1.0.0 - surveygeneralsettings - - - - /admin/survey/subview/accordion/_publication_panel - - surveylocale - read - col-sm-12 col-md-7 content-right - - _tabPublicationAccess - \ No newline at end of file diff --git a/application/views/admin/survey/settings/ressources.xml b/application/views/admin/survey/settings/ressources.xml deleted file mode 100644 index 7556af6b336..00000000000 --- a/application/views/admin/survey/settings/ressources.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - ressources - Add/Edit ressources to the survey - - Ressources - Add/Edit ressources to the survey - - fa-file - - 1.0.0 - surveygeneralsettings - - - - /admin/survey/subview/accordion/_resources_panel - - surveylocale - read - col-sm-12 col-md-7 content-right - - _tabResourceManagement - \ No newline at end of file diff --git a/application/views/admin/survey/settings/surveytexts.xml b/application/views/admin/survey/settings/surveytexts.xml deleted file mode 100644 index 746df55f156..00000000000 --- a/application/views/admin/survey/settings/surveytexts.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - generalsettings - Edit survey text elements - - Survey texts - Edit survey text elements - - fa-file-text-o - - 1.0.0 - surveygeneralsettings - - - - /admin/survey/subview/tab_edit_view - - /admin/survey/editLocalSettings_view - - surveylocale - read - col-sm-12 col-md-7 content-right - - _generalTabEditSurvey - \ No newline at end of file diff --git a/application/views/admin/survey/settings/tokens.xml b/application/views/admin/survey/settings/tokens.xml deleted file mode 100644 index 97916d244c9..00000000000 --- a/application/views/admin/survey/settings/tokens.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - tokens - Token handling - - Participant tokens - Define how tokens should be treated or generated - - fa-users - - 1.0.0 - surveygeneralsettings - - - - /admin/survey/subview/accordion/_tokens_panel - - - surveylocale - read - col-sm-12 col-md-7 content-right - - _tabTokens - \ No newline at end of file diff --git a/application/views/admin/survey/subview/accordion/_tokens_panel.php b/application/views/admin/survey/subview/accordion/_tokens_panel.php index a89d80a5c92..a33f949a0a2 100755 --- a/application/views/admin/survey/subview/accordion/_tokens_panel.php +++ b/application/views/admin/survey/subview/accordion/_tokens_panel.php @@ -4,168 +4,172 @@ */ ?> -
+
+
+
+ +
+ +
+ +
+
+
+
+ +
+ +
+ + + + + + -
- -
- - - - - - widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'anonymized', + 'value'=> $esrow['anonymized'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off'), + 'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){ + alertPrivacy(); + }") + )); + }?> +
+
- $this->widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'anonymized', - 'value'=> $esrow['anonymized'] == "Y", + +
+ +
+ widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'tokenanswerspersistence', + 'value'=> $esrow['tokenanswerspersistence'] == "Y", 'onLabel'=>gT('On'), 'offLabel'=>gT('Off'), 'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){ - alertPrivacy(); + if ($('#anonymized').is(':checked') == true) { + $('#tokenanswerspersistenceModal').modal(); + } }") )); - }?> -
-
- - -
- -
- widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'tokenanswerspersistence', - 'value'=> $esrow['tokenanswerspersistence'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off'), - 'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){ - if ($('#anonymized').is(':checked') == true) { - $('#tokenanswerspersistenceModal').modal(); - } - }") - )); - $this->widget('bootstrap.widgets.TbModal', array( - 'id' => 'tokenanswerspersistenceModal', - 'header' => gt('Error','unescaped'), - 'content' => '

'.gT("This option can't be used if the -Anonymized responses- option is active.").'

', - 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) - )); - ?> -
-
- - -
- -
- widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'alloweditaftercompletion', - 'value'=> $esrow['alloweditaftercompletion'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off') - )); - ?> -
-
+ $this->widget('bootstrap.widgets.TbModal', array( + 'id' => 'tokenanswerspersistenceModal', + 'header' => gt('Error','unescaped'), + 'content' => '

'.gT("This option can't be used if the -Anonymized responses- option is active.").'

', + 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) + )); + ?> +
+
- -
- -
- widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'allowregister', - 'value'=> $esrow['allowregister'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off') - )); - ?> -
-
+ +
+ +
+ widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'alloweditaftercompletion', + 'value'=> $esrow['alloweditaftercompletion'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off') + )); + ?> +
+
- -
- -
- widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'htmlemail', - 'value'=> $esrow['htmlemail'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off'), - 'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){ - $('#htmlemailModal').modal(); - }") - )); - $this->widget('bootstrap.widgets.TbModal', array( - 'id' => 'htmlemailModal', - 'header' => gt('Error','unescaped'), - 'content' => '

'.gT("If you switch email mode, you'll have to review your email templates to fit the new format").'

', - 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) - )); - ?> -
-
+ +
+ +
+ widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'allowregister', + 'value'=> $esrow['allowregister'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off') + )); + ?> +
+
- -
- -
- widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'sendconfirmation', - 'value'=> $esrow['sendconfirmation'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off') - )); - ?> -
-
+ +
+ +
+ widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'htmlemail', + 'value'=> $esrow['htmlemail'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off'), + 'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){ + $('#htmlemailModal').modal(); + }") + )); + $this->widget('bootstrap.widgets.TbModal', array( + 'id' => 'htmlemailModal', + 'header' => gt('Error','unescaped'), + 'content' => '

'.gT("If you switch email mode, you'll have to review your email templates to fit the new format").'

', + 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) + )); + ?> +
+
- -
- -
- + +
+ +
+ widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'sendconfirmation', + 'value'=> $esrow['sendconfirmation'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off') + )); + ?> +
+
-widget('bootstrap.widgets.TbModal', array( - 'id' => 'alertPrivacy1', - 'header' => gt('Warning','unescaped'), - 'content' => '

'.gT("You can't use Anonymized responses when Token-based answers persistence is enabled.").'

', - 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) -)); -$this->widget('bootstrap.widgets.TbModal', array( - 'id' => 'alertPrivacy2', - 'header' => gt('Warning','unescaped'), - 'content' => '

'.gT("If the option -Anonymized responses- is activated only a dummy date stamp (1980-01-01) will be used for all responses to ensure the anonymity of your participants.").'

', - 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) -)); -?> \ No newline at end of file + widget('bootstrap.widgets.TbModal', array( + 'id' => 'alertPrivacy1', + 'header' => gt('Warning','unescaped'), + 'content' => '

'.gT("You can't use Anonymized responses when Token-based answers persistence is enabled.").'

', + 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) + )); + $this->widget('bootstrap.widgets.TbModal', array( + 'id' => 'alertPrivacy2', + 'header' => gt('Warning','unescaped'), + 'content' => '

'.gT("If the option -Anonymized responses- is activated only a dummy date stamp (1980-01-01) will be used for all responses to ensure the anonymity of your participants.").'

', + 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) + )); + ?> \ No newline at end of file diff --git a/assets/packages/adminpanel/build/lsadminpanel.js b/assets/packages/adminpanel/build/lsadminpanel.js index bd2c05feaec..14aac753bc0 100644 --- a/assets/packages/adminpanel/build/lsadminpanel.js +++ b/assets/packages/adminpanel/build/lsadminpanel.js @@ -27381,14 +27381,17 @@ module.exports = __webpack_require__(55); Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vuex__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_lodash__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_lodash___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_lodash__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_sidebar_vue__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_sidebar_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__components_sidebar_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_topbar_vue__ = __webpack_require__(31); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_topbar_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__components_topbar_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_pjax__ = __webpack_require__(36); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_pjax___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_pjax__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_vue_localstorage__ = __webpack_require__(59); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_vue_localstorage___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_vue_localstorage__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lodash__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_lodash___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_lodash__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_sidebar_vue__ = __webpack_require__(15); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_sidebar_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__components_sidebar_vue__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_topbar_vue__ = __webpack_require__(31); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_topbar_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__components_topbar_vue__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_pjax__ = __webpack_require__(36); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_pjax___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_pjax__); + @@ -27397,6 +27400,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].use(__WEBPACK_IMPORTED_MODULE_1_vuex__["a" /* default */]); +__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].use(__WEBPACK_IMPORTED_MODULE_2_vue_localstorage___default.a); const AppState = new __WEBPACK_IMPORTED_MODULE_1_vuex__["a" /* default */].Store({ state: { @@ -27419,7 +27423,7 @@ if(document.getElementById('vue-side-menu-app')){ el: '#vue-side-menu-app', store: AppState, components: { - 'sidebar' : __WEBPACK_IMPORTED_MODULE_3__components_sidebar_vue___default.a, + 'sidebar' : __WEBPACK_IMPORTED_MODULE_4__components_sidebar_vue___default.a, }, mounted(){ this.$store.commit('updateSurveyId', $(this.$el).data('surveyid')); @@ -27427,7 +27431,7 @@ if(document.getElementById('vue-side-menu-app')){ }); } -const pjaxed = new __WEBPACK_IMPORTED_MODULE_5_pjax___default.a({ +const pjaxed = new __WEBPACK_IMPORTED_MODULE_6_pjax___default.a({ elements: "a.pjax", // default is "a[href], form[action]" selectors: [ "#in_survey_common" @@ -28646,20 +28650,31 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); checkIsActive(link) { let locationUrl = document.createElement('a');locationUrl.href = location.href; let checkUrl = document.createElement('a');checkUrl.href = link; - console.log(locationUrl.pathname, checkUrl.pathname, link, locationUrl.pathname == checkUrl.pathname); return locationUrl.pathname == checkUrl.pathname; + }, + sortedMenu(entries) { + let retVal = __WEBPACK_IMPORTED_MODULE_1_lodash___default.a.orderBy(entries, a => { + return parseInt(a.priority); + }, ['desc']); + return retVal; } }, mounted() { const self = this; + this.menues = JSON.parse(self.$localStorage.get('menues', JSON.stringify([]))); + this.questiongroups = JSON.parse(self.$localStorage.get('questiongroups', JSON.stringify([]))); this.get(this.getQuestionsUrl).then(result => { console.log(result); self.questiongroups = result.data.groups; + self.$localStorage.set('questiongroups', JSON.stringify(self.questiongroups)); self.$forceUpdate(); }); this.get(this.getMenuUrl).then(result => { console.log(result); - self.menues = result.data.menues; + self.menues = __WEBPACK_IMPORTED_MODULE_1_lodash___default.a.orderBy(result.data.menues, a => { + return parseInt(a.priority); + }, ['desc']); + self.$localStorage.set('menues', JSON.stringify(self.menues)); self.$forceUpdate(); }); } @@ -29069,7 +29084,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c attrs: { "title": menu.title } - }, _vm._l((menu.entries), function(menuItem, index) { + }, _vm._l((_vm.sortedMenu(menu.entries)), function(menuItem, index) { return _c('li', { directives: [{ name: "show", @@ -29090,21 +29105,27 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c "data-toggle": "tooltip" } }, [_c('div', { - class: _vm.checkIsActive(menuItem.link) ? 'col-sm-10 selected' : 'col-sm-12', + staticClass: "col-sm-10", + class: _vm.checkIsActive(menuItem.link) ? 'selected' : '', staticStyle: { "padding": "15px 10px" } }, [_c('i', { staticClass: "fa", class: 'fa-' + menuItem.menu_icon - }, [_vm._v(" ")]), _vm._v("  \n " + _vm._s(menuItem.menu_title) + "\n ")]), _vm._v(" "), (_vm.checkIsActive(menuItem.link)) ? _c('div', { - staticClass: "col-sm-2 background white", + }, [_vm._v(" ")]), _vm._v("  \n "), _c('span', { + domProps: { + "innerHTML": _vm._s(menuItem.menu_title) + } + })]), _vm._v(" "), _c('div', { + staticClass: "col-sm-2 text-center", + class: _vm.checkIsActive(menuItem.link) ? 'background white' : '', staticStyle: { "padding": "15px 10px" } }, [_c('i', { staticClass: "fa fa-chevron-right" - }, [_vm._v(" ")])]) : _vm._e()])]) + }, [_vm._v(" ")])])])]) })) }), _vm._v(" "), _c('div', { directives: [{ @@ -30581,5 +30602,188 @@ module.exports = function (css) { }; +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * vue-local-storage v0.2.0 + * (c) 2017 Abdelrahman Awad + * @license MIT + */ +(function (global, factory) { + true ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.VeeValidate = factory()); +}(this, (function () { 'use strict'; + +var ls$1 = window.localStorage; + +var VueLocalStorage = function VueLocalStorage () { + this._properties = {}; +}; + +/** + * Get value from localStorage + * + * @param {String} lsKey + * @param {*} defaultValue + * @returns {*} + */ +VueLocalStorage.prototype.get = function get (lsKey, defaultValue) { + var this$1 = this; + if ( defaultValue === void 0 ) defaultValue = null; + + if (ls$1[lsKey]) { + var type = String; + + for (var key in this$1._properties) { + if (key === lsKey) { + type = this$1._properties[key].type; + break + } + } + + return this._process(type, ls$1[lsKey]) + } + + return defaultValue !== null ? defaultValue : null +}; + +/** + * Set localStorage value + * + * @param {String} lsKey + * @param {*} value + * @returns {*} + */ +VueLocalStorage.prototype.set = function set (lsKey, value) { + var this$1 = this; + + for (var key in this$1._properties) { + var type = this$1._properties[key].type; + + if ((key === lsKey) && [Array, Object].includes(type)) { + ls$1.setItem(lsKey, JSON.stringify(value)); + + return value + } + } + + ls$1.setItem(lsKey, value); + + return value +}; + +/** + * Remove value from localStorage + * + * @param {String} lsKey + */ +VueLocalStorage.prototype.remove = function remove (lsKey) { + return ls$1.removeItem(lsKey) +}; + +/** + * Add new property to localStorage + * + * @param {String} key + * @param {function} type + * @param {*} defaultValue + */ +VueLocalStorage.prototype.addProperty = function addProperty (key, type, defaultValue) { + type = type || String; + + this._properties[key] = { type: type }; + + if (!ls$1[key] && defaultValue !== null) { + ls$1.setItem(key, [Array, Object].includes(type) ? JSON.stringify(defaultValue) : defaultValue); + } +}; + +/** + * Process the value before return it from localStorage + * + * @param {String} type + * @param {*} value + * @returns {*} + * @private + */ +VueLocalStorage.prototype._process = function _process (type, value) { + switch (type) { + case Boolean: + return value === 'true' + case Number: + return parseInt(value, 10) + case Array: + try { + var array = JSON.parse(value); + + return Array.isArray(array) ? array : [] + } catch (e) { + return [] + } + case Object: + try { + return JSON.parse(value) + } catch (e) { + return {} + } + default: + return value + } +}; + +var VueLocalStorage$1 = new VueLocalStorage(); + +var ls = window.localStorage; + +try { + var test = '__vue-localstorage-test__'; + + ls.setItem(test, test); + ls.removeItem(test); +} catch (e) { + console.error('Local storage is not supported'); +} + +var index = { + /** + * Install vue-local-storage plugin + * + * @param {Vue} Vue + * @param {Object} options + */ + install: function (Vue, options) { + if ( options === void 0 ) options = {}; + + var name = options.name || 'localStorage'; + + Vue.mixin({ + created: function created () { + var this$1 = this; + + if (this.$options[name]) { + Object.keys(this.$options[name]).forEach(function (key) { + var ref = [this$1.$options[name][key].type, this$1.$options[name][key].default]; + var type = ref[0]; + var defaultValue = ref[1]; + + VueLocalStorage$1.addProperty(key, type, defaultValue); + }); + } + } + }); + + Vue[name] = VueLocalStorage$1; + Vue.prototype[("$" + name)] = VueLocalStorage$1; + } +}; + +return index; + +}))); + + /***/ }) /******/ ]); \ No newline at end of file diff --git a/assets/packages/adminpanel/package.json b/assets/packages/adminpanel/package.json index 481a073e180..e333a991492 100644 --- a/assets/packages/adminpanel/package.json +++ b/assets/packages/adminpanel/package.json @@ -29,6 +29,7 @@ "lodash": "^4.17.4", "pjax": "^0.2.4", "vue": "^2.3.4", + "vue-localstorage": "^0.3.0", "vuex": "^2.3.1" } } diff --git a/assets/packages/adminpanel/yarn.lock b/assets/packages/adminpanel/yarn.lock index 327e28a31ea..50ade2e10ab 100644 --- a/assets/packages/adminpanel/yarn.lock +++ b/assets/packages/adminpanel/yarn.lock @@ -4168,6 +4168,10 @@ vue-loader@^12.2.1: vue-style-loader "^3.0.0" vue-template-es2015-compiler "^1.2.2" +vue-localstorage@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/vue-localstorage/-/vue-localstorage-0.3.0.tgz#3c37e9b7906ffde1ae899dc9c93a3ea0496f1ce0" + vue-style-loader@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-3.0.1.tgz#c8b639bb2f24baf9d78274dc17e4f264c1deda08"