Bladeren bron

Dashboard : configure wip

carruesco 1 jaar geleden
bovenliggende
commit
da4705710b
3 gewijzigde bestanden met toevoegingen van 21 en 9 verwijderingen
  1. 8 1
      plugin/dashboard/action.php
  2. 4 2
      plugin/dashboard/css/component.css
  3. 9 6
      plugin/dashboard/dashboard.plugin.php

+ 8 - 1
plugin/dashboard/action.php

@@ -113,7 +113,14 @@ Action::register('dashboard_model_search',function(&$response){
 	User::check_access('dashboard','read');
 	require_once(__DIR__.SLASH.'DashboardWidget.class.php');
 	require_once(__DIR__.SLASH.'Dashboard.class.php');
-	$response['rows'] = DashboardWidget::model();
+	$response['rows'] = array();
+	foreach(DashboardWidget::model() as $model){
+		$row = $model->toArray();
+		$row["excerpt"] = truncate($row["description"], $length = 100, array('html'=>true)) ;
+		if($row["description"] == $row["excerpt"]) $row["description"] = '';
+		$row['created'] = date('d-m-Y',$row['created']);
+		$response['rows'][] = $row;
+	}
 	unset($response['rows'][DashboardWidget::MODEL_NEW]);
 });
 

+ 4 - 2
plugin/dashboard/css/component.css

@@ -271,14 +271,16 @@
 	height: calc(100% - 30px); 
 }
 
-.widget-model-chip{
+.dashboard-modal .widget-model-chip{
 	border-radius: 100%;
 	width: 50px;
 	height: 50px;
 	margin: auto;
 	margin-top: 5px;
 	text-align: center;
-	padding-top: 6px;
 	color: #ffffff;
 	background-color: #222222;
+}
+.dashboard-modal .widget-model-chip i {
+    line-height: 50px;
 }

+ 9 - 6
plugin/dashboard/dashboard.plugin.php

@@ -121,9 +121,12 @@ function dashboard_application_bottom(){
 								    <li data-model="{{model}}" class="shadow-sm bg-white hidden">
 								        <h3><div class="widget-model-chip" style="background-color: {{headerBackground
 }};color: {{iconColor}}"><i class="{{icon}}"></i></div> {{label}}</h3>
-								        <p>{{description}}</p>
-								        <i onclick="e.stopPropagation();$(this).next().toggleClass('hidden')" title="plus d'information sur le widget" class="fas fa-info-circle widget-model-info"></i>
-								        <div class="hidden text-muted">{{description}}</div>
+								        <p>{{excerpt}}</p>
+								        <i onclick="event.stopPropagation();$(this).parent().find('.long-description').toggleClass('hidden')" title="plus d'information sur le widget" class="fas fa-info-circle widget-model-info"></i>
+								        <hr/>
+								        <div class="hidden long-description text-muted">{{description}}<br>
+								        	Créé par <i class="fas fa-user"></i> {{creator}} le <i>{{created}}</i>
+								        </div>
 								    </li>
 								</ul>
 						</template>
@@ -198,10 +201,10 @@ function dashboard_application_bottom(){
 
 //Déclation des assets
 Plugin::addCss("/css/main.css");
-Plugin::addCss("/css/component.css?v=1");
+Plugin::addCss("/css/component.css?v=2");
 Plugin::addJs("/js/main.js");
-Plugin::addJs("/js/dashboard.js?v=1");
-Plugin::addJs("/js/component.js?v=1");
+Plugin::addJs("/js/dashboard.js?v=2");
+Plugin::addJs("/js/component.js?v=2");
 
 //Mapping hook / fonctions
 Plugin::addHook("install", "dashboard_install");