To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Changeset 1062

Show
Ignore:
Timestamp:
04/26/10 16:26:04 (22 months ago)
Author:
dordille
Message:

Editing a blog slug now works as designed, this fixes #206.

Location:
plugins/apostropheBlogPlugin/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostropheBlogPlugin/trunk/config/doctrine/schema.yml

    r1046 r1062  
    66    Timestampable: ~ 
    77    Taggable: ~ 
    8     Sluggable: 
    9       canUpdate: true 
    108  columns: 
    119    id: 
     
    2018      type: string(255) 
    2119      notnull: true 
     20    slug: 
     21      type: string(255) 
     22      notnull: true 
     23      unique: true 
     24    slug_saved: 
     25      type: boolean 
     26      default: false 
    2227    excerpt: 
    2328      type: string 
  • plugins/apostropheBlogPlugin/trunk/config/routing.yml

    r1056 r1062  
    269269  url:    
    270270  param: { module: aEvent, action: today } 
    271   class: aRoute  
     271  class: aRoute 
    272272   
    273273   
     
    275275# blog admin routes # 
    276276################ 
    277  
    278  
    279277 
    280278a_blog_admin: 
     
    286284    column:              slug 
    287285    with_wildcard_routes: true 
    288     with_show:           false 
     286    with_show:            false 
    289287 
    290288a_blog_admin_autocomplete: 
     
    292290  param: { module: aBlogAdmin, action: autocomplete } 
    293291  class: sfRoute 
    294  
    295292 
    296293a_blog_admin_edit: 
  • plugins/apostropheBlogPlugin/trunk/lib/form/doctrine/PluginaBlogItemForm.class.php

    r1006 r1062  
    1717     
    1818    unset( 
    19       $this['type'], $this['page_id'], $this['created_at'], $this['updated_at'] 
     19      $this['type'], $this['page_id'], $this['created_at'], $this['updated_at'], $this['slug_saved'] 
    2020    ); 
    2121     
     
    5252    $this->widgetSchema['tags']       = new sfWidgetFormInput(array('default' => implode(', ', $this->getObject()->getTags())), array('class' => 'tag-input', 'autocomplete' => 'off')); 
    5353    $this->validatorSchema['tags']    = new sfValidatorString(array('required' => false)); 
    54   } 
    55  
    56   public function updateSlugColumn($value) 
    57   { 
    58     return $value; 
    5954  } 
    6055   
  • plugins/apostropheBlogPlugin/trunk/lib/model/doctrine/PluginaBlogItem.class.php

    r1046 r1062  
    1212 */ 
    1313abstract class PluginaBlogItem extends BaseaBlogItem 
    14  
     14{ 
     15  protected $update = true; 
     16 
    1517  /** 
    1618   * These date methods are use in the routing of the permalink 
     
    5153    $this->slug = 'untitled-'.$this['id']; 
    5254    $this->title = 'untitled'; 
     55    $this['slug_saved'] = false; 
     56    $this->update = false; 
    5357    $this->save(); 
     58  } 
     59 
     60  public function preUpdate($event) 
     61  { 
     62    if($this->update) 
     63    { 
     64      if(array_key_exists('slug', $this->getModified())) 
     65      { 
     66        $this['slug_saved'] = true; 
     67      } 
     68      if($this['slug_saved'] == false) 
     69      { 
     70        $this['slug'] = aTools::slugify($this['title']); 
     71      } 
     72    } 
    5473  } 
    5574   
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/lib/BaseaBlogAdminActions.class.php

    r1046 r1062  
    1717    $this->a_blog_post->Author = $this->getUser()->getGuardUser(); 
    1818    $this->a_blog_post->save(); 
    19     $this->redirect('aBlogAdmin/edit?slug='.$this->a_blog_post->getSlug()); 
     19    $this->redirect('a_blog_admin_edit', $this->a_blog_post); 
    2020  } 
    2121     
  • plugins/apostropheBlogPlugin/trunk/web/js/aBlog.js

    r1054 r1062  
    9898{ 
    9999                var permalinkInput = $('#a_blog_post_permalink_interface'); 
    100                  
     100    var slugInput = $('#a_blog_post_slug'); 
    101101                if (slug != null) 
    102102                { 
    103                         permalinkInput.val(slug);                        
     103                        permalinkInput.val(slug); 
     104      slugInput.val(slug); 
    104105                }; 
    105106