Changeset 2748


Ignore:
Timestamp:
May 20, 2012, 12:35:27 AM (8 years ago)
Author:
teymour
Message:

Petite optimisation dans la gestion des URL

Location:
cpc/trunk/project/apps/frontend/modules/parlementaire
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/parlementaire/actions/actions.class.php

    r2747 r2748  
    553553  public function executeWidget(sfWebRequest $request) {
    554554    $this->search = $request->getParameter('depute');
    555     $dep = $this->searchDepute($this->search);
     555    $this->internal = $request->getParameter('internal');
     556   $dep = $this->searchDepute($this->search);
    556557    $this->parl = null;
    557558    if (!$dep) return;
    558559    $this->parl = $dep->slug;
    559     if ($this->parl != $this->search) {
    560       return $this->redirect('parlementaire/widget?depute='.$this->parl);
     560    if ($this->parl != $this->search && !$this->internal) {
     561      return $this->redirect('parlementaire/widget?depute='.$this->parl."&".$_SERVER['QUERY_STRING']);
    561562    }
    562563    $this->options = array('titre' => 1, 'photo' => 1, 'graphe' => 1, 'activite' => 1, 'tags' => 1, 'iframe' => 0);
  • cpc/trunk/project/apps/frontend/modules/parlementaire/templates/widgetEditorSuccess.php

    r2744 r2748  
    3030var updateIframe = function() {
    3131  if (!$('#url').val()) return;
    32   if ($('#height').val() == $('#resultat').height()) return;
    3332  $('#height').val($('#resultat').height());
    3433  $("#iframe").val('<iframe frameborder="0" scrolling="no" src="'+$('#url').val()+'" height="'+($('#height').val()*1+20)+'" width="'+$('#width').val()+'"></iframe>');
     
    3736   var nom = $('#nom').val();
    3837   if (!nom) return;
    39    var slug = $('#slug').val();
    40    if (slug)   nom = slug;
     38   if ($(this).attr('id') == "nom") {
     39     $('#slug').val(null);
     40   } else {
     41     var slug = $('#slug').val(); 
     42     if (slug)   nom = slug;
     43   }
    4144   $("#preview").show();
    4245   var url = 'http://'+window.location.hostname+'/widget/'+nom.replace(/ /, '-')+"?iframe=true&";
     
    5962   $('#url').val(url);
    6063   updateIframe();
    61    $('#resultat').load(url, function(text, status) {
     64   $('#resultat').load(url+"&internal=1", function(text, status) {
    6265     updateIframe();
    6366   });
    6467};
    65 $("#nom").change(function() {$("#slug").val('');});
    6668$('.update').change(updatePreview);
    6769$('#bouton').click(updatePreview);
  • cpc/trunk/project/apps/frontend/modules/parlementaire/templates/widgetSuccess.php

    r2742 r2748  
    11<?php if ($parl) include_component('parlementaire', 'widget', array('slug' => $parl, 'options' => $options));
    22else echo '<span>Aucun député trouvé pour « '.$search.' ».</span>'; ?>
     3<?php if ($internal) : ?>
     4<script>if ($('#slug').val() != "<?php echo $parl; ?>") {$('#slug').val("<?php echo $parl; ?>"); updatePreview();} </script>
     5<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.