Commit ba9ec6c7 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Gestion des sections

parent 49c3b0ef
Loading
Loading
Loading
Loading
+16 −1
Changes for module/Oscar/src/Oscar/Controller/AbstractOscarController.php: 16 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ use Zend\View\Model\JsonModel;
class AbstractOscarController extends AbstractActionController
{

    public function oscarRest( $default, $get, $post=null)
    public function oscarRest( $default, $get, $post=null, $delete=null)
    {
        $format = $this->params()->fromQuery('format', 'html');

@@ -59,6 +59,14 @@ class AbstractOscarController extends AbstractActionController
            return $default();
        } else {
            $method = $this->getHttpXMethod();


            $fakeAction = $this->params()->fromPost('action', null);

            if( $fakeAction == 'delete' ){
                $method = 'DELETE';
            }

            switch( $method ){
                case "GET" :
                    $datas = $get();
@@ -71,6 +79,13 @@ class AbstractOscarController extends AbstractActionController
                    $datas = $post();
                    break;

                case "DELETE" :
                    if( !is_callable($delete) ) {
                        return $this->getResponseNotImplemented();
                    }
                    $datas = $delete();
                    break;

                default:
                    return $this->getResponseBadRequest("Mauvaise méthod $method");
            }
+19 −2
Changes for module/Oscar/src/Oscar/Controller/AdministrationController.php: 19 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -52,12 +52,13 @@ class AdministrationController extends AbstractOscarController

                ];
            },
            // GET
            function(){

                return [
                    'sections' => $this->getEntityManager()->getRepository(AdministrativeDocumentSection::class)->createQueryBuilder('s')->getQuery()->getArrayResult()
                ];
            },
            // POST
            function(){
                $id     = $this->params()->fromPost('id', null);
                if( $id ){
@@ -74,10 +75,26 @@ class AdministrationController extends AbstractOscarController
                $section->setLabel($label);
                try {
                    $this->getEntityManager()->flush($section);
                    return ["response" => "Enregistrement terminé"];
                    return ["response" => "Section enregistrée"];
                } catch (\Exception $e ){
                    throw new \Exception($e->getMessage());
                }
            },
            function(){
                $id     = $this->params()->fromPost('id', null);

                $section = $this->getEntityManager()->getRepository(AdministrativeDocumentSection::class)->find($id);
                if( !$section ){
                    throw new \Exception("Section introuvable");
                }
                try {
                    $this->getEntityManager()->remove($section);
                    $this->getEntityManager()->flush($section);
                } catch (\Exception $e ){
                    throw $e;
                }
                return ["response" => "Section supprimée"];

            }
        );
    }
+21 −0
Changes for public/css/_common.scss: 21 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -101,6 +101,27 @@
  }
}

.widget {
  .widget-loading-message {
    display: none;
  }

  &.loading {
    .widget-content {
      filter: blur(.25em);
    }
    .widget-loading-message {
      display: block;
      position: absolute;
      z-index: 5;
      text-align: center;
      left: 25%;
      right: 25%;
      top: 40%;
    }
  }
}


.label i[class *= "icon-"] {
  color: white !important;
+15 −0
Changes for public/css/adaj.css: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5435,6 +5435,21 @@ button.close {
.card.disabled {
  border-left: 4px #5a5a5a solid; }

.widget .widget-loading-message {
  display: none; }

.widget.loading .widget-content {
  filter: blur(0.25em); }

.widget.loading .widget-loading-message {
  display: block;
  position: absolute;
  z-index: 5;
  text-align: center;
  left: 25%;
  right: 25%;
  top: 40%; }

.label i[class*="icon-"] {
  color: white !important; }

+15 −0
Changes for public/css/app-beta.css: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5435,6 +5435,21 @@ button.close {
.card.disabled {
  border-left: 4px #5a5a5a solid; }

.widget .widget-loading-message {
  display: none; }

.widget.loading .widget-content {
  filter: blur(0.25em); }

.widget.loading .widget-loading-message {
  display: block;
  position: absolute;
  z-index: 5;
  text-align: center;
  left: 25%;
  right: 25%;
  top: 40%; }

.label i[class*="icon-"] {
  color: white !important; }

Loading