Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

can now add templates to dashboard + fixed resize bug

  • Loading branch information...
commit 5633ee38394d483f0596056b518d194133c69e0f 1 parent 270949a
@rasmusbergpalm authored
View
6 app/controllers/dbviews_controller.php
@@ -21,14 +21,14 @@ function add($dashboard_id, $template = null) {
$this->Dbview->create();
$this->data['Dbview']['name'] = $template;
- $this->data['Dbview']['code'] = file_get_contents(APP.'templates'.DS.'views'.DS.$template.DS.$template.'.js');
+ $this->data['Dbview']['code'] = file_get_contents(APP.'templates'.DS.$template);
$this->data['Dbview']['dashboard_id'] = $dashboard_id;
$this->data['Dbview']['left'] = 100;
$this->data['Dbview']['top'] = 100;
- $this->data['Dbview']['width'] = 300;
+ $this->data['Dbview']['width'] = 400;
$this->data['Dbview']['height'] = 300;
if ($this->Dbview->save($this->data)) {
- $this->Session->setFlash(__('The dbview has been saved', true));
+ $this->Session->setFlash(__('The widget has been added', true));
$this->redirect(array('controller' => 'dashboards','action' => 'view', $dashboard_id));
} else {
$this->Session->setFlash(__('The dbview could not be saved. Please, try again.', true));
View
6 app/views/dashboards/view.ctp
@@ -5,15 +5,15 @@
$id = $dbview['id'];
echo "<div class='dragbox' id='dragbox_$id'
- style='position: relative; left: ".$dbview['left']."px; top: ".$dbview['top']."px; width: ".($dbview['width']+20)."px; height: ".($dbview['height']+40)."px;'>
+ style='position: absolute; z-index: $id; left: ".$dbview['left']."px; top: ".$dbview['top']."px; width: ".($dbview['width'])."px; height: ".($dbview['height'])."px;'>
<div class='header'>
- <span>".$dbview['name']."</span>";
+ <span>&nbsp;</span>";
echo $this->Html->link('X', "/dbviews/delete/$id", array('style' =>'float: right; margin-left: 10px;'));
echo $this->Html->link('edit', "/dbviews/edit/$id", array('style' =>'float: right;', 'class' => 'editlink'));
echo "</div>
- <div class='dragbox-content' id='view$id' style='clear: both; width: ".$dbview['width']."px; height: ".$dbview['height']."px;'>Loading...</div>
+ <div class='dragbox-content' id='view$id' style='clear: both; width: ".($dbview['width']-10)."px; height: ".($dbview['height']-40)."px;'>Loading...</div>
</div>";
}
?>
View
1  app/views/dbviews/add.ctp
@@ -7,6 +7,7 @@
style='float: left; width: 420px; height: 320px;'>
<div class='header' style='cursor: default;'>
<span>$name</span>";
+ echo $this->Html->link('Add', "/dbviews/add/$dashboard_id/$name", array('style' =>'float: right; margin-left: 10px;'));
echo "</div>
<div class='dragbox-content' id='view$id' style='clear: both; width: 400px; height: 300px;'>Loading...</div>
</div>";
Please sign in to comment.
Something went wrong with that request. Please try again.