Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | None | 0 0
  1. <apex:page standardController="Program__c" extensions="commProgramExt" showHeader="true" standardStylesheets="false">
  2.  
  3. <head>
  4.  
  5. <apex:stylesheet value="{!URLFOR($Resource.sldsScoped, 'assets/styles/salesforce-lightning-design-system-vf.min.css')}" />
  6.  
  7. <style>
  8.  
  9. html {
  10. width: 98%;
  11. background: white !important;
  12. height: 100%;
  13. overflow: hidden;
  14. }
  15.  
  16. body, section {
  17. width: 100%;
  18. height: 100%;
  19. background:#FFF !important;
  20. background-color:#FFF !important;
  21. }
  22.  
  23. table {
  24. margin-top: 1rem;
  25. }
  26.  
  27. th {
  28. text-transform: uppercase;
  29. font-size: .875rem;
  30. position: relative;
  31. color: #696969;
  32. max-width: 200px;
  33. border-bottom: 1px solid #d4d4d4;
  34. padding: .5rem .5rem;
  35. text-overflow: ellipsis;
  36. white-space: nowrap;
  37. overflow: hidden;
  38. font-weight: normal;
  39. text-align: left;
  40. background-color: rgb(253, 253, 253);
  41. }
  42.  
  43. thead {
  44. border-bottom: .1rem solid #D4D4D4;
  45. }
  46.  
  47. .txtCenter {
  48. text-align: center !important;
  49. }
  50.  
  51. .scrollable {
  52. overflow-y: scroll;
  53. }
  54.  
  55. ::-webkit-scrollbar-track {
  56. -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
  57. border-radius: 10px;
  58. background-color: #F9F9F9;
  59. }
  60. ::-webkit-scrollbar {
  61. width: 12px;
  62. background-color: #F9F9F9;
  63. }
  64. ::-webkit-scrollbar-thumb {
  65. border-radius: 10px;
  66. -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
  67. background-color: #555;
  68. }
  69.  
  70.  
  71. .slds-button_brand {
  72. background: #0070d2 !important;
  73. color: white !important;
  74. padding: 0 1rem !important;
  75. }
  76.  
  77. .center {
  78. text-align:center;
  79. }
  80.  
  81. .active {
  82. display:block;
  83. }
  84. .inactive {
  85. display:none;
  86. }
  87.  
  88. /* THIS WILL CORRECT THE DISTORTION WHEN PAGE IS EMBEDDED IN COMMUNITY */
  89. /*fix for community*/
  90. .brandQuaternaryBgr, .sfdcBody {
  91. background:#FFF !important;
  92. background-color:#FFF !important;
  93. }
  94. html .brandQuaternaryBgr {
  95. background:#FFF !important;
  96. background-color:#FFF !important;
  97. }
  98. </style>
  99. </head>
  100.  
  101. <body id="pageBody" class="scrollable slds" onload="isCommunity()" >
  102.  
  103. <apex:form >
  104.  
  105. <div class="slds center">
  106. <!--<apex:commandButton value="New Session" action="{ goMkSession}" rerender="table" styleClass="slds-button slds-button_brand" />-->
  107. <button id="mkSession" class="slds-button slds-button_brand" type="button">New Session</button>
  108. </div>
  109.  
  110. <section id="sessionList" class="slds scroll active">
  111.  
  112.  
  113. <table id="table" class="slds-table slds-table_bordered slds-table_cell-buffer">
  114.  
  115. <thead>
  116. <tr class="slds-text-title_caps">
  117. <th scope="col">
  118. <div class="slds-truncate" title="Name">Session Name</div>
  119. </th>
  120. <th scope="col">
  121. <div class="slds-truncate" title="Contact Record Type">Session Date</div>
  122. </th>
  123. <th scope="col">
  124. <div class="slds-truncate txtCenter" title="Confirmed">Total Mentee Sessions</div>
  125. </th>
  126. <th scope="col">
  127. <div class="slds-truncate txtCenter" title="Enrollment Date">Total Mentor Sessions</div>
  128. </th>
  129. </tr>
  130. </thead>
  131.  
  132. <tbody >
  133.  
  134. <apex:repeat var="sesh" value="{!sessions}">
  135. <tr>
  136. <td>
  137. <apex:outputlink target="_blank" value="/{!sesh.Id}">{!sesh.Name}</apex:outputlink>
  138. </td>
  139.  
  140. <td>
  141. <apex:outputfield value="{!sesh.Session_Date__c}" />
  142. </td>
  143.  
  144. <td class="txtCenter">
  145. <apex:outputfield value="{!sesh.Total_Mentee_Sessions__c}" />
  146. </td>
  147.  
  148. <td class="txtCenter">
  149. <apex:outputfield value="{!sesh.Total_Mentor_Sessions__c}" />
  150. </td>
  151. </tr>
  152. </apex:repeat>
  153.  
  154. </tbody>
  155.  
  156. </table>
  157.  
  158. </section>
  159.  
  160. <section id="sessionNew" class="slds scroll inactive" style="margin-top: 1rem;">
  161.  
  162. <div class="center" style="background:#FFF !important">
  163. Program
  164. <apex:inputField value="{!session.Program__c}" />
  165. <br /><br />
  166. Date<br />
  167. <apex:inputField value="{!session.Session_Date__c}" />
  168. <br /><br />
  169.  
  170. <apex:commandButton value="Save" action="{!save}" styleClass="slds-button slds-button_brand" />
  171.  
  172. </div>
  173.  
  174. </section>
  175.  
  176. </apex:form>
  177. </body>
  178. <script>
  179. 'use strict'
  180.  
  181. const getId = (x) => document.getElementById(x)
  182. /*
  183. const isCommunity = () => {
  184. if (String(location.href).toLowerCase().includes('iframe')) {
  185.  
  186. //after testing, assumes we're in a community
  187. console.log('Community')
  188. Array.from(document.getElementsByTagName('body')).map((x) => x.classList.remove('brandQuaternaryBgr'))
  189. Array.from(document.getElementsByTagName('body')).map( x => x.style.background = '#FFF !important' )
  190. }
  191. }
  192. */
  193. const mkSession = (e) => toggle(['sessionList', 'sessionNew'], e.target)
  194.  
  195. const toggle = (arr, elem) => {
  196.  
  197. arr.map(x => {
  198.  
  199. x = getId(x)
  200.  
  201. if(x.classList.contains('active')){
  202. x.classList.remove('active')
  203. x.classList.add('inactive')
  204. }
  205. else {
  206. x.classList.remove('inactive')
  207. x.classList.add('active')
  208. }
  209. })
  210.  
  211. if(elem.innerText == 'New Session'){
  212. elem.innerText = 'Cancel'
  213. elem.classList.remove('slds-button_brand')
  214. elem.classList.add('slds-button_neutral')
  215. }
  216. else {
  217. elem.innerText = 'New Session'
  218. elem.classList.remove('slds-button_neutral')
  219. elem.classList.add('slds-button_brand')
  220. }
  221. }
  222.  
  223. // run logic
  224. //isCommunity()
  225. getId('mkSession').onclick = (e) => mkSession(e)
  226.  
  227. </script>
  228. </apex:page>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement