diff --git a/src/client/app/js/app/core/Controller.js b/src/client/app/js/app/core/Controller.js index 3d1defe..45c567e 100644 --- a/src/client/app/js/app/core/Controller.js +++ b/src/client/app/js/app/core/Controller.js @@ -252,6 +252,10 @@ app.core.Controller = (function(){ { app.core.StateManager.switchTo( new app.state.GroupLeave(), r.params ); }); + rlite.add( 'group/:groupId/terms', function( r ) + { + app.core.StateManager.switchTo( new app.state.GroupTermsConditions(), r.params ); + }); // stop: group(s) // start: profile diff --git a/src/client/app/js/app/core/Dict.js b/src/client/app/js/app/core/Dict.js index 62667e3..1c42105 100644 --- a/src/client/app/js/app/core/Dict.js +++ b/src/client/app/js/app/core/Dict.js @@ -240,6 +240,7 @@ app.core.Dict = { "EDIT_GROUP" : "Gruppe bearbeiten", "GROUP_NAME" : "Gruppenname", "GROUP_DESCRIPTION" : "Beschreibung", + "GROUP_TERMS": "Nutzungsbedingungn", "GROUP_TERMS_DESCRIPTION": "Begrüßung und Nutzungsbedingungen", "GROUP_TERMS_ACTIVE": "Nutzungsbedingungen aktiv", "GROUP_TERMS_ACTIVE_DESCRIPTION": "Wenn die Nutzungsbedingungen aktiv sind, müssen Gruppenmitglieder diese aktiv akzeptieren um weiter aktiv an Terminen teilnehmen zu können.", diff --git a/src/client/app/js/app/model/Group.js b/src/client/app/js/app/model/Group.js index 0271042..589cafb 100644 --- a/src/client/app/js/app/model/Group.js +++ b/src/client/app/js/app/model/Group.js @@ -17,7 +17,7 @@ app.model.Group = function( data, memberData ) category = data.category, description = data.description || null, termsConditions = data.terms_conditions || null, - termsConditionsActive = data.terms_conditions_active === 1, + termsConditionsActive = data.terms_conditions_active == 1, contactInformation = data.contact_information || null, emblemUrl = data.emblem_url || null, emblem_cloud_id = data.emblem_cloud_id || null, diff --git a/src/client/app/js/app/state/GroupTermsConditions.js b/src/client/app/js/app/state/GroupTermsConditions.js new file mode 100644 index 0000000..1ff5582 --- /dev/null +++ b/src/client/app/js/app/state/GroupTermsConditions.js @@ -0,0 +1,50 @@ +/** + * (c) by aheadware.com + */ + +var app = app || {}; +app.state = app.state || {}; + +app.state.GroupTermsConditions = function() +{ + var state = app.core.StateManager.createState( 'group-terms-conditions' ); + + state.onEnter = function( p ) + { + var $content = app.core.View.getContent(), + groupId = p.groupId; + + app.gui.PageLoader.show(); + + app.core.Rpc.call( + 'Team', + 'getDetails', + { teamId : groupId }, + function( res ) + { + var mGroup = new app.model.Group(res.team), + currentProfile = null; + + app.core.View.setContent( + app.core.View.getTemplate( + 'group-setting', + { + group: mGroup, + currentProfile: app.model.SessionUser.getUserProfile() + }) + ); + + $content.find( '[data-id="btn-copy-ical-group-link"]' ).first().click( function() + { + app.util.Helper.copyInputToClipboard( $content.find( '[data-id="input-group-ical"]' ).first() ); + app.core.View.toastSuccess( _lc( 'CALENDER_LINK_COPIED' ) ); + }); + + + app.gui.PageLoader.hide(); + } + ); + }; + + return state; +}; \ No newline at end of file diff --git a/src/client/app/js/app/state/Home.js b/src/client/app/js/app/state/Home.js index c9fb240..95cedc3 100644 --- a/src/client/app/js/app/state/Home.js +++ b/src/client/app/js/app/state/Home.js @@ -228,6 +228,7 @@ app.state.Home = function() filter = this.getStateSetting( 'filter' ), isBackButton = app.core.StateManager.isPreviousState(), scrollY = +this.getStateSetting( 'scrollY' ); + groupsTermsNotAccepted = []; // For paging self.currentPage = 1; @@ -251,6 +252,12 @@ app.state.Home = function() for ( var ui = 0; ui < userGroups.length; ui++ ) { + let groupData = app.model.SessionUser.getUserProfile().getGroupData(userGroups[ ui ].id)[0]; + if (userGroups[ ui ].getTermsConditionsActive() && !groupData.terms_accepted) { + groupsTermsNotAccepted.push(userGroups[ ui ]); + } + console.log(groupsTermsNotAccepted); + gcgIds = userGroups[ ui ].getCourseCategories(); for ( var gci = 0; gci < gcgIds.length; gci++ ) { @@ -1066,7 +1073,17 @@ app.state.Home = function() sessionStorage.removeItem("g_ids_popup_shown"); } - if (showPopup) { + if (groupsTermsNotAccepted.length > 0) { + // Show terms not accepted popup + app.core.View.showModal({ + title: _lc('HOME_MODAL_TERMS_NOT_ACCEPTED_TITLE'), + body: app.core.View.getTemplate('home-modal-terms-not-accepted', {}), + hideButtons: true, + hideCloseBtn: true, + prohibitCloseModal: true, + }); + + } else if (showPopup) { app.core.View.showModal({ title: _lc('HOME_MODAL_NOT_ACTIVATED_TITLE'), body: app.core.View.getTemplate('home-modal-not-activated', { groupName: groupName }), @@ -1082,15 +1099,6 @@ app.state.Home = function() window.location.href = $(this).attr("href"); }); } - - app.core.View.showModal({ - title: _lc('HOME_MODAL_TERMS_NOT_ACCEPTED_TITLE'), - body: app.core.View.getTemplate('home-modal-terms-not-accepted', {}), - hideButtons: true, - hideCloseBtn: true, - prohibitCloseModal: true, - }); - } ); }; diff --git a/src/client/app/tmpl/group-nav.html b/src/client/app/tmpl/group-nav.html index 415422a..63962fa 100644 --- a/src/client/app/tmpl/group-nav.html +++ b/src/client/app/tmpl/group-nav.html @@ -28,4 +28,10 @@ <% } %> +
+ <%= _lc( 'GROUP_TERMS_DESCRIPTION' ) %> +
++ <%= _lc( 'GROUP_TERMS_ACTIVE_DESCRIPTION' ) %> +
+