Commits

Jacob Moen committed a0dfca6

Various stuff :)

Comments (0)

Files changed (5)

protected/config/main.php

         'application.helpers.*',
         'application.widgets.*',
         'ext.simpleWorkflow.*',
+        'ext.editable.*',
         'ext.yii-mail.YiiMailMessage',
     ),
 

protected/controllers/IssueController.php

     }
 
     public function actionEditcomment(){
-        $model = Comment::model()->findbyPk((int)$_POST['id']);
-        if(null != $model) {
-            $model->content = $_POST['value'];
-            $model->update_user_id = Yii::app()->user->id;
-            if($model->save()) {
-                echo Yii::app()->textile->textilize($model->content);
-            }
-            else {
-                echo 'Error';
-            }
-        }
+        $es = new EditableSaver('Comment');
+        $es->onBeforeUpdate = function($event) {
+            $event->sender->setAttribute('update_user_id', Yii::app()->user->id);
+        };
+        $es->update();
+        // $model = Comment::model()->findbyPk((int)$_POST['id']);
+        // if(null != $model) {
+        //     $model->content = $_POST['value'];
+        //     $model->update_user_id = Yii::app()->user->id;
+        //     if($model->save()) {
+        //         echo Yii::app()->textile->textilize($model->content);
+        //     }
+        //     else {
+        //         echo 'Error';
+        //     }
+        // }
+        echo Yii::app()->textile->textilize($model->content);
     }
 
     public function actionComment($id) {

protected/modules/user/views/user/registration.php

 </div>
 <?php else: ?>
 
-<div id="page group">
+<div id="page group" class="row-fluid">
+
 <?php echo CHtml::beginForm('','post',array('enctype'=>'multipart/form-data')); ?>
+
     <fieldset class="register">
 
     <h1><?php echo UserModule::t("Registration"); ?></h1>
-	
+
 	<?php echo CHtml::errorSummary($form); ?>
 	<?php echo CHtml::errorSummary($profile); ?>
-	
+
 	<div class="field stacked">
 	<?php echo CHtml::activeLabelEx($form,'username'); ?>
 	<?php echo CHtml::activeTextField($form,'username'); ?>
 	</div>
-	
+
 	<div class="field stacked">
 	<?php echo CHtml::activeLabelEx($form,'password'); ?>
 	<?php echo CHtml::activePasswordField($form,'password'); ?>
 	<?php echo UserModule::t("Minimal password length 4 symbols."); ?>
 	</p>
 	</div>
-	
+
 	<div class="field stacked">
 	<?php echo CHtml::activeLabelEx($form,'verifyPassword'); ?>
 	<?php echo CHtml::activePasswordField($form,'verifyPassword'); ?>
 	</div>
-	
+
 	<div class="field stacked">
 	<?php echo CHtml::activeLabelEx($form,'email'); ?>
 	<?php echo CHtml::activeTextField($form,'email'); ?>
 	</div>
-	
-<?php 
+
+<?php
 		$profileFields=ProfileField::model()->forRegistration()->sort()->findAll();
 		if ($profileFields) {
 			foreach($profileFields as $field) {
 			?>
 	<div class="field stacked">
 		<?php echo CHtml::activeLabelEx($profile,$field->varname); ?>
-		<?php 
+		<?php
 		if ($field->widgetEdit($profile)) {
 			echo $field->widgetEdit($profile);
 		} elseif ($field->range) {
 		}
 		 ?>
 		<?php echo CHtml::error($profile,$field->varname); ?>
-	</div>	
+	</div>
 			<?php
 			}
 		}
 		<br/><?php echo UserModule::t("Letters are not case-sensitive."); ?></p>
 	</div>
 	<?php endif; ?>
-	
+
 	<div class="button-bar group">
 		<?php echo CHtml::submitButton(UserModule::t("Register")); ?>
 	</div>
-    
+
     <div class="note centered"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></div>
 </fieldset>
 <?php echo CHtml::endForm(); ?>

themes/bootstrap/views/issue/_comments.php

 <?php //TODO: check if the user wants the comments in cronological order?    ?>
 <?php $comments = array_reverse($comments); ?>
 <?php $comment_count = count($comments); ?>
-<?php $this->widget('ext.EJeditable.EJeditable', array(
-    'url' => $this->createUrl('issue/editcomment'),
-    'loadurl' => $this->createUrl('issue/getcomment'),
-));?>
+<?php
+//  $this->widget('ext.EJeditable.EJeditable', array(
+//     'url' => $this->createUrl('issue/editcomment'),
+//     'loadurl' => $this->createUrl('issue/getcomment'),
+// ));
+?>
 
 <div id="history">
     <h3>History</h3>
                             <?php endforeach; ?>
                         </ul>
                     <?php endif; ?>
-                    <div class="<?php echo (isset(Yii::app()->user->id)&&(Yii::app()->user->id == $comment->create_user_id)) ? "edit" : "nedit" ?>" id="<?php echo $comment->id; ?>"><?php echo Yii::app()->textile->textilize($comment->content); ?></div>
+                    <div class="<?php echo (isset(Yii::app()->user->id)&&(Yii::app()->user->id == $comment->create_user_id)) ? "edit" : "nedit" ?>" id="<?php echo $comment->id; ?>">
+
+    <?php
+        // $this->widget('bootstrap.widgets.TbEditableField', array(
+        // 'type' => 'textarea',
+        // 'model' => $comment,
+        // 'options' => array(
+        //     'source' => $this->createUrl('issue/getcomment'),
+        //     'pk' => $comment->id,
+        //     ),
+        // 'attribute' => 'content',
+        // 'url' => $this->createUrl('issue/editcomment'), //url for submit data
+        // 'placement' => 'right',
+        // //'enabled' => true
+        // ));
+    ?>
+                        <?php echo Yii::app()->textile->textilize($comment->content); ?>
+                    </div>
                 </dd></dl>
         <hr/>
         </div>

themes/bootstrap/views/issue/index.php

     'filter'=>$model,
     'sortableRows'=>true,
     'responsiveTable' => true,
-    'template' => "{items}{pager}",
+    'template' => "{summary}{items}{pager}",
     'enablePagination' => true,
     'columns'=>array(
             array(