Skip to content

Commit

Permalink
remove some obsolete DSL properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Jun 27, 2024
1 parent 42fcf07 commit 6aca097
Show file tree
Hide file tree
Showing 39 changed files with 24 additions and 1,486 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,10 @@ class WorkflowStart {
settings.appVersion = if (null !== app.version) app.version else '1.0.0' //$NON-NLS-1$

// compute destination path for model files
if (app.writeModelToDocs) {
//modelDestinationPath = File.separator + 'symfony' + File.separator + settings.appName + File.separator
var modelDestinationPath = settings.getPathToBundleRoot
modelDestinationPath += 'Resources' + File.separator + 'docs' + File.separator + 'model' + File.separator //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.modelDestinationPath = modelDestinationPath
}
//modelDestinationPath = File.separator + 'symfony' + File.separator + settings.appName + File.separator
var modelDestinationPath = settings.getPathToBundleRoot
modelDestinationPath += 'Resources' + File.separator + 'docs' + File.separator + 'model' + File.separator //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.modelDestinationPath = modelDestinationPath

return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import de.guite.modulestudio.metamodel.DetailAction
import de.guite.modulestudio.metamodel.EditAction
import de.guite.modulestudio.metamodel.Entity
import de.guite.modulestudio.metamodel.IndexAction
import org.zikula.modulestudio.generator.cartridges.symfony.controller.action.ActionRoute
import org.zikula.modulestudio.generator.cartridges.symfony.controller.action.Actions
import org.zikula.modulestudio.generator.extensions.FormattingExtensions
import org.zikula.modulestudio.generator.extensions.ModelBehaviourExtensions
import org.zikula.modulestudio.generator.cartridges.symfony.controller.action.ActionRoute

class ControllerAction {

Expand All @@ -22,7 +22,7 @@ class ControllerAction {
Actions actionsImpl

new(Application app) {
routeAnnotation = new ActionRoute(app)
routeAnnotation = new ActionRoute()
actionsImpl = new Actions(app)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,6 @@ class ServiceDefinitions {
«IF hasIndexActions»
- { name: knp_menu.menu_builder, method: createViewActionsMenu, alias: «vendorAndName.toFirstLower»MenuViewActions }
«ENDIF»
«IF !getAllEntities.filter[hasIpTraceableFields].empty»
gedmo_doctrine_extensions.listener.ip_traceable:
class: Gedmo\IpTraceable\IpTraceableListener
public: false
calls:
- setAnnotationReader: ['@annotation_reader']
tags:
- { name: doctrine.event_subscriber, connection: default }
«ENDIF»
«IF hasSluggable»
stof_doctrine_extensions.listener.sluggable:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zikula.modulestudio.generator.cartridges.symfony.controller.action

import de.guite.modulestudio.metamodel.Action
import de.guite.modulestudio.metamodel.Application
import de.guite.modulestudio.metamodel.CustomAction
import de.guite.modulestudio.metamodel.DeleteAction
import de.guite.modulestudio.metamodel.DetailAction
Expand All @@ -13,21 +12,13 @@ import org.zikula.modulestudio.generator.extensions.FormattingExtensions
import org.zikula.modulestudio.generator.extensions.ModelBehaviourExtensions
import org.zikula.modulestudio.generator.extensions.ModelExtensions
import org.zikula.modulestudio.generator.extensions.Utils
import org.zikula.modulestudio.generator.extensions.ViewExtensions

class ActionRoute {

extension FormattingExtensions = new FormattingExtensions
extension ModelBehaviourExtensions = new ModelBehaviourExtensions
extension ModelExtensions = new ModelExtensions
extension Utils = new Utils
extension ViewExtensions = new ViewExtensions

Application app

new(Application app) {
this.app = app
}

def generate(Action it) '''
«actionRoute(false
Expand All @@ -40,7 +31,7 @@ class ActionRoute {
def private dispatch actionRoute(IndexAction it, Boolean isAdmin) '''
#[Route('«IF isAdmin»/admin«ENDIF»/«entity.nameMultiple.formatForCode»/view/{sort}/{sortdir}/{page}/{num}.{_format}',
name: '«entity.application.appName.formatForDB»«IF isAdmin»_admin«ENDIF»_«entity.name.formatForDB»_index',
requirements: ['sortdir' => 'asc|desc|ASC|DESC', 'page' => '\d+', 'num' => '\d+', '_format' => 'html«IF app.getListOfViewFormats.size > 0»|«app.getListOfViewFormats.join('|')»«ENDIF»'],
requirements: ['sortdir' => 'asc|desc|ASC|DESC', 'page' => '\d+', 'num' => '\d+', '_format' => 'html'],
defaults: ['sort' => '', 'sortdir' => 'asc', 'page' => 1, 'num' => 10, '_format' => 'html'],
methods: ['GET']
)]
Expand All @@ -49,7 +40,7 @@ class ActionRoute {
def private actionRouteForSingleEntity(Entity it, Action action, Boolean isAdmin) '''
#[Route('«IF isAdmin»/admin«ENDIF»/«name.formatForCode»/«IF !(action instanceof DetailAction)»«action.name.formatForCode»/«ENDIF»«actionRouteParamsForSingleEntity(action)».{_format}',
name: '«application.appName.formatForDB»«IF isAdmin»_admin«ENDIF»_«name.formatForDB»_detail',
requirements: [«actionRouteRequirementsForSingleEntity(action)», '_format' => 'html«IF action instanceof DetailAction && app.getListOfDisplayFormats.size > 0»|«app.getListOfDisplayFormats.join('|')»«ENDIF»'],
requirements: [«actionRouteRequirementsForSingleEntity(action)», '_format' => 'html'],
defaults: [«IF action instanceof EditAction»«actionRouteDefaultsForSingleEntity(action)», «ENDIF»'_format' => 'html'],
methods: ['GET'«IF action instanceof EditAction || action instanceof DeleteAction», 'POST'«ENDIF»]«IF tree != EntityTreeType.NONE»,
options: ['expose' => true]«ENDIF»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ import de.guite.modulestudio.metamodel.EntityTreeType
import de.guite.modulestudio.metamodel.EntityWorkflowType
import de.guite.modulestudio.metamodel.IndexAction
import org.zikula.modulestudio.generator.extensions.ControllerExtensions
import org.zikula.modulestudio.generator.extensions.DateTimeExtensions
import org.zikula.modulestudio.generator.extensions.FormattingExtensions
import org.zikula.modulestudio.generator.extensions.ModelBehaviourExtensions
import org.zikula.modulestudio.generator.extensions.Utils

class Actions {

extension ControllerExtensions = new ControllerExtensions
extension DateTimeExtensions = new DateTimeExtensions
extension FormattingExtensions = new FormattingExtensions
extension ModelBehaviourExtensions = new ModelBehaviourExtensions
extension Utils = new Utils
Expand Down Expand Up @@ -170,21 +168,7 @@ class Actions {
def private processDisplayOutput(Entity it) '''
// fetch and return the appropriate template
$response = $viewHelper->processTemplate($objectType, 'detail', $templateParameters);
«IF app.generateIcsTemplates && hasStartAndEndDateField»

if ('ics' === $request->getRequestFormat()) {
$fileName = $objectType . '_' .
(property_exists($«name.formatForCode», 'slug')
? $«name.formatForCode»['slug']
: $this->entityDisplayHelper->getFormattedTitle($«name.formatForCode»)
) . '.ics'
;
$response->headers->set('Content-Disposition', 'attachment; filename=' . $fileName);
}
«ENDIF»

return $response;
return $viewHelper->processTemplate($objectType, 'detail', $templateParameters);
'''
def private dispatch actionImplBody(Entity it, EditAction action) '''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ package org.zikula.modulestudio.generator.cartridges.symfony.controller.action

import de.guite.modulestudio.metamodel.Entity
import org.zikula.modulestudio.generator.extensions.ControllerExtensions
import org.zikula.modulestudio.generator.extensions.DateTimeExtensions
import org.zikula.modulestudio.generator.extensions.FormattingExtensions
import org.zikula.modulestudio.generator.extensions.ModelBehaviourExtensions
import org.zikula.modulestudio.generator.extensions.Utils

class LoggableUndelete {

extension ControllerExtensions = new ControllerExtensions
extension DateTimeExtensions = new DateTimeExtensions
extension FormattingExtensions = new FormattingExtensions
extension ModelBehaviourExtensions = new ModelBehaviourExtensions
extension Utils = new Utils
Expand Down Expand Up @@ -58,9 +56,6 @@ class LoggableUndelete {
ViewHelper $viewHelper,
EntityFactory $entityFactory,
LoggableHelper $loggableHelper,
«IF application.generateIcsTemplates && hasStartAndEndDateField»
EntityDisplayHelper $entityDisplayHelper,
«ENDIF»
«IF hasTranslatableFields»
TranslatableHelper $translatableHelper,
«ENDIF»
Expand Down Expand Up @@ -95,9 +90,6 @@ class LoggableUndelete {
$viewHelper,
$entityFactory,
$loggableHelper,
«IF application.generateIcsTemplates && hasStartAndEndDateField»
$entityDisplayHelper,
«ENDIF»
$«name.formatForCode»,
null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ class ConfigureFields implements ControllerMethodInterface {
if (entity.hasIndexAction && !visibleOnSort) {
calls += '->setSortable(false)'
}
if (entity.hasEditAction) {
if (null !== cssClass && !cssClass.empty) {
calls += '''->setColumns('«cssClass»')'''
}
}
calls
}
Expand Down
Loading

0 comments on commit 6aca097

Please sign in to comment.