Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="sg-events-wrapper">
  

   <div class="sg-filter">
      <div class="sg-filter--inline sg-filter__item1">Sort By</div>
      <div class="sg-filter--inline sg-filter__item2 sg-filter__item" v-cloak>

         <select id="select--date" v-model="dateOrder">
            <option selected value="ascending" disabled>- Date -</option>
            <option value="ascending">Ascending</option>
            <option value="descending">Descending</option>
         </select>
      </div>
      <div class="sg-filter--inline sg-filter__item3 sg-filter__item" v-cloak>
         <select id="select--city" v-model="selectedCity">
            <option selected value="none">- City -</option>
            <option v-for="city in eventCities" v-bind:value="city">{{city}}</option>
         </select>
      </div>
      <div class="sg-filter--inline sg-filter__item3 sg-filter__item" v-cloak>
         <select id="select--state" v-model="selectedState">
            <option selected value="none">- State -</option>
            <option v-for="state in eventStates" v-bind:value="state">
               {{state}}
            </option>
            <!--<option value="other">Other</option>-->
         </select>
      </div>
   </div>
   <div class="page-center sg-events__content-wrapper">
     
         <transition-group name="sg-events__list-" tag="div" class="sg-events__list md-grid-3-up sm-grid-2-up xs-grid-1-up">
            <a v-bind:href="event.path" class="grid-cell sg-event" v-for="event in eventsSorted"  :key="event.sortDate" v-if="isInStateAndCity(event.city,event.state)" v-cloak>
               <div class="sg-event__image" v-bind:style="{'background-image': 'url(' + event.featuredImg + ')'}"></div>
               <div class="sg-event__text">
                  <h3 class="sg-event__title text-uppercase">{{event.name}}</h3>
                  <div class="sg-event__details">
                     <div class="sg-event__detail-row" v-if="event.startDate">
                        <strong>DATE:</strong>
                        <span class="sg-event__date">
                           {{event.displayDate}}
                        </span>
                     </div>
                     <div class="sg-event__detail-row" v-if="event.state">
                        <strong>LOCATION:</strong>
                        <span class="sg-event__location">
                          <span v-if="event.city">{{event.city}},</span> {{event.state}}
                        </span>
                     </div>
                     <div class="sg-event__detail-row sg-event__detail-row--booth" v-if="event.booth">
                       <strong>Booth #</strong> {{event.booth}}
                     </div>
                  </div>
               </div>
            </a>
				 </transition-group><!--/.sg-event__list-->
      <div class="sg-event__list__no-results text-center">Sorry There are no upcoming events fitting your criteria<br>
         <button @click="selectedCity='none',selectedState='none'" class="btn-primary" v-if="selectedCity != 'none' && selectedState != 'none'">Reset City and State</button>
      </div>
      

     
 </div> <!--/.page-center-->
 
  </div><!-- /.sg-events-wrapper -->


<!-- these variables have to be generated in the html of the page due to the way the CMS works
They get used as values in vue data.
-->
<script>
 
var events = [{
    path: "events/residuals-biosolids",
    name: "Residuals & Biosolids Conference",
    sortDate: "1536165900000",
    startDate: "4 September 2018",
    endDate: "5 October 2018",
    displayDate: "September 4 - October 5, 2018",
    state: "WI",
    city: "Milwaukee",
    booth: "342",
    featuredImg: "https://cdn2.hubspot.net/hubfs/4299619/event%20thumb.png"
  }, {
    path: "events/bio-expo",
    name: "Biosolid Expo",
    sortDate: "1548979200000",
    startDate: "6 February 2019",
    endDate: "5 March 2019",
    displayDate: "February 6 - March 5, 2019",
    state: "MN",
    city: "Eagan",
    booth: "12",
    featuredImg: ""
  }, {
    path: "events/world-ag-expo",
    name: "World AG Expo",
    sortDate: "1549670400000",
    startDate: "7 February 2019",
    endDate: "2 February 2019",
    displayDate: "February 7 -  2, 2019",
    state: "CA",
    city: "Tulare",
    booth: "3815",
    featuredImg: ""
  }];
  var eventsDesc = [{
    path: "world-ag-expo",
    name: "World AG Expo",
    sortDate: "1549670400000",
    startDate: "7 February 2019",
    endDate: "2 February 2019",
    displayDate: "February 7 -  2, 2019",
    state: "CA",
    city: "Tulare",
    booth: "3815",
    featuredImg: ""
  }, {
    path: "bio-expo",
    name: "Biosolid Expo",
    sortDate: "1548979200000",
    startDate: "6 February 2019",
    endDate: "5 March 2019",
    displayDate: "February 6 - March 5, 2019",
    state: "MN",
    city: "Eagan",
    booth: "12",
    featuredImg: ""
  }, {
    path: "residuals-biosolids",
    name: "Residuals & Biosolids Conference",
    sortDate: "1536165900000",
    startDate: "4 September 2018",
    endDate: "5 October 2018",
    displayDate: "September 4 - October 5, 2018",
    state: "WI",
    city: "Milwaukee",
    booth: "342",
    featuredImg: "https://cdn2.hubspot.net/hub/4299619/hubfs/event%20thumb.png?width=760&name=event%20thumb.png"
  }];
  var selectedStates = ["CA", "MN", "WI" ];
  var selectedCities = ["Eagan", "Milwaukee", "Tulare" ];

</script>


<div class="screenshot">
  <p>Internet Explorer 10 does not show anything, error is <code>'city' is undefined.</code></p>
  <img src="https://spin.d.pr/06yUWu+" alt=""></div>
            
          
!
            
               
  /*
  
  Vue code below
  
  */
  var app = new Vue({
   el: "#sg-events-wrapper",
   data: {
      message: "Hello Vue!",
      dateOrder: "ascending",
      selectedCity:"none",
      selectedState:"none",
/*the data below is pulled from the script tag in the page.*/
      eventCities:selectedCities,
      eventStates:selectedStates,
      eventList: events,
      eventListDesc:eventsDesc,
   },
   computed: {
      eventsSorted:function(){
        /*chooses which server generated list to use for rendering events*/
         if(this.dateOrder=="ascending"){
            return this.eventList;
         }
         else{
            return this.eventListDesc; 
         }
      },
      
   },
   methods:{
     /*handles the visual filtering when someone sets city and or state*/
      isInStateAndCity:function(eventsCity,eventsState){
         var citiesMatch;
         var statesMatch;
         if(eventsCity == this.selectedCity || this.selectedCity=="none"){
            citiesMatch = true;
         }else{
            citiesMatch = false;
         }
         if(eventsState == this.selectedState ||this.selectedState=="none"){
            statesMatch = true;
         }else{
            statesMatch = false;
         }
         if(citiesMatch && statesMatch){
            return true;
         }else{
            return false;
         }
         
      }
      
   }
});
  


            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console