Browse Source

css: refactor controls--emailSwitch to generic --button

Felix Niklas 9 years ago
parent
commit
9c01acee9b

+ 15 - 0
app/assets/javascripts/app/views/layout_ref/inputs.jst.eco

@@ -2,6 +2,21 @@
   <h1>Inputs</h1>
 
   <div style="max-width: 500px">
+    <h2>Color</h2>
+    <div class="color form-group">
+      <div class="formGroup-label">
+        <label for="background-color"><%- @T('Background color') %></label>
+      </div>
+      <div class="controls controls--button">
+        <input type="text" id="background-color" value="">
+        <div class="controls-button">
+          <div class="controls-button-inner u-clickable">
+            <%- @Icon('eyedropper') %>
+          </div>
+        </div>
+      </div>
+    </div>
+
     <h2>Time</h2>
     <p>A time of the day</p>
     <input type="text" value="14:40" class="time js-timepicker1">

+ 2 - 2
app/assets/javascripts/app/views/layout_ref/merge_customer.jst.eco

@@ -103,13 +103,13 @@
   <div class="merge-target">
     <label>Email</label>
     <div class="merge-value">
-      <div class="primary-email-switch-holder">
+      <div class="controls-button">
         <span class="primary-email-switch-label">nicole.braun@zammad.org</span>
         <input class="primary-email-switch" type="radio" name="merge-primary-email" id="input-1" checked><label for="input-1">main</label>
       </div>
     </div>
     <div class="merge-value">
-      <div class="primary-email-switch-holder">
+      <div class="controls-button">
         <span class="primary-email-switch-label">nicole.mueller@zammad.org</span>
         <input class="primary-email-switch" type="radio" name="merge-primary-email" id="input-2"><label for="input-2">main</label>
       </div>

+ 12 - 8
app/assets/javascripts/app/views/layout_ref/primary_email.jst.eco

@@ -38,11 +38,13 @@
                 <span class="formGroup-metaControl js-addEmail" title="Add Email Address">+</span>
               </div>
 
-              <div class="controls controls--emailSwitch">
+              <div class="controls controls--button">
                 <input class="form-control" id="User_510389_email1" name="email" required="" type="email" value="">
-                <div class="primary-email-switch-holder">
-                  <input class="primary-email-switch" type="radio" name="merge-primary-email" id="User_510389_email1_switch" checked>
-                  <label for="User_510389_email1_switch">primary</label>
+                <div class="controls-button">
+                  <div class="controls-button-inner">
+                    <input class="primary-email-switch" type="radio" name="merge-primary-email" id="User_510389_email1_switch" checked>
+                    <label for="User_510389_email1_switch">primary</label>
+                  </div>
                 </div>
               </div>
             </div>
@@ -53,11 +55,13 @@
                 <span class="formGroup-metaControl js-removeEmail" title="Remove Email Address">&times;</span>
               </div>
 
-              <div class="controls controls--emailSwitch">
+              <div class="controls controls--button">
                 <input class="form-control" id="User_510389_email2" name="email" required="" type="email" value="">
-                <div class="primary-email-switch-holder">
-                  <input class="primary-email-switch" type="radio" name="merge-primary-email" id="User_510389_email2_switch" checked>
-                  <label for="User_510389_email2_switch">primary</label>
+                <div class="controls-button">
+                  <div class="controls-button-inner">
+                    <input class="primary-email-switch" type="radio" name="merge-primary-email" id="User_510389_email2_switch" checked>
+                    <label for="User_510389_email2_switch">primary</label>
+                  </div>
                 </div>
               </div>
             </div>

+ 164 - 169
app/assets/stylesheets/zammad.scss

@@ -1506,190 +1506,198 @@ input.time.time--12 {
   width: 7.5ch;
 }
 
-  .tokenfield.focus {
-    border-color: hsl(200,71%,59%);
-    box-shadow: 0 0 0 3px hsl(201,62%,90%);
-  }
-
-  .richtext.form-control {
-    padding-bottom: 28px;
-  }
+.tokenfield.focus {
+  border-color: hsl(200,71%,59%);
+  box-shadow: 0 0 0 3px hsl(201,62%,90%);
+}
 
-  .richtext.form-control [contenteditable] {
-    height: auto;
-    min-height: 82px;
-    background: none;
-  }
+.richtext.form-control {
+  padding-bottom: 28px;
+}
 
-  .richtext.form-control .attachments.attachments--list:not(:empty) {
-    border-top: 1px solid rgba(0,0,0,.04);
-    white-space: normal;
-    margin: 0 -12px -28px;
-    padding: 25px 20px 21px 72px;
-    position: relative;
-    line-height: 1;
-  }
+.richtext.form-control [contenteditable] {
+  height: auto;
+  min-height: 82px;
+  background: none;
+}
 
-  textarea.form-control {
-    height: 118px;
-  }
+.richtext.form-control .attachments.attachments--list:not(:empty) {
+  border-top: 1px solid rgba(0,0,0,.04);
+  white-space: normal;
+  margin: 0 -12px -28px;
+  padding: 25px 20px 21px 72px;
+  position: relative;
+  line-height: 1;
+}
 
-  select.form-control:not([multiple]) {
-    padding-left: 10px;
-    padding-right: 34px;
-    word-wrap: normal;
-  }
+textarea.form-control {
+  height: 118px;
+}
 
-  .form-control.is-hidden {
-    display: none;
-  }
+select.form-control:not([multiple]) {
+  padding-left: 10px;
+  padding-right: 34px;
+  word-wrap: normal;
+}
 
-  .form-control[disabled], .form-control.is-disabled {
-    cursor: not-allowed;
-    background-color: #fff;
-    color: #d5d5d5;
-    opacity: 1;
-  }
+.form-control.is-hidden {
+  display: none;
+}
 
-  .form-control.form-control--borderless {
-    border: none;
-    padding: 0;
-    line-height: inherit;
-    height: auto;
-    
-    &:focus {
-      box-shadow: none;
-    }
-  }
+.form-control[disabled], .form-control.is-disabled {
+  cursor: not-allowed;
+  background-color: #fff;
+  color: #d5d5d5;
+  opacity: 1;
+}
 
-  .form-control + .icon-arrow-down,
-  .dropdown-arrow {
-    position: absolute;
-    right: 12px;
-    top: 50%;
-    margin-top: -3px;
-    fill: black;
-    opacity: 0.39;
-    width: 13px;
-    height: 7px;
-    @extend .u-unclickable;
+.form-control.form-control--borderless {
+  border: none;
+  padding: 0;
+  line-height: inherit;
+  height: auto;
+  
+  &:focus {
+    box-shadow: none;
   }
+}
 
-  /* 
+.form-control + .icon-arrow-down,
+.dropdown-arrow {
+  position: absolute;
+  right: 12px;
+  top: 50%;
+  margin-top: -3px;
+  fill: black;
+  opacity: 0.39;
+  width: 13px;
+  height: 7px;
+  @extend .u-unclickable;
+}
 
-    Firefox only hack
-    -----------------
+/* 
 
-    Firefox below version 35 doesn't allow us to 
-    hide the dropdown arrow but we want to replace 
-    it with our own icon. So we have to hide our own 
-    icon in Firefox versions under 35.
-    
-    The class is set via Javascript
+  Firefox only hack
+  -----------------
 
-  */
+  Firefox below version 35 doesn't allow us to 
+  hide the dropdown arrow but we want to replace 
+  it with our own icon. So we have to hide our own 
+  icon in Firefox versions under 35.
+  
+  The class is set via Javascript
 
-  html.ff-lt-35 .form-control + .icon-arrow-down,
-  html.ff-lt-35 .dropdown-arrow {
-    display: none;
-  }
+*/
 
-  select::-ms-expand {
-    display: none;
-  }
+html.ff-lt-35 .form-control + .icon-arrow-down,
+html.ff-lt-35 .dropdown-arrow {
+  display: none;
+}
 
-  .has-error .form-control,
-  .has-error .form-control:focus,
-  .has-error .form-control.focus {
-    box-shadow: none;
-    border-color: red !important;
-  }
+select::-ms-expand {
+  display: none;
+}
 
-  input.has-error {
-    box-shadow: none;
-    border-color: red !important;
-  }
+.has-error .form-control,
+.has-error .form-control:focus,
+.has-error .form-control.focus {
+  box-shadow: none;
+  border-color: red !important;
+}
 
-  .help-inline:not(:empty) {
-    color: red;
-    padding: 2px;
-    font-size: 13px;
-  }
+input.has-error {
+  box-shadow: none;
+  border-color: red !important;
+}
 
-  /* use on input[type=radio] */
-  .primary-email-switch {
-    display: none;
+.help-inline:not(:empty) {
+  color: red;
+  padding: 2px;
+  font-size: 13px;
+}
 
-    & + label {
-      font-size: 11px;
-      color: #DBDBDB;
-      cursor: pointer;
-      margin: 0;
-    }
+/* use on input[type=radio] */
+.primary-email-switch {
+  display: none;
 
-    &:checked + label {
-      color: $highlight-color;
-    }
+  & + label {
+    font-size: 11px;
+    color: #DBDBDB;
+    cursor: pointer;
+    margin: 0;
   }
 
-  .primary-email-switch-holder {
-    position: relative;
-    display: flex;
-    
-    .primary-email-switch-label {
-      text-overflow: ellipsis;
-      overflow: hidden;
-      white-space: nowrap;
-    }
-    
-    .primary-email-switch + label {
-      align-self: stretch;
-      padding: 0 5px;
-      display: flex;
-      align-items: center;
-    }
+  &:checked + label {
+    color: $highlight-color;
   }
+}
 
-  .controls--emailSwitch {
-    display: flex;
+.primary-email-switch-label {
+  text-overflow: ellipsis;
+  overflow: hidden;
+  white-space: nowrap;
+}
+
+.primary-email-switch + label {
+  align-self: stretch;
+  padding: 0 5px;
+  display: flex;
+  align-items: center;
+}
+
+.controls--button {
+  display: flex;
+  
+  input,
+  .form-control {
+    flex: 1;
+    border-right: none;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
     
-    .form-control {
-      flex: 1;
-      border-right: none;
-      border-top-right-radius: 0;
-      border-bottom-right-radius: 0;
+    &:focus + .controls-button {
+      .controls-button-inner {
+        border-color: hsl(200,71%,59%);
+      }
       
-      &:focus + .primary-email-switch-holder {
-        label {
-          border-color: hsl(200,71%,59%);
-        }
-        
-        /* 
-
-          fake the form-control outline 
-
-        */
-        &:before {
-          content: "";
-          position: absolute;
-          left: 0;
-          top: -3px;
-          right: -3px;
-          bottom: -3px;
-          background: hsl(201,62%,90%);
-          border-radius: 0 7px 7px 0;
-        }
+      /* 
+
+        fake the form-control outline 
+
+      */
+      &:before {
+        content: "";
+        position: absolute;
+        left: 0;
+        top: -3px;
+        right: -3px;
+        bottom: -3px;
+        background: hsl(201,62%,90%);
+        border-radius: 0 7px 7px 0;
       }
     }
+  }
+}
 
-    .primary-email-switch-holder label {
-      padding: 0 9px;
-      background: white;
-      position: relative;
-      border: 1px solid hsl(0, 0%, 90%);
-      border-radius: 0 3px 3px 0;
-    }
+.controls-button {
+  position: relative;
+  display: flex;
+
+  &.is-active .icon  {
+    fill: $highlight-color;
   }
+}
+
+.controls-button-inner {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  padding: 0 10px;
+  background: white;
+  position: relative;
+  border: 1px solid hsl(0, 0%, 90%);
+  border-radius: 0 3px 3px 0;
+}
 
 .searchfield {
   position: relative;
@@ -7642,24 +7650,11 @@ output {
     height: 100%;
     transform-origin: left top;
     overflow: hidden;
-    
-    &[data-mode=screenshot] iframe,
-    &[data-mode=iframe] img {
-      display: none;
+
+    &.is-picking {
+      cursor: image_url("/assets/images/eyedropper.gif") 0 15, auto;
     }
   }
-  
-  iframe {
-    position: absolute;
-    border: none;
-    left: 0;
-    top: 0;
-    width: 100%;
-    height: 100%;
-    background: white;
-    border-radius: 0 0 5px 5px;
-    pointer-events: none;
-  }
 
   img {
     vertical-align: bottom;