Changeset 38

Show
Ignore:
Timestamp:
12/15/05 09:24:51 (3 years ago)
Author:
fabien
Message:

new design + some more features + some refactoring

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/data/fixtures/test_data.yml

    r31 r38  
    4646      I have a very swell blog that talks  
    4747      about my class and mates and pets and favorite movies. 
     48 
     49  q4: 
     50    title: Test4 
     51    user_id: anonymous 
     52    body: Test 
     53 
     54  q5: 
     55    title: Test4 
     56    user_id: anonymous 
     57    body: Test 
     58 
     59  q6: 
     60    title: Test4 
     61    user_id: anonymous 
     62    body: Test 
    4863 
    4964Interest: 
  • trunk/data/sql/schema.sql

    r23 r38  
    108108) 
    109109Type=InnoDB; 
     110# ----------------------------------------------------------------------- 
     111# ask_question_tag  
     112# ----------------------------------------------------------------------- 
     113DROP TABLE IF EXISTS `ask_question_tag`; 
     114 
     115CREATE TABLE `ask_question_tag`( 
     116    `question_id` INTEGER ,  
     117    `user_id` INTEGER ,  
     118    `created_at` DATETIME ,  
     119    `tag` VARCHAR(100) ,  
     120    `normalized_tag` VARCHAR(100) ,   
     121    KEY `normalized_tag_index` (`normalized_tag`),   
     122    INDEX `ask_question_tag_FI_1` (`question_id`),  
     123    CONSTRAINT `ask_question_tag_FK_1`  
     124      FOREIGN KEY (`question_id`) 
     125      REFERENCES `ask_question` (`id`) 
     126,  
     127    INDEX `ask_question_tag_FI_2` (`user_id`),  
     128    CONSTRAINT `ask_question_tag_FK_2`  
     129      FOREIGN KEY (`user_id`) 
     130      REFERENCES `ask_user` (`id`) 
     131) 
     132Type=InnoDB; 
     133   
    110134   
    111135   
  • trunk/frontend/config/app.yml

    r27 r38  
    22all: 
    33  pager: 
    4     homepage_max: 2 
    5     answers_max:  1 
     4    homepage_max: 5 
     5    answers_max:  5 
    66    users_max:    10 
    77 
  • trunk/frontend/config/routing.yml

    r34 r38  
    4444add_account: 
    4545  url:   /add_user 
    46   param: { module: user, action: new
     46  param: { module: user, action: add
    4747 
    4848user_require_password: 
     
    7676  param: { module: tag, action: popular } 
    7777 
     78tag_remove: 
     79  url:   /question/:stripped_title/tag/remove/:tag 
     80  param: { module: tag, action: remove } 
     81 
    7882# feeds 
    7983feed_recent_answers: 
     
    8892  url:   /feed/question/:stripped_title 
    8993  param: { module: feed, action: question } 
     94 
     95# content 
     96about: 
     97  url:   /about 
     98  param: { module: content, action: about } 
    9099 
    91100# default rules 
  • trunk/frontend/lib/helper/AnswerHelper.php

    r25 r38  
    2222  use_helper('Javascript'); 
    2323 
     24  $img = image_tag('thumb_'.$name.'.gif'); 
     25 
    2426  if ($user->isAuthenticated()) 
    2527  { 
     
    2830    { 
    2931      // already interested 
    30       return $name
     32      return $img
    3133    } 
    3234    else 
    3335    { 
    3436      // didn't declare interest yet 
    35       return link_to_remote($name, array( 
     37      return link_to_remote($img, array( 
    3638        'url'      => 'user/vote?id='.$answer->getId().'&score='.($name == 'up' ? 1 : -1), 
    3739        'update'   => array('success' => 'vote_'.$answer->getId()), 
     
    4345  else 
    4446  { 
    45     return link_to_login($name); 
     47    return link_to_login($img); 
    4648  } 
    4749} 
  • trunk/frontend/lib/helper/GlobalHelper.php

    r29 r38  
    33function link_to_rss($name, $uri) 
    44{ 
    5   return link_to(image_tag('rss.gif', array('alt' => $name, 'title' => $name)), $uri); 
     5  return link_to(image_tag('rss.gif', array('alt' => $name, 'title' => $name, 'align' => 'absmiddle')), $uri); 
    66} 
    77 
     
    2929 
    3030    // First and previous page 
    31     $navigation .= link_to('«', $uri.'1'); 
    32     $navigation .= link_to('<', $uri.$pager->getPreviousPage())
     31    $navigation .= link_to(image_tag('first.gif', 'align=absmiddle'), $uri.'1'); 
     32    $navigation .= link_to(image_tag('previous.gif', 'align=absmiddle'), $uri.$pager->getPreviousPage()).' '
    3333 
    3434    // Pages one by one 
     
    3838      $links[] = link_to_unless($page == $pager->getPage(), $page, $uri.$page); 
    3939    } 
    40     $navigation .= join(' - ', $links); 
     40    $navigation .= join('  ', $links); 
    4141 
    4242    // Next and last page 
    43     $navigation .= link_to('>', $uri.$pager->getNextPage()); 
    44     $navigation .= link_to('»', $uri.$pager->getLastPage()); 
     43    $navigation .= ' '.link_to(image_tag('next.gif', 'align=absmiddle'), $uri.$pager->getNextPage()); 
     44    $navigation .= link_to(image_tag('last.gif', 'align=absmiddle'), $uri.$pager->getLastPage()); 
    4545  } 
    4646 
  • trunk/frontend/lib/helper/QuestionHelper.php

    r31 r38  
    1313} 
    1414 
     15function link_to_question($question) 
     16{ 
     17  return link_to($question->getTitle(), '@question?stripped_title='.$question->getStrippedTitle()); 
     18} 
     19 
    1520?> 
  • trunk/frontend/lib/helper/UserHelper.php

    r25 r38  
    2020        'update'   => array('success' => 'block_'.$question->getId()), 
    2121        'loading'  => "Element.show('indicator')", 
    22         'complete' => "Element.hide('indicator');".visual_effect('highlight', 'mark_'.$question->getId()), 
     22        'complete' => "Element.hide('indicator');".visual_effect('pulsate', 'mark_'.$question->getId()), 
    2323      )); 
    2424    } 
     
    3030} 
    3131 
     32function link_to_profile($user) 
     33{ 
     34  if ($user->getNickname() == 'anonymous') 
     35  { 
     36    return 'anonymous'; 
     37  } 
     38  else 
     39  { 
     40    return link_to($user->__toString(), '@user_profile?nickname='.$user->getNickname()); 
     41  } 
     42} 
     43 
    3244?> 
  • trunk/frontend/modules/answer/actions/actions.class.php

    r27 r38  
    1414  { 
    1515    $this->answer_pager = AnswerPeer::getRecentPager($this->getRequestParameter('page', 1)); 
     16 
     17    $this->setTitle('askeet! » recent answers'); 
    1618  } 
    1719 
  • trunk/frontend/modules/answer/templates/_answer.php

    r25 r38  
    1 <?php use_helper('Date') ?> 
     1<?php use_helpers('Date', 'User') ?> 
    22 
    33<div class="vote_block" id="vote_<?php echo $answer->getId() ?>"> 
    44  <?php echo include_partial('answer/vote_user', array('answer' => $answer)) ?> 
    55</div> 
    6 posted by <?php echo $answer->getUser() ?> 
    7 on <?php echo format_date($answer->getCreatedAt(), 'p') ?> 
    8 <div> 
     6 
     7<div class="answer_body"> 
    98  <?php echo $answer->getHtmlBody() ?> 
     9  <div class="subtitle">answered by <?php echo link_to_profile($answer->getUser()) ?> on <?php echo format_date($answer->getCreatedAt(), 'f') ?></div> 
    1010</div> 
     11 
     12<br class="clearleft" /> 
  • trunk/frontend/modules/answer/templates/_list.php

    r25 r38  
    22 
    33<div id="answers"> 
    4 <?php foreach ($answers as $answer): ?> 
    5   <div class="answer"> 
    6   <?php include_partial('answer/answer', array('answer' => $answer)) ?> 
    7   </div> 
    8 <?php endforeach ?> 
    94 
    10 <div class="answer" id="add_answer"> 
    11   <?php echo form_remote_tag(array( 
    12     'url'      => '@add_answer', 
    13     'update'   => array('success' => 'add_answer'), 
    14     'loading'  => "Element.show('indicator')", 
    15     'complete' => "Element.hide('indicator');".visual_effect('highlight', 'add_answer'), 
    16   )) ?> 
    17     <fieldset> 
     5  <?php foreach ($answers as $answer): ?> 
     6    <div class="answer"> 
     7      <?php include_partial('answer/answer', array('answer' => $answer)) ?> 
     8    </div> 
     9  <?php endforeach ?> 
    1810 
    19     <div class="form-row"> 
     11  <div class="answer" id="add_answer"> 
     12    <?php echo form_remote_tag(array( 
     13      'url'      => '@add_answer', 
     14      'update'   => array('success' => 'add_answer'), 
     15      'loading'  => "Element.show('indicator')", 
     16      'complete' => "Element.hide('indicator');".visual_effect('highlight', 'add_answer'), 
     17    ), 'class=form') ?> 
     18      <fieldset> 
     19 
     20      <label for="author">author:</label> 
     21      <div style="display: inline; float: left"> 
    2022      <?php if ($user->isAuthenticated()): ?> 
    2123        <?php echo $user->getNickname() ?> 
    2224      <?php else: ?> 
    23         <?php echo 'Anonymous Coward' ?> 
    24         <?php echo link_to_login('login') ?> 
     25        <?php echo 'anonymous coward' ?> 
     26        <?php echo link_to_login('[login]') ?> 
    2527      <?php endif ?> 
    26     </div> 
     28      </div> 
     29      <br class="clearleft" /> 
    2730 
    28     <div class="form-row"
    29       <label for="label">Your answer:</label
    30       <?php echo textarea_tag('body', $params->get('body')) ?
    31     </div
     31      <label for="body">your answer:</label
     32      <?php echo textarea_tag('body', $params->get('body'), 'size=40x10') ?
     33      <br class="clearleft" /
     34      <?php echo include_partial('content/markdown_help') ?
    3235 
    33     </fieldset> 
     36      </fieldset> 
    3437 
    35     <div class="submit-row"> 
    3638      <?php echo input_hidden_tag('question_id', $question->getId()) ?> 
    37       <?php echo submit_tag('answer it') ?> 
    38     </div> 
    39   </form> 
    40 </div> 
     39      <div class="right"> 
     40        <?php echo submit_tag('answer it') ?> 
     41      </div> 
     42    </form> 
     43  </div> 
    4144 
    4245</div> 
  • trunk/frontend/modules/answer/templates/_vote_user.php

    r20 r38  
    11<?php use_helper('Answer') ?> 
    22 
    3 <span class="vote_up_mark" id="vote_up_<?php echo $answer->getId() ?>"> 
     3<div class="vote_up_mark"><?php echo link_to_user_relevancy_up($user, $answer) ?></div> 
     4<div class="vote_down_mark"><?php echo link_to_user_relevancy_down($user, $answer) ?></div> 
     5 
     6<br class="clearleft" /> 
     7 
     8<div class="vote_up_mark" id="vote_up_<?php echo $answer->getId() ?>"> 
    49  <?php echo $answer->getRelevancyUpPercent() ?>% 
    5 </span> <?php echo link_to_user_relevancy_up($user, $answer) ?> 
    6  
    7 <span class="vote_down_mark" id="vote_down_<?php echo $answer->getId() ?>"> 
     10</div> 
     11<div class="vote_down_mark" id="vote_down_<?php echo $answer->getId() ?>"> 
    812  <?php echo $answer->getRelevancyDownPercent() ?>% 
    9 </span> <?php echo link_to_user_relevancy_down($user, $answer) ?
     13</div
  • trunk/frontend/modules/answer/templates/recentSuccess.php

    r27 r38  
    1 <?php use_helpers('Date', 'Answer') ?> 
     1<?php use_helpers('Date', 'Answer', 'Question') ?> 
    22 
    33<h1>recent answers</h1> 
     
    66<?php foreach ($answer_pager->getResults() as $answer): ?> 
    77  <div class="answer"> 
    8   <?php include_partial('answer/answer', array('answer' => $answer)) ?> 
     8    <h2><?php echo link_to_question($answer->getQuestion()) ?></h2> 
     9    <?php include_partial('answer/answer', array('answer' => $answer)) ?> 
    910  </div> 
    1011<?php endforeach ?> 
  • trunk/frontend/modules/question/actions/actions.class.php

    r25 r38  
    2323    $c = new Criteria(); 
    2424    $c->add(AnswerPeer::QUESTION_ID, $this->question->getId()); 
     25    $c->addDescendingOrderByColumn(AnswerPeer::RELEVANCY_UP); 
    2526    $this->answers = AnswerPeer::doSelect($c); 
     27 
     28    $this->setTitle('askeet! &raquo; '.$this->question->getTitle()); 
    2629  } 
    2730 
     
    2932  { 
    3033    $this->question_pager = QuestionPeer::getRecentPager($this->getRequestParameter('page', 1)); 
     34 
     35    $this->setTitle('askeet! &raquo; recent questions'); 
    3136  } 
    3237 
     
    4651      $user->isInterestedIn($question); 
    4752 
     53      $question->addTagsForUser($this->getRequestParameter('tag'), $user->getId()); 
     54 
    4855      return $this->redirect('@question?stripped_title='.$question->getStrippedTitle()); 
    4956    } 
  • trunk/frontend/modules/question/templates/_interested_user.php

    r20 r38  
    11<?php use_helper('User') ?> 
    22 
    3 <div class="interested_mark" id="mark_<?php echo $question->getId() ?>"> 
    4   <?php echo $question->getInterestedUsers() ?> 
     3<?php 
     4  $class = 'few_interests'; 
     5  if ($question->getInterestedUsers() > 1000) 
     6  { 
     7    $class = 'many_interests'; 
     8  } 
     9  else if ($question->getInterestedUsers() > 100) 
     10  { 
     11    $class = 'some_interests'; 
     12  } 
     13?> 
     14 
     15<div class="interested_mark <?php echo $class ?>" id="mark_<?php echo $question->getId() ?>"> 
     16  <?php echo $question->getInterestedUsers().'&nbsp;' ?> 
    517</div> 
    618 
    7 <?php echo link_to_user_interested($user, $question) ?> 
     19<div class="interested_link"><?php echo link_to_user_interested($user, $question) ?></div> 
     20 
  • trunk/frontend/modules/question/templates/_question_list.php

    r31 r38  
    1 <?php use_helpers('Text', 'Global', 'Question') ?> 
     1<?php use_helpers('Text', 'Global', 'Question', 'Date') ?> 
    22 
    33<?php foreach($question_pager->getResults() as $question): ?> 
     4<div class="question"> 
    45  <div class="interested_block" id="block_<?php echo $question->getId() ?>"> 
    56    <?php echo include_partial('question/interested_user', array('question' => $question)) ?> 
    67  </div> 
    78 
    8   <h2><?php echo link_to($question->getTitle(), '@question?stripped_title='.$question->getStrippedTitle()) ?></h2> 
     9  <h2><?php echo link_to_question($question) ?></h2> 
     10 
     11  <div class="subtitle">asked by <?php echo link_to_profile($question->getUser()) ?> on <?php echo format_date($question->getCreatedAt(), 'f') ?></div> 
    912 
    1013  <div class="question_body"> 
    1114    <?php echo truncate_text(strip_tags($question->getHtmlBody()), 200) ?> 
     15 
     16    <div class="tags"> 
     17 
     18    <?php if ($question->getAnswers()): ?> 
     19      <?php echo link_to(count($question->getAnswers()).' answer'.(count($question->getAnswers()) > 1 ? 's' : ''), '@question?stripped_title='.$question->getStrippedTitle()) ?> 
     20    <?php else: ?> 
     21      <?php echo link_to('answer it', '@question?stripped_title='.$question->getStrippedTitle()) ?> 
     22    <?php endif ?> 
     23 
     24    &nbsp;-&nbsp; 
     25 
     26    <?php if ($question->getTags()): ?> 
     27      tags: <?php echo tags_for_question($question) ?> 
     28    <?php endif ?> 
     29 
     30    </div> 
     31 
    1232  </div> 
    13   tags: <?php echo tags_for_question($question) ?
     33</div
    1434<?php endforeach ?> 
    1535 
    16 <div id="question_pager"
    17 <?php echo pager_navigation($question_pager, '@popular_questions') ?> 
     36<div id="question_pager" class="right"
     37  <?php echo pager_navigation($question_pager, '@popular_questions') ?> 
    1838</div> 
  • trunk/frontend/modules/question/templates/addSuccess.php

    r25 r38  
    1 <?php echo form_tag('@add_question') ?> 
     1<?php use_helper('Javascript') ?> 
     2 
     3<h1>ask a question</h1> 
     4 
     5<div class="in_form"> 
     6  <p> 
     7  Have you looked for similar questions? Check if a related question already exists: The more interesting a 
     8  question is, the more people will be willing to answer it. 
     9  </p> 
     10 
     11  <p> 
     12  Be as accurate as you can when giving a title to your question. Keep it short and put the details 
     13  in the question body. 
     14  </p> 
     15</div> 
     16 
     17<?php echo form_tag('@add_question', 'class=form') ?> 
    218 
    319  <fieldset> 
    420 
    5   <div class="form-row"> 
    6     <?php echo form_error('title') ?> 
    7     <label for="title">Question title:</label> 
    8     <?php echo input_tag('title', $params->get('title')) ?> 
    9   </div> 
     21  <?php echo form_error('title') ?> 
     22  <label for="title">question:</label> 
     23  <?php echo input_tag('title', $params->get('title'), 'size=40') ?> 
     24  <br class="clearleft" /> 
    1025 
    11   <div class="form-row"> 
    12     <?php echo form_error('body') ?> 
    13     <label for="label">Your question in details:</label> 
    14     <?php echo textarea_tag('body', $params->get('body')) ?> 
    15   </div> 
     26  <?php echo form_error('body') ?> 
     27  <label for="label">describe it:</label> 
     28  <?php echo textarea_tag('body', $params->get('body'), 'size=40x10') ?> 
     29  <br class="clearleft" /> 
     30  <?php echo include_partial('content/markdown_help') ?> 
     31 
     32  <?php echo form_error('tag') ?> 
     33  <label for="tag">tags:</label> 
     34  <?php echo input_auto_complete_tag('tag', '', '@tag_autocomplete', 'autocomplete=off', 'use_style=true') ?> 
     35  <br class="clearleft" /> 
     36  <div class="small in_form">example: askeet "how to"</div> 
    1637 
    1738  </fieldset> 
    1839 
    19   <div class="submit-row"> 
     40  <div class="right"> 
    2041    <?php echo submit_tag('ask it') ?> 
    2142  </div> 
  • trunk/frontend/modules/question/templates/showSuccess.php

    r27 r38  
    11<?php use_helpers('Date', 'Answer') ?> 
    22 
    3 <div class="interested_block"> 
    4   <?php echo include_partial('interested_user', array('question' => $question)) ?> 
    5 </div> 
    6      
    7 <h2><?php echo $question->getTitle() ?></h2> 
    8      
    9 <div class="question_body"> 
    10   <?php echo $question->getHtmlBody() ?> 
     3<h1></h1> 
     4 
     5<div class="question"> 
     6  <div class="interested_block"> 
     7    <?php echo include_partial('interested_user', array('question' => $question)) ?> 
     8  </div> 
     9 
     10  <h2><?php echo $question->getTitle() ?>&nbsp;<?php echo link_to_rss('this question feed', '@feed_question?stripped_title='.$question->getStrippedTitle()) ?></h2> 
     11 
     12  <div class="subtitle">asked by <?php echo link_to_profile($question->getUser()) ?> on <?php echo format_date($question->getCreatedAt(), 'f') ?></div> 
     13 
     14  <div class="question_body"> 
     15    <?php echo $question->getHtmlBody() ?> 
     16  </div> 
    1117</div> 
    1218 
    13 <p><?php echo link_to_rss('this question feed', '@feed_question?stripped_title='.$question->getStrippedTitle()) ?></p
     19<h2>Answers</h2
    1420 
    1521<?php include_partial('answer/list', array('question' => $question, 'answers' => $answers)) ?> 
  • trunk/frontend/modules/question/validate/add.yml

    r25 r38  
    11methods: 
    2   post: [title, body
     2  post: [title, body, tag
    33 
    44names: 
     
    99  body: 
    1010    required:     Yes 
    11     required_msg: You must provide a brief context for your question 
     11    required_msg: you must provide a brief context for your question 
    1212    validators:   bodyValidator 
     13 
     14  tag: 
     15    required:     Yes 
     16    required_msg: you must provide some tags for your question 
    1317 
    1418bodyValidator: 
  • trunk/frontend/modules/sidebar/templates/defaultSuccess.php

    r27 r38  
    11<?php use_helper('Global') ?> 
    22 
    3 <?php echo link_to_login('ask a new question', '@add_question') ?> 
     3<div id="add_question"> 
     4  <?php echo link_to_login('ask a new question', '@add_question') ?> 
     5</div> 
    46 
    5 <ul> 
    6   <li><?php echo link_to('popular questions', '@homepage') ?> <?php echo link_to_rss('popular questions', 'feed/popular') ?></li> 
    7   <li><?php echo link_to('latest questions', '@recent_questions') ?> <?php echo link_to_rss('latest questions', '@feed_recent_questions') ?></li> 
    8   <li><?php echo link_to('latest answers', '@recent_answers') ?> <?php echo link_to_rss('latest answers', '@feed_recent_answers') ?></li> 
    9 </ul> 
     7<h2>popular tags</h2> 
     8<?php echo include_partial('tag/tag_cloud', array('tags' => QuestionTagPeer::getPopularTags(20))) ?> 
     9<div class="right" style="padding-top: 5px"><?php echo link_to('more popular tags &raquo;', '@popular_tags') ?></div> 
     10 
     11<h2>browse askeet</h2> 
     12<?php echo include_partial('rss_links') ?> 
  • trunk/frontend/modules/sidebar/templates/questionSuccess.php

    r34 r38  
    1 <?php use_helper('Javascript') ?> 
     1<?php use_helper('Global', 'Javascript') ?> 
    22 
    3 <?php echo link_to('ask a new question', 'question/new') ?> 
     3<div id="add_question"> 
     4  <?php echo link_to_login('ask a new question', '@add_question') ?> 
     5</div> 
    46 
    5 <ul> 
    6   <li><?php echo link_to('popular questions', 'question/list') ?> 
    7   <li><?php echo link_to('latest questions', 'question/recent') ?></li> 
    8   <li><?php echo link_to('latest answers', 'answer/recent') ?></li> 
    9 </ul> 
     7<h2>browse askeet</h2> 
     8<?php echo include_partial('rss_links') ?> 
    109 
    1110<h2>question tags</h2> 
     
    1615 
    1716<?php if ($user->isAuthenticated()): ?> 
    18   <div>Add your own: 
    19     <?php echo form_remote_tag(array( 
    20       'url'    => '@tag_add', 
    21       'update' => 'question_tags', 
    22     )) ?> 
    23       <?php echo input_hidden_tag('question_id', $question->getId()) ?> 
    24       <?php echo input_auto_complete_tag('tag', '', '@tag_autocomplete', 'autocomplete=off', 'use_style=true') ?> 
    25       <?php echo submit_tag('Tag') ?> 
    26     </form> 
     17  <div>add your own: 
     18  <?php echo form_remote_tag(array( 
     19    'url'      => '@tag_add', 
     20    'update'   => 'question_tags', 
     21    'loading'  => "Element.show('indicator'); \$('tag').value = ''", 
     22    'complete' => "Element.hide('indicator');".visual_effect('highlight', 'question_tags'), 
     23  )) ?> 
     24    <?php echo input_hidden_tag('question_id', $question->getId()) ?> 
     25    <?php echo input_auto_complete_tag('tag', '', '@tag_autocomplete', 'autocomplete=off', 'use_style=true') ?> 
     26    <?php echo submit_tag('tag') ?> 
     27  </form> 
    2728  </div> 
    2829<?php endif ?> 
  • trunk/frontend/modules/tag/actions/actions.class.php

    r34 r38  
    1414  { 
    1515    $this->question_pager = QuestionPeer::getPopularByTag($this->getRequestParameter('tag'), $this->getRequestParameter('page', 1)); 
     16 
     17    $this->setTitle('askeet! &raquo; question tagged '.Tag::normalize($this->getRequestParameter('tag'))); 
    1618  } 
    1719 
     
    6769  } 
    6870 
     71  public function executeRemove() 
     72  { 
     73    // disable web debug toolbar 
     74    $this->getRequest()->setAttribute('disable_web_debug', true, 'debug/web'); 
     75 
     76    $this->question = QuestionPeer::getQuestionFromTitle($this->getRequestParameter('stripped_title')); 
     77    $this->forward404Unless($this->question); 
     78 
     79    // remove tag for this user and question 
     80    $user = $this->getUser()->getSubscriber(); 
     81    $tag  = $this->getRequestParameter('tag'); 
     82 
     83    $user->removeTag($this->question, $tag); 
     84 
     85    $this->tags = $this->question->getTags(); 
     86  } 
     87 
    6988  public function executePopular() 
    7089  { 
    7190    $this->tags = QuestionTagPeer::getPopularTags(40); 
     91 
     92    $this->setTitle('askeet! &raquo; popular tags'); 
    7293  } 
    7394} 
  • trunk/frontend/modules/tag/config/view.yml

    r34 r38  
    66  has_layout: off 
    77  slots:      [] 
     8 
     9removeSuccess: 
     10  has_layout: off 
     11  slots:      [] 
  • trunk/frontend/modules/tag/templates/_question_tags.php

    r32 r38  
    1 <?php foreach($tags as $tag): ?> 
    2   <li><?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?></li> 
    3 <?php endforeach ?> 
     1<?php use_helper('Javascript') ?> 
     2 
     3<?php if ($user->isAuthenticated()): ?> 
     4  <?php $user_tags = $user->getSubscriber()->getTagsFor($question) ?> 
     5  <ul> 
     6  <?php foreach ($question->getPopularTags(20) as $tag => $count): ?> 
     7    <li> 
     8      <?php if (isset($user_tags[$tag])): ?> 
     9        <?php echo link_to($user_tags[$tag], '@tag?tag='.$tag, 'rel=tag') ?> 
     10        &nbsp;<?php echo link_to_remote('[x]', array( 
     11          'url'      => '@tag_remove?stripped_title='.$question->getStrippedTitle().'&tag='.$tag, 
     12          'update'   => 'question_tags', 
     13          'loading'  => "Element.show('indicator')", 
     14          'complete' => "Element.hide('indicator');".visual_effect('highlight', 'question_tags'), 
     15        )) ?> 
     16      <?php else: ?> 
     17        <?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?> 
     18      <?php endif ?> 
     19    </li> 
     20  <?php endforeach ?> 
     21  </ul> 
     22<?php else: ?> 
     23  <?php echo include_partial('tag/tag_cloud', array('tags' => QuestionTagPeer::getPopularTagsFor($question))) ?> 
     24<?php endif ?> 
  • trunk/frontend/modules/tag/templates/popularSuccess.php

    r34 r38  
    1 <h2>Popular tags</h2> 
    2 <ul id="tag_cloud"> 
    3   <?php foreach($tags as $tag => $count): ?> 
    4   <li class="tag_popularity_<?php echo $count ?>"><?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?></li> 
    5   <?php endforeach ?> 
    6 </ul> 
     1<h1>Popular tags</h1> 
     2 
     3<?php echo include_partial('tag/tag_cloud', array('tags' => $tags)) ?> 
  • trunk/frontend/modules/tag/templates/showSuccess.php

    r31 r38  
     1<h1>popular questions for tag '<?php echo $request->getParameter('tag') ?>'</h1> 
     2 
    13<?php echo include_partial('question/question_list', array('question_pager' => $question_pager)) ?> 
    24<?php echo pager_navigation($question_pager, '@tag?tag='.$request->getParameter('tag')) ?> 
  • trunk/frontend/modules/user/actions/actions.class.php

    r29 r38  
    5858    $this->answers   = $this->subscriber->getAnswersJoinQuestion(); 
    5959    $this->questions = $this->subscriber->getQuestions(); 
     60 
     61    $this->setTitle('askeet! &raquo; '.$this->subscriber->__toString().'\'s profile'); 
    6062  } 
    6163 
    6264  public function executeLogin() 
    6365  { 
     66    $this->getRequest()->setAttribute('newaccount', false); 
     67 
    6468    if ($this->getRequest()->getMethod() != sfRequest::POST) 
    6569    { 
    6670      // display the form 
    67       $this->getRequest()->getParameterHolder()->set('referer', $this->getRequest()->getReferer()); 
     71      $this->setTitle('askeet! &raquo; sign in / register'); 
     72      $this->getRequest()->getAttributeHolder()->set('referer', $this->getRequest()->getReferer()); 
    6873      return sfView::SUCCESS; 
    6974    } 
     
    122127  } 
    123128 
     129  public function executeAdd() 
     130  { 
     131    // process only POST requests 
     132    if ($this->getRequest()->getMethod() == sfRequest::POST) 
     133    { 
     134      $user = new User(); 
     135      $user->setNickname($this->getRequestParameter('nickname')); 
     136      $user->setEmail($this->getRequestParameter('email')); 
     137      $user->setPassword($this->getRequestParameter('password')); 
     138 
     139      $user->save(); 
     140 
     141      $this->forward('user', 'login'); 
     142    } 
     143 
     144    $this->getRequest()->setAttribute('newaccount', true); 
     145    $this->forward('user', 'login'); 
     146  } 
     147 
    124148  public function handleErrorLogin() 
    125149  { 
    126150    return sfView::SUCCESS; 
     151  } 
     152 
     153  public function handleErrorAdd() 
     154  { 
     155    $this->getRequest()->setAttribute('newaccount', true); 
     156 
     157    return array('user', 'loginSuccess'); 
    127158  } 
    128159 
  • trunk/frontend/modules/user/templates/loginSuccess.php

    <
    r29 r38  
    1 <?php use_helper('Validation') ?> 
    2 <?php echo form_tag('user/login') ?> 
    3   
     1<?php use_helpers('Validation', 'Javascript') ?> 
     2 
     3<h1>sign in / register</h1> 
     4 
     5<div class="in_form"> 
     6  <p>Registration is free and required only to create a new question or rate an answer.</p> 
     7</div> 
     8 
     9<?php echo form_tag($request->getAttribute('newaccount', false) ? '@add_account' : '@login', 'id=login_form class=form') ?> 
     10 
    411  <fieldset> 
    512 
    6   <div class="form-row"> 
    7     <?php echo form_error('nickname') ?> 
    8     <label for="nickname">nickname:</label> 
    9     <?php echo input_tag('nickname', $params->get('nickname')) ?> 
     13  <?php echo form_error('nickname') ?> 
     14  <label for="nickname">nickname:</label> 
     15  <?php echo input_tag('nickname', $params->get('nickname')) ?> 
     16  <br class="clearleft"/> 
     17 
     18  <?php echo form_error('password') ?> 
     19  <label for="password">password:</label> 
     20  <?php echo input_password_tag('password') ?>&nbsp;<?php echo link_to('forgot your password?', '@user_require_password') ?> 
     21  <br class="clearleft"/> 
     22 
     23  <div class="in_form"> 
     24  <?php echo checkbox_tag('new', 1, $request->getAttribute('newaccount', false) ? 1 : 0, array('onclick' => 'toggleForm()')) ?> 
     25  &nbsp;<label for="new" style="display: inline; float: none">click here to create a new account</label> 
    1026  </div> 
    11    
    12   <div class="form-row"> 
    13     <?php echo form_error('password') ?> 
    14     <label for="password">password:</label> 
    15     <?php echo input_password_tag('password') ?> 
     27  <br class="clearleft"/> 
     28 
     29