DEV: Create new component to reify the user fields (#7655)

DEV: Create new component to reify the user fields (#7655)

diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-field.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-field.hbs
new file mode 100644
index 0000000..cf9e69e
--- /dev/null
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-field.hbs
@@ -0,0 +1,6 @@
+{{#if value }}
+  <div class={{classes}}>
+    <div class='name'>{{name}}</div>
+    <div class='value'>{{value}}</div>
+  </div>
+{{/if}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-user.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-user.hbs
index f555163..f1b08f7 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-user.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-user.hbs
@@ -12,21 +12,19 @@
         {{/if}}
       </div>
     </div>
-    {{#if reviewable.payload.name}}
-      <div class='reviewable-user-details name'>
-        <div class='name'>{{i18n "review.user.name"}}</div>
-        <div class='value'>{{reviewable.payload.name}}</div>
-      </div>
-    {{/if}}
-    <div class='reviewable-user-details email'>
-      <div class='name'>{{i18n "review.user.email"}}</div>
-      <div class='value'>{{reviewable.payload.email}}</div>
-    </div>
+    
+    {{reviewable-field classes='reviewable-user-details name'
+                               name=(i18n 'review.user.name')
+                               value=reviewable.payload.name}}
+    
+    {{reviewable-field classes='reviewable-user-details email'
+                               name=(i18n 'review.user.email')
+                               value=reviewable.payload.email}}
+    
     {{#each userFields as |f|}}
-      <div class='reviewable-user-details user-field'>
-        <div class='name'>{{f.name}}</div>
-        <div class='value'>{{f.value}}</div>
-      </div>
+      {{reviewable-field classes='reviewable-user-details user-field'
+                                 name=f.name
+                                 value=f.value}}
     {{/each}}
   </div>

GitHub sha: c169456e

Hmm the indentation looks off here, is there a certain pattern you’re following?

1 Like

I think my editor is messing with my indentation. Will fix and check why it’s happening.

2 Likes

Fixed here:

1 Like