Przeglądaj źródła

#653 - Burdure de couleur autour zone Thème sur node Formation

Yves Chedemois 13 lat temu
rodzic
commit
934f172ad6
5 zmienionych plików z 139 dodań i 8 usunięć
  1. 65 0
      fgcf.features.content.inc
  2. 1 0
      fgcf.info
  3. 46 1
      fgcf.install
  4. 11 1
      fgcf.module
  5. 16 6
      theme/css/fgcf.css

+ 65 - 0
fgcf.features.content.inc

@@ -900,6 +900,71 @@ o|Oui',
     ),
   );
 
+  // Exported field: field_fgcf_thematique_color
+  $fields['fgcf_thematique-field_fgcf_thematique_color'] = array(
+    'field_name' => 'field_fgcf_thematique_color',
+    'type_name' => 'fgcf_thematique',
+    'display_settings' => array(
+      'weight' => '-3',
+      'parent' => '',
+      'label' => array(
+        'format' => 'above',
+      ),
+      'teaser' => array(
+        'format' => 'hidden',
+        'exclude' => 0,
+      ),
+      'full' => array(
+        'format' => 'hidden',
+        'exclude' => 0,
+      ),
+      '5' => array(
+        'format' => 'default',
+        'exclude' => 0,
+      ),
+      '4' => array(
+        'format' => 'default',
+        'exclude' => 0,
+      ),
+      '2' => array(
+        'format' => 'default',
+        'exclude' => 0,
+      ),
+      '3' => array(
+        'format' => 'default',
+        'exclude' => 0,
+      ),
+      'ad list' => array(
+        'format' => 'default',
+        'exclude' => 0,
+      ),
+      'token' => array(
+        'format' => 'default',
+        'exclude' => 0,
+      ),
+    ),
+    'widget_active' => '1',
+    'type' => 'colorpicker_cck_textfield',
+    'required' => '0',
+    'multiple' => '0',
+    'module' => 'colorpicker_cck',
+    'active' => '1',
+    'widget' => array(
+      'default_value' => array(
+        '0' => array(
+          'value' => '',
+          '_error_element' => 'default_value_widget][field_fgcf_thematique_color][0][value',
+        ),
+      ),
+      'default_value_php' => NULL,
+      'label' => 'Couleur bandeau',
+      'weight' => '-3',
+      'description' => 'Cette couleur sera appliquée sur les contenus \'Fiche de formation\' de ce thème.',
+      'type' => 'colorpicker_cck',
+      'module' => 'colorpicker_cck',
+    ),
+  );
+
   // Exported field: field_fgcf_thematique_logo
   $fields['fgcf_thematique-field_fgcf_thematique_logo'] = array(
     'field_name' => 'field_fgcf_thematique_logo',

+ 1 - 0
fgcf.info

@@ -28,6 +28,7 @@ features[content][] = "fgcf_fiche-field_fgcf_fiche_sanction"
 features[content][] = "fgcf_fiche-field_fgcf_fiche_supports"
 features[content][] = "fgcf_prestataire-field_fgcf_prestataire_link"
 features[content][] = "fgcf_prestataire-field_fgcf_prestataire_logo"
+features[content][] = "fgcf_thematique-field_fgcf_thematique_color"
 features[content][] = "fgcf_thematique-field_fgcf_thematique_logo"
 features[fieldgroup][] = "fgcf_fiche-group_fgcf_fiche_meta"
 features[fieldgroup][] = "fgcf_prestataire-group_prestataire_branding"

+ 46 - 1
fgcf.install

@@ -99,7 +99,7 @@ function fgcf_update_6102() {
 
 /**
  * Deploy feature changes, as per issue #650.
- * 
+ *
  * @return array
  */
 function fgcf_update_6103() {
@@ -125,3 +125,48 @@ function fgcf_update_6104() {
   $ret[] = update_sql($sq);
   return $ret;
 }
+
+/**
+ * Deploy feature changes for 'Thème' color banner on 'Formation' nodes, as per issue #653.
+ *
+ * @return array
+ */
+function fgcf_update_6105() {
+  features_revert();
+  return array();
+}
+
+/**
+ * Save color information in existing Thème nodes, as per issue #653.
+ *
+ * @return array
+ */
+function fgcf_update_6106() {
+  $ret = array();
+
+  $colors = array(
+    // Langue - Communication - Développement personnel
+    303 => '4a4494', // or #b47829 ?
+    // Santé - Sécurité- Permis
+    302 => 'f0bf02',
+    // Informatique - Bureautique
+    301 => 'f0bf02',
+    // Institution des courses
+    300 => '004c37',
+    // Droit - RH - Management
+    299 => '444',
+    // Corps de métiers
+    298 => '00868c',
+    // Espaces verts / Horticulture
+    297 => '496213',
+  );
+
+  foreach ($colors as $nid => $color) {
+    $node = node_load($nid);
+    $node->field_fgcf_thematique_color = array(array('value' => $color));
+    node_save($node);
+    $ret[] = array('success' => TRUE, 'query' => t('Ajout de la couleur sur thème @title.', array('@title' => $node->title)));
+  }
+
+  return $ret;
+}

+ 11 - 1
fgcf.module

@@ -364,7 +364,17 @@ function theme_fgcf_thematiques($terms) {
   $logo = drupal_render($node_view->content['field_fgcf_thematique_logo']);
   array_unshift($items, $logo);
 
-  $ret = '<div class="node-thematique">'. theme('item_list', $items) .'</div>';
+  $color = '';
+  if (isset($cat_node->field_fgcf_thematique_color[0]['value'])) {
+    $color = $cat_node->field_fgcf_thematique_color[0]['value'];
+    // Add '#' prefix if not already present in the value.
+    $color = (strpos($color, '#') !== 0 ? '#' . $color : $color);
+  }
+
+  $ret = '<div class="node-thematique"' . (!empty($color) ? " style=\";border-color: $color\"" : '') . '>';
+  $ret .= theme('item_list', $items);
+  $ret .= '</div>';
+
   return $ret;
 }
 

+ 16 - 6
theme/css/fgcf.css

@@ -29,6 +29,20 @@ body {
   float: right;
   margin: 10px 0 1em 1em;
   padding: 0.5em 0.5em 0.5em 0;
+  /* On précise une couleur par défaut, la couleur réelle, si présente, est ajoutée en 
+     inline style sur l'élément, dans theme_fgcf_thematiques(). */
+  border: 3px solid #aaa;
+}
+.node-thematique .item-list ul {
+  margin: 0;
+}
+.node-thematique .item-list ul li {
+  list-style: none;
+  background-image: none; /* override garland list styling */
+  margin-left: 0;
+}
+.node-thematique .item-list ul li.last {
+  margin-bottom: 0;
 }
 
 /**
@@ -36,11 +50,7 @@ body {
  */
 .node img.imagecache-fgcf_theme_logo_full_default {
   border: none; 
-}
-
-.node-thematique .item-list ul li {
-  list-style: none;
-  background-image: none; /* override garland list styling */
+>>>>>>> 19222eb2f828986dd092762da9e2d27daf2d5f57
 }
 
 /**
@@ -117,4 +127,4 @@ body {
   margin-left: auto;
   margin-right: auto;
   text-align: center;
-}
+}